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-00000-of-00128_0
Alice and Johnny are playing a simple guessing game. Johnny picks an arbitrary positive integer n (1 ≤ n ≤ 10^9) and gives Alice exactly k hints about the value of n. It is Alice's task to guess n, based on the received hints. Alice often has a serious problem guessing the value of n, and she's beginning to suspect t...
[{"code": "from collections import Counter\nminr = 1\nmaxr = 10 ** 9 + 1\nt = int(raw_input())\nfor i in xrange(t):\n k = int(raw_input())\n cnt = Counter()\n for j in xrange(k):\n op, num, ans = raw_input().split()\n ans = ans.upper()\n num = int(num)\n if op == '<':\n i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "0\n1\n2"}, "input": {"kind": "stdin", "value": "3\n2\n< 100 No\n> 100 No\n3\n< 2 Yes\n> 4 Yes\n= 3 No\n6\n< 2 Yes\n> 1 Yes\n= 1 Yes\n= 1 Yes\n> 1 Yes\n= 1 Yes"}, "metadata": {},...
{"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-00000-of-00128_1
Spring is interesting season of year. Chef is thinking about different things, but last time he thinks about interesting game - "Strange Matrix". Chef has a matrix that consists of n rows, each contains m elements. Initially, the element aij of matrix equals j. (1 ≤ i ≤ n, 1 ≤ j ≤ m). Then p times some element aij is...
[{"code": "n,m,p=map(int,raw_input().split())\nb=[]\nfor x in xrange(p):\n a=map(int,raw_input().split())\n b.append(a)\nb.sort()\npos=0\nfor i in xrange(1,n+1):\n if b[pos][0]!=i:\n ans=m-1\n else:\n count=0\n prev=0\n ans=m-1\n while b[pos][0]==i and m!=1:\n c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "3\n3\n-1\n4"}, "input": {"kind": "stdin", "value": "4 4 6\n2 2\n3 2 \n3 2 \n4 3\n4 4\n4 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-00000-of-00128_2
Chef loves games! But he likes to invent his own. Now he plays game "Digit Jump". Chef has sequence of digits S1, S2,..., SN,. He is staying in the first digit (S1) and want to reach the last digit (SN) in the minimal number of jumps. While staying in some digit x with index i (digit Si) Chef can jump into digits with...
[{"code": "import sys\n\ns = raw_input().strip()\n\ndigits = [[] for i in xrange(10)]\ndist = [-1] * (len(s))\nused = [False] * 10\n\nfor i in xrange(len(s)):\n digits[int(s[i])].append(i)\n\ndist[0] = 0\nq = [0]\n\nwhile True:\n v = q.pop(0)\n cur = dist[v]\n\n if v == len(s)-1:\n print cur\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "1\n"}, "input": {"kind": "stdin", "value": "01234567890"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_2...
{"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-00000-of-00128_80
You will be given an integer a and a string s consisting of lowercase English letters as input. Write a program that prints s if a is not less than 3200 and prints `red` if a is less than 3200. Constraints * 2800 \leq a < 5000 * s is a string of length between 1 and 10 (inclusive). * Each character of s is a lowerca...
[{"code": "a,s = int(input()),input()\nprint(s if a>=3200 else \"red\")", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\n \npublic class Main {\n \tpubli...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "red"}, "input": {"kind": "stdin", "value": "4049\nred"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_80...
{"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-00000-of-00128_82
You are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally "Seven-Five-Three numbers") are there? Here, a Shichi-Go-San number is a positive integer that satisfies the following condition: * When the number is written in base ten, each of the digits `7`, `5` ...
[{"code": "\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t//\t static int mod = (int) (Math.pow(10,9)+7);\n\t\t static int mod = 2019;\n\t\t static List<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>();\n\t public static void main(String[] args) {\n\t \t\n\t ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "575"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00000-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-00000-of-00128_83
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ...
[{"code": "#include <iostream>\nusing namespace std;\nint h, w, fl=1, a[55][55];\nstring s;\nint main() {\n\tint i, j;\n\tcin>>h>>w;\n\tfor(i=1; i<=h; i++) {\n\t\tcin>>s;\n\t\tfor(j=1; j<=w; j++) a[i][j] = s[j-1]=='.' ? 0:1;\n\t}\n\tfor(i=1; i<=h; i++) for(j=1; j<=w; j++) {\n\t\tif(a[i][j]==1 && a[i-1][j] + a[i+1][j] +...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "3 3\n.#.\n###\n.#."}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00000-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-00000-of-00128_87
Alice, Bob and Charlie are playing Card Game for Three, as below: * At first, each of the three players has a deck consisting of some number of cards. Alice's deck has N cards, Bob's deck has M cards, and Charlie's deck has K cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the d...
[{"code": "#include<bits/stdc++.h>\nusing namespace std ;\n#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )\n#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )\n#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )\n#define re register\n#define int long long\nint gi()...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "1227"}, "input": {"kind": "stdin", "value": "4 2 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00000-of-00128_87__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-00001-of-00128_2
For any positive integer, we define a digit rotation as either moving the first digit to the end of the number (left digit rotation), or the last digit to the front of the number (right digit rotation). For example, the number 12345 could be left digit rotated to 23451, or right digit rotated to 51234. If there are any...
[{"code": "# code chef - easy - digit rotation\n\ndef left(s):\n return str(int(s[-1]+s[:-1]))\n\ndef right(s):\n return str(int(s[1:]+s[0]))\n\nnCases = int(raw_input())\n\nfor iter in range(nCases):\n number = raw_input()\n\n if len(number)==1:\n print number\n continue\n\n best = max(in...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "51234\n54321\n11090\n211011\n7\n9\n"}, "input": {"kind": "stdin", "value": "6\n12345\n54321\n10901\n211011\n7\n90"}, "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-00001-of-00128_5
Alok-nath is man of equality. He needs your help to divide his “sanskars” evenly amongst all his followers. By doing this, Alok-nath can create equality amongst his followers and he'll be called a true “sanskari”. Alok-nath has N sanskars, and K followers. Each sanskar is given a numerical value which shows its intensi...
[{"code": "def possible(A, e, n):\n def rec(i, r):\n if r == 0:\n return True\n if i == n:\n return False\n if A[i] > 0 and r >= A[i]:\n p = rec(i + 1, r - A[i])\n if p:\n A[i] = 0\n return True\n p = rec(i + 1, r)\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "yes\nno"}, "input": {"kind": "stdin", "value": "2\n5 3\n1 2 4 5 6\n5 3\n1 2 4 5 7"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00001-of-00128_80
Given is a sequence of N integers A_1, \ldots, A_N. Find the (multiplicative) inverse of the sum of the inverses of these numbers, \frac{1}{\frac{1}{A_1} + \ldots + \frac{1}{A_N}}. Constraints * 1 \leq N \leq 100 * 1 \leq A_i \leq 1000 Input Input is given from Standard Input in the following format: N A_1 A_2 \...
[{"code": "n,a=open(0)\nprint(1/sum(1/int(i)for i in a.split()))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "import java.util.Scanner;\n\npublic class Main {\n public s...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "7.5"}, "input": {"kind": "stdin", "value": "2\n10 30"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_80_...
{"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-00001-of-00128_81
There are two buttons, one of size A and one of size B. When you press a button of size X, you get X coins and the size of that button decreases by 1. You will press a button twice. Here, you can press the same button twice, or press both buttons once. At most how many coins can you get? Constraints * All values i...
[{"code": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\n\t\tint sum = 0;\n\t\tfor(int i = 0; i < 2; i++) {\n\t\t\tif(A < B) {\n\t\t\t\tsum...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "3 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_81__public...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00001-of-00128_82
You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many Shichi-Go numbers (literally "Seven-Five numbers") are there? Here, a Shichi-Go number is a positive integer that has exactly 75 divisors. Constraints * 1 \leq N \leq 100 * N is an integer. Input Input is given from S...
[{"code": "N = int(input())\ne = [0 for _ in range(N + 1)]\n\nfor i in range(2, N + 1):\n for j in range(2, i + 1):\n while i % j == 0:\n i //= j\n e[j] += 1\n\nc = tuple(filter(lambda x: x > 0, e)) # 素因数の指数\n\ndp = [[0 for _ in range(75 + 1)] for _ in range(len(c) + 1)] # dp[素因数のidx][...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "9"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00001-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-00001-of-00128_85
Snuke is playing a puzzle game. In this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2},y_{i,2}). The objective is to draw a curve connecting the pair of points where the same integer i...
[{"code": "import sys\n\ndef main():\n # res = []\n inps = map(lambda s: s.strip(), sys.stdin.readlines())\n iid = 0\n r, c, n = map(int, inps[iid].split())\n iid += 1\n\n def boundary(x,y):\n if x==0 or y==0 or x==r or y==c:\n return True\n return False\n\n def downright(x...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00001-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "YES"}, "input": {"kind": "stdin", "value": "4 2 3\n0 1 3 1\n1 1 4 1\n2 0 2 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00002-of-00128_1
Chef had a hard day and want to play little bit. The game is called "Chain". Chef has the sequence of symbols. Each symbol is either '-' or '+'. The sequence is called Chain if each two neighboring symbols of sequence are either '-+' or '+-'. For example sequence '-+-+-+' is a Chain but sequence '-+-+--+' is not. H...
[{"code": "testCases = int(raw_input())\nfor testCase in range(testCases):\n\toriginalString = raw_input()\n\tlenOfOriginalString = len(originalString)\n\t# count variables to find the difference between the new string and original one\n\tcount1 = 0 # for \"-+-+-+....\"\n\tcount2 = 0 # for \"+-+-+-....\"\n\tfor pos in ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00002-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n"}, "input": {"kind": "stdin", "value": "2\n---+-+-+++\n-------"}, "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-00002-of-00128_2
Chef recently printed directions from his home to a hot new restaurant across the town, but forgot to print the directions to get back home. Help Chef to transform the directions to get home from the restaurant. A set of directions consists of several instructions. The first instruction is of the form "Begin on XXX", i...
[{"code": "t = int(raw_input())\nwhile t:\n n = int(raw_input())\n directions = []\n for i in range(n):\n directions.append(raw_input().split())\n if i:\n directions[i-1][0]=\"Left\" if directions[i][0]==\"Right\" else \"Right\"\n directions[n-1][0]=\"Begin\"\n while n:\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00002-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "Begin on Road D\nRight on Road C\nLeft on Road B\nLeft on Road A\nBegin on Ganapathi Temple Road\nLeft on Hosur Road\nLeft on Sarjapur Road\nLeft on 100 Feet Road\nRight on Doml...
{"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-00002-of-00128_80
You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i. When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n\tint n;\n\tcin>>n;\n\tfloat a[n];\n\tfor(int i=0;i<n;i++) cin>>a[i];\n\tsort(a,a+n);\n\tif(n==1){\n\t\tcout<<a[0]<<endl;\n\t\treturn 0;\n\t}\n\tdouble c=(a[0]+a[1])/2;\n\tfor(int i=2;i<n;i++){\n\t\tc=(c+a[i])/2;\n\t}\n\tcout<<c<<endl;\n}", "is_know...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00002-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "3.5"}, "input": {"kind": "stdin", "value": "2\n3 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00002-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-00002-of-00128_81
There are N mountains ranging from east to west, and an ocean to the west. At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns. The height of the i-th mountain from the west is H_i. You can certainly see the ocean from the inn at the top of the westmost mountain. F...
[{"code": "import java.util.*;\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\tint[] h = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tint count = 1, max = h[0];\n\t\tfor (int i = 1; i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00002-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "4\n6 5 6 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00002-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-00002-of-00128_85
There are M chairs arranged in a line. The coordinate of the i-th chair (1 ≤ i ≤ M) is i. N people of the Takahashi clan played too much games, and they are all suffering from backaches. They need to sit in chairs and rest, but they are particular about which chairs they sit in. Specifically, the i-th person wishes to...
[{"code": "#include <cstdio>\n#include <algorithm>\n#include <iostream>\n#include <vector>\n#include <cstring>\n#include <set>\n#include <utility>\n#include <cstdlib>\n#include <cmath>\n#include <queue>\n#include <stack>\n#include <string>\n#include <map>\n#include <cmath>\n#include <deque>\n#include <bitset>\n#include...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00002-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "6 6\n1 6\n1 6\n1 5\n1 5\n2 6\n2 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rie...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00003-of-00128_0
You are given a uniformly randomly generated string S, consisting of letters from the set {"A", "B"}. Your task is to find a string T that appears in S as a subsequence exactly twice. In other words, you need to find such a string T, that there exist exactly two sets of indexes i1, i2, ..., i|T| and j1, j2, ..., j|T| s...
[{"code": "for t in xrange(int(raw_input())):\n\ts = raw_input()\n\tn = len(s)\n\ta = s.count('A')\n\tb = n-a \n\tif (a==2):\n\t\tprint \"A\"\n\telif (b==2):\n\t\tprint \"B\"\n\telif (n<4):\n\t\tprint -1\n\telse:\n\t\tif (s[0]==\"A\"):\n\t\t\ts = \"B\"+s\n\t\telse:\n\t\t\ts = \"A\"+s\n\t\tif (s[-1]==\"A\"):\n\t\t\ts = ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "-1\nB"}, "input": {"kind": "stdin", "value": "2\nAAAA\nBAB"}, "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-00003-of-00128_1
Chef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembered an important task and left the room for sometime. While he was away, his newly hired assistant came across the piles and mixed them up while playing. When Che...
[{"code": "import sys\n\ndef getMaxRep(list):\n \n count = 0\n maxRep = None\n \n currRep = list[0]\n currCount = 1\n \n i = 1\n while i < len(list):\n if list[i] == currRep:\n currCount += 1\n else:\n if currCount > count:\n count = currC...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "3\n"}, "input": {"kind": "stdin", "value": "1\n4\n1 2 3 4"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00003-of-00128_5
Recently Chef become very much interested in perfect squares. We all know Chef and his weird interests. Anyways Chef will be soon writing his masters thesis on perfect squares revealing what-not-known properties of perfect squares. While doing his research, he happened to be confronted with some interesting perfect squ...
[{"code": "'''\nfrom collections import Counter\nimport string,sys\nN = int(raw_input()); s = raw_input();\nif N == 1: print s; sys.exit(0)\nsc = Counter(s)\nfor i in range(N-1):\n st = raw_input(); stc = Counter(st)\n for i in list(string.ascii_lowercase):\n if sc.get(i) != None and stc.get(i) == None: sc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "3\n9\n"}, "input": {"kind": "stdin", "value": "2\n1 10\n100 10000"}, "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-00003-of-00128_80
Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operation...
[{"code": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n\tpublic static long[] ans;\n\tpublic static Map<Integer, List<Integer>> map;\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "20 20 20 20 20 20"}, "input": {"kind": "stdin", "value": "6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__...
{"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-00003-of-00128_81
N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N. The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`. You want to repaint some of the tiles black or white, so that any two a...
[{"code": "S = str(raw_input())\nn = len(S)\n\npattern0 = (\"10\" * (n//2 + 1))\npattern1 = (\"01\" * (n//2 + 1))\ncount0 = 0\ncount1 = 0\n\nfor i in range(n):\n if pattern0[i] != S[i]:\n count0 += 1\n if pattern1[i] != S[i]:\n count1 += 1\n\nprint min(count0, count1)", "is_known_correct": true, "la...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "10010010"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00003-of-00128_81__p...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00004-of-00128_1
Our hardworking chef is bored of sleeping in his restaurants. He has decided to settle down. The first thing he must do is to find a suitable location to build a palatial home. Think of the city as a two-dimensional grid. There are N restaurants in the city. Each of the chef's restaurant is a point denoted by (X , ...
[{"code": "t = int(raw_input())\nwhile t > 0:\n\tt-=1\n\tn = int(raw_input())\n\tx=[]\n\ty=[]\n\tfor i in range(n):\n\t\tl = map(int,raw_input().split())\n\t\tx.append(l[0])\n\t\ty.append(l[1])\n\tif n % 2 == 1: \n\t\tprint 1\n\telse : \n\t\tx.sort()\n\t\ty.sort()\n\t\tprint (x[n/2]-x[n/2-1]+1)*(y[n/2]-y[n/2-1]+1)", "i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "1\n1\n4\n"}, "input": {"kind": "stdin", "value": "3\n5\n0 0\n-1 0\n1 0\n0 1\n0 -1\n5\n31 11\n30 -41\n20 14\n25 18\n25 38\n2\n0 0\n1 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-00004-of-00128_2
You have initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest subsequence of string A such that all the characters in that subsequence are distinct ie. no two characters in that subsequence should be same. A subsequence of string A is a sequence that can be derived from A...
[{"code": "t=int(raw_input())\nwhile(t):\n d={}\n s=(raw_input())\n for i in s:\n if i in d :\n d[i]+=1\n else:\n d[i]=1\n\n t-=1\n #print d\n print len(d.keys())", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "3\n2\n"}, "input": {"kind": "stdin", "value": "2\nabc\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-00004-of-00128_3
Chef has an array of N integers. He wants to play a special game. In this game he needs to make all the integers in the array greater than or equal to 0. Chef can use two types of operations. The first type is to increase all the integers of the given array by 1, but it costs X coins. The operation of the second type...
[{"code": "n = input()\na = []\nm = raw_input().split()\ntotal = 0\nfor i in range(n):\n k = int(m[i])\n if k < 0:\n a.append(k)\n total += -k\nX = input()\nif X >= len(a):\n print total\nelse:\n a.sort()\n ans = bar = 0; last = len(a)-1\n while True:\n j = None\n for i in ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "5\n"}, "input": {"kind": "stdin", "value": "3\n-1 -2 -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-00004-of-00128_5
Sereja and Dima play the game. The rules are as follows: Initially, there are n cards on the table, each card has a positive integer written on it. At the beginning Sereja writes down the number 0 on the sheet of paper. Then players pick cards from the table alternately. When a player picks a card, he writes down the g...
[{"code": "from fractions import gcd\n\na = []\nn = 0\n\ndp1 = [[-1 for i in range(101)] for i in range(101)]\ndp2 = [[-1.0 for i in range(101)] for i in range(101)]\n\ndef iswinning(g,taken):\n\tglobal n, a, dp1\n\t\n\tif dp1[g][taken]!= -1:\n\t\treturn dp1[g][taken]\n\t\n\tif g==1:\n\t\tdp1[g][taken] = 1\n\t\n\telif ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "0 0.4000\n1 1.0000\n0 0.0000\n1 0.5833"}, "input": {"kind": "stdin", "value": "4\n5\n6 10 15 22 28\n5\n2 4 8 16 32\n4\n2 4 8 16\n4\n1 2 3 4"}, "metadata": {}, "visibility": "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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00004-of-00128_79
Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order. Constraints * C is a lowercase English letter that is not `z`. Input Input is given from Standard Input in the following format: C Output Print the letter that follows C in alphabetical order. Example...
[{"code": "#include <stdio.h>\n\n\nint main ()\n{\nchar K;\n\nscanf (\"%c\", &K);\n\nK=K+1;\nprintf(\"%c\", K);\n\n\n\n\treturn 0;\n\t}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_79__ref__0000", "source": "benchmark"}, {"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "z"}, "input": {"kind": "stdin", "value": "y"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00004-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-00004-of-00128_80
Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. * Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i chara...
[{"code": "s=input()\nt=input()\n\nans=0\ns_inx=0\nt_inx=0\ns_l=len(s)\nt_l=len(t)\n\nc=0\nwhile t_inx<=t_l-1:\n try:\n temp_inx=s[s_inx:].index(t[t_inx])\n s_inx+=temp_inx+1\n t_inx+=1\n c=0\n except:\n c+=1\n s_inx=0\n ans+=s_l\n\n if c==2:\n print(-1)\n exit()\nelse:\n ans+=s_inx\n\npr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "33"}, "input": {"kind": "stdin", "value": "contest\nsentence"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00004-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-00004-of-00128_81
N people are arranged in a row from left to right. You are given a string S of length N consisting of `0` and `1`, and a positive integer K. The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`. You will give the following direction at mo...
[{"code": "n, k = map(int, input().split())\ns = input()\nl = [0] * (k * 2 + 1)\nc = '1'\np = 0\nret = 0\nfor i in range(len(s)):\n if s[i] != c:\n ret = max(ret, i - l[p])\n l.append(i)\n if c == '1':\n l.pop(0)\n l.pop(0)\n c = s[i]\nret = max(ret, n - l[p])\nprint...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00004-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "5 1\n00010"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00004-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-00005-of-00128_1
Chef wants to hire a new assistant. He published an advertisement regarding that in a newspaper. After seeing the advertisement, many candidates have applied for the job. Now chef wants to shortlist people for the interviews, so he gave all of them one problem which they must solve in order to get shortlisted. The pro...
[{"code": "from math import *\ndef lcm(n):\n x,c, t,f= 1,0,0,False\n while (n%2 == 0):\n c+=2**t\n f = True\n t+=1\n n = n/2\n if f == True:\n x = c+2**t\n i = 3\n while i<=sqrt(n):\n f = False\n c = 0\n t = 0\n while (n%i == 0):\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "1\n3\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-00005-of-00128_2
This summer, there is a worldwide competition being held in Chef Town and some of the best chefs of the world are participating. The rules of this competition are quite simple. Each participant needs to bring his or her best dish. The judges will initially assign a score to each of the dishes. Now, several rounds wil...
[{"code": "#!/usr/bin/env python\n\nimport sys\n\nparent = None\n#child = dict()\n\ndef find_set(x):\n global parent\n while parent[x] != x:\n parent[x] = parent[parent[x]]\n x = parent[x]\n return parent[x]\n\nT = int(sys.stdin.readline()) \n\nwhile T > 0:\n \n N = int(sys.stdin.readlin...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "2\n"}, "input": {"kind": "stdin", "value": "1\n2\n1 2\n2\n0 1 2\n1 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-00005-of-00128_3
The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime. Input The input begins with two positive integ...
[{"code": "# cook your code here\nn,k=map(int,raw_input().split())\ncount=0\nfor i in range(0,n):\n if (int(raw_input()))%k==0:\n count+=1\nprint count", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_3__ref__0000"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "4\n"}, "input": {"kind": "stdin", "value": "7 3\n1\n51\n966369\n7\n9\n999996\n11"}, "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-00005-of-00128_5
Sereja is playing a game called Winner Eats Sandwich with his friends. There are N persons in total, including Sereja. Sereja is allotted the number 1, while his friends are allotted numbers from 2 to N. A set of this game consists of M parts. Probability that a player numbered i wins part j of any set is p[i][j]. Sere...
[{"code": "from operator import mul\n\nparse = lambda: [25*i for i in map(float, raw_input().split())]\n\nfor _ in xrange(int(raw_input())):\n\tn, m = map(int, raw_input().split())\n\tnum = reduce(mul, parse())\n\tden = num\n\tfor _ in xrange(n - 1):\n\t\tden += reduce(mul, parse())\n\tif num == 0:\n\t\tden = 1\n\tprin...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "1.000000\n0.500000\n"}, "input": {"kind": "stdin", "value": "2\n2 2\n1.0000 1.0000\n0.0000 0.0000\n2 3\n0.5000 0.5000 0.5000\n0.5000 0.5000 0.5000"}, "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-00005-of-00128_70
ACT I Handi Bhaiya is a very notorious kid and always troubles his parents and friends. One day his naughtiness lead him to a demon Kali(THE COBRA COMMANDER) who trapped him into a triangular magic cell. Handi Bhaiya parents want their kid back and asks for your help. ACT II You knew that the entire humanity will hate...
[{"code": "t = int(raw_input())\nfor _ in range(t):\n l = []\n l = map(int, raw_input().split())\n if l[0]+l[1]>l[2] and l[1]+l[2]>l[0] and l[2]+l[0]>l[1]:\n if l[0]==l[1] and l[1]==l[2]:\n print 'YES. It is a equilateral triangle.'\n elif l[0]==l[1] or l[1]==l[2] or l[2]==l[0]:\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_70__public__0000", "expected_output": {"kind": "stdout", "value": "YES. It is a equilateral triangle.\nYES. It is a isosceles triangle.\nYES. It is a scalene triangle.\nNO"}, "input": {"kind": "stdin", "value": "4\n15 15 15\n13 13 14\n3 4 5\n1...
{"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-00005-of-00128_79
Takahashi participated in a contest on AtCoder. The contest had N problems. Takahashi made M submissions during the contest. The i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` or `WA`). The number of Takahashi's correct answers is the number of problems on which he received an `A...
[{"code": "#include <iostream>\n#include <vector>\n\nusing namespace std;\n\nint main() {\n\tint n, m; cin >> n >> m;\n\tvector<bool> flag(n);\n\tvector<int> cnt(n);\n\tint ac = 0, wa = 0;\n\tfor (int i = 0; i < m; ++i) {\n\t\tint p; cin >> p;\n\t\t--p;\n\t\tstring s; cin >> s;\n\t\tif (flag[p]) continue;\n\t\tif (s ==...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0 0"}, "input": {"kind": "stdin", "value": "6 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_79__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-00005-of-00128_80
Given are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \leq x \leq y \leq R) such that the remainder when y is divided by x is equal to y \mbox{ XOR } x. What is \mbox{ XOR }? The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows: * When A \mbox{ XOR } B is writte...
[{"code": "#include<bits/stdc++.h>\n\n#define ll long long\nusing namespace std; \nll f[64][2][2][2][2];ll l,r;ll ans1=0;int l1[64],r1[64];ll mod=1e9+7;\nll dfs(int pos,int tl,int tr,int ts,int th){\n\tif(pos<0) return 1;ll &ans=f[pos][tl][tr][ts][th];\n\tif(ans) return ans;\n\t\n\tfor(int i=0;i<=1;i++){\n\t\tfor(int j...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_80__public...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00005-of-00128_81
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. ...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint[] ant = new int[5];\n\t\tint dis = 0;\n\n\t\tfor(int i = 0; i < 5; i++) {\n\t\t\tant[i] = sc.nextInt();\n\t\t}\n\t\tdis = sc.nextInt();\n\n\t\tfor(int i = 0; i < 4...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00005-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "Yay!"}, "input": {"kind": "stdin", "value": "1\n2\n4\n8\n9\n15"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00005-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-00006-of-00128_0
Mike likes strings. He is also interested in algorithms. A few days ago he discovered for himself a very nice problem: You are given an AB-string S. You need to count the number of substrings of S, which have an equal number of 'A'-s and 'B'-s. Do you know how to solve it? Good. Mike will make the problem a little ...
[{"code": "def abcstr():\n s = raw_input()\n n = len(s)\n if n < 3:\n return 0\n \n A, B, C = ([0 for _ in xrange(n+1)] for _ in xrange(3))\n \n for i in xrange(1, n+1):\n ch = s[i-1]\n A[i] = A[i-1] + 1 if ch == 'A' else A[i-1]\n B[i] = B[i-1] + 1 if ch == 'B' else B[i-...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "2\n"}, "input": {"kind": "stdin", "value": "ABACABA"}, "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-00006-of-00128_1
Chef has a nice complete binary tree in his garden. Complete means that each node has exactly two sons, so the tree is infinite. Yesterday he had enumerated the nodes of the tree in such a way: Let's call the nodes' level a number of nodes that occur on the way to this node from the root, including this node. This wa...
[{"code": "import sys\n \n \ndef update_odd( direction , value ) :\n if direction == 'l' :\n value = (value * 2) \n else :\n value = (2 *value + 2) \n return value\n \ndef update_even(direction , value) :\n if direction == 'l' :\n value = (2*value - 1)\n else :\n value = (2*value...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "10\n14\n4\n13\n"}, "input": {"kind": "stdin", "value": "4\nlrl\nrll\nr\nlllr"}, "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-00006-of-00128_2
You have a string S consisting of N uppercase English letters. You are allowed to perform at most one operation of following kind: Choose any position in the string, remove the character at that position and insert it back to any other place in the string. Find the lexicographically smallest string you can achieve....
[{"code": "t = int(raw_input())\nfor i in range(t):\n\tn = int(raw_input())\n\ts = raw_input()\n\t\n\tif n == 1:\n\t\tprint s\n\t\tcontinue\n\t\n\ttmp = []\t\n\tfor j in range(n):\n\t\tfor k in range(n):\n\t\t\tx = list(s)\n\t\t\tx.insert(k, x.pop(j))\n\t\t\ttmp.append(x)\n\t\n\tprint ''.join(min(tmp))", "is_known_corr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "ADCB\nXYYZZZZ\n"}, "input": {"kind": "stdin", "value": "2\n4\nDCBA\n7\nXYZZYZZ"}, "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-00006-of-00128_5
Sereja has an undirected graph on N vertices. There are edges between all but M pairs of vertices. A permutation p on the vertices of the graph is represented as p[1], p[2], … , p[N] such that for all i, p[i] is a vertex of the graph. A permutation is called connected if there is an edge between vertices p[i] and p[i+...
[{"code": "import itertools\nMODULO=1000000007\nvisited = [0] * 100001\ncount_connected_components = 0\n#functions\ndef depth_first_traversal(graph, node, visited):\n\tstack = []\n\tvisited[node] = 1\n\tstack.extend(graph[node])\n\twhile len(stack) != 0:\n\t\tseed = stack.pop()\n\t\tif not visited[seed]:\n\t\t\tvisited...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "2\n0"}, "input": {"kind": "stdin", "value": "2\n4 3\n1 2\n2 3\n3 4\n2 1\n1 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-00006-of-00128_78
The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese. When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a pos...
[{"code": "n = input()\nprint('bon' if n[-1]=='3' else 'pon' if n[-1] in ['0','1','6','8'] else 'hon')\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "#include<bits/stdc++...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "pon"}, "input": {"kind": "stdin", "value": "16"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00006-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-00006-of-00128_79
Takahashi has a maze, which is a grid of H \times W squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column is a "wall" square if S_{ij} is `#`, and a "road" square if S_{ij} is `.`. From a road square, you can move to a horizontally or vertically adjacent ro...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int h,w;\n cin>>h>>w;\n vector<string> g(h);\n for(string &s: g) cin>>s; \n vector<int> dx={-1,0,0,1};\n vector<int> dy={0,1,-1,0};\n int ans=0;\n \n for(int i=0;i<h;i++){\n for(int j=0;j<w;j++){\n if(g[i][j]=='#') continue;\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "3 3\n...\n...\n..."}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00006-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-00006-of-00128_81
The restaurant AtCoder serves the following five dishes: * ABC Don (rice bowl): takes A minutes to serve. * ARC Curry: takes B minutes to serve. * AGC Pasta: takes C minutes to serve. * APC Ramen: takes D minutes to serve. * ATC Hanbagu (hamburger patty): takes E minutes to serve. Here, the time to serve a dish is ...
[{"code": "A = [-int(input()) for _ in range(5)]\nm = max(A, key = lambda x: x%10)\nprint(-(m-m//10*10+sum([a//10*10 for a in A])))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_81__ref__0000", "source": "benchmark"}, {"c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00006-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "643"}, "input": {"kind": "stdin", "value": "123\n123\n123\n123\n123"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-000...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00007-of-00128_1
Every great chef knows that lucky numbers are positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Our chef has recently returned from the Lucky country. He observed that every restaurant in the Lucky country had a luc...
[{"code": "import sys\nt = int(sys.stdin.readline())\nwhile t>0:\n\tn = int(sys.stdin.readline())\n\tcount = n/7\n\trem = n%7\n\tcount-=rem%4\n\tif count<0:\n\t\tprint -1\n\telse:\n\t\tprint count*7\t\n\tt-=1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_cont...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "7\n0\n7\n-1\n\n7\n"}, "input": {"kind": "stdin", "value": "5\n7\n4\n11\n1\n15"}, "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-00007-of-00128_2
Are you fond of collecting some kind of stuff? Mike is crazy about collecting stamps. He is an active member of Stamp Collecting Сommunity(SCC). SCC consists of N members which are fond of philately. A few days ago Mike argued with the others from SCC. Mike told them that all stamps of the members could be divided in...
[{"code": "n=int(int(raw_input()))\nc=map(int,raw_input().split())\ntotal=sum(c)\nx=(n*(n+1))/2\nif total==x:\n print 'YES'\nelse:\n print 'NO'", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_2__ref__0000", "source": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "YES\n"}, "input": {"kind": "stdin", "value": "5\n7 4 1 1 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00007-of-00128_5
Problem Statement Sereja has a sequence of n integers a[1], a[2], ..., a[n]. Sereja can do following transformation of the array:   create a new sequence of n integers b[1], b[2], ..., b[n]in this way: (1 ≤ i ≤ n) Replace the sequence a by b, i.e., a[i] = b[i] for all i in [1, n]   Sereja decided to use his trans...
[{"code": "#http://ruhinraihan.blogspot.in/2013/10/codechef-october-challenge-2013_7091.html\nMOD=1000000007\ndef Bigmod(base,power):\n\tret=1\n\twhile power>0:\n\t\tif power%2==1:\n\t\t\tret=(ret*base)%MOD\n\t\tbase=(base*base)%MOD\n\t\tpower>>=1\n\treturn ret\nt=int(raw_input())\nfor _ in range(0,t):\n\tn,m,q,k=map(i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "0\n2\n4"}, "input": {"kind": "stdin", "value": "3\n1 1 1 1\n2 2 1 1\n2 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-00007-of-00128_78
We have a string S consisting of lowercase English letters. If the length of S is at most K, print S without change. If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result. Constraints * K is an integer between 1 and 100 (inclusive). * S is a string ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main(){\n string s;\n long k;\n cin >> k;\n cin >> s;\n if (s.size() > k){\n s = s.substr(0,k)+\"...\";\n }\n cout << s << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_tr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "nikoand..."}, "input": {"kind": "stdin", "value": "7\nnikoandsolstice"}, "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-00007-of-00128_79
For a finite set of integers X, let f(X)=\max X - \min X. Given are N integers A_1,...,A_N. We will choose K of them and let S be the set of the integers chosen. If we distinguish elements with different indices even when their values are the same, there are {}_N C_K ways to make this choice. Find the sum of f(S) ove...
[{"code": "# include <bits/stdc++.h>\nusing namespace std;\n# define pb push_back\nconst int N = 100005;\n# define MOD 1000000007\ntypedef long long i64;\n\nint a[N];\ni64 A[N];\n\ni64 pow_mod(i64 a, i64 n, i64 mod){\n i64 ret=1, tmp=a%mod;\n while (n) {\n if (n&1) ret=ret*tmp%MOD;\n tmp=tmp*tmp%MOD...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "3 1\n1 1 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-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-00007-of-00128_81
In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)! There are five means of transport in this empire: * Train: travels from City 1 to 2 in one minute. A train can occupy at most A people. * Bus: travels from City 2 to 3 in one minute. A bus can occupy a...
[{"code": "#include <bits/stdc++.h>\n\nint main(){\n using namespace std;\n long N;\n cin >> N;\n vector<long> v(5);\n for(auto& i : v)cin >> i;\n cout << 5 + (N - 1) / *min_element(v.begin(), v.end()) << endl;\n return 0;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "5\n3\n2\n4\n3\n5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-001...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00007-of-00128_82
There is a train going from Station A to Station B that costs X yen (the currency of Japan). Also, there is a bus going from Station B to Station C that costs Y yen. Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then trav...
[{"code": "L = list(map(int,input().split()))\n\nprint(L[0]+L[1]//2)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_82__ref__0000", "source": "benchmark"}, {"code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "110"}, "input": {"kind": "stdin", "value": "81 58"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_82__pu...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00007-of-00128_86
Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her. Constraints * 1≦A,B≦10^9 * op is either `+` or `-`. Input The input is given from Standard Input in the following format: A op B Outpu...
[{"code": "a,b,c=input().split();print(int(a)+int(c)if b=='+'else int(a)-int(c))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_86__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\n\npublic class Main {\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "1 + 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_86__publ...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00007-of-00128_87
There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. Constraints * 1 \leq N, K \leq 10000 * 1 \leq ...
[{"code": "import java.util.Scanner;\n\nclass Main{\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn=new Scanner(System.in);\n\t\tint n=stdIn.nextInt(),k=stdIn.nextInt(),x=stdIn.nextInt(),y=stdIn.nextInt(),s=0,i;\n\t\tfor(i=0;i<n&&i<k;i++) s+=x;\n\t\tfor(i=k;i<n;i++) s+=y;\n\t\tSystem.out.print(s);\n\t}\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00007-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "20000"}, "input": {"kind": "stdin", "value": "2\n3\n10000\n9000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00007-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-00008-of-00128_1
Chef's team is going to participate at the legendary math battles. One of the main task in the competition is to calculate the number of ways to create a number by adding some Chefonacci numbers. A number is called a Chefonacci number if it is an element of Chefonacci sequence defined as follows. f(0) = 1; f(1) = 2;...
[{"code": "ans=0\nfound=set()\ndef numberofways(fib,x,k,curr,idx,high):\n\tglobal ans\n\tif ( x!=0 and curr>=k ) or x<0 or x>(high*(k-curr)):\n\t\t# print 'Discarded'\n\t\treturn 0\n\tif x==0 and curr==k:\n\t\tans+=1\n\t\t# print 'New Way'\n\t\treturn 1\t\n\tfor i in xrange(0,49):\n\t\tif fib[i]>x or fib[i]>high:\n\t\t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "0\n1\n1\n2\n4"}, "input": {"kind": "stdin", "value": "5\n12 1\n13 1\n13 2\n13 3\n13 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-00008-of-00128_2
You are given a multiset of N integers. Please find such a nonempty subset of it that the sum of the subset's elements is divisible by N. Otherwise, state that this subset doesn't exist. Input The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows....
[{"code": "import fileinput\nimport itertools\nimport sys\nimport random\n\n''' http://www.codechef.com/problems/DIVSUBS '''\n\ndef single_test_dumb(nums):\n\tnums = [(index, int(x)) for index,x in enumerate(fi.readline().strip().split(\" \"))]\n\n\tfor i in range(1, len(nums)+1):\n\t\tfor pairs in itertools.combinatio...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2"}, "input": {"kind": "stdin", "value": "1\n3\n4 6 10"}, "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-00008-of-00128_5
Sereja has a string A consisting of n lower case English letters. Sereja calls two strings X and Y each of length n similar if they can be made equal by applying the following operation at most once in each of them. Chose any two position i, j in the string (i can be equal to j too). Swap the characters at position ...
[{"code": "from collections import Counter\n\n# compute factorials and inverse factorials\nmod = 10**9 + 7\nN = 10**5 + 11\nfac = [1]*N\nifc = [1]*N\nfor i in xrange(2,N):\n ifc[i] = (mod - mod/i) * ifc[mod%i] % mod\n\nfor i in xrange(2,N):\n fac[i] = fac[i-1] * i % mod\n ifc[i] = ifc[i-1] * ifc[i] % mod\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "0\n144"}, "input": {"kind": "stdin", "value": "2\nz\nabcd"}, "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-00008-of-00128_77
In the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters. In Taknese, the plural form of a noun is spelled based on the following rules: * If a noun's singular form does not end with `s`, append `s` to the end of the singular form. * If a noun's singular form ends with `s`...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \t\n // 入力\n String s = sc.next();\n \tint l=s.length();\n \t\n if(s.charAt(l-1)=='s'){\n \tSystem.out.println(s+\"es\");\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "boxs"}, "input": {"kind": "stdin", "value": "box"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_77__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-00008-of-00128_78
Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std; \n \nint main(){\n int A,B,H,M;\n cin >> A >> B >> H >> M;\n double C=acos(-1)*(60*H+M)/360-acos(-1)*M/30;\n double ans=sqrt(A*A+B*B-2*A*B*cos(C));\n cout << fixed << setprecision(15) << ans << endl;\n}\n ", "is_known_correct": true, "language": "cpp", ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "5.00000000000000000000"}, "input": {"kind": "stdin", "value": "3 4 9 0"}, "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-00008-of-00128_79
Given are N points (x_i, y_i) in a two-dimensional plane. Find the minimum radius of a circle such that all the points are inside or on it. Constraints * 2 \leq N \leq 50 * 0 \leq x_i \leq 1000 * 0 \leq y_i \leq 1000 * The given N points are all different. * The values in input are all integers. Input Input is giv...
[{"code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "0.707106781186497524"}, "input": {"kind": "stdin", "value": "3\n0 0\n0 1\n1 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.r...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00008-of-00128_81
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows: * The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X. * The deliciousn...
[{"code": "from heapq import nlargest\nx,y,z,k=map(int,input().split())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\nab=nlargest(k,(x+y for x in a for y in b))\nabc=nlargest(k,(xy+z for xy in ab for z in c))\nfor i in abc:\n print(i)", "is_known_correct": true,...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "19\n17\n15\n14\n13\n12\n10\n8"}, "input": {"kind": "stdin", "value": "2 2 2 8\n4 6\n1 5\n3 8"}, "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-00008-of-00128_82
In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures. City i is established in year Y_i and belongs to Prefecture P_i. You can assume that there are no multiple cities that are established in the same year. It is decided to allocate a 12-digit ID number to each ci...
[{"code": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public static void main (String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int N = Integer.parseInt(sc.next());\n int M = Integer.parseInt(sc.next());\n int[][] p = new int[M][3];\n\n for (int i = 0; i < M; i++) {\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "000001000002\n000002000001\n000001000001"}, "input": {"kind": "stdin", "value": "2 3\n1 32\n2 63\n1 12"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__te...
{"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-00008-of-00128_83
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ...
[{"code": "s = input().count('o')\nprint(700 + s*100)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "import java.io.IOException;\nimport java.util.Scanner;\n\npublic class ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "900"}, "input": {"kind": "stdin", "value": "oxo"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_83__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-00008-of-00128_86
Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main()\n{\n int n,m,b=0;\n cin>>n;\n int t[n];\n for(int i=0;i<n;i++) {cin>>t[i]; b+=t[i];}\n cin>>m;\n int p[m],x[m];\n for(int i=0;i<m;i++) {cin>>p[i]>>x[i]; cout<<b-t[p[i]-1]+x[i]<<endl;}\n return 0;\n}\n", "is_known_correct": true,...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "6\n9"}, "input": {"kind": "stdin", "value": "3\n2 1 4\n2\n1 1\n2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0000...
{"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-00008-of-00128_87
Let w be a string consisting of lowercase letters. We will call w beautiful if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. Constraints * 1 \leq |w| \leq 100 * w consists of lowercas...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n string w; cin >> w;\n int r = 0;\n for (char c : w) r ^= c;\n cout << (r ? \"No\" : \"Yes\") << endl;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00008-of...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "abaccaba"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00008-of-00128_87_...
{"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-00009-of-00128_0
Akhil has many balls of white and black colors. One day, he was playing with them. During the play, he arranged the balls into two rows both consisting of N number of balls. These two rows of balls are given to you in the form of strings X, Y. Both these string consist of 'W' and 'B', where 'W' denotes a white colored ...
[{"code": "testCases = input()\nfor j in range(testCases):\n x = raw_input()\n y = raw_input()\n N = len(x)\n result= ''\n for i in range(N):\n if x[i]==y[i]:\n if x[i] == 'W':\n result=result + 'B'\n else:\n result=result + 'W'\n else:\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "BWBW\n"}, "input": {"kind": "stdin", "value": "1\nWBWB\nWBBB"}, "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-00009-of-00128_1
Chef is stuck in a two dimensional maze having N rows and M columns. He needs to get out of the maze as soon as possible and arrive at the kitchen in order to serve his hungry customers. But, he can get out of the maze only if he is able to successfully find any magical path in the given maze. A path is defined as ma...
[{"code": "val=raw_input()\nt=int(val)\nfor i in range(t):\n\tlens=list()\n\tstri=raw_input()\n\tlens=stri.split()\n\tn=int(lens[0])\n\tm=int(lens[1])\n\tif n%2==0 and m%2==1 and m!=1:\n\t\tprint 'Yes'\n\telif m%2==0 and n%2==1 and n!=1:\n\t\tprint 'Yes'\n\telif n%2==0 and m%2==0:\n\t\tprint 'Yes'\n\telif n%2==1 and m%...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\n"}, "input": {"kind": "stdin", "value": "1\n2 2"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00009-of-00128_5
Sereja conducted a voting about N of his opinions. Ai percent of people voted for opinion number i. This statistics is called valid if sum of all Ai is equal to 100. Now let us define rounding up of a statistics A. If Ai is not an integer, it will be rounded up to next integer. Otherwise it will be left as it is...
[{"code": "from pprint import pprint as pp\ndef GI(): return int(raw_input())\ndef GIS(): return map(int, raw_input().split())\n\ndef main():\n T = GI()\n for t in xrange(T):\n N = GI()\n B = GIS()\n excess = sum(B) - 100\n if excess < 0:\n print 'NO'\n elif excess < ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "NO\nYES\nYES\n"}, "input": {"kind": "stdin", "value": "3\n3\n30 30 30\n4\n25 25 25 25\n2\n50 51"}, "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-00009-of-00128_77
Tak performed the following action N times: rolling two dice. The result of the i-th roll is D_{i,1} and D_{i,2}. Check if doublets occurred at least three times in a row. Specifically, check if there exists at lease one i such that D_{i,1}=D_{i,2}, D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold. Constraints * 3 \...
[{"code": "n=int(input())\nans=0\nflg=0\naa=\"No\"\nfor _ in range(n):\n a,b=map(int,input().split())\n if a==b:\n ans+=1\n else:\n ans=0\n if ans==3:\n aa=\"Yes\"\nprint(aa)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_conte...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "5\n1 2\n6 6\n4 4\n3 3\n3 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-00009-of-00128_78
There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th...
[{"code": "from collections import deque\nN,M=map(int,input().split())\nG=[ [] for _ in range(N) ]\nfor i in range(M):\n A,B=map(int,input().split())\n A-=1\n B-=1\n G[A].append(B)\n G[B].append(A)\n\nsearched=[0]*N\nsearched[0]=1\nans=[-1]*N\nd=deque()\nd.append(0)\nwhile(len(d)!=0):\n tmp=d.popleft()\n for g i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\n6\n5\n5\n1\n1"}, "input": {"kind": "stdin", "value": "6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontest...
{"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-00009-of-00128_82
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from the top of a vertical l...
[{"code": "H,W,K = map(int,input().split())\ndp = []\nfor i in range(H+1):\n L = [0]*W\n dp.append(L)\nfb = [1,1]\nfor i in range(W-2):\n fb.append(fb[i]+fb[i+1])\ndp[0][0] = 1\nif W != 1:\n for i in range(1,H+1):\n for j in range(W):\n if 1 <= j <= W-2:\n dp[i][j] = dp[i-1][j-1]*fb[j-1]*fb[W-j-1]+dp...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "2 3 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_82__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-00009-of-00128_83
Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o...
[{"code": "N,X = map(int, input().split())\nM = [int(input()) for _ in range(N)]\n\nX = X - sum(M)\n\nprint(N + X//min(M))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "N,...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "3 1000\n120\n100\n140"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00009-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-00009-of-00128_85
AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this integer...
[{"code": "#include <iostream>\nusing namespace std;\nint main(){\n int r,g,b;\n cin>>r>>g>>b;\n int a=10*g+b;\n if(0==a%4){\n cout<<\"YES\";\n }else{\n cout<<\"NO\";\n }\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00009-o...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "YES"}, "input": {"kind": "stdin", "value": "4 3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_85__pu...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00009-of-00128_86
There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu...
[{"code": "#include<cstdio>\n\nusing namespace std;\n\ntypedef long long ll;\n\n#define MOD 1000000007\n#define rep(i, n) for(int i = 0; i < n; i++)\n\nint n, a[100000];\nint c[100000];\n\nll mod_pow(ll x, int n){\n\tif(n == 0) return 1;\n\treturn x * mod_pow(x, n - 1) % MOD;\n}\n\nll solve(){\n\trep(i, n){\n\t\tif(!(n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00009-of-00128_86__public__0000", "expected_output": {"kind": "stdout", "value": "16"}, "input": {"kind": "stdin", "value": "8\n7 5 1 1 7 3 5 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00009-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-00010-of-00128_1
Rupsa recently started to intern under Chef. He gave her N type of ingredients of varying quantity A1, A2, ..., AN respectively to store it. But as she is lazy to arrange them she puts them all in a storage box. Chef comes up with a new recipe and decides to prepare it. He asks Rupsa to get two units of each type ingr...
[{"code": "_ = int(raw_input())\nfor __ in range(_):\n N = int(raw_input())\n arr = map(int,raw_input().split())\n ans = 0\n mx = 10**4 + 10\n for num in arr :\n if num < 2:\n ans = -1\n break\n ans = ans + num\n if num < mx:\n mx = num\n if ans !=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "4\n2\n"}, "input": {"kind": "stdin", "value": "2\n2\n2 2\n1\n6"}, "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-00010-of-00128_2
There is new delicious item in Chef's menu - a doughnut chain. Doughnuts connected successively in line forming a chain. Chain of 3 doughnuts Chef has received an urgent order for making a chain of N doughnuts. He noticed that there are exactly N cooked doughnuts in the kitchen, some of which are already connected i...
[{"code": "for t in xrange(input()):\n n, m = map(int, raw_input().strip().split())\n arr = map(int, raw_input().strip().split())\n arr.sort()\n cuts = 0\n for i in xrange(m):\n k = m - i - cuts - 1\n if k <= arr[i]:\n ans = cuts + k\n break\n cuts += arr[i] ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "2\n1\n"}, "input": {"kind": "stdin", "value": "2\n11 3\n4 3 4\n6 3\n3 2 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-00010-of-00128_77
Given is a positive integer N. How many tuples (A,B,C) of positive integers satisfy A \times B + C = N? Constraints * 2 \leq N \leq 10^6 * All values in input are integers. Input Input is given from Standard Input in the following format: N Output Print the answer. Examples Input 3 Output 3 Input 100 ...
[{"code": "N = int(input())\nans = 0\nfor i in range(1, N):\n ans += (N - 1) // i\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "#include<iostream>\nusing na...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_77__public__...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00010-of-00128_78
We have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively. We will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time. The i-th and j-th sardines (i \neq j) are on bad terms if and o...
[{"code": "import java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n static Input in = new Input(System.in);\n static PrintWriter out = new PrintWriter(System.out);\n\n public static void main(String[] args) {\n int N = in.nextInt();\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "3\n1 2\n-1 1\n2 -1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00010-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-00010-of-00128_83
"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr...
[{"code": "a, b, c, x, y = map(int, input().split())\nprint(min(a*x+b*y, c*2*max(x,y), c*2*min(x,y)+abs(x-y)*(a if x>y else b)))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_83__ref__0000", "source": "benchmark"}, {"code...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "7900"}, "input": {"kind": "stdin", "value": "1500 2000 1600 3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00010-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-00010-of-00128_85
It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can start and ...
[{"code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String args[]){\n\t\tScanner cin = new Scanner(System.in);\n\n\t\tint A = cin.nextInt();\n\t\tint list[] = new int[A];\n\t\tint tmp;\n\t\tfor(int i=0;i<A;i++){\n\t\t\tlist[i] = cin.nextInt();\n\t\t}\n\n\t\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "4\n2 3 7 9"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00010-of-00128_85_...
{"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-00011-of-00128_1
Chef loves to play games. Now he plays very interesting game called "Segment". At the beginning Chef has segment [0, X] and no points on it. On each step Chef chooses the subsegment of maximal length possible such as it contains no points on it. If there are more than one such subsegment Chef chooses the one with the m...
[{"code": "import math;\nt=int(input());\nwhile t>0:\n\tt=t-1;\n\tinp=raw_input();\n\tx=int(inp.split()[0]);\n\tk=int(inp.split()[1]);\n\troun=int(math.log(k,2))+1;\n\tdeno=pow(2,roun-1);\n\tpoints=0;\n\tif roun==1:\n\t\tpoints=0;\n\telse:\n\t\tpoints=pow(2,roun-1)-1;\n\tpos=k-points;\n\tprint format(((x*1.0)/(deno*1.0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "5.0000000000000000\n2.5000000000000000\n7.5000000000000000\n177375316.6198730468750000\n"}, "input": {"kind": "stdin", "value": "4\n10 1\n10 2\n10 3\n1000000000 1234567"}, "meta...
{"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-00011-of-00128_3
Johnny needs to make a rectangular box for his physics class project. He has bought P cm of wire and S cm^2 of special paper. He would like to use all the wire (for the 12 edges) and paper (for the 6 sides) to make the box. What is the largest volume of the box that Johnny can make? Input The first line contains t, th...
[{"code": "#!/usr/bin/python\nimport math\n\n\ndef main():\n num_times = int(raw_input())\n for i in xrange(0, num_times):\n P, S = map(int, raw_input().split())\n l1 = ((P/2) + math.sqrt(math.pow(P/2, 2) - 6*S))/6\n l2 = ((P/2) - math.sqrt(math.pow(P/2, 2) - 6*S))/6\n h1 = P/4 - 2*l1\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "3.00\n4.15\n"}, "input": {"kind": "stdin", "value": "2\n20 14\n20 16"}, "metadata": {}, "visibility": "public"}]
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00011-of-00128_77
There are N cells arranged in a row, numbered 1, 2, \ldots, N from left to right. Tak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below. You are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2...
[{"code": "import sys\ninput = sys.stdin.readline\n\nN,K=map(int,input().split())\nK=[tuple(map(int,input().split())) for i in range(K)]\nmod=998244353\n\nDP=[0]*(4*10**5+100)\nDP[1]=1\nDP[2]=-1\n\nfor i in range(1,N+1):\n DP[i]+=DP[i-1]\n DP[i]%=mod\n \n for l,r in K:\n DP[i+l]+=DP[i]\n DP[i+...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "5 2\n3 3\n5 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00011-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-00011-of-00128_78
There is a grass field that stretches infinitely. In this field, there is a negligibly small cow. Let (x, y) denote the point that is x\ \mathrm{cm} south and y\ \mathrm{cm} east of the point where the cow stands now. The cow itself is standing at (0, 0). There are also N north-south lines and M east-west lines drawn...
[{"code": "#include<iostream>\n#include<algorithm>\n#include<vector>\n#include<queue>\nusing namespace std;\nint N,M;\nint A[1000],B[1000],C[1000];\nint D[1000],E[1000],F[1000];\nbool vis[3010][3010];\nvector<pair<int,int> >WX[3010],WY[3010];\nbool wx[3010][3010],wy[3010][3010];\nint main()\n{\n\tcin>>N>>M;\n\tvector<l...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "INF"}, "input": {"kind": "stdin", "value": "6 1\n-3 -1 -2\n-3 -1 1\n-2 -1 2\n1 4 -2\n1 4 -1\n1 4 1\n3 1 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests_...
{"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-00011-of-00128_85
In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : orange * Rating 280...
[{"code": "n,a=open(0)\ns=set();x=0\nfor i in map(int,a.split()):\n\tj=i//400\n\tif j<8:s.add(j)\n\telse:x+=1\nprint(max(1,len(s)),len(s)+x)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_85__ref__0000", "source": "benchma...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "2 2"}, "input": {"kind": "stdin", "value": "4\n2100 2500 2700 2700"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0001...
{"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-00011-of-00128_87
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i. Tak the traveler has the following two personal principles: * He never travels a distance of more than L in a single day. * He never sleeps in the open. That is, he must stay at a hotel at the end of a day. You are ...
[{"code": "#include<cstdio>\n#include<cstring>\n#include<algorithm>\nusing namespace std;\nconst int MAXN=100005;\n\nint N,L,Q;\nint x[MAXN],nxt[MAXN][25];\nint ans[MAXN];\n//int dis[MAXN];\n\nint main()\n{\n\tscanf(\"%d\",&N);\n\tfor(int i=1;i<=N;i++)\n\t\tscanf(\"%d\",&x[i]);\n\tscanf(\"%d%d\",&L,&Q);\n\tmemset(nxt,0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00011-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "4\n2\n1\n2"}, "input": {"kind": "stdin", "value": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 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
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00012-of-00128_1
Today, Chef woke up to find that he had no clean socks. Doing laundry is such a turn-off for Chef, that in such a situation, he always buys new socks instead of cleaning the old dirty ones. He arrived at the fashion store with money rupees in his pocket and started looking for socks. Everything looked good, but then Ch...
[{"code": "jacketCost, sockCost, money = map(int,raw_input().split())\nif((money-jacketCost)//sockCost)%2==0:\n print('Lucky Chef')\nelse:\n print('Unlucky Chef')", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_1__ref...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "Unlucky Chef\n"}, "input": {"kind": "stdin", "value": "1 2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00012-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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00012-of-00128_2
The palindrome is a string that can be read the same way from left to right and from right to left. For example, strings "aaaaa", "1221", "bbaabb" are palindromes, however the string "chef" is not a palindrome because if we read it from right to left, we will obtain "fehc" that is not the same as "chef". We call a str...
[{"code": "T = int(raw_input())\n\nfor i in range(T):\n N = int(raw_input())\n if N%2 == 0:\n print N\n else:\n print N-1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_2__ref__0000", "source": "benc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "2\n4\n"}, "input": {"kind": "stdin", "value": "2\n2\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-00012-of-00128_5
All bandits are afraid of Sheriff. Sheriff constantly fights crime, but when bandits lay low, he gets bored and starts to entertain himself. This time Sheriff gathered all the bandits in his garden and ordered them to line up. After the whistle all bandits should change the order in which they stand. Sheriff gave all...
[{"code": "def gcd(a, b):\n\t\"\"\"\n\tCompute the GCD of 2 numbers.\n\t\"\"\"\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef _lcm(a, b):\n\t\"\"\"\n\tCompute the LCM of 2 numbers.\n\t\"\"\"\n\treturn (a * b) / gcd(a, b)\n\ndef lcm(*args):\n\t\"\"\"\n\tCompute the LCM of arbitrary amount of numbers.\n\t\"\"\"\n\tr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "1\n6\n"}, "input": {"kind": "stdin", "value": "2\n3\n1 2 3\n5\n2 3 1 5 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-00012-of-00128_77
Let us denote by f(x, m) the remainder of the Euclidean division of x by m. Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}. Constraints * 1 \leq N \leq 10^{10} * 0 \leq X < M \leq 10^5 * All values in input are ...
[{"code": "n,x,m=map(int,input().split())\n\nyj=[x]\nlps=0\nfor i in range(n):\n an=(yj[i]**2)%m\n if an in yj:\n lps=yj.index(an)\n break\n yj.append(an)\n\nblp=yj[:lps]\nlp=yj[lps:]\nans=sum(blp)+sum(lp)*((n-len(blp))//len(lp))+sum(lp[:(n-len(blp))%len(lp)])\nprint(ans)\n", "is_known_correct": true, "languag...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "492443256176507"}, "input": {"kind": "stdin", "value": "10000000000 10 99959"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00012-of-00128_78
Takahashi wants to be a member of some web service. He tried to register himself with the ID S, which turned out to be already used by another user. Thus, he decides to register using a string obtained by appending one character at the end of S as his ID. He is now trying to register with the ID T. Determine whether...
[{"code": "s = input()\nt = input()\n\nprint('Yes') if t[:-1] == s else print('No')", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "#include <bits/stdc++.h>\nusing namespace...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "snuke\nsnekee"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00012-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-00012-of-00128_80
There are 2000001 stones placed on a number line. The coordinates of these stones are -1000000, -999999, -999998, \ldots, 999999, 1000000. Among them, some K consecutive stones are painted black, and the others are painted white. Additionally, we know that the stone at coordinate X is painted black. Print all coordi...
[{"code": "K, X = map(int, input().split())\nans = list(range(X-K+1,X+K,1))\nprint(*ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "\nimport java.util.Scanner;\n\npubli...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "-3 -2 -1 0 1 2 3"}, "input": {"kind": "stdin", "value": "4 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00012-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-00012-of-00128_83
In "Takahashi-ya", a ramen restaurant, basically they have one menu: "ramen", but N kinds of toppings are also offered. When a customer orders a bowl of ramen, for each kind of topping, he/she can choose whether to put it on top of his/her ramen or not. There is no limit on the number of toppings, and it is allowed to ...
[{"code": "#include<cstdio>\n#include<cstring>\n#include<cmath>\n#include<cstdlib>\n#include<algorithm>\nusing namespace std;\nconst int N=3005;\ntypedef long long ll;\n\nint power_mod(int a,int b,ll mod) \n{\n\tint ans=1;\n\twhile (b) \n\t{\n\t\tif (b&1) ans=(ll)ans*a%mod;\n\t\tb>>=1;\n\t\ta=(ll)a*a%mod;\n\t}\n\tretur...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "118"}, "input": {"kind": "stdin", "value": "3 1000000009"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00012-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-00012-of-00128_85
You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a correct bracket sequence. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of `(`, X ...
[{"code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n String S = sc.next();\n String ans = \"\";\n int d = 0;\n for (int i = 0; i < N; i++) {\n if (S.charAt(i) == '(') {\n ans = ans...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "(((())))(((())))"}, "input": {"kind": "stdin", "value": "8\n))))(((("}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00012-of-00128_87
Let x be a string of length at least 1. We will call x a good string, if for any string y and any integer k (k \geq 2), the string obtained by concatenating k copies of y is different from x. For example, `a`, `bbc` and `cdcdc` are good strings, while `aa`, `bbbb` and `cdcdcd` are not. Let w be a string of length at l...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint A[2][500005];\nstring S[2];\nvoid Z(int x){\n\tA[x][0] = S[x].size();\n\tint i=1,j=0;\n\twhile(i<S[x].size()){\n\t\twhile(i+j<S[x].size() && S[x][j]==S[x][i+j])j++;\n\t\tA[x][i]=j;\n\t\tif(j==0){\n\t\t\ti++; continue;\n\t\t}\n\t\tint k = 1;\n\t\twhile(i+k<S...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_87__public__0000", "expected_output": {"kind": "stdout", "value": "3\n1"}, "input": {"kind": "stdin", "value": "ddd"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00012-of-00128_87__pub...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null
codecontests__test__code_contests_train.riegeli-00013-of-00128_0
Yesterday Chef had a great party and doesn't remember the way he celebreated it. But he found a strange paper in his kitchen containing n digits (lets give them indices from 1 to n and name them a1, a2 ... aN). Chef remembers that he played such game: On each step he choose an index x from 1 to n. For all indices ...
[{"code": "[n, m] = [int(x) for x in raw_input().split(\" \")]\na = raw_input().rstrip()\ndigits = [int(x) for x in a]\n\nL = len(a)\n# construct\np = [[0]*L for _ in range(10)]\nfor i, x in enumerate(digits):\n p[x][i] = 1\nfor i in range(1, L):\n for j in range(10):\n p[j][i] += p[j][i-1]\n\nfor _ in ran...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "0\n7\n9\n"}, "input": {"kind": "stdin", "value": "10 3\n0324152397\n1\n4\n7"}, "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-00013-of-00128_1
One day, Chef prepared D brand new dishes. He named the i-th dish by a string Si. After the cooking, he decided to categorize each of these D dishes as special or not. A dish Si is called special if it's name (i.e. the string Si) can be represented in the form of a double string by removing at most one (possibly zero...
[{"code": "def is_subseq(x, y):\n i = 0\n for c in x:\n while i < len(y) and y[i] != c: i += 1\n if i == len(y): return False\n i += 1\n return True\n\nfor cas in xrange(input()):\n a = raw_input()\n n = len(a)\n print 'YES' if n > 1 and (is_subseq(a[:n/2], a[n/2:]) or is_subseq(a...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nNO\nNO\n"}, "input": {"kind": "stdin", "value": "3\naba\nabac\nabcd"}, "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-00013-of-00128_5
Chef has decided to arrange the free shuttle service for his employees. City of Bhiwani has a strange layout - all of its N shuttle boarding points are arranged in a circle, numbered from 1 to N in clockwise direction. Chef's restaurant is at boarding point number 1. There is a single ring road that runs over the circu...
[{"code": "def init_primes(n):\n primes = []\n is_prime = [True] * n\n is_prime[0] = False\n is_prime[1] = False\n for i in xrange(2, n):\n if not is_prime[i]:\n continue\n for j in xrange(i * i, n, i):\n is_prime[j] = False\n\n primes = [i for i in xrange(n) if is_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2\n2"}, "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-00013-of-00128_77
There is a grid with N rows and N columns of squares. Let (i, j) be the square at the i-th row from the top and the j-th column from the left. Each of the central (N-2) \times (N-2) squares in the grid has a black stone on it. Each of the 2N - 1 squares on the bottom side and the right side has a white stone on it. Q...
[{"code": "class SegTree():\n def __init__(self, initial, operation, identity):\n n = len(initial)\n self.initial = initial\n self.operation = operation\n self.identity = identity\n self.num = 1 << (len(bin(n - 1)) - 2)\n self.tree = [identity] * (2 * self.num - 1)\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "5 5\n1 3\n2 3\n1 4\n2 2\n1 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-00013-of-00128_78
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen? Constraints * All values in input are integers. * 0 \leq A, B, C * 1 \leq K \l...
[{"code": "#include<iostream>\nusing namespace std;\nint main(){\n\tlong long a,b,c,d;\n\tcin>>a>>b>>c>>d;\n\tcout<<max(0LL,min(a,d))-max(0LL,d-b-a);\n\treturn 0;\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_78__ref__0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00013-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "2000000000"}, "input": {"kind": "stdin", "value": "2000000000 0 0 2000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri...
{"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null}
CodeContests
ATCODER
[""]
null