{ "0": { "COOK82A": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2\nBarcelona 2\nMalaga 1\nRealMadrid 1\nEibar 0\nMalaga 3\nRealMadrid 2\nBarcelona 8\nEibar 6", "output": "RealMadrid\nBarcelona", "explanation": "" } ], "problem_statement": "Read problems statements in mandarin chinese, russian and vietnamese as well.\nToday is the final round of La Liga, the most popular professional football league in the world. Real Madrid is playing against Malaga and Barcelona is playing against Eibar. These two matches will decide who wins the league title. Real Madrid is already 3 points ahead of Barcelona in the league standings. In fact, Real Madrid will win the league title, except for one scenario: If Real Madrid loses against Malaga, and Barcelona wins against Eibar, then the La Liga title will go to Barcelona. In any other combination of results, Real Madrid will win the title.\nYou will be given multiple scenarios for these two games, where in each one you will be given the number of goals each team scored in their respective match. A team wins a match if it scores more than the opponent. In case they score the same number of goals, it's a draw. Otherwise, the team loses the game. You are asked to tell the winner of the La Liga title in each scenario.\nInput\n\nThe first line contains a single number T, the number of scenarios.\nEach scenario is described by four lines. Each line starts with a team name followed by the number of goals this team scored in its corresponding match. (Barcelona plays Eibar and Real Madrid plays Malaga). The names are given in any arbitrary order within a scenario.\nOutput\nFor each scenario, output a single line showing the title winner in case this scenario happens. It should be either \"RealMadrid\" or \"Barcelona\".\nConstraints\n\n1 \u2264 T \u2264 500\n0 \u2264 number of goals scored by a team in a match \u2264 20", "input_format": "", "output_format": "", "problem_name": "La Liga", "user_tags": [ "cakewalk", "cook82", "deadwing97" ], "computed_tags": [], "problem_code_id": "COOK82A", "difficulty_level": "956", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n scores = {}\n for _ in range(4):\n team, goals = input().split()\n scores[team] = int(goals)\n if scores['RealMadrid'] < scores['Malaga'] and scores['Barcelona'] > scores['Eibar']:\n print('Barcelona')\n else:\n print('RealMadrid')", "def la_liga_winner(T, matches):\n for match in matches:\n scores = {}\n for team, goals in match.items():\n scores[team] = goals\n if scores['RealMadrid'] < scores['Malaga'] and scores['Barcelona'] > scores['Eibar']:\n print('Barcelona')\n else:\n print('RealMadrid')\n\nT = int(input())\nmatches = []\nfor _ in range(T):\n match = {}\n for _ in range(4):\n team, goals = input().split()\n match[team] = int(goals)\n matches.append(match)\nla_liga_winner(T, matches)" ], "human_solutions": [ { "id": 34319254, "submission_date": 1592061727, "language": "PYTH 3", "username": "hatimhussain", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 34319254, "code": "for scenario in range(int(input())):\n teams = dict()\n for i in range(4):\n key, val = input().strip().split()\n teams[key] = int(val)\n print('Barcelona') if teams['Barcelona']>teams['Eibar'] and teams['RealMadrid']d[\"Eibar\"] and d[\"RealMadrid\"]0:\n n, k = list(map(int, input().strip().split(' ')))\n print(result(n-1, k-1))\n t=t-1" } ] }, "PLAYPIAN": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "4\nAB\nABBA\nABAABB\nAA", "output": "yes\nyes\nno\nno", "explanation": "Testcase 1: There is only one day, and both A and B have played exactly once. So this is a valid log. Hence 'yes'.\nTestcase 2: On the first day, A has played before B, and on the second day, B has played first. Hence, this is also a valid log.\nTestcase 3: On the first day, A played before B, but on the second day, A seems to have played twice. This cannot happen, and hence this is 'no'." } ], "problem_statement": "Two sisters, A and B, play the piano every day. During the day, they can play in any order. That is, A might play first and then B, or it could be B first and then A. But each one of them plays the piano exactly once per day. They maintain a common log, in which they write their name whenever they play.\nYou are given the entries of the log, but you're not sure if it has been tampered with or not. Your task is to figure out whether these entries could be valid or not.\nInput\n\nThe first line of the input contains an integer $T$ denoting the number of test cases. The description of the test cases follows.\nThe first line of each test case contains a string $s$ denoting the entries of the log.\n\nOutput\n\nFor each test case, output yes or no according to the answer to the problem.\n\nConstraints\n\n$1 \\le T \\le 500$\n$2 \\le |s| \\le 100$\n$|s|$ is even\nEach character of $s$ is either 'A' or 'B'", "input_format": "", "output_format": "", "problem_name": "Play Piano", "user_tags": [ "ad-hoc" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "PLAYPIAN", "difficulty_level": "980", "ai_solutions": [], "human_solutions": [ { "id": 36129212, "submission_date": 1596189197, "language": "PYTH 3", "username": "frundemprador", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 36129212, "code": "for _ in range(int(input())):\n s = input()\n flag = True\n for i in range(0,len(s),2):\n if s[i:i+2]==\"AA\" or s[i:i+2]==\"BB\":\n flag = False\n break\n if flag==False:\n print(\"no\")\n else:\n print(\"yes\")\n \n" }, { "id": 36102467, "submission_date": 1596054362, "language": "PYTH 3", "username": "chris_mcclinch", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 36102467, "code": "T = int(input())\nfor tc in range(T):\n log = input()\n segments = []\n for i in range(len(log)):\n if i % 2 == 0:\n segments.append(log[i:i+2])\n if 'AA' in segments or 'BB' in segments:\n print('no')\n else:\n print(\"yes\")" } ] }, "UWCOI21A": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "5\n1\n3\n5\n8\n10", "output": "1 1\n1 3\n1 5\n1 8\n2 5\n", "explanation": "" } ], "problem_statement": "Salmon has some hidden numbers that he wants you to find!\nGiven an integer $N$, find and output any two integers A and B such that:\n* $1 \\le A, B \\le 10^9$, and\n* $A*B = N$.\nInput:\nThe first line of input consists of a single integer $T$ ($1 \\le T \\le 10^5$) -- the number of testcases.\nThe next $T$ lines will consist of one integer, $N$ ($1 \\le\u00a0N \\le 10^9$).\nOutput:\nFor each of the $T$ testcases, output two space-separated integers $A$ and $B$.\nSubtasks\n\nSubtask 1 [100 points]: No additional constraints.", "input_format": "", "output_format": "", "problem_name": "Hidden Numbers", "user_tags": [ "Basic Maths", "Observation" ], "computed_tags": [ "Mathematics", "Algorithms" ], "problem_code_id": "UWCOI21A", "difficulty_level": "917", "ai_solutions": [], "human_solutions": [ { "id": 1027952055, "submission_date": 1698772916, "language": "PYTH 3", "username": "harshcodes10", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.35", "memory": "8.7M", "solution": 1027952055, "code": "\r\nt = int(input())\r\nfor i in range(t):\r\n N = int(input())\r\n A = 1 \r\n B = N // A \r\n \r\n print(A,B)" }, { "id": 1027531052, "submission_date": 1698488574, "language": "PYTH 3", "username": "csm_22h51a66e5", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.39", "memory": "8.5M", "solution": 1027531052, "code": "t=int(input())\r\nfor i in range(t):\r\n n=int(input())\r\n a=1 \r\n b=n//a\r\n print(a,' ',b)\r\n \r\n" } ] }, "JDELAY": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\n5\n1 3\n4 4\n4 10\n1 11\n2 7", "output": "2", "explanation": "Example case 1: The delays of the respective submissions are $2$ minutes, $0$ minutes, $6$ minutes, $10$ minutes and $5$ minutes. Only submissions $3$ and $4$ are delayed by more than $5$ minutes, hence the answer is $2$." } ], "problem_statement": "Read problems statements Bengali , Mandarin chinese , Russian and Vietnamese as well.\nYou have been recently hired as a developer in CodeChef. Your first mission is to implement a feature that will determine the number of submissions that were judged late in a contest.\nThere are $N$ submissions, numbered $1$ through $N$. For each valid $i$, the $i$-th submission was submitted at time $S_i$ and judged at time $J_i$ (in minutes). Submitting and judging both take zero time. Please determine how many submissions received their verdicts after a delay of more than $5$ minutes.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first line of the input contains a single integer $N$.\n$N$ lines follow. For each valid $i$, the $i$-th of these lines contains two space-separated integers $S_i$ and $J_i$.\n\nOutput\nFor each test case, print a single line containing one integer \u2014 the number of submissions for which the judging was delayed by more than 5 minutes.\nConstraints\n\n$1 \\le T \\le 100$\n$1 \\le N \\le 100$\n$1 \\le S_i \\le J_i \\le 300$ for each valid $i$\n\nSubtasks\nSubtask #1 (100 points): original constraints", "input_format": "", "output_format": "", "problem_name": "Judging Delay", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "JDELAY", "difficulty_level": "964", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N = int(input())\n late_submissions = 0\n for _ in range(N):\n S, J = map(int, input().split())\n if J - S > 5:\n late_submissions += 1\n print(late_submissions)", "T = int(input())\nfor _ in range(T):\n N = int(input())\n submissions = [list(map(int, input().split())) for _ in range(N)]\n print(sum(1 for S, J in submissions if J - S > 5))" ], "human_solutions": [ { "id": 30760886, "submission_date": 1585227190, "language": "PYTH 3", "username": "tejasri53", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.03", "memory": "17.6M", "solution": 30760886, "code": "t=int(input())\nwhile(t):\n n=int(input())\n c=0\n while(n):\n a,b=map(int,input().split())\n if b-a>5:\n c+=1\n n-=1\n print(c)\n t-=1\n" }, { "id": 30709868, "submission_date": 1585053659, "language": "PYTH 3", "username": "harshita99", "user_rating_star": 3, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.03", "memory": "17.6M", "solution": 30709868, "code": "t=int(input())\nfor i in range(t):\n n=int(input())\n count=0\n\n for ppoo in range(n):\n s,j=map(int,input().split())\n if j-s>5:\n count+=1\n print(count)\n \n " } ] }, "CO92JUDG": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\n5\n3 1 3 3 4\n1 6 2 5 3\n5\n1 6 2 5 3\n3 1 3 3 4\n3\n4 1 3\n2 2 7", "output": "Alice\nBob\nDraw", "explanation": "Example case 1: Alice will choose the finish time in the last race to be considered zero, which means her sum of finish times is 3 + 1 + 3 + 3 + 0 = 10, while Bob will choose the finish time of his second race to be considered zero, so his total sum of finish times is 1 + 0 + 2 + 5 + 3 = 11. Since Alice's sum is smaller, she is considered the winner.\nExample case 2: We're dealing with the same situation as in the previous case, but finish times for the players are swapped, so Bob wins this time.\nExample case 3: Alice will choose the finish time of the first race to be considered zero, which means her total time is 0 + 1 + 3 = 4. Bob will choose the finish time of his last race to be considered zero, which makes his total time 2 + 2 + 0 = 4. The competition is considered a draw because both players have equal sums of finish times." } ], "problem_statement": "Read problems statements in Mandarin chinese, Russian and Vietnamese as well.\nChef is the judge of a competition. There are two players participating in this competition \u2014 Alice and Bob.\nThe competition consists of N races. For each i (1 \u2264 i \u2264 N), Alice finished the i-th race in Ai minutes, while Bob finished it in Bi minutes. The player with the smallest sum of finish times wins. If this total time is the same for Alice and for Bob, a draw is declared.\nThe rules of the competition allow each player to choose a race which will not be counted towards their total time. That is, Alice may choose an index x and her finish time in the race with this index will be considered zero; similarly, Bob may choose an index y and his finish time in the race with this index will be considered zero. Note that x can be different from y; the index chosen by Alice does not affect Bob's total time or vice versa.\nChef, as the judge, needs to announce the result of the competition. He knows that both Alice and Bob play optimally and will always choose the best option. Please help Chef determine the result!\nInput\n\nThe first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.\nThe first line of each test case contains a single integer N.\nThe second line contains N space-separated integers A1, A2, ..., AN.\nThe third line contains N space-separated integers B1, B2, ..., BN.\n\nOutput\nFor each test case, print a single line containing the string \"Alice\" if Alice wins, \"Bob\" if Bob wins or \"Draw\" if the result is a draw (without quotes).\nConstraints\n\n1 \u2264 T \u2264 100\n2 \u2264 N \u2264 100\n1 \u2264 Ai \u2264 1000 for each valid i\n1 \u2264 Bi \u2264 1000 for each valid i", "input_format": "", "output_format": "", "problem_name": "Chef Judges a Competition", "user_tags": [ "ad-hoc" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "CO92JUDG", "difficulty_level": "984", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N = int(input())\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n A.remove(max(A))\n B.remove(max(B))\n sum_A = sum(A)\n sum_B = sum(B)\n if sum_A < sum_B:\n print(\"Alice\")\n elif sum_A > sum_B:\n print(\"Bob\")\n else:\n print(\"Draw\")", "T = int(input())\nfor _ in range(T):\n N = int(input())\n A = sorted(list(map(int, input().split())))\n B = sorted(list(map(int, input().split())))\n A.pop()\n B.pop()\n sum_A = sum(A)\n sum_B = sum(B)\n if sum_A < sum_B:\n print(\"Alice\")\n elif sum_A > sum_B:\n print(\"Bob\")\n else:\n print(\"Draw\")" ], "human_solutions": [ { "id": 33057411, "submission_date": 1589365207, "language": "PYTH 3", "username": "venky13", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 33057411, "code": "for i in range(int(input())):\n\tx=int(input())\n\ta=list(map(int,input().split()))\n\tb=list(map(int,input().split()))\n\ta.sort()\n\tb.sort()\n\ta.pop(-1)\n\tb.pop(-1)\n\tc=sum(a)\n\td=sum(b)\n\tif c>d:\n\t\tprint('Bob')\n\telif d>c:\n\t\tprint('Alice')\n\telif c==d:\n\t\tprint('Draw')" }, { "id": 33041017, "submission_date": 1589286997, "language": "PYTH 3", "username": "sameer_kousik", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 33041017, "code": "def call():\n n = int(input())\n A = [int(x) for x in input().split()]\n B = [int(x) for x in input().split()]\n tA = sum(A)-max(A)\n tB = sum(B)-max(B)\n if(tA0 :\n n,a,b=map(int,input().split())\n x=list(map(int,input().split()))\n print((x.count(a)*x.count(b))/(n*n))\n t-=1" } ] }, "SNAPE": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\n4 5\n10 12\n10 20", "output": "3.0 6.40312\n6.63325 15.6205\n17.3205 22.3607", "explanation": "" } ], "problem_statement": "Read problems statements in Mandarin Chinese and Russian as well.\n\n\nProfessor Snape has lots of potions. Bottles containing all types of potions are stacked on shelves which cover the entire wall from floor to ceiling. Professor Snape has broken his bones several times while climbing the top shelf for retrieving a potion. He decided to get a ladder for him. But he has no time to visit Diagon Alley. So he instructed Ron Weasley to make a ladder for him. Professor Snape specifically wants a step ladder which looks like an inverted 'V' from side view.\nProfessor just mentioned two things before vanishing-\n\nB - separation between left side (LS) and right side (RS) on the ground\nLS - the length of left side\nWhat should be the length of RS? At one extreme LS can be vertical and at other RS can be vertical. Ron is angry and confused. Since Harry is busy battling Voldemort, its your duty to help him find the minimum and maximum length of RS.\nInput\nFirst line contains single integer T, the number of test cases. Then T lines follow each containing 2 integers - B and LS.\nOutput\nOutput T lines, each containing minimum value of RS and maximum value of RS, separated by space. The answer (RS) will be considered correct if it has relative and absolute error less than 10-2.\nConstraints\n1 \u2264 T \u2264 10001 \u2264 B LS \u2264 1000", "input_format": "", "output_format": "", "problem_name": "Snape and Ladder", "user_tags": [ "cakewalk", "cook45", "geometry", "implementation", "vinay_adm" ], "computed_tags": [], "problem_code_id": "SNAPE", "difficulty_level": "828", "ai_solutions": [], "human_solutions": [ { "id": 35914211, "submission_date": 1595659707, "language": "PYTH 3", "username": "aman_ravan02", "user_rating_star": 3, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 35914211, "code": "from math import *\r\nfor j in range(int(input())):\r\n a,b=map(int,input().split())\r\n c=sqrt(abs(a**2-b**2))\r\n d=sqrt(a**2+b**2)\r\n print(c,d)" }, { "id": 35556282, "submission_date": 1594573607, "language": "PYTH 3", "username": "rishav_mz", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 35556282, "code": "import math\nt = int(input())\nfor t1 in range(t):\n a, b = input().split()\n a , b = int(a) , int(b)\n print(math.sqrt(b*b - a*a), math.sqrt(b*b + a*a))" } ] }, "CCOOK": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "7\n0 0 0 0 0\n0 1 0 1 0\n0 0 1 0 0\n1 1 1 1 1\n0 1 1 1 0\n0 1 1 1 1\n1 1 1 1 0", "output": "Beginner\nMiddle Developer\nJunior Developer\nJeff Dean\nSenior Developer\nHacker\nHacker", "explanation": "The first contestant has no solved problems, therefore he is a beginner. The second contestant solved 2 problems (the second and fourth problem), therefore he has the skills of a middle developer. The third contestant solved 1 problem, therefore he's at the expected level of a junior developer. The fourth contestant solved 5 problems \u2014 we can guess it was Jeff Dean. The fifth contestant solved 3 problems, so he is a senior developer. And the last two contestants should be hackers because they solved exactly 4 problems each." } ], "problem_statement": "Read problems statements in Mandarin chinese, Russian and Vietnamese as well.\nChef has obtained the results of a past Cook-Off. He wants to estimate the skill level of each contestant. The contestants can be classified with high probability (w.h.p.) based on the number of solved problems:\n\n\nA contestant that solved exactly 0 problems is a beginner.\nA contestant that solved exactly 1 problem is a junior developer.\nA contestant that solved exactly 2 problems is a middle developer.\nA contestant that solved exactly 3 problems is a senior developer.\nA contestant that solved exactly 4 problems is a hacker.\nA contestant that solved all five problems is Jeff Dean.\n\nPlease help Chef to identify the programming level of each participant.\nInput\n\nThe first line of the input contains a single integer N denoting the number of competitors.\nN lines follow. The i-th of these lines contains five space-separated integers Ai, 1, Ai, 2, Ai, 3, Ai, 4, Ai, 5. The j-th of these integers (1 \u2264 j \u2264 5) is 1 if the i-th contestant solved the j-th problem and 0 otherwise.\n\nOutput\nFor each participant, print a single line containing one string denoting Chef's classification of that contestant \u2014 one of the strings \"Beginner\", \"Junior Developer\", \"Middle Developer\", \"Senior Developer\", \"Hacker\", \"Jeff Dean\" (without quotes).\nConstraints\n\n1 \u2264 N \u2264 5000\n0 \u2264 Ai, j \u2264 1 for each valid i, j", "input_format": "", "output_format": "", "problem_name": "Chef and Cook-Off", "user_tags": [ "Case work", "Conditional Statements" ], "computed_tags": [ "Special", "Basic Programming Concepts" ], "problem_code_id": "CCOOK", "difficulty_level": "961", "ai_solutions": [ "N = int(input())\nfor _ in range(N):\n problems_solved = sum(map(int, input().split()))\n if problems_solved == 0:\n print(\"Beginner\")\n elif problems_solved == 1:\n print(\"Junior Developer\")\n elif problems_solved == 2:\n print(\"Middle Developer\")\n elif problems_solved == 3:\n print(\"Senior Developer\")\n elif problems_solved == 4:\n print(\"Hacker\")\n else:\n print(\"Jeff Dean\")", "N = int(input())\nclassification = [\"Beginner\", \"Junior Developer\", \"Middle Developer\", \"Senior Developer\", \"Hacker\", \"Jeff Dean\"]\nfor _ in range(N):\n problems_solved = sum(map(int, input().split()))\n print(classification[problems_solved])" ], "human_solutions": [ { "id": 34640789, "submission_date": 1592830033, "language": "PYTH 3", "username": "alekhya77", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.03", "memory": "17.6M", "solution": 34640789, "code": "def EstimateSkill(points) :\n count = points.count(1)\n \n if count == 0:\n return \"Beginner\"\n elif count == 1:\n return \"Junior Developer\"\n elif count == 2:\n return \"Middle Developer\"\n elif count == 3:\n return \"Senior Developer\"\n elif count == 4:\n return \"Hacker\"\n else:\n return \"Jeff Dean\"\n \n \nLIMIT = int(input()) \n\nwhile LIMIT > 0 :\n LIMIT -= 1 \n points = list(map(int, input().split()))\n print(EstimateSkill(points))" }, { "id": 34557350, "submission_date": 1592716635, "language": "PYTH 3", "username": "anjana_13", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.04", "memory": "17.6M", "solution": 34557350, "code": "for i in range(int(input())):\n count=0\n l=list(map(int,input().split()))\n for num in l:\n if num==1:\n count+=1\n if count==0:\n print(\"Beginner\")\n elif count==1:\n print(\"Junior Developer\")\n elif count==2:\n print( \"Middle Developer\")\n elif count==3:\n print(\"Senior Developer\")\n elif count==4:\n print(\"Hacker\")\n elif count==5:\n print( \"Jeff Dean\")" } ] }, "CHFINTRO": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2 1500\r\n1499\r\n1501", "output": "Bad boi\r\nGood boi", "explanation": "" } ], "problem_statement": "Read problems statements Hindi , Vietnamese , Mandarin Chinese , Russian and Bengali as well.\n\"Every beginning has an end... and an editorial.\" - taran_1407\nWhat the hell are all these interactive problems? What does flushing output mean? So many questions... Chef explains it in an easy way: you must communicate with a grader program, which accepts your input only if you flushed the output.\nThere is a contest with interactive problems where $N$ people participate. Each contestant has a known rating. Chef wants to know which contestants will not forget to flush the output in interactive problems. Fortunately, he knows that contestants with rating at least $r$ never forget to flush their output and contestants with rating smaller than $r$ always forget to do it. Help Chef!\nInput\n\nThe first line of the input contains two space-separated integers $N$ and $r$.\nEach of the following $N$ lines contains a single integer $R$ denoting the rating of one contestant.\n\nOutput\nFor each contestant, print a single line containing the string \"Good boi\" if this contestant does not forget to flush the output or \"Bad boi\" otherwise.\nConstraints\n\n$1 \\le N \\le 1,000$\n$1,300 \\le r, R \\le 1,501$\n\nSubtasks\nSubtask #1 (100 points): original constraints", "input_format": "", "output_format": "", "problem_name": "Chef and Interactive Contests", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "CHFINTRO", "difficulty_level": "951", "ai_solutions": [ "N, r = map(int, input().split())\nfor _ in range(N):\n R = int(input())\n if R >= r:\n print(\"Good boi\")\n else:\n print(\"Bad boi\")", "N, r = map(int, input().split())\nratings = [int(input()) for _ in range(N)]\nfor rating in ratings:\n print(\"Good boi\" if rating >= r else \"Bad boi\")" ], "human_solutions": [ { "id": 32660422, "submission_date": 1588580813, "language": "PYTH 3", "username": "surya_22", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 32660422, "code": "t,n=map(int,input().split())\nfor i in range(t):\n m=int(input())\n if m>=n:\n print('Good boi')\n else:\n print('Bad boi')" }, { "id": 37578872, "submission_date": 1599466185, "language": "PYTH 3", "username": "jomsaiadarsh", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "\\/misc\\/icons\\/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 37578872, "code": "n,r=list(map(int,input().split()))\nfor i in range(n):\n s=int(input())\n if(s>=r):\n print(\"Good boi\");\n else:\n print(\"Bad boi\");" } ] } }, "1": { "CHEFCBA": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1 2 4 2", "output": "Possible", "explanation": "By swapping 4 and the second 2, we get 1 2 2 4. Note that 1 2 2 4 make proportion as 1 : 2 = 2 : 4. Hence answer is \"Possible\"" } ], "problem_statement": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well.\nChef recently learned about ratios and proportions. He wrote some positive integers a, b, c, d on a paper. Chef wants to know whether he can shuffle these numbers so as to make some proportion? Formally, four numbers x, y, z, w are said to make a proportion if ratio of x : y is same as that of z : w.\nInput\nOnly line of the input contains four space separated positive integers - a, b, c, d.\nOutput\nPrint \"Possible\" if it is possible to shuffle a, b, c, d to make proportion, otherwise \"Impossible\" (without quotes).\nConstraints\n\n1 \u2264 a, b, c, d \u2264 1000", "input_format": "", "output_format": "", "problem_name": "Chef and Proportion", "user_tags": [ "Brute Force" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "CHEFCBA", "difficulty_level": "1122", "ai_solutions": [ "def check_proportion(a, b, c, d):\n if a/b == c/d or a/c == b/d or a/d == b/c:\n return \"Possible\"\n else:\n return \"Impossible\"\n\na, b, c, d = map(int, input().split())\nprint(check_proportion(a, b, c, d))", "def check_proportion(a, b, c, d):\n numbers = [a, b, c, d]\n numbers.sort()\n if numbers[0]/numbers[1] == numbers[2]/numbers[3]:\n return \"Possible\"\n else:\n return \"Impossible\"\n\na, b, c, d = map(int, input().split())\nprint(check_proportion(a, b, c, d))" ], "human_solutions": [ { "id": 34469102, "submission_date": 1592323513, "language": "PYTH 3", "username": "thecodinghero", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 34469102, "code": "a = [int(i) for i in input().split() if i.isdigit()]\na.sort();\nif a[0] * a[3] == a[1] * a[2]:\n print(\"Possible\")\nelse:\n print(\"Impossible\")\n " }, { "id": 33617102, "submission_date": 1591264195, "language": "PYTH 3", "username": "naveenrathore", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.5M", "solution": 33617102, "code": "lst = list(map(int, input().split()))\nlst.sort()\nif lst[0] / lst[1] == lst[2] / lst[3]:\n print(\"Possible\")\nelse:\n print(\"Impossible\")\n\n" } ] }, "RNDPAIR": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\n4\n3 3 3 3\n6\n1 1 1 2 2 2\n4\n1 2 2 3", "output": "1.00000000\n0.20000000\n0.33333333", "explanation": "" } ], "problem_statement": "Read problems statements in Russian and Vietnamese as well.\nChefu is Chef's little brother, he is 12 years old and he is new to competitive programming.\nChefu is practicing very hard to become a very skilled competitive programmer and win gold medal in IOI.\nNow Chefu is participating in a contest and the problem that he is trying to solve states:\nGiven an array A of N integers, find any i, j such that i j \n and Ai + Aj is maximum possible \nunfortunately, there's no much time left before the end of the contest, so Chefu doesn't have time to think of correct solution, so instead, he wrote a solution that selects a random pair (i, j) (i j) and output Ai + Aj. each pair is equiprobable to be selected.\nNow Chefu wants your help to calculate the probability that his solution will pass a particular input.\n\u00a0\nInput\nFirst line contains an integer T denoting the number of test-cases.\nFirst line of each test-case contains a single integer N\nSecond line of each test-case contains N space-separated integers A1 A2 ... AN\n\u00a0\nOutput\nFor each test-case output a single line containing a single number denoting the probability that Chefu's solution to output a correct answer. your answer will be accepted if the absolute difference between it and correct answer is less than 1e-6\nConstraints\n1 \u2264 T \u2264 100\n2 \u2264 N \u2264 100\n1 \u2264 Ai \u2264 1,000", "input_format": "", "output_format": "", "problem_name": "Random Pair", "user_tags": [ "Probability", "Brute Force", "Implementation" ], "computed_tags": [ "Mathematics", "Algorithms" ], "problem_code_id": "RNDPAIR", "difficulty_level": "1174", "ai_solutions": [], "human_solutions": [ { "id": 33388777, "submission_date": 1590643052, "language": "PYTH 3", "username": "ansuman_333", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.5M", "solution": 33388777, "code": "t=int(input())\nfor _ in range(t):\n n=int(input())\n li=list(map(int, input().split()))\n a=[]\n b=0\n for i in range(n):\n for j in range(i+1,n):\n b=li[i]+li[j]\n a.append(b)\n max_count=max(a)\n c=a.count(max_count)\n print(\"%.8f\"% (c/len(a)))" }, { "id": 33351058, "submission_date": 1590476873, "language": "PYTH 3", "username": "vishal_2", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 33351058, "code": "for _ in range(int(input())):\n\tn = int(input())\n\tli = [int(i) for i in input().split()]\n\td = n*(n-1)/2\n\tma = 0\n\tl = 0\n\tfor i in range(n):\n\t\tif li[i]>=ma:\n\t\t\tif li[i]==ma:\n\t\t\t\tl+=1\n\t\t\telse:\n\t\t\t\tind = i\n\t\t\t\tma = li[i]\n\t\t\t\tl = 1\n\tif l>1:\n\t\ts=l*(l-1)/2\n\telse:\n\t\ta = max(li[:ind]+li[ind+1:])\n\t\ts = li.count(a)\n\tprint(f'{s/d:.8f}')" } ] }, "CHEFSOCK": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1 2 3", "output": "Unlucky Chef", "explanation": "Test #1:\nWhen Chef arrived at the shop, he had 3 rupees. After buying the jacket, he has 2 rupees left, enough to buy only 1 sock." }, { "input": "1 2 6", "output": "Lucky Chef", "explanation": "Test #2:\nChef had 6 rupees in the beginning. After buying the jacket, he has 5 rupees left, enough to buy a pair of socks for 4 rupees." } ], "problem_statement": "Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.\n\nToday, Chef woke up to find that he had no clean socks. Doing laundry is such a turn-off for Chef, that in such a situation, he always buys new socks instead of cleaning the old dirty ones. He arrived at the fashion store with money rupees in his pocket and started looking for socks. Everything looked good, but then Chef saw a new jacket which cost jacketCost rupees. The jacket was so nice that he could not stop himself from buying it.\n\nInterestingly, the shop only stocks one kind of socks, enabling them to take the unsual route of selling single socks, instead of the more common way of selling in pairs. Each of the socks costs sockCost rupees.\n\n\nChef bought as many socks as he could with his remaining money. It's guaranteed that the shop has more socks than Chef can buy. But now, he is interested in the question: will there be a day when he will have only 1 clean sock, if he uses a pair of socks each day starting tommorow? If such an unlucky day exists, output \"Unlucky Chef\", otherwise output \"Lucky Chef\". Remember that Chef never cleans or reuses any socks used once.\n\nInput\nThe first line of input contains three integers \u2014 jacketCost, sockCost, money \u2014 denoting the cost of a jacket, cost of a single sock, and the initial amount of money Chef has, respectively.\n\n\nOutput\nIn a single line, output \"Unlucky Chef\" if such a day exists. Otherwise, output \"Lucky Chef\". \nConstraints\n1 \u2264 jacketCost \u2264 money \u2264 109\n1 \u2264 sockCost \u2264 109\n\nSubtasks\nSubtask 1: jacketCost, money, sockCost \u2264 103. Points - 20\nSubtask 2: Original constraints. Points - 80", "input_format": "", "output_format": "", "problem_name": "Chef and Socks", "user_tags": [ "Basic Maths", "Implementation" ], "computed_tags": [ "Mathematics", "Algorithms" ], "problem_code_id": "CHEFSOCK", "difficulty_level": "1122", "ai_solutions": [ "jacketCost, sockCost, money = map(int, input().split())\nremaining_money = money - jacketCost\nsocks_bought = remaining_money // sockCost\nif socks_bought % 2 == 0:\n print(\"Lucky Chef\")\nelse:\n print(\"Unlucky Chef\")", "def chef_luck(jacketCost, sockCost, money):\n remaining_money = money - jacketCost\n socks_bought = remaining_money // sockCost\n return \"Lucky Chef\" if socks_bought % 2 == 0 else \"Unlucky Chef\"\n\njacketCost, sockCost, money = map(int, input().split())\nprint(chef_luck(jacketCost, sockCost, money))" ], "human_solutions": [ { "id": 34371594, "submission_date": 1592143501, "language": "PYTH 3", "username": "vittal_161", "user_rating_star": 3, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 34371594, "code": "A,B,C=map(int,input().split())\nif ((C-A)//B)%2==0:\n\tprint(\"Lucky Chef\")\nelse:\n\tprint(\"Unlucky Chef\")" }, { "id": 33542933, "submission_date": 1590994825, "language": "PYTH 3", "username": "bhuwana_18537", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.5M", "solution": 33542933, "code": "#CHEF AND SOCKS\n\njc,sc,m = map(int,input().split())\n\nrem_jcm = m-jc\nrem_scm = (rem_jcm)//sc\n\nif rem_scm % 2 == 0:\n print(\"Lucky Chef\")\nelse:\n print(\"Unlucky Chef\")\n \n" } ] }, "TRACE": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\n3\n1 2 5\n6 3 4\n2 7 1", "output": "13", "explanation": "Example case 1: The submatrix with the largest trace is \n6 3\n2 7\nwhich has trace equal to $6 + 7 = 13$. (This submatrix is obtained for $r=2, c=1, l=2$.)" } ], "problem_statement": "Read problems statements in Mandarin chinese and Vietnamese as well.\nChef is learning linear algebra. Recently, he learnt that for a square matrix $M$, $\\mathop{\\rm trace}(M)$ is defined as the sum of all elements on the main diagonal of $M$ (an element lies on the main diagonal if its row index and column index are equal).\nNow, Chef wants to solve some excercises related to this new quantity, so he wrote down a square matrix $A$ with size $N\\times N$. A square submatrix of $A$ with size $l\\times l$ is a contiguous block of $l\\times l$ elements of $A$. Formally, if $B$ is a submatrix of $A$ with size $l\\times l$, then there must be integers $r$ and $c$ ($1\\le r, c \\le N+1-l$) such that $B_{i,j} = A_{r+i-1, c+j-1}$ for each $1 \\le i, j \\le l$.\nHelp Chef find the maximum trace of a square submatrix of $A$.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first line of each test case contains a single integer $N$.\n$N$ lines follow. For each $i$ ($1 \\le i \\le N$), the $i$-th of these lines contains $N$ space-separated integers $A_{i,1}, A_{i,2}, \\dots, A_{i, N}$ denoting the $i$-th row of the matrix $A$.\n\nOutput\nFor each test case, print a single line containing one integer \u2014 the maximum possible trace.\nConstraints\n\n$1 \\le T \\le 100$\n$2 \\le N \\le 100$\n$1 \\le A_{i,j} \\le 100$ for each valid $i, j$\n\nSubtasks\nSubtask #1 (100 points): original constraints", "input_format": "", "output_format": "", "problem_name": "Trace of Matrix", "user_tags": [ "Observation", "Brute Force" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "TRACE", "difficulty_level": "1198", "ai_solutions": [], "human_solutions": [ { "id": 39941534, "submission_date": 1606848478, "language": "PYTH 3", "username": "shankar_2000", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.48", "memory": "17.6M", "solution": 39941534, "code": "for _ in range(int(input())):\n n=int(input())\n l=[]\n ans=0\n for i in range(n):\n l.append(list(map(int,input().split())))\n for i in range(n-1):\n for j in range(n-1):\n l[i+1][j+1]+=l[i][j]\n for i in range(n):\n for j in range(n):\n ans=max(ans,l[i][j])\n print(ans)" }, { "id": 39688383, "submission_date": 1605706687, "language": "PYTH 3", "username": "sharan_linux", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.48", "memory": "17.6M", "solution": 39688383, "code": "for _ in range(int(input())):\r\n n=int(input())\r\n l=[]\r\n ans=0\r\n for i in range(n):\r\n l.append(list(map(int,input().split())))\r\n for i in range(n-1):\r\n for j in range(n-1):\r\n l[i+1][j+1]+=l[i][j]\r\n for i in range(n):\r\n for j in range(n):\r\n ans=max(ans,l[i][j])\r\n print(ans)" } ] }, "EXUNA": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\n2\n7 12", "output": "7", "explanation": "The two possible ways to order the elements are [7, 12] and [12, 7]. In the first case, the cost is $7 \\bmod 12 = 7$ and in the second case the cost is $12 \\bmod 7 = 5$. Clearly the answer is 7." } ], "problem_statement": "You are given an array $A$ of $N$ positive and pairwise distinct integers. \nYou can permute the elements in any way you want. \nThe cost of an ordering $(A_1, A_2, \\ldots, A_N)$ is defined as $ (((A_1 \\bmod A_2) \\bmod A_3)......) \\bmod A_N$ where $X \\bmod Y$ means the remainder when $X$ is divided by $Y$. \nYou need to find the maximum cost which can be attained through any possible ordering of the elements.\nInput:\n\nThe first line contains $T$ denoting the number of test cases.\nThe first line of each testcase contains a single integer $N$. \nThe second line of each testcase contains $N$ space-separated integers, the elements of $A$. \n\nOutput:\n\nFor each testcase, output the maximum possible cost in a new line. \n\nConstraints\n\n$1 \\leq T \\leq 5*10^5$\n$2 \\leq N \\leq 5*10^5$\n$1 \\leq A_i \\leq 10^9$\nSum of $N$ over all testcases is less than or equal to $10^6$\nAll elements in a single testcase are distinct.\n\nSubtasks\n\n100 points : Original constraints.", "input_format": "", "output_format": "", "problem_name": "Weird Modulo Problem ", "user_tags": [ "Observation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "EXUNA", "difficulty_level": "1104", "ai_solutions": [], "human_solutions": [ { "id": 37120987, "submission_date": 1598261606, "language": "PYTH 3", "username": "shirishareddy7", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.53", "memory": "22.3M", "solution": 37120987, "code": "for _ in range(int(input())):\n n=int(input())\n l=list(map(int,input().split()))\n print(min(l))\n \n \n \n \n " }, { "id": 37024639, "submission_date": 1597937766, "language": "PYTH 3", "username": "sumanthhh_1", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.46", "memory": "22.3M", "solution": 37024639, "code": "for _ in range(int(input())):\r\n n=int(input())\r\n a=list(map(int,input().split()))\r\n print(min(a))\r\n" } ] }, "UTMOPR": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\n2 3\n5 7", "output": "even", "explanation": "" } ], "problem_statement": "Read problems statements in Mandarin Chinese and Russian as well.\nGiven an array consisting of N integers, you have to do the following operation K times.\n\n\nFind out the sum of all the elements in the array. Denote it by S. Insert an integer in the array strictly greater than S. Hence, size of the array will increase by one. \nThus, at the end of the K operations, the array will have N + K elements. Find out the smallest possible value of the last number inserted in the array. Since this number can be very large, you just have to tell whether it will be odd or even. \nInput\nThe first line of each test file contains the number of test cases, T.\nThe description of the test cases follows this line. Each test case description consists of 2 lines.\nThe first line has the values of N and K, separated by a space. \nThe next line contains a single-space separated list of values of the elements in the array.\n\nOutput\nFor each test case, output a single line containing the answer to the problem.If the number is even print \"even\" and if the number is odd print \"odd\".\n\nConstraints:\n\n\n1 \u2264 T \u226410\n1 \u2264 K \u2264 106\n1 \u2264 N \u2264 103\n1 \u2264 array element \u2264 109", "input_format": "", "output_format": "", "problem_name": "Strange operations", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "UTMOPR", "difficulty_level": "1148", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N, K = map(int, input().split())\n arr = list(map(int, input().split()))\n S = sum(arr)\n if S % 2 == 0:\n if K == 1:\n print(\"odd\")\n else:\n print(\"even\")\n else:\n print(\"odd\")", "T = int(input())\nfor _ in range(T):\n N, K = map(int, input().split())\n arr = list(map(int, input().split()))\n S = sum(arr)\n print(\"odd\" if S % 2 == 1 or K == 1 else \"even\")" ], "human_solutions": [ { "id": 37942702, "submission_date": 1600180251, "language": "PYTH 3", "username": "shilpa98", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 37942702, "code": "for _ in range(int(input())):\n \n n,k = map(int,input().split())\n s = sum(map(int,input().split()))\n\n\n if s% 2 !=0:\n print( 'even')\n else:\n if k==1:\n print('odd')\n else:\n print('even')" }, { "id": 37530817, "submission_date": 1599383291, "language": "PYTH 3", "username": "srisai_525", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 37530817, "code": "try:\n for _ in range(int(input())):\n N, K = map(int, input().split(\" \"))\n l = list(map(int, input().split(\" \")))\n s = sum(l)\n if(s % 2 == 0 and K == 1):\n print(\"odd\")\n else:\n print(\"even\")\nexcept:\n pass" } ] }, "PAJAPONG": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\n1 3 3\n5 7 2\n38657 76322 564", "output": "Paja\nChef\nPaja", "explanation": "Example case 1: Chef served for the first three games, after that Paja started serving. He only served in one game, so he is supposed to serve next." } ], "problem_statement": "Read problem statements in Hindi, Bengali, Mandarin Chinese, Russian, and Vietnamese as well.\nChef and Paja are bored, so they are playing an infinite game of ping pong. The rules of the game are as follows:\n- The players play an infinite number of games. At the end of each game, the player who won it scores a point.\n- In each game, one of the players serves. Chef serves in the first game.\n- After every $K$ points are scored (regardless of which players scored them), i.e. whenever $K$ games have been played since the last time the serving player changed, the player that serves in the subsequent games changes: if Chef served in the game that just finished, then Paja will serve in the next game and all subsequent games until the serving player changes again; if Paja served, then Chef will serve.\nThe players got a little too caught up in the game and they forgot who is supposed to serve in the next game. Will you help them determine that? So far, Chef has scored $X$ points and Paja has scored $Y$ points.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first and only line of each test case contains three space-separated integers $X$, $Y$ and $K$.\n\nOutput\nFor each test case, print a single line containing the string \"Chef\" if Chef is supposed to serve next or \"Paja\" otherwise (without quotes).\nConstraints\n\n$1 \\le T \\le 50$\n$0 \\le X, Y \\le 10^9$\n$1 \\le K \\le 10^9$\n\nSubtasks\nSubtask #1 (100 points): original constraints", "input_format": "", "output_format": "", "problem_name": "Ping Paja Pong", "user_tags": [ "Modular Arithmetic", "Basic Maths", "ad-hoc" ], "computed_tags": [ "Mathematics", "Algorithms", "Constructive" ], "problem_code_id": "PAJAPONG", "difficulty_level": "1172", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n X, Y, K = map(int, input().split())\n if ((X + Y) // K) % 2 == 0:\n print(\"Chef\")\n else:\n print(\"Paja\")", "def who_serves_next(T, test_cases):\n for i in range(T):\n X, Y, K = test_cases[i]\n if ((X + Y) // K) % 2 == 0:\n print(\"Chef\")\n else:\n print(\"Paja\")\n\nT = int(input())\ntest_cases = []\nfor _ in range(T):\n test_cases.append(list(map(int, input().split())))\nwho_serves_next(T, test_cases)" ], "human_solutions": [ { "id": 34653967, "submission_date": 1592852862, "language": "PYTH 3", "username": "deepakchaurasi", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 34653967, "code": "t=int(input())\nwhile(t>0):\n x,y,k=map(int,input().split())\n\n add=x+y\n if(add%(2*k)= 47:\n print(\"Good\")\n elif any(fav in string for fav in fav_strings):\n print(\"Good\")\n else:\n print(\"Bad\")", "def is_good_string(string, fav_strings):\n if len(string) >= 47:\n return \"Good\"\n for fav in fav_strings:\n if fav in string:\n return \"Good\"\n return \"Bad\"\n\nK, N = map(int, input().split())\nfav_strings = [input() for _ in range(K)]\nfound_strings = [input() for _ in range(N)]\n\nfor string in found_strings:\n print(is_good_string(string, fav_strings))" ], "human_solutions": [ { "id": 37961447, "submission_date": 1600269133, "language": "PYTH 3", "username": "arvind_02", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 37961447, "code": "k, n = map(int,input().split())\na = list()\nfor i in range(k):\n s = input()\n a.append(s)\nb = []\nfor i in range(n):\n s1 = input()\n b.append(s1)\nfor i in b:\n if len(i) >= 47:\n print('Good')\n else:\n for j in a:\n if j in i:\n print('Good')\n break\n else:\n print('Bad')" }, { "id": 36522585, "submission_date": 1597091049, "language": "PYTH 3", "username": "bhavikajain04", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 36522585, "code": "k,n=map(int,input().split())\na=[]\nb=[]\nfor _ in range(k):\n a.append(input())\nfor _ in range(n):\n b.append(input())\n\n\nfor i in b:\n f1=0 \n f2=0\n if len(i)>=47:\n f1=1\n for j in a:\n if j in i:\n f2=1 \n break \n \n if (f1 or f2):\n print(\"Good\")\n else:\n print(\"Bad\")\n \n " } ] }, "EXAM1": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\r\n6\r\nABCDAB\r\nABCDAB\r\n8\r\nDDCABCCA\r\nDNCBBBBA\r\n3\r\nCDD\r\nNDC", "output": "6\r\n3\r\n1", "explanation": "Example case 1: Chef's answers were all correct, so he got a full score.\nExample case 2: Chef did not answer question $2$ and he answered questions $4$ and $6$ incorrectly, which resulted in discarding answers to questions $5$ and $7$. Note that even though Chef's answer to question $7$ was wrong, it was discarded, so it did not result in discarding his answer to question $8$.\nExample case 3: Chef did not answer the first question and he answered the last question incorrectly, but there is no penalty for that." } ], "problem_statement": "Read problems statements in Hindi, Mandarin Chinese, Russian, Vietnamese, and Bengali as well.\nChef is taking a cooking exam. The exam consists of $N$ multiple-choice questions numbered $1$ through $N$. In each question, Chef may choose one out of four choices: A, B, C and D, or leave the question unanswered.\nAnswering a question correctly gives Chef $1$ point. Not answering a question or answering it incorrectly gives him $0$ points. However, there is a penalty for wrong answers. Specifically, the questions are graded one by one from question $1$ to question $N$; for each $i$ ($1 \\le i \\le N-1$), if Chef answered the $i$-th question incorrectly, his answer to the next question (the $(i+1)$-th question) is discarded without being graded. If an answer is discarded, Chef gets $0$ points for it automatically, but even if it was wrong, the next answer is not discarded. There is no penalty for answering the last question incorrectly or for not answering some questions.\nYou are given the correct answers to all $N$ questions and Chef's answers. Calculate the total number of points Chef scored on the exam.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first line of each test case contains a single integer $N$.\nThe second line contains a single string $S$ with length $N$. For each valid $i$, the $i$-th character of this string denotes the correct answer to the $i$-th question.\nThe third line contains a single string $U$ with length $N$. For each valid $i$, the $i$-th character of this string is 'N' if Chef did not answer the $i$-th question; otherwise, it denotes Chef's answer to this question.\n\nOutput\nFor each test case, print a single line containing one integer \u2014 Chef's score.\nConstraints\n\n$1 \\le T \\le 100$\n$1 \\le N \\le 100$\n$S$ contains only characters 'A', 'B', 'C', 'D'\n$U$ contains only characters 'A', 'B', 'C', 'D', 'N'", "input_format": "", "output_format": "", "problem_name": "Multiple Choice Exam", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "EXAM1", "difficulty_level": "1135", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N = int(input())\n S = input()\n U = input()\n score = 0\n i = 0\n while i < N:\n if U[i] == 'N':\n i += 1\n elif U[i] == S[i]:\n score += 1\n i += 1\n else:\n i += 2\n print(score)", "T = int(input())\nfor _ in range(T):\n N = int(input())\n S = input()\n U = input()\n score = 0\n i = 0\n while i < N:\n if U[i] == S[i]:\n score += 1\n elif U[i] != 'N':\n i += 1\n i += 1\n print(score)" ], "human_solutions": [ { "id": 29137165, "submission_date": 1579844261, "language": "PYTH 3", "username": "pankaj2kumar", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 29137165, "code": "for _ in range(int(input())):\r\n\tscore = 0\r\n\tn = int(input())\r\n\tcorr = input()\r\n\tresp = input()\r\n\ti = 0\r\n\t\r\n\twhile i < n:\r\n\t\tif resp[i] == 'N':\r\n\t\t\ti += 1\r\n\t\telif corr[i] == resp[i]:\r\n\t\t\tscore += 1\r\n\t\t\ti += 1\r\n\t\telse:\r\n\t\t\ti += 2\r\n\t\t\r\n\tprint(score)" }, { "id": 29047121, "submission_date": 1579419778, "language": "PYTH 3", "username": "ashu_199900", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 29047121, "code": "# ashu@gate2022\r\nfor i in range(int(input())):\r\n n=int(input())\r\n s=input()\r\n a=input()\r\n t=0\r\n j=0\r\n for i in range(n):\r\n if j= 1 and problems.count(\"simple\") >= 1 and problems.count(\"easy\") >= 1 and (problems.count(\"easy-medium\") >= 1 or problems.count(\"medium\") >= 1) and (problems.count(\"medium-hard\") >= 1 or problems.count(\"hard\") >= 1):\n print(\"Yes\")\n else:\n print(\"No\")", "T = int(input().strip())\nfor _ in range(T):\n N = int(input().strip())\n problems = [input().strip() for _ in range(N)]\n difficulties = [\"cakewalk\", \"simple\", \"easy\", [\"easy-medium\", \"medium\"], [\"medium-hard\", \"hard\"]]\n for difficulty in difficulties:\n if isinstance(difficulty, list):\n if not any(problem in problems for problem in difficulty):\n print(\"No\")\n break\n elif difficulty not in problems:\n print(\"No\")\n break\n else:\n print(\"Yes\")" ], "human_solutions": [ { "id": 37940624, "submission_date": 1600174936, "language": "PYTH 3", "username": "sujithv", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.56", "memory": "18.3M", "solution": 37940624, "code": "def fun(a,n):\n b=['cakewalk','simple','easy'],\n if 'cakewalk' in a and 'simple' in a and 'easy' in a and ('easy-medium' in a or 'medium' in a) and ('medium-hard' in a or 'hard' in a):\n print('Yes')\n else:\n print('No')\n \nfor _ in range(int(input())):\n n=int(input())\n a=[]\n for i in range(n):\n a.append(input())\n fun(a,n)" }, { "id": 37699241, "submission_date": 1599665180, "language": "PYTH 3", "username": "yash_swaraj", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.60", "memory": "17.6M", "solution": 37699241, "code": "for _ in range(int(input())):\n n = int(input())\n checker = [0]*5\n for i in range(n):\n s = input()\n if s == \"cakewalk\":\n checker[0] = 1\n elif s == \"simple\":\n checker[1] = 1\n elif s == \"easy\":\n checker[2] = 1\n elif s == \"easy-medium\" or s == \"medium\":\n checker[3] = 1\n else:\n checker[4] = 1\n \n if sum(checker) == 5:\n print(\"Yes\")\n else:\n print(\"No\")" } ] }, "MDL": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2\n3\n2 5 3\n10\n38 9 102 10 96 7 46 28 88 13", "output": "2 5 \n102 7", "explanation": "Example case 1: We remove the element $3$ because it is the median of $(2, 5, 3)$. The final sequence is $(2, 5)$." } ], "problem_statement": "Read problems statements in Hindi, Mandarin Chinese, Russian, Vietnamese, and Bengali as well.\nYou are given a sequence $A_1, A_2, \\ldots, A_N$ of distinct integers. While the sequence contains at least three elements, look at its first three elements, find the median among these elements and delete it. What will the final sequence be?\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first line of each test case contains a single integer $N$.\nThe second line contains $N$ space-separated integers $A_1, A_2, \\ldots, A_N$.\n\nOutput\n\nFor each test case, print a single line containing $K$ space-separated integers, where $K$ is the length of the final sequence. For each valid $i$, the $i$-th of these integers should be the $i$-th element of the final sequence.\n\nConstraints\n\n$1 \\le T \\le 74$\n$3 \\le N \\le 19$\n$1 \\le A_i \\le 109$ for each valid $i$", "input_format": "", "output_format": "", "problem_name": "Medel", "user_tags": [ "ad-hoc", "Brute Force" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "MDL", "difficulty_level": "1139", "ai_solutions": [], "human_solutions": [ { "id": 33373006, "submission_date": 1590570386, "language": "PYTH 3", "username": "manishreddy_l", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.6M", "solution": 33373006, "code": "for _ in range(int(input())):\r\n x=int(input())\r\n l=list(map(int,input().split()))\r\n if l.index(max(l))0):\n n=int(input())\n lst=list(map(int,input().split()))\n while(len(lst)>=3):\n x=lst[:3]\n x=sorted(x)\n lst.remove(x[1])\n \n print(* lst)\n \n \n t-=1" } ] }, "UWCOI20A": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\n5\n4\n7\n6\n3\n1", "output": "7", "explanation": "" } ], "problem_statement": "Well known investigative reporter Kim \"Sherlock'' Bumjun needs your help! Today, his mission is to sabotage the operations of the evil JSA. If the JSA is allowed to succeed, they will use the combined power of the WQS binary search and the UFDS to take over the world!\nBut Kim doesn't know where the base is located. He knows that the base is on the highest peak of the Himalayan Mountains. He also knows the heights of each of the $N$ mountains. Can you help Kim find the height of the mountain where the base is located? \nInput:\n\nFirst line will contain $T$, number of testcases. Then the testcases follow. \nThe first line in each testcase contains one integer, $N$. \nThe following $N$ lines of each test case each contain one integer: the height of a new mountain.\n\nOutput:\nFor each testcase, output one line with one integer: the height of the tallest mountain for that test case.\nConstraints\n\n$1 \\leq T \\leq 10$\n$1 \\leq N \\leq 100000$\n$0 \\leq$ height of each mountain $\\leq 10^9$\n\nSubtasks:\n\n100 points: No additional constraints.", "input_format": "", "output_format": "", "problem_name": "Peak Finding", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "UWCOI20A", "difficulty_level": "1078", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N = int(input())\n heights = [int(input()) for _ in range(N)]\n print(max(heights))", "T = int(input())\nfor _ in range(T):\n N = int(input())\n max_height = 0\n for _ in range(N):\n height = int(input())\n if height > max_height:\n max_height = height\n print(max_height)" ], "human_solutions": [ { "id": 1027875074, "submission_date": 1698740423, "language": "PYTH 3", "username": "o170321", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.44", "memory": "8.4M", "solution": 1027875074, "code": "n = int(input())\r\n\r\nfor i in range(n):\r\n l = [0]\r\n k = int(input())\r\n \r\n for j in range(k):\r\n \r\n m = int(input())\r\n if(m>l[-1]):\r\n l.append(m)\r\n \r\n \r\n print(l[-1])" }, { "id": 1027671733, "submission_date": 1698596646, "language": "PYTH 3", "username": "bhavanamuthyam", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.45", "memory": "11.9M", "solution": 1027671733, "code": "for I in range(int(input())):\r\n k=[]\r\n n=int(input())\r\n for j in range(n):\r\n a=int(input())\r\n k.append(a)\r\n print(max(k))" } ] }, "RRJOKE": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2\n2\n1 2\n0 0\n3\n3 3\n0 0\n0 3", "output": "3\n0", "explanation": "For the first test case permutation [1, 2] is optimal. 1 xor 2 = 3.\n\nFor the second one both [2, 3, 1] and [1, 3, 2] lead us to the shortest walk, but the second one is lexicographically smaller. So the answer is H([1, 3, 2]) = 1 xor 3 xor 2 = 0 ." } ], "problem_statement": "Read problems statements in Mandarin Chinese and Russian as well.\n\nVadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem:\n\n Given N points on a plane. Each point p is defined by it's two integer coordinates \u2014 px and py. The distance between points a and b is min(|ax - bx|, |ay - by|). You should choose a starting point and make a route visiting every point exactly once, i.e. if we write down numbers of points in order you visit them we should obtain a permutation. Of course, overall distance walked should be as small as possible. The number of points may be up to 40.\n\n\"40? Maybe 20? Are you kidding?\" \u2013 asked Roman. \"No, it's not a joke\" \u2013 replied Vadim. So Roman had nothing to do, but try to solve this problem. Since Roman is really weak in problem solving and you are the only friend, except Vadim, with whom Roman can discuss challenging tasks, he has nobody else to ask for help, but you!\n \nInput\nInput description.\nThe first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.The first line of each test case contains a single integer N denoting the number of points on a plane. The following N lines contain two space-separated integers each \u2014 coordinates of points. \n \nOutput\nOutput description.\nOutput the answer for every test case in a separate line. The answer for every test case is a permutation of length N. In case there are several solutions that lead to minimal distance walked, you should choose the lexicographically smallest one. Let P denote such permutation. To make output smaller, you should output H(P). H(P) = P1 xor P2 xor ... xor PN. Have a look at the example and it's explanation for better understanding. \n \nConstraints\n1 \u2264 T \u2264 10\n1 \u2264 N \u2264 40\n0 \u2264 absolute value of each coordinate \u2264 1000\n1 \u2264 sum over all N in a single test file \u2264 120", "input_format": "", "output_format": "", "problem_name": "Good Joke!", "user_tags": [ "ad-hoc" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "RRJOKE", "difficulty_level": "1163", "ai_solutions": [], "human_solutions": [ { "id": 36913317, "submission_date": 1597817090, "language": "PYTH 3", "username": "avinash_1718", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 36913317, "code": "for _ in range(int(input())):\n n=int(input())\n for i in range(n) :\n x, y=map(int,input().split())\n p=0\n for i in range(1,n+1):\n p=p^i\n print(p) \n " }, { "id": 36801374, "submission_date": 1597572485, "language": "PYTH 3", "username": "pgk176", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.6M", "solution": 36801374, "code": "try:\n for _ in range(int(input())):\n N = int(input())\n for __ in range(N):\n a, b = map(int, input().split())\n \n ans = 1\n for i in range(2, N + 1):\n ans ^= i\n \n print(ans)\n \nexcept Exception as e:\n print(e.__class__)" } ] }, "DWNLD": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\r\n2 2\r\n2 1\r\n2 3\r\n2 2\r\n1 2\r\n2 3\r\n3 0\r\n1 2\r\n2 4\r\n10 10", "output": "6\r\n3\r\n110", "explanation": "Example case 1. For the first two minutes, internet data of usage of Chef is free. He has to pay for last 2 minutes only, for which he will be charged at 3 dollars per minute, i.e. total 6 dollars.\nExample case 2. For the first two minutes, internet data of usage of Chef is free. He has to pay for last 1 minute only, for which he is being charged at 3 dollars per minute. So, in total he has to pay 3 dollars.\nExample case 3. This time, Chef is not provided any free data usage. He has to pay \nfor entire data usage, which comes out to be 1 * 2 + 2 * 4 + 10 * 10 = 110 dollars." } ], "problem_statement": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.\nChef has recently got a broadband internet connection. His history of internet data usage is provided as below.\nDuring the first T1 minutes, the internet data used was D1 MBs per minute, and during the next T2 minutes, it was D2 MBs per minute, and so on till during last TN minutes it was DN MBs per minute.\nThe internet provider charges the Chef 1 dollar for every 1 MB data used, except for the first K minutes, when the internet data is free as part of the plan provided to Chef.\nPlease find out the total amount that Chef has to pay the internet provider (in dollars).\nInput\nFirst line of the input contains a single integer TC the number of test cases. Description of TC test cases follow.\nFirst line of each test case contains two space separated integers N and K.\nNext N lines of each test case contains information about the internet data usage. Specifically, in the i-th line, there will be two space separated integers: Ti and Di.\nOutput\nFor each test case output a single integer in separate line, the amount that Chef has to pay in dollars.\nConstraints\n\n1 \u2264 TC \u2264 1,000\n1 \u2264 N \u2264 10\n0 \u2264 K \u2264 T1 + T2 + ... + TN \n1 \u2264 Ti, Di \u2264 10", "input_format": "", "output_format": "", "problem_name": "Download file", "user_tags": [ "Basic Maths", "Implementation" ], "computed_tags": [ "Mathematics", "Algorithms" ], "problem_code_id": "DWNLD", "difficulty_level": "1147", "ai_solutions": [ "TC = int(input())\nfor _ in range(TC):\n N, K = map(int, input().split())\n total_cost = 0\n total_time = 0\n for _ in range(N):\n T, D = map(int, input().split())\n if total_time + T <= K:\n total_time += T\n else:\n if total_time < K:\n total_cost += D * (T - (K - total_time))\n total_time = K\n else:\n total_cost += D * T\n print(total_cost)", "TC = int(input())\nfor _ in range(TC):\n N, K = map(int, input().split())\n total_cost = 0\n total_time = 0\n for _ in range(N):\n T, D = map(int, input().split())\n if total_time < K:\n if total_time + T <= K:\n total_time += T\n else:\n total_cost += D * (T - (K - total_time))\n total_time = K\n else:\n total_cost += D * T\n print(total_cost)" ], "human_solutions": [ { "id": 29756190, "submission_date": 1581913109, "language": "PYTH 3", "username": "aayushi11_", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.03", "memory": "17.6M", "solution": 29756190, "code": "t=int(input())\nfor l in range(t):\n n,k=map(int,input().split())\n minute=[]\n mb_per_minute=[]\n for i in range(n):\n a,b=map(int,input().split(' '))\n minute.append(a)\n mb_per_minute.append(b)\n i=0\n while(k>0 and i=k):\n minute[i]=minute[i]-k\n k=0\n elif(minute[i]k):\n tl[h]=tl[h]-k\n k=0\n else:\n k=k-tl[h]\n tl[h]=0\n h+=1\n for x in range(len(tl)):\n s=s+(tl[x]*dl[x])\n print(s)\n " } ] }, "ADACRA": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "1\nUUDDDUUU", "output": "1", "explanation": "Example case 1. In one step we can flip all the crayons pointing downwards" } ], "problem_statement": "Read problems statements in mandarin chinese, russian and vietnamese as well.\n\nAda has an array of N crayons, some crayons are pointing upwards and some downwards.\nAda thinks that an array of crayons is beautiful if all the crayons are pointing in the same direction.\n\n\nIn one step you can flip any segment of consecutive crayons. After flipping a segment, all crayons pointing downwards will point upwards and visceversa\n\nWhat is the minimum number of steps to make the array of crayons beautiful?\n\nInput\n\nThe first line of the input contains T the number of test cases.\nEach test case is described in one line containing a string S of N characters, the i-th character is 'U' if the i-th crayon is pointing upwards and 'D' if it is pointing downwards.\n\nOutput\n\nFor each test case, output a single line containing the minimum number of flips needed to make all crayons point to the same direction.\n\nConstraints\n\n1 \u2264 T \u2264 3000\n1 \u2264 N \u2264 50", "input_format": "", "output_format": "", "problem_name": "Ada and crayons", "user_tags": [ "Greedy", "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "ADACRA", "difficulty_level": "1099", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n S = input().strip()\n print(min(S.count('DU'), S.count('UD')))" ], "human_solutions": [ { "id": 33169752, "submission_date": 1589878018, "language": "PYTH 3", "username": "darshjain", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.03", "memory": "17.6M", "solution": 33169752, "code": "t=int(input())\nwhile t!=0:\n s=input()\n s+='X'\n n=len(s)\n m1=m2=c1=c2=0\n for i in range(0,n-1):\n if s[i]!=s[i+1]:\n if s[i]=='U':\n c1+=1\n if s[i]=='D':\n c2+=1\n if m1m2:\n d=m2\n else:\n d=m1\n print(d)\n t-=1" }, { "id": 33131646, "submission_date": 1589708126, "language": "PYTH 3", "username": "manishreddy_l", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.04", "memory": "17.6M", "solution": 33131646, "code": "for _ in range(int(input())):\r\n s = input()\r\n sn = []\r\n sn.append(s[0])\r\n i = 1\r\n while ia:\n print(\"No\")\n else:\n print(\"Yes\")" }, { "id": 32758945, "submission_date": 1588742959, "language": "PYTH 3", "username": "manishreddy_l", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.51", "memory": "19.6M", "solution": 32758945, "code": "n,k=map(int,input().split())\r\nn=list(map(int,input().split()))\r\na=max(n)\r\nb=min(n)\r\nfor i in range(k):\r\n p=int(input())\r\n if pa:\r\n print(\"No\")\r\n else:\r\n print(\"Yes\")" } ] }, "CHEFNWRK": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "4\r\n1 1 \r\n2\r\n2 4\r\n1 1\r\n3 6\r\n3 4 2\r\n3 6\r\n3 4 3", "output": "-1\r\n1\r\n2\r\n3", "explanation": "Example case 1: Since the weight of the box higher than $K$, Chef can not carry that box home in any number of the round trip.\nExample case 2: Since the sum of weights of both boxes is less than $K$, Chef can carry them home in one round trip.\nExample case 3: In the first round trip, Chef can only pick up the box at position $1$. In the second round trip, he can pick up both remaining boxes at positions $2$ and $3$.\nExample case 4: Chef can only carry one box at a time, so three round trips are required." } ], "problem_statement": "Read problems statements in Hindi, Mandarin Chinese, Russian, Vietnamese, and Bengali as well.\nChef has $N$ small boxes arranged on a line from $1$ to $N$. For each valid $i$, the weight of the $i$-th box is $W_i$. Chef wants to bring them to his home, which is at the position $0$. He can hold any number of boxes at the same time; however, the total weight of the boxes he's holding must not exceed K at any time, and he can only pick the ith box if all the boxes between Chef's home and the ith box have been either moved or picked up in this trip.\nTherefore, Chef will pick up boxes and carry them home in one or more round trips. Find the smallest number of round trips he needs or determine that he cannot bring all boxes home.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first line of each test case contains two space-separated integers $N$ and $K$.\nThe second line contains $N$ space-separated integers $W_1, W_2, \\ldots, W_N$.\n\nOutput\nFor each test case, print a single line containing one integer \u2015 the smallest number of round trips or $-1$ if it is impossible for Chef to bring all boxes home.\nConstraints\n\n$1 \\le T \\le 100$\n$1 \\le N, K \\le 10^3$\n$1 \\le W_i \\le 10^3$ for each valid $i$", "input_format": "", "output_format": "", "problem_name": "Chef and Work", "user_tags": [ "Greedy", "ad-hoc", "Implementation" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "CHEFNWRK", "difficulty_level": "1185", "ai_solutions": [], "human_solutions": [ { "id": 1027867388, "submission_date": 1698736020, "language": "PYTH 3", "username": "jaganhdp", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.04", "memory": "8.5M", "solution": 1027867388, "code": "t=int(input())\r\nfor i in range(t):\r\n n,k=map(int,input().split())\r\n arr=list(map(int,input().split()))\r\n summ=0\r\n i=0\r\n count=1\r\n if max(arr)>k:\r\n print(-1)\r\n continue\r\n while ik:\r\n count+=1\r\n summ=arr[i]\r\n i+=1\r\n print(count)" }, { "id": 1025371381, "submission_date": 1697080266, "language": "PYTH 3", "username": "sathwikka2003", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.08", "memory": "9.5M", "solution": 1025371381, "code": "for _ in range(int(input())):\r\n n, k = map(int,input().split())\r\n w = list(map(int,input().split()))\r\n l = 0\r\n trips = 0\r\n while len(w)>0:\r\n if w[0]<=k:\r\n l += w[0]\r\n if l <= k:\r\n w.pop(0)\r\n continue\r\n else:\r\n trips += 1\r\n l = 0\r\n continue\r\n else:\r\n print(-1)\r\n break\r\n else:\r\n trips +=1\r\n print(trips) \r\n " } ] }, "ANKTRAIN": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "3\n1\n5\n3", "output": "4LB\n2MB\n6UB", "explanation": "" } ], "problem_statement": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.\nRahul and Rashi are off to the wedding of a close relative. This time they have to travel without their guardians. Rahul got very interested in the arrangement of seats inside the train coach.\nThe entire coach could be viewed as an arrangement of consecutive blocks of size 8. \n\n\nBerth Number Compartment\n\n 1 - 8 1 \n 9 - 16 2 \n17 - 24 3 \n... and so on\n\nEach of these size-8 blocks are further arranged as:\n\n\n 1LB, 2MB, 3UB, 4LB, 5MB, 6UB, 7SL, 8SU \n 9LB, 10MB, ...\n ... \n ...\n\nHere LB denotes lower berth, MB middle berth and UB upper berth.\nThe following berths are called Train-Partners:\n\n3UB | 6UB \n2MB | 5MB \n1LB | 4LB \n7SL | 8SU \n\nand the pattern is repeated for every set of 8 berths.\nRahul and Rashi are playing this game of finding the train partner of each berth. Can you write a program to do the same?\nInput\nThe first line of input contains a single integer T, denoting the number of test cases to follow.\nEach of the next T lines contain a single integer N, the berth number whose neighbor is to be found out.\nOutput\nThe output should contain exactly T lines each containing the berth of the neighbor of the corresponding seat.\nConstraints\nSubtasks\n\nSubtask #1 (50 points):\n\n1 \u2264 T \u2264 8\n1 \u2264 N \u2264 8\n\n\nSubtask #2 (50 points):\n\n1 \u2264 T \u2264 100\n1 \u2264 N \u2264 500", "input_format": "", "output_format": "", "problem_name": "Train Partner", "user_tags": [ "Implementation" ], "computed_tags": [ "Algorithms" ], "problem_code_id": "ANKTRAIN", "difficulty_level": "1187", "ai_solutions": [ "T = int(input())\nfor _ in range(T):\n N = int(input())\n remainder = N % 8\n if remainder == 1:\n print(str(N+3) + \"LB\")\n elif remainder == 2:\n print(str(N+3) + \"MB\")\n elif remainder == 3:\n print(str(N+3) + \"UB\")\n elif remainder == 4:\n print(str(N-3) + \"LB\")\n elif remainder == 5:\n print(str(N-3) + \"MB\")\n elif remainder == 6:\n print(str(N-3) + \"UB\")\n elif remainder == 7:\n print(str(N+1) + \"SU\")\n else:\n print(str(N-1) + \"SL\")", "T = int(input())\nfor _ in range(T):\n N = int(input())\n berth = {1: \"LB\", 2: \"MB\", 3: \"UB\", 4: \"LB\", 5: \"MB\", 6: \"UB\", 7: \"SL\", 0: \"SU\"}\n remainder = N % 8\n if remainder in [1, 2, 3]:\n print(str(N+3) + berth[remainder])\n elif remainder in [4, 5, 6]:\n print(str(N-3) + berth[remainder])\n elif remainder == 7:\n print(str(N+1) + berth[remainder])\n else:\n print(str(N-1) + berth[remainder])" ], "human_solutions": [ { "id": 39623859, "submission_date": 1605443297, "language": "PYTH 3", "username": "nayan_abhi", "user_rating_star": 4, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.5M", "solution": 39623859, "code": "a = int(input())\nfor i in range(a):\n b = int(input())\n if b%8==0:\n print(str(b-1) + 'SL')\n elif b%8==7:\n print(str(b+1) + 'SU')\n elif b%8==1:\n print(str(b+3) + 'LB')\n elif b%8==2:\n print(str(b+3) + 'MB')\n elif b%8==3:\n print(str(b+3) + 'UB')\n elif b%8==4:\n print(str(b-3) + 'LB')\n elif b%8==5:\n print(str(b-3) + 'MB')\n elif b%8==6:\n print(str(b-3) + 'UB')" }, { "id": 39395774, "submission_date": 1604777830, "language": "PYTH 3", "username": "sarthak_05", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.02", "memory": "17.5M", "solution": 39395774, "code": "def get_train_partner(n):\n res = n%8\n if res==0:\n return str(n-1)+\"SL\"\n elif res==7:\n return str(n+1)+\"SU\"\n elif res==1:\n return str(n+3)+\"LB\"\n elif res==4:\n return str(n-3)+\"LB\"\n elif res==3:\n return str(n+3)+\"UB\"\n elif res==6:\n return str(n-3)+\"UB\"\n elif res==2:\n return str(n+3)+\"MB\"\n else:\n return str(n-3)+\"MB\"\n\nfor i in range(int(input())):\n n = int(input())\n print(get_train_partner(n))" } ] }, "CUTBOARD": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "4\n2 4\n3 3\n6 8\n7 5", "output": "3\n4\n35\n24", "explanation": "Example case 1:\n\nThe edges cut by Suzumo in one optimal solution are marked by red lines." } ], "problem_statement": "Read problem statement in Mandarin chinese and Vietnamese.\nSuzumo has a chessboard with $N$ rows and $M$ columns. In one step, he can choose two cells of the chessboard which share a common edge (that has not been cut yet) and cut this edge.\nFormally, the chessboard is split into two or more pieces if it is possible to partition its cells into two non-empty subsets $S_1$ and $S_2$ ($S_1\\cap S_2 = \\emptyset$, $|S_1|+|S_2|=NM$) such that there is no pair of cells $c_1, c_2$ ($c_1 \\in S_1, c_2 \\in S_2$) which share a common edge that has not been cut.\nSuzumo does not want the board to split into two or more pieces. Compute the maximum number of steps he can perform while satisfying this condition.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows. \nThe first and only line of each test case contains two space-separated integers $N$ and $M$.\n\nOutput\nFor each test case, print a single line containing one integer \u2014 the maximum possible number of steps.\nConstraints\n\n$1 \\le T \\le 64$\n$1 \\le N, M \\le 8$", "input_format": "", "output_format": "", "problem_name": "Cut the Board", "user_tags": [ "ad-hoc" ], "computed_tags": [ "Algorithms", "Constructive" ], "problem_code_id": "CUTBOARD", "difficulty_level": "1081", "ai_solutions": [], "human_solutions": [ { "id": 40743538, "submission_date": 1608963462, "language": "PYTH 3", "username": "milind09_01", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.5M", "solution": 40743538, "code": "for _ in range(int(input())):\r\n n,m=map(int,input().split())\r\n print((n-1)*(m-1))" }, { "id": 40580452, "submission_date": 1608556902, "language": "PYTH 3", "username": "garethbale", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.01", "memory": "17.5M", "solution": 40580452, "code": "for __ in range(int(input())):\n x,y=map(int,input().split())\n print((x-1)*(y-1))" } ] }, "ANDOR": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2\n1\n8", "output": "0 1\n5 3", "explanation": "" } ], "problem_statement": "Read problem statements in Hindi, Bengali, Mandarin Chinese, Russian, and Vietnamese as well.\nGiven an integer $x$, find two non-negative integers $a$ and $b$ such that $(a \\wedge b) + (a \\vee b) = x$, where $\\wedge$ is the bitwise AND operation and $\\vee$ is the bitwise OR operation.\nInput\n\nThe first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\nThe first and only line of each test case contains a single integer $x$.\n\nOutput\nIf there is no valid pair $(a, b)$, print a single line containing the integer $-1$. Otherwise, print a single line containing two space-separated integers $a$ and $b$.\nIf there are multiple solutions, you may print any one of them.\nConstraints\n\n$1 \\le T \\le 10^5$\n$1 \\le x \\le 10^{18}$\n\nSubtasks\nSubtask #1 (30 points):\n- $1 \\le T \\le 200$\n- $1 \\le x \\le 200$\nSubtask #2 (70 points): original constraints", "input_format": "", "output_format": "", "problem_name": "AND Plus OR", "user_tags": [ "Basic Maths", "Bitwise Operation", "Observation" ], "computed_tags": [ "Mathematics", "Bit Manipulation", "Algorithms" ], "problem_code_id": "ANDOR", "difficulty_level": "1151", "ai_solutions": [], "human_solutions": [ { "id": 1027944830, "submission_date": 1698770275, "language": "PYTH 3", "username": "jack0", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.37", "memory": "8.5M", "solution": 1027944830, "code": "T = int(input())\r\nfor _ in range(T):\r\n X = int(input())\r\n print(0,X)" }, { "id": 1024665053, "submission_date": 1696699340, "language": "PYTH 3", "username": "joshnareddy", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "(100)", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.42", "memory": "9.5M", "solution": 1024665053, "code": "goals = int(input())\r\nfor distractions in range(goals):\r\n wife = int(input())\r\n print(1, wife - 1)" } ] }, "ANUUND": { "constraints": "", "subtasks": "", "sample_test_cases": [ { "input": "2\n2\n3 2\n3\n10 5 2", "output": "2 3\n2 10 5", "explanation": "Example case 1.A[0] ? A[1] is satisfied, 2 ? 3.\nExample case 2.A[0] ? A[1] is satisfied, 2 ? 10.A[1] ? A[2] is satisfied, 10 ? 5.Note: 5 10 2 is also valid answer." } ], "problem_statement": "Read problems statements in Mandarin Chinese and Russian as well.\nProblem description\nYou will be given a zero-indexed array A. You need to rearrange its elements in such a way that the following conditions are satisfied:\n\n\nA[i] \u2264 A[i+1] if i is even.\nA[i] \u2265 A[i+1] if i is odd.\nIn other words the following inequality should hold: A[0] \u2264 A[1] \u2265 A[2] \u2264 A[3] \u2265 A[4], and so on. Operations \u2264 and \u2265 should alter.\nInput\nThe first line contains a single integer T denoting the number of test cases. The first line of each test case contains an integer N, that is the size of the array A. The second line of each test case contains the elements of array A\nOutput\nFor each test case, output a single line containing N space separated integers, which are the elements of A arranged in the required order. If there are more than one valid arrangements, you can output any of them.\nConstraints\n1 \u2264 N \u2264 100000\nSum of N in one test file \u2264 600000\n1 \u2264 A[i] \u2264 10^9", "input_format": "", "output_format": "", "problem_name": "Ups and Downs", "user_tags": [ "ad-hoc", "anudeep2011", "cook46", "easy", "sorting" ], "computed_tags": [], "problem_code_id": "ANUUND", "difficulty_level": "1198", "ai_solutions": [], "human_solutions": [ { "id": 34079069, "submission_date": 1591719372, "language": "PYTH 3", "username": "kit_28", "user_rating_star": 1, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.76", "memory": "21M", "solution": 34079069, "code": "for _ in range(int(input())):\n n=int(input())\n l=list(map(int,input().split()))\n i=0 ; j=len(l)-1\n l=sorted(l)\n while i < j:\n print(l[i],end=\" \")\n print(l[j],end=\" \")\n i += 1; j -= 1\n if n%2==1: print(l[int(n/2)])\n print()\n" }, { "id": 32996840, "submission_date": 1589179313, "language": "PYTH 3", "username": "gsn1993", "user_rating_star": 2, "contest_code": "PRACTICE", "tooltip": "accepted", "score": "", "points": "", "icon": "/misc/icons/tick-icon.svg", "time": "0.70", "memory": "21.1M", "solution": 32996840, "code": "t = int(input())\nwhile t>0:\n n = int(input())\n arr = list(map(int, input().split()))\n arr.sort()\n if n%2==0: m = n//2\n else: m = n//2 + 1\n i, j = 0, m\n while i