Search is not available for this dataset
problem_id
string
problem
string
answer
string
test_cases
string
eval_spec
string
source
string
source_platform
string
original_domain
string
category
float64
codecontests__test__code_contests_train.riegeli-00013-of-00128_80
We will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a. For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times. Given are N strings s_1, s_2, \ldots, s...
[{"code": "N = int(input())\nfrom collections import Counter\nS = [''.join(sorted(input())) for _ in range(N)]\nans = 0\nfor i in Counter(S).values():\n ans += i*(i-1)//2 \nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-000...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__t...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00013-of-00128_84
We call a 4-digit integer with three or more consecutive same digits, such as 1118, good. You are given a 4-digit integer N. Answer the question: Is N good? Constraints * 1000 ≤ N ≤ 9999 * N is an integer. Input Input is given from Standard Input in the following format: N Output If N is good, print `Yes`; ot...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString N = sc.next();\n\t\tsc.close();\n\t\t\n\t\tif(N.charAt(0) == N.charAt(1)) {\n\t\t\tif(N.charAt(1) == N.charAt(2)) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t}...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "7777"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_84__pub...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00013-of-00128_85
You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. Constraints * A and B are integers. * 1 ≤ A, B ≤ 9 Input Input is given from Standard Input in the following format: A B Output If A + B is 10 or greater, print the string `e...
[{"code": "#include<iostream>\nusing namespace std;\nint main(){\n int a,b;\n cin>>a>>b;\n if(a+b>=10)\n cout<<\"error\"<<endl;\n else\n cout<<a+b<<endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_85__ref__00...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "error"}, "input": {"kind": "stdin", "value": "6 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_85__pu...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00013-of-00128_86
Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. Constraints * c is a lowercase English letter. Input The input is given from Standard Input in the following format: c Output If c is a vowel, print `vowel`. Oth...
[{"code": "print([\"consonant\",\"vowel\"][input() in \"aiueo\"])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_86__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\n\npublic class Main{\n public stati...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "consonant"}, "input": {"kind": "stdin", "value": "s"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_86__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_0
Aditi recently discovered a new magic trick. First, she gives you an integer N and asks you to think an integer between 1 and N. Then she gives you a bundle of cards each having a sorted list (in ascending order) of some distinct integers written on it. The integers in all the lists are between 1 and N. Note that the s...
[{"code": "for cas in xrange(input()):\n n, c, Fc1, Fc2 = input(), 1, 1, 2\n while Fc2 <= n:\n Fc1, Fc2, c = Fc2, Fc1+Fc2, c+1\n print c", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_0__ref__0000", "source...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1\n3\n"}, "input": {"kind": "stdin", "value": "2\n1\n4"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_1
Chef has a sequence of N numbers. He like a sequence better if the sequence contains his favorite sequence as a substring. Given the sequence and his favorite sequence(F) check whether the favorite sequence is contained in the sequence Input The first line will contain the number of test cases and are followed by t...
[{"code": "import sys\n\nt = int(sys.stdin.readline())\n\nfor frutta in range(t):\n\tlN = int(sys.stdin.readline())\n\tl1 = map(int,sys.stdin.readline().split())\n\n\tlF = int(sys.stdin.readline())\n\tl2 = map(int,sys.stdin.readline().split())\n\t\n\tsePuede = True\n\tfor x in l2:\n\t\tsePuede = sePuede and (x in l1) \...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nNo\n"}, "input": {"kind": "stdin", "value": "2\n6\n1 2 3 4 5 6\n3\n2 3 4\n6\n22 5 6 33 1 4\n2\n4 15"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_2
Did you ever hear about 'Dragon Food' ? Its used to refer to the chocolates bought for your loved ones :). Po offers dragon food to master Shifu, who is a famous cook in the valley of food. In return, Shifu hands over the dragon scroll to Po, which is said to hold the ingredients of the secret recipe. To open the drago...
[{"code": "__author__ = 'deveshbajpai'\n\n\ndef solve(n,a,b):\n bin_a = bin(a).split('b')[1]\n bin_b = bin(b).split('b')[1]\n\n\n cn1_bin_a = countNoOf1(bin_a)\n cn1_bin_b = countNoOf1(bin_b)\n\n\n v = n-(cn1_bin_a+cn1_bin_b)\n\n\n result = \"\"\n if v==0:\n result = '1'*n\n elif v>0:\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "7\n16\n14\n"}, "input": {"kind": "stdin", "value": "3\n3 5 4\n5 0 1\n4 3 7"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_5
Sergey has made N measurements. Now, he wants to know the average value of the measurements made. In order to make the average value a better representative of the measurements, before calculating the average, he wants first to remove the highest K and the lowest K measurements. After that, he will calculate the averag...
[{"code": "for t in xrange(int(raw_input())):\n n, k = map(int, raw_input().split())\n if k == 0:\n a = map(int, raw_input().split())\n else:\n a = sorted(map(int, raw_input().split()))[k:-k]\n print '{:.6f}'.format(float(sum(a))/len(a))", "is_known_correct": true, "language": "python", "metadata": {}, "solut...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "4.000000\n5.400000\n1.000000\n"}, "input": {"kind": "stdin", "value": "3\n5 1\n2 9 -10 25 1\n5 0\n2 9 -10 25 1\n3 1\n1 1 1"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_77
Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1. Constraints * 0 \leq x \leq 1 * x is an integer Input Input is given from Standard Input in the following format: x Output Print 1 if x is equal to 0, or 0 if x is equal ...
[{"code": "#include<cstdio>\nint main(){int x;scanf(\"%d\",&x);printf(\"%d\\n\",x^1);}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\npublic class Main {\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_77__public__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_78
Constraints * All values in input are integers. * 1\leq N, M\leq 12 * 1\leq X\leq 10^5 * 1\leq C_i \leq 10^5 * 0\leq A_{i, j} \leq 10^5 Input Input is given from Standard Input in the following format: N M X C_1 A_{1,1} A_{1,2} \cdots A_{1,M} C_2 A_{2,1} A_{2,2} \cdots A_{2,M} \vdots C_N A_{N,1} A_{N,2} \cdots A_{...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\n#define rep(i,n) for(int i=0;i<(n);i++)\n\nint main(){\nint n,m,x;\ncin >> n >> m >> x;\n\nint a[15],cost;\nint inf = 1100000000;\nint ans = inf;\n\nint v[15][15];\n\nrep(i,n){\n rep(j,m+1) cin >> v[i][j];\n}\n\n\nrep(bit,1<<n){\n int cost =0;\n vector<int> ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_tr...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_79
Takahashi has K 500-yen coins. (Yen is the currency of Japan.) If these coins add up to X yen or more, print `Yes`; otherwise, print `No`. Constraints * 1 \leq K \leq 100 * 1 \leq X \leq 10^5 Input Input is given from Standard Input in the following format: K X Output If the coins add up to X yen or more, prin...
[{"code": "k,x=map(int,input().split());print('YNeos'[500*k<x::2])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "1 501"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_79__pub...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_80
There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you have already done. Find the maximum total reward that you can ea...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nstruct qwq{\n\tint a,b;\n\tinline bool operator<(const qwq &x)const{\n\t return a<x.a;\n\t}\n} x[100005];\npriority_queue<int> q;\nint main(){\n\tint n,m,i,j=1,s=0;\n\tcin>>n>>m;\n\tfor(i=1;i<=n;++i)\n\t cin>>x[i].a>>x[i].b;\n\tsort(x+1,x+n+1);\n\tfor(i=1;i<...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "5 3\n1 2\n1 3\n1 4\n2 1\n2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_83
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. Constraints * 1 \leq A \leq 100 * 1 \leq B \leq 100 * 1 \leq X \leq 200 * All values in input...
[{"code": "a,b,x=map(int,input().split())\nprint(\"YES\" if a+b-x>=0 and x>=a else \"NO\")", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "#include<iostream>\nusing namespac...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "NO"}, "input": {"kind": "stdin", "value": "2 2 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_83__pub...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_84
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) Constraints * 1≤N≤86 * It is guaranteed that the answer is less than 10^{18}. ...
[{"code": "n = int(input())\nl = [2, 1]\nfor i in range(n-1):\n l.append(l[i]+l[i+1])\nprint(l[-1])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_84__ref__0000", "source": "benchmark"}, {"code": "#include<iostream>\nus...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "11"}, "input": {"kind": "stdin", "value": "5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_84__public_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_85
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. Constraints * 2 ≤ |S| ≤ 26, where |S| denotes the length of S. * S consists of lowercase English letters. Input Input is given from Standard Input in the following format: S Output If all ...
[{"code": "s=input();print(\"yneos\"[len(set(s))<len(s)::2])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_85__ref__0000", "source": "benchmark"}, {"code": "l = input()\ns = set(l)\nprint(\"yes\" if len(l)==len(s) else \"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "yes"}, "input": {"kind": "stdin", "value": "uncopyrightable"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00014-of-00128_86
There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nstring a[100];\nint main()\n{\n\tint b,c;\n\tcin>>b>>c;\n\tfor(int i=0;i<b;i++){\n\t\tcin>>a[i];\n\t}\n\tfor(int j=0;j<b;j++){\n\t\tcout<<a[j]<<endl;\n\t\tcout<<a[j]<<endl;\n\t}\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "co...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00014-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": ".....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_1
Chef loves squares! You are given N points with integers coordinates, Chef asks you to find out how many points he should add to these set of N points, so that one could create at least one square having its vertices from the points of the resulting set. Note that the square created need not to be parallel to the axis....
[{"code": "n = input()\ns = []\ndic = {}\nfor i in range(n):\n a = map(int,raw_input().split())\n s.append(a)\n foo = str(a[0])+','+str(a[1])\n dic[foo] = 1\nif n == 0:\n print '4'\nelif n == 1:\n print '3'\nelif n == 2:\n print '2'\nelse:\n ans = 2\n for i in range(n-1):\n for j in ra...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "5\n0 0\n100 100\n200 200\n100 0\n0 100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_4
Lucy had recently learned the game, called Natural Numbers. The rules of the game are really simple. There are N players. At the same time, every player says one natural number. Let's call the number said by the i-th player Ai. The person with the smallest unique number (that is, the smallest number that was not said b...
[{"code": "t=int(raw_input())\nwhile(t):\n\tt-=1\n\tn=int(raw_input())\n\ttable={}\n\tans=\"Nobody wins.\"\n\twhile(n):\n\t\tn-=1\n\t\tname,num=map(str,raw_input().split())\n\t\tnum=int(num)\n\t\tif num in table:\n\t\t\ttable[num].append(name)\n\t\telse:\n\t\t\ttable[num]=[name]\n\t\n\tfor i in sorted(table):\n\t\tif l...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "Lucy\nNobody wins.\n"}, "input": {"kind": "stdin", "value": "2\n5\nKouta 1\nYuka 1\nMayu 3\nLucy 2\nNana 5\n2\nLucy 2\nNana 2"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_77
Given are integers a,b,c and d. If x and y are integers and a \leq x \leq b and c\leq y \leq d hold, what is the maximum possible value of x \times y? Constraints * -10^9 \leq a \leq b \leq 10^9 * -10^9 \leq c \leq d \leq 10^9 * All values in input are integers. Input Input is given from Standard Input in the follo...
[{"code": "lines = map(int,input().split())\na,b,c,d = lines\n\nprint(max(a*c,a*d,b*c,b*d))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "a, b, c, d = map(int, input().spl...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "1000000000000000000"}, "input": {"kind": "stdin", "value": "-1000000000 0 -1000000000 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contes...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_78
The Kingdom of Takahashi has N towns, numbered 1 through N. There is one teleporter in each town. The teleporter in Town i (1 \leq i \leq N) sends you to Town A_i. Takahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K...
[{"code": "n, k = map(int, input().split())\na = list(map(int, input().split()))\n\ns = []\nord = [-1] * (n+1)\n\nv = 1\nwhile ord[v] == -1:\n ord[v] = len(s)\n s.append(v)\n v = a[v-1]\n\nc = len(s) - ord[v]\nl = ord[v]\n\nans = 0\nif k < l:\n ans = s[k]\nelse:\n k -= l\n k %= c\n ans = s[l+k]\npr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "6 727202214173249351\n6 5 2 5 3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rie...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_79
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)? Constraints * 3 \leq N \leq 50 * S consists of uppercase English letters. Input Input is given from Standard Input in the following format: N S ...
[{"code": "n = input()\nprint(input().count('ABC'))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "_,s=open(0);print(s.count(\"ABC\"))", "is_known_correct": true, "language...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "19\nTHREEONEFOURONEFIVE"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00015...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_80
There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge. Additionally, there is a button on Vertex N. We will play a game on this graph. You start the game on Vertex 1 with zero coins, and head for V...
[{"code": "n,m,p = map(int, input().split())\nedge = []\ninv_link = [[] for _ in range(n)]\nlink = [[] for _ in range(n)]\n\nfor i in range(m):\n a,b,cost = list(map(int,input().split()))\n edge.append([a-1,b-1,p-cost])\n link[a-1].append(b-1)\n inv_link[b-1].append(a-1)\n\ndef bell(edges, start,num_v):\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "2 2 10\n1 2 100\n2 2 100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-000...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_81
On the Planet AtCoder, there are four types of bases: `A`, `C`, `G` and `T`. `A` bonds with `T`, and `C` bonds with `G`. You are given a letter b as input, which is `A`, `C`, `G` or `T`. Write a program that prints the letter representing the base that bonds with the base b. Constraints * b is one of the letters `A`...
[{"code": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s = br.readLine();\n \n if(s.equals(\"A\")) System.out.println(\"T\");\n else if(s.equal...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "C"}, "input": {"kind": "stdin", "value": "G"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_81__public__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_83
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. Constraints * 2 ...
[{"code": "#coding:utf-8\nN=input()\nA=map(int,raw_input().split())\nA.sort()\nn=A[-1]\nmed=n/2\np=0\nmi=1145141919810\nfor i,a in enumerate(A):\n b=min(a,n-a)\n if abs(b-med) < mi:\n p=i; mi=abs(b-med)\nprint(\"%d %d\"%(n,A[p]))\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "11 6"}, "input": {"kind": "stdin", "value": "5\n6 9 4 2 11"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_84
Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in...
[{"code": "import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\t\n\tpublic static void main(String[] args){\n\t\tsolve();\n\t}\n\t\n\tpublic static void solve(){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint z = sc.nextInt();\n\t\tint x = z;\n\t\tint a = x/1000;\n\t\tx -= x/1000*1000;\n\t\tint b = x/100...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "1+2+2+2=7"}, "input": {"kind": "stdin", "value": "1222"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_8...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00015-of-00128_85
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();\n\t\tboolean[][] dp = new boolean[101][10010];\n\t\tdp[0][0] = tr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "35"}, "input": {"kind": "stdin", "value": "3\n10\n10\n15"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00015-of-00128...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_2
The Chef is sleeping now. He tries to cook new kind of meals in his dream. These meals are arranged in a row and numbered from 1 to N consecutively. For each meal i (1<=i<=N) there is given one integer f(i) which denotes the time needed to cook it. Initially, all meals are uncooked. Each assistant of The Chef (the...
[{"code": "n, k = map(int, raw_input().split())\ntimes = map(int, raw_input().split())\ntimes = sorted(zip(times, xrange(len(times))), key=lambda x: x[0])\n\ncnt, i = 0, 0\nwhile(i < n):\n j = i+1\n while(j < n and times[i][0] == times[j][0] and times[j][1] - times[i][1] < k):\n j += 1\n cnt += 1\n i = j\nprint c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "5 3\n40 30 40 30 40"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_3
Vlad enjoys listening to music. He lives in Sam's Town. A few days ago he had a birthday, so his parents gave him a gift: MP3-player! Vlad was the happiest man in the world! Now he can listen his favorite songs whenever he wants! Vlad built up his own playlist. The playlist consists of N songs, each has a unique positi...
[{"code": "t=int(raw_input())\n\ndef fun(pivot, n,rn):\n sm=0\n for j in range(rn):\n if n[j]<pivot:\n sm+=1\n sm+=1\n print sm\n \nfor i in range(t):\n rn=int(raw_input())\n n=map(int, raw_input().split())\n k=int(raw_input())\n pivot=n[k-1]\n fun(pivot,n,rn)", "...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "3\n4\n1\n"}, "input": {"kind": "stdin", "value": "3\n4\n1 3 4 2\n2\n5\n1 2 3 9 4\n5\n5\n1 2 3 9 4 \n1"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_4
Alice has learnt factorization recently. Bob doesn't think she has learnt it properly and hence he has decided to quiz her. Bob gives Alice a very large number and asks her to find out the number of factors of that number. To make it a little easier for her, he represents the number as a product of N numbers. Alice is ...
[{"code": "def primes(n):\n primfac = []\n d = 2\n while d*d <= n:\n while (n % d) == 0:\n primfac.append(d)\n n /= d\n d += 1\n if n > 1:\n primfac.append(n)\n return primfac\ndef hist(s):\n d = dict()\n for i in s:\n if i in d:\n d[i] +=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "8\n10\n3\n"}, "input": {"kind": "stdin", "value": "3\n3\n3 5 7\n3\n2 4 6\n2\n5 5"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_77
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7. Constraints * 1 \leq N \leq 10^6 * N is an in...
[{"code": "N = int(input())\n\nans = 10**N - 2*(9**N) + 8**N\nprint(ans % 1000000007)\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\nimport java.io.*...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "2511445"}, "input": {"kind": "stdin", "value": "869121"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_7...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_78
There are N blocks arranged in a row. Let us paint these blocks. We will consider two ways to paint the blocks different if and only if there is a block painted in different colors in those two ways. Find the number of ways to paint the blocks under the following conditions: * For each block, use one of the M colors...
[{"code": "#include <iostream>\nusing namespace std;\n\nlong long n, m, k, t = 0;\nlong long p[200001], q[200001], r[200001];\nconst long long M = 998244353;\n\nlong long pow(long long a, long long b) {\n\tlong long w = 1, x = a;\n\n\twhile (b) {\n\t\tif (b & 1)\n\t\t\tw = w * x % M;\n\n\t\tx = x * x % M;\n\t\tb >>= 1;...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "73074801"}, "input": {"kind": "stdin", "value": "100 100 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_79
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-co...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n#define int long long\n\nint gcd(int a, int b){\n\tif(b == 0){\n\t\treturn a;\n\t}\n\telse{\n\t\treturn gcd(b, a % b);\n\t}\n}\n\nint lcm(int a, int b){\n\treturn (a / gcd(a, b)) * b;\n}\n\nsigned main(){\n\tint N, M, i;\n\tscanf(\"%lld%lld\", &N, &M);\n\tvecto...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "3 100\n14 22 40"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-0012...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_80
Given are a prime number p and a sequence of p integers a_0, \ldots, a_{p-1} consisting of zeros and ones. Find a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \ldots + b_0, satisfying the following conditions: * For each i (0 \leq i \leq p-1), b_i is an integer such that 0 \leq b_i \le...
[{"code": "\npublic class Main {\n\n private static void solve() {\n int p = ni();\n int[] a = na(p);\n\n int[][] fif = enumFIF(p - 1, p);\n\n\n int[] ret = new int[p];\n for (int i = 0; i < p; i++) {\n if (a[i] == 0)\n continue;\n\n int f = 1;\n for (int j = p - 1; j >= 0; j--) {\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "1 1"}, "input": {"kind": "stdin", "value": "2\n1 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_80__p...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_81
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S. Here, a ACGT string is a string that contains no characters other than `A`, `C`, `G` and `T`. Constraints * S is a string of length between 1 and 10 (inclusive). * Each c...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//入力表示\n\t\tString S = sc.next();\n\t\tint count=0;\n\t\tint ans =0;\n\t\n\t\tchar [] a= S.toCharArray();\n\t\t for(int i=0;i<a.length...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "SHINJUKU"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_81__p...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_84
Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and...
[{"code": "h,w = map(int,input().split())\nc = [list(map(int,input().split())) for i in range(10)]\nA = [list(map(int,input().split())) for i in range(h)]\n\nfor k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j],c[i][k]+c[k][j])\nans = 0\nfor i in range(h):\n fo...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "12"}, "input": {"kind": "stdin", "value": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 ...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00016-of-00128_85
You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below. Fortunately, you are a skilled magician, capable of causing expl...
[{"code": "// D - Widespread\n#include <bits/stdc++.h>\nusing namespace std;\nusing LL = long long;\n#define rp(i,n) for(int i=0;i<(n);++i)\n#define roundup(a,b) (((a)+(b)-1)/(b))\n\nint main(){\n\tint N,A,B; cin>>N>>A>>B;\n\tvector<LL> H(N); rp(i, N) cin>>H[i];\n\n\tint ans = INT_MAX;\n\tLL ab = (LL)A - B;//additional...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00016-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "800000000"}, "input": {"kind": "stdin", "value": "5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codec...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_1
Chef is playing a game. Currently in the game, he is at a field full of stones. There are total N kinds of stones. There is unlimited supply of each kind of stone. Chef knows that one stone of kind i needs Ai minutes to pick it from the ground and it will give Chef a profit of Bi Rs. Chef has K minutes of free time. ...
[{"code": "from sys import stdin,stdout \ntc=int(raw_input())\nwhile tc!=0:\n n,k = map(int,raw_input().split())\n s1 = raw_input()\n s2 = raw_input()\n lista = map(int,s1.split())\n listb = map(int,s2.split())\n i=0\n profit=0\n while i<n:\n temp = (k/lista[i])*listb[i]\n if temp>...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "12\n"}, "input": {"kind": "stdin", "value": "1\n3 10\n3 4 5\n4 4 5"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_77
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7. Constraints * 1 \leq S \leq 2000 * All values in input are integers. Input Input is given from Standard Input in ...
[{"code": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n Scanner in;\n InputStream is;\n PrintWriter out;\n String INPUT = \"\";\n//----------------------------------------------------------------------------------------------------//\n int INF = Integer.MAX_VALUE;\n int m = (int) (1e9) + ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_77__public__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_78
A bracket sequence is a string that is one of the following: 1. An empty string; 2. The concatenation of `(`, A, and `)` in this order, for some bracket sequence A ; 3. The concatenation of A and B in this order, for some non-empty bracket sequences A and B / Given are N strings S_i. Can a bracket sequence be forme...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n cin.tie(0);\n ios::sync_with_stdio(false);\n int N; cin >> N;\n vector<int> sum(N,0),Min(N,0);\n int Sum=0;\n for (int i=0;i<N;++i){\n string S; cin >> S;\n for (int j=0;j<S.size();++j){\n sum[i]+=(S[j]...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "3\n(((\n)\n)"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_79
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \time...
[{"code": "#include \"bits/stdc++.h\"\nusing namespace std;\n\nlong long MOD = 1000 * 1000 * 1000 + 7;\n\nlong long p(long long a, long long b) {\n\tif (b == 0) return 1;\n\tif (b == 1) return a;\n\tlong long ha = p(a, b/2);\n\tif (b % 2 == 0) return (ha * ha) % MOD;\n\treturn (((ha * ha) % MOD) * a) % MOD;\n}\n\nint m...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "124"}, "input": {"kind": "stdin", "value": "2\n5 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_79__p...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_80
We have two bottles for holding water. Bottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water. Bottle 2 contains C milliliters of water. We will transfer water from Bottle 2 to Bottle 1 as much as possible. How much amount of water will remain in Bottle 2? Constraints * All val...
[{"code": "A, B, C = list(map(int,input().split()))\nprint(max((B+C-A),0))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "import java.util.Scanner;\n\npublic class Main {\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "12 3 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_80__pub...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_81
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many t...
[{"code": "import sys\ninput=sys.stdin.readline\nn,q=map(int,input().split())\ns=input();a=[0]*2\nfor i in range(2,n+1):\n a+=[a[i-1]+s[i-2:i].count(\"AC\")]\nfor _ in range(q):\n l,r=map(int,input().split())\n print(a[r]-a[l])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontes...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "2\n0\n3"}, "input": {"kind": "stdin", "value": "8 3\nACACTACG\n3 7\n2 3\n1 8"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_83
There is an H \times W grid (H vertical, W horizontal), where each square contains a lowercase English letter. Specifically, the letter in the square at the i-th row and j-th column is equal to the j-th character in the string S_i. Snuke can apply the following operation to this grid any number of times: * Choose two...
[{"code": "#include <cstdio>\n#include <map>\nusing namespace std;\ntypedef unsigned long long ULL;\nconst int N=15;\nconst ULL B=133333;\nint n,m;\nchar str[N][N];\ninline int abs(int x){\n\treturn x>=0?x:-x;\n}\nvoid readData(){\n\tscanf(\"%d%d\",&n,&m);\n\tfor(int i=1;i<=n;i++)\n\t\tscanf(\"%s\",str[i]+1);\n}\nbool ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "NO"}, "input": {"kind": "stdin", "value": "3 7\natcoder\nregular\ncontest"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riege...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_84
In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] inputArr = sc.nextLine().split(\" \");\n\t\tsc.close();\n\t\tchar input1 = inputArr[0].charAt(0);\n\t\tchar input2 = inputArr[1].charAt(0);\n\t\t \n\t\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "="}, "input": {"kind": "stdin", "value": "F F"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_84__public...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00017-of-00128_86
There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i). We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|). You have a peculiar pair of compasses, called Manhattan Compass. This instrument always points at two of the pinholes. The two legs ...
[{"code": "#include<bits/stdc++.h>\n#define sz(x) ((int)(x).size())\n#define all(x) (x).begin(),(x).end()\n#define rep(i,a,b) for (int i=(a); i<(b); i++)\n#define per(i,a,b) for (int i=(b-1); i>=(a); i--)\n#define debug(x) cout << #x << \" => \" << x << endl\nusing namespace std;\n\n#define fi first\n#define se second\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00017-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "6 2 3\n1 3\n5 3\n3 5\n8 4\n4 7\n2 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.r...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_1
Chef has N subordinates. In order to complete a very important order he will choose exactly K of them. He can't choose less than K since it will be not enough to complete the order in time. On the other hand if he chooses more than K subordinates he can't control them during the operation. Help him to find the number o...
[{"code": "import sys\ndef nCr (n,k) :\n\n\tif k == 0 :\n\t\treturn 1\n\telse :\n\t\treturn ( n*(nCr(n-1,k-1))/k )\n\nT = int(raw_input())\n\nwhile T :\n\t\n\tT-=1\n\t\n\tn , k = map(int,sys.stdin.readline().split())\n\tif n < k :\n\t\tprint \"0\"\n\telif n == k :\n\t\tprint \"1\"\n\telse :\n\t\tif k > n-k :\n\t\t\tk =...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "2\n1\n252\n"}, "input": {"kind": "stdin", "value": "3\n2 1\n3 3\n10 5"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_4
The Head Chef is interested in studying interactions between his chefs . There are N chefs with ids 1 to N . Each chef trusts some of the other chefs . The relation of trust is one way . Also , a chef may trust chefs only with ids strictly greater than his/her id .A chef with id = i , trusts the chefs with next ni id...
[{"code": "n,b = map(int,raw_input().split())\na = [0]\nfor i in range(n):\n\ta.append(int(raw_input()))\n\ndp = []\nss = []\nfor i in range(n+2):\n\tdp.append(0)\n\tss.append(0)\n\t\ndp[b] = 1\nss[b] = 1\nM = 1000000007\n\n\nfor i in range(b-1,0,-1):\n\tdp[i] = (ss[i+1]-ss[i+a[i]+1])%M\n\tss[i] = (dp[i] + ss[i+1])%M\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2\n1"}, "input": {"kind": "stdin", "value": "3 3\n2\n1\n0\n2\n1\n2"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_77
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-...
[{"code": "#include <iostream>\n#include <vector>\n#include <algorithm>\nusing namespace std;\nvector<long long> u,v;\nint main(){\n int i,n; cin >> n;\n for(i=0;i<n;i++){\n long long x,y; cin >> x >> y;\n u.push_back(x + y),v.push_back(x - y);\n }\n sort(u.begin(),u.end()); sort(v.begin(),v.e...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "3\n1 1\n2 4\n3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_78
AtCoder Inc. holds a contest every Saturday. There are two types of contests called ABC and ARC, and just one of them is held at a time. The company holds these two types of contests alternately: an ARC follows an ABC and vice versa. Given a string S representing the type of the contest held last week, print the str...
[{"code": "#include<iostream>\nusing namespace std;\nint main()\n{\n\tstring s;\n\tcin>>s;\n\tif(s[1]=='B')cout<<\"ARC\";\n\tif(s[1]=='R')cout<<\"ABC\";\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_78__ref__0000", "sourc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "ARC"}, "input": {"kind": "stdin", "value": "ABC"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_79
Given are two sequences a=\\{a_0,\ldots,a_{N-1}\\} and b=\\{b_0,\ldots,b_{N-1}\\} of N non-negative integers each. Snuke will choose an integer k such that 0 \leq k < N and an integer x not less than 0, to make a new sequence of length N, a'=\\{a_0',\ldots,a_{N-1}'\\}, as follows: * a_i'= a_{i+k \mod N}\ XOR \ x F...
[{"code": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na = a + a[:-1]\n\nda = [a[i] ^ a[i+1] for i in range(len(a) - 1)]\ndb = [b[i] ^ b[i+1] for i in range(len(b) - 1)]\n\n\nfail = [0 for i in range(len(da))]\nfail[0] = -1\np = 0\nfor q in range(2, len(da)):\n while p...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "2 2\n5 5"}, "input": {"kind": "stdin", "value": "6\n0 1 3 7 6 4\n1 5 4 6 2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_80
Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros). Constraints * 1 \leq N \leq 10^5 Input Input is given from Standard Input in the following format: N Output Print the number of positive integers less than ...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tsc.close();\n\t\tint r = 0;\n\t\tfor(int i = 1; i <= N; i++) {\n\t\t\tint l = String.valueOf(i).length();\n\t\t\tif(l % 2 != 0) r++;\n\t\t}\n\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "11"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_80__public_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_81
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent chara...
[{"code": "N = int(input())\nmemo = [{} for i in range(N + 1)]\nMOD = 10 ** 9 + 7\n\ndef ok(last4):\n \n \n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i], t[i - 1] = t[i - 1], t[i]\n if \"\".join(t).count(\"AGC\") >= 1:\n return False\n \n return ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "230"}, "input": {"kind": "stdin", "value": "4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_81__public...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_83
Takahashi has an ability to generate a tree using a permutation (p_1,p_2,...,p_n) of (1,2,...,n), in the following process: First, prepare Vertex 1, Vertex 2, ..., Vertex N. For each i=1,2,...,n, perform the following operation: * If p_i = 1, do nothing. * If p_i \neq 1, let j' be the largest j such that p_j < p_i. S...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int n; scanf(\"%d\", &n);\n vector<vector<int>> g(n);\n for (int i = 0; i < n - 1; ++i) {\n int u, v; scanf(\"%d%d\", &u, &v);\n u--, v--;\n g[u].push_back(v);\n g[v].push_back(u);\n }\n\n vector<int> ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "15\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n4 8\n4 9\n5 10\n5 11\n6 12\n6 13\n7 14\n7 15"}, "metadata": {}, "visibility": "public"}, {"case_id"...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_84
We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two...
[{"code": "x,y,z=map(int,input().split())\nx-=z\nprint(x//(z+y))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_84__ref__0000", "source": "benchmark"}, {"code": "#include<bits/stdc++.h>\nusing namespace std;\nint x,y,z,ans...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "49999"}, "input": {"kind": "stdin", "value": "100000 1 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00018-of-00128_86
There is a string S of length N consisting of characters `0` and `1`. You will perform the following operation for each i = 1, 2, ..., m: * Arbitrarily permute the characters within the substring of S starting at the l_i-th character from the left and extending through the r_i-th character. Here, the sequence l_i i...
[{"code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nconst int maxn = 3010,mod = 1e9 + 7;\nint n,m,sum[maxn],R[maxn],f[maxn][maxn];\nchar s[maxn];\n\nint main()\n{\n scanf(\"%d%d\",&n,&m);\n scanf(\"%s\",s + 1);\n for (int i = 1; i <= n; i++)\n {\n sum[i] = sum[i - 1] + s[i] - '0';\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00018-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "143"}, "input": {"kind": "stdin", "value": "11 6\n00101000110\n2 4\n2 3\n4 7\n5 6\n6 10\n10 11"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_1
Tic-Tac-Toe used to be Chef's favourite game during his childhood. Reminiscing in his childhood memories, he decided to create his own "Tic-Tac-Toe", with rules being similar to the original Tic-Tac-Toe, other than the fact that it is played on an NxN board. The game is played between two players taking turns. First ...
[{"code": "def read():\n return map(int, raw_input().split())\n\ndef is_X(c):\n if c == 'X':\n return 1\n else:\n return 0\n\nT = read()[0]\n\nfor n in range(T):\n N, K = read()\n\n Box =[None for i in range(N)]\n for i in range(N):\n s = raw_input()\n Box[i] = list(s)\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "YES"}, "input": {"kind": "stdin", "value": "1\n4 4\nXOXO\nOX..\nXO..\nOXOX"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riege...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_5
You are given a sequence a1, a2, ..., aN. Find the smallest possible value of ai + aj, where 1 ≤ i < j ≤ N. Input The 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 description consists of a single integer N. The second ...
[{"code": "T = input()\nfor test in range(T):\n\tN = input()\n\tnumbers = map(int, raw_input().split())\n\ta = min(numbers)\n\tnumbers.remove(a)\n\tb = min(numbers)\n\tprint a+b", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00019-of-001...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "4\n"}, "input": {"kind": "stdin", "value": "1\n4\n5 1 3 4"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_77
Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it. Constraints * 1\leq N \leq 2 \times 10^5 *...
[{"code": "from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nfrom math import gcd\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math impo...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "3\n1 1 2\n1 1 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_78
N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town. There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}. Takahashi will walk around this town and make mischief on the Snukes who have no s...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main(void){\n\tint n,k;\n\tcin>>n>>k;\n\tmap<int,bool> m;\n\tfor(int i=1;i<=k;i++){\n\t\tint d;\n\t\tcin>>d;\n\t\tfor(int j=1;j<=d;j++){\n\t\t\tint c;\n\t\t\tcin>>c;\n\t\t\tif(!m[c]) n--,m[c]=true;\n\t\t}\n\t}\n\tcout<<n<<endl;\n\treturn 0;\n}", "is_known_c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "3 2\n2\n1 3\n1\n3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_79
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string. Constraints * S and T are strings consisting of lowercase English letters. * The lengths of S and T are between 1 and 100 (inclusive). Input Input is gi...
[{"code": "import java.util.*;\nclass Main {\n public static void main(String[] args){\n Scanner c=new Scanner(System.in);\n String s=c.next();\n String t=c.next();\n System.out.println(t+s);\n }\n}", "is_known_correct": true, "language": "java", "metadata": {}, "solution_id": "codecontests__test__code_c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "humuhumu"}, "input": {"kind": "stdin", "value": "humu humu"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_80
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. For each square, you will perform either of the following operations once: * Decrease the height of the square by 1. * Do nothing. Determine if it is possible to perform the operations so that the heights ...
[{"code": "import decimal\ndecimal.getcontext().prec = 100\ndef sum1(pre,l,r):\n l=max(l,0)\n if(l==0):\n return pre[r]\n return pre[r] - pre[l - 1]\n\nx=int(raw_input())\narr=map(int,raw_input().split())\nb=[arr[0]-1]\nmi=b[0]\nfor i in range(1,len(arr)):\n if(arr[i]-1>=mi):\n b.append(arr[i]...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "1\n1000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-0012...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_83
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. Constraints * |S|=3 * S consists of `a`, `b` and `c`. Input Input is given from Standard Input in the following format: S Output If S can be obtained by permuting `abc`, print `Yes`; otherwis...
[{"code": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tif(s.matches(\"^(?=.*a)(?=.*b)(?=.*c).*\")) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "bab"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_83__publi...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_84
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
[{"code": "N,M = map(int,input().split())\nprint(int(((N-M)*100+M*1900)/(0.5**M)))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_84__ref__0000", "source": "benchmark"}, {"code": "#include <bits/stdc++.h>\nusing namespace ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "608000"}, "input": {"kind": "stdin", "value": "100 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_84_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00019-of-00128_86
Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\n\t@SuppressWarnings(\"resource\")\n\tpublic static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString w = scanner.next();\n\t\tString h = scanner.next();\n\t\tString n = scanner.next();\n\n\t\tSystem.out.println(\"A\" + h....
[{"case_id": "codecontests__test__code_contests_train.riegeli-00019-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "ABC"}, "input": {"kind": "stdin", "value": "AtCoder Beginner Contest"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_1
Chef spent N days working really hard! He planned loads of tasks: as many as Ai tasks to do on the ith day! Chef's work was brutal, so he only managed to finish Bi tasks on the ith day. The good news is that Chef has a Time Machine! The Time Machine has K white buttons and M black buttons. Each button has a positive i...
[{"code": "for t in xrange(int(raw_input())):\n\tn, k, m = map(int,raw_input().split())\n\ta = map(int,raw_input().split())\n\tb = map(int,raw_input().split())\n\ty = sorted(map(int,(raw_input()+\" \"+raw_input()).split()), reverse = True)\n\tx = []\n\tfor i in xrange(n):\n\t\tx.append(a[i]-b[i])\n\tx = sorted(x, rever...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "1\n4 2 2 \n5 7 6 1\n3 3 1 1\n6 3\n1 4"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_4
Little Egor likes to play with positive integers and their divisors. Bigger the number to play with, more the fun! The boy asked you to come up with an algorithm, that could play the following game: Let's define f(n) as the sum of all odd divisors of n. I.e. f(10) = 1 + 5 = 6 and f(21) = 1 + 3 + 7 + 21 = 32. The game ...
[{"code": "cases = int(raw_input())\n\nwhile(cases):\n\tl,r = map(int,raw_input().split())\n\n\tans = 0\n\t\n\tj = 1\n\twhile(j <= r):\n\t\t#print j\n\t\tans += ((r/j)-((l)/j))*j\n\t\tif(l%j==0):\n\t\t\tans+=j\n\t\tj+=2\n\tprint ans\n\tcases-=1", "is_known_correct": true, "language": "python", "metadata": {}, "solution...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "45\n32\n"}, "input": {"kind": "stdin", "value": "2\n1 10\n42 42"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_5
Professor 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 ...
[{"code": "for i in range(int(raw_input())):\n a=map(int,raw_input().split())\n print '%g' %(a[1]*a[1]-a[0]*a[0])**0.5,\n print '%g' %(a[1]*a[1]+a[0]*a[0])**0.5", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_5__re...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "3.0 6.40312\n6.63325 15.6205\n17.3205 22.3607"}, "input": {"kind": "stdin", "value": "3\n4 5\n10 12\n10 20"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_69
Alice got a message M. It is in an alien language. A string in an alien language is said to be valid if it contains the letter a or z. Alice decided to count the number of valid substrings of the message M. Help him to do this. Two substrings are different if it occurs at different positions in the message. Input ...
[{"code": "t = int(raw_input())\n \nwhile t:\n\tt-=1\n\ts = raw_input().strip()\n\t\n\tcount = 0\n\tprev = 0\n\tcurr = 0\n\tl = len(s)\n\ts = s.replace(\"a\", \"z\")\n\tif \"z\" in s:\n\t\tfor i, v in enumerate(s):\n\t\t\tif v == \"z\":\n\t\t\t\tcount += l - i\n\t\t\t\tprev += curr\n\t\t\t\tcount += prev\n\t\t\t\t\n\t\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_69__public__0000", "expected_output": {"kind": "stdout", "value": "4\n21\n22\n0\n"}, "input": {"kind": "stdin", "value": "4\nabcd\nazazaz\nabbzbba\nflkjdh\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
HACKEREARTH
[]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_78
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be r...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int N, M;\n cin >> N >> M;\n vector<int> H(N);\n int A, B;\n vector<bool> X(N,true);\n for(int i=0; i<N; i++) cin >> H[i];\n for(int i=0; i<M; i++){\n cin >> A >> B;\n if(H[A-1]>=H[B-1]) X[B-1]=false;\n if(H[B-1]>=H[A-1]) X[A-1]=f...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_t...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_79
Takahashi has A cookies, and Aoki has B cookies. Takahashi will do the following action K times: * If Takahashi has one or more cookies, eat one of his cookies. * Otherwise, if Aoki has one or more cookies, eat one of Aoki's cookies. * If they both have no cookies, do nothing. In the end, how many cookies will Taka...
[{"code": "A, B, K = map(int, input().split())\nprint(max(0, A - K), max(0, min(A + B -K, B)))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "\n\nimport java.util.Scanner;\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0 0"}, "input": {"kind": "stdin", "value": "500000000000 500000000000 1000000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_t...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_80
Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost square is always `R`, and the character written on the rightmost square...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nint main(void){\n string s;\n cin>>s;\n int n=s.size();\n int a[100010];\n for(int i=0;i<n;i++) a[i]=1;\n for(int i=0;i+2<n;i++){\n if(s[i]=='R'&&s[i+1]=='R'){\n a[i+2]+=a[i];\n a[i]=0;\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "0 3 3 0 0 0 1 1 0 2 2 0"}, "input": {"kind": "stdin", "value": "RRLLLLRLRRLL"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_83
Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. Constraints * 1 \leq A \leq B \leq 10^9 * 1 \leq K \leq 100 * All values in input are integers. Input Input is give...
[{"code": "#include <iostream>\nusing namespace std;\n\nint main()\n{\n int a, b, k;\n cin >> a >> b >> k;\n\n for(int i = a; i <= b; i++)\n {\n if(i < (a+k) || i > (b-k))\n {\n cout << i << endl;\n }\n }\n return 0;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n4\n5\n6\n7\n8\n9"}, "input": {"kind": "stdin", "value": "2 9 100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_86
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? Constraints * 0 ≤ a ≤ b ≤ 10^{18} * 1 ≤ x ≤ 10^{18} Input The input is given from Standard Input in the following format: a b x Output Print the number of th...
[{"code": "#include <iostream>\nusing namespace std;\n\nint main() {\n long long int a,b,x;\n cin >> a >> b >> x;\n cout << b / x - a / x + (a % x == 0 ? 1 : 0) << endl; \n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00020-of-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "4 8 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_86__publ...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00020-of-00128_87
12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience. There are N children in AtCoder Kindergarten, conveniently numbered 1 through N. Mr. Evi will distribute C indistinguishable candies to the children. If child i is given a candies, the child's happine...
[{"code": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nconst int N = (int)400 + 7;\nconst int mod = (int)1e9 + 7;\n\nint add(int a, int b) {\n\ta += b;\n\tif (a > mod) a -= mod;\n\treturn a;\n}\n\nint mul(int a, int b) {\n\treturn (a * 1LL * b) % mod;\n}\n\nint n, c;\nint a[N], b[N];\nint sum[N][N];\nint s[N][N...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00020-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "139123417"}, "input": {"kind": "stdin", "value": "3 100\n7 6 5\n9 9 9"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_0
There's an array A consisting of N non-zero integers A1..N. A subarray of A is called alternating if any two adjacent elements in it have different signs (i.e. one of them should be negative and the other should be positive). For each x from 1 to N, compute the length of the longest alternating subarray that starts at...
[{"code": "def opposite(a,b):\n if(a<0):\n return b>=0\n else:\n return b<0\n\ndef func(a):\n a2 = [1]*len(a)\n count = 1\n for i in range(len(a)):\n if(count>1):\n count = count-1\n a2[i] = count\n else:\n j = i\n while(j<len(a)-1 a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1 1 1 1\n4 3 2 1\n1 1 3 2 1 1\n"}, "input": {"kind": "stdin", "value": "3\n4\n1 2 3 4\n4\n1 -5 1 -5\n6\n-5 -1 -1 2 -2 -3"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_3
Eugene loves sequences, especially arithmetic progressions. One day he was asked to solve a difficult problem. If a sequence of numbers A1, A2, ... , AN form an arithmetic progression A, he was asked to calculate sum of F(Ai), for L ≤ i ≤ R. F(X) is defined as: If X < 10 then F(X) = X. Else F(X) = F(sum_of_digits(X))....
[{"code": "'''\nCreated on 21-Nov-2015\n\n@author: Lenovo\n'''\ndef F(x):\n return (x-1)%9+1\n \nT =input()\n \nfor t in range(T):\n A, D, L, R = map(int, raw_input().split())\n L-=1;R-=1;\n sum_per9 =0;\n for i in range(1,10): sum_per9 +=F(A+D*i)\n ans =0\n while (R-L+1)%9 != 0:\n ans +=F(A...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "6\n12\n"}, "input": {"kind": "stdin", "value": "2\n1 1 1 3\n14 7 2 4"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_79
Find the minimum prime number greater than or equal to X. Constraints * 2 \le X \le 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: X Output Print the minimum prime number greater than or equal to X. Examples Input 20 Output 23 Input 2 Outpu...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nbool hoge(int a){\n for(ll i=2;i*i <= a;i++){\n if(a%i == 0)return false;\n }\n return true;\n}\nint main(){\n int x;\n cin >> x;\n while(!hoge(x)){x++;}\n cout << x << endl;\n}", "is_known_correct": true, "lang...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "100003"}, "input": {"kind": "stdin", "value": "99992"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_79_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_80
We have a sequence of N integers: A_1, A_2, \cdots, A_N. You can perform the following operation between 0 and K times (inclusive): * Choose two integers i and j such that i \neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element. Compute the maximum possible pos...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int N, K; cin >> N >> K;\n vector<int> A(N), B(N);\n for (int i=0; i<N; i++) cin >> A[i];\n int S = accumulate(A.begin(), A.end(), 0);\n vector<int> divisors;\n for (int i=1; i*i<=S; i++) {\n if (S % i == 0) {\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "8 7\n1 7 5 6 8 2 6 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00021-of...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_84
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
[{"code": "#include<set>\n#include<map>\n#include<deque>\n#include<queue>\n#include<stack>\n#include<cmath>\n#include<ctime>\n#include<bitset>\n#include<string>\n#include<vector>\n#include<cstdio>\n#include<cstdlib>\n#include<cstring>\n#include<climits>\n#include<complex>\n#include<iostream>\n#include<algorithm>\n#defi...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "200"}, "input": {"kind": "stdin", "value": "6\n100 -100 -100 -100 100 -100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rieg...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_86
There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes conta...
[{"code": "#include<iostream>\nusing namespace std;\nint main(){\n long n,x;\n long c=0;\n cin>>n>>x;\n long arr[n];\n for(int i=0;i<n;i++)cin>>arr[i];\n if(arr[0]>x){\n c = arr[0]-x;\n arr[0]=x;\n }\n for(int i=1; i <n; i++){\n int a;\n a = arr[i] + arr[i-1];\n if(a > x){\n c+=a-x;\n a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "2 0\n5 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_86__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00021-of-00128_87
Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long LL;\nconst LL mod = 1e9+7;\n#define MAXN 5000\nLL ksm(LL p, LL q)\n{\n LL ret = 1LL;\n while(q != 0){\n if (q & 1) \n\t\t\tret = ret * p % mod;\n p = p * p % mod;\n q >>= 1;\n }\n return ret;\n}\nLL dp[MAXN+5][M...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00021-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "500886057"}, "input": {"kind": "stdin", "value": "5000\n01000001011101000100001101101111011001000110010101110010000"}, "metadata": {}, "visibility": "public"}, {"case_id": "cod...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_0
The Head Chef has been playing with Fibonacci numbers for long . He has learnt several tricks related to Fibonacci numbers . Now he wants to test his chefs in the skills . A fibonacci number is defined by the recurrence : f(n) = f(n-1) + f(n-2) for n > 2 and f(1) = 0 and f(2) = 1 . Given a number A , determine if...
[{"code": "import sys\n\narr=sys.stdin.read().split()\n\nN=int(arr[0])\n\nnos=[]\nnos1=[]\nk=0\nfor i in range(0,N):\n\tk+=1\n\tnos.append(int(arr[k]))\n\tnos1.append(int(arr[k]))\n\nnos1.sort()\n\ndef bin_search(arr,start,end,x):\n\tmid=(start+end)/2\n\tif(end<start):\n\t\treturn -1\n\tif(arr[mid]==x):\n\t\treturn mid...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nNO\nYES\n"}, "input": {"kind": "stdin", "value": "3\n3\n4\n5"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_1
Chef loves research! Now he is looking for subarray of maximal length with non-zero product. Chef has an array A with N elements: A1, A2, ..., AN. Subarray Aij of array A is elements from index i to index j: Ai, Ai+1, ..., Aj. Product of subarray Aij is product of all its elements (from ith to jth). Input First li...
[{"code": "n=input()\ns=map(int,raw_input().split())\nl=j=0\na=[0]*n\nfor i in s:\n\tif i==0:\n\t\tl=0\n\telse:\n\t\tl+=1\n\t\ta[j]=l\n\t\tj+=1\nprint max(a)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_1__ref__0000", "s...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "0\n"}, "input": {"kind": "stdin", "value": "1\n0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_1__publi...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_2
Chef Shifu and Chef Po are participating in the Greatest Dumpling Fight of 2012. Of course, Masterchef Oogway has formed the rules of the fight. There is a long horizontal rope of infinite length with a center point P. Initially both Chef Shifu and Chef Po will stand on the center P of the rope facing each other. Don...
[{"code": "import fractions\nimport sys\n\ntc = int(raw_input())\nf = fractions.gcd\nwhile tc:\n\ttc-=1\n\ta,b,c,d,k = map(int,sys.stdin.readline().split())\n\tg1 = f(a,b)\n\tg2 = f(c,d)\n\tlcm = (g1*g2)/f(g1,g2)\n\tmx = k/lcm\n\tprint 2*mx+1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "3\n3\n5\n"}, "input": {"kind": "stdin", "value": "3\n2 4 3 6 7\n1 2 4 5 1\n10 12 3 9 16"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_3
Chef Al Gorithm was reading a book about climate and oceans when he encountered the word “glaciological”. He thought it was quite curious, because it has the following interesting property: For every two letters in the word, if the first appears x times and the second appears y times, then |x - y| ≤ 1. Chef Al was happ...
[{"code": "#top down dp\n# def function(b,i,j,matrix):\n# \tif i>=j:\n# \t\treturn 0\n# \tif b[j]-b[i]<=k:\n# \t\treturn 0\n# \tif matrix[i][j]!=-1:\n# \t\treturn matrix[i][j]\n# \t#matrix[i][j]=min(b[i]+matrix[i+1][j],matrix[i][j-1]+b[j]-b[i]-k)\n# \tm1=b[i]+function(b,i+1,j,matrix)\n# \tm2=b[j]-b[i]-k+function(b,i,j-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "0\n0\n1\n2\n"}, "input": {"kind": "stdin", "value": "4\nglaciological 1\nteammate 0\npossessions 3\ndefenselessness 3"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_4
This morning Chef wants to jump a little. In a few minutes he will arrive at the point 0. Then he will perform a lot of jumps in such a sequence: 1-jump, 2-jump, 3-jump, 1-jump, 2-jump, 3-jump, 1-jump, and so on. 1-jump means that if Chef is at the point x, he will jump to the point x+1. 2-jump means that if Chef is a...
[{"code": "t=(int)(raw_input())\nk=t//3\nif((t%3==0)|((t%3==1)&(k%2==0))):\n print 'yes'\nelse:\n print 'no'", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_4__ref__0000", "source": "benchmark"}, {"code": "n=int(raw_i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "no\n"}, "input": {"kind": "stdin", "value": "2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_4__public_...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_78
You are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens. There are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i. According to an examina...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\ntypedef unsigned long long int ulli;\n\nint main() {\n\tulli n, ans = 0;\n\tcin >> n;\n\tmap<int, int> m;\n\tfor (ulli i = 1; i <= n; i++) {\n\t\tint temp;\n\t\tcin >> temp;\n\t\tans += m[i-temp];\n\t\tm[i+temp]++;\n\t}\n\tcout << ans;\n}", "is_known_correct"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "6\n5 2 4 2 8 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_79
At an arcade, Takahashi is playing a game called RPS Battle, which is played as follows: * The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.) * Each time the player wins a round, depending on which hand he/she use...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nll ans;\nint main() {\n int n,k,R,P,S;\n cin >> n >> k >> R >> S >> P;\n string s;\n cin >> s;\n for(int i = 0;i<n;i++)\n {\n if(i >= k && s[i]==s[i-k]){\n s[i] = ' ';\n continue;\n }\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "27"}, "input": {"kind": "stdin", "value": "5 2\n8 7 6\nrsrpr"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-0...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_80
We have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates. For a non-empty subset T of S, let f(T) be the number of points contained in the smallest rectangle, whose sides are parallel to the coordinate ...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\n#define N 200005\nlong long n,O[N],X[N],Pow[N],mo=998244353,ans;\nstruct V {\n\tlong long x,y;\n\tbool operator <(const V a)const {\n\t\treturn y<a.y;\n\t}\n} A[N];\nlong long _1[N],_2[N],_3[N],_4[N];\nvoid ADD(int o) {\n\twhile(o<=n)O[o]++,o+=o&-o;\n}\nint SUM(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "13"}, "input": {"kind": "stdin", "value": "3\n-1 3\n2 1\n3 -2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_82
In 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education. One day, there was an exam where a one-year-old child must write a program that prints `Hello World`, and a two-year-old child must write a program that receives integers A, B...
[{"code": "import sys\nif input()==\"1\": print(\"Hello World\"),sys.exit()\nprint(int(input())+int(input()))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_82__ref__0000", "source": "benchmark"}, {"code": "#include <iostr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "Hello World"}, "input": {"kind": "stdin", "value": "1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_82...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_83
You are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i. Tozan and Gezan repeats the following sequence of operations: * If A and B are equal sequences, ter...
[{"code": "#include<cstdio>\n#include<iostream>\nusing namespace std;\nint q;long long sum,a,b,m=100000000000;bool flag;\nint main()\n{\n cin>>q;\n while(q--)\n {\n cin>>a>>b;\n sum+=b;\n if(m>b&&b<a)\n m=b;\n if(a!=b)\n flag=1;\n }\n if(flag)\n co...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "3\n8 3\n0 1\n4 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_84
You are given a sequence a = \\{a_1, ..., a_N\\} with all zeros, and a sequence b = \\{b_1, ..., b_N\\} consisting of 0 and 1. The length of both is N. You can perform Q kinds of operations. The i-th operation is as follows: * Replace each of a_{l_i}, a_{l_i + 1}, ..., a_{r_i} with 1. Minimize the hamming distance...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nstruct SegTree{\n\tvector<int> val;\n\tvoid build(){\n\t\tval.resize((1<<18)*2);\n\t\tfor(int i=0;i<(1<<18)*2;++i){\n\t\t\tval[i]=INT_MIN;\n\t\t}\n\t}\n\tvoid modify(int x,int v){\n\t\tx+=(1<<18)-1;\n\t\tval[x]=v;\n\t\twhile(x>0){\n\t\t\tx=(x-1)/2;\n\t\t\tval[x...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "5\n0 1 0 1 0\n1\n1 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00022-of-00128_87
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? Constraints * 1≦N≦100 Input The input is given from Standard Inpu...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(void){\n int n;\n cin>>n;\n cout<<n*(1+n)/2<<endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_87__ref__0000", "source": "benchmark"}, {"code":...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00022-of-00128_87__public__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_4
Leha is playing a very interesting game. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all the cells of the grid are uncolored. Leha's initial score is zero. At each turn, he chooses some cell that is yet not colored, and colors that cell. The score obtained in this step w...
[{"code": "T=int(raw_input())\nwhile T:\n n,m=map(int,raw_input().split())\n ans = 2*n*m-n-m\n print(ans)\n T-=1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_4__ref__0000", "source": "benchmark"}, {"code": "d...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "4\n"}, "input": {"kind": "stdin", "value": "1\n2 2"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_5
A number is called palindromic if its decimal representation is a palindrome. You are given a range, described by a pair of integers L and R. Find the sum of all palindromic numbers lying in the range [L, R], inclusive of both the extrema. Input The first line of the input contains an integer T denoting the number of ...
[{"code": "for tests in xrange(int(raw_input())):\n a, z = map(int, raw_input().split())\n str_range = map(str, xrange(a, z + 1)) \n print sum([int(str_num) for str_num in str_range if str_num == str_num[::-1]])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__cod...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "45\n272\n"}, "input": {"kind": "stdin", "value": "2\n1 10\n123 150"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_78
There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ...
[{"code": "#from collections import deque,defaultdict\nprintn = lambda x: print(x,end='')\ninn = lambda : int(input())\ninl = lambda: list(map(int, input().split()))\ninm = lambda: map(int, input().split())\nins = lambda : input().strip()\nDBG = True # and False\nBIG = 10**18\nR = 10**9 + 7\n\ndef ddprint(x):\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nA\nC"}, "input": {"kind": "stdin", "value": "2 1 3 0\nAB\nAC"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00023...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_79
Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i. Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0). A handshake will be performed as follows: * Takahashi chooses o...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int64_t N, M;\n cin >> N >> M;\n vector<int64_t> A(N), S(N+1);\n for(int i=0; i<N; i++) cin >> A[i];\n sort(A.begin(), A.end());\n for(int i=0; i<N; i++) S[i+1] = S[i] + A[i];\n\n // ok : ok以上がM回以上\n int64_t ok = 0, ng = ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "202"}, "input": {"kind": "stdin", "value": "5 3\n10 14 19 34 33"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00023-o...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_80
We have two distinct integers A and B. Print the integer K such that |A - K| = |B - K|. If such an integer does not exist, print `IMPOSSIBLE` instead. Constraints * All values in input are integers. * 0 \leq A,\ B \leq 10^9 * A and B are distinct. Input Input is given from Standard Input in the following format: ...
[{"code": "#include<iostream>\nusing namespace std;\n\nint main() {\n int A, B; cin >> A >> B;\n if ((A - B) % 2) cout << \"IMPOSSIBLE\" << endl;\n else cout << (A + B) / 2 << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00023...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "549034394"}, "input": {"kind": "stdin", "value": "998244353 99824435"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_82
When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC. You, the smartwatch, has found N routes to his home. If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i. Find the smallest cost of a route that takes not l...
[{"code": "using namespace std;\n#include<iostream>\n\nint main(){\n int n,tl,c,t,cm=1001;\n cin>>n>>tl;\n for(int i=0;i<n;i++){\n cin>>c>>t;\n if(c<cm && t<=tl)cm=c;\n }\n if(cm>1000)cout<<\"TLE\"<<endl;\n else cout <<cm<<endl;\n return 0;\n}\n ", "is_known_correct": true, "language": "cpp", "metadata": {...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "TLE"}, "input": {"kind": "stdin", "value": "4 3\n1 1000\n2 4\n3 1000\n4 500"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rie...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00023-of-00128_83
You are given a string S consisting of `a`,`b` and `c`. Find the number of strings that can be possibly obtained by repeatedly performing the following operation zero or more times, modulo 998244353: * Choose an integer i such that 1\leq i\leq |S|-1 and the i-th and (i+1)-th characters in S are different. Replace each...
[{"code": "#include <bits/stdc++.h>\n\n#define dbg(x) cerr<<#x\": \"<<x<<\"\\n\"\n#define dbg_p(x) cerr<<#x\": \"<<x.first<<\",\"<<x.second<<\"\\n\"\n#define dbg_v(x, n) do{cerr<<#x\"[]: \";for(long long _=0;_<n;++_)cerr<<x[_]<<\" \";cerr<<'\\n';}while(0)\n#define dbg_ok cerr<<\"OK!\\n\"\n\n#define st first\n#define nd...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "6310"}, "input": {"kind": "stdin", "value": "babacabac"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00023-of-00128_8...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null