problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03665
u114641312
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['# from math import factorial,sqrt,ceil,gcd\n# from itertools import permutations as permus\n# from collections import deque,Counter\n# import re\n\n# from decimal import Decimal, getcontext\n\n# # eps = Decimal(10) ** (-100)\n\nimport numpy as np\n# import networkx as nx\n# from scipy.sparse.csgraph import shortest_p...
['Wrong Answer', 'Accepted']
['s738966284', 's158868473']
[12384.0, 13212.0]
[156.0, 163.0]
[1175, 1248]
p03665
u129836004
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\nAs = list(map(int, input().split()))\neven = 0\nodd = 0\nfor a in As:\n if a % 2 == 0:\n even += 1\n else:\n odd += 1\nprint(even)\nprint(odd)\nE = 2**even\nif P == 0:\n O = 1\n o = 1\n for i in range(2, odd+1, 2):\n o = int(o*(odd+1-i)*(odd+2-i)/i...
['Wrong Answer', 'Accepted']
['s984727866', 's027373790']
[3064.0, 3064.0]
[17.0, 17.0]
[460, 438]
p03665
u131634965
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int, input().split())\na=list(map(int, input().split()))\ntotal=sum( n%2 for i in a )\n\nif total==0:\n if p==0:\n print(2**n)\n else:\n print(0)\nelse:\n print(2**(n-1))', 'n,p=map(int, input().split())\na=list(map(int, input().split()))\ntotal=sum( n%2 for i in a )\n\nif total=0:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s800349748', 's925335821', 's616909116']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[191, 190, 191]
p03665
u153147777
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import scipy.misc as scm\n\n\nN, P = map(int, input().split())\nA = [int(s) % 2 == 0 for s in input().split()]\n\nevens = len(list(filter(lambda x: x == True, A)))\nodds = len(A) - evens\n\nif P == 0:\n evens_x = pow(2, evens)\n odds_x = 0\n \n for i in range(0, odds + 1, 2):\n odds_x += scm.comb(odds...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s181780754', 's587439882', 's651154516']
[16828.0, 26120.0, 3064.0]
[1134.0, 373.0, 19.0]
[470, 548, 337]
p03665
u183840468
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p = [int(i) for i in input().split()]\n\nif p % 2 == 0:\n print(2**p)\nelse:\n print(2**(p-1))', 'n,p = [int(i) for i in input().split()]\n \nif p % 2 == 0:\n print(2**n)\nelse:\n print(2**(n-1))', 'a,b = [int(i) for i in input().split()]\n\nl = [int(i) for i in input().split()]\n\nl2 = [i for i in l if i %2 ==...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s008159925', 's632523878', 's611270723']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[93, 94, 188]
p03665
u226191225
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['nCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\nn,p = map(int,input().split())\nx = [int(i) for i in input().split()]\nodd = 0\nans = 0\nans_tmp = 0\nfor i in x:\n if i%2...
['Wrong Answer', 'Accepted']
['s171558381', 's849907786']
[3064.0, 3064.0]
[18.0, 18.0]
[577, 588]
p03665
u227082700
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]\nfor i in a:b[i%2]+=1\nprint(2**b[p]-p)', 'n,p=map(int,input().split())\na=list(map(int,input().split()))\nfor i in range(n):a[i]%=2\no=a.count(1)\nz=n-o\nif o==0:\n if p==0:print(2**z)\n else:print(0)\nelse:\n print(2**(n-1))']
['Wrong Answer', 'Accepted']
['s761244682', 's061800089']
[2940.0, 3060.0]
[17.0, 17.0]
[107, 177]
p03665
u228223940
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import scipy.misc\nn,p = map(int,input().split())\nai = [int(i)%2 for i in input().split()]\n\nzero = ai.count(0)\none = ai.count(1)\n\n\ntmp = 2**zero\nans = 0\nfor i in range(one//2+1):\n if p == 0:\n if i*2 > one:\n break\n ans += scipy.misc.comb(one,0+i*2)\n else:\n if i*2+1 ...
['Wrong Answer', 'Accepted']
['s835766621', 's687100219']
[14556.0, 3064.0]
[185.0, 18.0]
[388, 629]
p03665
u241159583
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from math import factorial\nn,p = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef combinations_count(n,r):\n return factorial(n) // (factorial(n-r) * factorial(r))\n\neven = 0\nnot_even = 0\nfor a in A:\n if a % 2 == 0: even += 1\n else: not_even += 1\nprint(even, not_even)\nans = 0\nif...
['Wrong Answer', 'Accepted']
['s304022430', 's862107561']
[3064.0, 42104.0]
[17.0, 179.0]
[763, 489]
p03665
u252828980
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\na,b = map(int,input().split())\nL = list(map(int,input().split()))\nLe = [x for x in L if x%2 == 0]\nLo = [x for x in L if x%2 == 1]\n#print(Le,Lo)\ndef nCr(n,r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n \nif b == 0:\n ev = 0\n od = 1\n while ev <= len(Le)//2:\...
['Runtime Error', 'Accepted']
['s329674292', 's131528442']
[3064.0, 3064.0]
[17.0, 17.0]
[619, 299]
p03665
u309141201
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\neven = 0\nodd = 0\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(N):\n if A[i] % 2 == 0:\n even += 1\n else:\n odd += 1\n\noddcmb = 0\nif P == 0:\n ...
['Wrong Answer', 'Accepted']
['s230282599', 's640798710']
[3064.0, 3064.0]
[18.0, 18.0]
[552, 556]
p03665
u321035578
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n, p = map(int, input().split())\na = list(map(int,input().split()))\n\nodd = []\neven = []\nfor i, aa in enumerate(a):\n if aa % 2 == 0:\n even.append(aa)\n else:\n odd.append(aa)\ne = len(even)\no = len(odd)\nans = 2 ** e\nod_list = [0]\nbunsi = 1\nbunbo = 1\n\nfor i in range(1,o):\n bunsi *=...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s333473370', 's707426684', 's003839388']
[3064.0, 3064.0, 3064.0]
[17.0, 20.0, 18.0]
[483, 3178, 3129]
p03665
u325956328
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from scipy.special import comb\nimport numpy as np\n\nN, P = map(int, input().split())\nA = np.array(list(map(int, input().split())))\n\nA = A % 2 != 0\nodd = np.sum(A)\neven = N - odd\nprint(A, odd, even)\n\nans = 0\nodd_num = 0\neven_num = 0\nif P == 1:\n for i in range(1, odd + 1, 2):\n odd_num += comb(o...
['Wrong Answer', 'Accepted']
['s500797932', 's127360020']
[42468.0, 42524.0]
[183.0, 181.0]
[562, 564]
p03665
u329865314
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['tmp = list(map(int,input().split()))\nAs = list(map(int,input().split()))\nn,p = tmp[0],tmp[1]\no ,e = 0,0\nfor i in range(n):\n if As[i] % 2:\n o += 1\n else:\n e += 1\ndef comb(j,k):\n if k == 1:\n return(j)\n else:\n return comb(j-1,k-1) * j / k\nans = 0\nif p == 0:\n for i in range(o+1):\n if...
['Runtime Error', 'Accepted']
['s976289640', 's486426786']
[3988.0, 3188.0]
[75.0, 19.0]
[438, 438]
p03665
u340010271
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P=map(int,input().split())\na=list(map(int,input().split()))\na=list(map(lambda x:x%2,a))\nif 1 in a:\n print(2**N)\nelse:\n if P%2==0:\n print(2**(N-1))\n else:\n print(0)', 'N,P=map(int,input().split())\na=list(map(int,input().split()))\na=list(map(lambda x:x%2,a))\nif 1 in a:\n print(2*...
['Wrong Answer', 'Accepted']
['s456625130', 's870456827']
[3060.0, 3316.0]
[17.0, 20.0]
[188, 188]
p03665
u346812984
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\n\nodd = sum([a % 2 for a in A])\neven = len(A) - odd\n\nans = (2 ** even) * (2 ** (odd - 1))\n\n', 'import sys\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = ...
['Wrong Answer', 'Accepted']
['s295809048', 's908612241']
[2940.0, 3064.0]
[17.0, 17.0]
[227, 717]
p03665
u358254559
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P = map(int, input().split())\nA = list(map(int, input().split()))\n\neven_num=0\nodd_num=0\n\nfor a in A:\n if a%2==0:\n even_num+=1\n else:\n odd_num+=1\n\nev_case = 2**even_num\n\n\nfrom math import factorial\n\nres=0\nfor i in range(P,odd_num+1,2): ...
['Wrong Answer', 'Accepted']
['s811021180', 's801414756']
[3064.0, 3064.0]
[18.0, 17.0]
[408, 413]
p03665
u367130284
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from math import factorial\ndef cmb(n,r):\n if n-r<0:\n return 0\n else:\n return factorial(n) // factorial(r) // factorial(n - r)\n \n\nn,p,*a=map(int,open(0).read().split())\n\nodd=sum(i%2 for i in a)\neven=n-odd\n\nprint(odd,even)\n\nx=sum(cmb(even,i)for i in range(even+1))\ny=sum(cmb(od...
['Wrong Answer', 'Accepted']
['s446259959', 's624763763']
[3188.0, 3188.0]
[20.0, 18.0]
[344, 329]
p03665
u371385198
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\n \n import sys\ninput = sys.stdin.readline\n\n\ndef readstr():\n return input().strip()\n\n\ndef readint():\n return int(input())\n\n\ndef readnums():\n return map(int, input().split())\n\n\ndef readstrs():\n return input().split()\n\n\nN, P = readnums()\nA = map(lambda x: x % 2, readnums())\n\nif not...
['Runtime Error', 'Accepted']
['s203930127', 's106009242']
[2940.0, 3060.0]
[17.0, 17.0]
[344, 444]
p03665
u388415336
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['num_bags, congr_factor = list(map(int, input().split()))\nbags = list(map(int, input().split()))\nodd_bags = len([bag for bag in bags if (bag % 2 == 1]))\n\nif congr_factor == 0 and odd == 0:\n print(2 ** num_bags)\nelif congr_factor == 1 and odd == 0:\n print(0)\nelse:\n print(2 ** (num_bags-1))\n', 'num_bags, co...
['Runtime Error', 'Runtime Error', 'Accepted']
['s434600085', 's450527344', 's769011736']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[292, 281, 302]
p03665
u394721319
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P = [int(i) for i in input().split()]\nA = [int(i)%2 for i in input().split()]\n\nk = A.count(1)\nl = A.count(0)\n\nif P == 0:\n if k == 0:\n print(2**l)\n ans = 1\n ans = 2**(k-1+l)\nelse:\n if k == 0:\n print(0)\n exit()\n else:\n ans = 1\n ans = 2**(k-1+l)\n\npri...
['Wrong Answer', 'Accepted']
['s681497367', 's496880507']
[3060.0, 3188.0]
[17.0, 20.0]
[305, 322]
p03665
u411923565
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\nN,P = map(int,input().split())\nA = list(map(int,input().split()))\nA = sorted(A,reverse = False)\n\nm = sum(A) +1\ndp = [0]*(m)\n\ndp[0] = 2\n\n\nv = 0\n\nodd = 0\neven = 1\n\n\n\nfor a in range(N):\n \n for j in range(2):\n n = A[a]*j\n v += n \n \n if dp[v-n]%2 != n%2:\n ...
['Wrong Answer', 'Accepted']
['s732397997', 's687516063']
[9172.0, 9164.0]
[28.0, 26.0]
[638, 722]
p03665
u414699019
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nN,P=map(int,input().split())\nA=list(map(int,input().split()))\nodd=len([i for i in A ...
['Wrong Answer', 'Accepted']
['s103542970', 's103257654']
[3572.0, 3700.0]
[23.0, 26.0]
[613, 631]
p03665
u427344224
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\na_list = list(map(int, input().split()))\nimport math\ncount = 0\neven_count = 0\nodd_count = 0\nfor a in a_list:\n if a % 2 == 0:\n even_count += 1\n else:\n odd_count += 1\n\nif even_count > 0:\n print(2**(N-1))\n\nelse:\n if P == 0:\n print(2**N)\n...
['Wrong Answer', 'Accepted']
['s579965788', 's353329849']
[3064.0, 3444.0]
[17.0, 25.0]
[326, 191]
p03665
u432688695
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["# -*- coding: utf-8 -*-\n\nimport sys\nimport os\n\ninput_text_path = __file__.replace('.py', '.txt')\nfd = os.open(input_text_path, os.O_RDONLY)\nos.dup2(fd, sys.stdin.fileno())\n\nN, P = map(int, input().split())\n\nA_temp = list(map(int, input().split()))\nA = []\n\nfor a in A_temp:\n A.append(a % 2)\n\nzero_nu...
['Runtime Error', 'Accepted']
['s157778596', 's907338347']
[3064.0, 3064.0]
[18.0, 17.0]
[925, 622]
p03665
u445511055
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['# -*- coding: utf-8 -*-\nimport math\n\ndef main():\n """Function."""\n n, p = map(int, input().split())\n a = list(map(int, input().split()))\n\n e_count, o_count = 0, 0\n for dum in a:\n if dum % 2 == 0:\n e_count += 1\n else:\n o_count += 1\n\n print(e_count)\n...
['Wrong Answer', 'Accepted']
['s191023108', 's612781527']
[3064.0, 3064.0]
[18.0, 18.0]
[945, 906]
p03665
u445624660
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\n\nn, p = map(int, input().split())\nodds = n - len(list(filter(lambda x: int(x) % 2 == 0, input().split())))\nevens = n - odds\n\ndef ncr(n, r):\n res = 1\n for i in range(1, r + 1):\n res = res * (n - i + 1) // i\n return res\n\n\nans = 0\nif p == 0:\n for i in range(0, odds, 2):\n ans +=...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s017493626', 's319324315', 's711918999', 's928147966']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[561, 582, 606, 703]
p03665
u474423089
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["import scipy.misc\nN,P=map(int,input().split(' '))\nA=list(map(int,input().split(' ')))\nodd = 0\neven = 0\nfor i in A:\n if i%2 !=0:\n odd += 1\n else:\n even += 1\n\nans = 0\nif P ==1:\n for i in range(1,odd+1,2):\n ans += scipy.misc.comb(odd,i)\nelse:\n for i in range(0,odd+1,2):\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s248843589', 's495894935', 's778585134', 's157577145']
[13484.0, 13492.0, 13520.0, 3060.0]
[164.0, 163.0, 161.0, 17.0]
[369, 374, 384, 180]
p03665
u482969053
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\n\ndef combination(n, r):\n return math.factorial(n)/math.factorial(r)/math.factorial(n-r)\n\nn, p = map(int, input().split())\na_list = list(map(int, input().split()))\nsurplus0 = 0\nsurplus1 = 0\nfor i in a_list:\n if i % 2 == 0:\n surplus0 += 1\n else:\n surplus1 += 1\n\nif p == ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s056334331', 's283622606', 's591676280']
[3064.0, 3064.0, 3316.0]
[19.0, 21.0, 20.0]
[1212, 1173, 258]
p03665
u511630329
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\nA = [int(a) for a in input().split()]\ndp=[[0,0] for _ in range(N)]\ndp[0]=[2,0]\nfor i in range(1,N):\n if A[i]%2 ==0:\n dp[i][0]=dp[i-1][0]*2\n dp[i][1]=dp[i-1][1]*2\n else:\n dp[i][0]=dp[i-1][0]*2\n dp[i][1]+=dp[i-1][0]\n print(dp[i])\npri...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s971115530', 's995637453', 's427542397']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[320, 327, 313]
p03665
u513434790
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from math import factorial\n\ndef c(n,k):\n return factorial(n)/(factorial(n-k) * factorial(k))\n\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\n\no = 0\ne = 0\n\nfor i in A:\n if i % 2 == 0:\n e += 1\n else:\n o += 1\non = o // 2\n\na = []\nb = []\nans = 0\n\nif P == 0...
['Wrong Answer', 'Accepted']
['s026345576', 's418680139']
[3064.0, 3064.0]
[17.0, 17.0]
[671, 678]
p03665
u535171899
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from math import factorial\n\nn,p = map(int,input().split())\na_input = list(map(int,input().split()))\n\n\n\ndef calc_comb(n,r):\n return factorial(n) / factorial(r) / factorial(n - r)\n\nodd_len = 0\neven_len = 0\nfor i in range(n):\n if a_input[i]%2==0:\n even_len+=1\n else:\n odd_len+=1\n\n...
['Wrong Answer', 'Accepted']
['s724674131', 's533376293']
[3188.0, 3064.0]
[20.0, 18.0]
[910, 889]
p03665
u537782349
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['a, b = map(int, input().split())\nc = list(map(int, input().split()))\ne_odd = False\nfor i in c:\n if i % 2 == 1:\n e_odd = not e_odd\n break\nif not e_odd:\n if b == 1:\n print(0)', 'a, b = map(int, input().split())\nc = list(map(int, input().split()))\nd = 0\ne = 0\nfor i in c:\n if i...
['Wrong Answer', 'Accepted']
['s430165016', 's118648782']
[3064.0, 2940.0]
[19.0, 18.0]
[199, 257]
p03665
u537963083
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from collections import Counter\nimport itertools\nimport math\n\nn, p = map(int, input().split())\nalist = map(int, input().split())\n\nd = Counter()\nfor a in alist:\n d[a % 2] += 1\n\n# print(d)\n\nzeros = 2 ** d[0]\n\n\nones = 0\nif p == 0:\n for i in range(d[1]):\n if i % 2 == 0:\n ones +...
['Wrong Answer', 'Accepted']
['s652598425', 's024252474']
[3316.0, 3316.0]
[21.0, 21.0]
[650, 654]
p03665
u540761833
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\nN,P = map(int,input().split())\nA = [i%2 for i in list(map(int,input().split()))]\nodd,even = A.count(1),A.count(0)\nsumo = 0\nfor i in range(0,odd+1,P+1):\n sumo += int(math.factorial(odd)//(math.factorial(odd-i)*math.factorial(i)))\nprint(sumo*(2**even))', 'import math\nN,P = map(int,input().split()...
['Wrong Answer', 'Accepted']
['s995539034', 's496611471']
[3060.0, 3064.0]
[17.0, 17.0]
[265, 263]
p03665
u541318412
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from operator import mul\nfrom functools import reduce\n\n\nn,p = map(int,input().split())\nL = list(map(int,input().split()))\n\nLLeven = map(lambda x: x % 2, L)\nLLodd = map(lambda x: x % 2, L)\n\neven = list(LLeven).count(0)\nodd = list(LLodd).count(1)\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\...
['Wrong Answer', 'Accepted']
['s141753655', 's874556737']
[3700.0, 3572.0]
[23.0, 22.0]
[722, 724]
p03665
u543954314
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\n\ndef cc(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn, p = map(int, input().split())\na = list(map(int, input().split()))\no = 0\ne = 0\ns = 0\nfor i in a:\n if i%2:\n o += 1\n else:\n e += 1\nif p:\n for j in range(1,o,2):\n s += cc(o, j)\nelse:\n ...
['Wrong Answer', 'Accepted']
['s040511941', 's344823507']
[3064.0, 3064.0]
[18.0, 18.0]
[357, 362]
p03665
u559823804
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int,input().split())\na=list(map(int,input().split()))\nprint(2**(N-1))', 'n, p = map(int, input().split())\na = list(map(lambda x: x % 2, map(int, input().split())))\ne=a.count(0)\n\nans=2**(n-1)\nif p==1 and e==n:\n ans=0\nif p==0 and e==0:\n ans=2**n\nprint(ans)', 'n,p=map(int,input().split())\na=lis...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s059539776', 's654104297', 's888258122']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[77, 187, 185]
p03665
u572012241
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n, p = map(int, input().split())\na = list(map(int, input().split()))\n\nodd = 0\neven = 0\n\nfor i in a:\n if a %2 ==0:\n even +=1\n else:\n odd+=1\nif even == n:\n if p == 0:\n print(2**n)\n else:\n print(0)\nelse:\n print(2**(n-1))', 'n, p = map(int, input().split())\na =...
['Runtime Error', 'Runtime Error', 'Accepted']
['s667976258', 's815927719', 's730190551']
[3064.0, 2940.0, 3060.0]
[18.0, 17.0, 19.0]
[260, 259, 260]
p03665
u576917603
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\ndef ncr(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\nn,p=map(int,input().split())\na=list(map(int,input().split()))\nodd=0\neven=0\n\nfor i in a:\n if i%2==0:\n even+=1\n else:\n odd+=1\n\nif p==1:\n ans=2**even\n odd_choice=0\n for i in rang...
['Wrong Answer', 'Accepted']
['s679765303', 's563445460']
[3064.0, 3064.0]
[17.0, 20.0]
[556, 583]
p03665
u587589241
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['def comb(n,k):\n nCk = 1\n MOD = 10**9+7\n\n for i in range(n-k+1, n+1):\n nCk *= i\n nCk %= MOD\n\n for i in range(1,k+1):\n nCk *= pow(i,MOD-2,MOD)\n nCk %= MOD\n return nCk\nn,p=map(int,input().split())\na=list(map(lambda x:int(x)%2,input().split()))\non=a.count(1)\nze=a....
['Wrong Answer', 'Accepted']
['s586913979', 's397545774']
[9140.0, 9176.0]
[29.0, 25.0]
[454, 233]
p03665
u589087860
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n, p = map(int, input().split())\n\na = list(input())\n\nif p == 1:\n print(0)\n\nelif p == 0:\n print(2 ** n)\n\nelse:\n print(2 ** (n - 1))\n', 'n, p = map(int, input().split())\n\na = list(input())\n\nfor i in len(a):\n if i % 2 == 1:\n print(2 ** (n - 1))\n exit(0)\n\nif p == 0:\n pri...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s216643785', 's316576757', 's728004385', 's553267610']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0]
[140, 183, 178, 207]
p03665
u593567568
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P = map(int,input().split())\nA = list(map(int,input().split()))\n\nA = [a % 2 for a in A]\n\nacc = [1] * 60\nfor i in range(60):\n if i == 0:\n continue\n acc[i] = acc[i-1] * i\n\nodd = sum(A)\neven = N - odd\n\nans = 0\nif P == 0:\n \n j = 0\n for i in range(0,odd,2):\n j += acc[odd] // (acc[odd-i] * a...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s007000013', 's247796978', 's293921941']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 17.0]
[570, 575, 575]
p03665
u614181788
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p = map(int,input().split())\na = list(map(int,input().split()))\n\ns = [0]*n\nfor i in range(n):\n if a[i]%2 == 0:\n s[i] = 0\n else:\n s[i] = 1\nimport collections\nc = collections.Counter(s)\nodd = c[1]\neven = c[0]\nx = 0\ni = 0\nwhile 2*i+p <= even:\n x += comb(even, i, exact=True)\n ...
['Runtime Error', 'Accepted']
['s228408664', 's181014270']
[3316.0, 9168.0]
[21.0, 30.0]
[477, 591]
p03665
u619819312
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,r=map(int,input().split())\nc=[i%2for i in list(map(int,input().split()))]\np=sum(c)\nprint((2**(n-1))if p==0 else(0if r!=1else 2**n))', 'n,r=map(int,input().split())\nc=[i%2for i in list(map(int,input().split()))]\np=sum(c)\nprint(0if p==0 and r!=0else(2**n if p==0 and r!=1else (2**(n-1))))']
['Wrong Answer', 'Accepted']
['s009966845', 's199096436']
[3060.0, 3064.0]
[18.0, 21.0]
[133, 151]
p03665
u630088114
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import sys\n\ndef biscuit(N, P, As):\n n_even = 0\n n_odd = 0\n for a in As:\n if int(a) % 2 == 0:\n n_even += 1\n else:\n n_odd +=1\n v = 2**n_even\n print(n_even, n_odd)\n if n_odd == 0:\n v *= (0 if int(P) == 1 else 1)\n else:\n v *= 2**(n_odd -1)\n return ...
['Wrong Answer', 'Accepted']
['s175489223', 's801027770']
[3064.0, 3064.0]
[17.0, 17.0]
[415, 417]
p03665
u636387751
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from scipy.misc import comb\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\nodd = 0\neven = 0\nfor i in range(N):\n if A[i]%2 == 0:\n even += 1\n else:\n odd += 1\nm = 0\nif P == 0:\n for i in range(0,odd+1,2):\n m += int(comb(odd,i))\nelse:\n for i in range(1,...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s697805782', 's986126847', 's530950088']
[26208.0, 14768.0, 3188.0]
[414.0, 1459.0, 20.0]
[363, 363, 570]
p03665
u644907318
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P = map(int,input().split())\nA = list(map(int,input().strip()))\ncnt = 0\nfor i in range(N):\n cnt += A[i]%2\nprint(2**(N-1))', 'N,P = map(int,input().split())\nA = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n cnt += A[i]%2\nif cnt>0:\n print(2**(N-1))\nelif P==1:\n print(0)\nelse:\n ...
['Runtime Error', 'Accepted']
['s646012447', 's960607541']
[3064.0, 3060.0]
[17.0, 17.0]
[126, 186]
p03665
u645250356
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nimport sys,bisect,math,itertools,fractions\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\nde...
['Wrong Answer', 'Accepted']
['s589721266', 's426151264']
[5040.0, 5084.0]
[35.0, 37.0]
[681, 683]
p03665
u653807637
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["# encoding:utf-8\nimport math\n\ndef main():\n\tN, P = list(map(int, input().split()))\n\tbiscuits = list(map(int, input().split()))\n\n\tn_odd = sum([x % 2 for x in biscuits])\n\tn_even = N - n_odd\n\n\tprint(n_odd)\n\tprint(calcNPtrn_odd(n_odd, P))\n\tprint(calcNPtrn_even(n_even))\n\n\tout = calcNPtrn_odd(n_odd, P)...
['Wrong Answer', 'Accepted']
['s430725068', 's687547305']
[3064.0, 3064.0]
[19.0, 17.0]
[885, 779]
p03665
u655663334
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import itertools\nimport math\nfrom math import factorial\n\nN,P = list(map(int, input().split()))\nAs = list(map(int, input().split()))\n\n\nodd = 0\neven = 0\n\nfor A in As:\n if(A % 2 == 0):\n even += 1\n else:\n odd += 1\n\n\n\neven_combi = 0\n\nfor i in range(even+1):\n even_combi += math....
['Wrong Answer', 'Accepted']
['s427205736', 's489133150']
[9212.0, 9192.0]
[30.0, 28.0]
[972, 973]
p03665
u667084803
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P=map(int,input().split())\nA=list(map(int,input().split()))\nodd=0\nfor i in range(N):\n if A[i]%2==1: odd+=1\n break\nif odd==0:\n if P==1: print(0)\n else: print(2**N)\nelse:\n print(2**(N-1))', 'import math\ndef comb(n,r):\n return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))\n\nN,P=ma...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s024091909', 's100646793', 's565383348', 's894214756', 's111045969']
[2940.0, 3064.0, 3064.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[194, 456, 508, 183, 184]
p03665
u670180528
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['print(2**int(input()[:2]))', 'i=int(input()[:2])-1;print((2**i,0)[i%2])', 'n,p,*a=map(int,open(0).read().split());print(2**~-n*(any(x%2for x in a)or(1^p)*2))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s278217423', 's517904198', 's846131740']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[26, 41, 82]
p03665
u691018832
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\nn, p, *a = map(int, read().split())\ncnt_1 = 0\ncnt_2 = 0\nfor i in a:\n if a[i] % 2 == 1:\n cnt_1 += 1\n else:\n cnt_2 += 1\nans = 2 ** max(0, ...
['Runtime Error', 'Accepted']
['s611436438', 's389541337']
[3060.0, 3808.0]
[18.0, 29.0]
[377, 760]
p03665
u693953100
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['def check(a):\n for i in a:\n if i%2:\n return True\n return False\n\nn,p = map(int, input().split())\na = list(map(int,input().split()))\nif check():\n print(2**(n-1))\nelif p==0:\n print(2**n)\nelse:\n print(0)', 'def check(a):\n for i in a:\n if i%2:\n return T...
['Runtime Error', 'Accepted']
['s541815454', 's519654597']
[3060.0, 3064.0]
[17.0, 21.0]
[232, 233]
p03665
u694649864
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\nimport itertools\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\n\nodd = []\neven = []\nc = 0\nfor i in A:\n if i % 2 == 0:\n even.append(i)\n else:\n odd.appen...
['Runtime Error', 'Accepted']
['s341197832', 's846318482']
[3064.0, 3064.0]
[18.0, 18.0]
[939, 951]
p03665
u758815106
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N,P= map(int, input().split())\nA= list(map(int, input().split()))\nA = [A[i] % 2 for i in range(N)] \neven = A.count(0)\nodd = A.count(1)\n\nanseven = 1\nansodd = 0\n\ndic = {0:1}\nfor i in range(1, 51):\n dic[i] = dic[i - 1] * i\n\n\nfor i in range(1, even + 1):\n anseven += dic[even] // dic[even - i] // dic[...
['Wrong Answer', 'Accepted']
['s963862993', 's536910521']
[9104.0, 9128.0]
[28.0, 29.0]
[641, 656]
p03665
u761989513
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n, p = map(int, input().split())\na = list(map(int, input().split()))\nodd = 0\nfor i in a:\n if i % 2:\n print(2 ** (n - 1))\nif p:\n print(0)\nelse:\n print(2 ** n)', 'n, p = map(int, input().split())\na = list(map(int, input().split()))\nodd = 0\nfor i in a:\n if i % 2:\n print(2 ** (n - ...
['Wrong Answer', 'Accepted']
['s419765387', 's338123652']
[2940.0, 2940.0]
[20.0, 18.0]
[173, 188]
p03665
u767664985
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\nA = [i%2 for i in list(map(int, input().split))]\nzero = A.count(0)\none = A.count(1)\n\nprint( (2**zero) * (2**(max(0, one-1))) )\n', 'N, P = map(int, input().split())\nA = list(map(int, input().split()))\na = [i%2 for i in A]\nzero = a.count(0)\none = a.count(1)\n\nif one == 0 and ...
['Runtime Error', 'Accepted']
['s726782843', 's935044560']
[2940.0, 2940.0]
[17.0, 17.0]
[160, 215]
p03665
u771007149
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['#AGC017-A\nfrom math import factorial\ndef nCr(n,r):\n return factorial(n) / factorial(r) / factorial(n - r)\nn,p = map(int,input().split())\na = list(map(int,input().split()))\neven = 0\nodd = 0\nfor i in a:\n if i % 2 == 0:\n even += 1\n else:\n odd += 1\n\n\nif p == 0:\n temp = 0\n for...
['Wrong Answer', 'Accepted']
['s970574954', 's860372009']
[9220.0, 9212.0]
[29.0, 24.0]
[522, 505]
p03665
u781262926
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from scipy.special import comb\nn, p, *A = map(int, open(0).read().split())\nodd = sum(a%2 for a in A)\neven = n - odd\n\nif p:\n s = 0\n for i in range(1, odd, 2):\n s += comb(odd, i, exact=True)\n s *= pow(2, even)\n print(s)\nelse:\n s = 0\n for i in range(0, odd, 2):\n s += comb(odd, i, exact=True)\n ...
['Wrong Answer', 'Accepted']
['s163179615', 's871683123']
[42452.0, 42360.0]
[190.0, 186.0]
[332, 196]
p03665
u807772568
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import sys,collections as cl,bisect as bs\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nmod = 10**9+7\nMax = sys.maxsize\ndef l(): \n return list(map(int,input().split()))\ndef m(): \n return map(int,input().split())\ndef onem(): \n return int(input())\ndef s(x): \n a = []\n if len(x) == ...
['Wrong Answer', 'Accepted']
['s720224287', 's071053031']
[15716.0, 3556.0]
[135.0, 22.0]
[2631, 2263]
p03665
u813098295
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['def nCr(n, r):\n ret = 1\n for i in range(1, n+1):\n ret *= i\n for i in range(1, r+1):\n ret //= i\n for i in range(1, n-r+1):\n ret //= i\n return ret\n\nn, p = map(int, input().split())\na = map(int, input().split())\neven, odd = 0, 0\n\nfor i in a:\n if i & 1:\n odd += 1\n ...
['Wrong Answer', 'Accepted']
['s085421901', 's983339799']
[3064.0, 3064.0]
[17.0, 17.0]
[481, 460]
p03665
u814986259
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from math import factorial\nN,P=map(int,input().split())\na=list(map(int,input().split()))\nodd=0\neven=0\nfor i in range(N):\n if a[i]%2==0:\n even+=1\n else:\n odd+=1\nans=2**even\nk=0\nif P==0:\n k=0\nelse:\n k=1\ntmp=0\nfor i in range(k,odd,2):\n tmp+=factorial(odd)//factorial(odd-i)//factorial(i)\n\np...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s073868002', 's553824593', 's725167091']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[312, 326, 314]
p03665
u821262411
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['for i in a:\n if i%2==0:\n k +=1\nm=n-k\n\nans_x=ans_y=0\n\ndef cbn(b,c):\n z=1\n for i in range(2,b+1):\n z *= i\n for i in range(2,c+1):\n z //= i\n for i in range(2,b-c+1):\n z //= i\n return(z)\n\n\nif p==0:\n\n for i in range(k+1):\n ans_x += cbn(k,i)\n ...
['Runtime Error', 'Accepted']
['s335881078', 's123968644']
[3064.0, 3064.0]
[18.0, 18.0]
[513, 585]
p03665
u835482198
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\nN, P = map(int, input().split())\nA = map(int, input().split())\n\nn_even = len(filter(lambda x: x % 2 == 0, A))\nn_odd = N - n_even\nans = 2 ** max(0, n_odd - 1) * 2 ** n_even\nif P == 0 and n_odd == 0:\n print(0)\nelse:\n print(ans)\n', 'N, P = map(int, input().split())\nA = map(int, input().split())\n\nif ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s537821740', 's553436990', 's767136380']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[233, 296, 244]
p03665
u843175622
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\nn, p, *a = map(int, open(0).read().split())\n\n\ndef c(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nmemo = [0, 0]\nfor i in range(n):\n memo[a[i] % 2] += 1\n# p == 0\n\n\nans = 0\nif p == 0:\n for i in range(0, memo[1], 2):\n ans += c(memo[1], i) *...
['Wrong Answer', 'Accepted']
['s289978283', 's993759321']
[9232.0, 9136.0]
[30.0, 28.0]
[426, 434]
p03665
u846552659
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\nodd = [ tmp for tmp in a if tmp%2 != 0]\neven = [ tmp for tmp in a if tmp%2 == 0]\nif P == 0:\n ans += 1\n b = sum([ len(list(itertools.combinations(odd,tmp))) for tmp in range(2, len(odd)+1, 2) ])\nelse:\n b = sum([ len(list(ite...
['Runtime Error', 'Accepted']
['s505423385', 's646652654']
[3064.0, 3064.0]
[18.0, 18.0]
[606, 717]
p03665
u846694620
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["import math\n\n\ndef comb(n, r):\n return math.factorial(n) / math.factorial(r) / math.factorial(n - r)\n\n\ndef main():\n n, p = map(int, input().split())\n a = tuple(map(lambda x: int(x) % 2 == 0, input().split()))\n\n if n == 1 and a[0] == bool(p):\n print(0)\n return 0\n\n t = len(tup...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s519736357', 's891258355', 's701582505']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[735, 735, 744]
p03665
u855200003
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\nimport itertools\n\nN,P = [int(i) for i in input().split(" ")]\nA = [int(i) for i in input().split(" ")]\nk = 0\nfor i in range(N):\n if int(A[i] % 2) == P:\n k += 1\n\nif k == 0:\n if P == 0:\n tmp = 0\n i = 0\n while i < N-k:\n tmp += int(math.factorial(N-k)...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s163002333', 's635059123', 's887711523', 's363599027']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 18.0, 17.0, 19.0]
[586, 587, 583, 589]
p03665
u859897687
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int,input().split())\nl=list(map(lambda x:int(x)%2,input().split()))\na=l.count(0)\nb=l.count(1)\nans1=1\nfor i in range(0,a+1,2):\n ans11=1\n for j in range(a,a-i,-1):\n ans11*=j\n for j in range(1,1+i):\n ans11//=j\n ans1+=ans11\nans2=1\nfor i in range(p,b+1,2):\n ans21=1\n for j in range(b,b-i,...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s004790420', 's235349999', 's911692849', 's938698873', 's326627425']
[3064.0, 3064.0, 3064.0, 3060.0, 3064.0]
[20.0, 17.0, 18.0, 18.0, 18.0]
[390, 448, 390, 214, 212]
p03665
u860002137
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from collections import deque\n\nnCr = {}\n\n\ndef cmb(n, r):\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n if (n, r) in nCr:\n return nCr[(n, r)]\n nCr[(n, r)] = cmb(n-1, r) + cmb(n-1, r-1)\n return nCr[(n, r)]\n\n\nN, P = map(int, input().split())\nA = np.array(list...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s008214833', 's507996956', 's923376791', 's300999571']
[3316.0, 14512.0, 3564.0, 127756.0]
[21.0, 189.0, 23.0, 1358.0]
[659, 483, 716, 665]
p03665
u860972915
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['def odd(n):\n return n % 2 == 1\n \ndef even(n):\n return n % 2 == 0\n\nfrom math import factorial as fact\ndef c(n, r):\n if n < r:\n return 0\n if n == 0:\n return 0\n if r == 0:\n return 1\n return fact(n) // (fact(n-r) * fact(r))\n\nn, p = map(int, input().split())\na = l...
['Wrong Answer', 'Accepted']
['s126179821', 's305955308']
[3064.0, 3064.0]
[19.0, 17.0]
[608, 632]
p03665
u871841829
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['N, P = map(int, input().split())\nA = map(int, input().split())\n\nodds, evens = 0, 0\n\nfor i in A:\n if i & 1:\n odds += 1\n \n else:\n evens += 1\n\nfrom math import factorial\n\nif P == 0:\n ans = 0\n fo = factorial(odds)\n for r in range(2, odds + 1, 2):\n # ncr\n ...
['Wrong Answer', 'Accepted']
['s333554308', 's906678893']
[3064.0, 3064.0]
[18.0, 18.0]
[555, 527]
p03665
u875361824
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["def main():\n N, P = map(int, input().split())\n *A, = map(int, input().split())\n\n editorial(N, P, A)\n\ndef editorial(N, P, A):\n odds = [a for a in A if a % 2 == 1]\n odd = len(odds)\n even = N - odd\n\n if odd == 0:\n if P = 1:\n print(0)\n else:\n print(2...
['Runtime Error', 'Accepted']
['s922150993', 's304194974']
[2940.0, 3064.0]
[17.0, 18.0]
[808, 809]
p03665
u921773161
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import numpy as np\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\nA = np.array(A)\nA = A % 2\nA = list(A)\ncount0 = A.count(0)\ncount1 = A.count(1)\n\nprint(count0, count1, P)\n\nif P == 0 and count1 % 2 == 0:\n tmp = 2**(count1-1) * 2**count0\n\nelif P == 0 and count1 % 2 == 1:\n tmp =...
['Wrong Answer', 'Accepted']
['s233456252', 's527270211']
[12484.0, 12488.0]
[151.0, 150.0]
[489, 560]
p03665
u941047297
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
["def main():\n from operator import mul\n from functools import reduce\n def combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n n, p = list(map(int, input().split()))\n ...
['Wrong Answer', 'Accepted']
['s630339466', 's044438538']
[9428.0, 9564.0]
[27.0, 33.0]
[886, 913]
p03665
u941438707
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int,input().split())\na=[int(i) for i in input().split()]\nb=[i%2 for i in a]\nans=(2**b.count(0))*(2**(b.count(1)-1))\nprint((p+1)%2 if p not in b else ans)', 'from math import factorial as f\nn,p,*a=map(int,open(0).read().split())\nx=len([i for i in a if i%2])\ny=n-x\n\nxx=0\nfor i in range(p,x,2):\n xx+...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s349547432', 's546954400', 's609740587', 's704266780', 's735276633', 's589560421']
[3060.0, 3064.0, 3064.0, 3188.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0, 19.0, 17.0, 17.0]
[161, 247, 317, 155, 232, 120]
p03665
u945418216
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['import math\nn,p = map(int, input().split())\naa = list(map(int, input().split()))\n\naa = list(map(lambda x:x%2, aa))\nodd = aa.count(1)\neven = aa.count(0)\nans = 2**even\n# if p==1:\n# ans*=odd\n\n\npattern = 0\nfor i in range(p, odd+1, 2):\n print(even, odd, i, math.factorial(odd) // (math.factorial(i)*mat...
['Wrong Answer', 'Accepted']
['s533372578', 's261500429']
[3064.0, 3064.0]
[17.0, 17.0]
[458, 460]
p03665
u948522631
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['def cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n ...
['Wrong Answer', 'Accepted']
['s094761989', 's646024204']
[3064.0, 3064.0]
[18.0, 19.0]
[947, 1148]
p03665
u977193988
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['n,p=map(int,input().split())\nA=list(map(int,input().split()))\n\nfor i in range(n):\n A[i]%=2\none=A.count(1)\nif one==n:\n print(2**n)\nelse:\n print(2**(n-1))', 'n,p=map(int,input().split())\nA=list(map(int,input().split()))\n\nfor i in range(n):\n A[i]%=2\none=A.count(1)\nif one==n and p==0:\n prin...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s165786883', 's658461283', 's611200013']
[3060.0, 3060.0, 3064.0]
[19.0, 17.0, 19.0]
[161, 205, 208]
p03665
u980205854
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\n\nN, P = map(int, input().split())\nprint(2**N)', '\nimport numpy as np\n\nN, P = map(int, input().split())\nA = list(map(int, input().split()))\nodd = len([i for i in A if i%2!=0])\nif odd==0 and P==0:\n ans = 2**N\nelif odd==0 and P==1:\n ans = 0\nelse:\n ans = 2**(N-1)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s783944653', 's351832561']
[2940.0, 21048.0]
[17.0, 318.0]
[60, 244]
p03665
u987164499
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['from sys import stdin\nfrom math import factorial\n\nn,p = [int(x) for x in stdin.readline().rstrip().split()]\nli = list(map(int,stdin.readline().rstrip().split()))\n\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\nguusu = 0\nkisuu = 0\n\nfor i in li:\n if i%2 == 0:...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s136811249', 's343168182', 's945119930']
[3064.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0]
[735, 735, 253]
p03665
u996749146
2,000
262,144
There are N bags of biscuits. The i-th bag contains A_i biscuits. Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags. He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such wa...
['\n\n\n\n\nimport math\n\nN, P = map(int,input().strip().split(" "))\nA = list(map(int,input().strip().split(" ")))\n\neven = 0\nodd = 0\nfor a in A:\n if a % 2 == 0:\n even += 1\n else:\n odd += 1\n\neven_combi = 2 ** even\n\nodd_combi = 0\nm = int(odd/2)\n#print("m:", m)\nfor i in range(m+1):\n ...
['Wrong Answer', 'Accepted']
['s340846104', 's339030119']
[3064.0, 3188.0]
[18.0, 17.0]
[681, 686]
p03666
u101225820
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N,A,B,C,D=map(int,input().split())\nfor i in range(0,N-1):\n l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))\n\nfor _ in l:\n if B-A in _:\n print("YES")\n break\nelse:\n print("NO")', 'N,A,B,C,D=map(int,input().split())\nN=N-2\nfor i in range(0,N+1):\n l.append(range(i*C-(N-i)*D,i*D-(N-i)*C+1))\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s042968674', 's278162718', 's987908542']
[3060.0, 3060.0, 80408.0]
[18.0, 18.0, 530.0]
[191, 198, 202]
p03666
u334712262
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, prod...
['Wrong Answer', 'Accepted']
['s573572099', 's263211846']
[5728.0, 7648.0]
[189.0, 189.0]
[1323, 1323]
p03666
u340781749
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
["def solve(n, a, b, c, d):\n return d == 0\n if d == 0:\n return a == b\n t = n - 1\n return (b - a - c * t) % (c + d) <= (d - c) * t\n\n\nprint('YES' if solve(*map(int, input().split())) else 'NO')\n", "def solve(n, a, b, c, d):\n if d == 0:\n return a == b\n t = n - 1\n ab = abs(a ...
['Wrong Answer', 'Accepted']
['s104881194', 's919077044']
[3188.0, 2940.0]
[18.0, 18.0]
[209, 248]
p03666
u354638986
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['def main():\n n, a, b, c, d = map(int, input().split())\n\n for i in range(n):\n if c * (n-1-i) - d * i <= b - a <= -c * i + d * (n-1-i):\n print("Yes")\n break\n else:\n print("No")\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n n, a, b, c, d = map(in...
['Wrong Answer', 'Accepted']
['s523604048', 's960140537']
[2940.0, 2940.0]
[175.0, 175.0]
[260, 260]
p03666
u572142121
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
["N,a,b,c,d=map(int, input().split())\nN-=1\na,b=0,abs(b-a)\n\nif d*N<b:\n print('No')\n exit()\n \nfor i in range(N//2+1):\n e=b-(N-i*2)*d\n f=b-(N-i*2)*c\n if e<=(d-c)*i and (c-d)*i<=f:\n print('Yes')\n exit()\nprint('No')", "N,a,b,c,d=map(int, input().split())\nN-=1\na,b=0,abs(b-a)\n\n\nfor i in range(N/...
['Wrong Answer', 'Accepted']
['s551496474', 's298886727']
[9196.0, 9140.0]
[148.0, 147.0]
[259, 224]
p03666
u608297208
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N,A,B,C,D = map(int,input().split())\nif N > 30 and D > 1:\n\tflag = 10 **9\nelse:\n\tflag = pow(D,N -1)\nB -= A\nif N % 2 == 1:\n\tif (B % (C + D) <= (N - 1) * (D - C) / 2 or abs(B % (C + D) - (C + D)) <= (N - 1) * (D - C) / 2) and B <= flag and B >= -flag:\n\t\tprint("YES")\n\telse:\n\t\tprint("NO")\nelse:\n\tif ((...
['Runtime Error', 'Runtime Error', 'Accepted']
['s459506392', 's823767461', 's736564459']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[473, 483, 438]
p03666
u624475441
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
["N, A, B, C, D = map(int, input().split())\nlb, ub = A, A\nfor _ in range(1, N):\n if (lb + ub) / 2 < B:\n lb, ub = lb + C, ub + D\n else:\n lb, ub = lb - D, ub - C\nif lb <= B <= ub:\n print('Yes')\nelse:\n print('No')", "N, A, B, C, D = map(int, input().split())\nfor m in range(N):\n if ...
['Wrong Answer', 'Accepted']
['s779718109', 's331003260']
[3060.0, 3060.0]
[227.0, 221.0]
[234, 185]
p03666
u630088114
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['import sys\n\ndef diff(N,A,B,C,D):\n mini = (B+(N-1)*D-A)/(C+D)\n for i in xrange(mini, N-1):\n lower_bound = A + i*C - (N-i-1)*D\n upper_bound = A + i*D - (N-i-1)*C\n print(lower_bound, upper_bound)\n if lower_bound <= B and B <= upper_bound:\n return True\n elif B...
['Runtime Error', 'Accepted']
['s583244847', 's345511913']
[3064.0, 3064.0]
[19.0, 19.0]
[519, 523]
p03666
u653807637
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['# encoding:utf-8\nimport math\n\ndef main():\n\tN, A, B, C, D = list(map(int, input().split()))\n\tcur_list = [(A, A)]\n\n\tfor i in range(N - 1):\n\t\tcur_list = calcNextList(cur_list, C, D)\n\t\tcur_list =[x for x in cur_list if x[0] >= 0 and x[1] <= 10 ** 9]\n\t\tcur_list = merge(cur_list)\n\n\tprint(cur_list)\n\t...
['Runtime Error', 'Accepted']
['s999266343', 's835893117']
[3692.0, 3064.0]
[2107.0, 437.0]
[1146, 452]
p03666
u729133443
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
["n,a,b,c,d=map(int,input().split())\nf=0\nfor i in range(n):f^=i*c-(~i+n)*d<=b-a<=i*d-(~i+n)*c\nprint('NYOE S'[f::2])", "n,a,b,c,d=map(int,input().split());print('NYOE S'[any(i*c-(~i+n)*d<=b-a<=i*d-(~i+n)*cfor i in range(n))::2])", "n,a,b,c,d=map(int,input().split());print('NYOE S'[any(c*i-d*(~i+n)<=b-a<=d*i-c*(~i+n)f...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s374749538', 's700391074', 's731206844']
[3060.0, 2940.0, 3060.0]
[278.0, 17.0, 205.0]
[113, 108, 108]
p03666
u754022296
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N, A, B, C, D = map(int, input().split())\nE = B - A\nfor m in range(N):\n if C*(N-1-m) - D*m <= E <= -C*m + (N-1-m)*D:\n print("YES")\n break\nelse\nprint("NO")', 'N, A, B, C, D = map(int, input().split())\nE = B - A\nfor m in range(N):\n if C*(N-1-m) - D*m <= E <= -C*m + (N-1-m)*D:\n print("YES")\n br...
['Runtime Error', 'Accepted']
['s440424079', 's192970256']
[2940.0, 2940.0]
[17.0, 211.0]
[161, 165]
p03666
u814986259
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N,A,B,C,D=map(int,input().split())\nif A> B:\n A,B=B,A\nif C>D:\n C,B=B,C\n\nflag=False\ndiff=B-A\nd=0\nfor i in range(0,N,2):\n d+=D-C\n j= N-1 - i\n if j==0:\n if diff==d:\n flag=True\n break\n k=abs(diff - d) / j\n if k>=C and k<=D:\n flag=True\n break\n \nif flag:\n print("YES")\nelse:...
['Wrong Answer', 'Accepted']
['s960539431', 's729097812']
[3064.0, 3188.0]
[168.0, 378.0]
[310, 601]
p03666
u918935103
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N,a,b,c,d = map(int,input().split())\nn = N - 1\nans = "No"\nfor i in range(n+1):\n m1 = i*d - (n-i)*c\n m2 = -1*(n-i)*d + i*c\n if m1 <= m2:\n if a + m1 <= b and b <= a+ m2:\n ans = "Yes"\n #print(m1,m2)\n break\n else:\n if a + m2 <= b and b <= a + m1:\n ...
['Wrong Answer', 'Accepted']
['s857885791', 's090925837']
[3188.0, 3064.0]
[394.0, 416.0]
[380, 380]
p03666
u994988729
2,000
262,144
There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty. Aohashi would like to fill the empty squares with integers so that the following condition is satisfied: * For any two adjacent squares, the (absolute) difference of the t...
['N, A, B, C, D = map(int, input().split())\nB -= A\n\nans = "NO"\nfor i in range(N):\n high = i * D - (N - i - 1) * C\n low = i * C - (N - i - 1) * D\n print(i, N-i-1, low, high)\n if low <= B <= high:\n ans = "YES"\nprint(ans)', 'N, A, B, C, D = map(int, input().split())\n\ndif = B - A\n\nans = "NO...
['Wrong Answer', 'Accepted']
['s691782832', 's931847147']
[25444.0, 3188.0]
[1289.0, 331.0]
[235, 247]
p03667
u340781749
2,000
262,144
There are N balls in a row. Initially, the i-th ball from the left has the integer A_i written on it. When Snuke cast a spell, the following happens: * Let the current number of balls be k. All the balls with k written on them disappear at the same time. Snuke's objective is to vanish all the balls by casting the ...
['from collections import Counter, defaultdict\n\nn, m = map(int, input().split())\nan = list(map(int, input().split()))\nac = defaultdict(int, Counter(an))\nad = [0] * (n * 2)\nfor a, c in ac.items():\n for i in range(a - c, a):\n ad[i] += 1\nans = ad[:n].count(0)\n\nfor _ in range(m):\n x, y = map(int, i...
['Wrong Answer', 'Accepted']
['s628719500', 's869739371']
[41060.0, 74716.0]
[2105.0, 1491.0]
[557, 696]
p03675
u035336908
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['N = int(input())\na = input().split()\nb = []\nfor i in range(len(a)):\n\tif i % 2 == 1:\n\t\tb.insert(0, a[i])\n\telse:\n\t\tb.append(a[i])\nif N % 2 == 1:\n\tb = b.reverse()\nprint(b)\nline = " ".join(b)\nprint(line)', 'N = int(input())\na = input().split()\nb = [""] * N\nb1 = [a[i] for i in range(len(a)) if i % 2 ...
['Runtime Error', 'Accepted']
['s927733953', 's575395376']
[20184.0, 28148.0]
[2105.0, 90.0]
[199, 224]