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
p02812
u952669998
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['N = int(input())\ns = input()\ncnt = 0\nfor i in range(N-2):\n print(s[i:i+3])\n if s[i:i+3] =="ABC":\n cnt += 1\nprint(cnt)', 'N = int(input())\ns = input()\ncnt = 0\nfor i in range(N-2):\n if s[i:i+3] =="ABC":\n cnt += 1\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s209117376', 's238015714']
[3064.0, 2940.0]
[18.0, 17.0]
[122, 104]
p02812
u961481098
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['import itertools\nimport math\nN = int(input())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nL = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))\na = L.index(P)\nb = L.index(Q)\nprint(abs(a-b))', 'import itertools\nimport math\nN = int(input())\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nL = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))\na = L.index(P)\nb = L.index(Q)\nprint(abs(a-b))', 'N = int(input())\nS = str(input())\nprint(S.count("ABC"))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s195116409', 's321182211', 's561196227']
[3064.0, 3064.0, 2940.0]
[17.0, 17.0, 18.0]
[245, 245, 55]
p02812
u963903527
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["print(input().count('ABC'))", 'input(); print(input().count("ABC"))']
['Wrong Answer', 'Accepted']
['s158738125', 's416630850']
[2940.0, 2940.0]
[17.0, 17.0]
[27, 36]
p02812
u963944915
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["N=int(input())\nS=input()\nresult=0\nfor i in range(N):\n if [i:i+3]=='ABC':\n result+=!\nprint(result)\n", "N=int(input())\nS=input()\nresult=0\nfor i in range(N):\n if [i:i+3]=='ABC':\n result+=1\nprint(result)\n", "N=int(input())\nS=input()\ncount=0\nfor i in range(N):\n if S[i:i+3]=='ABC':\n count+=1\nprint(count)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s089382748', 's556240555', 's927660207']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[102, 102, 99]
p02812
u964521959
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['N = int(input())\nS = input()\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == "A"):\n if(str_list[i+1] == "B"):\n if(str[i+2] == "C"):\n ans += 1\n\nprint(ans)', 'N, S = map(str, input().split())\nN = int(N)\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == "A"):\n if(str_list[i+1] == "B"):\n if(str[i+2] == "C"):\n ans += 1\n\nprint(ans)', 'N = int(input())\nS = input()\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == "A"):\n pass\n if(str_list[i+1] == "B"):\n pass\n if(str[i+2] == "C"):\n ans += 1\n\nprint(ans)', 'N = int(input())\nS = input()\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == "A"):\n ans = ans\n if(str_list[i+1] == "B"):\n ans = ans\n if(str[i+2] == "C"):\n ans += 1\n\nprint(ans)\n', 'N, S = map(str, input().split())\nN = int(N)\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == A):\n if(str_list[i+1] == B):\n if(str[i+2] == C):\n ans += 1\n\nprint(ans)', 'N = int(input())\nS = input()\n\nans = 0\nstr_list = list(S)\n\nfor i in range (len(str_list)-2):\n if(str_list[i] == "A"):\n if(str_list[i+1] == "B"):\n if(str_list[i+2] == "C"):\n ans += 1\n\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s567453638', 's734286056', 's930639836', 's947068033', 's965382663', 's770649469']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3316.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 20.0]
[203, 218, 223, 234, 212, 209]
p02812
u966542724
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["n = int(input())\ns = input()\n\ni = -1\nc = 0\n\nwhile True:\n\ti = s.find('ABC', i + 1)\n\tif i == -1:\n\t\tbreak\n\tc++\nprint(c)", "n = int(input())\ns = input()\n\ni = -1\nc = 0\n\nwhile True:\n\ti = s.find('ABC', i + 1)\n\tif i == -1:\n\t\tbreak\n\tc += 1\nprint(c)"]
['Runtime Error', 'Accepted']
['s154262677', 's381241803']
[2940.0, 3316.0]
[18.0, 20.0]
[116, 119]
p02812
u969211566
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['n = int(input())\ns = input()\nls = s.replace("ABC","")\nprint(ls)\nprint((n-len(ls))//3)', 'n = int(input())\ns = input()\nls = s.replace("ABC","")\nprint((n-len(ls))//3)']
['Wrong Answer', 'Accepted']
['s187627365', 's596341495']
[2940.0, 2940.0]
[17.0, 17.0]
[85, 75]
p02812
u970308980
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['C010_scrambled', "N = int(input())\nS = input().strip()\nans = 0\nfor i in range(N-2):\n if S[i:i+3] == 'ABC':\n ans += 1\nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s362495898', 's805018272']
[2940.0, 2940.0]
[17.0, 21.0]
[14, 120]
p02812
u970388292
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["a = input()\nb = a.count('ABC')\nprint(b)", "c=input()\na = input()\nb = a.count('ABC')\nprint(b)\n"]
['Wrong Answer', 'Accepted']
['s588170796', 's786353685']
[2940.0, 2940.0]
[17.0, 17.0]
[39, 50]
p02812
u970523279
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["n = int(input())\ns = input()\nprint(s.count('ABC')", "n = int(input())\ns = input()\nprint(s.count('ABC'))"]
['Runtime Error', 'Accepted']
['s746302731', 's323533134']
[2940.0, 2940.0]
[17.0, 17.0]
[49, 50]
p02812
u972892985
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['n = int(input())\ns = str(inout())\n\nans = 0\n\nfor i in range(n-2):\n if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":\n ans += 1\n else:\n continue\n \nprint(ans)\n', 'n = inr(input())\ns = str(inout())\n\nans = 0\n\nfor i in range(n):\n\tif s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":\n ans += 1\n else:\n continue\n \nprint(ans)', 'n = int(input())\ns = str(input())\n \nans = 0\n \nfor i in range(n-2):\n if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":\n ans += 1\n else:\n continue\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s194811534', 's849518152', 's762983145']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 20.0]
[183, 173, 184]
p02812
u974231963
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['\nn = input()\ns = input()\n\nresults = re.findall(r"ABC", s)\n\nprint(len(results))', 'import re\n\n\nn = input()\ns = input()\n\nresults = re.findall(r"ABC", s)\n\nprint(len(results))']
['Runtime Error', 'Accepted']
['s679362374', 's186496236']
[2940.0, 3188.0]
[17.0, 20.0]
[93, 104]
p02812
u974792613
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['n = int(input())\ns = input()\npat = "ABC"\n\nans =0\ni=0\nwhile i < n:\n if pat = s[i:len(pat)]:\n ans+=1\n\nprint(ans)', 'n = int(input())\ns = input()\npat = "ABC"\n\nans = 0\ni = 0\nwhile i < n:\n if pat == s[i : i + len(pat)]:\n ans += 1\n i += 1\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s815008416', 's116962731']
[2940.0, 2940.0]
[18.0, 17.0]
[114, 144]
p02812
u975797983
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["N = int(input())\nS = int(input())\nprint(S.count('ABC'))", "N = int(input())\nS = input()\nprint(S.count('ABC'))"]
['Runtime Error', 'Accepted']
['s427288878', 's297500254']
[2940.0, 2940.0]
[18.0, 17.0]
[55, 50]
p02812
u978178314
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['N = int(input())\nS = input()\nans = 0\nif N > 3:\n for i in range(N-3):\n \tif S[i:i+3] == "ABC":\n \tans += 1\nelse:\n ans = 1 if S == "ABC" else 0\nprint(ans)', 'N = int(input())\nS = input()\nans = 0\nif N > 3:\n for i in range(N-2):\n if S[i:i+3] == "ABC":\n ans += 1\nelse:\n ans = 1 if S == "ABC" else 0\nprint(ans)']
['Runtime Error', 'Accepted']
['s963949531', 's330572952']
[2940.0, 2940.0]
[17.0, 17.0]
[156, 158]
p02812
u979726772
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['n = int(input())\nS = list(input())\nprint(n,S)', "# coding: utf-8\n# Your code here!\nn = int(input())\nS = list(input())\n#print(len(S))\ncount = 0\ncount_total = 0\nfor moji in S:\n if moji == 'A':\n count = 'A'\n elif count == 'A' and moji == 'B':\n count = 'B'\n elif count == 'B' and moji == 'C':\n count = 0\n count_total += 1\n else:\n count = 0\n \nprint(count_total)"]
['Wrong Answer', 'Accepted']
['s646587073', 's096729131']
[2940.0, 3060.0]
[17.0, 17.0]
[45, 389]
p02812
u982591663
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['N = int(input())\nS = input()\n\nnew_S = S.replace("ABC", "@")\n\nprint(new_S)\nprint(new_S.count("@"))\n', 'N = int(input())\nS = input()\n\nnew_S = S.replace("ABC", "@")\n\nprint(new_S.count("@"))\n']
['Wrong Answer', 'Accepted']
['s004750221', 's364406504']
[2940.0, 2940.0]
[17.0, 17.0]
[98, 85]
p02812
u982749462
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
["b, c = map(str, input().split())\nprint(c.count('ABC'))", "a = input()\nb = input()\nprint(b.count('ABC'))"]
['Runtime Error', 'Accepted']
['s036140211', 's305806438']
[2940.0, 2940.0]
[17.0, 17.0]
[54, 45]
p02812
u994988729
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['def abc151_b():\n N, K, M = map(int, input().split())\n A = sum(list(map(int, input().split())))\n need = max(0, N * M - A)\n ans = need if need <= K else - 1\n print(ans)\n\nabc151_b()', 'N = int(input())\ns = input()\n\nans = 0\nfor x, y, z in zip(s[:-2], s[1:-1], s[2:]):\n if x + y + z == "ABC":\n ans += 1\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s679398119', 's855402445']
[3056.0, 2940.0]
[17.0, 17.0]
[193, 137]
p02812
u996665352
2,000
1,048,576
We have a string S of length N consisting of uppercase English letters. How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?
['print(input().count("ABC"))', 'print(input().count("ABC"))', 'input()\nprint(input().count("ABC"))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s319052992', 's870843063', 's570657331']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[27, 27, 35]
p02814
u006883624
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['# from math import sqrt\n# from heapq import heappush, heappop\n# from collections import deque\nfrom functools import reduce\n\n# a, b = [int(v) for v in input().split()]\n\n\ndef main():\n N, M = [int(v) for v in input().split()]\n A = list(set([int(v) // 2 for v in input().split()]))\n\n def gcd(v1, v2):\n while v1 % v2 != 0:\n tmp = v2\n v2 = v1 % v2\n v1 = tmp\n return v2\n\n def lcm(v1, v2):\n return v1 * v2 // gcd(v1, v2)\n\n alcm = 1\n for a in A:\n d = gcd(alcm, a)\n lcm = lcm * a // d\n if alcm > M:\n print(0)\n exit()\n\n \n\n if a_lcm > M:\n print(0)\n else:\n print((M // a_lcm + 1) // 2)\n\n\nmain()\n', '# from math import sqrt\n# from heapq import heappush, heappop\n# from collections import deque\nfrom functools import reduce\n\n# a, b = [int(v) for v in input().split()]\n\n\ndef main():\n N, M = map(int, input().split())\n A = [int(v) // 2 for v in input().split()]\n\n def gcd(v1, v2):\n v = v1 % v2\n if v == 0:\n return v2\n return gcd(v2, v)\n\n def lcm(v1, v2):\n return v1 * v2 // gcd(v1, v2)\n\n lcma = reduce(lcm, A)\n\n if next(filter(lambda v: (lcma // v) % 2 == 0, A), None) is not None:\n print(0)\n exit()\n\n print((M + lcma) // (2 * lcma))\n\n\nmain()\n']
['Runtime Error', 'Accepted']
['s562882953', 's150520990']
[14748.0, 14748.0]
[58.0, 230.0]
[767, 614]
p02814
u018990794
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\n \ncount = 0\np = 0\nwhile res * (2 * p + 1) <= M:\n count += 1\n p += 1\nprint(count)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\ncount = 0\nfor i in range(len(M)):\n count += 1\n if res*(2*i + 1) > M:\n break\nprint(count)', 'N, M = map(int, input().split())\na_n = [int(x/2) for x in input().split()]\n\ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\ncount = 0\nfor i in range(int(M/res)-1):\n count += 1\nprint(count)', 'N, M = map(int, input().split(" "))\na_n = list(set(map(int, input().split(" "))))\ng = a.copy()\n \nwhile not any(x%2 for x in g):\n g = [i //2 for i in g]\n if not all(x%2 for x in g): \n print(0); exit(0)\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \ndef lcm(a, b):\n return a * b // gcd(a, b)\n \ntot = 1\n \nfor x in a:\n tot = lcm(tot, x//2)\nprint((M//tot+1)//2)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\n \ncount = 0\nfor i in range(M):\n count += 1\n if res * (2 * i + 1) > M:\n break\nprint(count)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n\ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\ncount = 0\nfor i in range(int(M/res)-1):\n count += 1\nprint(count)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\ncount = 0\nfor i in range(len(M)):\n count += 1\n if res*(2*i + 1) > M:\n break\nprint(count)', 'N, M = map(int, input().split(" "))\na_n = list(set(map(int, input().split(" "))))\ng = a.copy()\n \nwhile not any(x%2 for x in g):\n g = [i //2 for i in g]\n if not all(x%2 for x in g): \n print(0); exit(0)\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \ndef lcm(a, b):\n return a * b // gcd(a, b)\n \ntot = 1\n \nfor x in a:\n tot = lcm(tot, x//2)\nprint((M//tot+1)//2)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\n\ncount = 0\nfor i in range(len(M)):\n count += 1\n if res * (2 * i + 1) > M:\n break\n\nprint(count)', 'N,M = map(int, input().split())\na_n = list(map(int, input().split()))\ng = a_n.copy()\n\nwhile not any(x%2 for x in g): g = [x//2 for x in g]\nif not all(x%2 for x in g): print(0); exit(0)\ndef gcd(a,b):\n while b: a,b = b,a%b\n return a\nlcm = lambda a,b: a*b//gcd(a,b)\ntot = 1\nfor x in l: tot = lcm(tot,x//2)\nprint((m//tot+1)//2)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = 0\n x = [(x * lis[i]) // gcd(x, lis[i]) for i in range(1, len(lis))]\n return x\nres = lcm(a_n)\n \ncount = 0\np = 0\nwhile res * (2 * p + 1) <= M:\n count += 1\n p += 1\nprint(count)', 'N, M = map(int, input().split())\na_n = list(map(int, input().split()))\na_n = [int(a_n[i]*1/2) for i in range(len(a_n))]\n \ndef lcm(lis):\n from fractions import gcd\n x = lis[0]\n for i in range(1, len(lis)):\n x = (x * lis[i]) // gcd(x, lis[i])\n return x\nres = lcm(a_n)\n \ncount = 0\nfor i in range(M):\n if res * (2 * i + 1) <= M:\n count += 1\n else:\n break\nprint(count)', 'N,M = map(int, input().split())\na_n = list(map(int, input().split()))\ng = a_n.copy()\n \nwhile not any(x%2 for x in g): g = [x//2 for x in g]\nif not all(x%2 for x in g): print(0); exit(0)\ndef gcd(a,b):\n while b: a,b = b,a%b\n return a\nlcm = lambda a,b: a*b//gcd(a,b)\ntot = 1\nfor x in a_n: tot = lcm(tot,x//2)\nprint((M//tot+1)//2)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s026850015', 's092717166', 's100317015', 's151558509', 's237582254', 's242063301', 's286051476', 's307479785', 's493635492', 's712750545', 's883134471', 's994181742', 's687719439']
[14124.0, 14124.0, 11124.0, 11356.0, 14292.0, 14892.0, 14244.0, 12068.0, 14124.0, 15676.0, 14124.0, 14356.0, 15676.0]
[2104.0, 172.0, 27.0, 42.0, 2104.0, 2104.0, 174.0, 42.0, 165.0, 470.0, 116.0, 2104.0, 512.0]
[371, 384, 306, 376, 379, 351, 378, 376, 384, 325, 359, 390, 328]
p02814
u024383312
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from functools import reduce\ndef f(n):\n res = 0\n while(n%2 == 0):\n res += 1\n n //= 2\n return res\n\ndef gcd(a, b):\n return a if b == 0 else gcd(b, a%b)\n\ndef lcm(a, b):\n return a // gcd(a, b) * b\n\nn, m = map(int, input().split())\nA = list(map(lambda x: int(x) // 2, input().split()))\n\nF = set()\nfor a in A:\n F.add(f(a))\nif(len(F) != 1):\n print(0)\n exit()\n\nl = reduce(lcm, A, 1)\nfor a in A:\n if((l // a) % 2 == 0):\n print(0)\n exit()\n\nans = (m // 2 +1) // l\nprint(ans)', 'from functools import reduce\ndef f(n):\n res = 0\n while(n%2 == 0):\n res += 1\n n //= 2\n return res\n\ndef gcd(a, b):\n return a if b == 0 else gcd(b, a%b)\n\ndef lcm(a, b):\n return a // gcd(a, b) * b\n\nn, m = map(int, input().split())\nA = list(map(lambda x: int(x) // 2, input().split()))\n\nl = reduce(lcm, A, 1)\nfor a in A:\n if((l // a) % 2 == 0):\n print(0)\n break\n\nelse:\n ans = (m // l +1) // 2\n print(ans)']
['Wrong Answer', 'Accepted']
['s248337246', 's959660452']
[14744.0, 14748.0]
[519.0, 237.0]
[518, 451]
p02814
u026155812
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from math import gcd, ceil\nfrom functools import reduce\nimport sys\n\ndef lcm_base(x, y):\n return (x * y) // gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(i)//2 for i in input().split()]\n\nif N == 1:\n print((M//a[0]+1)//2)\n sys.exit()\n\nA = []\ns = set()\nfor x in a:\n cur = 0\n y = x\n while y%2 == 0:\n cur += 1\n y //= 2\n s.add(cur)\n if len(s) >= 2:\n print(0)\n sys.exit()\nlcm = lcm_list(A)\nprint((M//lcm+1)//2)', 'from math import gcd, ceil\nfrom functools import reduce\nimport sys\n\ndef lcm_base(x, y):\n return (x * y) // gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(i)//2 for i in input().split()]\n\ns = set()\nfor x in a:\n cur = 0\n y = x\n while y%2 == 0:\n cur += 1\n y //= 2\n s.add(cur)\n if len(s) >= 2:\n print(0)\n sys.exit()\nlcm = lcm_list(a)\nprint((M//lcm+1)//2)']
['Wrong Answer', 'Accepted']
['s484760680', 's584518028']
[20964.0, 20532.0]
[400.0, 419.0]
[526, 466]
p02814
u026788530
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['def prime_factor(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\ntry:\n from math import gcd\nexcept ImportError:\n from fractions import gcd\n\nn, m = [int(_) for _ in input().split()]\nA = [int(_) for _ in input().split()]\n\nn = 1\nfor a in A:\n n = (n*a)//gcd(n, a)\nif n > m*2:\n ans = 0\nelse:\n ans = 2*m//n+1\n\n\nprint(ans)\n', 'def prime_factor(n):\n arr = []\n temp = n\n for i in range(2, 3):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\ntry:\n from math import gcd\nexcept ImportError:\n from fractions import gcd\n\nn, m = [int(_) for _ in input().split()]\nA = [int(_) for _ in input().split()]\n\nn = 1\nc = prime_factor(A[0])[0][1]\nfor a in A:\n if c != prime_factor(a)[0][1]:\n print(0)\n exit()\n n = (n*a)//gcd(n, a)\n\nn //= 2\n\nif n > m:\n ans = 0\nelse:\n ans = m//n\n ans = (ans+1)//2\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s859174151', 's553757652']
[16280.0, 16280.0]
[148.0, 608.0]
[633, 734]
p02814
u027547861
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N, M = list(map(int, input().split(" ")))\nlist_a = list(map(int, input().split(" ")))\n\n\ndef check_exist(l) :\n if(len(l) == 1) :\n return True\n while(True) :\n flag = l[0] % 2\n for x in l[1:] :\n if(x % 2 != flag) :\n return False\n if(flag == 0) :\n l = list(map(lambda x: int(x/2), l))\n else :\n return True\n \n\n\n\ndef gcd(a, b) :\n print(a)\n if(b==0) :\n return a\n else :\n return gcd(b, a%b)\n \n\ndef lcm(a, b) :\n cd = gcd(a, b)\n return a * b / cd\n \n\ndef lcm_multi(l) :\n if(len(l) < 2) :\n return l[0]\n cm = lcm(l[0], l[1])\n for i in range(2, N) :\n cm = lcm(l[i], cm)\n if(cm > M) :\n print(0)\n exit()\n \n return cm\n\nif(not(check_exist(list_a))) :\n print(0)\n exit()\n\nlcm_m = lcm_multi(list_a)\nif(M-lcm_m/2 < 0) :\n print(0)\nelse :\n print(int((M-lcm_m/2) / lcm_m) + 1)\n\n', 'N, M = list(map(int, input().split(" ")))\nlist_a = list(map(int, input().split(" ")))\n\n\n\ndef gcd(a, b) :\n if(b==0) :\n return a\n else :\n t = a - b\n if(m > t) :\n return gcd(m, t)\n else :\n return(b, a%b)\n \n\ndef lcm(a, b) :\n return a * b / gcd(a, b)\n \n\ndef lcm_multi(l) :\n if(len(l) < 2) :\n return l[0]\n res = lcm(l[0], l[1])\n for i in range(2, N) :\n res = lcm(l[i], res)\n \n return res\n\nans = 0\nlcm_m = lcm_multi(list_a)\n\nif(M-lcm_m/2 < 0) :\n print(0)\nelse :\n print(int((M-lcm_m/2) / lcm_m) + 1)\n', 'N, M = list(map(int, input().split(" ")))\nlist_a = list(map(int, input().split(" ")))\n\n\n\ndef gcd(a, b) :\n if(b==0) :\n return a\n else :\n return(b, a%b)\n \n\ndef lcm(a, b) :\n return a * b / gcd(a, b)\n \n\ndef lcm_multi(l) :\n if(len(l) < 2) :\n return l[0]\n res = lcm(l[0], l[1])\n for i in range(2, N) :\n res = lcm(l[i], res)\n \n return res\n\nans = 0\nlcm_m = lcm_multi(list_a)\n\nif(M-lcm_m/2 < 0) :\n print(0)\nelse :\n print(int((M-lcm_m/2) / lcm_m) + 1)\n', 'N, M = list(map(int, input().split(" ")))\nlist_a = list(map(int, input().split(" ")))\n\n\ndef check_exist(l) :\n if(len(l) == 1) :\n return True\n while(True) :\n flag = l[0] % 2\n for x in l[1:] :\n if(x % 2 != flag) :\n return False\n if(flag == 0) :\n l = list(map(lambda x: int(x/2), l))\n else :\n return True\n \n\n\n\ndef gcd(a, b) :\n if(b==0) :\n return a\n else :\n return gcd(b, a%b)\n \n\ndef lcm(a, b) :\n cd = gcd(a, b)\n return (a / cd) * b\n \n\ndef lcm_multi(l) :\n cm = 1\n for x in l :\n cm = lcm(x, cm)\n if(cm > 4 * M) :\n print(0)\n exit()\n \n return cm\n\nif(not(check_exist(list_a))) :\n print(0)\n exit()\n\n\nlcm_m = lcm_multi(list(map(lambda x: int(x/2), list_a)))\n\nif(M-lcm_m < 0) :\n print(0)\nelse :\n print(int((M-lcm_m) / (2*lcm_m)) + 1)\n\n']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s296117888', 's576451528', 's657494442', 's365966593']
[15296.0, 14484.0, 14400.0, 15148.0]
[1102.0, 44.0, 43.0, 938.0]
[991, 643, 577, 975]
p02814
u031178961
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['def gcd(n, m):\n if m == 0: return n\n return gcd(m , n%m)\n\ndef lcm(n, m): \n g = gcd(n, m)\n return n * m // g\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nres = 1\nfor i in range(0, N):\n res = lcm(res, A[i])\n\nif res // 2 > M: print(0)\nelse: print((M + res//2 + res - 1) // res)\n\n', 'def gcd(n, m):\n if m == 0: return n\n return gcd(m , n%m)\n\ndef lcm(n, m): \n g = gcd(n, m)\n return n * m // g\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nres = 1\nfor a in A:\n res = lcm(res, a)\n\ncnt = 0\nwhile A[0] % 2 == 0:\n A[0] //= 2;\n cnt += 1\n\nok = True\nfor i in range(1, N):\n c = 0\n while A[i] % 2 == 0:\n A[i] //= 2;\n c+= 1\n if cnt != c :ok = False\n \nif res // 2 > M or ok == False: print(0)\nelse: print((M + res//2 ) // res)\n\n']
['Wrong Answer', 'Accepted']
['s613853613', 's436754959']
[15060.0, 14244.0]
[151.0, 884.0]
[316, 502]
p02814
u089376182
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nfrom functools import reduce\n\nn,m = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef lcm_base(x,y):\n return x*y//math.gcd(x,y)\n\ndef lcm(target_list):\n return reduce(lcm_base, target_list)\n\nif reduce(math.gcd, A)%2:\n min_x = int(lcm(A)*0.5)\n ans = m//min_x - m//(2*min_x)\n print(ans)\nelse:\n print(0)', 'import math\nfrom functools import reduce\n\nn,m = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef lcm_base(x,y):\n return x*y//math.gcd(x,y)\n\ndef lcm(target_list):\n return reduce(lcm_base, target_list)\n\nA_gcd = reduce(math.gcd, A)\nflg = True\n\nfor a in A:\n if a//A_gcd%2==0:\n flg = False\n break\n \nif flg:\n min_x = int(lcm(A))//2\n ans = m//min_x - m//(2*min_x)\n print(ans)\nelse:\n print(0)']
['Wrong Answer', 'Accepted']
['s109276739', 's055051336']
[20944.0, 21064.0]
[60.0, 130.0]
[334, 418]
p02814
u099643902
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from fractions import gcd\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = list(set(A))\nAA = [a//2 for a in A]\nK = [1 for i in range(len(AA))]\n\ndef lcm(x, y):\n ans = (x * y) // gcd(x, y)\n return(ans)\nl = 1\ng = AA[0]\n\nfor i in range(len(AA)):\n g = gcd(g, AA[i])\n l = lcm(l, AA[i])\nAAA = [a // g for a in AA]\nC = [a % 2 for a in AAA]\n\nif C == K:\n ans = M // l\n print((ans+1)//2)\nelse:\n print(0)\n', '\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = list(set(A))\n\ndef gcd(x, y):\n if x < y:\n x, y = y, x\n while x % y != 0:\n x, y = y, x % y\n return(y)\n\ndef lcm(x, y):\n ans = (x * y) // gcd(x, y)\n return(ans)\nl = 1\ncnt = [0 for i in range(len(A))]\nfor i in range(len(A)):\n a = A[i]\n l = lcm(l, a)\n count = 0\n while True:\n if a % 2 == 0:\n a //= 2\n count += 1\n else:\n cnt[i] = count\n break\ncount = cnt[0]\nflag = True\nfor i in range(len(A)):\n if cnt[i] != count:\n flag = False\n break\nif flag:\n l = l // 2\n ans = M // l\n print((ans+1)//2)\nelse:\n print(0)']
['Time Limit Exceeded', 'Accepted']
['s197745845', 's841072327']
[16396.0, 14400.0]
[2104.0, 46.0]
[555, 700]
p02814
u130900604
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import numpy as np\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\naa=np.array(a)\n\nwhile True:\n aa=aa//2\n if (aa%2).any()==1:\n break\n \nif (aa%2).all()!=1:\n print(0);exit()\n\nt=list(set(aa))\n\n\nimport fractions as fr\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fr.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(fr.gcd, numbers)\n\n\nlcm=np.prod(t)//gcd_list(t)\n\nprint(int((m/lcm+1)//2))\n\n', 'import numpy as np\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\naa=np.array(a)\n\nwhile True:\n aa=aa//2\n if (aa%2).any()==1:\n break\n\nprint(aa) \nif (aa%2).all()!=1:\n print(0);exit()\n\nt=list(set(aa))\n\n\nimport fractions as fr\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fr.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(fr.gcd, numbers)\n\n\nlcm=np.prod(t)//gcd_list(t)\n\nprint(int((m/lcm+1)//2))\n\n', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\n\nb=set([(i//2)%2 for i in a])\nc=set([i//2 for i in a])\nif 0 in b:\n print(0)\n exit()\n\n \nimport fractions as fr\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fr.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(fr.gcd, numbers)\n\nkk=1\nfor i in list(c):\n kk*=i\nlow=(kk)//gcd_list(list(c))\n\n\n \nprint(m//low//2+1)', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\n\ndef dividable_with_2(x):\n cnt=0\n while x%2==0:\n x//=2\n cnt+=1\n return cnt\n\neg=dividable_with_2(a[0])\n\nfor q in a:\n if dividable_with_2(q) != eg:\n print(0)\n exit()\n\ndef gcd(x,y):\n if y>x:\n y,x=x,y \n while y!=0:\n x,y=y,x%y\n return x\n\ndef lcm(x,y):\n return x*y//gcd(x,y)\n\nd=[i//2 for i in a]\nL=d[0]\nfor i in range(n):\n L=lcm(L,d[i])\n\nans=(m//L+1)//2\n\nprint(ans)\n\n \n ']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s105111252', 's238563734', 's795780019', 's761372617']
[23216.0, 23216.0, 17940.0, 14244.0]
[277.0, 269.0, 76.0, 511.0]
[445, 456, 409, 458]
p02814
u133347536
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nfrom functools import reduce\n\n\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef my_round(val, digit=0):\n p = 10 ** digit\n return (val * p * 2 + 1) // 2 / p\n\n\nn, m = list(map(int, input().split()))\na_pr = [i // 2 for i in list(map(int, input().split()))]\nlcm_ = lcm_list(a_pr)\nres, div2 = 0, None\nfor ai in a_pr:\n cnt = 0\n while a % 2 == 0:\n a //= 2\n cnt += 1\n if div2 is None:\n div2 = cnt\n elif cnt != div2:\n print(0)\n exit()\n\nprint(int(my_round(m // lcm_ / 2)))\n', 'import fractions\nn, m = list(map(int, input().split()))\na = sorted(list(map(int, input().split())))\na = [int(i/2) for i in a]\nnum_gcd = a[0]\nfor i in range(1, n):\n num_gcd = num_gcd * a[i] // fractions.gcd(num_gcd, a[i])\nprint(round((m // num_gcd) / 2))\n', 'import fractions\nimport math\nn, m = list(map(int, input().split()))\na = sorted(list(map(int, input().split())))\na = [int(i/2) for i in a]\nnum_gcd = a[0]\nfor i in range(1, n):\n num_gcd = num_gcd * a[i] // fractions.gcd(num_gcd, a[i])\nprint(math.ceil((m // num_gcd) / 2))\n', 'import math\nfrom functools import reduce\n\n\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef my_round(val, digit=0):\n p = 10 ** digit\n return (val * p * 2 + 1) // 2 / p\n\n\nn, m = list(map(int, input().split()))\na_pr = [i // 2 for i in list(map(int, input().split()))]\nlcm_ = lcm_list(a_pr)\nres, div2 = 0, None\nfor ai in a_pr:\n cnt = 0\n while ai % 2 == 0:\n ai //= 2\n cnt += 1\n if div2 is None:\n div2 = cnt\n elif cnt != div2:\n print(0)\n exit()\n\nprint(int(my_round(m // lcm_ / 2)))\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s087062186', 's378490201', 's442107472', 's636394610']
[21176.0, 16320.0, 16324.0, 20988.0]
[116.0, 160.0, 157.0, 417.0]
[668, 257, 273, 670]
p02814
u143509139
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from fractions import gcd\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nb = [0] * n\ng1 = a[0]\ng2 = a[0] // 2\nt = 0\nk = a[0]\nwhile k % 2 == 0:\n k //= 2\n t += 1\nfor i in range(n):\n c = 0\n g1 = lcm(g1, a[i])\n if g1 > m:\n break\n while a[i] % 2 == 0:\n a[i] //= 2\n c += 1\n if c != t:\n print(0)\n exit(0)\nfor i in range(n):\n g2 = lcm(g2, a[i])\n if g2 > m:\n break\nprint(m // g2 - m // g1)\n', 'from fractions import gcd\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nb = [0] * n\ng1 = a[0]\ng2 = a[0] // 2\nt = 0\nk = a[0]\nwhile k % 2 == 0:\n k //= 2\n t += 1\nfor x in a:\n c = 0\n g1 = lcm(g1, x)\n if g1 > m:\n break\n while x % 2 == 0:\n x //= 2\n c += 1\n if c != t:\n print(0)\n exit(0)\nfor i in range(n):\n g2 = lcm(g2, a[i] // 2)\n if g2 > m:\n break\nprint(m // g2 - m // g1)\n', 'from fractions import gcd\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nb = [0] * n\ng1 = a[0]\ng2 = a[0] // 2\nfor i in range(n):\n g1 = lcm(g1, a[i])\n if g1 > m:\n break\nfor i in range(n):\n g2 = lcm(g2, a[i] // 2)\n if g2 > m:\n break\nprint(m // g2 - m // g1)\n', 'from math import gcd\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nl = [0] * n\nfor i in range(n):\n tmp = a[i]\n while tmp % 2 == 0:\n tmp //= 2\n l[i] += 1\n if i > 0 and l[i] != l[i - 1]:\n print(0)\n exit(0)\nres = 1\nfor i in range(n):\n res = lcm(res, a[i] // 2)\nprint(m // res - m // (res * 2))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s388934943', 's550676800', 's670087875', 's079203039']
[16320.0, 16280.0, 16320.0, 20724.0]
[946.0, 832.0, 170.0, 501.0]
[521, 510, 353, 401]
p02814
u151785909
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n , m = map(int, input().split())\na = list(map(int,input().split()))\n\ndef gcd(num1,num2):\n r=1\n while r>0:\n r=num1%num2\n num1=num2\n num2=r\n return num1\n\ndef lcm(num1,num2):\n gcd1=gcd(num1,num2)\n return num1*num2//gcd1\n\nlcm1=a[0]//2\nlcm2=a[0]\n\nfor i in range(1,n):\n t=a[i]\n if lcm1//(t//2)%2==0:\n lcm1=0\n lcm2=0\n lcm1=lcm(lcm1,t//2)\n lcm2=lcm(lcm2,t)\n\n\nif lcm1!=0:\n ans1=m//lcm1\n ans2=m//lcm2\n ans=ans1-ans2\nelse:\n ans=0\n\nprint(ans)\n', 'n , m = map(int, input().split())\na = list(map(int,input().split()))\n\ndef gcd(num1,num2):\n r=1\n while r>0:\n r=num1%num2\n num1=num2\n num2=r\n return num1\n\ndef lcm(num1,num2):\n gcd1=gcd(num1,num2)\n return num1*num2//gcd1\n\nlcm1=a[0]//2\nlcm2=a[0]\n\nfor i in range(1,n):\n t=a[i]\n lcm1=lcm(lcm1,t//2)\n lcm2=lcm(lcm2,t)\n ta=max(t//2,lcm1)\n tb=min(t//2,lcm1)\n if ta!=tb and ta//tb%2==0:\n lcm1=0\n lcm2=0\n break\n\nif lcm1!=0:\n ans1=m//lcm1\n ans2=m//lcm2\n ans=ans1-ans2\nelse:\n ans=0\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s330793735', 's950767765']
[19904.0, 20000.0]
[128.0, 293.0]
[506, 568]
p02814
u167932128
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a / 2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\n\n# if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):\n# print(0)\n# exit(0)\n\n\nfor i in range(0, len(A)):\n if (A[i] / 2) % 2 == 0:\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\n\nprint(int(M/min_hankobaisu+1)/2)\n\n', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a /2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\nfor i in range(0, len(A) - 1):\n if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\nprint(min_hankobaisu)\n\nprint(int((M // min_hankobaisu) / 2 + 0.5))', "\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a / 2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\nfor i in range(0, len(A) - 1):\n if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):\n print(0)\n exit(0)\n\n\nif (A[0] / 2) % 2 == 0:\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\nprint('最小半公倍数:{}'.format(min_hankobaisu))\nprint(int(M/min_hankobaisu+1)/2)\n\n", '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef nankai_2de_warikireruka(n):\n i = 0\n for n in range(99999999999999):\n if n % 2 == 1 or n < 2:\n break\n n = n / 2\n i += 1\n return i\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a / 2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\np = nankai_2de_warikireruka(A[0])\n\nfor i in range(1, len(A)):\n pi = nankai_2de_warikireruka(A[i])\n if pi != p:\n print(0)\n exit(0)\n\n\n\n# if (A[i] / 2) % 2 == 0:\n# print(0)\n# exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\n\nprint(int(M/min_hankobaisu+1)/2)\n\n', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef nankai_2de_warikireruka(n):\n i = 0\n for n in range(99999999999999):\n if n % 2 == 1 or n < 2:\n break\n n = n / 2\n i += 1\n return i\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for i in range(9999999999999):\n result = A[0] * (0.5 + i)\n\n if result > M:\n print(0)\n exit(0)\n\n\n\n for j in range(1, len(A)):\n \n \n q, mod = divmod(result, A[j]/2)\n \n if q % 2 == 1 and mod == 0:\n if j == len(A)-1:\n return int(result)\n \n continue\n else:\n \n break\n\n\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\np = nankai_2de_warikireruka(A[0])\nfor i in range(1, len(A)):\n pi = nankai_2de_warikireruka(A[i])\n if pi != p:\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\n\nprint(int(M/min_hankobaisu+1)/2)\n\n', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a / 2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\nfor i in range(0, len(A) - 1):\n if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):\n print(0)\n exit(0)\n\n\nif (A[0] / 2) % 2 == 0:\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\n\nprint(int(M/min_hankobaisu+1)/2)\n\n', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\ndef min_hankobaisu(A):\n total_volume = 1\n for a in A:\n total_volume = int(total_volume * a / 2)\n return total_volume\n\ndef check_hankobaisu(A,try_X):\n for a in A:\n a = a/2\n if a == 1:\n continue\n\n\n if try_X % a != 0:\n\n return False\n while try_X >= a:\n if try_X % a == 0:\n try_X = try_X / a\n\n else:\n break\n\n if try_X == 1:\n return True\n\n return False\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\n\nhankobaisu_list = []\n\n\nmin_hankobaisu = min_hankobaisu(A)\n\n\nfor try_X in range(min_hankobaisu, M+1, min_hankobaisu):\n if check_hankobaisu(A, try_X):\n hankobaisu_list.append(try_X)\n\nprint(hankobaisu_list)\nprint(len(hankobaisu_list))', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for a in A:\n result = result * a /2\n if result > M:\n print(0)\n exit(0)\n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\nfor i in range(0, len(A) - 1):\n if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):\n print(0)\n exit(0)\n\n\nmin_hankobaisu = min_hankobaisu(A, M)\n\nprint(int(M/min_hankobaisu+1)/2)\n\n', '\n\n\n\n\n# N M\n# a1 a2 ... aN\n\n\n\ndef n_hankobaisu(M, min_hankobaisu):\n q = M // min_hankobaisu\n if q % 2 == 1:\n q += 1\n return int(q/2)\n\n\ndef nankai_2de_warikireruka(n):\n i = 0\n\n \n for i in range(0,99999999999):\n if n >= 1024 and n % 1024 == 0:\n n = n / 1024\n i += 10\n else:\n break\n\n for i in range(0,9999999999999999999):\n if n > 1:\n n, mod = divmod(n, 2)\n if mod == 1:\n break\n i += 1\n else:\n break\n\n return i\n\n\ndef min_hankobaisu(A, M):\n result = 1\n for i in range(9999999999999):\n result = A[0] * (0.5 + i)\n\n if len(A) == 1:\n return result\n\n if result > M:\n print(0)\n exit(0)\n\n for j in range(1, len(A)):\n q, mod = divmod(result, A[j]/2)\n if q % 2 == 1 and mod == 0:\n \n if j == len(A)-1:\n return int(result)\n continue\n else:\n break \n return int(result)\n\n\nN, M = map(int, input().split())\n\n\nA = list(set(list(map(int, input().split()))))\nA.sort(reverse=True)\n\n\n\n\np = nankai_2de_warikireruka(A[0])\n\nif N == 1:\n print(n_hankobaisu(M, min_hankobaisu(A, M)))\n exit(0)\n\nfor i in range(1, len(A)):\n pi = nankai_2de_warikireruka(A[i])\n if pi != p:\n print(0)\n exit(0)\n\n\n\n\n\n\nprint(n_hankobaisu(M, min_hankobaisu(A, M)))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s027451394', 's028449697', 's119490313', 's158370455', 's475947251', 's568597975', 's576912253', 's763477396', 's736648339']
[14124.0, 14244.0, 14244.0, 14400.0, 15060.0, 14244.0, 15060.0, 14124.0, 14244.0]
[44.0, 46.0, 46.0, 45.0, 2104.0, 44.0, 2104.0, 45.0, 45.0]
[1531, 1372, 1487, 1769, 2355, 1488, 1793, 1341, 2774]
p02814
u189513668
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['\nN, M = map(int, input().split())\nA = list(set(map(int, input().split())))\n\n#print(A)\n\nwhile not any(a % 2 for a in A):\n A = [a // 2 for a in A]\n\n#print(A)\n#print(all(a % 2 for a in A))\n\nif not all(a % 2 for a in A):\n print(0)\n exit()\n \n#print(1)\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \ndef lcm(a, b):\n return a * b // gcd(a, b)\n \nans = 1\nfor i in A:\n ans = lcm(ans, i)\n\nprint(ans)\nprint((M // ans + 1) // 2)', '#import sys\n\nN, M = map(int, input().split())\nA = list(set(map(int, input().split())))\n\nN = len(A)\nA = [a // 2 for a in A]\n\n\ndef lcm(x, y):\n xy = x * y\n while y != 0:\n x, y = y, x % y\n return xy // x\n\nLCM = A[0]\nfor i in range(1, N): \n LCM = lcm(LCM, A[i])\n print(LCM)\n \nif LCM > M:\n ans = 0\nelse:\n M //= LCM\n ans = (M + 1) // 2\n\nprint(ans)', 'N, M = map(int, input().split())\n\nA = list(set(map(int, input().split(" "))))\nG = A.copy()\n \nwhile not any(x % 2 for x in G):\n G = [i // 2 for i in G]\n \nif not all(x % 2 for x in G):\n print(0)\n exit(0)\n \ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \ndef lcm(a, b):\n return a * b // gcd(a, b)\n \ntotal = 1\n\nfor x in A:\n total = lcm(total, x // 2)\n\nprint((M // total + 1) // 2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s663253888', 's709752623', 's731229146']
[11356.0, 11356.0, 11128.0]
[44.0, 63.0, 42.0]
[460, 428, 419]
p02814
u193264896
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
["from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm(a, b):\n return a*b//gcd(a, b)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = a%2\n if b.sum() < n:\n ans = 0\n else:\n c = reduce(lcm, a)\n cnt = 0\n ans = ((m//c) + 1)//2\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = a%2\n if b.sum() < n:\n ans = 0\n else:\n c = lcm_list(a)\n ans = (m//c) - (m//(c+c))\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = np.copy(a)\n while True:\n c = b % 2\n if c.sum() == 0:\n b //= 2\n elif c.sum() == n:\n break\n else:\n print(0)\n sys.exit()\n d = lcm_list(a)\n if d > 10 ** 9:\n ans = 0\n else:\n ans = (m // d) - (m // (d + d))\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n c = lcm_list(a)\n if c>10**9 or c%2==0:\n ans = 0\n else:\n ans = (m//c) - (m//(c+c))\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = a%2\n if b.sum() < n:\n ans = 0\n else:\n c = lcm_list(a)\n if c>m:\n ans = 0\n else:\n ans = (m//c) - (m//(c+c))\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n c = lcm_list(a)\n if c>m:\n ans = 0\n else:\n ans = (m//c) - (m//(c+c))\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product, permutations,combinations\nfrom operator import itemgetter\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right, bisect\nfrom fractions import gcd\nfrom math import ceil,floor, sqrt, cos, sin, pi, factorial\nfrom functools import reduce\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nMOD = 10**9+7\ndef lcm(a, b):\n return a*b//gcd(a, b)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = a%2\n if b.sum() < n:\n ans = 0\n else:\n c = reduce(lcm, a)\n ans = (m+c)//(2*c)\n print(ans)\n \n \n \nif __name__ == '__main__':\n main()", "import sys\nfrom math import gcd\nfrom functools import reduce\nimport numpy as np\n \nread = sys.stdin.read\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef lcm_base(a, b):\n return (a * b) // gcd(a, b)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef main():\n n, m = map(int, readline().split())\n a = np.array(input().split(), np.int64)\n a //= 2\n b = np.copy(a)\n while True:\n c = b % 2\n if c.sum() == 0:\n b //= 2\n elif c.sum() == n:\n break\n else:\n print(0)\n sys.exit()\n d = lcm_list(a)\n if d > 10 ** 9:\n ans = 0\n else:\n ans = (m // d) - (m // (d + d))\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s065709559', 's454722397', 's478067987', 's483578541', 's630804813', 's733227972', 's981440853', 's185515563']
[27192.0, 27192.0, 9148.0, 27108.0, 27112.0, 27208.0, 27196.0, 39688.0]
[297.0, 301.0, 27.0, 775.0, 371.0, 764.0, 299.0, 245.0]
[1029, 1095, 730, 1089, 1133, 1075, 1014, 803]
p02814
u201234972
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
["def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return(a)\n\ndef lcm(a, b):\n return a*b//gcd(a,b)\n#import sys\n#input = sys.stdin.readline\ndef main():\n N, M = map( int, input().split())\n A = list( map( int, input().split()))\n B = [a for a in A]\n T = 1\n L = 1\n C = [0]*N\n for i in range(30):\n if B[i]%2 == 0:\n B[i] //= 2\n C[i] += 1\n p = C[0]\n for i in range(N-1):\n if p != C[i+1]:\n print(0)\n return\n q = pow(2,p)\n t = 1\n for i in range(N):\n t = lcm(1,t)\n m = t*q\n if m > M:\n print(0)\n return\n print((M-m)//(q*t)+1)\n\nif __name__ == '__main__':\n main()", "def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return(a)\n\ndef lcm(a, b):\n return a*b//gcd(a,b)\n#import sys\n#input = sys.stdin.readline\ndef main():\n N, M = map( int, input().split())\n A = list( map( int, input().split()))\n B = [a for a in A]\n T = 1\n L = 1\n C = [0]*N\n for i in range(N):\n for _ in range(30):\n if B[i]%2 == 0:\n B[i] //= 2\n C[i] += 1\n else:\n break\n p = C[0]\n for i in range(N-1):\n if p != C[i+1]:\n print(0)\n return\n q = pow(2,p)\n t = 1\n for i in range(N):\n t = lcm(t,B[i])\n m = t*q//2\n if m > M:\n print(0)\n return\n\n print((M-m)//m+1)\n\nif __name__ == '__main__':\n main()\n\n", "def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return(a)\n\ndef lcm(a, b):\n return a*b//gcd(a,b)\n#import sys\n#input = sys.stdin.readline\ndef main():\n N, M = map( int, input().split())\n A = list( map( int, input().split()))\n B = [a for a in A]\n T = 1\n L = 1\n C = [0]*N\n for i in range(N):\n for _ in range(30):\n if B[i]%2 == 0:\n B[i] //= 2\n C[i] += 1\n else:\n break\n p = C[0]\n for i in range(N-1):\n if p != C[i+1]:\n print(0)\n return\n q = pow(2,p)\n t = 1\n for i in range(N):\n t = lcm(t,A[i]//2)\n if t > M:\n print(0)\n return\n\n print((M-t)//(t*2) + 1)\n\nif __name__ == '__main__':\n main()\n\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s119641549', 's901608072', 's266153512']
[15060.0, 14244.0, 14244.0]
[45.0, 820.0, 821.0]
[689, 773, 767]
p02814
u243312682
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
["import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for a in A:\n \n # print(0)\n # exit()\n # if a_lcm // 2 % a == 0:\n # if (a_lcm / a) % 2 == 0: \n if a % 2 == 0:\n continue\n else:\n print(0)\n exit()\n # else:\n # continue\n \n if (a_lcm / 2) > m:\n # if a_lcm > m * 2:\n print(0)\n exit()\n else:\n \n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for a in A:\n print(0)\n exit(0)\n # if a_lcm / 2 % a == 0:\n # if (a_lcm / a) % 2 == 0: \n # print(0)\n # exit()\n # else:\n # continue\n \n # if (a_lcm / 2) > m:\n # # if a_lcm > m * 2:\n # print(0)\n # exit()\n # else:\n \n # ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\n\ndef main():\n def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\n def lcm(a, b):\n return (a // gcd(a, b)) * b\n\n n, m = map(int, input().split())\n \n A = set([int(x) for x in input().split()])\n \n # A = [int(x) for x in input().split()]\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for i in A:\n if (a_lcm / 2) % i == 0:\n # if (a_lcm / i) % 2 == 0: \n print(0)\n exit()\n # else:\n # continue\n \n if (a_lcm / 2) > m:\n # if a_lcm > m * 2:\n print(0)\n exit()\n # else:\n \n # ans = int((m - (a_lcm / 2))) // a_lcm + 1\n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n \n # a_lcm = a_lcm // 2\n \n \n \n # else:\n + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\n\ndef main():\n def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\n def lcm(a, b):\n return (a // gcd(a, b)) * b\n\n n, m = map(int, input().split())\n \n A = set([int(x) for x in input().split()])\n \n # A = [int(x) for x in input().split()]\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for i in A:\n if (a_lcm / 2) % i == 0:\n # if (a_lcm / i) % 2 == 0: \n print(0)\n exit()\n # else:\n # continue\n \n # if (a_lcm / 2) > m:\n if a_lcm > m * 2:\n print(0)\n else:\n ans = 1 \n print(ans)\n \n # ans = int((m - (a_lcm / 2))) // a_lcm + 1\n # ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n # print(ans)\n \n # a_lcm = a_lcm // 2\n \n \n \n # else:\n + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for a in A:\n \n # print(0)\n # exit()\n # if a_lcm // 2 % a == 0:\n # if (a_lcm / a) % 2 == 0: \n if a % 2 == 0:\n print(0)\n exit()\n # else:\n # continue\n \n if (a_lcm / 2) > m:\n # if a_lcm > m * 2:\n print(0)\n exit()\n else:\n \n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for a in A:\n \n print(a)\n exit()\n # if a_lcm / 2 % a == 0:\n # if (a_lcm / a) % 2 == 0: \n # print(0)\n # exit()\n # else:\n # continue\n \n if (a_lcm / 2) > m:\n # if a_lcm > m * 2:\n print(0)\n exit()\n else:\n \n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n print(1)\n # #else:\n # # a_lcm = a_lcm\n \n \n \n \n # # if (a_lcm / i) % 2 == 0: \n # print(0)\n # exit()\n # # else:\n # # continue\n \n # if (a_lcm / 2) > m:\n # # if a_lcm > m * 2:\n # print(0)\n # exit()\n # else:\n \n # ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "\ndef main():\n def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\n def lcm(a, b):\n return int(a / gcd(a, b)) * b\n \n n, m = map(int, input().split())\n A = set([int(x) for x in input().split()])\n a_ = A[0]\n for a in A[1:]:\n a_lcm = lcm(a_, a)\n a_ = a_lcm\n if a_lcm / 2 > m:\n print(0)\n else:\n ans = int((m - (a_lcm / 2))) // a_lcm + 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\n\ndef main():\n def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\n def lcm(a, b):\n return (a // gcd(a, b)) * b\n\n n, m = map(int, input().split())\n \n A = set([int(x) for x in input().split()])\n \n # A = [int(x) for x in input().split()]\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for i in A:\n if (a_lcm / 2) % i == 0:\n # if (a_lcm / i) % 2 == 0: \n print(0)\n exit()\n # else:\n # continue\n \n # if (a_lcm / 2) > m:\n if a_lcm > m * 2:\n print(0)\n else:\n \n # ans = int((m - (a_lcm / 2))) // a_lcm + 1\n # ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n # print(ans)\n \n # a_lcm = a_lcm // 2\n \n \n \n # else:\n + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\nimport sys\nsys.setrecursionlimit(10**7)\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = [int(x) for x in input().split()]\n # A_s = set(A)\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for a in A:\n print(0)\n exit()\n # if a_lcm / 2 % a == 0:\n # if (a_lcm / a) % 2 == 0: \n # print(0)\n # exit()\n # else:\n # continue\n \n # if (a_lcm / 2) > m:\n # # if a_lcm > m * 2:\n # print(0)\n # exit()\n # else:\n \n # ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()", "import copy\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\n\ndef main():\n n, m = map(int, input().split())\n \n A = set([int(x) for x in input().split()])\n \n # A = [int(x) for x in input().split()]\n # A_ = copy.deepcopy(A)\n # a_lcm = A.pop()\n a_lcm = 1\n \n #if len(A) >= 1:\n for a in A:\n a_lcm = lcm(a_lcm, a)\n #else:\n # a_lcm = a_lcm\n \n \n for i in A:\n if (a_lcm / 2) % i == 0:\n # if (a_lcm / i) % 2 == 0: \n print(0)\n exit()\n # else:\n # continue\n \n if (a_lcm / 2) > m:\n # if a_lcm > m * 2:\n print(0)\n exit()\n else:\n \n # ans = int((m - (a_lcm / 2))) // a_lcm + 1\n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n \n # a_lcm = a_lcm // 2\n \n \n \n # else:\n + 1\n # print(ans)\n\nif __name__ == '__main__':\n main()\n\n", "import copy\n# from math import gcd\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ndef lcm(a, b):\n return (a // gcd(a, b)) * b\ndef main():\n n, m = map(int, input().split())\n A = set([int(x) for x in input().split()])\n a_lcm = 1\n for a in A:\n a_lcm = lcm(a_lcm, a)\n \n if (a_lcm / 2) > m:\n print(0)\n exit()\n for a in A:\n if (a_lcm / 2) % a == 0:\n print(0)\n exit()\n \n ans = int((m - (a_lcm / 2)) // a_lcm) + 1\n print(ans)\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s003684973', 's046269169', 's099795224', 's134356437', 's165692231', 's257298241', 's302582663', 's422640474', 's770702114', 's784079557', 's868199248', 's819469539']
[20980.0, 20832.0, 21136.0, 21012.0, 20860.0, 20836.0, 21120.0, 19888.0, 8908.0, 21084.0, 21004.0, 20896.0]
[123.0, 118.0, 58.0, 58.0, 123.0, 115.0, 122.0, 52.0, 29.0, 124.0, 60.0, 57.0]
[1231, 1167, 1387, 1426, 1208, 1182, 1165, 500, 1390, 1166, 1441, 687]
p02814
u271934630
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\n\nif half_lcm > M:\n print(0)\n exit()\n\n\ntmp = M // half_lcm\nif (tmp) & 1:\n print(tmp // 2 + 1)\nelse:\n print(0)', 'import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\n\nif half_lcm > M:\n print(0)\n exit()\n\n\ntmp = M // half_lcm\nif (tmp) & 1:\n print(tmp // 2 + 1)\nelse:\n print(tmp // 2)', 'import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\n\nif half_lcm > M:\n print(0)\n exit()\n\n\ntmp = M // half_lcm\nif (tmp) & 1:\n print(round(tmp // 2) + 1)\nelse:\n print(tmp // 2)', 'import sys\nimport fractions\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\n\nans = 0\nhalf_lcm = lcm_list(a) // 2\n\na = set(a)\nfor i in range(half_lcm, M+1, half_lcm):\n if all(int((i / x * 2)) & 1 for x in set(a)):\n ans += 1\n\nprint(ans)', 'import sys\nimport fractions\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\n\nans = 0\nhalf_lcm = lcm_list(a) // 2\n\na = set(a)\nfor i in range(half_lcm, M+1, half_lcm):\n if all(int((i / x * 2)) & 1 for x in a):\n ans += 1\n\nprint(ans)', 'import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\n\nif half_lcm > M:\n print(0)\n exit()\n\n\ntmp = M // half_lcm\nif (tmp) & 1:\n print(tmp + 1 // 2)\nelse:\n print(0)', 'import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\n\nprint(round(M / half_lcm / 2))\n', 'import sys\nimport fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\na = [int(x) for x in input().split()]\nhalf_lcm = lcm_list(a) // 2\nif half_lcm > M:\n print(0)\n exit()\n\nprint(round(M / half_lcm / 2))\n', 'import sys\n# import fractions\nimport math\nfrom functools import reduce\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 7)\nstdin = sys.stdin\n\ndef gcd(a,b):\n while b:a,b=b,a%b\n return a\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\ndef lcm_list(l):\n return reduce(lcm, l, 1)\n\ni_i = lambda: int(i_s())\ni_l = lambda: list(map(int, stdin.readline().split()))\ni_s = lambda: stdin.readline().rstrip()\n\nN, M = i_l()\na = i_l()\nhalf_lcm = lcm_list(a) // 2\n\nfor i in a:\n if half_lcm // (i // 2) % 2 == 0:\n print(0)\n exit()\n\nprint(((M // half_lcm) + 1) // 2)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s032576714', 's184810834', 's430039836', 's501356743', 's513375485', 's521520138', 's879137844', 's884923027', 's976404296']
[16268.0, 16264.0, 16268.0, 16272.0, 16268.0, 16268.0, 16268.0, 16264.0, 14860.0]
[148.0, 149.0, 147.0, 2104.0, 65.0, 148.0, 148.0, 147.0, 228.0]
[474, 481, 488, 482, 472, 474, 386, 427, 578]
p02814
u278142467
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nn, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i//2 for i in a]\n\ndef f(x):\n cnt = 0\n while x%2 == 0:\n x /= 2\n cnt += 1\n return cnt\n\nt = f(a[0])\nfor i in range(1, t):\n if f(a[i]) != t:\n print(0)\n break\n a[i] //= 2 ** t\n\nlcm = a[0]\nfor i in range(1, n):\n lcm = lcm * a[i] // fractions.gcd(lcm, a[i])\n\nif lcm > m:\n ans = 0\nelse:\n m //= lcm\n ans = (m+1) // 2\nprint(ans)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i//2 for i in a]\n\ndef f(x):\n cnt = 0\n while x%2 == 0:\n x /= 2\n cnt += 1\n return cnt\n\ndef lcm(x, y):\n z = x * y\n if x < y:\n x, y = y, x\n while x%y != 0:\n x, y = y, x%y\n return z // y\n\nt = f(a[0])\nfor i in range(1, t):\n if f(a[i]) != t:\n print(0)\n break\n a[i] >>= t\nm >>= t\n\nL = a[0]\nfor i in range(1, n):\n L = lcm(L, a[i])\n if L > M:\n print(0)\n break\n\nm //= L\nans = (m+1) // 2\nprint(ans)', 'import sys\n\ndef f(x):\n cnt = 0\n while x%2 == 0:\n x /= 2\n cnt += 1\n return cnt\n\ndef gcd(x, y):\n if y:\n return gcd(y, x%y)\n else:\n return x\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i//2 for i in a]\n\nt = f(a[0])\nfor i in range(n):\n if f(a[i]) != t:\n print(0)\n sys.exit()\n a[i] >>= t\nm >>= t\n\nl = 1\nfor i in range(n):\n l = lcm(l, a[i])\n if l > m:\n print(0)\n sys.exit()\n\nm //= l\nans = (m+1) // 2\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s347904695', 's937964464', 's596806212']
[16284.0, 14244.0, 14244.0]
[168.0, 50.0, 795.0]
[430, 495, 515]
p02814
u285022453
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nimport functools\n\nn, m = map(int, input().split())\na = list(map(lambda x: x // 2, map(int, input().split())))\n\n\n\ndef lcm(a, b):\n y = a * b / fractions.gcd(a, b)\n return int(y)\n\n\n\ndef lcm_2(vals):\n return functools.reduce(lcm, vals)\n\n\nlc = lcm_2(a)\n\nans = m // lc\nif ans % 2 == 0:\n print(ans // 2)\nelse:\n print(ans // 2 + 1)\n', 'import functools\nimport sys\n\nn, m = map(int, input().split())\na = list(map(lambda x: x // 2, map(int, input().split())))\n\n\ndiv = 0\n\na_0 = a[0]\nwhile a_0 % 2 == 0:\n a_0 /= 2\n div += 1\n\n# print("count = " + str(div))#\n\n\nfor i in range(1, len(a)):\n div2 = 0\n a = a[i]\n while a % 2 == 0:\n a /= 2\n div2 += 1\n # print("A[" + str(i) + "] count = " + str(div2))#\n if div2 != div:\n print("0")\n sys.exit()\n\n\ndef gcd(x, y):\n if x == 0:\n return y\n\n return gcd(y % x, x)\n\n\ndef least_common_multiple(iter):\n \n lcm = lambda x, y: x * y // gcd(x, y)\n return functools.reduce(lcm, iter)\n\n\nlc = least_common_multiple(a)\nans = 0\na = 1\n\nans = m // lc\nif ans == 0:\n print(0)\n sys.exit()\nif ans % 2 == 0:\n print(ans // 2)\nelse:\n print(ans // 2 + 1)\n', 'import functools\nimport sys\n\nn, m = map(int, input().split())\na = list(map(lambda x: x // 2, map(int, input().split())))\na = set(a)\n\n\ndiv = 0\n\na_0 = a[0]\nwhile a_0 % 2 == 0:\n a_0 /= 2\n div += 1\n\n# print("count = " + str(div))#\n\n\nfor i in range(1, len(a)):\n div2 = 0\n a = a[i]\n while a % 2 == 0:\n a /= 2\n div2 += 1\n # print("A[" + str(i) + "] count = " + str(div2))#\n if div2 != div:\n print("0")\n sys.exit()\n\n\ndef gcd(x, y):\n if x == 0:\n return y\n\n return gcd(y % x, x)\n\n\ndef least_common_multiple(iter):\n \n lcm = lambda x, y: x * y // gcd(x, y)\n return functools.reduce(lcm, iter)\n\n\nlc = least_common_multiple(a)\nans = 0\na = 1\n\nans = m // lc\nif ans == 0:\n print(0)\n sys.exit()\nif ans % 2 == 0:\n print(ans // 2)\nelse:\n print(ans // 2 + 1)\n', 'import numpy as np\nimport fractions\nimport functools\n\n\n\ndef lcm(a, b):\n y = a * b / fractions.gcd(a, b)\n return int(y)\n\n\n\ndef lcm_2(vals):\n return functools.reduce(lcm, vals)\n\n\nn, m = map(int, input().split())\n\na = np.array(list(map(int, input().split())))\nlcm = lcm_2(a)\n\nhalf_lcm = lcm / 2\nans = 0\nflg = False\nwhile True:\n if not sum((half_lcm * 2) % a):\n flg = True\n break\n\n half_lcm += lcm\n if half_lcm > m:\n break\n\nif flg:\n ans = (m - half_lcm) // lcm + 1\n\nprint(int(ans))\n', 'import functools\nimport sys\n\nn, m = map(int, input().split())\na = list(map(lambda x: x // 2, map(int, input().split())))\n\n\ndiv = 0\n\na_0 = a[0]\nwhile a_0 % 2 == 0:\n a_0 /= 2\n div += 1\n\n# print("count = " + str(div))#\n\n\nfor i in range(1, len(a)):\n div2 = 0\n tmp_a = a[i]\n while tmp_a % 2 == 0:\n tmp_a /= 2\n div2 += 1\n # print("A[" + str(i) + "] count = " + str(div2))#\n if div2 != div:\n print("0")\n sys.exit()\n\n\ndef gcd(x, y):\n if x == 0:\n return y\n\n return gcd(y % x, x)\n\n\ndef least_common_multiple(iter):\n \n lcm = lambda x, y: x * y // gcd(x, y)\n return functools.reduce(lcm, iter)\n\n\nlc = least_common_multiple(a)\nans = 0\na = 1\n\nans = m // lc\nif ans == 0:\n print(0)\n sys.exit()\nif ans % 2 == 0:\n print(ans // 2)\nelse:\n print(ans // 2 + 1)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s178327490', 's518900787', 's562818722', 's616758073', 's539455822']
[16344.0, 14744.0, 14748.0, 24996.0, 14748.0]
[133.0, 61.0, 66.0, 2108.0, 1035.0]
[472, 994, 1005, 636, 1006]
p02814
u292091954
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\n\n\na = [0] * int(1e5 + 100)\n# functions\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\n\nfor i in range(2, n + 1) :\n gcd = math.gcd(lcm, a[i])\n #lcm = int(lcm * a[i] / gcd)\n if(lcm > m):\n flag = True\n break\n\nfor i in range (1, n + 1):\n if lcm / a[i] % 2 == 0 : flag = True\n\nif flag or lcm > m : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n', 'import math\n\n\na = [0] * int(1e5 + 100)\n# functions\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\nexit()\nfor i in range(1, n + 1) : \n gcd = math.gcd(lcm, a[i])\n lcm = int(lcm * a[i] / gcd)\n if(lcm > m):\n flag = True\n break\n\nfor i in range (1, n + 1):\n if lcm / a[i] % 2 == 0 : flag = True\n\nif flag or lcm > m : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n', 'import math\n\n\na = [0] * int(1e5 + 100)\n# functions\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\n\nfor i in range(1, n + 1) :\n gcd = math.gcd(lcm, a[i])\n lcm = int(lcm * a[i] / gcd)\n if(lcm > m):\n flag = True\n break\nexit()\nfor i in range (1, n + 1):\n if lcm / a[i] % 2 == 0 : flag = True\n\nif flag or lcm > m : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n', 'import math\n\n\na = [0] * int(1e5 + 100)\n# functions\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\n\nfor i in range(2, n + 1) :\n #gcd = math.gcd(lcm, a[i])\n #lcm = int(lcm * a[i] / gcd)\n if(lcm > m):\n flag = True\n break\n\nfor i in range (1, n + 1):\n if lcm / a[i] % 2 == 0 : flag = True\n\nif flag or lcm > m : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n', 'import math\n\n\na = [0] * int(1e5 + 100)\n# functions\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\n\nfor i in range(2, n + 1) :\n gcd = math.gcd(lcm, a[i])\n lcm = int(lcm * a[i] / gcd)\n if(lcm > m):\n flag = True\n break\nexit()\nfor i in range (1, n + 1):\n if lcm / a[i] % 2 == 0 : flag = True\n\nif flag or lcm > m : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n', '\na = [0] * int(1e5 + 100)\n# functions\ndef _gcd(a, b):\n if a % b == 0 : return b\n if b % a == 0 : return a\n while a != 1 and b != 1:\n if a > b: a %= b\n else : b %= a\n if a % b == 0: return b\n if b % a == 0: return a\n# main\n\nn, m = (int(s) for s in input().split())\n\ninp = input().split()\nfor i in range(1, n + 1) :\n a[i] = int(inp[i - 1])\n\nflag = False\nlcm = a[1]\n\nfor i in range(2, n + 1) :\n gcd = _gcd(lcm, a[i])\n lcm = int(lcm * a[i] / gcd)\n if(lcm > 2 * m):\n flag = True\n break\n\nfor i in range (1, n + 1):\n if int(lcm / a[i]) % 2 == 0 : flag = True\n\nif flag : print(0)\nelse : print(int( (m - int(lcm / 2)) / lcm ) + 1)\n']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s076888991', 's319024559', 's399565336', 's470008273', 's909840393', 's336195099']
[15020.0, 15020.0, 15020.0, 15020.0, 15020.0, 15012.0]
[62.0, 64.0, 63.0, 93.0, 62.0, 166.0]
[502, 508, 507, 503, 507, 696]
p02814
u313043608
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n,m=map(int,input().split())\na = list(map(int, input().split()))\n\ndef gcd(a,b):\n if(b==0):\n return a\n else:\n return gcd(b,a%b)\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\nb=[0]*n\nfor i in range(n):\n b[i]=a[i]//2\nflag=False\nf=0\nketa=0\nbuf=0\nwhile(buf>0):\n buf/=2\n keta+=1\nfor i in range(n):\n buf=b[i]\n tmp=0\n while(buf>0):\n buf/=2\n tmp+=1\n if(keta!=tmp):\n flag=True\nx=1\nif(b[0]%2==0):\n f=1\nfor i in range(n):\n x=lcm(x,b[i])\nres=m//x+1\nres//=2\n#print(x)\nif(flag):\n print(0)\nelse:\n print(res)\n', 'n,m=map(int,input().split())\na = list(map(int, input().split()))\n\ndef gcd(a,b):\n if(b==0):\n return a\n else:\n return gcd(b,a%b)\ndef lcm(a,b):\n return a*b//gcd(a,b)\nb=[0]*n\nfor i in range(n):\n b[i]=a[i]//2\nflag=False\nf=False\nfor i in range(n):\n if(b[i]%2!=b[0]%2):\n flag=True\nx=1\nif(b[0]%2==0):\n f=True\nfor i in range(n):\n x=lcm(x,b[i])\n\nif(f):\n l=0\nelse:\n res=m//x+1\n res//=2\nprint(x)\nif(flag):\n print(0)\nelse:\n print(res)\n', 'n,m=map(int,input().split())\na = list(map(int, input().split()))\n\ndef gcd(a,b):\n if(b==0):\n return a\n else:\n return gcd(b,a%b)\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\nb=[0]*n\nfor i in range(n):\n b[i]=a[i]//2\nflag=False\nf=0\nketa=0\nbuf=b[0]\nwhile(buf%2==0):\n buf/=2\n keta+=1\nfor i in range(n):\n buf=b[i]\n tmp=0\n while(buf%2==0):\n buf/=2\n tmp+=1\n if(keta!=tmp):\n flag=True\nx=1\nif(b[0]%2==0):\n f=1\nfor i in range(n):\n x=lcm(x,b[i])\nres=m//x+1\nres//=2\n#print(x)\nif(flag):\n print(0)\nelse:\n print(res)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s807787625', 's895224627', 's638056573']
[14400.0, 15060.0, 15060.0]
[2104.0, 194.0, 1087.0]
[560, 479, 569]
p02814
u314050667
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\n\nn,m = map(int, input().split())\na = list(map(int, input().split()))\n\ndef gcd(a,b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b,a%b)\n\nGCD = 1\nt = a[0]\ncond = 0\nwhile t%2 == 0:\n\tt //= 2\n\tcond += 1\n\t\nmod = 2**cond\nfor i in range(len(a)):\n\tt = a[i]\n\tt_div,t_mod = divmod(t,mod)\n\tif t_div == 0:\n\t\tprint(0)\n\t\tsys.exit()\n\tif mod != 0:\n\t\tprint(0)\n\t\tsys.exit()\n\tif t_div % 2 == 0:\n\t\tprint(0)\n\t\tsys.exit()\n\n\n\tGCD = GCD*a[i] // gcd(GCD,a[i])\n\t\nA = (2*m) // GCD\nif A%2 == 1:\n\tA+=1\n\nprint(A//2)', 'import sys\n\nn,m = map(int, input().split())\na = list(map(int, input().split()))\n\ndef gcd(a,b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b,a%b)\n\nGCD = 1\nt = a[0]\ncond = 0\nwhile t%2 == 0:\n\tt //= 2\n\tcond += 1\n\t\nmod = 2**cond\nfor i in range(len(a)):\n\tt,tt = divmod(a[i], mod)\n\tif t == 0 or tt != 0:\n\t\tprint(0)\n\t\tsys.exit()\n\tif t % 2 == 1:\n\t\tprint(0)\n\t\tsys.exit()\n\n\tGCD = GCD*a[i] // gcd(GCD,a[i])\n\t\nA = (2*m) // GCD\nif A%2 == 1:\n\tA+=1\n\nprint(A//2)', 'n, m = map(int,input().split())\np = list(map(int, input().split()))\nprint(0)', 'import sys\nimport numpy as np\nimport math\nN, M = map(int, input().split())\n\nA = np.array(list(map(int, input().split())), np.int64)\n\ncnt = 0\nwhile True:\n\tnum_E = np.count_nonzero(A % 2 == 0) \n\tif 0 < num_E < N:\n\t\tprint(0)\n\t\tsys.exit()\n\telif num_E == 0:\n\t\tcnt -= 1\n\t\tbreak\n\telse:\n\t\tcnt += 1\n\t\tA //= 2\n\ndef gcd(a,b):\n\tif b == 0:\n\t\treturn a\n\n\treturn gcd(b, a%b)\nlcm = A[0]\nfor i in range(1,N):\n\ttmp_gcd = gcd(lcm, A[i])\n\tlcm *= A[i]//tmp_gcd\n\tif lcm > M:\n\t\tprint(0)\n\t\tsys.exit()\nM = math.floor(M/(2**cnt))\n\nans = 1 + (M-lcm)//(2*lcm)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s102661650', 's197217018', 's624722901', 's570224164']
[14244.0, 14484.0, 14364.0, 23216.0]
[43.0, 43.0, 43.0, 585.0]
[486, 437, 76, 541]
p02814
u329407311
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nfrom functools import reduce\nimport math\ndef lcm_base(x, y):\n return int((x * y) // fractions.gcd(x, y))\ndef lcm_list(numbers):\n return int(reduce(lcm_base, numbers, 1))\n\nN,M = map(int,input().split())\nList=list(map(int,input().split()))\naa = int(lcm_list(List)/2)\ncnt = 0\na=List[0]\nwhile a%2 == 0:\n cnt+=1\n a = int(a/2)\nout = 0\nif cnt == 0:\n out = 1\n cnt = 1\nfor i in range(len(List)):\n if List[i] % (2**cnt) > 0:\n out = 1\n elif List[i] % (2**(cnt+1)) == 0:\n out = 1\n\nif out == 1:\n print(0)\nelse:\n print(int(math.ceil((M / aa)) // 2))', 'import fractions\nfrom functools import reduce\nimport math\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN,M = map(int,input().split())\nList=list(map(int,input().split()))\naa = int(lcm_list(List)/2)\ncnt = 0\na = List[0]\nwhile a%2 == 0:\n cnt+=1\n a = int(a/2)\nout = 0\nif cnt == 0:\n out = 1\n cnt = 1\nfor i in range(len(List)):\n if List[i] % (2**cnt) > 0:\n out = 1\n if List[i] % (2**(cnt+1)) == 0:\n out = 1\n\nif out == 1:\n print(0)\nelse:\n print(int(math.ceil((M / aa)) // 2))', 'import fractions\n\nN,M=map(int,input().split())\nList = list(map(int, input().split()))\n\nans = List[0]\nfor i in range(1, N):\n ans = ans * List[i] // fractions.gcd(ans, List[i])\n\nans = ans // 2\nif ans % 2 == 0:\n print(0)\nelse:\n print(int((M / ans + 1) // 2))', 'import fractions\n\nN,M=map(int,input().split())\nList = list(map(int, input().split()))\n\nans = List[0]\nfor i in range(1, N):\n ans = ans * List[i] // fractions.gcd(ans, List[i])\n\nans = ans // 2\n \nprint(int((M / ans + 1) // 2))', 'import fractions\n\nN,M=map(int,input().split())\nList = list(map(int, input().split()))\n\nans = List[0]\nfor i in range(1, N):\n ans = ans * List[i] // fractions.gcd(ans, List[i])\n\nans = ans // 2\naa = max(List) * 0.5\n\nx = aa // ans\nans = x * ans\n\n\nprint(int((M / ans + 1) // 2))', 'import fractions\nfrom functools import reduce\nimport math\ndef lcm_base(x, y):\n return int((x * y) // fractions.gcd(x, y))\ndef lcm_list(numbers):\n return int(reduce(lcm_base, numbers, 1))\n\nN,M = map(int,input().split())\nList=list(map(int,input().split()))\naa = int(lcm_list(List)/2)\ncnt = 0\na=List[0]\nwhile a%2 == 0:\n cnt+=1\n a = int(a/2)\nout = 0\nif cnt == 0:\n out = 1\n cnt = 1\nfor i in range(len(List)):\n if List[i] % (2**cnt) == 1:\n out = 1\n elif List[i] % (2**(cnt+1)) == 0:\n out = 1\n\nif out == 1:\n print(0)\nelse:\n print(int(math.ceil((M / aa)) // 2))', 'N, M = map(int, input().split())\nA = list(set(map(lambda x : int(x)//2, input().split())))\ndef gcd(x, y):\n return x if y == 0 else gcd(y, x % y)\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\nl = A[0]\nfor a in A[1:]:\n l = lcm(l, a)\nans = (M // l + 1) // 2\nfor a in A[1:]:\n if (l // a) % 2 == 0:\n ans = 0\n break\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s259592778', 's367140092', 's466967517', 's682188252', 's866611662', 's955185102', 's595879612']
[16308.0, 16308.0, 16280.0, 16280.0, 16324.0, 16308.0, 11132.0]
[219.0, 215.0, 2104.0, 2104.0, 2104.0, 229.0, 57.0]
[572, 562, 260, 227, 276, 573, 329]
p02814
u335599768
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef gcd(a,b):\n while b > 0:\n a, b = b, a % b\n return a\n\n\nG = A[0]/2\nfor a in A[1:]:\n print(G)\n G *= (a/2)/gcd(G,a//2)\n\nif M//G % 2 == 0:\n print(int(M//G/2))\nelse:\n print(int(M//G//2 + 1))', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef gcd(a,b):\n while b > 0:\n a, b = b, a % b\n return a\n\n\nG = A[0]/2\nfor a in A[1:]:\n G *= (a/2)/gcd(G,a//2)\nfor a in A:\n if G % a == 0:\n print(0)\n exit()\nprint(int(M//G - M//G//2))']
['Wrong Answer', 'Accepted']
['s371741164', 's733494180']
[19796.0, 20080.0]
[127.0, 90.0]
[282, 283]
p02814
u363421241
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n, m = map(int, input().split())\na = list(map(int, input().split()))\nprint(0)', 'import math\nfrom functools import reduce\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\na0 = A[0]\ncnt = 0\nwhile a0%2 == 0:\n a0 //= 2\n cnt += 1\n\na = []\nfor aa in A:\n if cnt == 1:\n if aa%4 == 0:\n print(0)\n exit()\n else:\n if aa%(2**(cnt-1)) != 0 or aa%(2**cnt) != 0 or aa%(2**(cnt+1)) == 0:\n print(0)\n exit()\n a.append(aa//2)\n\n\ndef lcm_base(p, q):\n return (p * q) // math.gcd(p, q)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\nlcm = lcm_list(a)\nprint(m//lcm - m//(lcm*2))']
['Wrong Answer', 'Accepted']
['s254135280', 's695356520']
[19968.0, 21304.0]
[52.0, 190.0]
[77, 589]
p02814
u364027015
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nimport numpy as np\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nc=1\ntest=A[0]\nl=0\n\nwhile test%2 == 0:\n test=test//2\n c*=2\n \nfor i in np.arange(N-1):\n if A[i+1]%c!=0:\n print(0)\n l=1\n break\n elif A[i+1]%(c*2)==0:\n print(0)\n l=1\n break\n else:\n k=A[i+1]//c\n test=test*k//math.gcd(test,k)\nif l==0:\n k=test*c/2\n', 'import math\nimport numpy as np\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nc=1\ntest=A[0]\nl=0\n\nwhile test%2 == 0:\n test=test//2\n c*=2\n \nfor i in np.arange(N-1):\n if A[i+1]%c!=0:\n print(0)\n l=1\n break\n elif A[i+1]%(c*2)==0:\n print(0)\n l=1\n break\n else:\n k=A[i+1]//c\n test=test*k//math.gcd(test,k)\nif l==0:\n k=test*c//2\n print(M//k//2+M//k%2)']
['Runtime Error', 'Accepted']
['s303948082', 's076918248']
[38068.0, 38408.0]
[297.0, 298.0]
[365, 389]
p02814
u374531474
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from math import gcd\nfrom functools import reduce\nN, M = map(int, input().split())\na = list(map(int, input().split()))\n\nhalf_a = [ai // 2 for ai in a]\nL = reduce(lambda x, y: x * y // gcd(x, y), half_a)\n', 'from fractions import gcd\nfrom functools import reduce\n\nN, M = map(int, input().split())\na = list(map(int, input().split()))\n\nhalf_a = [ai // 2 for ai in a]\nL = reduce(lambda x, y: x * y // gcd(x, y), half_a)\nprint((M - L) // (2 * L) + 1)\n', 'from fractions import gcd\nfrom functools import reduce\n\nN, M = map(int, input().split())\na = list(map(int, input().split()))\n\nhalf_a = [ai // 2 for ai in a]\nL = reduce(lambda x, y: x * y // gcd(x, y), half_a)\nprint((M - L) // (2 * L) + 1 if M >= L else 0)\n', 'from functools import reduce\n\nN, M = map(int, input().split())\na = list(map(int, input().split()))\n\n\ndef f(x):\n c = 0\n while x % 2 == 0:\n x //= 2\n c += 1\n return c\n\n\ndef gcd(x, y):\n return gcd(y, x % y) if y != 0 else x\n\n\nnth = [f(ai) for ai in a]\nif len(set(nth)) == 1:\n half_a = [ai >> 1 for ai in a]\n L = reduce(lambda x, y: x * y // gcd(x, y), half_a)\n ans = (M - L) // (2 * L) + 1 if M >= L else 0\nelse:\n ans = 0\nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s150692478', 's200482992', 's892255161', 's646265783']
[2940.0, 16236.0, 16348.0, 14748.0]
[18.0, 148.0, 152.0, 499.0]
[203, 239, 256, 467]
p02814
u375616706
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N,M = map(int,input().split())\nA = list(map(lambda x:int(x)//2,input().split()))\n\nif(all(A[0]%2 == a%2 for a in A)):\n pass\nelse:\n print(0)\n\n', 'def gcd(a,b):\n a,b = max(a,b),min(a,b)\n while b:\n a,b = b,a%b\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\nN,M = map(int,input().split())\nA = list(map(lambda x:int(x)//2,input().split()))\n\nif(all(A[0]%2 == a%2 for a in A)):\n lcm_A = lcm(A[0],A[1])\n for a in A[2:]:\n lcm_A = lcm(lcm_A,a)\n print((M/lcm_A+1)//2)\nelse:\n print(0)\n\n', 'def cnt_div2(n):\n cnt=0\n while n%2==0:\n n//=2\n cnt+=1\n return cnt\ndef gcd(a,b):\n a,b = max(a,b),min(a,b)\n while b:\n a,b = b,a%b\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\nN,M = map(int,input().split())\nA = list(map(lambda x:int(x)//2,input().split()))\n\nif(all(cnt_div2(A[0]) == cnt_div2(a) for a in A)):\n if N==1:\n lcm_A = A[0]\n else:\n lcm_A = lcm(A[0],A[1])\n for a in A[2:]:\n lcm_A = lcm(lcm_A,a)\n print(int((M/lcm_A+1)//2))\nelse:\n print(0)\n\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s333122226', 's607227587', 's984436791']
[14892.0, 14244.0, 15060.0]
[77.0, 201.0, 937.0]
[146, 368, 534]
p02814
u380524497
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\n\n\ndef lcm(a, b):\n return a * b // fractions.gcd(a, b)\n\n\ndef div_count_by_2(x):\n count = 0\n while x % 2 == 0:\n count += 1\n x //= 2\n\n return count\n\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nnum = A[0]\ncount = div_count_by_2(num)\nfor a in A:\n if count == div_count_by_2(a):\n continue\n else:\n print(0)\n exit()\n\nx = A[0]\nfor a in A:\n x = lcm(x, a)\n\nans = (m - x//2) // x + bool((m - x//2) % x)\nprint(ans)', 'import fractions\n\n\ndef lcm(a, b):\n return a * b // fractions.gcd(a, b)\n\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nx = A[0]\ny = A[0] // 2\n\nfor a in A:\n x = lcm(x, a)\n y = lcm(y, a//2)\n\n\nans1 = m // x + bool(m%x)\nans2 = m // y + bool(m%y)\n\nprint(ans2 - ans1)\n\n', 'import fractions\n\n\ndef lcm(a, b):\n return a * b // fractions.gcd(a, b)\n\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nx = A[0]\n\nfor a in A:\n x = lcm(x, a)\n\nm -= x//2\nans = m // x + bool(m%x)\n\nprint(ans)\n\n', 'from math import gcd\nfrom functools import reduce\nimport sys\ninput = sys.stdin.readline\n\n\ndef lcm(a, b):\n return a*b // gcd(a, b)\n\n\ndef count_factor_2(num):\n count = 0\n while num % 2 == 0:\n num //= 2\n count += 1\n return count\n\n\ndef main():\n n, m = map(int, input().split())\n A = list(map(lambda x: x//2, set(map(int, input().split()))))\n\n check = len(set(map(count_factor_2, A)))\n if check != 1:\n print(0)\n return\n\n lcm_a = reduce(lcm, A)\n step = lcm_a * 2\n ans = (m + lcm_a) // step\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s001758335', 's583066799', 's814382521', 's348353397']
[16316.0, 16324.0, 16320.0, 18208.0]
[514.0, 254.0, 2104.0, 51.0]
[501, 296, 235, 600]
p02814
u392319141
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef gcd(m, n):\n if n == 0:\n return m\n return gcd(n, m % n)\n\nLCM = A[0]\nfor a in A:\n LCM = LCM * a // gcd(LCM, a)\n\nprint(LCM)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef gcd(n, m):\n if m == 0:\n return n\n return gcd(m, n % m)\n\nK = A[0]\nLCM = K\nfor a in A:\n K = gcd(K, a)\n LCM = LCM * a // K\n\nprint(LCM)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nB = set([a & (-a) for a in A])\nif len(B) > 1:\n print(0)\n exit()\n\ndef gcd(n, m):\n if m == 0:\n return n\n return gcd(m, n % m)\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\nA = [a // 2 for a in A]\nLCM = A[0]\nfor a in A:\n LCM = lcm(LCM, a)\n\nans = ((M // LCM) + 1) // 2\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s488943516', 's743076044', 's198355055']
[14892.0, 14124.0, 14244.0]
[133.0, 2104.0, 158.0]
[210, 224, 369]
p02814
u402652772
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['#!/usr/bin/env python\n\nfrom sys import stdin\nfrom math import ceil\n\nN, M = (int(wd) for wd in stdin.readline().split())\na = [int(wd) for wd in stdin.readline().split()]\n\ndef kouyakusuu(g1, g2):\n if g1 < g2:\n return kouyakusuu(g2, g1)\n if g2 == 0:\n return g1\n return kouyakusuu(g2, g1 % g2)\n\ndef koubaisuu(g1, g2):\n return (g1 * g2) // kouyakusuu(g1, g2)\n\ndef gojohou(A, B):\n C = A % B\n if C == 0:\n return (1, -(A // B) + 1, B)\n b, c, d = gojohou(B, C)\n return (c, b - c * (A // B), d)\n\ndef jouyo(A, a, B, b):\n C = kouyakusuu(A, B)\n if C != 1:\n if a % C != b % C:\n return None\n nB = B // C\n return jouyo(A, a, nB, b % nB)\n aa, bb, cc = gojohou(A, B)\n assert cc == 1\n ret = bb * B * a + aa * A * b\n return A * B, ret % (A * B)\n\ncur = (a[0], a[0] // 2)\nfor aa in a[1:]:\n cur = jouyo(cur[0], cur[1], aa, aa//2)\n if cur is None:\n break\n#print(cur)\nif cur is None:\n print(0)\nelse:\n print(int(ceil((M - cur[1]) / cur[0] + 1)))\n', '#!/usr/bin/env python\n\nfrom sys import stdin\nfrom math import ceil\n\nN, M = (int(wd) for wd in stdin.readline().split())\na = [int(wd) for wd in stdin.readline().split()]\n\ndef kouyakusuu(g1, g2):\n if g1 == 0 or g2 == 0:\n return g1\n return kouyakusuu(g2, g1 % g2)\n\ndef jouyo(g1, g2):\n M1, P1 = g1\n M2, P2 = g2\n if M1 < M2:\n M1, M2 = M2, M1\n P1, P2 = P2, P1\n ret = P1\n for _ in range(M2):\n if ret % M2 == P2:\n break\n ret += M1\n pass\n if ret % M2 != P2:\n return None\n return (M1 * M2 / kouyakusuu(M1, M2), ret)\n\ncur = (a[0], a[0] // 2)\nfor aa in a[1:]:\n cur = jouyo(cur, (aa, aa//2))\n if cur is None:\n break\nif cur is None:\n print(0)\nelse:\n print(int(ceil((M - cur[1]) / cur[0] + 1)))\n', '#!/usr/bin/env python\n\nfrom sys import stdin\nfrom math import floor\n\nN, M = (int(wd) for wd in stdin.readline().split())\na = [int(wd) for wd in stdin.readline().split()]\n\ndef kouyakusuu(g1, g2):\n if g1 < g2:\n return kouyakusuu(g2, g1)\n if g2 == 0:\n return g1\n return kouyakusuu(g2, g1 % g2)\n\ndef koubaisuu(g1, g2):\n return (g1 * g2) // kouyakusuu(g1, g2)\n\n\n\n\ndef solve2(N, M, a):\n ret = 1\n cnt2 = 1\n while a[0] % (2**cnt2) == 0: cnt2 += 1\n ng = 2 ** cnt2\n cnt2 -= 1\n ok = 2 ** cnt2\n for aa in a:\n if aa % ng == 0:\n return 0\n if aa % ok != 0:\n return 0\n ret = koubaisuu(ret, aa // 2)\n return int(floor((M - ret) / (ret * 2)) + 1)\n\nprint(solve2(N, M, a))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s088742864', 's847600668', 's308165268']
[14244.0, 14264.0, 14244.0]
[564.0, 2104.0, 161.0]
[1034, 786, 746]
p02814
u433375322
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\ndef lcm(x,y):\n return(x*y)//math.gcd(x,y)\nn,m=map(int,input().split())\nl=list(map(int,input().split()))\na=l[0]//2\nfor i in range(n-1):\n a=lcm(a,l[i+1]//2)\n \nok = True\nfor aa in l:\n if (a//aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m//a)+1)//2\nprint(ans)', 'import math\ndef lcm(x,y):\n return(x*y)//math.gcd(x,y)\nn,m=map(int,input().split())\nl=list(map(int,input().split()))\na=l[0]//2\nfor i in range(n-1):\n a=lcm(a,l[i+1]//2)\n \nok = True\nfor i in range(n):\n if (a//(l[i]//2))%2!=1:\n ok=False\n break\nans = 0\nif ok:\n ans = ((m//a)+1)//2\nprint(ans)']
['Wrong Answer', 'Accepted']
['s429185995', 's647732218']
[20276.0, 20088.0]
[125.0, 212.0]
[305, 302]
p02814
u475503988
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nimport sys\nreadline = sys.stdin.buffer.readline\nN, M = map(int, readline().split())\na = list(map(int, readline().split()))\n# print(N, M, a)\n\ntmp = 1\nfor x in a:\n x //= 2\n tmp2 = x // fractions.gcd(tmp, x)\n M //= tmp2\n tmp *= tmp2\n\nans = (M + 1) // 2\nprint(ans)\n', 'import fractions\nimport sys\nreadline = sys.stdin.buffer.readline\nN, M = map(int, readline().split())\na = list(map(int, readline().split()))\n# print(N, M, a)\n\ndef lcm(a, b):\n\treturn a * b // fractions.gcd(a, b)\ntmp = 1\nfor x in a:\n tmp = lcm(tmp, x//2)\n# print(tmp)\nans = (M // tmp + 1) // 2\nprint(ans)\n', 'import fractions\nimport sys\nreadline = sys.stdin.buffer.readline\nN, M = map(int, readline().split())\na = list(map(int, readline().split()))\n# print(N, M, a)\n\nMOD = 10**9 + 7\n\ntmp = 1\nfor x in a:\n x //= 2\n tmp2 = x // fractions.gcd(tmp, x)\n M //= tmp2\n tmp *= tmp2\n tmp %= MOD\n\nans = (M + 1) // 2\nprint(ans)', 'def gcd(a,b):\n if b:\n return gcd(b,a%b)\n else:\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\ndef f(x):\n res = 0\n while x%2==0:\n x //= 2\n res += 1\n return res\n\ndef main():\n import sys\n readline = sys.stdin.buffer.readline\n N, M = map(int, readline().split())\n a = list(map(int, readline().split()))\n for i in range(N):\n a[i] //= 2\n\n t = f(a[0])\n for i in range(N):\n if f(a[i]) == t:\n a[i] >>= t\n else:\n print(0)\n return\n M >>= t\n\n l = 1\n for i in range(N):\n l = lcm(l, a[i])\n if l > M:\n print(0)\n return\n\n M //= l\n ans = (M + 1) // 2\n print(ans)\n\nmain()']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s125180424', 's159830536', 's367061431', 's974751221']
[14556.0, 14540.0, 14560.0, 12528.0]
[2104.0, 2104.0, 247.0, 500.0]
[290, 305, 321, 729]
p02814
u489691149
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from math import gcd\nfrom functools import reduce\n\nn,m=map(int,input().split())\nlst=list(map(lambda x : int(x)//2,input().split()))\ndivi=lst[0]//2\nfor i in range(1,n):\n if lst[i]//2!=divi:\n print(0)\n exit()\n\nwork=reduce(lambda x,y: x*y//gcd(x,y),lst)\nprint((m//work+1)//2)', 'from math import gcd\nfrom functools import reduce\n\nn,m=map(int,input().split())\nlst=list(map(lambda x : int(x)//2,input().split()))\ndivi=0\nx=lst[0]\nwhile x%2==0:\n x//=2\n divi+=1\n\nfor i in range(1,n):\n divi2=0\n x=lst[i]\n while x%2==0:\n x//=2\n divi2+=1\n if divi!=divi2 :\n print(0)\n exit()\n\nwork=reduce(lambda x,y: x*y//gcd(x,y),lst)\nprint((m//work+1)//2)']
['Wrong Answer', 'Accepted']
['s009764613', 's078040332']
[21212.0, 21076.0]
[91.0, 448.0]
[289, 398]
p02814
u489959379
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nimport math\n\ndef lcm(x, y):\n return (x * y) / fractions.gcd(x, y)\n\nn, m = map(int, input().split())\na = [i // 2 for i in set(list(map(int, input().split())))]\nb = []\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i /= 2\n cnt += 1\n b.append(cnt)\n\nL = 1\nif len(set(b)) == 1:\n for j in a:\n L = lcm(L, j)\n if m < L:\n print(0)\n break\n\n print(int(math.ceil(m / L) // 2))\nelse:\n print(0)\n', 'import numpy as np\nimport math\nimport fractions\nfrom functools import reduce\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nn, m = map(int, input().split())\na = np.array(list(map(int, input().split())))\n\nwhile all(a % 2 == 0):\n a = a / 2\n\nans = 0\nfor i in a:\n if i % 2 == 0:\n ans = 0\n break\n else:\n ans = math.ceil((math.floor(m / lcm(*a))) / 2)\n if lcm(*a) == 1:\n ans -= 1\n\nprint(int(ans))\n', 'import numpy as np\nimport fractions\nfrom functools import reduce\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nn, m = map(int, input().split())\na = np.array(list(map(int, input().split())))\na_d = a // 2\n\nans = m / lcm(*a_d) / 2\nif ans.is_integer():\n ans = m // lcm(*a_d) // 2 - 1\n print(int(ans))\nelse:\n ans = round(m / lcm(*a_d) / 2)\n print(int(ans))', 'import fractions\nimport math\n\ndef lcm(x, y):\n return (x * y) // fractions.gcd(x, y)\n\nn, m = map(int, input().split())\na = [i // 2 for i in set(list(map(int, input().split())))]\nb = []\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i //= 2\n cnt += 1\n b.append(cnt)\n\nL = 1\nif len(set(b)) == 1:\n for j in a:\n L = lcm(j, L)\n if m < L:\n print(0)\n break\n print(int((m // L + 1) // 2))\nelse:\n print(0)', 'import fractions\nimport math\n\ndef lcm(x, y):\n return (x * y) / fractions.gcd(x, y)\n\nn, m = map(int, input().split())\na = [i // 2 for i in set(list(map(int, input().split())))]\nb = []\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i /= 2\n cnt += 1\n b.append(cnt)\n\nL = 1\nif len(set(b)) == 1:\n for j in a:\n L = lcm(L, j)\n if m < L:\n print(0)\n break\n\n print(int((m // L + 1) // 2))\nelse:\n print(0)\n', 'import numpy as np\nimport math\nimport fractions\nfrom functools import reduce\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nn, m = map(int, input().split())\na = np.array(list(map(int, input().split())))\na_d = a // 2\n\nfor i in a_d:\n if i % 2 == 0:\n ans = 0\n break\n else:\n ans = math.ceil(m / lcm(*a_d) / 2)\n\nprint(int(ans))', 'import fractions\n\ndef lcm(x, y):\n return (x * y) / fractions.gcd(x, y)\n\nn, m = map(int, input().split())\na = [i // 2 for i in set(list(map(int, input().split())))]\nb = []\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i /= 2\n cnt += 1\n b.append(cnt)\n\nL = 1\nif len(set(b)) == 1:\n for j in a:\n L = lcm(L, j)\n if m < L:\n print(0)\n else:\n print(int((m // L) - (m // (2 * L))))\nelse:\n print(0)\n', 'from fractions import gcd\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\nn, m = map(int, input().split())\na = [i // 2 for i in set(list(map(int, input().split())))]\nb = []\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i //= 2\n cnt += 1\n b.append(cnt)\n\nL = 1\nif len(set(b)) == 1:\n for j in a:\n L = lcm(j, L)\n if m < L:\n print(0)\n break\n\n print((m // L + 1) // 2)\nelse:\n print(0)\n', "import sys\nfrom math import gcd\nfrom copy import deepcopy\n\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\ndef resolve():\n n, m = map(int, input().split())\n A = list(map(int, input().split()))\n\n A_ = deepcopy(A)\n cnt = [0] * n\n for i in range(n):\n while A_[i] % 2 == 0:\n A_[i] //= 2\n cnt[i] += 1\n if i != 0 and cnt[i] != cnt[i - 1]:\n print(0)\n exit()\n\n L = 1\n for a in A:\n L = lcm(L, a // 2)\n\n res = m // L - (m // (L * 2))\n print(res)\n\n\nif __name__ == '__main__':\n resolve()\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s122856575', 's310931578', 's428112828', 's552356559', 's716441607', 's782860983', 's798019521', 's898384933', 's971435865']
[16320.0, 24928.0, 24940.0, 16280.0, 16280.0, 24932.0, 16312.0, 16316.0, 21024.0]
[62.0, 2112.0, 1535.0, 62.0, 63.0, 2109.0, 2104.0, 65.0, 508.0]
[463, 516, 441, 459, 459, 426, 442, 441, 669]
p02814
u490305870
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['def main():\n N, M = map(int, input().split())\n A = tuple(map(int,input().split()))\n ans = count(A, N, M)\n print(ans)\ndef count(A, N, M):\n t = hMt(A[0])\n B = [A[0]//(2**t)]\n for val in A[1:]:\n if hMt(val) != t:\n ans = 0\n return ans\n B.append(val//(2**t))\n T = nlcm(B)\n MdivT = (M//(2**t))//T\n ans = countodd(MdivT)\n return ans\ndef countodd(M):\n if M%2 == 0:\n ans = M//2\n else:\n ans = M//2 + M%2\n return ans\ndef nlcm(A):\n LCM = A[0]\n for val in A[1:]:\n #print("%d %d gcm:%d LCM:%d"%(LCM,val,gcm(LCM,val),lcm(LCM,val)))\n LCM = lcm(LCM,val)\n return LCM\n \ndef gcm(a, b):\n abtuple = (a,b)\n abmin = min([0,1], key=lambda x:abtuple[x])\n remainder = abtuple[1-abmin]%abtuple[abmin]\n if remainder == 0:\n return abtuple[abmin]\n return gcm(abtuple[abmin], remainder)\ndef lcm(a,b):\n prod = a*b\n ans = prod//gcm(a,b)\n return ans\ndef hMt(num):\n ans = 0\n tmp = num\n while tmp%2 == 0:\n tmp = tmp//2\n ans += 1\n return ans\nmain()', 'def main():\n N, M = map(int, input().split())\n A = tuple(map(int,input().split()))\n ans = count(A, N, M)\n print(ans)\ndef count(A, N, M):\n t = hMt(A[0])\n B = [A[0]//(2**t)]\n for val in A[1:]:\n if hMt(val) != t:\n ans = 0\n return ans\n B.append(val//(2**t))\n T = nlcm(B)\n MdivT = (M//(2**(t-1)))//T\n ans = countodd(MdivT)\n return ans\ndef countodd(num):\n if num%2 == 0:\n ans = num//2\n else:\n ans = num//2 + num%2\n return ans\ndef nlcm(A):\n LCM = A[0]\n for val in A[1:]:\n #print("%d %d gcm:%d LCM:%d"%(LCM,val,gcm(LCM,val),lcm(LCM,val)))\n LCM = lcm(LCM,val)\n return LCM\n \ndef gcm(a, b):\n abtuple = (a,b)\n abmin = min([0,1], key=lambda x:abtuple[x])\n remainder = abtuple[1-abmin]%abtuple[abmin]\n if remainder == 0:\n return abtuple[abmin]\n return gcm(abtuple[abmin], remainder)\ndef lcm(a,b):\n prod = a*b\n ans = prod//gcm(a,b)\n return ans\ndef hMt(num):\n ans = 0\n tmp = num\n while tmp%2 == 0:\n tmp = tmp//2\n ans += 1\n return ans\nmain()']
['Wrong Answer', 'Accepted']
['s183113741', 's354906376']
[20120.0, 20192.0]
[376.0, 357.0]
[1085, 1099]
p02814
u497952650
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import numpy as np \nimport sys\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\ndef lcm(a, b):\n return (a * b)//gcd(a,b)\n\nN,M = map(int,input().split())\na = list(map(int,input().split()))\n\nA = np.array(a)\n\n##while np.sum(A%2) == 0:\n##A = A//2\n\nif np.sum(A%2) != len(A):\n print("0")\n sys.exit()\n \ntmp = 1##LCM\n\nfor i in range(N):\n tmp = lcm(tmp,a[i]//2)\n\nif tmp > M:\n print("0")\n\nelse:\n print((M//tmp+1)//2)', 'import numpy as np \nimport sys\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\ndef lcm(a, b):\n return (a * b)//gcd(a,b)\n\nN,M = map(int,input().split())\na = list(map(int,input().split()))\n\nA = np.array(a)\n\nwhile np.sum(A%2) == 0:\n A = A//2\n\nif np.sum(A%2) != len(A):\n print("0")\n sys.exit()\n \ntmp = 1##LCM\n\nfor i in range(N):\n tmp = lcm(tmp,a[i]//2)\n\nif tmp > M:\n print("0")\n\nelse:\n print((M//tmp+1)//2)']
['Wrong Answer', 'Accepted']
['s253332508', 's885154076']
[23240.0, 23208.0]
[182.0, 304.0]
[441, 441]
p02814
u500415792
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\n\nN, M = map(int, input().split(" "))\n\na = list(set(map(int, input().split(" "))))\n\ns = []\nstep = 1\n\ndef division(a, step):\n flag = True\n for i in a:\n # print(step)\n f = str(step / i).split(".")[1]\n if f != "5":\n flag = False\n break\n\n # print(step, flag)\n return flag\n\n\nwhile(len(s) != 2):\n\n if step > M:\n print(0)\n sys.exit()\n\n if division(a, step):\n s.append(step)\n step += 2\n\nprint(s)\nd = s[1] - s[0]\n\nprint(2+(M-s[1])//d)', 'N, M = map(int, input().split(" "))\n\na = list(set(map(int, input().split(" "))))\ng = a.copy()\n\nwhile not any(x%2 for x in g): g = [i //2 for i in g]\n\nif not all(x%2 for x in g): print(0); exit(0)\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n return a\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\ntot = 1\n\nfor x in a: tot = lcm(tot, x//2)\nprint((M//tot+1)//2)']
['Runtime Error', 'Accepted']
['s996768322', 's904159746']
[19864.0, 11356.0]
[2104.0, 45.0]
[520, 374]
p02814
u521323621
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from functools import reduce\nimport math\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nn,m = map(int, input().split())\na = list(map(int, input().split()))\na = [i//2 for i in list(set(a))]\n\ncnt_common = -1\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i = i//2\n cnt += 1\n if cnt_common == -1:\n cnt_common = cnt\n continue\n if cnt_common != cnt:\n nothing = True\n break\n\nb=lcm_list(a)\nif nothing:\n print(0)\nelse:\n ans = (m-b)//(2*b) + 1\n print(max(ans,0))', 'from functools import reduce\nimport math\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nn,m = map(int, input().split())\na = list(map(int, input().split()))\na = [i//2 for i in list(set(a))]\nnothing = False\ncnt_common = -1\nfor i in a:\n cnt = 0\n while i % 2 == 0:\n i = i//2\n cnt += 1\n if cnt_common == -1:\n cnt_common = cnt\n continue\n if cnt_common != cnt:\n nothing = True\n break\n\nb=lcm_list(a)\nif nothing:\n print(0)\nelse:\n ans = (m-b)//(2*b) + 1\n print(max(ans,0))']
['Runtime Error', 'Accepted']
['s478036027', 's189205550']
[20552.0, 20548.0]
[53.0, 57.0]
[601, 616]
p02814
u535236942
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nN, M = map(int,input().split())\nA = list(map(int,input().split()))\ncnt = M\nfor i in range(N):\n if A[i]%2 == 0:\n A[i] = A[i]//2\n else:\n cnt = 0\ngcd = A[0]\nfor i in range(1, N):\n gcd = gcd*A[i]//fractions.gcd(gcd, A[i])\nprint(min(cnt, 1+(M-gcd)//(2*gcd)))\nprint(1 + (999999988)//24)', 'import fractions\nN, M = map(int,input().split())\nA = list(map(int,input().split()))\nfor i in range(N):\n A[i] = A[i]//2\ngcd = A[0]\nfor i in range(1, N):\n gcd = gcd*A[i]//fractions.gcd(gcd, A[i])\nprint(1 + (M-gcd)//(2*gcd))', 'import fractions\nN, M = map(int,input().split())\nA = list(map(int,input().split()))\ncnt = M\nfor i in range(N):\n if A[i]%2 == 0:\n A[i] = A[i]//2\n else:\n cnt = 0\ngcd = A[0]\nfor i in range(1, N):\n gcd = gcd*A[i]//fractions.gcd(gcd, A[i])\nprint(min(cnt,1 + (M-gcd)//(2*gcd)))', 'def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\ndef numberof2(n):\n ans = 0\n while n%2 == 0:\n n = n//2\n ans += 1\n return ans\n\nN, M = map(int,input().split())\nA = list(map(int,input().split()))\ncnt = M\n\nfor i in range(N):\n if A[i]%2 == 0:\n A[i] = A[i]//2\n else:\n cnt = 0\nfor i in range(N-1):\n if numberof2(A[i]) != numberof2(A[i+1]):\n cnt = 0\n \nlcm = A[0]\nfor i in range(1, N):\n lcm = lcm*A[i]//gcd(lcm, A[i])\n\nprint(min(cnt, 1+(M-lcm)//(2*lcm)))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s028036818', 's222565644', 's865770534', 's348554114']
[16280.0, 16280.0, 16280.0, 15060.0]
[2104.0, 2104.0, 2104.0, 896.0]
[306, 223, 280, 513]
p02814
u566428756
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nfrom functools import reduce\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nA=[a//2 for a in A]\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\nx=lcm_list(A)\nprint(-(-M//2//x))', 'import sys\nN,M=map(int,input().split())\nA=list(set(map(int,input().split())))\nN=len(A)\nA=[a//2 for a in A]\n\ndef f(x):\n cnt=0\n while x%2==0:\n x//=2\n cnt+=1\n return cnt\nC=f(A[0])\nfor a in A:\n if f(a)!=C:\n print(0)\n sys.exit()\ndef lcm(x,y):\n xy=x*y\n while y!=0:\n x,y=y,x%y\n return xy//x\nLCM=A[0]\nfor i in range(1,N):\n LCM=lcm(LCM,A[i])\nif LCM>M:\n ans=0\nelse:\n M//=LCM\n ans=(M+1)//2\nprint(ans)']
['Wrong Answer', 'Accepted']
['s675441130', 's921723604']
[16320.0, 11512.0]
[2104.0, 43.0]
[285, 457]
p02814
u575239123
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import numpy as np\nimport collections\nn,m=map(int,input().split())\na=np.array(list(map(int,input().split())))\na=np.sort(a)\nm//=a[0]\n\nl=[]\nfor p in range(m):\n print((a*(p+0.5)))\n for i in (a*(p+0.5)):\n if i>m:continue\n if i==int(i):\n l.append(int(i))\nprint(list(collections.Counter(l).values()).count(len(a)))', 'import numpy as np\nimport collections\nn,m=map(int,input().split())\na=np.array(list(map(int,input().split())))\na=np.sort(a)\nm//=a[0]\n\nl=[]\nfor p in range(m):\n for i in (a*(p+0.5)):\n if i>m:continue\n if i==int(i):\n l.append(int(i))\nprint(list(collections.Counter(l).values()).count(len(a)))', 'n,m=map(int,input().split())\na=[ i //2 for i in list(map(int,input().split()))]\ndef f(x):\n c=0\n while(x%2==0):\n x//=2\n c+=1\n return c\ndef gcd(a,b):\n if b==0:\n return a\n return gcd(b,a%b)\ndef lcm(a,b):\n return a//gcd(a,b)*b\n\nt=f(a[0])\nfor i in range(len(a)):\n if t!=f(a[i]):\n print(0)\n exit(0)\n a[i]//=2**t\nm//=2**t\nl=1\nfor i in a:\n l=lcm(l,i)\n if l>m:\n print(0)\n exit(0)\nm//=l\nprint((m+1)//2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s043210820', 's149080327', 's717684541']
[71340.0, 71852.0, 14400.0]
[2112.0, 2112.0, 548.0]
[321, 300, 423]
p02814
u599114793
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nfrom functools import reduce\ndef lcm_base(x,y):\n return (x*y) // fractions.gcd(x, y)\n\ndef lcm_list(num):\n return reduce(lcm_base, num, 1)\n\nn, m = map(int,input().split())\na_list = list(map(int,input().split()))\nu1 = lcm_list(a_list)\nu2 = lcm_list(a_list) // 2\nprint((m-u2) // u1 + 1)\n', 'import fractions\nfrom functools import reduce\ndef lcm_base(x,y):\n return (x*y) // fractions.gcd(x, y)\n\ndef lcm_list(num):\n return reduce(lcm_base, num, 1)\n\nn, m = map(int,input().split())\na_list = list(map(int,input().split()))\nu1 = lcm_list(a_list)\nu2 = lcm_list(a_list) // 2\nprint((m-u2) // u1 + 1)\n', 'import copy\nn,m = map(int,input().split())\na = set(list(map(int,input().split())))\na = list(a)\na_div2 = [0]*len(a)\na2 = copy.deepcopy(a)\n\n# if a[i] % 2 == 1:\n# print(0)\n# exit()\nfor i in range(len(a)):\n while a2[i] % 2 == 0:\n a2[i] //= 2\n a_div2[i] += 1\nif len(set(a_div2)) != 1:\n print(0)\n exit()\n\n\ndef gcd(a,b):\n while b != 0:\n a, b = b, a % b\n return a\n\n\ndef lcm(a,b):\n return a // gcd(a,b) * b\n\n\nif len(a) == 1:\n if m < a[0]//2:\n print(0)\n else:\n print((m-a[0]//2)//a[0] + 1)\nelse:\n cnt = 1\n for i in range(len(a)):\n a[i] //= 2\n cnt = lcm(cnt,a[i])\n if m < cnt:\n print(0)\n else:\n print((m-cnt)//(cnt*2)+1)\n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s503761598', 's620821970', 's168478004']
[16236.0, 16236.0, 14804.0]
[2104.0, 229.0, 55.0]
[307, 307, 756]
p02814
u617515020
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from fractions import gcd\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\na=list(set(a))\n\na=list(map(lambda x: x//2, a))\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\nlcma=lcm(a)\ntemp=m//lcma\nprint(temp//2 if temp%2==0 else temp//2+1)', 'from fractions import gcd\nfrom functools import reduce\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\na=list(set(a))\n\ndef lcm_base(x, y):\n return (x * y) // gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nlcma=lcm(*a)\nprint((m + lcma//2)//lcma)', 'from fractions import gcd\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\na=list(set(a))\n\na=list(map(lambda x: x//2, a))\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\nlcma=lcm(a)\n\nif (lcma//a[0])%2==0:\n print(0)\n \nelse:\n flg=0\n for i in range(1,n):\n if (lcma//a[i])%2==0:\n print(0)\n flg=1\n\n if flg==0:\n temp=m//lcma\n print(temp//2 if temp%2==0 else temp//2+1)', 'from math import gcd\nn,m=map(int,input().split())\na=list(map(int,input().split()))\na=list(set(a))\na=list(map(lambda x: x//2, a))\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\nlcma=lcm(a)\nfor i in range(len(a)):\n if (lcma//a[i])%2==0:\n print(0)\n exit()\ntemp=m//lcma\nprint(-(-temp//2))']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s130201629', 's277328208', 's638876928', 's857596164']
[16316.0, 16392.0, 16336.0, 20192.0]
[63.0, 2104.0, 67.0, 55.0]
[303, 286, 452, 344]
p02814
u628285938
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['# -*- coding: utf-8 -*-\n"""\nCreated on Wed Sep 9 14:33:00 2020\n\n@author: liang\n"""\nfrom math import gcd\n\nN, M = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nflag = False\nres = 1\nfor a in A:\n a /= 2\n res *= a//gcd(res,a)\n if res > M:\n flag = True\n break\n #print(res)\n\n\nfor a in A:\n if int(res/a) == res/a:\n flag = True\n \nif flag:\n ans = 0\n print(ans)\nelse:\n \n \n ans= (M//res + 1)//2\n print(ans)', '# -*- coding: utf-8 -*-\n"""\nCreated on Wed Sep 9 13:52:28 2020\n\n@author: liang\n"""\n\nfrom math import gcd\n\nN, M = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nres = A[0]\nfor i in range(1,N):\n res = res*A[i]//gcd(res,A[i])\n print(res)\n\nif M < max(A)//2:\n ans = 0\nelse:\n ans = (M - max(A)//2)//res + 1\nprint(ans)', '# -*- coding: utf-8 -*-\n"""\nCreated on Wed Sep 9 14:33:00 2020\n\n@author: liang\n"""\nfrom math import gcd\n\nN, M = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nflag = False\nres = 1\nfor a in A:\n a //= 2\n res *= a//gcd(res,a)\n if res > M:\n \n break\n #print(res)\n\n\nfor a in A:\n if int(res/a) == res/a:\n flag = True\n \nif flag:\n ans = 0\n print(ans)\nelse:\n \n \n ans= (M//res + 1)//2\n #print(ans)', '# -*- coding: utf-8 -*-\n"""\nCreated on Wed Sep 9 14:33:00 2020\n\n@author: liang\n"""\nfrom math import gcd\n\nN, M = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nflag = False\nres = 1\nfor a in A:\n a //= 2\n res *= a//gcd(res,a)\n if res > M:\n flag = True\n break\n #print(res)\n\n\nfor a in A:\n if int(res/a) == res/a:\n flag = True\n \nif flag:\n ans = 0\n print(ans)\nelse:\n \n \n ans= (M//res + 1)//2\n print(ans)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s143714508', 's806308084', 's808802714', 's391358724']
[20372.0, 27532.0, 20336.0, 20396.0]
[52.0, 298.0, 95.0, 95.0]
[593, 342, 596, 594]
p02814
u662794944
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['mod = 10**9+7\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom itertools import product, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush\nfrom math import ceil,floor\nfrom copy import deepcopy\nfrom heapq import heappop,heappush,heapify\nimport heapq\n\n\n# l = [\'a\', \'a\', \'a\', \'a\', \'b\', \'c\', \'c\']\n# c = Counter(l)\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\n\np2D = lambda x: print(*x, sep="\\n")\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\ndef MI1(): return map(int1, sys.stdin.readline().split())\n\n\n\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))\ndef HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))\n\n\n\n# n = II()\n# p = tuple(MI())\n# q = tuple(MI())\n\n# l = list(permutations(list(range(1,n+1))))\n# print(abs(l.index(p)-l.index(q)))\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a%b)\n \ndef lcm(a, b):\n\treturn a // gcd(a, b) * b\n \nN, M = MI()\na = LI()\na = [a//2 for a in a]\n\nprint(a)\n\nwhile a[0] % 2 == 0:\n\tfor i in range(N):\n\t\tif a[i] % 2 != 0:\n\t\t\tprint(0)\n\t\t\texit()\n\t\ta[i] //= 2\n\tM //= 2\n\nprint(a)\n \nfor i in range(N):\n\tif a[i] % 2 == 0:\n\t\tprint(0)\n\t\texit()\n \nL = 1\nfor i in range(N):\n\tL = lcm(L, a[i])\n\tif M < L:\n\t\tprint(0)\n\t\texit()\n \nprint((M // L + 1) // 2)', 'mod = 10**9+7\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom itertools import product, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush\nfrom math import ceil,floor\nfrom copy import deepcopy\nfrom heapq import heappop,heappush,heapify\nimport heapq\n\n\n# l = [\'a\', \'a\', \'a\', \'a\', \'b\', \'c\', \'c\']\n# c = Counter(l)\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\n\np2D = lambda x: print(*x, sep="\\n")\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\ndef MI1(): return map(int1, sys.stdin.readline().split())\n\n\n\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))\ndef HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))\n\n\n\n# n = II()\n# p = tuple(MI())\n# q = tuple(MI())\n\n# l = list(permutations(list(range(1,n+1))))\n# print(abs(l.index(p)-l.index(q)))\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a%b)\n \ndef lcm(a, b):\n\treturn a // gcd(a, b) * b\n \nN, M = MI()\nA = LI()\nA = [a//2 for a in A]\n\nprint(A)\n\nwhile A[0] % 2 == 0:\n\tfor i in range(N):\n\t\tif A[i] % 2 != 0:\n\t\t\tprint(0)\n\t\t\texit()\n\t\tA[i] //= 2\n\tM //= 2\n\nprint(A)\n \nfor i in range(N):\n\tif A[i] % 2 == 0:\n\t\tprint(0)\n\t\texit()\n \nlcm_ = 1\nfor i in range(N):\n\tlcm_ = lcm(lcm_, A[i])\n\tif M < lcm_:\n\t\tprint(0)\n\t\texit()\n \nprint((M // lcm_ + 1) // 2)', 'mod = 10**9+7\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom itertools import product, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush\nfrom math import ceil,floor\nfrom copy import deepcopy\nfrom heapq import heappop,heappush,heapify\nimport heapq\n\n\n# l = [\'a\', \'a\', \'a\', \'a\', \'b\', \'c\', \'c\']\n# c = Counter(l)\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\n\np2D = lambda x: print(*x, sep="\\n")\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\ndef MI1(): return map(int1, sys.stdin.readline().split())\n\n\n\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))\ndef HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))\n\n\n\n# n = II()\n# p = tuple(MI())\n# q = tuple(MI())\n\n# l = list(permutations(list(range(1,n+1))))\n# print(abs(l.index(p)-l.index(q)))\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a%b)\n \ndef lcm(a, b):\n\treturn a // gcd(a, b) * b\n \nN, M = MI()\nA = LI()\nA = [a//2 for a in A]\n\n\nwhile A[0] % 2 == 0:\n\tfor i in range(N):\n\t\tif A[i] % 2 != 0:\n\t\t\tprint(0)\n\t\t\texit()\n\t\tA[i] //= 2\n\tM //= 2\n\n \nfor i in range(N):\n\tif A[i] % 2 == 0:\n\t\tprint(0)\n\t\texit()\n \ntmp_lcm = 1\nfor i in range(N):\n\ttmp_lcm = lcm(tmp_lcm, A[i])\n\tif M < tmp_lcm:\n\t\tprint(0)\n\t\texit()\n \nprint((M // tmp_lcm + 1) // 2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s682385223', 's799778414', 's587222202']
[15404.0, 15400.0, 15400.0]
[845.0, 863.0, 826.0]
[1859, 1874, 1871]
p02814
u677121387
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['def gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y,x%y)\n\ndef lcm(x,y):\n return x*y//gcd(x,y)\n\nn,m = map(int,input().split())\na = [int(i) for i in input().split()]\nna = [i*0.5 for i in a]\nl = 1\nfor i in range(n):\n l = lcm(l,na[i])\n\nl2 = l*2\nif l > m:\n ans = 0\nelse:\n ans = (m-l)//l2 + 1\n \nprint(ans)\n', 'def gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y,x%y)\n\ndef lcm(x,y):\n return x*y//gcd(x,y)\n\nn,m = map(int,input().split())\na = [int(i) for i in input().split()]\nna = [i*0.5 for i in a]\nl = 1\nfor i in range(n):\n l = lcm(l,na[i])\n\nl2 = l*2\nif l-1 > m:\n ans = 0\nelse:\n ans = (m-(l-1))//l2 + 1\n \nprint(ans)', 'def gcd(x,y):\n if y == 0: return x\n else: return gcd(y,x%y)\n\ndef lcm(x,y): return x*y//gcd(x,y)\n\ndef f(x):\n cnt = 0\n while(x%2==0):\n x //= 2\n cnt += 1\n return cnt\n\nn,m = map(int,input().split())\na = [int(i) for i in input().split()]\nna = [i//2 for i in a]\n\nt = f(na[0])\nfor i in range(1,n):\n if t != f(na[i]):\n print(0)\n exit()\n\nl = na[0]\nfor i in range(1,n): l = lcm(l,na[i])\n\nif m < l:\n ans = 0\nelse:\n ans = 1 + (m-l)//(2*l)\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s253769561', 's360672118', 's040726457']
[14484.0, 15060.0, 15060.0]
[164.0, 163.0, 517.0]
[344, 349, 490]
p02814
u685983477
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from collections import deque,defaultdict\nimport math\nimport numpy as np\ndef gcd(a,b):\n return b if not a%b else gcd(b,a%b)\ndef lcm(a,b):\n return (a*b)//gcd(a,b)\nn,m=map(int, input().split())\nA=[int(i) for i in input().split()]\ntmp = A[0]//2\nres=0\nfor i in range(1,n):\n tmp = lcm(tmp,A[i]//2)\nlis = set()\n\nfor i in A:\n r = i\n k=0\n while(r%2==0):\n k+=1\n r//=2\n lis.add(k)\nif(len(lis)>1):\n print(0)\nelse:\n print(m//tmp)\n', 'from collections import deque,defaultdict\ndef gcd(a,b):\n return b if not a%b else gcd(b,a%b)\ndef lcm(a,b):\n return (a*b)//gcd(a,b)\nn,m=map(int, input().split())\nA=[int(i) for i in input().split()]\ntmp = A[0]\nfor i in range(1,n):\n tmp = lcm(tmp,A[i])\nans = m//tmp\nlis = set()\nfor i in A:\n r = i\n k=0\n while(r%2==0):\n k+=1\n r//=2\n lis.add(k)\nif(m//(tmp)*tmp+tmp//2<=m):\n ans += 1\nif(len(lis)!=1):\n ans=0\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s731469769', 's795805113']
[38376.0, 20408.0]
[518.0, 430.0]
[459, 456]
p02814
u692746605
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N,M=map(int,input().split())\na=[int(x)//2 for x in input().split()]\n\ndef lcm(a,b):\n if a>b:\n a,b=b,a\n if a==1:\n return b\n n=a*b\n while a!=0:\n b,a=a,b%a\n return n//b\n\nt=a[0]\nfor i in range(1,N):\n t=lcm(t,a[i])\n if t>M:\n print(0)\n break\nelse:\n print(0 if t%2 else M//t-M//(t*2))\n', 'N,M=map(int,input().split())\na=[int(x)//2 for x in input().split()]\n\ndef lcm(a,b):\n if a>b:\n a,b=b,a\n if a==1:\n return b\n n=a*b\n while a!=0:\n b,a=a,b%a\n return n//b\n\nf1,f2=a[0],a[0]\nfor i in range(1,N):\n f1|=a[i]\n f2&=a[i]\nc=0\nwhile f1&1==0:\n f1//=2\n c+=1\nif f2&2**c==0:\n print(0)\n exit()\n\nt=a[0]\nfor i in range(1,N):\n t=lcm(t,a[i])\n if t>M:\n print(0)\n break\nelse:\n print(M//t-M//(t*2))\n']
['Wrong Answer', 'Accepted']
['s159000563', 's003729065']
[14356.0, 15060.0]
[104.0, 127.0]
[301, 417]
p02814
u698919163
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from math import gcd, ceil\nimport sys\nN,M = map(int, input().split())\na = list(map(int, input().split()))\ntmp = 1\nfor i in range(N):\n tmp = tmp * (a[i]//2) // gcd(tmp, (a[i]//2))\nfor i in range(N):\n if tmp // a[i] % 2 == 0:\n print(0)\n sys.exit()\nprint(ceil((M // tmp) / 2))', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport math\ntmp = 1\nfor i in range(N):\n lcm = tmp*(a[i]//2)//math.gcd(tmp,(a[i]//2))\n tmp = lcm\n \nallo=1\nfor i in range(N):\n allo&=(lcm//a[i])%2\nif allo:\n print((M//lcm+1)//2)\nelse:\n print(0)', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport math\nimport sys\n\ntmp = 1\nfor i in range(N):\n lcm = tmp*(a[i]//2)//math.gcd(tmp,(a[i]//2))\n tmp = lcm\n \nfor i in a:\n if tmp // i % 2 == 0:\n print(0)\n sys.exit()\nprint((M//tmp+1) // 2)', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport math\nimport sys\n\ntmp = 1\nfor i in range(N):\n lcm = tmp*(a[i]//2)//math.gcd(tmp,(a[i]//2))\n tmp = lcm\n \nfor i in a:\n if tmp // i % 2 == 0:\n print(0)\n sys.exit()\nprint(ceil((M // tmp) / 2))', 'from math import gcd, ceil\nn, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i // 2 for i in a]\ntmp = 1\nfor i in range(n):\n lcm = tmp * (a[i]//2) // gcd(tmp,a[i]//2)\n tmp = lcm\nfor i in range(n):\n if tmp // (a[i]//2) % 2 == 0:\n print(0)\n exit()\nprint((m//tmp+1)//2)', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport fractions\n\nlcm = a[0]//2\n\nfor i in range(1, N):\n lcm = lcm * (a[i]//2) // fractions.gcd(lcm, a[i]//2)\n\nif (M//lcm)%2 == 0:\n print(M//lcm//2)\nelse:\n print((M//lcm+1)//2)', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport fractions\n\nlcm = a[0]//2\n\nfor i in range(1, N):\n lcm = lcm * (a[i]//2) // fractions.gcd(lcm, a[i]//2)\n\nprint(-(-(M//lcm) // 2))', 'from math import gcd, ceil\nn, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i // 2 for i in a]\ntmp = 1\nfor i in a:\n lcm = tmp * (a[i]//2) // gcd(tmp,a[i]//2)\n tmp = lcm\nfor i in a:\n if tmp // i % 2 == 0:\n print(0)\n exit()\nprint((m//tmp+1)//2)', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport fractions\n\nans = a[0]\nfor i in range(1, N):\n ans = ans * a[i] // fractions.gcd(ans, a[i])\n \nif ans > M*2: \n print(0)\nelse:\n print(int(M/ans)+1)', 'from math import gcd\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = [i // 2 for i in a]\nl = 1\nfor a in A:\n lcd *= a // gcd(lcd, a)\nfor a in A:\n if lcd // a % 2 == 0:\n print(0)\n exit()\nprint((M//lcd+1)//2)\n', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport fractions\nimport sys\n\nlcm = a[0]//2\n\nfor i in range(1, N):\n lcm = lcm * (a[i]//2) // fractions.gcd(lcm, a[i]//2)\n\n \ncount_list = []\ncount = 0\nfor i in range(N):\n while a[i] % 2 == 0:\n count += 1\n a[i] = a[i] // 2\n count_list.append(count)\n count = 0\n \nfor i in range(N):\n if count_list[i] != sum(count_list)/N:\n print(0)\n sys.exit()\n \n\nprint(-(-(M//lcm) // 2))', 'N,M = list(map(int,input().split()))\na = list(map(int,input().split()))\n\nimport fractions\n\nlcm = a[0]//2\n\nfor i in range(1, N):\n lcm = lcm * (a[i]//2) // fractions.gcd(lcm, a[i]//2)\n\n\nprint(M//lcm//2)', 'from math import gcd\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = [i // 2 for i in A]\nlcd = 1\nfor a in A:\n lcd *= a // gcd(lcd, a)\nfor a in A:\n if lcd // a % 2 == 0:\n print(0)\n exit()\nprint((M//lcd+1)//2)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s002056382', 's130942373', 's139119440', 's182026710', 's270576364', 's361016390', 's402845019', 's420896728', 's459652377', 's519922877', 's609619614', 's859705455', 's814036310']
[20000.0, 19972.0, 19488.0, 19928.0, 20368.0, 14292.0, 14244.0, 20304.0, 14124.0, 20360.0, 14356.0, 14100.0, 20208.0]
[130.0, 208.0, 126.0, 128.0, 214.0, 166.0, 164.0, 74.0, 162.0, 48.0, 2104.0, 169.0, 171.0]
[293, 282, 288, 293, 312, 257, 210, 290, 237, 251, 492, 203, 253]
p02814
u729417323
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['# --*-coding:utf-8-*--\n\ndef gcd(n, m):\n while m > 0:\n n, m = m, n%m\n\n return n\n\ndef f(M, A):\n lcm = 1\n\n for a in A:\n g = gcd(lcm, a)\n lcm = lcm*a//g\n\n if lcm > M:\n return 0\n\n for a in A:\n if lcm//a%2 == 0:\n return 0\n\n return (M-lcm)//(2*lcm) + 1\n \n\n\ndef main():\n N, M = map(int, input().split())\n A = list(map(lambda x:int(x)//2, input().split()))\n\n print(f(M,A))\n\n \n', "# --*-coding:utf-8-*--\n\ndef gcd(n, m):\n while m > 0:\n n, m = m, n%m\n\n return n\n\ndef f(M, A):\n lcm = 1\n\n for a in A:\n g = gcd(lcm, a)\n lcm = lcm*a//g\n\n if lcm > M:\n return 0\n\n for a in A:\n if lcm//a%2 == 0:\n return 0\n\n return (M-lcm)//(2*lcm) + 1\n \n\n\ndef main():\n N, M = map(int, input().split())\n A = list(map(lambda x:int(x)//2, input().split()))\n\n print(f(M,A))\n\n \n\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s774972392', 's116276852']
[3064.0, 14356.0]
[17.0, 98.0]
[466, 507]
p02814
u747602774
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b,a%b)\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\nN,M = map(int,readline().split())\nA = list(map(int,readline().split()))\n\nB = [A[i]//2 for i in range(N)]\nans = 1\n\ndev_c = 0\nwhile A[0]%2 != 1:\n A[0] = A[0]//2\n dev_c += 1\n#print(dev_c)\n\nfor i in range(N):\n dev_c2 = 0\n while A[i]%2 != 1:\n A[i] = A[i]//2\n dev_c2 += 1\n if dev_c != dev_c2:\n ans = 0\n break\n\nl = B[0]\nif ans == 1:\n for i in range(N):\n l = lcm(l,B[i])\n\n#print(l)\n\nif ans != 0:\n ans = (M//l+1)//2\n\nprint(ans)', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef gcd(a,b):\n while b:\n a,b = b,a%b\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\nN,M = map(int,readline().split())\nA = list(map(int,readline().split()))\n\nB = [A[i]//2 for i in range(N)]\nans = 1\n\ndev_c = 0\nwhile A[0]%2 != 1:\n A[0] = A[0]//2\n dev_c += 1\n#print(dev_c)\n\nfor i in range(1,N):\n dev_c2 = 0\n while A[i]%2 != 1:\n A[i] = A[i]//2\n dev_c2 += 1\n if dev_c != dev_c2:\n ans = 0\n break\n\nl = B[0]\nif ans == 1:\n for i in range(N):\n l = lcm(l,B[i])\n\n#print(l)\n\nif ans != 0:\n ans = (M//l+1)//2\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s556727193', 's363676419']
[12528.0, 12972.0]
[53.0, 962.0]
[759, 739]
p02814
u756195685
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nfrom functools import reduce\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nN,M = map(int,input().split())\na = list(map(lambda a: int(a)//2, input().split()))\ng = lcm(*a)\nif any([2 * g // item % 2 == 0 for item in a]):\n print(0)\nelse:\n ans = M//g\n ans = max(math.ceil(ans/2),0) \n print(ans)', 'import math\nfrom functools import reduce\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\nN,M = map(int,input().split())\na = list(map(lambda a: int(a)//2, input().split()))\ng = lcm(*a)\nif any([g // item % 2 == 0 for item in a]):\n print(0)\nelse:\n ans = M//g\n ans = max(math.ceil(ans/2),0) \n print(ans)']
['Wrong Answer', 'Accepted']
['s274882514', 's007892419']
[20956.0, 20940.0]
[209.0, 200.0]
[387, 383]
p02814
u797572808
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n,m = map(int,input().split())\n\na = [0]*n\na = [int(s) for s in input().split()]\n\na_half = [s//2 for s in a]\n#print(a)\n\ndef check(x):\n while (all(c%2 == 1 for c in x)):\n if any(c%2 == 1 for c in x):\n return 0\n x /= 2\n \n return 1\n\ndef gcd(x,y):\n #print(x,y)\n if(x%y == 0):\n #print(y)\n return y\n else:\n return gcd(y,x%y)\n\n\ndef lcm(x,y):\n return x/gcd(x,y)*y\n\nif(check(a)== 1):\n x = a_half[0]\n for i in range(1,n):\n y = a_half[i]\n x = lcm(x,y)\n \n res = (m//x+1)//2\n print(res)\nelse:\n print(0)\n \n \n \n', 'n,m = map(int,input().split())\n\na = [1]*n\n#print(a)\na = [int(s) for s in input().split()]\n\na_half = [s//2 for s in a]\n#print(a)\n\ndef check(x):\n while (all(c%2 == 0 for c in x)):\n x = [s//2 for s in x]\n if any(c%2 == 1 for c in x) and any(c%2 == 0 for c in x):\n return 0\n \n \n return 1\n\ndef gcd(x,y):\n #print(x,y)\n if(x%y == 0):\n #print(y)\n return y\n else:\n return gcd(y,x%y)\n\n\ndef lcm(x,y):\n return x//gcd(x,y)*y\n\nif(check(a)== 1):\n x = a_half[0]\n for i in range(1,n):\n y = a_half[i]\n x = lcm(x,y)\n if(x > m):\n print(0)\n else:\n res = int((m//x+1)//2)\n print(res)\nelse:\n print(0)\n \n \n']
['Runtime Error', 'Accepted']
['s882753649', 's043007616']
[15012.0, 19780.0]
[117.0, 838.0]
[603, 712]
p02814
u833963136
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = list(set(A))\nN = len(A)\na0 = A[0]\ndiv = 1\nwhile a0 % 2 == 0:\n div *= 2\n a0 //= 2\n\nfor i in range(1, N):\n a = A[i] % div\n b = A[i] // div\n if (b % 2 == 0) or (a != 0):\n print(0)\n exit()\n\nfor i in range(N):\n A[i] //= 2\n\nif N > 1:\n print(-1)\n exit()\n gcd = math.gcd(A[0], A[1])\n for i in range(2, N):\n gcd = math.gcd(gcd, A[i])\n\nif N == 1:\n gcd = A[0]\nlcm = gcd\nfor i in range(N):\n lcm *= A[i] // gcd\n\nprint((M - lcm) // lcm // 2 + 1)', 'import math\ndef LCM(a, b):\n g = math.gcd(a, b)\n return a * b // g\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = list(set(A))\nN = len(A)\na0 = A[0]\ndiv = 1\nwhile a0 % 2 == 0:\n div *= 2\n a0 //= 2\n\nfor i in range(1, N):\n a = A[i] % div\n b = A[i] // div\n if (b % 2 == 0) or (a != 0):\n print(0)\n exit()\n\nfor i in range(N):\n A[i] //= 2\n\nif N > 1:\n lcm = LCM(A[0], A[1])\n for i in range(2, N):\n lcm = LCM(lcm, A[i])\n\nif N == 1:\n lcm = A[0]\n\nans = M // lcm\nif ans % 2 == 1:\n print(ans // 2 + 1)\nelse:\n print(ans // 2)\n']
['Wrong Answer', 'Accepted']
['s987439165', 's837490006']
[20968.0, 20308.0]
[53.0, 54.0]
[573, 597]
p02814
u834837888
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\n sum += int(l[i]) % 2\n\nif sum == len(l) or sum == 0:\n x = m // (int(lcm) / 2)\n y = m // lcm\n print(int(x - y))\nelse:\n print(0)', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nfor i in range(len(l)):\n if lcm // int(len(i)) % 2 == 1:\n sum += 1\nif sum == len(l):\n x = m // (int(lcm) / 2)\n y = m // lcm\n print(int(x - y))\nelse:\n print(0)', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nfor i in range(len(l) -1):\n lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nfor i in range(len(l)):\n if (lcm // int(l[i])) % 2 == 1:\n sum += 1\nif sum == len(l):\n x = m // (int(lcm) / 2)\n y = m // lcm\n print(int(x - y))\nelse:\n print(0)', 'import fractions\nn,m = map(int,input().split())\na,b = map(int,input().split())\nlcm = (a * b) // fractions.gcd(a, b)\nx = m // (lcm /2 )\ny = m // (lcm)\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nfor i in range(len(l) -1):\n lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\n sum += int(l[i]) % 2\n \nif sum == len(l) or sum == 0:\n print(0)\nelse:\n x = m // (int(lcm)/2)\n y = m // lcm\n print(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\n \ncounter = 0\nsum = 0\n\nfor i in range(len(l)):\n if lcm // int(l[i]) % 2 == 1:\n counter += 1\n \nif counter == len(l):\n sum += 1\n\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'ort fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nfor i in range(len(l)):\n if (lcm // int(l[i])) % 2 == 1:\n sum += 1\nif sum == len(l):\n x = m // (int(lcm) / 2)\n y = m // lcm\n print(int(x - y))\nelse:\n print(0)', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nfor i in range(len(l)):\n lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nfor i in range(len(l) -1):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\na,b = map(int,input().split())\nlcm = (a * b) // fractions.gcd(a, b)\nx = m // (int(lcm)/2)\ny = m // lcm\nprint(int(x-y))', 'import fractions\nn,m = map(int,input().split())\nl = input().split()\nlcm = 1\nsum = 0\nfor i in range(len(l)):\n lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)\nfor i in range(len(l)):\n if (lcm // int(l[i])) % 2 == 1:\n sum += 1\nif sum == len(l):\n x = m // (int(lcm) / 2)\n y = m // lcm\n print(int(x - y))\nelse:\n print(0)', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n \ndef div_ceil(x, y): return (x + y - 1) // y\n \nN, M = map(int, input().split())\n*A, = map(int, input().split())\nA = list(set([a // 2 for a in A]))\nL = A[0]\nfor a in A[1:]:\n L *= a // gcd(L, a)\nfor a in A:\n if (L // a) % 2 == 0:\n ans = 0\n break\nelse:\n ans = div_ceil(M // L, 2)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s002301126', 's082487417', 's156784463', 's230378360', 's297815113', 's359278387', 's545331178', 's651723099', 's689935583', 's749589716', 's876861174', 's878383487', 's878459562', 's886761911', 's701637673']
[13328.0, 13292.0, 13292.0, 13288.0, 13292.0, 13292.0, 13288.0, 13292.0, 13288.0, 2940.0, 13288.0, 13288.0, 13288.0, 13292.0, 15060.0]
[180.0, 205.0, 177.0, 290.0, 280.0, 48.0, 291.0, 217.0, 287.0, 18.0, 292.0, 177.0, 44.0, 284.0, 53.0]
[211, 310, 349, 226, 349, 165, 226, 310, 361, 346, 223, 214, 166, 349, 376]
p02814
u867320886
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\n\ndef gcd(x,y):\n while y:\n x,y = y , x % y \n return x\n\nn,m=map(int,input().split())\na=tuple(map(int,input().split()))\na.sort()\nlcm = 1\nfor i in a:\n lcm = lcm * i // gcd(lcm,i)\nfor i in a:\n if (lcm//i)%2 == 0:\n print(0)\n sys.exit()\nprint((m+lcm//2)//lcm)', 'import sys\n\ndef gcd(x,y):\n while y:\n x,y = y , x % y \n return x\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nlcm = 1\nfor i in a:\n lcm = lcm * i // gcd(lcm,i)\nfor i in a:\n if (lcm//i)%2 == 0:\n print(0)\n sys.exit()\nprint((m+lcm//2)//lcm)']
['Runtime Error', 'Accepted']
['s691356060', 's592187106']
[14652.0, 14244.0]
[42.0, 222.0]
[296, 295]
p02814
u888092736
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from math import ceil\nfrom fractions import gcd\n\n\ndef prime_factor(n):\n res = []\n for i in range(2, int(n ** 0.5) + 1):\n while n % i == 0:\n res.append(i)\n n //= i\n if n > 1:\n res.append(n)\n return res\n\n\nif __name__ == "__main__":\n n, m = map(int, input().split())\n a = list(map(int, input().split()))\n twos_cnt = {prime_factor(num).count(2) for num in a}\n if len(twos_cnt) > 1:\n print(0)\n exit()\n\n num_two = twos_cnt.pop()\n a_div = [x >> num_two for x in a]\n\n a_div_lcm = a_div[0]\n for i in range(1, n):\n a_div_lcm = a_div_lcm * a_div[i] // gcd(a_div_lcm, a_div[i])\n print(ceil(m / a_div_lcm * 0.5 - 0.5))\n', 'from functools import reduce\n\n\ndef count_factors(a, factor):\n count = 0\n while a % factor == 0:\n count += 1\n a //= factor\n return count\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nif __name__ == "__main__":\n n, m = map(int, input().split())\n a = list(set(map(lambda x: int(x) // 2, input().split())))\n num_of_two = count_factors(a[0], 2)\n for ai in a[1:]:\n if count_factors(ai, 2) != num_of_two:\n print(0)\n exit()\n\n a_lcm = reduce(lambda x, y: lcm(x, y), a)\n if a_lcm > m:\n print(0)\n exit()\n\n print((m // a_lcm + 1) // 2)\n']
['Wrong Answer', 'Accepted']
['s283368570', 's957992302']
[16344.0, 11760.0]
[2104.0, 65.0]
[702, 688]
p02814
u920977317
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import numpy as np\n\ndef main():\n N,M=map(int,input().split())\n A=list(map(int,input().split()))\n A_double=list(map(lambda x:x//2,A))\n\n mini_multi=int(np.gcd.reduce(A_double))\n\n res=M//mini_multi\n\n if res%2!=0:\n res+=1\n\n\n print(res//2)\n\n\n\n\n\nif __name__=="__main__":\n main()\n', 'import numpy as np\nimport sys\n\ndef main():\n N,M=map(int,input().split())\n A=list(map(int,input().split()))\n A_double=list(map(lambda x:x//2,A))\n\n mini_multi=int(np.lcm.reduce(A_double))\n\n res=M//mini_multi\n \n for i in A_double:\n if (mini_multi//i)%2==0:\n print(0)\n sys.exit()\n\n if res%2!=0:\n res+=1\n\n\n print(res//2)\n\n\n\n\n\nif __name__=="__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s437740226', 's981603925']
[38356.0, 38412.0]
[147.0, 164.0]
[304, 420]
p02814
u923172145
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import math\nimport sys\nfrom functools import reduce\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n \ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nC = gcd_list(A)\nB = [0 for _ in range(N)]\n\nfor i in range(N):\n B[i] = C // A[i]\n if B[i] % 2 == 0:\n print(0)\n sys.exit()\n\nprint( (M // C + 1) // 2)', 'import math\nimport sys\nfrom functools import reduce\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nfor i in range(N):\n A[i] = A[i] // 2\n \ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n \ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nC = lcm_list(A)\nB = [0 for _ in range(N)]\n\nfor i in range(N):\n B[i] = C // A[i]\n if B[i] % 2 == 0:\n print(0)\n sys.exit()\n\nprint( (M // C + 1) // 2)']
['Runtime Error', 'Accepted']
['s169292411', 's478729013']
[20868.0, 29084.0]
[52.0, 231.0]
[402, 443]
p02814
u923270446
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['from fractions import gcd\nfrom math import ceil\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nans = a[0] // 2\nfor i in a:\n ans *= (i // 2) // gcd(ans, i // 2)\nprint(ceil((m // ans) / 2))', 'from math import gcd, ceil\nn, m = map(int, input().split())\na = list(map(int, input().split()))\na = [i // 2 for i in a]\nl = 1\nfor i in a:\n l *= i // gcd(l, i)\nfor i in a:\n if l // i % 2 == 0:\n print(0)\n exit()\nprint(ceil((m // l) / 2))']
['Wrong Answer', 'Accepted']
['s854715929', 's420231524']
[16320.0, 20208.0]
[131.0, 172.0]
[212, 255]
p02814
u932465688
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n,m = map(int,input().split())\nA = list(map(int,input().split()))\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\ncur == 0\nif n != 1:\n while A[0]%2 == 0:\n cur += 1\n A[0] = A[0]//2\n flag = True\n for i in range(1,n):\n temp = 0\n while A[i]%2 == 0:\n temp += 1\n A[i] = A[i]//2\n if temp != cur:\n flag = False\n break\n if flag:\n g = A[0]*A[1]//(4*gcd(A[0]//2, A[1]//2))\n for i in range(2, n):\n u = g\n v = A[i]//2\n p = u*v//gcd(u,v)\n g = p\n if g <= 2*m:\n print(int((m/g-1)/2)+1)\n else:\n print(0)\n else:\n print(0)\nelse:\n if A[0] <= 2*m:\n print(int((2*m/A[0]-1)/2)+1)\n else:\n print(0)\n', 'n,m = map(int,input().split())\nA = list(map(int,input().split()))\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\ncur = 0\nif n != 1:\n t = A[0]\n while t%2 == 0:\n cur += 1\n t = t//2\n flag = True\n for i in range(1,n):\n temp = 0\n s = A[i]\n while s%2 == 0:\n temp += 1\n s = s//2\n if temp != cur:\n flag = False\n break\n if flag:\n g = A[0]*A[1]//(4*gcd(A[0]//2, A[1]//2))\n for i in range(2, n):\n u = g\n v = A[i]//2\n p = u*v//gcd(u,v)\n g = p\n if g <= m:\n print(int((m/g-1)/2)+1)\n else:\n print(0)\n else:\n print(0)\nelse:\n if A[0] <= 2*m:\n print(int(((2*m/A[0])-1)/2)+1)\n else:\n print(0)\n']
['Runtime Error', 'Accepted']
['s963122240', 's326835103']
[15060.0, 15060.0]
[44.0, 739.0]
[828, 839]
p02814
u948911484
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['n,m = map(int,input().split())\na = list(map(int,input().split()))\nhalf_a = [i//2 for i in a]\nfrom fractions import gcd\ndef lcm(x,y):\n return (x*y) // gcd(x,y)\nq = half_a[0]\nfor i in range(n):\n q = lcm(q,half_a[i])\nans = (m//q) - (m//(2*q))\nprint(ans)', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\nhalf_a = [i//2 for i in a]\nfrom fractions import gcd\ndef lcm(x,y):\n return (x*y) // gcd(x,y)\nq = 1\nfor i in range(n):\n q = lcm(q,a[i])\nstart = q//2\nif start > m:\n print(0)\n exit()\nprint((m-start)//q+1)', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\nhalf_a = [i//2 for i in a]\nfrom fractions import gcd\ndef lcm(x,y):\n return (x*y) // gcd(x,y)\nq = 1\nfor i in range(n):\n q = lcm(q,half_a[i])\nans = m//q - m//(2*q)\n\nprint(ans)', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\ndef lcm(a, b):\n return a * b // gcd(a, b)\nq = a[0]//2\nfor i in range(n):\n a = a[i]//2\n q = lcm(q,a)\ncnt = 0\nwhile True:\n for i in range(n):\n if a[i] % 2 == 0:\n cnt += 1\n else:\n a[i]//1\n if cnt:\n break\nans = (m//q) - (m//(2*q))\nif cnt == n:\n print(ans)\nelse:\n print(0)', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\nfrom fractions import gcd\ndef lcm(x,y):\n return x*y // gcd(x, y)\nq = a[0]//2\nfor i in range(n):\n a[i] = a[i]//2\n q = lcm(q,a[i])\n\ncnt = 0\nflag = 1\nwhile flag:\n for i in range(n):\n if a[i] % 2 == 1:\n cnt += 1\n else:\n a[i]//1\n if cnt != 0:\n flag = 0\nans = (m//q) - (m//(2*q))\nif cnt == n:\n print(ans)\nelse:\n print(0)', 'from math import gcd\ndef lcm(x,y):\n return x*y//gcd(x,y)\ndef cnt(x):\n i = 0\n while x%2 == 0:\n x = x//2\n i += 1\n return i \nn,m = map(int,input().split())\na = list(map(int,input().split()))\nmemo = cnt(a[0])\nfor i in range(n):\n if cnt(a[i]) != memo:\n print(0)\n quit()\n a[i] = a[i]//2\n\nt = 1\nfor i in range(n):\n t = lcm(t,a[i])\nprint(m//t-m//(2*t))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s219259166', 's583316995', 's924041348', 's929913887', 's937342859', 's901047657']
[14124.0, 14892.0, 14892.0, 15060.0, 14356.0, 20448.0]
[169.0, 2104.0, 166.0, 42.0, 2108.0, 299.0]
[252, 277, 241, 420, 410, 393]
p02814
u956530786
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['def lcm(a, b):\n return a // gcd(a, b) * b\n\ndef gcd(a, b):\n if(b == 0): return a\n else: return gcd(b, a % b)\n\ndef cnt(a):\n res = 0\n while(a and a % 2 == 0):\n a //= 2\n res += 1\n return res\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nl = 1\nc = cnt(A[0])\nfor a in A:\n if cnt(a) != c or c == 1:\n print(0)\n exit()\n else:\n l = lcm(l, a)\nd = m // l\nprint((d + 1) // 2)', 'def lcm(a, b):\n return a // gcd(a, b) * b\n\ndef gcd(a, b):\n if(b == 0): return a\n else: return gcd(b, a % b)\n\ndef cnt(a):\n res = 0\n while(a and a % 2 == 0):\n a //= 2\n res += 1\n return res\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nl = 1\nc = cnt(A[0])\nprint(c)\nfor a in A:\n if cnt(a) != c or c == 0:\n print(0)\n exit()\n else:\n l = lcm(l, a // 2)\nprint(l)\nd = m // l\nprint((d + 1) // 2)', 'def lcm(a, b):\n return a // gcd(a, b) * b\n\ndef gcd(a, b):\n if(b == 0): return a\n else: return gcd(b, a % b)\n\ndef cnt(a):\n res = 0\n while(a and a % 2 == 0):\n a //= 2\n res += 1\n return res\n\nn, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nl = 1\nc = cnt(A[0])\nfor a in A:\n if cnt(a) != c or c == 0:\n print(0)\n exit()\n else:\n l = lcm(l, a // 2)\nd = m // l\nprint((d + 1) // 2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s152817395', 's619378443', 's602446241']
[19948.0, 19988.0, 20136.0]
[318.0, 316.0, 333.0]
[410, 433, 415]
p02814
u969190727
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\ninput=lambda: sys.stdin.readline().rstrip()\n\nn,m=map(int,input().split())\nA=[int(i)//2 for i in input().split()]\nct=0\ns=A[0]\nwhile s:\n if s%2==0:\n s//=2\n ct+=1\n else:\n s=0\nchk=True\nfor i in range(1,n):\n cur=0\n a=A[i]\n while a:\n if a%2==0:\n a//=2\n cur+=1\n else:\n a=0\n if cur!=ct:\n chk=False\n break\n\n\ndef gcd(a,b):\n while b:\n a,b=b,a%b\n return a\nif not chk:\n print(0)\nelse:\n lcm=A[0]\n for i in range(1,n):\n lcm*=A[i]//gcd(lcm,A[i])\n print((m//lcm+1)//2)', 'import sys\ninput=lambda: sys.stdin.readline().rstrip()\n\nn,m=map(int,input().split())\nA=[int(i)//2 for i in input().split()]\nct=0\ns=A[0]\nwhile s:\n if s%2==0:\n s//=2\n ct+=1\n else:\n s=0\nchk=True\nfor i in range(1,n):\n cur=0\n a=A[i]\n while a:\n if a%2==0:\n a//=2\n cur+=1\n else:\n a=0\n if cur!=ct:\n chk=False\n break\n\n\ndef gcd(a,b):\n while b:\n a,b=b,a%b\n return a\nif not chk:\n print(0)\nelse:\n lcm=A[0]\n for i in range(1,n):\n lcm*=A[i]//gcd(lcm,A[i])\n print((m//lcm+1)//2)']
['Runtime Error', 'Accepted']
['s961728942', 's050166463']
[3064.0, 15060.0]
[17.0, 812.0]
[506, 516]
p02814
u970197315
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\ndef lcm(x, y):\n \n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nb=[]\nlc=[]\n\n\n# b.append(a[i]//2)\n# print(a)\nfor i in range(n):\n a[i]//=2\n# print(a)\nt=0\nfor i in range(n-1):\n if i==0:\n t=lcm(a[i],a[i+1])\n lc.append(t)\n elif i!=0:\n t=lcm(lc[i-1],a[i+1])\n # t=min(lc[i-1],t)\n lc.append(t)\n# print(lc)\n# print(max(a))\n# ans=(m-max(a)//max(lc))//2\nans=0\nans=(m+max(a))//max(lc)\nif ans%2==1:\n ans//=2\n ans+=1\nelse:\n ans//=2\nprint(ans)\n\n', '# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\ndef lcm(x, y):\n \n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nlc=[]\nans=0\nif n==1:\n ans=(m+a[0])//(a[0]//2)\n if ans%2==1:\n ans//=2\n ans+=1\n else:\n ans//=2\n print(ans)\n exit()\n\n# b.append(a[i]//2)\n# print(a)\nfor i in range(n):\n a[i]//=2\n# print(a)\nt=0\nfor i in range(n-1):\n if i==0:\n t=lcm(a[i],a[i+1])\n lc.append(t)\n elif i!=0:\n t=lcm(lc[i-1],a[i+1])\n # t=min(lc[i-1],t)\n lc.append(t)\n\nif len(lc)==0:\n print(0)\n exit()\n\n\nans=(m+max(a))//max(lc)\nif ans%2==1:\n ans//=2\n ans+=1\nelse:\n ans//=2\nprint(ans)\n', '# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\nfrom math import ceil\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nans=0\na=[x//2 for x in a] \n\nlcm_v=a[0]\nfor i in range(n):\n lcm_v=lcm(lcm_v,a[i])\nok_flg=[(lcm_v//i)%2==1 for i in a]\nif all(ok_flg):\n ans=ceil((m/lcm_v)/2)\nprint(ans)\n\n', '# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\ndef lcm(x, y):\n \n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nlc=[]\nans=0\nif n==1:\n ans=m//(a[0]//2)\n if ans%2==1:\n ans//=2\n ans+=1\n else:\n ans//=2\n print(ans)\n exit()\n\nfor i in range(n):\n a[i]//=2\n\nt=0\nfor i in range(n-1):\n if i==0:\n t=lcm(a[i],a[i+1])\n lc.append(t)\n elif i!=0:\n t=lcm(lc[i-1],a[i+1])\n lc.append(t)\n\nif len(lc)==0:\n print(0)\n exit()\n\n\nans=m//max(lc)\nif ans%2==1:\n ans//=2\n ans+=1\nelse:\n ans//=2\nprint(ans)\n\n', '# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\nfrom math import ceil\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nans=0\na=[x//2 for x in a] \n\nlcm_v=a[0]\nfor i in range(n):\n lcm_v=lcm(lcm_v,a[i])\nok_flg=[(lcm_v//i)%2==1 for i in a]\nif all(ok_flg):\n ans=((m//lcm)+1)//2\nprint(ans)\n\n', '# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\nfrom math import ceil\ndef lcm(x, y):\n \n return (x * y) // gcd(x, y)\nn,m=nm()\na=nl()\nlc=[]\nans=0\nif n==1:\n ans=m//(a[0]//2)\n ans=ceil(ans/2)\n # if ans%2==1:\n # ans//=2\n # ans+=1\n # else:\n # ans//=2\n print(ans)\n exit()\n\nfor i in range(n):\n a[i]//=2\n\nt=0\nfor i in range(n-1):\n if i==0:\n t=lcm(a[i],a[i+1])\n lc.append(t)\n elif i!=0:\n t=lcm(lc[i-1],a[i+1])\n lc.append(t)\n\nif len(lc)==0:\n print(0)\n exit()\n\n\nans=m//max(lc)\nans=ceil(ans/2)\n# if ans%2==1:\n# ans//=2\n# ans+=1\n# else:\n# ans//=2\nprint(ans)\n\n', 'from math import gcd, ceil\n\n\ndef lcm(a, b):\n return (a*b)//gcd(a, b)\n\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\n\nfor i in range(n):\n a[i] = a[i]//2\n\nlcm_v = a[0]\nfor i in range(1, n):\n lcm_v = lcm(lcm_v, a[i])\n\nok = True\nfor aa in a:\n if (lcm_v//aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m//lcm_v)+1)//2\nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s125020287', 's682064364', 's717299531', 's721419140', 's941242458', 's957415372', 's856136819']
[301192.0, 301192.0, 16404.0, 20448.0, 16276.0, 20448.0, 20232.0]
[2122.0, 2123.0, 251.0, 209.0, 251.0, 203.0, 206.0]
[852, 967, 427, 860, 425, 938, 387]
p02814
u978178314
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import sys\nsys.setrecursionlimit(10**5)\nimport fractions\nfrom functools import reduce\n\ndef lcm_base(x, y):\n return (x * y) // fractions.gcd(x, y)\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\nN, M = map(int, input().split())\nX_2 = lcm_list(list(map(int, input().split())))\nX = X_2//2\nprint(M//X-M//X_2)', 'import sys\nsys.setrecursionlimit(10**5)\ndef GCM(a, b):\n a, b = max(a,b), min(a, b)\n r = a % b\n if r == 0:\n return b\n else:\n return GCM(b, r)\n\ndef LCD(a, b):\n g = GCM(a, b)\n return (a//g)*b\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nX = A[0]//2\nfor a in A[1:]:\n b = a//2\n newX = LCD(X, a//2)\n if (newX // b)%2 == 0:\n print(0)\n sys.exit(0)\n else:\n X = newX\nX_2 = X*2\nprint(M//X-M//X_2)']
['Wrong Answer', 'Accepted']
['s594981974', 's988427133']
[16348.0, 15060.0]
[2104.0, 244.0]
[382, 435]
p02814
u984276646
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\np = 0\nfor i in A:\n if i % 2 == 0:\n i //= 2\n else:\n p = 1\n break\nL = A[0]\nk = 0\nwhile A[0] % 2 == 0:\n k += 1\n A[0] //= 2\nfor i in range(1, N):\n a, b = L, A[i]\n while b != 0:\n a, b = b, a % b\n b = A[i] // a\n L *= b\n cnt = 0\n while A[i] % 2 == 0:\n cnt += 1\n A[i] //= 2\n if cnt != k:\n p = 1\n break\nif p == 1:\n S = 0\nelse:\n S = M // L - M // (2 * L)\nprint(S)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\np = 0\nfor i in range(N):\n if A[i] % 2 == 0:\n A[i] //= 2\n else:\n p = 1\n break\nL = A[0]\nk = 0\nwhile A[0] % 2 == 0:\n k += 1\n A[0] //= 2\nfor i in range(1, N):\n a, b = L, A[i]\n while b != 0:\n a, b = b, a % b\n b = A[i] // a\n L *= b\n cnt = 0\n while A[i] % 2 == 0:\n cnt += 1\n A[i] //= 2\n if cnt != k:\n p = 1\n break\nif p == 1:\n S = 0\nelse:\n S = M // L - M // (2 * L)\nprint(S)']
['Wrong Answer', 'Accepted']
['s300120484', 's826775703']
[15060.0, 15060.0]
[909.0, 940.0]
[459, 472]
p02814
u989345508
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['\n\n#include<cmath>\n#include<algorithm>\nusing namespace std;\n\nint gcd(int x,int y){\n if(x<y) swap(x,y);\n //xの方が常に大きい\n while(y>0){\n int r=x%y;\n x=y;\n y=r;\n }\n return x;\n}\n\nint lcm(int x,int y){\n return int(x*y/gcd(x,y));\n}\n\n//n個の場合のlcmも2個で比べて順に適用していくだけ\nint main(){\n int n,m;cin >> n >> m;\n vector<int> a(n);for(int i=0;i<n;i++){cin >> a[i];a[i]/=2;}\n int ans=lcm(a[0],a[1]);\n for(int i=1;i<n;i++){ans=lcm(ans,a[i]);}\n //cout << ans << endl;\n cout << int((floor(m/ans)+1)/2) << endl;\n}\n', 'from math import gcd\ndef lcm(a,b):\n return a//gcd(a,b)*b\ndef lcm(ab):\n l=len(ab)\n ret=ab[0]\n for i in range(1,l):\n ret=ret//gcd(ab[i],ret)*ab[i]\n return ret\ndef count2(a):\n ret=0\n while a%2==0:\n a//=2\n ret+=1\n return 2**ret\nn,m=map(int,input().split())\nA=list(map(int,input().split()))\n\nif any(i%2 for i in A):\n exit(print(0))\nA=[i//2 for i in A]\n\np=lcm(A)\nc=count2(p)\n\nif any(i%c for i in A):\n exit(print(0))\nx=m//p\n#print(p//c)\nprint(-(-x//2))']
['Runtime Error', 'Accepted']
['s639528535', 's987408258']
[2940.0, 20632.0]
[17.0, 125.0]
[595, 614]
p02814
u997641430
2,000
1,048,576
Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M. Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N): * There exists a non-negative integer p such that X= a_k \times (p+0.5). Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).
['import functools\nimport fractions\ndef lcm(a, b):\n return a * b // fractions.gcd(a, b)\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nLCM=functools.reduce(lcm,A)\nHLCM=LCM//2\nY=M//HLCM\nif Y%2==0:\n print(Y//2)\nelse:\n print((Y+1)//2)\n', 'def gcd(a, b):\n a_, b_ = a, b\n while a_:\n a_, b_ = b_ % a_, a_\n return b_\n\n\ndef lcm(a, b):\n return a*b//gcd(a, b)\n\n\ndef count(x):\n x_ = x\n cnt = 0\n while x_ % 2 == 0:\n x_ = x_//2\n cnt += 1\n return cnt\n\n\nN, M = map(int, input().split())\n*A, = map(int, input().split())\nif len(set([count(a) for a in A])) > 1:\n print(0)\nelse:\n A = [a//2 for a in A]\n while len(A) > 1:\n a = A.pop()\n b = A.pop()\n A.append(lcm(a, b))\n t = A.pop()\n q = M//t\n if q % 2 == 0:\n print(q//2)\n else:\n print((q+1)//2)\n']
['Wrong Answer', 'Accepted']
['s180128694', 's641912336']
[16308.0, 14244.0]
[2104.0, 522.0]
[254, 590]
p02815
u006251926
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['from math import factorial\n\ndef comb(a,d):\n return factorial(a)//factorial(b)//factorial(a-b)\n\nmod = 10**9+7\n\nN = int(input())\nC_input = list(map(int, input().split()))\n\nC = sorted(C_input)\nans = 0\nfor ind, s in enumerate(C):\n ans+= C[ind]* 2**(N-2) * (N+1-ind)\n ans %= mod\nprint(ans*2**N %mod)', 'import sys\ninput = sys.stdin.readline\nfrom math import factorial\n\ndef comb(a,d):\n return factorial(a)//factorial(b)//factorial(a-b)\n\nmod = 10**9+7\n\nN = int(input())\nC_input = list(map(int, input().split()))\n\nC = sorted(C_input)\nans = 0\nfor ind, s in enumerate(C):\n ans+= C[ind] * (N+1-ind)\n ans %= mod\nprint(int(ans* 2**(2*N-2)) %mod)']
['Wrong Answer', 'Accepted']
['s012119474', 's335758714']
[27300.0, 27276.0]
[2105.0, 244.0]
[303, 343]
p02815
u113971909
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['md = 10**9+7\nN=int(input())\nC=list(map(int, input().split()))\nC.sort()\nans = 0\nfor i in range(N):\n ans +=C[i]*(2**N-2*i)%md\nans = (ans * (2**N)) %md\nprint(ans)', 'md = 10**9+7\nN = int(input())\nNN0 = (2**N)%md\nNN1 = (2**(N-1))%md\nNN2 = (2**(N-2))%md\nC = list(map(int, input().split()))\nC.sort()\nans = 0\nfor i in range(N):\n ans += ((C[i]%md) * NN1 )%md\n if i != (N-1):\n ans += ( (C[i]%md)*(N-1-i) * NN2 )%md\nans = (ans * NN0) %md\nprint(ans)']
['Wrong Answer', 'Accepted']
['s594404119', 's623748630']
[26024.0, 25768.0]
[2104.0, 316.0]
[160, 288]
p02815
u152589615
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['# coding: utf-8\n\nimport itertools\n\nN = int(input())\nC = [int(x) for x in input().split()]\n\n\nC.sort()\n\n\nsum = 0\nfor i in range(N):\n\tsum += (N + 1 - i) * C[i]\nsum *= 2 ** (N - 2)\nsum *= 2 ** N\n\n\nprint(sum % (10 ** 9 + 7))', '# coding: utf-8\n\nimport itertools\nimport sys\n\nN = int(input())\nC = [int(x) for x in input().split()]\n\n\nC.sort()\n\n\nsum = 0\nfor i in range(N):\n\tsum += (N + 1 - i) * C[i]\nsum *= 2 ** (N - 2)\nsum *= 2 ** N\n\n\nprint(int(sum % (10 ** 9 + 7)))']
['Wrong Answer', 'Accepted']
['s134625882', 's283967786']
[25768.0, 25772.0]
[215.0, 228.0]
[366, 382]
p02815
u163320134
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['mod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\nprint(arr)\nans=0\nfor i in range(n):\n ans+=pow(2,2*n-1,mod)*(1+(n-i-1)/2)*arr[i]\n ans%=mod\nprint(int(ans))', 'mod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\nprint(arr)\nans=0\ntable=[1]\nfor _ in range(n):\n tmp=table[-1]*2\n tmp%=mod\n table.append(tmp)\nfor i in range(n):\n if i==n-1: \n ans+=(table[i-1]*(n-i+1)*arr[i])%mod\n else:\n ans+=(table[i]*(n-i+1)*table[n-i-2]*arr[i])%mod\nprint((ans*table[n])%mod)', 'mod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\nans=0\ntable=[1]\nfor _ in range(n):\n tmp=table[-1]*2\n tmp%=mod\n table.append(tmp)\nfor i in range(n):\n if i==n-1: \n ans+=(table[i-1]*(n-i+1)*arr[i])%mod\n else:\n ans+=(table[i]*(n-i+1)*table[n-i-2]*arr[i])%mod\nprint((ans*table[n])%mod)', 'mod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\nans=0\ntotal=pow(2,2*n-2,mod)\nfor i in range(n):\n ans+=total*(n-i+1)*arr[i]\n ans%=mod\nprint(int(ans))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s122742546', 's417217888', 's585879466', 's336536025']
[27108.0, 25768.0, 26024.0, 26800.0]
[747.0, 396.0, 367.0, 242.0]
[185, 335, 324, 181]
p02815
u201234972
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
["def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return(a)\n\ndef lcm(a, b):\n return a*b//gcd(a,b)\n#import sys\n#input = sys.stdin.readline\ndef main():\n N, M = map( int, input().split())\n A = list( map( int, input().split()))\n B = [a for a in A]\n T = 1\n L = 1\n C = [0]*N\n for i in range(N):\n for _ in range(30):\n if B[i]%2 == 0:\n B[i] //= 2\n C[i] += 1\n else:\n break\n p = C[0]\n for i in range(N-1):\n if p != C[i+1]:\n print(0)\n return\n q = pow(2,p)\n t = 1\n for i in range(N):\n t = lcm(t,A[i]//2)\n if t > M:\n print(0)\n return\n\n print((M-t)//t + 1)\n\nif __name__ == '__main__':\n main()\n\n", "def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return(a)\n\ndef lcm(a, b):\n return a*b//gcd(a,b)\n#import sys\n#input = sys.stdin.readline\ndef main():\n N, M = map( int, input().split())\n A = list( map( int, input().split()))\n B = [a for a in A]\n T = 1\n L = 1\n C = [0]*N\n for i in range(N):\n for _ in range(30):\n if B[i]%2 == 0:\n B[i] //= 2\n C[i] += 1\n else:\n break\n p = C[0]\n for i in range(N-1):\n if p != C[i+1]:\n print(0)\n return\n q = pow(2,p)\n t = 1\n for i in range(N):\n t = lcm(t,A[i]//2)\n if t > M:\n print(0)\n return\n\n print((M-t)//t + 1)\n\nif __name__ == '__main__':\n main()\n\n", "def main():\n N = int( input())\n Q = 10**9+7\n C = list( map( int, input().split()))\n C.sort()\n ans = 1\n if N == 1:\n print(C[0]*2%Q)\n return\n for i in range(N-1):\n ans += pow(2,i,Q)*(((N-1)-i)*pow(2,N-2-i,Q) + pow(2, N-1-i, Q))*C[i]%Q\n ans %= Q\n ans += pow(2, N-1, Q)*C[N-1]%Q\n ans -= 1\n print(ans*pow(2,N,Q)%Q)\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s181297930', 's264055329', 's876369171']
[3188.0, 3064.0, 25768.0]
[18.0, 18.0, 1322.0]
[763, 763, 406]
p02815
u223904637
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['n=int(input())\nmod=10**9+7\nc=list(map(int,input().split()))\nc.sort()\nans=0\nfor i in range(n):\n ans+=c[i]*(n-i)\n ans%=mod\nprint(ans*pow(4,n-1,mod)%mod)', 'n=int(input())\nmod=10**9+7\nc=list(map(int,input().split()))\nc.sort()\nans=0\nfor i in range(n):\n ans+=c[i]*(1+i)\n ans%=mod\nprint(ans*pow(4,n-1,mod)%mod)\n', 'n=int(input())\nmod=10**9+7\nc=list(map(int,input().split()))\nc.sort()\nans=0\nfor i in range(n):\n ans+=c[i]*(n-i+2)\n ans%=mod\nprint(ans*pow(4,n-1,mod)%mod)\n', 'n=int(input())\nmod=10**9+7\nc=list(map(int,input().split()))\nc.sort()\nans=0\nfor i in range(n):\n ans+=c[i]*(n-i+1)\n ans%=mod\nprint((ans*pow(4,n-1,mod))%mod)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s010009127', 's054878442', 's958496195', 's766039797']
[27108.0, 27244.0, 25768.0, 26800.0]
[223.0, 214.0, 225.0, 226.0]
[156, 157, 159, 161]
p02815
u254886300
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['import sys\nINF=1e9\nmod=1e9+7\nn=int(input())\nlit=list(map(int,input().split()))\nlit.sort()\nans=0\nfor i in range(n):\n ans=(ans+lit[i]*(n-i+1)%mod)%mod\nfor i in range(2*(n-1)):\n ans=ans*2%mod\nprint(ans)\n', 'import sys\nINF=1e9\nmod=1e9+7\nn=int(input())\nlit=list(map(int,input().split()))\nlit.sort()\nans=0\nfor i in range(n):\n ans=(ans+lit[i]*(n-i+1)%mod)%mod\nfor i in range((n-1)):\n ans=ans*4%mod\nans=int(ans)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s676757473', 's049771514']
[26024.0, 26024.0]
[313.0, 277.0]
[206, 217]
p02815
u263830634
2,000
1,048,576
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change. There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs, modulo (10^9+7).
['MOD = 10 ** 9 + 7\nN = int(input())\nC = list(map(int, input().split()))\nC.sort()\n\n\nlst = [0] * (N + 3)\nlst[0] = 1\nfor i in range(1, N + 3):\n lst[i] = (lst[i - 1] * 2) % MOD\n\n\nANS = 0\nfor i, c in enumerate(C):\n ANS += c * (N + 1 - i)\n\nANS *= lst[N - 2]\nANS %= MOD\nANS *= lst[N] \nprint (ANS % MOD)', 'MOD = 10 ** 9 + 7\nN = int(input())\nC = list(map(int, input().split()))\nC.sort()\n\nif N == 1:\n print (2 * C[0] % MOD)\n exit()\n\nANS = 0\nfor i, c in enumerate(C):\n ANS += c * (N + 1 - i)\n\nANS *= pow(2, N - 2, MOD)\nANS %= MOD\nANS *= pow(2, N, MOD)\nprint (ANS % MOD)']
['Wrong Answer', 'Accepted']
['s387569592', 's288495693']
[26800.0, 27108.0]
[252.0, 220.0]
[300, 269]