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-00109-of-00128_5
A version control system(VCS) is a repository of files, often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change. Version c...
[{"code": "for i in range(input()):\n\ta,b,c=map(int,raw_input().split())\n\tcount = [0]*(a+1)\n\tar1 = map(int,raw_input().split())\n\tar2=map(int,raw_input().split())\n\tfor i in ar1:\n\t\tcount[i]+=1\n\tfor i in ar2:\n\t\tcount[i]+=1\n\ttrig =0\n\tuntunig = 0\n\tfor i in range(1,a+1):\n\t\tif(count[i]==2):\n\t\t\ttr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "4 1\n1 1\n"}, "input": {"kind": "stdin", "value": "2\n7 4 6\n1 4 6 7\n1 2 3 4 6 7\n4 2 2\n1 4\n3 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-00109-of-00128_78
Given is a string S. Replace every character in S with `x` and print the result. Constraints * S is a string consisting of lowercase English letters. * The length of S is between 1 and 100 (inclusive). Input Input is given from Standard Input in the following format: S Output Replace every character in S with ...
[{"code": "s = input()\n\nprint('x' * (len(s)))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\npublic class Main{\n public static void main(String[]...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "xxxxxxx"}, "input": {"kind": "stdin", "value": "sardine"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00109-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-00109-of-00128_79
Given is a string S of length N. Find the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. More formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \leq l_1, l_2 \leq N - len + 1 ) that satisfy the following: ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define rep(i,a) for(int i=0;i<(a);i++)\nconst ll MOD=1000000007;\n//const ll MOD=998244353;\n\nint dp[5050][5050];\n\nint main(){\n int N; cin>>N;\n string S; cin>>S;\n int ans=0;\n for(int i=N-1;i>=0;i--){\n for(int j=N-1;j>=0;j-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "13\nstrangeorange"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00109-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-00109-of-00128_82
You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. Constraints * -1000 \leq A,B \leq 1000 * All values in input are integers. Input Input is given from Standard Input in the following format: A B Output Print the largest value among A+B, A-B and A \times B. Examples Inp...
[{"code": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int A = sc.nextInt();\n int B = sc.nextInt();\n int max = A + B;\n\n max = Math.max(max, A - B);\n max = Math.max(max, A * B);\n\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "0 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_82__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-00109-of-00128_83
Snuke has a rooted tree with N+1 vertices. The vertices are numbered 0 through N, and Vertex 0 is the root of the tree. The parent of Vertex i (1 \leq i \leq N) is Vertex p_i. Besides this tree, Snuke also has an box which is initially empty and many marbles, and playing with them. The play begins with placing one mar...
[{"code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int n = in.n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "8"}, "input": {"kind": "stdin", "value": "2\n0 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00109-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-00109-of-00128_84
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. Constraints * 1 \leq K \leq N \leq 50 * 1 \leq l_i \leq 50 ...
[{"code": "import java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tInteger[] cards = new Integer[N];\n\t\tf...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "386"}, "input": {"kind": "stdin", "value": "15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_con...
{"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-00109-of-00128_85
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w...
[{"code": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main(){\n string S; cin>>S;\n\n cout<<S.rfind('Z')-S.find('A')+1<<endl;\n\n return 0;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_85_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00109-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "12"}, "input": {"kind": "stdin", "value": "HASFJGHOGAKZZFEGA"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00109-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-00110-of-00128_3
Chef Ceil has some matchsticks in his kitchen. Detail of matchsticks: There are N matchsticks in total. They are numbered from to 0 to N-1 inclusive. All matchsticks have same length. But they may have different rates of burning. For i^th matchstick, we denote bi as the time required for that matchstick to completely b...
[{"code": "intMax = 10**8+1\ndef treeQuery(tree1, tree2, start, end, rangeStart, rangeEnd, index):\n if rangeStart<=start and rangeEnd>=end:\n return tree1[index], tree2[index]\n if end<rangeStart or start>rangeEnd:\n return intMax, -1\n middleIndex = (start + end) / 2\n a,c = treeQuery(tree1,...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00110-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "9.0\n"}, "input": {"kind": "stdin", "value": "18\n3 4 2 1 5 7 9 7 10 5 12 3 1 1 2 1 3 2\n1\n4 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00110-of-00128_78
Given is a sequence of integers A_1, A_2, ..., A_N. If its elements are pairwise distinct, print `YES`; otherwise, print `NO`. Constraints * 2 ≤ N ≤ 200000 * 1 ≤ A_i ≤ 10^9 * All values in input are integers. Input Input is given from Standard Input in the following format: N A_1 ... A_N Output If the elements...
[{"code": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tHashSet<Integer> a = new HashSet<>();\n\t\tint A = 0;\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA=sc.nextInt();\n\t\t\ta.add(A);\n\t\t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00110-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "NO"}, "input": {"kind": "stdin", "value": "6\n4 1 3 1 6 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00110-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-00110-of-00128_79
We have N non-negative integers: A_1, A_2, ..., A_N. Consider painting at least one and at most N-1 integers among them in red, and painting the rest in blue. Let the beauty of the painting be the \mbox{XOR} of the integers painted in red, plus the \mbox{XOR} of the integers painted in blue. Find the maximum possibl...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n#define int long long\n\nint32_t main(){\n ios::sync_with_stdio(0),cin.tie(0);\n int n;\n cin >> n;\n int a[n],x=0,b[60]={0};\n for(int i=0;i<n;i++){\n cin >> a[i];\n x^=a[i];\n }\n for(int i=0;i<n;i++){\n for(int j=0;j...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00110-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "2012721721873704572"}, "input": {"kind": "stdin", "value": "20\n1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272...
{"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-00110-of-00128_82
You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ...
[{"code": "import java.util.*;\nimport java.io.*;\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner scn=new Scanner(System.in);\n\t\tint N = scn.nextInt();\n\t\tString S = scn.next();\n\t\tint[] visited1 = new int[26];\n\t\tint[] visited2 = new int[26];\n\t\tint c1=0, c2=0, max=-1;\n\t\tfor(i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00110-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "10\naaaaaaaaaa"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00110-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-00110-of-00128_84
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n, a[];\n\t\tlong psum[], sum = 0;\n\t\tn = sc.nextInt();\n\t\ta = new int[n];\n\t\tpsum = new long[n];\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\ta[i] = sc.nextI...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00110-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "6\n1 2 3 4 5 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00110-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-00111-of-00128_3
Vidhi went to a magic show last week where she was astounded by a magic trick performed by the great Mandwarf, the brown. His trick was as follows : Ask a volunteer from the audience to write down a list L of N integers. Ask another volunteer from the audience to provide three integers A, B, C A...
[{"code": "#!/usr/bin/env python\n# coding=utf-8\n\nT = input()\nfor _ in xrange(T):\n N = input()\n L = map(int, raw_input().split())\n A, B, C = map(int, raw_input().split())\n s = raw_input()\n revcnt = 0\n slope = 1\n D = 0\n offset = 0\n for i in xrange(N):\n if s[i] == 'R':\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "3 3 9 \n1 2 3 4 \n"}, "input": {"kind": "stdin", "value": "2\n3\n1 1 1\n2 3 1000\nARM\n4\n1 2 3 4\n0 1 1000\nAMAM"}, "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-00111-of-00128_4
You are given an array A of N integers. You are to fulfill M queries. Each query has one of the following three types: C d : Rotate the array A clockwise by d units. A d : Rotate the array A anticlockwise by d units. R d : Query for the value of the element, currently being the d-th in the array A. Input The first l...
[{"code": "n,m=map(int,raw_input().split())\na=map(int,raw_input().split())\nr=0\nfor q in range(m):\n\tz,x=raw_input().split()\n\tx=int(x)\n\tif (z=='R'):\n\t\tprint a[(x-1+r)%n]\n\telif (z=='A'):\n\t\tr=(r-x)\n\telse:\n\t\tr=(r+x)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codec...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "5\n3\n3\n"}, "input": {"kind": "stdin", "value": "5 5\n5 4 3 3 9\nR 1\nC 4\nR 5\nA 3\nR 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-00111-of-00128_68
Today, King Trophies is on another rampage to destroy the small village controlled by Alex. Please help his soldiers. At first, there are N individual soldiers, who haven't yet joined together; each of these soldiers is the leader of his/her own group. You have to handle 3 types of operations: 1) Two groups find each...
[{"code": "def union(parents, i, j):\n ''' Union with under the deepest root '''\n parents[i] = j\n\ndef find(parents, el):\n ''' Find an element and compress the sets '''\n if parents[el] == el: return el\n leader = find(parents, parents[el])\n parents[el] = leader\n return leader\n\ndef solve(n, ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_68__public__0000", "expected_output": {"kind": "stdout", "value": "2\n"}, "input": {"kind": "stdin", "value": "2 2\n1 1 2\n3 1\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-00111-of-00128_78
We have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown. We will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this ...
[{"code": "n, k = map(int, input().split())\np = list(map(int, input().split()))\ns = sum(p[:k])\nm = s\nfor i in range(1, n-k+1):\n s = s-p[i-1]+p[i+k-1]\n if s > m:\n m = s\nprint((m+k)/2)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.ri...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "7.000000000000"}, "input": {"kind": "stdin", "value": "5 3\n1 2 2 4 5"}, "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-00111-of-00128_79
Takahashi is going to set a 3-character password. How many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)? Constraints * 1 \leq N \leq 9 * N is an integer. Input Input is given from Standard Input in the following format: N Output Print the number of possibl...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint a;\nint main()\n{\n\tcin>>a;\n\tcout<<a*a*a;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "x=int(input())\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "8"}, "input": {"kind": "stdin", "value": "2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_79__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-00111-of-00128_83
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. Constraints * 1?N?10^8 * N is an integer. Input Input is given from Standard Input in the following format: N Output...
[{"code": "#2019/09/26\nN = input()\nprint(\"Yes\" if int(N) % sum(map(int, N)) == 0 else \"No\")", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "import java.util.Scanner;\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "148"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00111-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-00111-of-00128_84
Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the g...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nconst int maxn = 1e5 + 10;\nvector<int> mp[maxn];\nint n, sz[maxn], dep[maxn], fa[maxn];\nint dfs(int u, int f, int d){\n dep[u] = d;\n fa[u] = f;\n sz[u] = 1;\n for(auto &v:mp[u])if(v != f){\n int ret = dfs(v, u, d + 1);\n sz[u] += ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "Snuke"}, "input": {"kind": "stdin", "value": "4\n1 4\n4 2\n2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00111-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-00111-of-00128_85
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of...
[{"code": "N = int(input())\nA_arr = [int(x) for x in input().split()]\n\nA_set = set(A_arr)\nans = len(A_set)\nif ans%2 == 0:\n ans -= 1\nprint(ans)\n\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_85__ref__0000", "s...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00111-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "5\n1 2 1 3 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00111-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-00112-of-00128_3
Now that Chef has finished baking and frosting his cupcakes, it's time to package them. Chef has N cupcakes, and needs to decide how many cupcakes to place in each package. Each package must contain the same number of cupcakes. Chef will choose an integer A between 1 and N, inclusive, and place exactly A cupcakes into ...
[{"code": "t = int(raw_input())\nfor ii in range(t):\n\ti = int(raw_input())\n\tif i == 1 :\n\t\tprint 1\n\telif i == 2 :\n\t\tprint 2\n\telif i%2 == 0 :\n\t\tprint (i/2 +1)\n\telse :\n\t\tprint ( (i+1)/2)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contes...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n"}, "input": {"kind": "stdin", "value": "2\n2\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-00112-of-00128_4
You are given a simple code of a function and you would like to know what it will return. F(N, K, Answer, Operator, A[N]) returns int; begin for iK do for jN do AnswerAnswer operator Aj) return Answer end Here N, K, Answer and the value returned by the function F are integers;...
[{"code": "for q in range(int(raw_input())):\n n,k,ans=[int(u) for u in raw_input().split()]\n arr=[int(u) for u in raw_input().split()]\n op=raw_input().strip()\n if(k==0):\n print ans\n continue\n if(op=='OR'):\n for i in arr:\n ans=ans|i\n elif(op=='AND'): ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "0\n0\n3\n"}, "input": {"kind": "stdin", "value": "3\n3 1 0\n1 2 3\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n1 2 3\nOR"}, "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-00112-of-00128_5
Chef and his girlfriend are going to have a promenade. They are walking along the straight road which consists of segments placed one by one. Before walking Chef and his girlfriend stay at the beginning of the first segment, they want to achieve the end of the last segment. There are few problems: At the beginning ...
[{"code": "for _ in range(input()):\n n= int(raw_input())\n att = map(int,raw_input().split())\n ans = []\n for i in range(n):\n ans.append(att[i]+i)\n print max(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "6\n5\n"}, "input": {"kind": "stdin", "value": "2\n5\n6 5 4 3 2\n5\n3 4 3 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-00112-of-00128_78
Find the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten. Constraints * 1 \leq N < 10^{100} * 1 \leq K \leq 3 Input Input is given from Standard Input in the following format: N K Output Print the count. Examples Input 100 1 Output 19 Inpu...
[{"code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author varunvats32\n */\npublic class Main {\n public static void main(String[] a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "117879300"}, "input": {"kind": "stdin", "value": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3"}, "metadata": {}, "vi...
{"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-00112-of-00128_79
Takahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \ldots, Dish N) once. The i-th dish (1 \leq i \leq N) he ate was Dish A_i. When he eats Dish i (1 \leq i \leq N), he gains B_i satisfaction points. Additionally, when he eats Dish i+1 just after eating Dish i (1 \...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint n,a[201],b[201],c[201];\nint main()\n{\n\tscanf(\"%d\",&n);\n\tint sum=0;\n\tfor(int i=1;i<=n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(int i=1;i<=n;i++)\n\t\tscanf(\"%d\",&b[i]),sum+=b[i];\n\tfor(int i=1;i<n;i++)\n\t\tscanf(\"%d\",&c[i]);\n\tfor(int i=1;i<n;i+...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "150"}, "input": {"kind": "stdin", "value": "2\n1 2\n50 50\n50"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00112-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-00112-of-00128_82
You are given an integer sequence A of length N and an integer K. You will perform the following operation on this sequence Q times: * Choose a contiguous subsequence of length K, then remove the smallest element among the K elements contained in the chosen subsequence (if there are multiple such elements, choose one ...
[{"code": "N, K, Q = map(int, input().split())\nX = list(map(int, input().split()))\n\nr = 10**18\nfor y in X:\n tmp = []\n tmp2 = []\n for x in X:\n if x < y:\n tmp.sort()\n tn = len(tmp)\n if len(tmp) > K-1:\n tmp2 += tmp[:tn-K+1]\n tmp = []\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "451211184"}, "input": {"kind": "stdin", "value": "11 7 5\n24979445 861648772 623690081 433933447 476190629 262703497 211047202 971407775 628894325 731963982 822804784"}, "metad...
{"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-00112-of-00128_83
Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ...
[{"code": "// C - Shopping Street\n#include <bits/stdc++.h>\nusing namespace std;\nusing vi = vector<int>;\nusing vvi = vector<vi>;\n#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)\n\nint main(){\n\tint n; cin>>n;\n\tvvi F(n, vi(10));\n\trp(i, 0, n) rp(j, 0, 10) cin>>F[i][j];\n\tvvi P(n, vi(10+1));\n\trp(i, 0, n) ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "8"}, "input": {"kind": "stdin", "value": "1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_con...
{"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-00112-of-00128_85
Snuke has decided to play a game, where the player runs a railway company. There are M+1 stations on Snuke Line, numbered 0 through M. A train on Snuke Line stops at station 0 and every d-th station thereafter, where d is a predetermined constant for each train. For example, if d = 3, the train stops at station 0, 3, 6...
[{"code": "#include <bits/stdc++.h>\n#define ll long long\n#define INF 999999999\n#define MOD 1000000007\n#define rep(i,n) for(int i=0;i<n;i++)\n\nusing namespace std;\n\ntypedef pair<int,int>P;\n\nconst int MAX_N = 100005;\n\nvector<P> lens[100005];\n\nint bit[MAX_N+1],n,m;\n//i番目までの和を計算する\nint sum(int i)\n{\n\tint s ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00112-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "3\n2\n2"}, "input": {"kind": "stdin", "value": "3 3\n1 2\n2 3\n3 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0011...
{"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-00113-of-00128_2
After a long period of relaxation Alice and Bob decided to play a game. This time of course not a number game. The rules of the game are as follows: There is a vehicle situated at the point (m, n) of a rectangular grid. Only one corner of the rectangular grid is defined, i.e. the left-top point (0, 0), which is also kn...
[{"code": "a=[[0 for i in xrange(1001)] for y in range(1001)]\n \ndef row(i,j):\n for k in xrange(1001-j-1):\n a[i][k+j+1]=2\n \ndef col(i,j):\n for k in xrange(1001-i-1):\n a[k+i+1][j]=2\n \ndef diag(i,j):\n i=i+1\n j=j+1\n while(i<1001)and(j<1001):\n a[i][j]=2\n i=i+1\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "Alice\nBob"}, "input": {"kind": "stdin", "value": "2\n1 1 0 0\n2 4 1 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-00113-of-00128_4
You had an array of integer numbers. You also had a beautiful operations called "Copy-Paste" which allowed you to copy any contiguous subsequence of your array and paste it in any position of your array. For example, if you have array [1, 2, 3, 4, 5] and copy it's subsequence from the second to the fourth element and p...
[{"code": "t=input()\nfor _ in xrange(t):\n raw_input()\n print len(set(raw_input().split()))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_4__ref__0000", "source": "benchmark"}, {"code": "t=int(raw_input());\nfinal...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "1\n3\n"}, "input": {"kind": "stdin", "value": "2\n5\n1 1 1 1 1\n5\n1 2 3 1 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-00113-of-00128_5
Chef is going to participate in a new quiz show: "Who dares to be a millionaire?" According to the rules of the game, contestants must answer N questions. The quiz being famous for its difficulty, each question has 26 candidate answers, but only one of which is correct. Answers are denoted by capital Latin letters from...
[{"code": "test = input()\nfor i in xrange(test):\n\tn = input()\n\tans = raw_input()\n\tchef = raw_input()\n\tW = map(int, raw_input().split())\n\tcorrect = 0\n\tfor i in range(n):\n\t\tif(ans[i] == chef[i]):\n\t\t\tcorrect += 1\n\tif(correct != n):\n\t\tprint max(W[:correct+1])\n\telse:\n\t\tprint W[n]", "is_known_co...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "30\n4\n100\n"}, "input": {"kind": "stdin", "value": "3\n5\nABCDE\nEBCDA\n0 10 20 30 40 50\n4\nCHEF\nQUIZ\n4 3 2 1 0\n8\nABBABAAB\nABABABAB\n100 100 100 100 100 100 100 100 100"}...
{"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-00113-of-00128_71
An inversion in an array is a pair of indices (i, j) such that A[i] > A[j] and i < j, but you are given two arrays A and B and pairs such that A[i] > B[j] and i < j is called Inversion. If total number of inversions T, is a prime number then the that will be called a MAGIC INVERSION, otherwise it will be a SIMPLE INV...
[{"code": "def isp(n):\n\tfor i in range(2,int(n/2)+1):\n\t\tif n%i==0:\n\t\t\treturn False\n\treturn True\nn=input()\na=map(int,raw_input().split())\nb=map(int,raw_input().split())\nc=0\ni,j=0,0\nwhile i<n-1:\n\twhile i<j+1 and j<n:\n\t\tif a[i]>b[j]:\n\t\t\tc+=1\n\t\tj+=1\n\ti+=1\nif isp(c):\n\tprint \"MAGIC INVERSI...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_71__public__0000", "expected_output": {"kind": "stdout", "value": "MAGIC INVERSION\n"}, "input": {"kind": "stdin", "value": "3\n5 6 7\n1 2 3\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-00113-of-00128_78
Snuke is standing on a two-dimensional plane. In one operation, he can move by 1 in the positive x-direction, or move by 1 in the positive y-direction. Let us define a function f(r, c) as follows: * f(r,c) := (The number of paths from the point (0, 0) to the point (r, c) that Snuke can trace by repeating the operati...
[{"code": "#include<bits/stdc++.h>\n#define int int64_t\nusing namespace std;\n\nconst int M = 1e9+7;\nint fact[2000055] , inv[2000055];\n\nint __power(int x , int p) {\n\tint res = 1;\n\twhile(p) {\n\t\tif(p & 1) res = (res * x)%M;\n\t\tp /= 2;\n\t\tx = (x * x)%M;\n\t}\n\treturn res;\n}\n\nsigned main() {\n ios_bas...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "602215194"}, "input": {"kind": "stdin", "value": "314 159 2653 589"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0011...
{"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-00113-of-00128_79
There is an integer sequence A of length N whose values are unknown. Given is an integer sequence B of length N-1 which is known to satisfy the following: B_i \geq \max(A_i, A_{i+1}) Find the maximum possible sum of the elements of A. Constraints * All values in input are integers. * 2 \leq N \leq 100 * 0 \leq B_i...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int n; cin>>n;\n vector<int> b(n-1);\n for(int i=0; i<n-1; ++i)cin>>b[i];\n\n int ans=0;\n for(int i=1; i<n-1; ++i)ans+=min(b[i], b[i-1]);\n ans+=b[0]+b[n-2];\n\n cout<<ans<<endl;\n}\n", "is_known_correct": true, "language": "cpp", "metad...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "2\n3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_79__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-00113-of-00128_82
There is a simple undirected graph with N vertices and M edges. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i connects Vertex U_i and V_i. Also, Vertex i has two predetermined integers A_i and B_i. You will play the following game on this graph. First, choose one vertex and stan...
[{"code": "#include<bits/stdc++.h>\n#define fir first\n#define sec second\n#define db double\n#define ll long long\n#define ev eg[i].v\n#define pb push_back\n#define INF 1000000007\n#define pir pair<int,int>\n#define Rep(i,l,r) for(int i=(l);i<=(r);++i)\n#define RepD(i,r,l) for(int i=(r);i>=(l);--i)\n#define RepG(i,x) ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "44"}, "input": {"kind": "stdin", "value": "5 8\n6 4\n15 13\n15 19\n15 1\n20 7\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 5\n4 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "c...
{"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-00113-of-00128_83
Joisino is planning to record N TV programs with recorders. The TV can receive C channels numbered 1 through C. The i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i. Here, there will never be more than one program that are broadcast on ...
[{"code": "import sys\ndef MI(): return map(int,sys.stdin.readline().rstrip().split())\n\nN,C = MI()\nA = [[0]*(10**5+2) for i in range(C+1)]\nfor i in range(N):\n s,t,c = MI()\n A[c][s] += 1\n A[c][t+1] -= 1\n\nfrom itertools import accumulate\n\nfor i in range(1,C+1):\n A[i] = list(accumulate(A[i]))\n\n# ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "9 4\n56 60 4\n33 37 2\n89 90 3\n32 43 1\n67 68 3\n49 51 3\n31 32 3\n70 71 1\n11 12 3"}, "metadata": {}, "visibility": "public"}, {"cas...
{"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-00113-of-00128_85
Snuke has decided to play with N cards and a deque (that is, a double-ended queue). Each card shows an integer from 1 through N, and the deque is initially empty. Snuke will insert the cards at the beginning or the end of the deque one at a time, in order from 1 to N. Then, he will perform the following action N times...
[{"code": "#include<bits/stdc++.h>\n#define N 2005\n#define LL long long\nusing namespace std;\nconst int mo=1e9+7;\nint n,k,f[N][N],s[N][N],ans;\nLL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;}\nvoid inc(int &x,int y){ x=x+y>=mo ? x+y-mo : x+y;}\nint main()\n{\n\tint i,j;\n\tcin>...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "2 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00113-of-00128_85__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-00114-of-00128_4
Chef had an interesting dream last night. He dreamed of a new revolutionary chicken recipe. When he woke up today he tried very hard to reconstruct the ingredient list. But, he could only remember certain ingredients. To simplify the problem, the ingredient list can be represented by a string of lowercase characters 'a...
[{"code": "def main():\n for i in xrange(int(raw_input())):\n s = raw_input()\n ctr = 1\n for j in xrange((len(s)+1)//2):\n if s[j]==\"?\" and s[-j-1]==\"?\":\n ctr*=26\n ctr%=10000009\n elif s[j]!=s[-j-1] and s[j]!=\"?\" and s[-j-1]!=\"?\":\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00114-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "26\n26\n1\n0\n1\n"}, "input": {"kind": "stdin", "value": "5\n?\n??\nab?\na?c\naba"}, "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-00114-of-00128_75
Alice and Bob are taking a walk in the Land Of Doors which is a magical place having a series of N adjacent doors that are either open or close. After a while they get bored and decide to do something interesting. So they started closing the open doors taking turns. In each turn, the person walks upto any closed door...
[{"code": "t = int(raw_input())\nfor ti in range(t):\n\tdoor = raw_input()\n\tn = len(door)\n\ti = 0\n\top = []\n\twhile i<n:\t\t\n\t\tif door[i] == '_':\n\t\t\tj = 1\n\t\t\twhile i<n and door[i]== '_':\n\t\t\t\ti += 1\n\t\t\t\tj += 1\n\t\t\top.append(j-1)\n\t\ti += 1\n\t#print op\n\tif not op:\n\t\tprint \"Bob\"\n\tel...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00114-of-00128_75__public__0000", "expected_output": {"kind": "stdout", "value": "Bob\nBob\nAlice\nAlice\n"}, "input": {"kind": "stdin", "value": "4\n_|_\n|||\n|__\n|__||_|\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-00114-of-00128_78
Serval is fighting with a monster. The health of the monster is H. In one attack, Serval can decrease the monster's health by A. There is no other way to decrease the monster's health. Serval wins when the monster's health becomes 0 or below. Find the number of attacks Serval needs to make before winning. Constrai...
[{"code": "import java.util.*;\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int H = sc.nextInt();\n int A = sc.nextInt();\n System.out.println(H%A==0 ? H/A : H/A+1);\n }\n}", "is_known_correct": true, "language": "java", "metadata": {}, "solution_id": "...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00114-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "10 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00114-of-00128_78__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-00114-of-00128_79
There are N people standing in a queue from west to east. Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `R`. A person is happy if the person in front of him/her is facing the...
[{"code": "#include<iostream>\n#include<algorithm>\nusing lint=int64_t;\nusing namespace std;\n\nint main()\n{\n\tint N,K;\n\tstring S;\n\n\tcin >> N >> K;\n\tcin >> S;\n\n\tint cnt=0;\n\tfor(int i=0;i<S.size()-1;i++)\n\t{\n\t\tif(S[i]==S[i+1])\n\t\t\tcnt++;\n\t}\n\n\tcout << min(cnt+2*K,N-1) << endl;\n\treturn 0;\n}\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00114-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "6 1\nLRLRRL"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00114-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-00115-of-00128_4
After IOI Ilya decided to make a business. He found a social network called "TheScorpyBook.com". It currently has N registered users. As in any social network two users can be friends. Ilya wants the world to be as connected as possible, so he wants to suggest friendship to some pairs of users. He will suggest user u ...
[{"code": "a = int (raw_input())\nc= []\nd= []\n\nfor i in range(a):\n now = raw_input()\n c.append(now)\n d.append(int(now,2))\n \ni=0\n\n\nfor k in xrange(a):\n for j in xrange(k+1,a):\n if c[k][j]!='1':\n if int(d[k])&int(d[j]):\n i= i+2\n\nprint i", "is_known_correct"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00115-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "6\n"}, "input": {"kind": "stdin", "value": "4\n0111\n1000\n1000\n1000"}, "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-00115-of-00128_78
Raccoon is fighting with a monster. The health of the monster is H. Raccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i. There is no other way to decrease the monster's health. Raccoon wins when the monster's health becomes 0 or below. If Raccoon can win without using...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n int h, n, a;\n\n cin >> h >> n;\n for (int i = 0; i < n; i++)\n {\n cin >> a;\n h -= a;\n }\n cout << (h <= 0 ? \"Yes\" : \"No\") << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontes...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00115-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "211 5\n31 41 59 26 53"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00115-...
{"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-00115-of-00128_79
Given is a permutation P of \\{1, 2, \ldots, N\\}. For a pair (L, R) (1 \le L \lt R \le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \ldots, P_R. Find \displaystyle \sum_{L=1}^{N-1} \sum_{R=L+1}^{N} X_{L,R}. Constraints * 2 \le N \le 10^5 * 1 \le P_i \le N * P_i \neq P_j (i \neq j) * All values...
[{"code": "#include<bits/stdc++.h>\n#define ll long long\nusing namespace std;\ntemplate <typename T> void read(T &x){\n\tx=0;char ch=getchar();int fh=1;\n\twhile (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}\n\twhile (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();\n\tx*=fh;\n}\nint n,x,w[100010],le[100010],ho[100010...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00115-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "30"}, "input": {"kind": "stdin", "value": "5\n1 2 3 4 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00115-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-00116-of-00128_3
There is a line with 1000 cells numbered from 1 to 1000 from left to right and N coins placed on it. Coin i is placed at cell Xi, and no two coins are placed at the same cell. Bob would like to move the coins to the N leftmost cells of the line. To do this, he is allowed to take a coin from any cell T and move it to c...
[{"code": "for _ in xrange(int(raw_input())):\n\tN, K = map(int, raw_input().split())\n\tcoins = map(int, raw_input().split())\n\tif coins[-1] == N:\n\t\tprint 0\n\t\tcontinue\n\tseconds = 0\n\tcount = 0\n\tfor __ in xrange(coins[-1], 0, -1):\n\t\tif __ in coins:\n\t\t\tcount += 1\n\t\telse:\n\t\t\tseconds += ((count -...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "5\n0\n"}, "input": {"kind": "stdin", "value": "2\n3 2\n2 4 7\n5 3\n1 2 3 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-00116-of-00128_4
You are playing following game: given an array A of N natural numbers. All numbers in the array A are at most M. On every turn you may pick any two different elements Ai and Aj (i≠j), such that Ai, Aj ≤ M, and add K to both. The game ends when you are not able to continue. That is, when there is no pair (i,j) left such...
[{"code": "import sys\n\nN, M, K = map(lambda x: int(x), sys.stdin.readline().split())\nA = map(lambda x: int(x), sys.stdin.readline().split())\nmoves = map(lambda x: (M - x) / K + 1, A)\n\nmoves_sum = sum(moves)\nmoves_max = max(moves)\nmoves.remove(moves_max)\nmoves_max2 = max(moves)\n\nmin_moves = max((moves_sum - m...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "3 3 2\n1 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-00116-of-00128_5
Witua is a little student from the University of Lviv. He enjoys studying math. Witua knows a lot of famous mathematicians like Eratosthenes, Pythagoras, Fermat, Diophantus, Furko, Gauss and so on. However, his favorite one is Euler. The only thing Witua likes more than Euler is Euler’s totient function φ. He is explor...
[{"code": "import random\ndef modulo(a,b,c):\n x = 1\n y = a\n while b>0:\n if b%2==1:\n x = (x*y)%c\n y = (y*y)%c\n b = b/2\n return x%c\n\ndef millerRabin(N,iteration):\n if N<2:\n return 0\n i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n3\n"}, "input": {"kind": "stdin", "value": "3\n2\n3\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-00116-of-00128_78
Fennec is fighting with N monsters. The health of the i-th monster is H_i. Fennec can do the following two actions: * Attack: Fennec chooses one monster. That monster's health will decrease by 1. * Special Move: Fennec chooses one monster. That monster's health will become 0. There is no way other than Attack and...
[{"code": "R = lambda: map(int, input().split())\nn, k = R()\nprint(sum(sorted(R())[:n - k]) if k < n else 0)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "#!/usr/bin/env ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "3000000000"}, "input": {"kind": "stdin", "value": "3 0\n1000000000 1000000000 1000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_conte...
{"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-00116-of-00128_79
You will be given a string S of length 3 representing the weather forecast for three days in the past. The i-th character (1 \leq i \leq 3) of S represents the forecast for the i-th day. `S`, `C`, and `R` stand for sunny, cloudy, and rainy, respectively. You will also be given a string T of length 3 representing the ...
[{"code": "#include<iostream>\nusing namespace std;\nint ans;\nchar s[10],t[10];\nint main()\n{\n\tcin>>s>>t;\n\tfor(int i=0;i<3;++i)\n\t\tans+=(s[i]==t[i]);\n\tcout<<ans<<endl;\n\treturn 0;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00116-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "CSS\nCSR"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00116-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-00117-of-00128_1
Devu and Churu love to play games a lot. Today, they have an array A consisting of N positive integers. First they listed all N × (N+1) / 2 non-empty continuous subarrays of the array A on a piece of paper and then replaced all the subarrays on the paper with the maximum element present in the respective subarray. Devu...
[{"code": "import bisect\nimport time\nimport sys\nA = []\nsubarray = {}\nkeys = []\nsubarray_low = {}\nsubarray_high = {}\nsubarray_length = 0\n# (val,start,pos) stack\n# (start,end,pos) dict\n\ndef preprocess(n):\n\tglobal keys\n\tglobal A\n\tglobal subarray\n\tglobal subarray_low\n\tglobal subarray_high\n\tglobal su...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "DCDDC"}, "input": {"kind": "stdin", "value": "3 5\n1 2 3\n> 1 D\n< 2 C\n= 3 D\n> 4 C\n< 5 D"}, "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-00117-of-00128_3
In an attempt to reduce the growing population, Archer was asked to come up with a plan. Archer being as intelligent as he is, came up with the following plan: If N children, with names C1, C2, ..., CN, are born to parents with names A and B, and you consider C to be the concatenation of all the names of the children, ...
[{"code": "import sys\nfrom collections import Counter\nnum = int(sys.stdin.readline().rstrip())\nwhile num != 0:\n\tparents = sys.stdin.readline().rstrip().split()\n\ttext = parents[0] + parents[1]\n\tp_count = Counter(text)\n\tnum_child = int(sys.stdin.readline().rstrip())\n\tchildren = ''\n\twhile num_child != 0:\n\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nYES\nNO\n"}, "input": {"kind": "stdin", "value": "3\ntom marvoloriddle\n2\nlord\nvoldemort\ncheap up\n1\nheapcup\nbruce wayne\n2\nbat\nman"}, "metadata": {}, "visibility": ...
{"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-00117-of-00128_4
Vadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem: Given N points on a plane. Each point p is defined by it's two integer coordinates — px and py. The distance between points a and b is min(|ax - bx|, |ay - by|). You should choose a starting point and...
[{"code": "for t in range(int(raw_input())):\n n = int(raw_input())\n for i in range(n):\n raw_input()\n result = 0\n for i in range(1, n+1):\n result ^= i\n print result", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_trai...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "3\n0\n"}, "input": {"kind": "stdin", "value": "2\n2\n1 2\n0 0\n3\n3 3\n0 0\n0 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-00117-of-00128_77
Compute A \times B. Constraints * 1 \leq A \leq 100 * 1 \leq B \leq 100 * All values in input are integers. Input Input is given from Standard Input in the following format: A B Output Print the value A \times B as an integer. Examples Input 2 5 Output 10 Input 100 100 Output 10000
[{"code": "from __future__ import division, print_function\n\n''' Hey stalker :) '''\nINF = 10 ** 10\nTEST_CASES = False\nfrom collections import defaultdict, Counter\n\ndef main():\n a,b = get_list()\n print(a*b)\n\n\n''' FastIO Footer: PyRival Library, Thanks @c1729 and contributors '''\nimport os\nimport sys\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "2 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_77__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-00117-of-00128_78
Caracal is fighting with a monster. The health of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappear...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n long long h;\n cin >> h;\n\n long long n = log2(h);\n cout << long(pow(2, n + 1)) - 1 << endl;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00117-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_78__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-00117-of-00128_79
Takahashi's house has only one socket. Takahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets. One power strip with A sockets can extend one empty socket into A empty sockets. Find the minimum number of power strips required. Constraints * All values in inp...
[{"code": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n int tmp =1;\n int answer = 0;\n while(tmp<B){\n tmp=tmp+A-1;\n answer=answer+1;\n }\n System.out.print(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "4 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00117-of-00128_79__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-00118-of-00128_1
Statement You need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it. If there are many such strings, print the one which has the shortest length. If there is still a tie, print the string which comes the le...
[{"code": "s=''.join(list(map(chr, range(122, 96, -1))))\ntc=int(raw_input().strip())\nfor _ in range(tc):\n\tn=int(raw_input().strip())\n\tr=(n%25)*(-1)-1\n\tif(r==-1):\n\t\tprint s*(n/25)\n\telse:\n\t\tprint s[(n%25)*(-1)-1:]+s*(n/25)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "ba\ncba\n"}, "input": {"kind": "stdin", "value": "2\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-00118-of-00128_3
In an attempt to control the rise in population, Archer was asked to come up with a plan. This time he is targeting marriages. Archer, being as intelligent as he is, came up with the following plan: A man with name M is allowed to marry a woman with name W, only if M is a subsequence of W or W is a subsequence of M. A ...
[{"code": "#### CodeChef\n#### Open the Dragon Scroll\n#### 2016.04.07\n##\n##def binary(n):\n## total = 0\n## while n >0 :\n## if n%2 == 1:\n## n = n/2\n## total += 1\n## else:\n## n = n/2\n## return total\n##\n##def result(k,n):\n## total = 0\n## for i in ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nYES\nNO\n"}, "input": {"kind": "stdin", "value": "3\njohn johanna\nira ira\nkayla jayla"}, "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-00118-of-00128_4
Given two matrices A and B. Both have N rows and M columns. In the matrix A, numbers from 1 to MN have been written in row major order. Row major order numbers cells from left to right, and top to bottom. That is, 1 2 3 ... M A = M+1 M+2 ...
[{"code": "import sys\nfrom fractions import gcd\nnum = int(sys.stdin.readline().rstrip())\nwhile num != 0:\n\tn,m = [int(s) for s in sys.stdin.readline().rstrip().split()]\n\tcount = 0\n\tif n==1 and m==1:\n\t\tcount = 1\n\telse:\n\t\tcount = gcd(n-1,m-1) + 1\n\tprint count\n\tnum -= 1", "is_known_correct": true, "lan...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2\n"}, "input": {"kind": "stdin", "value": "1\n4 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-00118-of-00128_68
Little Stuart has reached the final level of 'Code Hunt', the annual treasure hunt organised by HackerEarth. Now for the final level, Little Stuart has to choose a door from infinite number of doors numbered from 1 to infinity. Out of these only one door contains the grand prize. The clue for finding the correct door i...
[{"code": "t=input()\nwhile(t>0):\n\tsize=input()\n\ta=[]\n\tcnt=[0]*105\n\tcount=[0]*105\n\t\"\"\"\n\tfor i in range(0,105):\n\t\tcnt.append(0)\n\t\tcount.append(0)\n\t\"\"\"\n\tCount=0\n\ta=map(int,raw_input().split())\n\tfor i in range(0,size):\n\t\tcnt[a[i]]+=1\n\t\n\tfor i in range(0,size):\n\t\tcount[a[i]]+=1\n\t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_68__public__0000", "expected_output": {"kind": "stdout", "value": "1\n0\n"}, "input": {"kind": "stdin", "value": "2\n3\n10 2 3\n2\n3 5\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-00118-of-00128_77
Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N. However, if the result exceeds 10^{18}, print `-1` instead. Constraints * 2 \leq N \leq 10^5 * 0 \leq A_i \leq 10^{18} * All values in input are integers. Input Input is given from Standard Input in the following format: N A_1 ... A_N Output P...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main(){\n int N;\n cin >> N;\n __int128_t M = 1, INF = int64_t(1e18) + 1;\n while(N--){\n int64_t a;\n cin >> a;\n M = min(M*a, INF);\n }\n if(M == INF) M = -1;\n cout << int64_t(M) << endl;\n return 0;\n}", "is_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "3\n101 9901 999999000001"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-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-00118-of-00128_78
Ibis is fighting with a monster. The health of the monster is H. Ibis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points. The same spell can be cast multiple times. There is no way other than spells to decrease the monster's health. Ibis wins wh...
[{"code": "# coding=utf-8\n# Date: 2020-01-08\n# Author: lee215\n\nget = lambda: int(raw_input().strip())\ngetl = lambda: raw_input().strip()\ngets = lambda: map(int, raw_input().strip().split())\ngetss = lambda n: [gets() for _ in xrange(n)]\n\nH, N = gets()\nAB = getss(N)\nAB.sort(key=lambda a_b: -a_b[0] * 1.0 / a_b[...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "9 3\n8 3\n4 2\n2 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00118-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-00118-of-00128_79
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. You will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square. Find the maximum numb...
[{"code": "le=int(input())\nl=list(map(int,input().split()))\nans=0\ne=0\nfor i in range(le)[:-1]:\n if l[i]<l[i+1]:\n ans=max(ans,i-e)\n e=i+1\nans=max(ans,le-e-1)\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00118-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00118-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "5\n10 4 8 7 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00118-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-00119-of-00128_1
It's finally summer in Chefland! So our chef is looking forward to prepare some of the best "beat-the-heat" dishes to attract more customers. He summons the Wizard of Dessert to help him with one such dish. The wizard provides the chef with a sequence of N ingredients where the i^th ingredient has a delish value of D[...
[{"code": "# Property 1:\n#j and k cannot have gap\n#because if have gap > 0, one side will eat it up\n\n# hence for each middle position j or k\n# calculate the min/max values for each section, one to the left\n# and one to the right of j/k\n# then calculate the largest absolute difference between each\n# pair of left...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "13\n4\n"}, "input": {"kind": "stdin", "value": "2\n5\n1 2 3 4 5\n4\n1 1 -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-00119-of-00128_4
In every contest there should be an easy problem about matrices. December Cook-Off is not an exception. Given a matrix A which consists of n rows and m columns, and contains integer numbers. Consider every possible vector v of m elements, such that every 1 ≤ vi ≤ n. Let value of the vector be product of all Avi, i (1 ...
[{"code": "z=map(int,raw_input().split())\nn=z[0]\nm=z[1]\na=[0]*m\nfor i in range(n):\n x=map(int,raw_input().split())\n for j in range(m):\n a[j]=a[j]+x[j]\nans=1\nfor i in range(m):\n ans=ans*a[i]\nprint ans%(10**7+7)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "24\n"}, "input": {"kind": "stdin", "value": "2 2\n1 2\n3 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-00119-of-00128_77
Compute A \times B, truncate its fractional part, and print the result as an integer. Constraints * 0 \leq A \leq 10^{15} * 0 \leq B < 10 * A is an integer. * B is a number with two digits after the decimal point. Input Input is given from Standard Input in the following format: A B Output Print the answer as ...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint main() {\n int64_t a,c;\n double b;\n cin>>a>>b;\n c=(b+0.001)*100;\n c=c*a/100;\n cout<<c<<endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_77__ref__...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "9990000000000000"}, "input": {"kind": "stdin", "value": "1000000000000000 9.99"}, "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
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00119-of-00128_78
Silver Fox is fighting with N monsters. The monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i. Silver Fox can use bombs to attack the monsters. Using a bomb at the coordinate x decreases the healths of all mo...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define rep(i,n) for(int i=0;i<(n);i++)\n\nint main(int argc, char const *argv[])\n{\n\tint n, d, a; cin >> n >> d >> a;\n\tvector<pair<int, int>> v(n);\n\trep(i, n) {\n\t\tint x, h; cin >> x >> h;\n\t\tv[i] = make_pair(x, h);\n\t}\n\tsor...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "9 4 1\n1 5\n2 4\n3 3\n4 2\n5 1\n6 2\n7 3\n8 4\n9 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_c...
{"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-00119-of-00128_79
For an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}. Then, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i. Find the maximum possible value of M_1 + M_2 + \cdots + M_N. Constraints * N is an integer satisfying 1 \leq N \leq 10^9. Input Input is giv...
[{"code": "import java.util.Scanner;\npublic class Main {\n public static void main(String args[]) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong N = scan.nextInt();\n\t\tlong ans = 0;\n for (int i = 1; i < N; i++) {\n ans += i;\n }\n\t\tSystem.out.println(ans);\n }\n}", "is_know...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "78"}, "input": {"kind": "stdin", "value": "13"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_79__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-00119-of-00128_80
A biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation. Find the total number of biscuits produced within T + 0.5 seconds after activation. Constraints * All values in input are integers. * 1 \leq A, B, T \le...
[{"code": "//台湾旅行中(Day 1)\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String args[]) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint T = sc.nextInt();\n\n\t\tSystem.out.println( ((int)(T+0.5)/A) * B);\n\t}\n\n}\n", "is_known...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "3 5 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00119-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-00119-of-00128_84
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m...
[{"code": "print(sum(sorted([int(tok) for tok in input().split()])[:2]))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_84__ref__0000", "source": "benchmark"}, {"code": "a,b,c = map(int,input().split())\nprint(a+b+c-(max(a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "20000"}, "input": {"kind": "stdin", "value": "10000 10000 10000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00119-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-00119-of-00128_85
There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r...
[{"code": " import java.util.*;\n public class Main {\n \n \tpublic static void main(String[] args) {\n \t\tScanner scan = new Scanner(System.in);\n \t\tint a=Integer.parseInt(scan.next());\n \t\tint b=Integer.parseInt(scan.next());\n \t\t\n \t\tint c=Integer.parseInt(scan.next());\n \t\t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00119-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "60000"}, "input": {"kind": "stdin", "value": "100 600 200 300"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00119-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-00120-of-00128_4
Petr, Nikita G. and Nikita are the most influential music critics in Saint-Petersburg. They have recently downloaded their favorite band's new album and going to listen to it. Nikita claims that the songs of entire album should be listened strictly in the same order as they are given, because there is the secret messag...
[{"code": "def expectation(n):\n exp = 0.0\n for i in range(1, n + 1):\n exp += 1.0 / float(i)\n print(exp * n)\n\n\nt = input()\nfor i in range(0, t):\n n = input()\n expectation(n)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "1.0\n3.0\n5.5\n"}, "input": {"kind": "stdin", "value": "3\n1\n2\n3"}, "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-00120-of-00128_5
Oh, no! Chef’s in trouble. He’s got himself stuck in a cave (we don’t know how) and is looking for a way out. The bigger problem is that he needs to get his tractor out of the cave (don't ask why Chef owns a tractor!). He currently faces a large block of height N cells and length N cells, and needs to get his tractor a...
[{"code": "# cook your code here\nfor _ in range(int(raw_input())):\n n,h=map(int,raw_input().split())\n a=[0]*(n+2)\n for i in range(n):\n l,r=map(int,raw_input().split())\n a[l+1]+=1\n a[r+2]-=1\n for i in range(1,n+1):\n a[i]=a[i]+a[i-1]\n for i in range(n+1):\n a[i]...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "4\n2\n"}, "input": {"kind": "stdin", "value": "2\n4 3\n1 2\n1 2\n1 2\n1 2\n5 2\n2 3\n1 2\n2 3\n1 2\n2 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-00120-of-00128_77
Given is a positive integer N. Consider repeatedly applying the operation below on N: * First, choose a positive integer z satisfying all of the conditions below: * z can be represented as z=p^e, where p is a prime number and e is a positive integer; * z divides N; * z is different from all integers chosen in previous...
[{"code": "import java.util.*;\nimport java.util.function.*;\nimport java.lang.*;\nimport java.io.*;\n\nclass MathLib{\n static long gcd(long a, long b){\n if(a<0) a = -a;\n if(b<0) b = -b;\n if(a>b){\n long t = a;\n a = b;\n b = t;\n }\n while(a>0)...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "997764507000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00120-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-00120-of-00128_78
Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A. The problem has N test cases, all of which must be passed to get an AC verdict. Takahashi's submission has passed M cases out of the N test cases. Determine whether Takahashi's submission gets an AC. Constraints ...
[{"code": "import java.util.*;\nclass Main\n{\n public static void main(String args[])\n {\n Scanner sc = new Scanner(System.in);\n int m=sc.nextInt();\n int n=sc.nextInt();\n if(m==n) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n}", "is_known_correct": true, "language": "java"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "3 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_78__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-00120-of-00128_79
N players will participate in a tennis tournament. We will call them Player 1, Player 2, \ldots, Player N. The tournament is round-robin format, and there will be N(N-1)/2 matches in total. Is it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find t...
[{"code": "n=int(input());l=[list(map(int,input().split()))for i in[0]*n];a=[0]*n;d=1;k=n*(n-1)\nwhile sum(a)<k and d<9999:\n L=[0]*n;y=0;d+=1\n for i in range(n):\n if a[i]<n-1:\n x=l[i][a[i]]-1\n if l[x][a[x]]-1==i and L[x]+L[i]<1:\n a[i]+=1;a[x]+=1;L[i]=L[x]=y=1\nd*=y;print([k//2,d-1][d<9999])", "is_known_co...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "4\n2 3 4\n1 3 4\n4 1 2\n3 1 2"}, "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-00120-of-00128_80
There are N gems. The value of the i-th gem is V_i. You will choose some of these gems, possibly all or none, and get them. However, you need to pay a cost of C_i to get the i-th gem. Let X be the sum of the values of the gems obtained, and Y be the sum of the costs paid. Find the maximum possible value of X-Y. Co...
[{"code": "n = int(input())\nVi = map(int, input().split())\nCi = map(int, input().split())\n\nprint(sum([max(0, v-c) for (v, c) in zip(Vi, Ci)]))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_80__ref__0000", "source": "b...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "4\n13 21 6 19\n11 30 6 15"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-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-00120-of-00128_82
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint a, b, c, d;\n\nint main() {\n\tcin >> a >> b >> c >> d;\n\tcout << (abs(c-a)<=d || (abs(a-b)<=d && abs(b-c)<=d) ? \"Yes\" : \"No\") << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contest...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "1 100 2 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00120-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-00120-of-00128_84
We will call a string that can be obtained by concatenating two equal strings an even string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by delet...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nchar s[210];\nint main()\n{\n\t\n\t\n\tscanf(\"%s\", s);\n\tint x = strlen(s);\n\tfor (int i = (x - 1) / 2 - 1; i >= 0; i--) {\n\t\tif (!strncmp(s, s + i + 1, i + 1)) {\n\t\t\tprintf(\"%d\\n\", 2 * (i + 1));\n\t\t\tbreak;\n\t\t}\n\t}\n}", "is_known_correct": tr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "abaababaab"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00120-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-00120-of-00128_85
You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri...
[{"code": "import 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\tint N = sc.nextInt();\n\t\tString S = sc.next();\n\t\tint max = 0;\n\t\tint x = 0;\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tif(S.charAt(i) == 'I') {\n\t\t\t\tx++;\n\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "5\nIIDID"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00120-of-00128_85__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-00121-of-00128_0
You are given two positive integers – A and B. You have to check whether A is divisible by all the prime divisors of B. Input The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. For each test case, you are given two space separated integers – A ...
[{"code": "t=input()\nwhile (t):\n\ta,b=raw_input().split()\n\ta=eval(a)\n\tb=eval(b)\n\tprint 'Yes' if (a**65)%b==0 else 'No'\n\tt-=1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_0__ref__0000", "source": "benchmark"}, {...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nYes\nNo\n"}, "input": {"kind": "stdin", "value": "3\n120 75\n128 16\n7 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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00121-of-00128_1
Arrays have fallen out of Chef's good books, and he plans to destroy all arrays he possesses. He is left with the last array A, consisting of N positive integers. In order to destroy the array, he can perform the following 2 types of operations any number of times. Choose any 2 elements, say X and Y, from the given a...
[{"code": "# this is implementation of moors algorithm, where we have to find out whether there is an element whose frequency is more than half of the length of array.\n# Answer of this problem can not be less than half of the length of array.\n\nT = int(raw_input());\nwhile T > 0:\n T = T-1;\n N = int(raw_input(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2\n2\n"}, "input": {"kind": "stdin", "value": "3\n2\n1 2\n2\n1 1\n3\n1 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-00121-of-00128_4
Roman has no idea, why this problem is called Stone. He also has no idea on how to solve the followong problem: given array of N integers A and a number K. During a turn the maximal value over all Ai is chosen, let's call it MAX. Then Ai = MAX - Ai is done for every 1 <= i <= N. Help Roman to find out how will the arra...
[{"code": "fr=raw_input().split()\nn=int(fr[0])\nk=int(fr[1])\nraw=raw_input().split()\nl=[]\n\nfor i in range(0,n):\n\tl.append(int(raw[i]))\n\nif k==0:\n\tfor i in l:\n\t\tprint i,\n\tprint \"\"\n\nme=max(l)\nfor i in range(0,n):\n\tl[i]=me-l[i]\nif k%2==1:\n\tfor i in l:\n\t\tprint i,\n\tprint \"\"\n\nif k%2==0 and ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2 8 0 7\n"}, "input": {"kind": "stdin", "value": "4 1\n5 -1 7 0"}, "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-00121-of-00128_5
Olya works as a warehouse keeper for a T-Shirt factory. Now the factory is facing hard times, so currently they produce only the T-shirts of three kinds: red, green and blue T-Shirts. All the T-shirts are stored in the containers, each of the containers contain the T-Shirts of a single colour. Now there are N container...
[{"code": "for _ in xrange(input()):\n s = raw_input()\n n = len(s)\n rs = [0 for i in xrange(n)]\n gs = [0 for i in xrange(n)]\n bs = [0 for i in xrange(n)]\n r, g, b = 0, 0, 0\n for i in xrange(n):\n rs[i] = r\n gs[i] = g\n bs[i] = b\n if s[i] == 'r':\n r +=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "1\n0\n0\n2"}, "input": {"kind": "stdin", "value": "4\nrgr\nrrr\nrgb\nrgbr"}, "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-00121-of-00128_77
There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take. Constraints * 2 \leq N \leq 2 \times 10^5 * 1 \leq A_i \leq B_i \leq 10^9 * All values in input are integers. Input Input is given from Standard ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long int LL;\ntypedef pair<int,int> P;\ntypedef pair<LL,LL> PL;\n\nint main(){\n LL n;\n cin>>n;\n LL a[200010],b[200010];\n for(LL i=0;i<n;i++){\n cin>>a[i]>>b[i];\n }\n sort(a,a+n);\n sort(b,b+n);\n if(n%2!=0){\n LL m=n/2;\n cout...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "9991"}, "input": {"kind": "stdin", "value": "3\n100 100\n10 10000\n1 1000000000"}, "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
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00121-of-00128_78
Given are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller? Constraints * 1 \leq a \leq 9 * 1 \leq b \leq 9 * a and b are integers. Input Input is given from Stan...
[{"code": "N = list(map(int, input().split()))\n\na = N.sort()\n\nprint(str(N[0])*N[1])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "#include<bits/stdc++.h>\nusing namesp...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "7777777"}, "input": {"kind": "stdin", "value": "7 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_78__...
{"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-00121-of-00128_79
E869120 is initially standing at the origin (0, 0) in a two-dimensional plane. He has N engines, which can be used as follows: * When E869120 uses the i-th engine, his X- and Y-coordinate change by x_i and y_i, respectively. In other words, if E869120 uses the i-th engine from coordinates (X, Y), he will move to the ...
[{"code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\n\npublic class Main {\n public static void main(String[] args) {\n FastScanner fsc = new FastScanner();\n int n = fsc.nextInt();\n L...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "128303.000000000000000000000000000000000000000000000000"}, "input": {"kind": "stdin", "value": "1\n90447 91000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecont...
{"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-00121-of-00128_80
There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint gcd(int x, int y){\n int r;\n while((r=x%y)!=0){x=y; y=r;}\n return y;\n}\n\nint main(){\n int N;\n cin >> N;\n vector<int> A(N);\n for(int i=0;i<N;i++)cin >> A[i];\n sort(A.begin(),A.end());\n for(int i=A[1];i>=1;i--){\n int cnt=0; bool q=tru...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "3\n7 6 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00121-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-00121-of-00128_82
You are given a positive integer X. Find the largest perfect power that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. Constraints * 1 ≤ X ≤ 1000 * X is an integer. Input Input is given from Standard Input ...
[{"code": "#include <iostream>\n#include <cmath>\nusing namespace std;\n\nint main()\n{\n int X;\n cin >> X;\n\n int ans = 1;\n for(int i = 2; i < X; ++i) {\n for(int j = 2; pow(i, j) <= X; ++j) {\n ans = max(ans, int(pow(i, j)));\n }\n }\n\n cout << ans << endl;\n}\n", "is_known_correct": true, "langu...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_82__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-00121-of-00128_84
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
[{"code": "# ------ combination -------\nN, MOD = 10**5 + 1, 10**9 + 7\nfc, ifc = [0] * (N+1), [0] * (N+1)\n\ndef power(n, a):\n res, exp = 1, n\n while(a):\n if a & 1:\n res = res * exp % MOD\n exp = exp * exp % MOD\n a = a >> 1\n return res\n\nfc[0] = 1\nfor i in range(1, N+1)...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "1\n1"}, "input": {"kind": "stdin", "value": "1\n1 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00121-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-00121-of-00128_85
You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. Constraints * 1≤N≤10^3 Input The input is given from Standard Input in the following format: N Output Print the number of the positive divisors of N!, modulo 10^9+7. Examples Input 3 Output 4 Input 6 Output 3...
[{"code": "n = int(input())\n\nmultiplier = [0 for _ in range(n)]\nfor m in range(2, n+1):\n a = m\n i = 2\n while i ** 2 <= m:\n while a % i == 0:\n a = int(a / i)\n multiplier[i-1] += 1\n i += 1\n if a != 1:\n multiplier[a-1] += 1\nans = 1\nfor x in multiplier:\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "30"}, "input": {"kind": "stdin", "value": "6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00121-of-00128_85__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-00122-of-00128_0
Today a plane was hijacked by a maniac. All the passengers of the flight are taken as hostage. Chef is also one of them. He invited one of the passengers to play a game with him. If he loses the game, he will release all the passengers, otherwise he will kill all of them. A high risk affair it is. Chef volunteered fo...
[{"code": "import re\ndef processBallons(line, k):\n x = re.split(\" \", line)\n r = int(x[0]); g = int(x[1]); b = int(x[2])\n #\n return 1+min(r,k-1)+min(g,k-1)+min(b,k-1)\n\nif __name__ == '__main__':\n T = int(raw_input())\n for t in range(T):\n line = raw_input()\n k = int(raw_input(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1\n4\n"}, "input": {"kind": "stdin", "value": "2\n3 3 3\n1\n3 3 3\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-00122-of-00128_4
Andrii is good in Math, but not in Programming. He is asking you to solve following problem: Given an integer number N and two sets of integer A and B. Let set A contain all numbers from 1 to N and set B contain all numbers from N + 1 to 2N. Multiset C contains all sums a + b such that a belongs to A and b belongs to B...
[{"code": "n,q = map(int,raw_input().split())\nhalf=(1+(n+1)+n+(2*n))/2\nfor i in range(0,q):\n inp = input()\n diff = abs(half-inp)\n if(inp<(1+(n+1)) or inp>(n+(2*n))):\n print \"0\"\n elif(inp==half):\n print(n)\n else:\n print(n-diff)", "is_known_correct": true, "language": "pyth...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2\n0\n1\n3\n1\n"}, "input": {"kind": "stdin", "value": "3 5\n6\n2\n9\n7\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-00122-of-00128_5
The following is an easy game that the setter of this problem played when he was 8: A boatman, a wolf, a sheep, and a cabbage are on the bank of a river. They have a small boat that is capable of carrying the boatman and at most one other animal/item with him. However, if left alone by the boatman, the wolf can eat the...
[{"code": "for t in xrange(input()):\n n,m=map(int,raw_input().split())\n arr=[]\n for i in range(m):\n arr+=map(int,raw_input().split())\n if m>=3: print 'NO'\n elif m==2:\n arr=set(arr)\n if len(arr)<4:print 'YES'\n else:...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nNO\n"}, "input": {"kind": "stdin", "value": "2\n3 2\n1 2\n2 3\n3 3\n1 2\n2 3\n1 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-00122-of-00128_77
Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S. For a non-empty subset T of the set \\{1, 2, \ldots , N \\}, let us define f(T) as follows: * f(T) is the number of different non-empty subsets \\{x_1, x_2, \ldots , x_k \\} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k}...
[{"code": "N, S = map(int, input().split())\nA = list(map(int, input().split()))\nmod = 998244353\nL = [[0 for i in range(S+1)] for j in range(N+1)]\nL[0][0] = 1\nfor j, a in enumerate(A):\n for i in range(S+1):\n if i < a:\n L[j+1][i] = (2 * L[j][i]) % mod\n else:\n L[j+1][i] = (2 * L[j][i] + L[j][i-a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "5 8\n9 9 9 9 9"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00122-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-00122-of-00128_78
Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition: * For any integer j (1 \leq j \leq i), P_i \leq P_j. Constraints * 1 \leq N \leq 2 \times 10^5 * P_1, \ldots, P_N is a permutation of 1, \ldots, N. * All values in input are ...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint n,r,x,m=0x3f3f3f3f;\nint main()\n{\n cin>>n;\n for(int i=1;i<=n;i++,r+=(m>x),m=min(m,x))cin>>x;\n cout<<r;\n return 0;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riege...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "8\n5 7 4 2 6 8 1 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00122-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-00122-of-00128_80
There are N integers, A_1, A_2, ..., A_N, arranged in a row in this order. You can perform the following operation on this integer sequence any number of times: Operation: Choose an integer i satisfying 1 \leq i \leq N-1. Multiply both A_i and A_{i+1} by -1. Let B_1, B_2, ..., B_N be the integer sequence after your ...
[{"code": "import java.util.*;\nimport java.lang.*;\n\npublic class Main {\n\tstatic long mod = 998244353;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "10000000000"}, "input": {"kind": "stdin", "value": "11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000"}, ...
{"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-00122-of-00128_81
In some other world, today is December D-th. Write a program that prints `Christmas` if D = 25, `Christmas Eve` if D = 24, `Christmas Eve Eve` if D = 23 and `Christmas Eve Eve Eve` if D = 22. Constraints * 22 \leq D \leq 25 * D is an integer. Input Input is given from Standard Input in the following format: D ...
[{"code": "D = int(input())\na = \"Christmas\"\nprint(a + \" Eve\"*(25-D))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_81__ref__0000", "source": "benchmark"}, {"code": "a =int(input())\nd = 25-a\nprint('Christmas' + ' E...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "Christmas"}, "input": {"kind": "stdin", "value": "25"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_81_...
{"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-00122-of-00128_82
You are given a string s. Among the different substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. Also,...
[{"code": "#include <iostream>\n#include <set>\nusing namespace std;\nint main(void) {\n\tstring s;\n\tint k;\n\tcin >> s >> k;\n\tset<string> st;\n\tfor (int i = 0; i < s.size(); ++i) {\n\t\tstring subs;\n\t\tfor (int j = i; j < s.size(); ++j) {\n\t\t\tsubs += s[j];\n\t\t\tif (subs.size() > k) break;\n\t\t\tst.insert(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "b"}, "input": {"kind": "stdin", "value": "aba\n4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00122-of-00128_82__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-00123-of-00128_0
Chef is playing a game with his friend Misha. They have a pile containg N coins. Players take alternate turns, removing some coins from the pile. On each turn, a player can remove either one coin or coins equal to some prime power (i.e. p^x coins, where p - prime number and x - positive integer). Game ends when the pil...
[{"code": "for i in range(int(raw_input())):\n n = int(raw_input())\n \n if n % 6 == 0:\n print \"Misha\" \n else:\n print \"Chef\"", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00123-of-00128_0__ref__0000", "s...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00123-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "Chef\nChef\n"}, "input": {"kind": "stdin", "value": "2\n1\n8"}, "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-00123-of-00128_1
Devu has an array A consisting of N positive integers. He would like to perform following operation on array. Pick some two elements a, b in the array (a could be same as b, but their corresponding indices in the array should not be same). Remove both the elements a and b and instead add a number x such that x lies be...
[{"code": "inputstr = raw_input()\nn,q = inputstr.split()\nn = int(n)\nq = int(q)\na = map(int, raw_input().split())\nminn = min(a)\nmaxn = max(a)\nfor i in range(q):\n t = int(raw_input())\n if((t >= minn)&(t <= maxn)):\n print('Yes')\n else:\n print('No')", "is_known_correct": true, "language":...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00123-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nYes\nYes\nNo\n"}, "input": {"kind": "stdin", "value": "2 4\n1 3\n1\n2\n3\n4"}, "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