{"problem":{"name":"143. Zoom Meeting","description":{"content":"You're attending an international Zoom call during the Coronavirus quarantine, where the attendees represent many different countries. The zoom call is really long, and to pass the time, you tally how","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269143"},"statements":[{"statement_type":"Markdown","content":"You're attending an international Zoom call during the Coronavirus quarantine, where the attendees represent many different countries. The zoom call is really long, and to pass the time, you tally how many people are from each country.\n\nGiven the list of people and their countries, print the countries, and how many meeting attendees are from each country. Sort the countries first by their number of attendees, and if two countries have an equal number of attendees, sort them alphabetically by the name of the country.\n\nThe first line of input contains a single positive integer $n$: the number of meeting attendees.\n\nThe next $n$ lines each contain a single country name $c$.\n\nIf there are less than five lines of input, output $n$ lines: each country, and it's number of meeting attendees, separated by a space.\n\nOtherwise, output 5 lines: each of the top 5 countries using the sorting method described above, and it's number of meeting attendees, separated by a space.\n\n## Input\n\nThe first line of input contains a single positive integer $n$: the number of meeting attendees.The next $n$ lines each contain a single country name $c$.\n\n## Output\n\nIf there are less than five lines of input, output $n$ lines: each country, and it's number of meeting attendees, separated by a space.Otherwise, output 5 lines: each of the top 5 countries using the sorting method described above, and it's number of meeting attendees, separated by a space.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of attendees.  \nLet $ C = (c_1, c_2, \\dots, c_n) $ be a sequence of country names, where each $ c_i \\in \\mathcal{C} $ and $ \\mathcal{C} $ is the set of all possible country names.\n\nDefine the frequency function $ f: \\mathcal{C} \\to \\mathbb{Z}^+ $ such that $ f(x) = |\\{ i \\mid c_i = x \\}| $.\n\nLet $ S = \\{ (x, f(x)) \\mid x \\in \\mathcal{C}, f(x) > 0 \\} $ be the set of country-frequency pairs.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq \\infty $ (practically bounded by input size)  \n2. Each $ c_i $ is a non-empty string representing a country name.\n\n**Objective**  \nSort $ S $ by:  \n- Primary: descending order of frequency $ f(x) $  \n- Secondary: ascending alphabetical order of country name $ x $ (for ties in frequency)  \n\nIf $ n < 5 $, output all $ |S| $ pairs in sorted order.  \nOtherwise, output the top 5 pairs from the sorted $ S $.  \n\nEach output line is of the form: $ x \\; f(x) $, where $ x $ is the country name and $ f(x) $ is its count.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269143","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}