Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02812
n=int(input()) s=input() count=0 for i in range(len(s)): if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C': count+=1 print(count)
n=int(input()) s=input() count=0 for i in range(len(s)-2): if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C': count+=1 print(count)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
616,013
616,014
u064563749
python
p02812
n = int(input()) s = input() count = 0 for i in range(n): if s[i] == "A": if s[i+1] == "B": if s[i+2] == "C": count += 1 print(count)
n = int(input()) s = input() count = 0 for i in range(n-2): #print(s[i],s[i+1],s[i+2]) if s[i] == "A": if s[i+1] == "B": if s[i+2] == "C": count += 1 print(count)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
616,027
616,025
u293198424
python
p02812
n=int(input()) s=input() cnt=0 if len(s)<= 2: pass else: for i in range(len(s)): if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C': cnt += 1 print(cnt)
n=int(input()) s=input() cnt=0 if len(s)<= 2: pass else: for i in range(len(s)-2): if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C': cnt += 1 print(cnt)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
616,041
616,042
u857070771
python
p02812
N=int(input()) S=str(input()) count=0 for i in range(N-3): if S[i]+S[i+1]+S[i+2]=='ABC': count+=1 print(count)
N=int(input()) S=str(input()) count=0 for i in range(N-2): if S[i]+S[i+1]+S[i+2]=='ABC': count+=1 print(count)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
616,056
616,057
u748311048
python
p02812
n = int(input()) letters = input() cnt = 0 for i in range(n): if letters[i:i+3]=="abc": cnt += 1 print(cnt)
n = int(input()) letters = input() cnt = 0 for i in range(n): if letters[i:i+3]=="ABC": cnt += 1 print(cnt)
[ "literal.string.change", "literal.string.case.change", "control_flow.branch.if.condition.change" ]
616,080
616,081
u589578850
python
p02812
import sys row = sys.stdin.readline def read_int(row): return int(row().rstrip()) def read_string(row): return row().rstrip() N = read_int(row) S = read_string(row) cnt = 0 for i in range(0, len(S) -3): if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C": cnt +=1 print(cnt)
import sys row = sys.stdin.readline def read_int(row): return int(row().rstrip()) def read_string(row): return row().rstrip() N = read_int(row) S = read_string(row) cnt = 0 for i in range(0, len(S) -2): if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C": cnt +=1 print(cnt)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
616,084
616,085
u274262034
python
p02812
n = int(input()) s = input() ans = 0 for i in range(n-3): if s[i:i+3]=='ABC': ans+=1 print(ans)
n = int(input()) s = input() ans = 0 for i in range(n-2): if s[i:i+3]=='ABC': ans+=1 print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
616,097
616,098
u014250021
python
p02812
N = int(input()) S = input() """ 10 ZABCDBABCQ """ num = 0 for i in range(len(S)-3): if S[i:i+3] == "ABC": num += 1 print(num)
N = int(input()) S = input() """ 10 ZABCDBABCQ """ num = 0 for i in range(len(S)-2): if S[i:i+3] == "ABC": num += 1 print(num)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
616,105
616,106
u224353074
python
p02812
n = int(input()) s = input() c = 0 for i in range(len(s)- 3): if s[i] + s[i+1] + s[i + 2] == "ABC": c+=1 print(c)
n = int(input()) s = input() c = 0 for i in range(len(s)- 2): if s[i] + s[i+1] + s[i + 2] == "ABC": c+=1 print(c)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.loop.range.bounds.upper.change" ]
616,113
616,114
u254050469
python
p02812
i = int(input()) j = input() print(count('ABC'))
i = int(input()) j = input() print(j.count('ABC'))
[]
616,126
616,127
u201802797
python
p02813
import itertools n = int(input()) l = list(range(1,n+1)) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) r = list(itertools.permutations(l)) for i in range(len(r)): if r[i] == p: a = i elif r[i] == q: b = i print(abs(a-b))
import itertools n = int(input()) l = list(range(1,n+1)) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) r = list(itertools.permutations(l)) for i in range(len(r)): if r[i] == p: a = i if r[i] == q: b = i print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,164
616,165
u072606168
python
p02813
from itertools import permutations n = int(input()) nums1 = list(map(int,input(),split(""))) nums2 = list(map(int,input(),split(""))) t1 = tuple(nums1) t2 = tuple(nums2) index = 1 a = b = -1 for perm in permutations(list(range(1,n+1))): if perm == t1: a = index if perm == t2: b = index index += 1 print(abs(a-b))
from itertools import permutations n = int(input()) nums1 = list(map(int,input().split(" "))) nums2 = list(map(int,input().split(" "))) t1 = tuple(nums1) t2 = tuple(nums2) index = 1 a = b = -1 for perm in permutations(list(range(1,n+1))): if perm == t1: a = index if perm == t2: b = index index += 1 print(abs(a-b))
[ "assignment.value.change", "call.arguments.change", "literal.string.change" ]
616,171
616,172
u469783285
python
p02813
from itertools import permutations n = int(input()) nums1 = list(map(int,input(),split(""))) nums2 = list(map(int,input(),split(""))) t1 = tuple(nums1) t2 = tuple(nums2) index = 1 a = b = -1 for perm in permtations(list(range(1,n+1))): if perm == t1: a = index if perm == t2: b = index index += 1 print(abs(a-b))
from itertools import permutations n = int(input()) nums1 = list(map(int,input().split(" "))) nums2 = list(map(int,input().split(" "))) t1 = tuple(nums1) t2 = tuple(nums2) index = 1 a = b = -1 for perm in permutations(list(range(1,n+1))): if perm == t1: a = index if perm == t2: b = index index += 1 print(abs(a-b))
[ "assignment.value.change", "call.arguments.change", "literal.string.change", "identifier.change", "call.function.change" ]
616,173
616,172
u469783285
python
p02813
from itertools import permutations N = int(input()) P = list(map(int, input().split())) S = list(map(int, input().split())) J = list(permutations(sorted(S) , N)) print(J.index(tuple(P)) - J.index(tuple(S)))
from itertools import permutations N = int(input()) P = list(map(int, input().split())) S = list(map(int, input().split())) J = list(permutations(sorted(S) , N)) print(abs(J.index(tuple(P)) - J.index(tuple(S))))
[ "call.arguments.add", "call.arguments.change" ]
616,181
616,182
u140480594
python
p02813
def get_order(numbers, originals): from math import factorial from copy import copy numbers = copy(numbers) originals = copy(originals) total = 0 while numbers: number = numbers.pop(0) number_index = originals.index(number) originals.pop(number_index) count = (number_index ) * factorial(len(originals)) total += count return total def get_next_int(): return int(float(input())) def get_next_ints(delim=" "): return tuple([int(float(x)) for x in input().split(delim)]) def main(print=__builtins__.print): n = get_next_int() a = list(get_next_ints()) b = list(get_next_ints()) originals = list(map(int, range(1, n+1))) print(get_order(a, originals) - get_order(b, originals)) if __name__ == '__main__': main()
def get_order(numbers, originals): from math import factorial from copy import copy numbers = copy(numbers) originals = copy(originals) total = 0 while numbers: number = numbers.pop(0) number_index = originals.index(number) originals.pop(number_index) count = (number_index ) * factorial(len(originals)) total += count return total def get_next_int(): return int(float(input())) def get_next_ints(delim=" "): return tuple([int(float(x)) for x in input().split(delim)]) def main(print=__builtins__.print): n = get_next_int() a = list(get_next_ints()) b = list(get_next_ints()) originals = list(map(int, range(1, n+1))) print(abs(get_order(a, originals) - get_order(b, originals))) if __name__ == '__main__': main()
[ "call.arguments.add", "call.arguments.change" ]
616,185
616,186
u663230781
python
p02813
import itertools n=int(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) seq=range(n) l=list(itertools.permutations(seq)) #print(l[0]) a_num=0 b_num=0 for i in range(len(l)): if l[i]==a: a_num=i elif l[i]==b: b_num=i print(abs(a_num-b_num))
import itertools n=int(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) seq=range(1,n+1) l=list(itertools.permutations(seq)) #print(l[0]) a_num=0 b_num=0 for i in range(len(l)): if l[i]==a: a_num=i if l[i]==b: b_num=i print(abs(a_num-b_num))
[ "call.arguments.add", "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,193
616,192
u131406572
python
p02813
import math n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) #p p_n=0 q_n=0 for i in range(n): count_p=p[i]-1 count_q=q[i]-1 for j in range(i): if p[j]<p[i]: count_p-=1 if q[j]<q[i]: count_q-=1 p_n+=math.factorial(n-i-1)*count_p q_n+=math.factorial(n-i-1)*count_q print(p_n-q_n)
import math n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) #p p_n=0 q_n=0 for i in range(n): count_p=p[i]-1 count_q=q[i]-1 for j in range(i): if p[j]<p[i]: count_p-=1 if q[j]<q[i]: count_q-=1 p_n+=math.factorial(n-i-1)*count_p q_n+=math.factorial(n-i-1)*count_q print(abs(p_n-q_n))
[ "call.arguments.add", "call.arguments.change" ]
616,194
616,195
u377370946
python
p02813
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) length = [i+1 for i in range(n)] permut = list(itertools.permutations(length)) print(max((permut.index(p)) - (permut.index(q)) , (mm.index(q)) - mm.index(p)))
import itertools n = int(input()) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) length = [i+1 for i in range(n)] permut = list(itertools.permutations(length)) print(max((permut.index(p)) - (permut.index(q)) , (permut.index(q)) - permut.index(p)))
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
616,219
616,220
u238127001
python
p02813
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) import itertools X = list(itertools.permutations(range(1,N+1),N)) for i in range(len(X)): x = X[i] if P == x: a = i elif Q == x: b = i print(abs(a-b))
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) import itertools X = list(itertools.permutations(range(1,N+1),N)) for i in range(len(X)): x = X[i] if P == x: a = i if Q == x: b = i print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,230
616,231
u221898645
python
p02813
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) import itertools J=(list(itertools.permutations(range(n)))) for i, j in enumerate(J): if j == p: a=i if j==q: b=i print(abs(a-b))
n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) import itertools J=(list(itertools.permutations(range(1,n+1)))) #print(J) for i, j in enumerate(J): #print(j,p,q) if j == p: a=i if j==q: b=i print(abs(a-b))
[ "assignment.value.change", "identifier.change", "call.function.change", "call.arguments.add" ]
616,232
616,233
u344959886
python
p02813
import itertools N = int(sys.stdin.readline()) P = [int(v) for v in sys.stdin.readline().split()] Q = [int(v) for v in sys.stdin.readline().split()] Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)] Ps = sorted(Ps) def find(l1): for i, l3 in enumerate(Ps): if l3 == l1: return i return 0 print(abs(find(P) - find(Q)))
import sys import itertools N = int(sys.stdin.readline()) P = [int(v) for v in sys.stdin.readline().split()] Q = [int(v) for v in sys.stdin.readline().split()] Ps = [list(v) for v in itertools.permutations(range(1, N + 1),N)] Ps = sorted(Ps) def find(l1): for i, l3 in enumerate(Ps): if l3 == l1: return i return 0 print(abs(find(P) - find(Q)))
[]
616,234
616,235
u471828790
python
p02813
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) s = [] for i in range(N): s.append(i) p_list = list(itertools.permutations(s)) p_n = 0 q_n = 0 for i in range(len(p_list)): if p == p_list[i]: p_n = i if q == p_list[i]: q_n = i print(p_n - q_n) if p_n >= q_n else print(q_n - p_n)
import itertools N = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) s = [] for i in range(N): s.append(i+1) p_list = list(itertools.permutations(s)) p_n = 0 q_n = 0 for i in range(len(p_list)): if p == p_list[i]: p_n = i if q == p_list[i]: q_n = i print(p_n - q_n) if p_n >= q_n else print(q_n - p_n)
[ "expression.operation.binary.add" ]
616,240
616,241
u779728630
python
p02813
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) import itertools li=[i for i in range(1,n+1)] cnt=0 a=-1 for x in itertools.permutations(li): x=list(x) if x==p or x==q: if a>=0: print(abs(cnt-a)) exit() else: a=cnt cnt+=1
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) import itertools li=[i for i in range(1,n+1)] cnt=0 a=-1 for x in itertools.permutations(li): x=list(x) if x==p or x==q: if a>=0: print(abs(cnt-a)) exit() else: a=cnt cnt+=1 print(0)
[ "call.add" ]
616,242
616,243
u116233709
python
p02813
import itertools def main(): n = int(input()) p = tuple(input().split()) q = tuple(input().split()) a = list(itertools.permutations([str(i+1) for i in range(n)])) print(a) print(abs(a.index(q)-a.index(p))) if __name__ == "__main__": main()
import itertools def main(): n = int(input()) p = tuple(input().split()) q = tuple(input().split()) a = list(itertools.permutations([str(i+1) for i in range(n)])) print(abs(a.index(q)-a.index(p))) if __name__ == "__main__": main()
[ "call.remove" ]
616,252
616,253
u652081898
python
p02813
from itertools import permutations n = list(range(1, int(input())+1)) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) # p = ''.join(a) # q = ''.join(b) pp , qq = 0, 0 for i, j in enumerate(permutations(n)): if j == p: pp = i+1 elif j == q: qq = i+1 if pp and qq: break print(abs(pp-qq))
from itertools import permutations n = list(range(1, int(input())+1)) p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) # p = ''.join(a) # q = ''.join(b) pp , qq = 0, 0 for i, j in enumerate(permutations(n)): if j == p: pp = i+1 if j == q: qq = i+1 if pp and qq: break print(abs(pp-qq))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,256
616,257
u871440947
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) r = list(itertools.permutations(range(1,N+1))) print(abs(r.index(P)-r.index(Q)))
import itertools N = int(input()) P = tuple(map(int,input().split())) Q = tuple(map(int,input().split())) r = list(itertools.permutations(range(1,N+1))) print(abs(r.index(P)-r.index(Q)))
[ "assignment.value.change", "identifier.change", "call.function.change" ]
616,262
616,263
u106985169
python
p02813
n=(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) import itertools as it x=0 y=0 for i,j in enumerate(it.permutations(range(1,n+1))): if a==j: x=i if b==j: y=i print(abs(x-y))
n=int(input()) a=tuple(map(int,input().split())) b=tuple(map(int,input().split())) import itertools as it x=0 y=0 for i,j in enumerate(it.permutations(list(range(1,n+1)))): if a==j: x=i if b==j: y=i print(abs(x-y))
[ "call.add", "type_conversion.to_integer.change", "type_conversion.to_number.change", "call.arguments.change" ]
616,273
616,274
u995109095
python
p02813
# 大きさnの順列をすべて生成する from itertools import permutations def generate_permutations(n): perms = permutations(range(1, n+1), n) return [perm for perm in perms] n = int(input()) ptuple = tuple(map(int, input().split())) qtuple = tuple(map(int, input().split())) perms = generate_permutations(n) a = perms.index(ptuple) b = perms.index(qtuple) print(int(math.fabs(a - b)))
import math from itertools import permutations def generate_permutations(n): perms = permutations(range(1, n+1), n) return [perm for perm in perms] n = int(input()) ptuple = tuple(map(int, input().split())) qtuple = tuple(map(int, input().split())) perms = generate_permutations(n) a = perms.index(ptuple) b = perms.index(qtuple) print(int(math.fabs(a - b)))
[]
616,289
616,290
u391589398
python
p02813
import itertools import math N=int(input()) P=list(map,int,input().split()) Q=list(map,int,input().split()) L=list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N)))) a=L.index(P) b=L.index(Q) print(abs(a-b))
import itertools import math N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N)))) a = L.index(P) b = L.index(Q) print(abs(a-b))
[ "call.arguments.change" ]
616,291
616,292
u631998785
python
p02813
import itertools n = int(input()) p = list(map(int, input().split())) for i in range(len(p)): p[i] = p[i]-1 p = tuple(p) q = list(map(int, input().split())) a = list(itertools.permutations(range(n))) for i in range(len(q)): q[i] = q[i]-1 q = tuple(q) print(a.index(p) - a.index(q))
import itertools n = int(input()) p = list(map(int, input().split())) for i in range(len(p)): p[i] = p[i]-1 p = tuple(p) q = list(map(int, input().split())) a = list(itertools.permutations(range(n))) for i in range(len(q)): q[i] = q[i]-1 q = tuple(q) print(abs(a.index(p) - a.index(q)))
[ "call.arguments.add", "call.arguments.change" ]
616,297
616,298
u038136206
python
p02813
import math import itertools N = int(input()) P = input() Q = input() p_list = [int(i) for i in P.split(" ")] q_list = [int(i) for i in Q.split(" ")] n = [] for i in range(N): n.append(i+1) p_num = 1 q_num = 1 for i in itertools.permutations(n): if list(i)==p_list: a = p_num elif list(i)==q_list: b = q_num p_num += 1 q_num += 1 print(abs(a-b))
import math import itertools N = int(input()) P = input() Q = input() p_list = [int(i) for i in P.split(" ")] q_list = [int(i) for i in Q.split(" ")] n = [] for i in range(N): n.append(i+1) p_num = 1 q_num = 1 for i in itertools.permutations(n): if list(i)==p_list: a = p_num if list(i)==q_list: b = q_num p_num += 1 q_num += 1 print(abs(a-b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,301
616,302
u994484340
python
p02813
N = int(stdin.readline().rstrip()) P = map(int, input().rstrip().split()) Q = map(int, input().rstrip().split()) import itertools l = list(itertools.permutations(list(range(1, N+1)))) a = l.index(tuple(P)) b = l.index(tuple(Q)) print(abs(a-b))
N = int(input().rstrip()) P = map(int, input().rstrip().split()) Q = map(int, input().rstrip().split()) import itertools l = list(itertools.permutations(list(range(1, N+1)))) a = l.index(tuple(P)) b = l.index(tuple(Q)) print(abs(a-b))
[ "assignment.value.change", "call.arguments.change" ]
616,303
616,304
u541921833
python
p02813
n = int(input()) ps = list(map(int,input().split())) qs = list(map(int,input().split())) a = 0 b = 0 r = 0 for i in range(n): if ps[i] == qs[i]: continue else: r = i break ts = ps[r:] ts.sort() ns = list(itertools.permutations(ts)) m = len(ns) for j in range(m): if list(ns[j]) == ps[r:]: a = j break for l in range(m): if list(ns[l]) == qs[r:]: b = l break print(abs(a-b))
import itertools n = int(input()) ps = list(map(int,input().split())) qs = list(map(int,input().split())) a = 0 b = 0 r = 0 for i in range(n): if ps[i] == qs[i]: continue else: r = i break ts = ps[r:] ts.sort() ns = list(itertools.permutations(ts)) m = len(ns) for j in range(m): if list(ns[j]) == ps[r:]: a = j break for l in range(m): if list(ns[l]) == qs[r:]: b = l break print(abs(a-b))
[]
616,318
616,319
u865119809
python
p02813
import itertools N = input() P = input() Q = input() string1 = tuple(map(int,list(P.split("")))) string2 = tuple(map(int,list(Q.split("")))) num =list(itertools.permutations(list(range(1, int(N)+1)))) count = 1 for i in num: if i==string1: a=count if i==string2: b=count count+=1 print(abs(a-b))
import itertools N = input() P = input() Q = input() string1 = tuple(map(int, list(P.split(" ")))) string2 = tuple(map(int, list(Q.split(" ")))) num =list(itertools.permutations(list(range(1, int(N)+1)))) count = 1 for i in num: if i == string1: a = count if i == string2: b = count count += 1 print(abs(a-b))
[ "literal.string.change", "assignment.value.change", "call.arguments.change" ]
616,325
616,326
u349753002
python
p02813
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def find_power(n): # 0!からn!までのびっくりを出してくれる関数 powlist=[0]*(n+1) powlist[0]=1 powlist[1]=1 for i in range(2,n+1): powlist[i]=powlist[i-1]*i%(10**9+7) return powlist powl=find_power(10) import math a=1 b=1 for i in range(n): c=1 d=1 subp=p[i:] subq=q[i:] for j in subp: if j<subp[0]: c+=1 for k in subq: if k<subq[0]: d+=1 a=a+c*int(powl[n-1-i]) b=b+d*int(powl[n-1-i]) print(a-b)
n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) def find_power(n): # 0!からn!までのびっくりを出してくれる関数 powlist=[0]*(n+1) powlist[0]=1 powlist[1]=1 for i in range(2,n+1): powlist[i]=powlist[i-1]*i%(10**9+7) return powlist powl=find_power(10) import math a=1 b=1 for i in range(n): c=1 d=1 subp=p[i:] subq=q[i:] for j in subp: if j<subp[0]: c+=1 for k in subq: if k<subq[0]: d+=1 a=a+c*int(powl[n-1-i]) b=b+d*int(powl[n-1-i]) print(abs(a-b))
[ "call.arguments.add", "call.arguments.change" ]
616,331
616,332
u780962115
python
p02813
from itertools import permutations N=int(input()) l=[i+1 for i in range(N)] P=tuple(map(int, input().split())) Q=tuple(map(int, input().split())) counter=0 print(P) for t in permutations(l): if P==t: a=counter if Q==t: b=counter counter+=1 print(abs(a-b))
from itertools import permutations N=int(input()) l=[i+1 for i in range(N)] P=tuple(map(int, input().split())) Q=tuple(map(int, input().split())) counter=0 for t in permutations(l): if P==t: a=counter if Q==t: b=counter counter+=1 print(abs(a-b))
[ "call.remove" ]
616,341
616,342
u095021077
python
p02813
# 2020/01/10 from itertools import permutations n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) P=list(permutations(range(1,n+1))) ans=0 for idx,e in enumerate(P,1): if e==p: ans+=idx elif e==q: ans-=idx print(abs(ans))
# 2020/01/10 from itertools import permutations n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) P=sorted(list(permutations(range(1,n+1)))) ans=0 for idx,e in enumerate(P,1): if e==p: ans+=idx if e==q: ans-=idx print(abs(ans))
[ "call.add", "call.arguments.change", "control_flow.loop.range.bounds.upper.change", "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,347
616,348
u919633157
python
p02813
import itertools N = int(input()) L1 = tuple(map(int,input().split())) a = 0 L2 = tuple(map(int,input().split())) b = 0 L = [i for i in range(1,N+1)] Base = list(itertools.permutations(L)) print(Base) for i in range(len(Base)): if Base[i] == L1: a = i+1 for i in range(len(Base)): if Base[i] == L2: b = i+1 print(abs(a-b))
import itertools N = int(input()) L1 = tuple(map(int,input().split())) a = 0 L2 = tuple(map(int,input().split())) b = 0 L = [i for i in range(1,N+1)] Base = list(itertools.permutations(L)) for i in range(len(Base)): if Base[i] == L1: a = i+1 for i in range(len(Base)): if Base[i] == L2: b = i+1 print(abs(a-b))
[ "call.remove" ]
616,365
616,366
u617037231
python
p02813
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) pos = 0 pos_p = 0 pos_q = 0 for i in itertools.permutations(range(1,N)): pos += 1 if i == P: pos_p = pos if i == Q: pos_q = pos print(abs(pos_p - pos_q))
import itertools N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) pos = 0 pos_p = 0 pos_q = 0 for i in itertools.permutations(range(1,N + 1)): pos += 1 if i == P: pos_p = pos if i == Q: pos_q = pos print(abs(pos_p - pos_q))
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
616,369
616,370
u205936263
python
p02813
n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) import itertools pi = 0 count = 1 for i in itertools.permutations(range(1, n+1), n): if list(i) == p: pi = count break else: count += 1 qi = 0 count = 1 for i in itertools.permutations(range(1, n+1), n): if list(i) == q: qi = count break else: count += 1 print(pi, qi) ans = abs(pi - qi) print(ans)
n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) import itertools pi = 0 count = 1 for i in itertools.permutations(range(1, n+1), n): if list(i) == p: pi = count break else: count += 1 qi = 0 count = 1 for i in itertools.permutations(range(1, n+1), n): if list(i) == q: qi = count break else: count += 1 ans = abs(pi - qi) print(ans)
[ "call.remove" ]
616,371
616,372
u148551245
python
p02813
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools tmp = [i for i in range(1,N+1)] #print(tmp) tmp2 = itertools.permutations(tmp) a,b = 0,0 for n,j in enumerate(tmp2): #print(n,j) if list(j)==P: a = n+1 elif list(j)==Q: b = n+1 res=abs(a-b) print(res)
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools tmp = [i for i in range(1,N+1)] #print(tmp) tmp2 = itertools.permutations(tmp) a,b = 0,0 for n,j in enumerate(tmp2): #print(n,j) if list(j)==P: a = n+1 #print(a) if list(j)==Q: b = n+1 #print(b) res=abs(a-b) print(res)
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,375
616,376
u933717615
python
p02813
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools s = [] for j in range(N): s.append(j + 1) n_P = 0 n_Q = 0 list_seed = list(itertools.permutations(s, N)) list_seed = [list(list_seed[i]) for i in range(len(list_seed))] for i in range(len(list_seed)): if list_seed[i] == P: n_P = i + 1 elif list_seed[i] == Q: n_Q = i + 1 print(abs(n_P - n_Q))
N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) import itertools s = [] for j in range(N): s.append(j + 1) n_P = 0 n_Q = 0 list_seed = list(itertools.permutations(s, N)) list_seed = [list(list_seed[i]) for i in range(len(list_seed))] for i in range(len(list_seed)): if list_seed[i] == P: n_P = i + 1 if list_seed[i] == Q: n_Q = i + 1 print(abs(n_P - n_Q))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,378
616,379
u374517193
python
p02813
import itertools n=int(input()) p=list(map(int,input().split())) q=list(map(int,input().split())) l=list(range(1,n+1)) ll=itertools.permutations(l,n) pp=ll.index(p) qq=ll.index(q) a=pp-qq if a<0: a=a*(-1) print(str(a))
import itertools n=int(input()) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) l=list(range(1,n+1)) ll=list(itertools.permutations(l,n)) pp=ll.index(p) qq=ll.index(q) a=pp-qq if a<0: a=a*(-1) print(str(a))
[ "assignment.value.change", "identifier.change", "call.function.change", "call.add", "call.arguments.change" ]
616,380
616,381
u291988695
python
p02813
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) perm = list(permutations(range(1, N+1), N)) print(abs(perm.index(P) - perm.index(Q)))
from itertools import permutations N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) perm = list(permutations(range(1, N+1), N)) print(abs(perm.index(P) - perm.index(Q)))
[]
616,384
616,385
u723790132
python
p02813
if __name__ == '__main__': from itertools import permutations N = int(input()) P = input() P = ''.join(P.split()) Q = input() Q = ''.join(Q.split()) base = '' for i in range(N): base += str(i+1) perm = sorted(''.join(chars) for chars in permutations(base)) x = -1 y = -1 for idx, p in enumerate(perm): if P == p: x = idx elif Q == p: y = idx if not (x == -1) and not (y == -1): break print(abs(x-y))
if __name__ == '__main__': from itertools import permutations N = int(input()) P = input() P = ''.join(P.split()) Q = input() Q = ''.join(Q.split()) base = '' for i in range(N): base += str(i+1) perm = sorted(''.join(chars) for chars in permutations(base)) x = -1 y = -1 for idx, p in enumerate(perm): if P == p: x = idx if Q == p: y = idx if not (x == -1) and not (y == -1): break print(abs(x-y))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,388
616,389
u296758006
python
p02813
if __name__ == '__main__': n = int(input()) s1 = [int(i) for i in input().split()] s2 = [int(i) for i in input().split()] l = [] for i in range(n): l.append(i+1) g = [] for v in itertools.permutations(l, n): h = "" for i in v: h=h+str(i) g.append(h) g.sort() index1 = "" index2 = "" for i in s1: index1 = index1 +str(i) for i in s2: index2 = index2 +str(i) print(abs(g.index(index1) - g.index(index2)))
import itertools if __name__ == '__main__': n = int(input()) s1 = [int(i) for i in input().split()] s2 = [int(i) for i in input().split()] l = [] for i in range(n): l.append(i+1) g = [] for v in itertools.permutations(l, n): h = "" for i in v: h=h+str(i) g.append(h) g.sort() index1 = "" index2 = "" for i in s1: index1 = index1 +str(i) for i in s2: index2 = index2 +str(i) print(abs(g.index(index1) - g.index(index2)))
[]
616,400
616,401
u290187182
python
p02813
import itertools as it N=int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) l=[n for n in range(1,N+1)] for i,t in enumerate(it.permutations(l)): if t==P: a=i+1 elif t==Q: b=i+1 ans=abs(b-a) print(ans)
import itertools as it N=int(input()) P=tuple(map(int,input().split())) Q=tuple(map(int,input().split())) l=[n for n in range(1,N+1)] for i,t in enumerate(it.permutations(l)): if t==P: a=i+1 if t==Q: b=i+1 ans=abs(b-a) print(ans)
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,404
616,405
u042802884
python
p02813
import itertools n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = sorted(p) a = 0 b = 0 for i, j in enumerate(itertools.permutations(r, 3)): if list(j) == p: a = i if list(j) == q: b = i print(abs(b-a))
import itertools n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = sorted(p) a = 0 b = 0 for i, j in enumerate(itertools.permutations(r)): if list(j) == p: a = i if list(j) == q: b = i print(abs(b-a))
[ "call.arguments.change" ]
616,406
616,407
u864989756
python
p02813
from itertools import permutations as p N=int(input()) l=list(p(range(1,N+1))) A=tuple(map(int, input().split())) B=tuple(map(int, input().split())) fa=True fb=True for i in range(len(l)): if l[i]==A and fa: idx_a=i fa=False elif l[i]==B and fb: idx_b=i fb=False if (not fa) and (not fb): break print(abs(idx_a-idx_b))
from itertools import permutations as p N=int(input()) l=list(p(range(1,N+1))) A=tuple(map(int, input().split())) B=tuple(map(int, input().split())) fa=True fb=True for i in range(len(l)): if l[i]==A and fa: idx_a=i fa=False if l[i]==B and fb: idx_b=i fb=False if (not fa) and (not fb): break print(abs(idx_a-idx_b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,430
616,431
u058809975
python
p02813
from math import factorial n = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] def f(X): c = 0 a = [i+1 for i in range(n)] for i in range(n): a.sort() # print(X, a, c) if X[i]!=min(a): c += factorial(n-i-1)*(a.index(X[i])) del a[a.index(X[i])] return c+1 print(f(P)-f(Q))
from math import factorial n = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] def f(X): c = 0 a = [i+1 for i in range(n)] for i in range(n): a.sort() # print(X, a, c) if X[i]!=min(a): c += factorial(n-i-1)*(a.index(X[i])) del a[a.index(X[i])] return c+1 print(abs(f(P)-f(Q)))
[ "call.arguments.add", "call.arguments.change" ]
616,432
616,433
u821432765
python
p02813
import itertools n = int(input()) p_list = tuple(map(int, input().split())) q_list = tuple(map(int, input().split())) seq = [i for i in range(1,n+1)] seq_list = list(itertools.permutations(seq)) sorted_seq = sorted(seq_list) for i in range(1, len(sorted_seq)): if p_list == sorted_seq[i]: a = i if q_list == sorted_seq[i]: b = i print(abs(a - b))
import itertools n = int(input()) p_list = tuple(map(int, input().split())) q_list = tuple(map(int, input().split())) seq = [i for i in range(1,n+1)] seq_list = list(itertools.permutations(seq)) sorted_seq = sorted(seq_list) for i in range(len(sorted_seq)): if p_list == sorted_seq[i]: a = i if q_list == sorted_seq[i]: b = i print(abs(a - b))
[ "call.arguments.change" ]
616,434
616,435
u558494840
python
p02813
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = list(range(1,N+1)) Alist=[] import itertools for v in itertools.permutations(A): Alist.append(v) a_num = Alist.index(P)+1 b_num = Alist.index(Q)+1 print(b_num - a_num)
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = list(range(1,N+1)) Alist=[] import itertools for v in itertools.permutations(A): Alist.append(v) a_num = Alist.index(P)+1 b_num = Alist.index(Q)+1 print(abs(b_num - a_num))
[ "call.arguments.add", "call.arguments.change" ]
616,436
616,437
u765401716
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i break else: pass print(abs(A-B) if A != 0 and B != 0 else 0)
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i continue print(abs(A-B) if A != 0 and B != 0 else 0)
[ "control_flow.break.remove", "control_flow.continue.add" ]
616,438
616,439
u748999254
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i break else: pass print(abs(A-B) if A != 0 and B != 0 else 0)
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i continue else: pass print(abs(A-B) if A != 0 and B != 0 else 0)
[ "control_flow.break.remove", "control_flow.continue.add" ]
616,438
616,440
u748999254
python
p02813
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i break else: pass print(abs(A-B) if A != 0 and B != 0 else 0)
import itertools N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) A = B = 0 for i,v in enumerate(list(itertools.permutations(range(1,N+1))), 1): if list(v) == P: A = i elif list(v) == Q: B = i continue else: pass print(abs(A-B) if A != 0 and B != 0 else 0)
[ "control_flow.break.remove", "control_flow.continue.add" ]
616,438
616,441
u748999254
python
p02813
import copy n = int(input()) p = int(input().replace(" ", "")) q = int(input().replace(" ", "")) def hoge(numbers, s, n_list): for i in range(len(numbers)): copy_numbers = copy.deepcopy(numbers) ss = s+copy_numbers.pop(i) if len(copy_numbers) > 0: hoge(copy_numbers, ss, n_list) else: n_list.append(ss) n_list = [] for i in range(n): number_list = [str(i) for i in range(1, n+1)] s = number_list.pop(i) hoge(number_list, s, n_list) n_list.sort() ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1)) print(ans)
import copy n = int(input()) p = int(input().replace(" ", "")) q = int(input().replace(" ", "")) def hoge(numbers, s, n_list): for i in range(len(numbers)): copy_numbers = copy.deepcopy(numbers) ss = s+copy_numbers.pop(i) if len(copy_numbers) > 0: hoge(copy_numbers, ss, n_list) else: n_list.append(int(ss)) n_list = [] for i in range(n): number_list = [str(i) for i in range(1, n+1)] s = number_list.pop(i) hoge(number_list, s, n_list) n_list.sort() ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1)) print(ans)
[ "call.add", "call.arguments.change" ]
616,442
616,443
u230717961
python
p02813
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) y = [num for num in range(1, n+1)] permutation_n = list(itertools.permutations(y, 3)) a=b=0 count=1 for permu in permutation_n: if permu == p: a = count if permu == q: b = count if a != 0 and b != 0 : break count+=1 print(abs(a-b))
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) y = [num for num in range(1, n+1)] permutation_n = list(itertools.permutations(y, n)) a=b=0 count=1 for permu in permutation_n: if permu == p: a = count if permu == q: b = count if a > 0 and b > 0 : break count+=1 print(abs(a-b))
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
616,453
616,454
u717265305
python
p02813
import itertools n = int(input()) c1 = tuple(map(int, input().split())) c2 = tuple(map(int, input().split())) a = [] for i in range(1,n+1): a.append(i) b = sorted(list(itertools.permutations(a))) for i in range(len(b)): if b[i] == c1: d = i elif b[i] == c2: e = i print(abs(d-e))
import itertools n = int(input()) c1 = tuple(map(int, input().split())) c2 = tuple(map(int, input().split())) a = [] for i in range(1,n+1): a.append(i) b = sorted(list(itertools.permutations(a))) for i in range(len(b)): if b[i] == c1: d = i if b[i] == c2: e = i print(abs(d-e))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,460
616,461
u836737505
python
p02813
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) lists = list(itertools.permutations(list(range(1, n+1)), n)) print(abs(lists.index(p) - lists.index()))
import itertools n = int(input()) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) lists = list(itertools.permutations(list(range(1, n+1)), n)) print(abs(lists.index(p) - lists.index(q)))
[ "call.arguments.change" ]
616,472
616,473
u620755587
python
p02813
import itertools n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) l = [x+1 for x in range(n)] ans = [] count = 0 for v in itertools.permutations(l): count += 1 ans = list(v) if ans == a: a1 = count elif ans == b: b1 = count print(abs(a1-b1))
import itertools n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) l = [x+1 for x in range(n)] ans = [] count = 0 for v in itertools.permutations(l): count += 1 ans = list(v) if ans == a: a1 = count if ans == b: b1 = count print(abs(a1-b1))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,476
616,477
u368796742
python
p02813
import itertools as it N = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] a, b = 0, 0 count = 0 for perm in it.permutations(range(1, N + 1)): count += 1 if list(perm) == P: a = count elif list(perm) == Q: b = count print(abs(a - b))
import itertools as it N = int(input()) P = [int(i) for i in input().split()] Q = [int(i) for i in input().split()] a, b = 0, 0 count = 0 for perm in it.permutations(range(1, N + 1)): count += 1 if list(perm) == P: a = count if list(perm) == Q: b = count print(abs(a - b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,500
616,501
u774160580
python
p02813
from itertools import permutations N = int(input()) *P, = map(int, input().split()) *Q, = map(int, input().split()) P = tuple(P); Q = tuple(Q) for i, t in enumerate(permutations(range(1, N+1))): if t == P: a = i elif t == Q: b = i print(abs(a - b))
from itertools import permutations N = int(input()) *P, = map(int, input().split()) *Q, = map(int, input().split()) P = tuple(P); Q = tuple(Q) for i, t in enumerate(permutations(range(1, N+1))): if t == P: a = i if t == Q: b = i print(abs(a - b))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,504
616,505
u497046426
python
p02813
n = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) import itertools A = itertools.permutations([i+1 for i in range(n)], n) B=list(A) B.sort() # print(B) p=-1 q=-1 for i in range(len(B)): # print(P,[j for j in B[i]]) if P == [j for j in B[i]]: p=i elif Q== [j for j in B[i]]: q=i print(abs(p-q))
n = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) import itertools A = itertools.permutations([i+1 for i in range(n)], n) B=list(A) B.sort() # print(B) p=-1 q=-1 for i in range(len(B)): # print(P,[j for j in B[i]]) if P == [j for j in B[i]]: p=i if Q== [j for j in B[i]]: q=i print(abs(p-q))
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,510
616,511
u325227960
python
p02813
def main(): N = int(input()) P = tuple([int(i) for i in input().split()]) Q = tuple([int(i) for i in input().split()]) a, b = -1, -1 from itertools import permutations for i, per in enumerate(permutations(range(1, N+1), N)): if per == P: a = i+1 elif per == Q: b = i+1 print(abs(a-b)) if __name__ == '__main__': main()
def main(): N = int(input()) P = tuple([int(i) for i in input().split()]) Q = tuple([int(i) for i in input().split()]) a, b = -1, -1 from itertools import permutations for i, per in enumerate(permutations(range(1, N+1), N)): if per == P: a = i+1 if per == Q: b = i+1 print(abs(a-b)) if __name__ == '__main__': main()
[ "control_flow.branch.if.replace.add", "control_flow.branch.else_if.replace.remove" ]
616,514
616,515
u312025627
python
p02814
from math import gcd N,M = map(int,input().split()) a = list(map(int,input().split())) if len(set([i&-i for i in a])) != 1: print(0) else: x = a[0]/2 for i in range(1, len(a)): x = x*(a[i]/2//gcd(x,a[i]/2)) print(M//x-M//(2*x))
from math import gcd N,M = map(int,input().split()) a = list(map(int,input().split())) if len(set([i&-i for i in a])) != 1: print(0) else: x = a[0]//2 for i in range(1, len(a)): x = x*(a[i]//2//gcd(x,a[i]//2)) print(M//x-M//(2*x))
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
616,520
616,521
u493130708
python
p02814
import sys import math N, M = map(int, input().split()) a = list(map(lambda x: int(x) >> 1, input().split())) set(a) fdigit = 0 while True: c = 1 << fdigit if a[0] & c != 0: break fdigit += 1 alcm = 1 for i in range(N): digit = 0 while True: c = 1 << digit if a[0] & c != 0: break digit += 1 if digit != fdigit: print(0) sys.exit(0) alcm = (alcm * a[i]) // math.gcd(alcm, a[i]) print(math.ceil((M // alcm) / 2))
import sys import math N, M = map(int, input().split()) a = list(map(lambda x: int(x) >> 1, input().split())) set(a) fdigit = 0 while True: c = 1 << fdigit if a[0] & c != 0: break fdigit += 1 alcm = 1 for i in range(N): digit = 0 while True: c = 1 << digit if a[i] & c != 0: break digit += 1 if digit != fdigit: print(0) sys.exit(0) alcm = (alcm * a[i]) // math.gcd(alcm, a[i]) print(math.ceil((M // alcm) / 2))
[ "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
616,524
616,525
u565476466
python
p02814
n,m = map(int, input().split()) a = list(map(int, input().split())) from functools import reduce import math def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(numbers): return reduce(lcm_base, numbers, 1) def get2(num): cnt=0 while num %2!=0: cnt+=1 num//=2 return cnt div2=get2(a[0]) for i in range(len(a)): if div2 != get2(a[i]): print(0) exit() num = lcm(a) thr = m - num//2 if thr < 0: print(0) else: print(thr//num + 1)
n,m = map(int, input().split()) a = list(map(int, input().split())) from functools import reduce import math def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(numbers): return reduce(lcm_base, numbers, 1) def get2(num): cnt=0 while num %2==0: cnt+=1 num//=2 return cnt div2=get2(a[0]) for i in range(len(a)): if div2 != get2(a[i]): print(0) exit() num = lcm(a) thr = m - num//2 if thr < 0: print(0) else: print(thr//num + 1)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
616,530
616,531
u358254559
python
p02814
import functools N,M = map(int,input().split()) a = list(map(int,input().split())) b = [0]*N def euclid(a, b): if b == 0: return a else: return euclid(b, a%b) def multiple(a, b): return a*b // euclid(a, b) def lcm(nums): return functools.reduce(multiple, nums) def count_two(n): c = 0 while n%2 ==0: c += 1 n //= 2 return c l = [0]*N for i in range(N): l[i] = count_two(a[i]) if len(set(l)) != 1: print(0) else: p_2 = l[0] #2で何回割れるか for i in range(N): b[i] = a[i] // (2**p_2) X = lcm(b)*(2**(p_2-1)) print(X) nax = M // X print((nax+1)//2)
import functools N,M = map(int,input().split()) a = list(map(int,input().split())) b = [0]*N def euclid(a, b): if b == 0: return a else: return euclid(b, a%b) def multiple(a, b): return a*b // euclid(a, b) def lcm(nums): return functools.reduce(multiple, nums) def count_two(n): c = 0 while n%2 ==0: c += 1 n //= 2 return c l = [0]*N for i in range(N): l[i] = count_two(a[i]) if len(set(l)) != 1: print(0) else: p_2 = l[0] #2で何回割れるか for i in range(N): b[i] = a[i] // (2**p_2) X = lcm(b)*(2**(p_2-1)) nax = M // X print((nax+1)//2)
[ "call.remove" ]
616,539
616,540
u397384480
python
p02814
n,m=map(int,input().split()) a=list(map(int,input().split())) b=[a[i]//2 for i in range(n)] from math import gcd from functools import reduce def lcm(x,y): return (x*y)//gcd(x,y) x=reduce(lcm,b,1) y=reduce(lcm,a,1) if x>m: print(0) else: z=(m-x)//y+1 for i in b: if (x//i)%2==1: z=0 break print(z)
n,m=map(int,input().split()) a=list(map(int,input().split())) b=[a[i]//2 for i in range(n)] from math import gcd from functools import reduce def lcm(x,y): return (x*y)//gcd(x,y) x=reduce(lcm,b,1) y=reduce(lcm,a,1) if x>m: print(0) else: z=(m-x)//y+1 for i in b: if (x//i)%2==0: z=0 break print(z)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
616,563
616,564
u539517139
python
p02814
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd def Lcm(x): L = 1 for a in x: a=a//2 L = (a // gcd(a, L))*L return L X=Lcm(A) fg = 0 for i in A: if (X//i)%2==0: fg=1 break if fg==1: print(0) else: print(((M//X)+1)//2)
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd def Lcm(x): L = 1 for a in x: a=a//2 L = (a // gcd(a, L))*L return L X=Lcm(A) fg = 0 for i in A: if (X//(i//2))%2==0: fg=1 break if fg==1: print(0) else: print(((M//X)+1)//2)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
616,573
616,574
u113971909
python
p02814
import math N, M = map(int, input().split()) a_array = list(map(int, input().split())) Q = 2 ** 35 two_count = math.gcd(a_array[0], Q) lcm = 1 for a in a_array: aa = a // 2 if two_count != math.gcd(a, Q): print(0) exit() lcm = int(aa * lcm) / math.gcd(aa, lcm) if lcm > M: print(0) exit() # ans = ((M//lcm)+1) // 2 ans = (M-lcm) // (2*lcm) + 1 print(int(ans))
import math N, M = map(int, input().split()) a_array = list(map(int, input().split())) Q = 2 ** 35 two_count = math.gcd(a_array[0], Q) lcm = 1 for a in a_array: aa = a // 2 if two_count != math.gcd(a, Q): print(0) exit() lcm = int(aa * lcm) // math.gcd(aa, lcm) if lcm > M: print(0) exit() # ans = ((M//lcm)+1) // 2 ans = (M-lcm) // (2*lcm) + 1 print(int(ans))
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
616,580
616,581
u886633618
python
p02814
import math N, M = map(int, input().split()) a_array = list(map(int, input().split())) Q = 2 ** 35 two_count = math.gcd(a_array[0], Q) lcm = 1 for a in a_array: aa = a / 2 if two_count != math.gcd(a, Q): print(0) exit() lcm = int(aa * lcm) / math.gcd(aa, lcm) if lcm > M: print(0) exit() # ans = ((M//lcm)+1) // 2 ans = (M-lcm) // (2*lcm) + 1 print(int(ans))
import math N, M = map(int, input().split()) a_array = list(map(int, input().split())) Q = 2 ** 35 two_count = math.gcd(a_array[0], Q) lcm = 1 for a in a_array: aa = a // 2 if two_count != math.gcd(a, Q): print(0) exit() lcm = int(aa * lcm) // math.gcd(aa, lcm) if lcm > M: print(0) exit() # ans = ((M//lcm)+1) // 2 ans = (M-lcm) // (2*lcm) + 1 print(int(ans))
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
616,582
616,581
u886633618
python
p02814
n,m=map(int,input().split()) a=[ i //2 for i in list(map(int,input().split()))] def f(x): c=0 while(x%2==0): x//=2 c+=1 return c def gcd(a,b): if b==0: return a return gcd(b,a%b) def lcm(a,b): return a//gcd(a,b)*b t=f(a[0]) for i in range(len(a)): if t!=f(a[i]): exit(0) a[i]//=2**t m//=2**t l=1 for i in a: l=lcm(l,i) if l>m: print(0) exit(0) m//=l print((m+1)//2)
n,m=map(int,input().split()) a=[ i //2 for i in list(map(int,input().split()))] def f(x): c=0 while(x%2==0): x//=2 c+=1 return c def gcd(a,b): if b==0: return a return gcd(b,a%b) def lcm(a,b): return a//gcd(a,b)*b t=f(a[0]) for i in range(len(a)): if t!=f(a[i]): print(0) exit(0) a[i]//=2**t m//=2**t l=1 for i in a: l=lcm(l,i) if l>m: print(0) exit(0) m//=l print((m+1)//2)
[ "call.add" ]
616,585
616,586
u575239123
python
p02814
N,M=map(int,input().split()) a=list(map(int,input().split())) import math from functools import reduce def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) l=lcm_list(a) for s,t in enumerate(a): if l%t==0: print("0") exit() print((2*M//l+1)//2)
N,M=map(int,input().split()) a=list(map(int,input().split())) import math from functools import reduce def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) l=lcm_list(a) for s,t in enumerate(a): if (l//t)%2==0: print("0") exit() print((2*M//l+1)//2)
[ "control_flow.branch.if.condition.change", "expression.operator.arithmetic.change", "control_flow.loop.for.condition.change" ]
616,596
616,597
u173148629
python
p02814
from math import gcd from functools import reduce import copy import sys N, M, *a_n = map(int, open(0).read().split()) a_n = list(set(a_n)) a_n = [a // 2 for a in a_n] N = len(a_n) def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(a_n): return reduce(lcm_base, a_n) a_n_half = [0] * N a_n_copy = copy.copy(a_n) for i in range(N): while a_n_copy[i] % 2 == 0: a_n_copy[i] //= 2 a_n_half[i] += 1 for i in range(N-1): if a_n_half[i] != a_n_half[i+1]: print(0) sys.exit() print(-(-M // lcm_list(a_n) // 2))
from math import gcd from functools import reduce import copy import sys N, M, *a_n = map(int, open(0).read().split()) a_n = list(set(a_n)) a_n = [a // 2 for a in a_n] N = len(a_n) def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(a_n): return reduce(lcm_base, a_n) a_n_half = [0] * N a_n_copy = copy.copy(a_n) for i in range(N): while a_n_copy[i] % 2 == 0: a_n_copy[i] //= 2 a_n_half[i] += 1 for i in range(N-1): if a_n_half[i] != a_n_half[i+1]: print(0) sys.exit() print(-(-(M // lcm_list(a_n)) // 2))
[ "call.arguments.change" ]
616,598
616,599
u872538555
python
p02814
import sys import math import bisect import queue import heapq from collections import deque sys.setrecursionlimit(4100000) MOD = int(1e9+7) PI = 3.14159265358979323846264338327950288 INF = 1e18 ''' 1行のint N, K = map(int, input().split()) 1行のstring S, T = input().split() 1行の整数配列 P = list(map(int,input().split())) 改行あり x = [] y = [] for i in range(N): x1,y1=[int(i) for i in input().split()] x.append(x1) y.append(y1) N行M列の初期化 dp = [[INF] * M for i in range(N)] ''' """"""""""""""""""""""""""""""""" 最大公約数 O() """"""""""""""""""""""""""""""""" # math.gcd(a,b) def gcd(a, b): return math.gcd(a, b) """"""""""""""""""""""""""""""""" 最小公倍数 O() """"""""""""""""""""""""""""""""" def lcm(a,b): return (a*b) // math.gcd(a,b) N, M = map(int, input().split()) A = list(map(int,input().split())) twice = 1 while True: if A[0] % (twice*2) == 0: twice*=2 else: break for a in A: if a%twice != 0: print(0) sys.exit() elif a%(twice*2) == 0: print(0) sys.exit() koubais = [] # 隣り合った2つの最小公倍数のリスト for i in range(0, N, 2): if i == N-1: koubais.append(A[i]//2) break A[i] /= 2 A[i+1] /= 2 koubais.append(lcm(A[i+1], A[i])) half = 1 for i in range(len(koubais)): half = lcm(half, koubais[i]) ans = (M//half + 1) // 2 print(int(ans))
import sys import math import bisect import queue import heapq from collections import deque sys.setrecursionlimit(4100000) MOD = int(1e9+7) PI = 3.14159265358979323846264338327950288 INF = 1e18 ''' 1行のint N, K = map(int, input().split()) 1行のstring S, T = input().split() 1行の整数配列 P = list(map(int,input().split())) 改行あり x = [] y = [] for i in range(N): x1,y1=[int(i) for i in input().split()] x.append(x1) y.append(y1) N行M列の初期化 dp = [[INF] * M for i in range(N)] ''' """"""""""""""""""""""""""""""""" 最大公約数 O() """"""""""""""""""""""""""""""""" # math.gcd(a,b) def gcd(a, b): return math.gcd(a, b) """"""""""""""""""""""""""""""""" 最小公倍数 O() """"""""""""""""""""""""""""""""" def lcm(a,b): return (a*b) // math.gcd(a,b) N, M = map(int, input().split()) A = list(map(int,input().split())) twice = 1 while True: if A[0] % (twice*2) == 0: twice*=2 else: break for a in A: if a%twice != 0: print(0) sys.exit() elif a%(twice*2) == 0: print(0) sys.exit() koubais = [] # 隣り合った2つの最小公倍数のリスト for i in range(0, N, 2): if i == N-1: koubais.append(A[i]//2) break A[i] //= 2 A[i+1] //= 2 koubais.append(lcm(A[i+1], A[i])) half = 1 for i in range(len(koubais)): half = lcm(half, koubais[i]) ans = (M//half + 1) // 2 print(int(ans))
[ "expression.operator.change" ]
616,608
616,609
u433195318
python
p02814
import sys import math import bisect import queue import heapq from collections import deque sys.setrecursionlimit(4100000) MOD = int(1e9+7) PI = 3.14159265358979323846264338327950288 INF = 1e18 ''' 1行のint N, K = map(int, input().split()) 1行のstring S, T = input().split() 1行の整数配列 P = list(map(int,input().split())) 改行あり x = [] y = [] for i in range(N): x1,y1=[int(i) for i in input().split()] x.append(x1) y.append(y1) N行M列の初期化 dp = [[INF] * M for i in range(N)] ''' """"""""""""""""""""""""""""""""" 最大公約数 O() """"""""""""""""""""""""""""""""" # math.gcd(a,b) def gcd(a, b): return math.gcd(a, b) """"""""""""""""""""""""""""""""" 最小公倍数 O() """"""""""""""""""""""""""""""""" def lcm(a,b): return (a*b) // math.gcd(a,b) N, M = map(int, input().split()) A = list(map(int,input().split())) twice = 1 while True: if A[0] % (twice*2) == 0: twice*=2 else: break for a in A: if a%twice != 0: print(0) sys.exit() elif a%(twice*2) == 0: print(0) sys.exit() half = 1 # 最小公倍数の二分の一 for i in range(N): A[i] /= 2 half = lcm(half, A[i]) ans = (M//half) // 2 + int((M//half)%2 == 1) print(int(ans)) """ ATTENTION: Pythonで間に合うか?? <目安> 文字列結合、再帰関数を含む→Python 上を含まず時間が不安→PyPy3 """
import sys import math import bisect import queue import heapq from collections import deque sys.setrecursionlimit(4100000) MOD = int(1e9+7) PI = 3.14159265358979323846264338327950288 INF = 1e18 ''' 1行のint N, K = map(int, input().split()) 1行のstring S, T = input().split() 1行の整数配列 P = list(map(int,input().split())) 改行あり x = [] y = [] for i in range(N): x1,y1=[int(i) for i in input().split()] x.append(x1) y.append(y1) N行M列の初期化 dp = [[INF] * M for i in range(N)] ''' """"""""""""""""""""""""""""""""" 最大公約数 O() """"""""""""""""""""""""""""""""" # math.gcd(a,b) def gcd(a, b): return math.gcd(a, b) """"""""""""""""""""""""""""""""" 最小公倍数 O() """"""""""""""""""""""""""""""""" def lcm(a,b): return (a*b) // math.gcd(a,b) N, M = map(int, input().split()) A = list(map(int,input().split())) twice = 1 while True: if A[0] % (twice*2) == 0: twice*=2 else: break for a in A: if a%twice != 0: print(0) sys.exit() elif a%(twice*2) == 0: print(0) sys.exit() half = 1 # 最小公倍数の二分の一 for i in range(N): A[i] //= 2 half = lcm(half, A[i]) ans = (M//half) // 2 + int((M//half)%2 == 1) print(int(ans)) """ ATTENTION: Pythonで間に合うか?? <目安> 文字列結合、再帰関数を含む→Python 上を含まず時間が不安→PyPy3 """
[ "expression.operator.change" ]
616,610
616,611
u433195318
python
p02814
def main(): from math import gcd N, M = map(int, input().split()) A = list(map(int, input().split())) t = A[0] n = 1 while t % 2 == 0: n *= 2 t //= 2 for a in A: if a % n != 0 or (a // n) % 2 == 0: print(0) return lcm = 1 for a in A: lcm = lcm * a // gcd(lcm, a) if lcm // 2 > M: print(0) return print((M - t // 2) // t + 1) main()
def main(): from math import gcd N, M = map(int, input().split()) A = list(map(int, input().split())) t = A[0] n = 1 while t % 2 == 0: n *= 2 t //= 2 for a in A: if a % n != 0 or (a // n) % 2 == 0: print(0) return lcm = 1 for a in A: lcm = lcm * a // gcd(lcm, a) if lcm // 2 > M: print(0) return print((M - lcm // 2) // lcm + 1) main()
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
616,651
616,652
u347640436
python
p02814
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=tuple(map(int,input().split())) a.sort() lcm = 1 for i in a: lcm = lcm * i // gcd(lcm,i) for i in a: if (lcm//i)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=list(map(int,input().split())) a.sort() lcm = 1 for i in a: lcm = lcm * i // gcd(lcm,i) for i in a: if (lcm//i)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
[ "assignment.value.change", "identifier.change", "call.function.change" ]
616,659
616,660
u867320886
python
p02814
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=map(int,input().split()) lcm = 1 for i in a: lcm = lcm * i // gcd(lcm,i) for i in a: if (lcm/i)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=tuple(map(int,input().split())) lcm = 1 for i in a: lcm = lcm * i // gcd(lcm,i) for i in a: if (lcm//i)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
[ "call.add", "call.arguments.change", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
616,663
616,662
u867320886
python
p02814
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=map(int,input().split()) lcm = 1 for i in a: lcm = lcm * i // gcd (lcm,i) for i in a: if (lcm/a)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
import sys def gcd(x,y): while y: x,y = y , x % y return x n,m=map(int,input().split()) a=tuple(map(int,input().split())) lcm = 1 for i in a: lcm = lcm * i // gcd(lcm,i) for i in a: if (lcm//i)%2 == 0: print(0) sys.exit() print((m+lcm//2)//lcm)
[ "call.add", "call.arguments.change", "control_flow.loop.for.condition.change" ]
616,664
616,662
u867320886
python
p02814
N, M = map(int,input().split()) A = list(map(int,input().split())) # 17:22 import sys from math import gcd def lcm(a,b): return a//gcd(a,b)*b #%% ans = 0 L = 1 for i in range(N): L = lcm(L, A[i]) if L>2*M: print(0) sys.exit() L2 = L L1 = L//2 for a in A: if (L1//a)&1==0: print(0) sys.exit() ans = M//L1 - M//L2 print(ans)
N, M = map(int,input().split()) A = list(map(int,input().split())) # 17:22 import sys from math import gcd def lcm(a,b): return a//gcd(a,b)*b #%% ans = 0 L = 1 for i in range(N): L = lcm(L, A[i]) if L>2*M: print(0) sys.exit() L2 = L L1 = L//2 for a in A: if (L//a)&1==0: print(0) sys.exit() ans = M//L1 - M//L2 print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
616,687
616,688
u698176039
python
p02814
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd def lcm(x, y): return x * y // gcd(x, y) def f(n): cnt = 0 while n: if n % 2 == 0: n //= 2 cnt += 1 else: break return f l = A[0]//2 cnt = f(l) for k in range(1, N): a = A[k]//2 c = f(a) if cnt != c: print(0) exit() l = lcm(l, a) print((M // l + 1) // 2)
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd def lcm(x, y): return x * y // gcd(x, y) def f(n): cnt = 0 while n: if n % 2 == 0: n //= 2 cnt += 1 else: break return cnt l = A[0]//2 cnt = f(l) for k in range(1, N): a = A[k]//2 c = f(a) if cnt != c: print(0) exit() l = lcm(l, a) print((M // l + 1) // 2)
[ "identifier.change", "function.return_value.change" ]
616,691
616,692
u869919400
python
p02814
def lcm(a, b): return a // gcd(a, b) * b def gcd(a, b): if(b == 0): return a else: return gcd(b, a % b) def cnt(a): res = 0 while(a and a % 2 == 0): a //= 2 res += 1 return res n, m = map(int, input().split()) A = list(map(int, input().split())) l = 1 c = cnt(A[0]) for a in A: if cnt(a) != c or c == 1: print(0) exit() else: l = lcm(l, a) d = m // l print((d + 1) // 2)
def lcm(a, b): return a // gcd(a, b) * b def gcd(a, b): if(b == 0): return a else: return gcd(b, a % b) def cnt(a): res = 0 while(a and a % 2 == 0): a //= 2 res += 1 return res n, m = map(int, input().split()) A = list(map(int, input().split())) l = 1 c = cnt(A[0]) for a in A: if cnt(a) != c or c == 0: print(0) exit() else: l = lcm(l, a // 2) d = m // l print((d + 1) // 2)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
616,697
616,698
u956530786
python
p02814
from math import gcd from math import gcd def lcm(x,y): return (x * y) // gcd(x, y) def get_2(x): curr_2 = 0 curr_x = x while curr_x%2 != 0: curr_x = curr_x//2 curr_2 += 1 return curr_2 n,m = map(int, input().split()) al = list(map(int, input().split())) if n == 1: cnt = (m-al[0]//2)//al[0] print(cnt) exit() a2_set = set() a2_set.add(get_2(al[0])) for a in al: two_cnt = get_2(a) if two_cnt not in a2_set: print(0) exit() a2_set.add(two_cnt) curr_lcm = 1 for a in al: curr_lcm = lcm(curr_lcm, a//2) lcm_cnt = m//curr_lcm lcm_cnt = (lcm_cnt+2-1)//2 # print(curr_lcm) print(lcm_cnt)
from math import gcd from math import gcd def lcm(x,y): return (x * y) // gcd(x, y) def get_2(x): curr_2 = 0 curr_x = x while curr_x%2 == 0: curr_x = curr_x//2 curr_2 += 1 return curr_2 n,m = map(int, input().split()) al = list(map(int, input().split())) if n == 1: cnt = (m-al[0]//2)//al[0] + 1 print(cnt) exit() a2_set = set() a2_set.add(get_2(al[0])) for a in al: two_cnt = get_2(a) if two_cnt not in a2_set: print(0) exit() a2_set.add(two_cnt) curr_lcm = 1 for a in al: curr_lcm = lcm(curr_lcm, a//2) lcm_cnt = m//curr_lcm lcm_cnt = (lcm_cnt+2-1)//2 # print(curr_lcm) print(lcm_cnt)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
616,701
616,700
u493520238
python
p02814
import functools import sys n, m = map(int, input().split()) a = list(map(lambda x: x // 2, map(int, input().split()))) # A[0]を素因数分解して2で割り切れる回数を数える div = 0 a_0 = a[0] while a_0 % 2 == 0: a_0 /= 2 div += 1 # print("count = " + str(div))# # Aのすべての整数がA[0]と同じ回数2で割り切れるか調べる for i in range(1, len(a)): div2 = 0 a = a[i] while a % 2 == 0: a /= 2 div2 += 1 # print("A[" + str(i) + "] count = " + str(div2))# if div2 != div: print("0") sys.exit() def gcd(x, y): if x == 0: return y return gcd(y % x, x) def least_common_multiple(iter): ''' 最小公倍数を返す ''' lcm = lambda x, y: x * y // gcd(x, y) return functools.reduce(lcm, iter) lc = least_common_multiple(a) ans = 0 a = 1 ans = m // lc if ans == 0: print(0) sys.exit() if ans % 2 == 0: print(ans // 2) else: print(ans // 2 + 1)
import functools import sys n, m = map(int, input().split()) a = list(map(lambda x: x // 2, map(int, input().split()))) # A[0]を素因数分解して2で割り切れる回数を数える div = 0 a_0 = a[0] while a_0 % 2 == 0: a_0 /= 2 div += 1 # print("count = " + str(div))# # Aのすべての整数がA[0]と同じ回数2で割り切れるか調べる for i in range(1, len(a)): div2 = 0 tmp_a = a[i] while tmp_a % 2 == 0: tmp_a /= 2 div2 += 1 # print("A[" + str(i) + "] count = " + str(div2))# if div2 != div: print("0") sys.exit() def gcd(x, y): if x == 0: return y return gcd(y % x, x) def least_common_multiple(iter): ''' 最小公倍数を返す ''' lcm = lambda x, y: x * y // gcd(x, y) return functools.reduce(lcm, iter) lc = least_common_multiple(a) ans = 0 a = 1 ans = m // lc if ans == 0: print(0) sys.exit() if ans % 2 == 0: print(ans // 2) else: print(ans // 2 + 1)
[ "assignment.variable.change", "identifier.change", "control_flow.loop.condition.change" ]
616,718
616,719
u285022453
python
p02814
n,m=map(int,input().split()) l=list(map(int,input().split())) l=list(set(l)) n=len(l) ll=[] for i in l: ll.append(int(i/2)) newl=[] for i in ll: j=i count=0 while j%2!=0: j//=2 count+=1 newl.append(count) import collections newl=collections.Counter(newl) if len(newl)!=1: print(0) else: from math import gcd num=ll[0] flag=True for i in ll: if num<=m: num=int(i*num/gcd(i,num)) else: flag=False break if flag==False: print(0) else: k=m%(num*2) if k>=num: print(int(m//(num*2)+1)) else: print(int(m//(num*2)))
n,m=map(int,input().split()) l=list(map(int,input().split())) l=list(set(l)) n=len(l) ll=[] for i in l: ll.append(int(i/2)) newl=[] for i in ll: j=i count=0 while j%2==0: j//=2 count+=1 newl.append(count) import collections newl=collections.Counter(newl) if len(newl)!=1: print(0) else: from math import gcd num=ll[0] flag=True for i in ll: if num<=m: num=int(i*num/gcd(i,num)) else: flag=False break if flag==False: print(0) else: k=m%(num*2) if k>=num: print(int(m//(num*2)+1)) else: print(int(m//(num*2)))
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
616,720
616,721
u272525952
python
p02814
from math import gcd N, M = map(int, input().split()) S = list(map(int, input().split())) temp = S[0] cnt = 0 while temp%2 == 1: temp //= 2 cnt += 1 temp = S[0] for i in range(1, N): temp = temp*S[i]//gcd(temp, S[i]) if S[i]%(2**cnt) == 1 or (S[i]//(2**cnt))%2 == 0: print(0) break else: if temp//2 > M: print(0) else: print((M-temp//2)//temp+1)
from math import gcd N, M = map(int, input().split()) S = list(map(int, input().split())) temp = S[0] cnt = 0 while temp%2 == 0: temp //= 2 cnt += 1 temp = S[0] for i in range(1, N): temp = temp*S[i]//gcd(temp, S[i]) if S[i]%(2**cnt) == 1 or (S[i]//(2**cnt))%2 == 0: print(0) break else: if temp//2 > M: print(0) else: print((M-temp//2)//temp+1)
[ "literal.number.integer.change", "control_flow.loop.condition.change" ]
616,762
616,763
u135346354
python
p02814
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if num%A[i]==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if semi%A[i]==0]):print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
616,774
616,775
u905203728
python
p02814
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if A[i]%num==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if semi%A[i]==0]):print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
616,776
616,775
u905203728
python
p02814
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if num%A[i]==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if semi%A[i]==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
616,774
616,777
u905203728
python
p02814
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if A[i]%num==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
from math import gcd from functools import reduce def lcm_base(x,y): return (x*y)//gcd(x,y) def lcm(A): return reduce(lcm_base,A,1) n,m=map(int,input().split()) A=list(map(int,input().split())) num=lcm(A) semi=num//2 ans=0 if any([True for i in range(n) if semi%A[i]==0]): print(0) elif semi<=m: ans +=1 m -=semi ans +=m//num print(ans) else:print(0)
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
616,776
616,777
u905203728
python
p02814
import math n,m=map(int,input().split()) A=list(map(lambda x: int(x)//2,input().split())) lcm=A[0] for i in range(1,n): lcm=lcm*A[i]//math.gcd(lcm,A[i]) if any([i for i in range(n) if lcm%(A[i]*2)==0]): print(0);exit() ans=m//(2*lcm) print(ans if m//lcm==0 else ans+1)
import math n,m=map(int,input().split()) A=list(map(lambda x: int(x)//2,input().split())) lcm=A[0] for i in range(1,n): lcm=lcm*A[i]//math.gcd(lcm,A[i]) if any([i for i in range(n) if lcm%(A[i]*2)==0]): print(0);exit() ans=m//(2*lcm) print(ans if (m//lcm)%2==0 else ans+1)
[ "call.arguments.change" ]
616,778
616,779
u905203728
python
p02814
import math n,m=map(int,input().split()) A=list(map(lambda x: int(x)//2,input().split())) lcm=A[0] for i in range(1,n): lcm=lcm*A[i]//math.gcd(lcm,A[i]) if lcm>m: print(0);exit() if any([i for i in range(n) if lcm%(A[i]*2)==0]): print(0);exit() ans=m//(2*lcm) print(ans if m//lcm==0 else ans+1)
import math n,m=map(int,input().split()) A=list(map(lambda x: int(x)//2,input().split())) lcm=A[0] for i in range(1,n): lcm=lcm*A[i]//math.gcd(lcm,A[i]) if lcm>m: print(0);exit() if any([i for i in range(n) if lcm%(A[i]*2)==0]): print(0);exit() ans=m//(2*lcm) print(ans if (m//lcm)%2==0 else ans+1)
[ "call.arguments.change" ]
616,780
616,781
u905203728
python
p02814
from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) l = 1 num = a[0] bin = 1 while num % 2 == 0: bin *= 2 num //= 2 for num in a: l = (l * num // 2) // gcd(l, num // 2) if num % bin != 0 or num % (bin // 2) != 0: print(0) exit() print((m + l) // (2 * l))
from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) l = 1 num = a[0] bin = 1 while num % 2 == 0: bin *= 2 num //= 2 for num in a: l = (l * num // 2) // gcd(l, num // 2) if num % bin != 0 or num % (bin * 2) == 0: print(0) exit() print((m + l) // (2 * l))
[ "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.compare.change" ]
616,785
616,786
u745514010
python
p02814
from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) l = 5 num = a[0] bin = 1 while num % 2 == 0: bin *= 2 num //= 2 for num in a: l = (l * num // 2) // gcd(l, num // 2) if num % bin != 0 or num % (bin // 2) != 0: print(0) exit() print((m + l) // (2 * l))
from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) l = 1 num = a[0] bin = 1 while num % 2 == 0: bin *= 2 num //= 2 for num in a: l = (l * num // 2) // gcd(l, num // 2) if num % bin != 0 or num % (bin * 2) == 0: print(0) exit() print((m + l) // (2 * l))
[ "literal.number.integer.change", "assignment.value.change", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.compare.change" ]
616,787
616,786
u745514010
python
p02814
#from math import gcd from math import gcd from functools import reduce def lcm(a,b): return a * b // gcd(a,b) def ls_lcm(A): return reduce(lcm ,A) def ls_gcd(A): return reduce (gcd, A) def check_two(A): old = None for n in A: cnt = 0 while(n & 1 == 0): cnt += 1 n = n >> 1 if old is not None: old = cnt else: if old!=cnt: return False return True N, M = map(int, input().split()) A = list(map(int, input().split())) if not check_two(A): print (0) exit() A = [a//2 for a in A] half = ls_lcm(A) print ((M + half) // (2*half))
#from math import gcd from math import gcd from functools import reduce def lcm(a,b): return a * b // gcd(a,b) def ls_lcm(A): return reduce(lcm ,A) def ls_gcd(A): return reduce (gcd, A) def check_two(A): old = None for n in A: cnt = 0 while(n & 1 == 0): cnt += 1 n = n >> 1 if old is None: old = cnt else: if old!=cnt: return False return True N, M = map(int, input().split()) A = list(map(int, input().split())) if not check_two(A): print (0) exit() A = [a//2 for a in A] half = ls_lcm(A) print ((M + half) // (2*half))
[ "control_flow.branch.if.condition.change" ]
616,807
616,808
u709304134
python
p02814
from math import gcd n,m=map(int,input().split()) a=list(map(int,input().split())) a=list(set(a)) a=list(map(lambda x: x//2, a)) def lcm(q): x = q[0] for i in range(1, len(q)): x = (x * q[i]) // gcd(x, q[i]) return x lcma=lcm(a) if (lcma//a[0])%2==0: print(0) else: flg=0 for i in range(1,n): if (lcma//a[i])%2==0: print(0) flg=1 if flg==0: temp=m//lcma print(temp//2 if temp%2==0 else temp//2+1)
from math import gcd n,m=map(int,input().split()) a=list(map(int,input().split())) a=list(set(a)) a=list(map(lambda x: x//2, a)) def lcm(q): x = q[0] for i in range(1, len(q)): x = (x * q[i]) // gcd(x, q[i]) return x lcma=lcm(a) if (lcma//a[0])%2==0: print(0) else: flg=0 for i in range(1,len(a)): if (lcma//a[i])%2==0: print(0) flg=1 break if flg==0: temp=m//lcma print(temp//2 if temp%2==0 else temp//2+1)
[ "call.arguments.change", "control_flow.loop.range.bounds.upper.change", "call.arguments.add", "control_flow.break.add" ]
616,827
616,828
u617515020
python
p02814
from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def f(x): cnt = 0 while x%2 == 0: cnt += 1 x //= 2 return cnt def lcm(x,y): return x*y//math.gcd(x,y) n,m = inpl() a = inpl() a = list(set(a)) c = list(set([f(x) for x in a])) if len(c) != 1: print(0) quit() c = c[0] x = 1 for i in range(len(a)): x = lcm(a[i]//2**c, x) print((m+x)//(2**c*x))
from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def f(x): cnt = 0 while x%2 == 0: cnt += 1 x //= 2 return cnt def lcm(x,y): return x*y//math.gcd(x,y) n,m = inpl() a = inpl() a = list(set(a)) c = list(set([f(x) for x in a])) if len(c) != 1: print(0) quit() c = c[0] x = 1 for i in range(len(a)): x = lcm(a[i]//2, x) # print(x) print((m+x)//(2*x))
[ "expression.operation.binary.remove" ]
616,838
616,839
u645250356
python
p02814
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys, bisect, math, itertools, pprint sys.setrecursionlimit(10**8) mod = 10**9+7 mod2 = 998244353 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) def f(x): cnt = 0 while x%2==0: cnt += 1 x //= 2 return cnt n,m = inpl() a = inpl() g = f(a[0]) xx = a[0] for i in range(1,n): if g != f(a[i]): print(0) quit() xx = xx*a[i]//math.gcd(xx,a[i]) print(xx) if xx//2 > m: print(0) else: print((m*2-xx)//(xx*2)+1)
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys, bisect, math, itertools, pprint sys.setrecursionlimit(10**8) mod = 10**9+7 mod2 = 998244353 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) def f(x): cnt = 0 while x%2==0: cnt += 1 x //= 2 return cnt n,m = inpl() a = inpl() g = f(a[0]) xx = a[0] for i in range(1,n): if g != f(a[i]): print(0) quit() xx = xx*a[i]//math.gcd(xx,a[i]) if xx//2 > m: print(0) else: print((m*2-xx)//(xx*2)+1)
[ "call.remove" ]
616,840
616,841
u645250356
python