Dataset Viewer
Auto-converted to Parquet Duplicate
id
int64
50
4.72k
question
stringlengths
803
2.39k
solutions
stringlengths
697
64.7k
input_output
stringlengths
89
1.26M
difficulty
stringclasses
3 values
url
stringlengths
47
49
starter_code
stringclasses
1 value
4,483
You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. Finally, you see mochi for sale for abs(A-B) yen each, where abs(n) refers to the absolute value of n. How much ...
["print((int(input()) - int(input())) % int(input()))", "X = int(input())\nA = int(input())\nB = int(input())\n\nprint(X - A - B * ((X - A) // B))", "x=int(input())\na=int(input())\nb=int(input())\n\nprint((x-a)%b)", "x=int(input())\na=int(input())\nb=int(input())\nprint((x-a)%b)", "x = int(input())\na = int(input())\n...
{"inputs": ["1234\n150\n100\n", "1000\n108\n108\n", "579\n123\n456\n", "7477\n549\n593\n"], "outputs": ["84\n", "28\n", "0\n", "405\n"]}
introductory
https://atcoder.jp/contests/abc087/tasks/abc087_a
104
Polycarp has created his own training plan to prepare for the programming contests. He will train for $n$ days, all days are numbered from $1$ to $n$, beginning from the first. On the $i$-th day Polycarp will necessarily solve $a_i$ problems. On even-indexed days, he is twice as good at solving problems as normal. One...
["def main():\n n = int(input())\n a = list(int(x) for x in input().split())\n s = sum(a)\n t = 0\n for i in range(n):\n t += a[i]\n if 2 * t >= s:\n print(i + 1)\n return\n\nmain()\n", "#!/bin/python\n\nn = int(input())\nl = list(map(int, input().split()))\ns = sum(l)...
{ "inputs": [ "4\n1 3 2 1\n", "6\n2 2 2 2 2 2\n", "1\n10000\n", "3\n2 1 1\n", "2\n1 3\n", "4\n2 1 1 3\n", "3\n1 1 3\n", "3\n1 1 1\n", "2\n1 2\n", "3\n2 1 2\n", "5\n1 2 4 3 5\n", "5\n2 2 2 4 3\n", "4\n1 2 3 1\n", "6\n7 3 10 7 3 11\n", "2\n3 4\n", "5\n1 1 ...
interview
https://codeforces.com/problemset/problem/962/A
1,766
Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains a number, all numbers on the cards are distinct. There is also one token at each of the two ends of the row, containing the number 5. The players take turns, Sereja moves first. During his turn a pl...
["n=int(input())\na=list(map(int,input().split()))\nb=True\nl=0\nr=n-1\nans1=0\nans2=0\nwhile l<=r:\n if a[l]>a[r]:\n if b:\n ans1+=a[l]\n b=False\n else:\n ans2+=a[l]\n b=True\n l+=1\n else:\n if b:\n ans1+=a[r]\n b=Fal...
{ "inputs": [ "4\n4 1 2 10\n", "7\n1 2 3 4 5 6 7\n", "42\n15 29 37 22 16 5 26 31 6 32 19 3 45 36 33 14 25 20 48 7 42 11 24 28 9 18 8 21 47 17 38 40 44 4 35 1 43 39 41 27 12 13\n", "43\n32 1 15 48 38 26 25 14 20 44 11 30 3 42 49 19 18 46 5 45 10 23 34 9 29 41 2 52 6 17 35 4 50 22 33 51 7 28 47 13 39 37...
interview
https://codeforces.com/problemset/problem/381/A
3,860
There are $b$ boys and $g$ girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and $n$ participants have accepted the invitation. The organizers do not know how many boys and girls are among them. Organizers are preparing red badges for girls and blue ones for boys. H...
["def main():\n import sys\n input = sys.stdin.readline\n \n b = int(input())\n g = int(input())\n n = int(input())\n \n ans = n + 1\n if b < n:\n ans -= n - b\n if g < n:\n ans -= n - g\n \n print(ans)\n \n return 0\n\nmain()\n", "b = int(input())\ng = int(input(...
{ "inputs": [ "5\n6\n3\n", "5\n3\n5\n", "1\n200\n33\n", "100\n200\n150\n", "123\n55\n100\n", "300\n300\n600\n", "1\n1\n1\n", "100\n200\n250\n", "100\n200\n300\n", "123\n222\n250\n", "300\n300\n1\n", "300\n299\n300\n", "1\n1\n2\n", "300\n1\n45\n", "199\n199\n...
competition
https://codeforces.com/problemset/problem/1214/B
1,003
Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m, 2m, 3m, ...) mom buys a pair of socks to Vasya. She does it late in the eve...
["\"\"\"\nCodeforces Contest 262 Div 2 Problem A\n\nAuthor : chaotic_iak\nLanguage: Python 3.3.4\n\"\"\"\n\ndef main():\n n,m = read()\n i = 0\n while n:\n n -= 1\n i += 1\n if not i%m: n += 1\n print(i)\n\n################################### NON-SOLUTION STUFF BELOW\n\ndef read(mode=2...
{ "inputs": [ "2 2\n", "9 3\n", "1 2\n", "2 3\n", "1 99\n", "4 4\n", "10 2\n", "10 9\n", "100 100\n", "2 27\n", "99 100\n", "99 2\n", "100 3\n", "98 3\n", "4 4\n", "100 2\n", "62 4\n", "99 10\n", "100 5\n", "80 80\n", "95 16\n", "...
interview
https://codeforces.com/problemset/problem/460/A
870
Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and L, and they move towards each other wi...
["d, L, v1, v2 = list(map(int, input().split()))\nt = (L - d) / (v1 + v2)\nprint(t)\n", "d,l,v1,v2=list(map(int,input().split()))\nprint((l-d)/(v1+v2))\n", "d, l, v1, v2 = list(map(int, input().split()))\nl -= d\nif (l <= 0):\n print(0.0)\nelse:\n print(l/(v1+v2))\n", "#! /usr/bin/env python\n# -*- coding: utf-8 ...
{ "inputs": [ "2 6 2 2\n", "1 9 1 2\n", "1 10000 1 1\n", "9999 10000 10000 10000\n", "1023 2340 1029 3021\n", "2173 2176 10000 9989\n", "1 2 123 1\n", "123 1242 12 312\n", "2 9997 3 12\n", "1 10000 10000 10000\n", "3274 4728 888 4578\n", "4600 9696 5634 8248\n", "22...
interview
https://codeforces.com/problemset/problem/624/A
978
Cucumber boy is fan of Kyubeat, a famous music game. Kyubeat has 16 panels for playing arranged in 4 × 4 table. When a panel lights up, he has to press that panel. Each panel has a timing to press (the preffered time when a player should press it), and Cucumber boy is able to press at most k panels in a time with his...
["k=int(input())\n\nL={}\ns=\".123456789\"\nfor item in s:\n L[item]=0\nfor i in range(4):\n s=input()\n for item in s:\n L[item]+=1\n\ns=\"123456789\"\ndone=True\nfor item in s:\n if(L[item]>2*k):\n print(\"NO\")\n done=False\n break\nif(done):\n print(\"YES\")\n", "k = int(i...
{ "inputs": [ "1\n.135\n1247\n3468\n5789\n", "5\n..1.\n1111\n..1.\n..1.\n", "1\n....\n12.1\n.2..\n.2..\n", "1\n....\n....\n....\n....\n", "1\n6981\n.527\n4163\n2345\n", "5\n9999\n9999\n9999\n9999\n", "2\n4444\n3333\n2222\n1111\n", "3\n2123\n1232\n2321\n3213\n", "2\n1...\n.1..\n..1....
interview
https://codeforces.com/problemset/problem/373/A
4,270
You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where ...
["N = int(input())\nv = sorted(map(int, input().split()))\n\ntmp = v[0]\nfor i in range(1,N):\n tmp = (tmp+v[i])/2.0\n \nprint(tmp)", "N = int(input())\nv = [int(x) for x in input().split()]\nv.sort()\nans = (v[0]+v[1])/2.0\nfor i in range(2, N):\n ans = float(ans+v[i])/2\nprint(ans)", "n=int(input())\nv =list(map(i...
{"inputs": ["2\n3 4\n", "3\n500 300 200\n", "5\n138 138 138 138 138\n", "2\n1 1\n", "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1...
introductory
https://atcoder.jp/contests/abc138/tasks/abc138_c
2,412
A telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not. Also, sequences that contain at least one 0 are ugly. You are given a string $s$ of length $n$, consisting of digits....
["for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tfor i in range(len(s)-10):\n\t\tif(s[i] == '8'):\n\t\t\tprint(\"YES\")\n\t\t\tbreak\n\telse:\n\t\tprint(\"NO\")\t\t", "N = int(input())\n\nfor i in range(N):\n l = int(input())\n \n S = input()\n \n if '8' in S and len(S) - S.index('8'...
{ "inputs": [ "2\n13\n7818005553535\n11\n31415926535\n", "1\n11\n80000000000\n", "1\n11\n83583640644\n" ], "outputs": [ "YES\nNO\n", "YES\n", "YES\n" ] }
interview
https://codeforces.com/problemset/problem/1167/A
1,695
A class of students wrote a multiple-choice test. There are $n$ students in the class. The test had $m$ questions, each of them had $5$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $i$ worth $a_i$ points. Incorrect answers are graded with ze...
["from collections import Counter\nn, m = map(int, input().split())\nl = [input() for _ in range(n)]\nv = [*map(int, input().split())]\nres = 0\nfor i in range(m):\n res += v[i] * max(Counter(s[i] for s in l).values())\nprint(res)", "from sys import stdin, stdout, exit\n\nn,m = list(map(int, stdin.readline().split()...
{ "inputs": [ "2 4\nABCD\nABCE\n1 2 3 4\n", "3 3\nABC\nBCD\nCDE\n5 4 12\n", "2 5\nABCDE\nABCDE\n2 3 5 7 11\n", "6 5\nAAAAA\nAAAAB\nAAABB\nAABBB\nABBBB\nBBBBB\n999 13 877 342 1\n", "1 1\nD\n965\n", "2 1\nB\nA\n317\n", "1 2\nBC\n741 648\n", "2 2\nEB\nEB\n541 569\n", "10 10\nCBBBBBBBB...
interview
https://codeforces.com/problemset/problem/1201/A
1,091
In this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bidder secretly informs the organizer of the auction price he is willing to pay. After that, the auct...
["n=int(input())\n\nL=list(map(int,input().split()))\n\nind=L.index(max(L))\n\nL.remove(max(L))\n\nx=max(L)\n\nprint(ind+1,x)\n", "n=int(input())\na=list(map(int,input().split()))\nif a[0]>a[1]:\n i=0\n j=1\nelse:\n j=0\n i=1\nfor k in range(2,n):\n if a[k]>a[i]:\n j=i\n i=k\n elif a[k]>...
{ "inputs": [ "2\n5 7\n", "3\n10 2 8\n", "6\n3 8 2 9 4 14\n", "4\n4707 7586 4221 5842\n", "5\n3304 4227 4869 6937 6002\n", "6\n5083 3289 7708 5362 9031 7458\n", "7\n9038 6222 3392 1706 3778 1807 2657\n", "8\n7062 2194 4481 3864 7470 1814 8091 733\n", "9\n2678 5659 9199 2628 7906 74...
interview
https://codeforces.com/problemset/problem/386/A
4,183
We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds. Initially, the hand of every clock stands still, pointing directly upward. Now, Dolphin starts all the clocks simultaneously. Every second, Dolphin thinks about manually resetting the i-th clock back to 0. In how many ...
["\nimport math\nfrom functools import reduce\n\nurl = \"https://atcoder.jp//contests/abc070/tasks/abc070_c\"\n\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\ndef main():\n count = int(input())\n clocks = []\n for i in range(count):\...
{"inputs": ["2\n2\n3\n", "5\n2\n5\n10\n1000000000000000000\n1000000000000000000\n", "75\n22\n1968854689373829\n87153\n51936214827607\n174306\n89708007429503\n37408239098102751\n5282\n89708007429503\n57\n417\n28328844451422\n311617288965642\n822981260158260522\n14164422225711\n2\n5920728490347198\n103872429655214\n28328...
introductory
https://atcoder.jp/contests/abc070/tasks/abc070_c
440
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange. Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consec...
["n = int(input())\ns = input()\nt = []\nvowels = 'aeiouy'\nfor c in s:\n if t and t[-1] in vowels and c in vowels:\n continue\n else:\n t.append(c)\nprint(''.join(t))\n", "n=int(input())\ns=list(input())\nel=0\nwhile el+1<len(s):\n if s[el] in 'aeiouy' and s[el+1] in \"aeiouy\":\n del s[e...
{ "inputs": [ "5\nweird\n", "4\nword\n", "5\naaeaa\n", "100\naaaaabbbbboyoyoyoyoyacadabbbbbiuiufgiuiuaahjabbbklboyoyoyoyoyaaaaabbbbbiuiuiuiuiuaaaaabbbbbeyiyuyzyw\n", "69\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "12\nmmmmmmmmmmmm\n", "18\nyaywptqwuyiqypwoyw...
interview
https://codeforces.com/problemset/problem/938/A
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
5