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
p02814
from math import gcd n,m=map(int,input().split()) *a,=map(int,input().split()) g=a[0] lcm=a[0] for i in range(1,n): g=gcd(lcm,a[i]) lcm*=a[i] lcm//=g for i in range(n): if lcm//a[i]%2==0: print(0) exit(0) print((m+lcm-1)//lcm)
from math import gcd n,m=map(int,input().split()) *a,=map(int,input().split()) g=a[0] lcm=a[0] for i in range(1,n): g=gcd(lcm,a[i]) lcm*=a[i] lcm//=g for i in range(n): if lcm//a[i]%2==0: print(0) exit(0) print((2*m//lcm+1)//2)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change", "misc.opposites", "identifier.replace.remove", "literal.replace.add" ]
616,848
616,849
u860829879
python
p02814
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 14:33:00 2020 @author: liang """ from math import gcd N, M = map(int, input().split()) A = [int(i) for i in input().split()] flag = False res = 1 for a in A: a /= 2 res *= a//gcd(res,a) if res > M: flag = True break #print(res) """ 存在チェック 2で割り切れる個数同じ? """ for a in A: if int(res/a) == res/a: flag = True if flag: ans = 0 print(ans) else: #ans = (M - res(A)//2)//res + 1 #ans = (M-1)//res//2 + 1 ans= (M//res + 1)//2 print(ans)
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 14:33:00 2020 @author: liang """ from math import gcd N, M = map(int, input().split()) A = [int(i) for i in input().split()] flag = False res = 1 for a in A: a //= 2 res *= a//gcd(res,a) if res > M: flag = True break #print(res) """ 存在チェック 2で割り切れる個数同じ? """ for a in A: if int(res/a) == res/a: flag = True if flag: ans = 0 print(ans) else: #ans = (M - res(A)//2)//res + 1 #ans = (M-1)//res//2 + 1 ans= (M//res + 1)//2 print(ans)
[ "expression.operator.change" ]
616,867
616,868
u628285938
python
p02814
import queue import numpy as np import math N, M = map(int, input().split()) a2 = list(map(int, input().split())) a = [] for i in a2: a.append(i//2) lcm = a[0] for i in a: lcm *= i // math.gcd(lcm, i) hasAns = True for i in a: if (lcm // i) % 2 ==0: hasAns = False break ans = 0 if hasAns: ans = (M // lcm) // 2 + 1 print(ans)
import queue import numpy as np import math N, M = map(int, input().split()) a2 = list(map(int, input().split())) a = [] for i in a2: a.append(i//2) lcm = a[0] for i in a: lcm *= i // math.gcd(lcm, i) hasAns = True for i in a: if (lcm // i) % 2 == 0: hasAns = False break ans = 0 if hasAns: ans = ((M // lcm) + 1 )// 2 print(ans)
[ "expression.operation.binary.remove" ]
616,869
616,870
u784982404
python
p02814
import math n,m=map(int,input().split()) a=list(map(int,input().split())) if n==1: a1=a[0]//2 ans_m=m//a1 if ans_m==0: print(0) else: print((ans_m-1)//2+1) else: x=a[0] ch=0 ch1=0 while x%2==0: x=x//2 ch+=1 dob=2**ch for i in a: if i%dob==0 and i%(dob*2)!=1: ch1+=1 if ch1!=n: print(0) else: ans=a[0]//2 for j in range(1,n): ans=(ans*(a[j]//2))//math.gcd(ans,a[j]//2) ans_m=m//ans if ans_m==0: print(0) else: print((ans_m-1)//2+1)
import math n,m=map(int,input().split()) a=list(map(int,input().split())) if n==1: a1=a[0]//2 ans_m=m//a1 if ans_m==0: print(0) else: print((ans_m-1)//2+1) else: x=a[0] ch=0 ch1=0 while x%2==0: x=x//2 ch+=1 dob=2**ch for i in a: if i%dob==0 and i%(dob*2)!=0: ch1+=1 if ch1!=n: print(0) else: ans=a[0]//2 for j in range(1,n): ans=(ans*(a[j]//2))//math.gcd(ans,a[j]//2) ans_m=m//ans if ans_m==0: print(0) else: print((ans_m-1)//2+1)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
616,881
616,882
u516554284
python
p02814
from math import gcd import sys N, M = map(int, input().split()) A = list(map(int, input().split())) lcm = 1 for a in A: gcd_ = gcd(lcm, a//2) lcm = lcm * (a // 2 // gcd_) for a in A: if lcm // (a // 2) % 2 == 1: print(0) sys.exit() print(M // lcm - M // (2 * lcm))
from math import gcd import sys N, M = map(int, input().split()) A = list(map(int, input().split())) lcm = 1 for a in A: gcd_ = gcd(lcm, a//2) lcm = lcm * (a // 2 // gcd_) for a in A: if (lcm // (a // 2)) % 2 == 0: print(0) sys.exit() print(M // lcm - M // (2 * lcm))
[ "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
616,885
616,886
u874320250
python
p02814
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permutations from operator import add, mul, sub import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def read_float(): return float(buff_readline()) def read_float_n(): return list(map(float, buff_readline().split())) def read_str(): return readline().strip() def read_str_n(): return readline().strip().split() def error_print(*args): print(*args, file=sys.stderr) def mt(f): import time def wrap(*args, **kwargs): s = time.time() ret = f(*args, **kwargs) e = time.time() error_print(e - s, 'sec') return ret return wrap @mt def slv(N, M, A): b_lcm = 1 d2 = set() for a in A: b = a // 2 b_lcm = b_lcm//math.gcd(b_lcm, b) * b for i in range(100000000): if a % 2 == 0: a //= 2 else: d2.add(i) break return -(-(M // b_lcm)//2) if len(d2) == 0 else 0 def main(): N, M = read_int_n() A = read_int_n() print(slv(N, M, A)) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- import bisect import heapq import math import random from collections import Counter, defaultdict, deque from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import combinations, combinations_with_replacement, product, permutations from operator import add, mul, sub import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_int_n(): return list(map(int, buff_readline().split())) def read_float(): return float(buff_readline()) def read_float_n(): return list(map(float, buff_readline().split())) def read_str(): return readline().strip() def read_str_n(): return readline().strip().split() def error_print(*args): print(*args, file=sys.stderr) def mt(f): import time def wrap(*args, **kwargs): s = time.time() ret = f(*args, **kwargs) e = time.time() error_print(e - s, 'sec') return ret return wrap @mt def slv(N, M, A): b_lcm = 1 d2 = set() for a in A: b = a // 2 b_lcm = b_lcm//math.gcd(b_lcm, b) * b for i in range(100000000): if a % 2 == 0: a //= 2 else: d2.add(i) break return -(-(M // b_lcm)//2) if len(d2) == 1 else 0 def main(): N, M = read_int_n() A = read_int_n() print(slv(N, M, A)) if __name__ == '__main__': main()
[ "literal.number.integer.change", "function.return_value.change" ]
616,893
616,894
u334712262
python
p02814
import sys import math from functools import reduce def num_of_zeros(num): return (num ^ (num - 1)).bit_length() - 1 def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def main(): input = sys.stdin.buffer.readline n, m = map(int, input().split()) a = list(map(int, input().split())) if len(set(map(num_of_zeros, a))) != 1: print(0) else: lcm = lcm_list(list(map(lambda x: x // 2, a))) ub = 10 ** 9 lb = 0 while ub - lb > 1: mid = (ub + lb) // 2 if lcm * (2 * mid + 1) <= m: lb = mid else: ub = mid if lb <= m: lb += 1 print(lb) if __name__ == "__main__": main()
import sys import math from functools import reduce def num_of_zeros(num): return (num ^ (num - 1)).bit_length() - 1 def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def main(): input = sys.stdin.buffer.readline n, m = map(int, input().split()) a = list(map(int, input().split())) if len(set(map(num_of_zeros, a))) != 1: print(0) else: lcm = lcm_list(list(map(lambda x: x // 2, a))) ub = 10 ** 9 lb = 0 while ub - lb > 1: mid = (ub + lb) // 2 if lcm * (2 * mid + 1) <= m: lb = mid else: ub = mid if lcm <= m: lb += 1 print(lb) if __name__ == "__main__": main()
[ "identifier.change", "control_flow.branch.if.condition.change" ]
616,903
616,904
u331327289
python
p02814
from math import gcd, ceil def lcm(a, b): return (a*b)//gcd(a, b) n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] = a[i]//2 lcm_v = a[0] for i in range(1, n): lcm_v = lcm(lcm_v, a[i]) ok = True for aa in a: if (lcm_v//aa) % 2 != 1: ok = False break if ok: ans = ((m//lcm_v)+1)//2 print(ans)
from math import gcd, ceil def lcm(a, b): return (a*b)//gcd(a, b) n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] = a[i]//2 lcm_v = a[0] for i in range(1, n): lcm_v = lcm(lcm_v, a[i]) ok = True for aa in a: if (lcm_v//aa) % 2 != 1: ok = False break ans = 0 if ok: ans = ((m//lcm_v)+1)//2 print(ans)
[ "assignment.add" ]
616,908
616,909
u970197315
python
p02814
# ABC150 D si = lambda: input() ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) from math import gcd from math import ceil def lcm(x, y): return (x * y) // gcd(x, y) n,m=nm() a=nl() ans=0 a=[x//2 for x in a] lcm_v=a[0] for i in range(n): lcm_v=lcm(lcm_v,a[i]) ok_flg=[(lcm_v//i)%2==1 for i in a] if all(ok_flg): ans=((m//lcm)+1)//2 print(ans)
# ABC150 D si = lambda: input() ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) from math import gcd from math import ceil def lcm(x, y): return (x * y) // gcd(x, y) n,m=nm() a=nl() ans=0 a=[x//2 for x in a] lcm_v=a[0] for i in range(n): lcm_v=lcm(lcm_v,a[i]) ok_flg=[(lcm_v//i)%2==1 for i in a] if all(ok_flg): ans=((m//lcm_v)+1)//2 print(ans)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
616,910
616,911
u970197315
python
p02814
import math from functools import reduce def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def my_round(val, digit=0): p = 10 ** digit return (val * p * 2 + 1) // 2 / p n, m = list(map(int, input().split())) a_pr = [i // 2 for i in list(map(int, input().split()))] lcm_ = lcm_list(a_pr) res, div2 = 0, None for ai in a_pr: cnt = 0 while a % 2 == 0: a //= 2 cnt += 1 if div2 is None: div2 = cnt elif cnt != div2: print(0) exit() print(int(my_round(m // lcm_ / 2)))
import math from functools import reduce def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) def my_round(val, digit=0): p = 10 ** digit return (val * p * 2 + 1) // 2 / p n, m = list(map(int, input().split())) a_pr = [i // 2 for i in list(map(int, input().split()))] lcm_ = lcm_list(a_pr) res, div2 = 0, None for ai in a_pr: cnt = 0 while ai % 2 == 0: ai //= 2 cnt += 1 if div2 is None: div2 = cnt elif cnt != div2: print(0) exit() print(int(my_round(m // lcm_ / 2)))
[ "identifier.change", "control_flow.loop.condition.change" ]
616,934
616,935
u133347536
python
p02814
from math import gcd N, M = map(int, input().split()) A = list(map(int, input().split())) A = [i // 2 for i in a] l = 1 for a in A: lcd *= a // gcd(lcd, a) for a in A: if lcd // a % 2 == 0: print(0) exit() print((M//lcd+1)//2)
from math import gcd N, M = map(int, input().split()) A = list(map(int, input().split())) A = [i // 2 for i in A] lcd = 1 for a in A: lcd *= a // gcd(lcd, a) for a in A: if lcd // a % 2 == 0: print(0) exit() print((M//lcd+1)//2)
[ "assignment.value.change", "identifier.change", "assignment.variable.change" ]
616,936
616,937
u698919163
python
p02814
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 lcm_list(numbers): return reduce(lcm_base, numbers, 1) n,m = map(int, input().split()) a = list(map(int, input().split())) a = [i//2 for i in list(set(a))] cnt_common = -1 for i in a: cnt = 0 while i % 2 == 0: i = i//2 cnt += 1 if cnt_common == -1: cnt_common = cnt continue if cnt_common != cnt: nothing = True break b=lcm_list(a) if nothing: print(0) else: ans = (m-b)//(2*b) + 1 print(max(ans,0))
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 lcm_list(numbers): return reduce(lcm_base, numbers, 1) n,m = map(int, input().split()) a = list(map(int, input().split())) a = [i//2 for i in list(set(a))] nothing = False cnt_common = -1 for i in a: cnt = 0 while i % 2 == 0: i = i//2 cnt += 1 if cnt_common == -1: cnt_common = cnt continue if cnt_common != cnt: nothing = True break b=lcm_list(a) if nothing: print(0) else: ans = (m-b)//(2*b) + 1 print(max(ans,0))
[ "assignment.add" ]
616,950
616,951
u521323621
python
p02814
from math import gcd from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def evencount(n): cnt=0 while n%2==0: cnt+=1 n//=2 return cnt n,m=map(int,input().split()) a=list(map(int,input().split())) for i in range(n): a[i]//=2 if all(evencount(i) == evencount(a[i]) for i in a): d=lcm(*a) print((m+d)//2//d) else:print(0)
from math import gcd from functools import reduce def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def evencount(n): cnt=0 while n%2==0: cnt+=1 n//=2 return cnt n,m=map(int,input().split()) a=list(map(int,input().split())) for i in range(n): a[i]//=2 if all(evencount(i) == evencount(a[0]) for i in a): d=lcm(*a) print((m+d)//2//d) else:print(0)
[ "identifier.replace.remove", "literal.replace.add", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
616,952
616,953
u730769327
python
p02814
import math # least common multiple def lcm(a,b): f = math.gcd(a,b) return a*b // f N,m = list(map(int, input().split())) A = list(map(int,input().split())) l = A[0] # a -> a` for i in range(N): if A[i]%2==1: print(0) exit(0) A[i] //= 2 def F(x): print(x) res = 0 while x%2==0: x //= 2 res += 1 return res t = F(A[0]) for i in range(N): if F(A[i]) != t: print(0) exit(0) A[i] >>= t # a[i] /= 2^t m >>= t l = 1 for i in range(N): l = lcm(l, A[i]) if l > m: print(0) exit(0) m /= l print(int((m+1) // 2))
import math # least common multiple def lcm(a,b): f = math.gcd(a,b) return a*b // f N,m = list(map(int, input().split())) A = list(map(int,input().split())) l = A[0] # a -> a` for i in range(N): if A[i]%2==1: print(0) exit(0) A[i] //= 2 def F(x): res = 0 while x%2==0: x //= 2 res += 1 return res t = F(A[0]) for i in range(N): if F(A[i]) != t: print(0) exit(0) A[i] >>= t # a[i] /= 2^t m >>= t l = 1 for i in range(N): l = lcm(l, A[i]) if l > m: print(0) exit(0) m /= l print(int((m+1) // 2))
[ "call.remove" ]
616,956
616,957
u723711163
python
p02814
from math import gcd n,m = map(int,input().split()) a = list(map(lambda x: int(x)//2,input().split())) def lcm(x,y): return x*y//gcd(x,y) def f(x): cnt = 0 while x%2 == 0: x //= 2 cnt += 1 r = set([f(i) for i in a]) if len(r) != 1: print(0) exit() T = 1 for i in range(n): T = lcm(T,a[i]) ans=-(-(m//T)//2) c=T print(ans)
from math import gcd n,m = map(int,input().split()) a = list(map(lambda x: int(x)//2,input().split())) def lcm(x,y): return x*y//gcd(x,y) def f(x): cnt = 0 while x%2 == 0: x //= 2 cnt += 1 return cnt r = set([f(i) for i in a]) if len(r) != 1: print(0) exit() T = 1 for i in range(n): T = lcm(T,a[i]) ans=-(-(m//T)//2) c=T print(ans)
[ "control_flow.return.add" ]
617,019
617,020
u703214333
python
p02814
''' https://atcoder.jp/contests/abc150/tasks/abc150_d ''' def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate #from itertools import product from bisect import bisect_left,bisect_right import heapq from math import floor, ceil #from operator import itemgetter #inf = 10**17 #mod = 10**9 + 7 n,m = map(int, input().split()) a = list(map(int, input().split())) a = list(set(a)) if n == 1: if m >= a[0]//2: print((m-a[0]//2) // a[0] + 1) else: print(0) exit() def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) def gcd_group(arr): g = gcd(arr[0], arr[1]) for i in range(2, len(arr)): g = gcd(g, arr[i]) return g def lcm(a, b): g = gcd(a, b) return (a*b)//g def lcm_group(arr): l = lcm(arr[0], arr[1]) for i in range(2, len(arr)): l = lcm(l, arr[i]) return l g = gcd_group(a) for i in a: if (i//g)%2 == 0: print(0) exit() lcm = lcm_group(a) semi_lcm = lcm // 2 if m >= semi_lcm: print((m-semi_lcm)//lcm + 1) else: print(0) if __name__ == '__main__': main()
''' https://atcoder.jp/contests/abc150/tasks/abc150_d ''' def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10000000) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate #from itertools import product from bisect import bisect_left,bisect_right import heapq from math import floor, ceil #from operator import itemgetter #inf = 10**17 #mod = 10**9 + 7 n,m = map(int, input().split()) a = list(map(int, input().split())) a = list(set(a)) if len(a) == 1: if m >= a[0]//2: print((m-a[0]//2) // a[0] + 1) else: print(0) exit() def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) def gcd_group(arr): g = gcd(arr[0], arr[1]) for i in range(2, len(arr)): g = gcd(g, arr[i]) return g def lcm(a, b): g = gcd(a, b) return (a*b)//g def lcm_group(arr): l = lcm(arr[0], arr[1]) for i in range(2, len(arr)): l = lcm(l, arr[i]) return l g = gcd_group(a) for i in a: if (i//g)%2 == 0: print(0) exit() lcm = lcm_group(a) semi_lcm = lcm // 2 if m >= semi_lcm: print((m-semi_lcm)//lcm + 1) else: print(0) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change", "call.arguments.add" ]
617,029
617,030
u863442865
python
p02814
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from math import gcd n, m = map(int, readline().split()) a = list(map(int, readline().split())) for i in range(n): a[i] //= 2 lcm_memo = 1 for i in range(n): lcm_memo *= a[i] // gcd(lcm_memo, a[i]) if lcm_memo > m: print(0) exit() for i in range(n): if (n // a[i]) % 2 == 0: print(0) exit() print(1 + (m - lcm_memo) // (lcm_memo * 2))
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from math import gcd n, m = map(int, readline().split()) a = list(map(int, readline().split())) for i in range(n): a[i] //= 2 lcm_memo = 1 for i in range(n): lcm_memo *= a[i] // gcd(lcm_memo, a[i]) if lcm_memo > m: print(0) exit() for i in range(n): if (lcm_memo // a[i]) % 2 == 0: print(0) exit() print(1 + (m - lcm_memo) // (lcm_memo * 2))
[ "identifier.change", "control_flow.branch.if.condition.change" ]
617,045
617,046
u691018832
python
p02814
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) nm=list(map(int, input().split())) a=list(map(int, input().split())) n=nm[0] m=nm[1] b=0 c=a[0] dnum=0 while c%2==0: dnum+=1 c=c//2 for i in range(len(a)): c=a[0] dnum1=0 while c%2==0: dnum1+=1 c=c//2 if dnum1!=dnum: b=1 break #print(a) if b==1: print(0) else: for i in range(len(a)): a[i]=a[i]//2 #print(a) amc=lcm_list(a) #print(amc) # version3.5にてgcdがfractionsからmathに移動した print(int((m+amc)/(2*amc)))
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) nm=list(map(int, input().split())) a=list(map(int, input().split())) n=nm[0] m=nm[1] b=0 c=a[0] dnum=0 while c%2==0: dnum+=1 c=c//2 for i in range(len(a)): c=a[i] dnum1=0 while c%2==0: dnum1+=1 c=c//2 #print(dnum) if dnum1!=dnum: b=1 break #print(a) if b==1: print(0) else: for i in range(len(a)): a[i]=a[i]//2 #print(a) amc=lcm_list(a) #print(amc) # version3.5にてgcdがfractionsからmathに移動した print(int((m+amc)/(2*amc)))
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "variable_access.subscript.index.change" ]
617,052
617,053
u927839462
python
p02814
import copy n,m = map(int,input().split()) a = set(list(map(int,input().split()))) a = list(a) a_div2 = [0]*len(a) a2 = copy.deepcopy(a) for i in range(len(a)): if a[i] % 2 == 1: print(0) exit() for i in range(len(a)): while a2[i] % 2 != 0: a2[i] //= 2 a_div2[i] += 1 if len(set(a_div2)) != 1: print(0) exit() def gcd(a,b): while b != 0: a, b = b, a % b return a def lcm(a,b): return a // gcd(a,b) * b if len(a) == 1: if m < a[0]//2: print(0) else: print((m-a[0]//2)//a[0] + 1) else: cnt = 1 for i in range(len(a)): a[i] //= 2 cnt = lcm(cnt,a[i]) if m < cnt: print(0) else: print((m-cnt)//(cnt*2)+1)
import copy n,m = map(int,input().split()) a = set(list(map(int,input().split()))) a = list(a) a_div2 = [0]*len(a) a2 = copy.deepcopy(a) for i in range(len(a)): if a[i] % 2 == 1: print(0) exit() for i in range(len(a)): while a2[i] % 2 == 0: a2[i] //= 2 a_div2[i] += 1 if len(set(a_div2)) != 1: print(0) exit() def gcd(a,b): while b != 0: a, b = b, a % b return a def lcm(a,b): return a // gcd(a,b) * b if len(a) == 1: if m < a[0]//2: print(0) else: print((m-a[0]//2)//a[0] + 1) else: cnt = 1 for i in range(len(a)): a[i] //= 2 cnt = lcm(cnt,a[i]) if m < cnt: print(0) else: print((m-cnt)//(cnt*2)+1)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
617,064
617,065
u599114793
python
p02814
import copy n,m = map(int,input().split()) a = set(list(map(int,input().split()))) a = list(a) a_div2 = [0]*n a2 = copy.deepcopy(a) for i in range(len(a)): if a[i] % 2 == 1: print(0) exit() for i in range(len(a)): while a2[i] % 2 != 0: a2[i] //= 2 a_div2[i] += 1 if len(set(a_div2)) != 1: print(0) exit() def gcd(a,b): while b != 0: a, b = b, a % b return a def lcm(a,b): return a // gcd(a,b) * b if len(a) == 1: if m < a[0]//2: print(0) else: print((m-a[0]//2)//a[0] + 1) else: cnt = 1 for i in range(len(a)): a[i] //= 2 cnt = lcm(cnt,a[i]) if m < cnt: print(0) else: print((m-cnt)//(cnt*2)+1)
import copy n,m = map(int,input().split()) a = set(list(map(int,input().split()))) a = list(a) a_div2 = [0]*len(a) a2 = copy.deepcopy(a) for i in range(len(a)): if a[i] % 2 == 1: print(0) exit() for i in range(len(a)): while a2[i] % 2 == 0: a2[i] //= 2 a_div2[i] += 1 if len(set(a_div2)) != 1: print(0) exit() def gcd(a,b): while b != 0: a, b = b, a % b return a def lcm(a,b): return a // gcd(a,b) * b if len(a) == 1: if m < a[0]//2: print(0) else: print((m-a[0]//2)//a[0] + 1) else: cnt = 1 for i in range(len(a)): a[i] //= 2 cnt = lcm(cnt,a[i]) if m < cnt: print(0) else: print((m-cnt)//(cnt*2)+1)
[ "assignment.value.change", "expression.operation.binary.change", "call.arguments.add", "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
617,066
617,065
u599114793
python
p02814
import math def lcm(x, y): return (x * y) // math.gcd(x, y) n, m = map(int, input().split()) v = list(map(int, input().split())) num = 0 # print(v[0]) while (v[0] % 2 == 0): v[0] //= 2 num += 1 # print(v[0]) ans = v[0] for i in range(n - 1): if (v[i + 1] % (2 ** num) != 0 or v[i + 1] % (2 ** (num + 1)) == 0): ans = 2 break # print(v[i+1]) v[i+1] //= 2**num # print(v[i+1]) ans = lcm(ans, v[i + 1]) # print(ans) if (ans % 2 == 0): print(0) exit(0) ans *= 2**(num-1) print(ans, m) print(((m//ans)+1)//2)
import math def lcm(x, y): return (x * y) // math.gcd(x, y) n, m = map(int, input().split()) v = list(map(int, input().split())) num = 0 # print(v[0]) while (v[0] % 2 == 0): v[0] //= 2 num += 1 # print(v[0]) ans = v[0] for i in range(n - 1): if (v[i + 1] % (2 ** num) != 0 or v[i + 1] % (2 ** (num + 1)) == 0): ans = 2 break # print(v[i+1]) v[i+1] //= 2**num # print(v[i+1]) ans = lcm(ans, v[i + 1]) # print(ans) if (ans % 2 == 0): print(0) exit(0) ans *= 2**(num-1) print(((m//ans)+1)//2)
[ "call.remove" ]
617,071
617,072
u174404613
python
p02814
from functools import reduce from math import gcd from math import ceil N, M = map(int, input().split()) A = list(map(int, input().split())) def lcm(a, b): return a * b / gcd(a, b) def bit(a): res = 0 _a = a while _a % 2 == 0: _a /= 2 res += 1 return res count = bit(A[0]) for i in range(1, len(A)): if bit(A[i]) != count: print(0) exit() half_A = [ a // 2 for a in A] min_X = half_A[0] for a in half_A: min_X = lcm(a, min_X) if min_X > M: print(0) exit() res = M // min_X print(int((res+1)//2))
from functools import reduce from math import gcd from math import ceil N, M = map(int, input().split()) A = list(map(int, input().split())) def lcm(a, b): return a * b // gcd(a, b) def bit(a): res = 0 _a = a while _a % 2 == 0: _a /= 2 res += 1 return res count = bit(A[0]) for i in range(1, len(A)): if bit(A[i]) != count: print(0) exit() half_A = [ a // 2 for a in A] min_X = half_A[0] for a in half_A: min_X = lcm(a, min_X) if min_X > M: print(0) exit() res = M // min_X print(int((res+1)//2))
[ "expression.operator.arithmetic.change", "function.return_value.change", "expression.operation.binary.change" ]
617,108
617,109
u538632589
python
p02814
#150_D from math import gcd from functools import reduce def lcm(x, y): return x * y // gcd(x, y) n, m = map(int, input().split()) a = list(map(int, input().split())) flg = False cnt0 = 0 while a[0] % 2 == 0: a[0] //= 2 cnt0 += 1 for i in range(1, n): cnti = 0 while a[i] % 2 == 0: a[i] //= 2 cnti += 1 if cnti != cnt0: flg = False break lcm_a = reduce(lcm, a) * (2 ** (cnt0 - 1)) x = m // lcm_a print(-(-x // 2))
#150_D from math import gcd from functools import reduce def lcm(x, y): return x * y // gcd(x, y) n, m = map(int, input().split()) a = list(map(int, input().split())) flg = True cnt0 = 0 while a[0] % 2 == 0: a[0] //= 2 cnt0 += 1 for i in range(1, n): cnti = 0 while a[i] % 2 == 0: a[i] //= 2 cnti += 1 if cnti != cnt0: flg = False break lcm_a = reduce(lcm, a) * (2 ** (cnt0 - 1)) x = m // lcm_a print(-(-x // 2) if flg else 0)
[ "misc.opposites", "assignment.value.change" ]
617,120
617,121
u139112865
python
p02814
from math import gcd import sys input = sys.stdin.readline N,M=map(int,input().split()) List=list(map(lambda x:int(x)/2,map(int, set(input().split())))) def main(): LCM=1 for i in List: LCM*=i/gcd(LCM,i) for i in List: if LCM/i%2==0: print(0) exit() print(int(M//(LCM*2)+M%(LCM*2)//LCM)) if __name__ == '__main__': main()
from math import gcd import sys input = sys.stdin.readline N,M=map(int,input().split()) List=list(map(lambda x:int(x)//2,map(int, set(input().split())))) def main(): LCM=1 for i in List: LCM*=i//gcd(LCM,i) for i in List: if LCM//i%2==0: print(0) exit() print(int(M//(LCM*2)+M%(LCM*2)//LCM)) if __name__ == '__main__': main()
[ "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
617,140
617,141
u093861603
python
p02814
import math import functools N, M = map(int, input().split()) A = [int(i) for i in input().split()] def multiple(a, b): return a*b // math.gcd(a, b) def lcm(nums): return functools.reduce(multiple, nums) lcm = lcm(A) hlcm = lcm//2 print(lcm, hlcm) for a in A: if a % 2 == 1: print(0) exit() if lcm//a % 2 == 0: print(0) exit() if hlcm > M: print(0) else: print((M+hlcm)//hlcm//2)
import math import functools N, M = map(int, input().split()) A = [int(i) for i in input().split()] def multiple(a, b): return a*b // math.gcd(a, b) def lcm(nums): return functools.reduce(multiple, nums) lcm = lcm(A) hlcm = lcm//2 # print(lcm, hlcm) for a in A: if a % 2 == 1: print(0) exit() if lcm//a % 2 == 0: print(0) exit() if hlcm > M: print(0) else: print((M+hlcm)//hlcm//2)
[ "call.remove" ]
617,150
617,151
u223646582
python
p02814
import math import functools N, M = map(int, input().split()) A = [int(i) for i in input().split()] def multiple(a, b): return a*b // math.gcd(a, b) def lcm(nums): return functools.reduce(multiple, nums) lcm = lcm(A) hlcm = lcm//2 # print(lcm, hlcm) for a in A: if a % 2 == 1: print(0) exit() if lcm//a % 2 == 0: print(0) exit() if hlcm > M: print(0) else: print(M//hlcm//2+1)
import math import functools N, M = map(int, input().split()) A = [int(i) for i in input().split()] def multiple(a, b): return a*b // math.gcd(a, b) def lcm(nums): return functools.reduce(multiple, nums) lcm = lcm(A) hlcm = lcm//2 # print(lcm, hlcm) for a in A: if a % 2 == 1: print(0) exit() if lcm//a % 2 == 0: print(0) exit() if hlcm > M: print(0) else: print((M+hlcm)//hlcm//2)
[ "call.arguments.change", "expression.operation.binary.remove" ]
617,152
617,151
u223646582
python
p02814
import math from functools import reduce N,M= map(int,input().split()) A=[int(x) for x in input().split()] def lcmpair(a,b): return (a*b)// math.gcd(a,b) def lcm(List): return reduce(lcmpair,List,1) lcmB = lcm(A) //2 crit = 0 pena = 0 num = A[0] while num%2 != 0: crit +=1 num = num//2 count = 0 for i in A: count = 0 while i%2 !=0: count +=1 i = i//2 if count != crit: pena = 1 if lcmB > M: print(0) elif pena ==1: print(0) else: print(((M//lcmB)+1)//2)
import math from functools import reduce N,M= map(int,input().split()) A=[int(x) for x in input().split()] def lcmpair(a,b): return (a*b)// math.gcd(a,b) def lcm(List): return reduce(lcmpair,List,1) lcmB = lcm(A) //2 crit = 0 pena = 0 num = A[0] while num%2 == 0: crit +=1 num = num//2 count = 0 for i in A: count = 0 while i%2 == 0 : count +=1 i = i//2 if count != crit: pena = 1 if lcmB > M: print(0) elif pena ==1: print(0) else: print(((M//lcmB)+1)//2)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
617,155
617,156
u269235541
python
p02814
import math, string, itertools, heapq, collections, re, array, bisect, sys, copy, functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def main(): n,m = LI() a = LI() g = 2 s = set() for c in a: t = math.gcd(g, c) g *= c // t i = 0 while c % 2 == 0: c //= 2 s.add(i) if len(s) > 1: return 0 g //= 2 t = (m // g + 1) // 2 return t print(main())
import math, string, itertools, heapq, collections, re, array, bisect, sys, copy, functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def main(): n,m = LI() a = LI() g = 2 s = set() for c in a: t = math.gcd(g, c) g *= c // t i = 0 while c % 2 == 0: i += 1 c //= 2 s.add(i) if len(s) > 1: return 0 g //= 2 t = (m // g + 1) // 2 return t print(main())
[]
617,164
617,165
u637175065
python
p02814
from math import gcd from functools import reduce def read_int_n(): return list(map(int, input().split())) def read_float_n(): return list(map(float, input().split())) NM=read_int_n() A=read_float_n() A=list(set(A)) ##重複した要素を削除し、新たなリストを生成 ##2で何回割れるかをcountする def power2(n): ##参考:https://note.nkmk.me/python-prime-factorization/ m=0 while n % 2 == 0: m+=1 n //= 2 return m #####2で奇数回割り切れる場合のみのflag flag=0 a=[] a_2=power2(A[0]) for i in range(len(A)): ###len(A) ###### A[0]をa=[]にappendする if power2(A[i])==a_2: a.append(A[i]*0.5) else: flag=1 def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN if flag==0: lcm=lcm_list(a) amari=NM[1]/lcm #50までは15,30,45の3つ amari=(amari+1)//2 #3つのうち奇数を切り上げ ########roundは偶数への丸め(0.5は1になる):https://note.nkmk.me/python-round-decimal-quantize/ ########四捨五入するならdecimalモジュールのquantize('.01') #Decimal(i).quantize(Decimal('0.01'), rounding=ROUND_HALF_UP) print(int(amari)) else: print(0) #print(A,a,flag,amari)
from math import gcd from functools import reduce def read_int_n(): return list(map(int, input().split())) def read_float_n(): return list(map(float, input().split())) NM=read_int_n() A=read_float_n() A=list(set(A)) ##重複した要素を削除し、新たなリストを生成 ##2で何回割れるかをcountする def power2(n): ##参考:https://note.nkmk.me/python-prime-factorization/ m=0 while n % 2 == 0: m+=1 n //= 2 return m #####2で奇数回割り切れる場合のみのflag flag=0 a=[] a_2=power2(A[0]) for i in range(len(A)): ###len(A) ###### A[0]をa=[]にappendする if power2(A[i])==a_2: a.append(int(A[i]*0.5)) ########## floatをintに直す else: flag=1 def lcm_base(x, y): return (x * y) // gcd(x, y) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN if flag==0: lcm=lcm_list(a) amari=NM[1]/lcm #50までは15,30,45の3つ amari=(amari+1)//2 #3つのうち奇数を切り上げ ########roundは偶数への丸め(0.5は1になる):https://note.nkmk.me/python-round-decimal-quantize/ ########四捨五入するならdecimalモジュールのquantize('.01') #Decimal(i).quantize(Decimal('0.01'), rounding=ROUND_HALF_UP) print(int(amari)) else: print(0) #print(flag,amari,NM[1],lcm,a,A)
[ "call.arguments.add", "call.arguments.change" ]
617,168
617,169
u788023488
python
p02814
n, m = map(int, input().split()) l = 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) #print(lcm_list(l)) x = lcm_list(l) for i in range(n): if x%l[i] == 0: print(0) exit() ans = (m*2)//lcm_list(l) if ans%2 == 1: print((ans+1)//2) else: print(ans//2)
n, m = map(int, input().split()) l = 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) #print(lcm_list(l)) x = lcm_list(l) for i in range(n): if (x//l[i])%2 == 0: print(0) exit() ans = (m*2)//lcm_list(l) if ans%2 == 1: print((ans+1)//2) else: print(ans//2)
[ "control_flow.branch.if.condition.change", "expression.operator.arithmetic.change", "control_flow.loop.for.condition.change" ]
617,198
617,199
u186838327
python
p02814
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (_a if not _a % c or _a // c % 2 else 2 * m + 2 for _a in a)) return str((m - l // 2) // l + 1) if l <= 2 * m else "0" if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (_a if not _a % c and _a // c % 2 else 2 * m + 2 for _a in a)) return str((m - l // 2) // l + 1) if l <= 2 * m else "0" if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
[ "assignment.value.change", "call.arguments.change" ]
617,203
617,204
u046187684
python
p02814
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (0 if _a % c or not _a // c % 2 else _a for _a in a)) return str((m - l // 2) // l + 1) if l else "0" if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) if a * b else 0 def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (0 if _a % c or not _a // c % 2 else _a for _a in a)) return str((m - l // 2) // l + 1) if l else "0" if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
[]
617,205
617,206
u046187684
python
p02814
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (2 * m if _a % c or not _a // c % 2 else _a for _a in a)) return str(max((m - l // 2) // l + 1, 0)) if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (2 * m + 2 if _a % c or not _a // c % 2 else _a for _a in a)) return str(max((m - l // 2) // l + 1, 0)) if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
[ "assignment.change" ]
617,207
617,208
u046187684
python
p02814
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (2 * m if _a % c or not _a // c % 2 else _a for _a in a)) return str(max((m - l // 2) // l + 1, 0)) if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
from math import gcd from functools import reduce def lcm(a, b): return a * b // gcd(a, b) def solve(string): n, m, *a = map(int, string.split()) c = 2**len(bin(a[0]).split("1")[-1]) l = reduce(lcm, (2 * m + 2 if _a % c or not _a // c % 2 else _a for _a in a)) return str(max((m + l // 2) // l, 0)) if __name__ == '__main__': import sys print(solve(sys.stdin.read().strip()))
[ "misc.opposites", "expression.operator.arithmetic.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
617,207
617,210
u046187684
python
p02814
import mat import functools def lcm(n1, n2): return n1 * n2 // math.gcd(n1, n2) N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(N): A[i] //= 2 lcmA = functools.reduce(lcm, A) gcdA = functools.reduce(math.gcd, A) if (lcmA // gcdA) % 2 == 0: print(0) else: print((M // lcmA + 1) // 2)
import math import functools def lcm(n1, n2): return n1 * n2 // math.gcd(n1, n2) N, M = map(int, input().split()) A = list(map(int, input().split())) for i in range(N): A[i] //= 2 lcmA = functools.reduce(lcm, A) gcdA = functools.reduce(math.gcd, A) if (lcmA // gcdA) % 2 == 0: print(0) else: print((M // lcmA + 1) // 2)
[ "identifier.change" ]
617,225
617,226
u673361376
python
p02814
import math from functools import reduce def main(): n,m=map(int,input().split()) a=list(map(int,input().split())) for i,aa in enumerate(a): j = 0 while aa % 2 == 0: aa //= 2 j+=1 if i == 0: modtmp = j else: if modtemp != j: print(0) return for i,aa in enumerate(a): a[i] = aa//2 tmp = lcm(*a) # print(tmp) cnt =0 # print(a) up = m//tmp if up % 2 == 0: up = up//2 else: up = up//2 + 1 nowtmp = tmp cnt = 0 ans = 0 a.sort() # print(nowtmp) # print(up) before = 0 before_aa = 0 print(up) return for i, aa in enumerate(a): if before_aa == aa: continue if aa == 1: print(up) return if aa <= nowtmp and aa>before: cnt += 1 elif aa> nowtmp : ans += cnt * up up -=1 cnt = 0 nowtmp += tmp before += tmp ans += cnt * up print(ans) def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) if __name__=='__main__': main()
import math from functools import reduce def main(): n,m=map(int,input().split()) a=list(map(int,input().split())) for i,aa in enumerate(a): j = 0 while aa % 2 == 0: aa //= 2 j+=1 if i == 0: modtmp = j else: if modtmp != j: print(0) return for i,aa in enumerate(a): a[i] = aa//2 tmp = lcm(*a) # print(tmp) cnt =0 # print(a) up = m//tmp if up % 2 == 0: up = up//2 else: up = up//2 + 1 nowtmp = tmp cnt = 0 ans = 0 a.sort() # print(nowtmp) # print(up) before = 0 before_aa = 0 print(up) return for i, aa in enumerate(a): if before_aa == aa: continue if aa == 1: print(up) return if aa <= nowtmp and aa>before: cnt += 1 elif aa> nowtmp : ans += cnt * up up -=1 cnt = 0 nowtmp += tmp before += tmp ans += cnt * up print(ans) def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) if __name__=='__main__': main()
[ "identifier.change", "control_flow.branch.if.condition.change" ]
617,231
617,232
u321035578
python
p02814
import sys input = sys.stdin.readline N,M=map(int,input().split()) A=list(map(int,input().split())) def gcd(a, b): while b: a, b = b, a % b return a def lcm(x, y): return (x * y) // gcd(x, y) def count2(x): c=0 while x%2==0: x//=2 return c c2=count2(A[0]) LCM=1 for a in A: if count2(a)!=c2: print(0) sys.exit() LCM=lcm(a//2,LCM) if LCM>M: print(0) sys.exit() print(max(0,(M-LCM)//(2*LCM)+1))
import sys input = sys.stdin.readline N,M=map(int,input().split()) A=list(map(int,input().split())) def gcd(a, b): while b: a, b = b, a % b return a def lcm(x, y): return (x * y) // gcd(x, y) def count2(x): c=0 while x%2==0: x//=2 c+=1 return c c2=count2(A[0]) LCM=1 for a in A: if count2(a)!=c2: print(0) sys.exit() LCM=lcm(a//2,LCM) if LCM>M: print(0) sys.exit() print(max(0,(M-LCM)//(2*LCM)+1))
[]
617,239
617,240
u695811449
python
p02814
N,M = map(int, input().split()) a_n = list(map(int, input().split())) g = a_n.copy() while not any(x%2 for x in g): g = [x//2 for x in g] if not all(x%2 for x in g): print(0); exit(0) def gcd(a,b): while b: a,b = b,a%b return a lcm = lambda a,b: a*b//gcd(a,b) tot = 1 for x in l: tot = lcm(tot,x//2) print((m//tot+1)//2)
N,M = map(int, input().split()) a_n = list(map(int, input().split())) g = a_n.copy() while not any(x%2 for x in g): g = [x//2 for x in g] if not all(x%2 for x in g): print(0); exit(0) def gcd(a,b): while b: a,b = b,a%b return a lcm = lambda a,b: a*b//gcd(a,b) tot = 1 for x in a_n: tot = lcm(tot,x//2) print((M//tot+1)//2)
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
617,241
617,242
u018990794
python
p02814
#ABC150_D from math import gcd N,M=map(int,input().split()) A=list(map(int,input().split())) lcm=a[0]//2 for x in A: x//=2 g=gcd(lcm,x) if (lcm//g)%2!=(x//g)%2: print(0) exit() lcm=lcm*x//g print((M//lcm+1)//2)
#ABC150_D from math import gcd N,M=map(int,input().split()) A=list(map(int,input().split())) lcm=A[0]//2 for x in A: x//=2 g=gcd(lcm,x) if (lcm//g)%2!=(x//g)%2: print(0) exit() lcm=lcm*x//g print((M//lcm+1)//2)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
617,281
617,282
u842964692
python
p02814
N,M=map(int,input().split()) a=[int(x)//2 for x in input().split()] def lcm(a,b): if a>b: a,b=b,a if a==1: return b n=a*b while a!=0: b,a=a,b%a return n//b f1,f2=a[0],a[0] for i in range(1,N-1): f1|=a[i] f2&=a[i] c=0 while f1&1==0: f1//=2 c+=1 if f2&2**c==0: print(0) exit() t=a[0] for i in range(1,N): t=lcm(t,a[i]) if t>M: print(0) break else: print(M//t-M//(t*2))
N,M=map(int,input().split()) a=[int(x)//2 for x in input().split()] def lcm(a,b): if a>b: a,b=b,a if a==1: return b n=a*b while a!=0: b,a=a,b%a return n//b f1,f2=a[0],a[0] for i in range(1,N): f1|=a[i] f2&=a[i] c=0 while f1&1==0: f1//=2 c+=1 if f2&2**c==0: print(0) exit() t=a[0] for i in range(1,N): t=lcm(t,a[i]) if t>M: print(0) break else: print(M//t-M//(t*2))
[ "expression.operation.binary.remove" ]
617,291
617,292
u692746605
python
p02814
import sys def f(x): cnt = 0 while x%2 == 0: x /= 2 cnt += 1 return cnt def gcd(x, y): if y: return gcd(y, x%y) else: return x def lcm(x, y): return (x * y) // gcd(x, y) n, m = map(int, input().split()) a = list(map(int, input().split())) a = [i//2 for i in a] t = f(a[0]) for i in range(1, t): if f(a[i]) != t: print(0) sys.exit() a[i] >>= t m >>= t l = 1 for i in range(n): l = lcm(l, a[i]) if l > m: print(0) sys.exit() m //= l ans = (m+1) // 2 print(ans)
import sys def f(x): cnt = 0 while x%2 == 0: x /= 2 cnt += 1 return cnt def gcd(x, y): if y: return gcd(y, x%y) else: return x def lcm(x, y): return (x * y) // gcd(x, y) n, m = map(int, input().split()) a = list(map(int, input().split())) a = [i//2 for i in a] t = f(a[0]) for i in range(n): if f(a[i]) != t: print(0) sys.exit() a[i] >>= t m >>= t l = 1 for i in range(n): l = lcm(l, a[i]) if l > m: print(0) sys.exit() m //= l ans = (m+1) // 2 print(ans)
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
617,303
617,304
u278142467
python
p02814
from math import gcd import sys input = sys.stdin.readline def main(): N, M = map(int, input().split()) A = list(map(lambda x: int(x) // 2, input().split())) X = A[0] for i in range(1, N): a, b = X, A[i] X = a * b // gcd(a, b) if X > M: print(0) exit(0) cnt = -1 tmp = X while tmp % 2 == 1: tmp = tmp // 2 cnt += 1 for a in A: if a % (2 ** cnt) == 0 and a % (2 ** (cnt + 1)) != 0: continue else: print(0) exit(0) print((M // X + 1) // 2) if __name__ == '__main__': main()
from math import gcd import sys input = sys.stdin.readline def main(): N, M = map(int, input().split()) A = list(map(lambda x: int(x) // 2, input().split())) X = A[0] for i in range(1, N): a, b = X, A[i] X = a * b // gcd(a, b) if X > M: print(0) exit(0) cnt = 0 tmp = X while tmp % 2 == 0: tmp = tmp // 2 cnt += 1 for a in A: if a % (2 ** cnt) == 0 and a % (2 ** (cnt + 1)) != 0: continue else: print(0) exit(0) print((M // X + 1) // 2) if __name__ == '__main__': main()
[ "assignment.value.change", "expression.operation.unary.remove", "literal.number.integer.change", "control_flow.loop.condition.change" ]
617,313
617,314
u380772254
python
p02814
N, M = map(int, input().split()) A = list(map(int, input().split())) half = [i//2 for i in A] def f(v): r = 0 while v % 2 == 0: v /= 2 r += 1 return r from math import gcd def f2(x, y): return (x * y) // gcd(x, y) d = f(A[0]) for ai in A: if d != f(ai): print(0) break else: lcm = 1 for ai in half: lcm = f2(lcm, ai) r = M // lcm ans = (r + 2) // 2 print(ans)
N, M = map(int, input().split()) A = list(map(int, input().split())) half = [i//2 for i in A] def f(v): r = 0 while v % 2 == 0: v /= 2 r += 1 return r from math import gcd def f2(x, y): return (x * y) // gcd(x, y) d = f(A[0]) for ai in A: if d != f(ai): print(0) break else: lcm = 1 for ai in half: lcm = f2(lcm, ai) r = M // lcm ans = (r + 1) // 2 print(ans)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
617,354
617,355
u002459665
python
p02814
import math n,m = map(int,input().split()) l = list(map(int,input().split())) count = 0 while True: if l[0] % 2 == 0: l[0] //= 2 count += 1 else: break for i in range(1,n): l[i] //= 2**count if l[i] % 1 != 0 or l[i] % 2 == 0: print(0) exit() ans = l[0] for i in range(1,n): ans = ans * l[i] //math.gcd(ans,l[i]) ans1 = math.ceil((m//2**(count-1))/ans) if ans1 % 2 == 0: print(ans1//2) else: print(ans1//2+1)
import math n,m = map(int,input().split()) l = list(map(int,input().split())) count = 0 while True: if l[0] % 2 == 0: l[0] //= 2 count += 1 else: break for i in range(1,n): l[i] //= 2**count if l[i] % 1 != 0 or l[i] % 2 == 0: print(0) exit() ans = l[0] for i in range(1,n): ans = ans * l[i] //math.gcd(ans,l[i]) ans1 = (m//2**(count-1))//ans if ans1 % 2 == 0: print(ans1//2) else: print(ans1//2+1)
[ "call.remove", "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
617,362
617,363
u368796742
python
p02814
from math import gcd N, M = list(map(int, input().split())) A = list(map(int, input().split())) def lcm(values): ans = values[0] for i in range(1, len(values)): ans = ans * values[i] // gcd(ans, values[i]) return ans def count_div2(value): count = 0 while value % 2 == 0: count += 1 value //= 2 return count min_value = lcm(A) amount = M * 2 // min_value div2 = count_div2(A[0]) if any([count_div2(a) != amount_div2 for a in A]): print(0) else: print((amount + 1) // 2)
from math import gcd N, M = list(map(int, input().split())) A = list(map(int, input().split())) def lcm(values): ans = values[0] for i in range(1, len(values)): ans = ans * values[i] // gcd(ans, values[i]) return ans def count_div2(value): count = 0 while value % 2 == 0: count += 1 value //= 2 return count min_value = lcm(A) amount = M * 2 // min_value div2 = count_div2(A[0]) if any([count_div2(a) != div2 for a in A]): print(0) else: print((amount + 1) // 2)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
617,372
617,373
u956937655
python
p02814
import math n,m = map(int,input().split()) A=list(map(int,input().split())) def lcm(x, y): return (x * y) // math.gcd(x, y) def chk(i): cnt=0 while True: if i%2==0: i/=2 cnt+=1 else: break return cnt flag=0 number=chk(A[0]) for i in A: if chk(i)!=number: print(0) exit() l = 1 for i in A: l = l * i // math.gcd(l, i) print((m // l + 1) // 2) """ num=A[0]//2 flag2=0 if flag==0: for i in range(1,len(A)): num=lcm(num,A[i]//2) if num>m: flag2=1 break if flag2==1: print(0) else: print(math.ceil(m//num/2)) """
import math n,m = map(int,input().split()) A=list(map(int,input().split())) def lcm(x, y): return (x * y) // math.gcd(x, y) def chk(i): cnt=0 while True: if i%2==0: i/=2 cnt+=1 else: break return cnt flag=0 number=chk(A[0]) for i in A: if chk(i)!=number: print(0) exit() l = 1 for i in A: l = l * i//2 // math.gcd(l, i//2) print((m // l + 1) // 2) """ num=A[0]//2 flag2=0 if flag==0: for i in range(1,len(A)): num=lcm(num,A[i]//2) if num>m: flag2=1 break if flag2==1: print(0) else: print(math.ceil(m//num/2)) """
[ "assignment.change" ]
617,377
617,378
u916637712
python
p02814
def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) def div2(x): c = 0 while x%2==0: x //= 2 c+=1 return c def test(): N, M = map(int, input().split()) a = list(map(int, input().split())) for i in range(N): if a[i]%2 == 1: return 0 a[i] //= 2 t = div2(a[i]) for i in range(1, N): if div2(a[i]) != t: return 0 a[i] >>= t M >>= t L = a[0] for i in range(1, N): L = lcm(L, a[i]) if L > M: return 0 ans = (M-L)//(2*L)+1 return ans print(test())
def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) def div2(x): c = 0 while x%2==0: x //= 2 c+=1 return c def test(): N, M = map(int, input().split()) a = list(map(int, input().split())) for i in range(N): if a[i]%2 == 1: return 0 a[i] //= 2 t = div2(a[0]) for i in range(N): if div2(a[i]) != t: return 0 a[i] >>= t M >>= t L = a[0] for i in range(1, N): L = lcm(L, a[i]) if L > M: return 0 ans = (M-L)//(2*L)+1 return ans print(test())
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "variable_access.subscript.index.change", "call.arguments.change" ]
617,426
617,425
u637170240
python
p02814
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd from functools import reduce A = [x >> 1 for x in A] def merge(a, b): g = gcd(a, b) a //= g b //= g if a % 2 == 0: return 0 if b % 2 == 0: return 0 n = a * b * g if n > 10 ** 9: return 0 return n x = reduce(merge, A) if x == 0: ans = 0 else: ans = (M//x) - (M//(2*M)) print(ans)
N, M = map(int, input().split()) A = list(map(int, input().split())) from math import gcd from functools import reduce A = [x >> 1 for x in A] def merge(a, b): g = gcd(a, b) a //= g b //= g if a % 2 == 0: return 0 if b % 2 == 0: return 0 n = a * b * g if n > 10 ** 9: return 0 return n x = reduce(merge, A) if x == 0: ans = 0 else: ans = (M//x) - (M//(2*x)) print(ans)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
617,432
617,433
u554954744
python
p02814
import sys from math import gcd def cnt(x): a = 0 while True: r = x % 2 if r == 1: break else: a += 1 x //= 2 read = sys.stdin.read N, M, *a = map(int, read().split()) a = list(set(a)) b = [cnt(i) for i in a] if len(set(b)) != 1: print(0) exit() m = 2 * M lcm = a[0] for i in a: g = gcd(lcm, i) lcm = lcm * i // g if lcm > m: print(0) exit() lcm //= 2 if M < lcm: print(0) else: print((M - lcm) // (lcm * 2) + 1)
import sys from math import gcd def cnt(x): a = 0 while True: r = x % 2 if r == 1: break else: a += 1 x //= 2 return a read = sys.stdin.read N, M, *a = map(int, read().split()) a = list(set(a)) b = [cnt(i) for i in a] if len(set(b)) != 1: print(0) exit() m = 2 * M lcm = a[0] for i in a: g = gcd(lcm, i) lcm = lcm * i // g if lcm > m: print(0) exit() lcm //= 2 if M < lcm: print(0) else: print((M - lcm) // (lcm * 2) + 1)
[ "control_flow.return.add" ]
617,438
617,439
u945181840
python
p02814
import math def lcm(x, y): return (x * y) // math.gcd(x, y) # 2で割れる回数を数える def f(x): t = 0 while (x % 2 == 0): x //= 2 t += 1 return t n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] //= 2 cnt = f(a[0]) for i in range(n): # 割れる回数が一致しなければ不可 if cnt != f(a[i]): print(0) exit() a[i] >>= cnt m >> cnt num = 1 for i in range(n): num = lcm(num, a[i]) if num > m: print(0) exit() m //= num ans = (m + 1) // 2 print(ans)
import math def lcm(x, y): return (x * y) // math.gcd(x, y) # 2で割れる回数を数える def f(x): t = 0 while (x % 2 == 0): x //= 2 t += 1 return t n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] //= 2 cnt = f(a[0]) for i in range(n): # 割れる回数が一致しなければ不可 if cnt != f(a[i]): print(0) exit() a[i] >>= cnt m >>= cnt num = 1 for i in range(n): num = lcm(num, a[i]) if num > m: print(0) exit() m //= num ans = (m + 1) // 2 print(ans)
[ "assignment.compound.bitwise.replace.add", "expression.operator.bitwise.replace.remove", "expression.operation.binary.change" ]
617,448
617,449
u305366205
python
p02814
import math def lcm(x, y): return (x * y) // math.gcd(x, y) # 2で割れる回数を数える def f(x): t = 0 while (x % 2 == 0): x //= 2 t += 1 return t n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] //= 2 cnt = f(a[0]) for i in range(n): # 割れる回数が一致しなければ不可 if cnt != f(a[i]): print(0) exit() a[i] >>= cnt num = 1 for i in range(n): num = lcm(num, a[i]) if num > m: print(0) exit() m //= num ans = (m + 1) // 2 print(ans)
import math def lcm(x, y): return (x * y) // math.gcd(x, y) # 2で割れる回数を数える def f(x): t = 0 while (x % 2 == 0): x //= 2 t += 1 return t n, m = map(int, input().split()) a = list(map(int, input().split())) for i in range(n): a[i] //= 2 cnt = f(a[0]) for i in range(n): # 割れる回数が一致しなければ不可 if cnt != f(a[i]): print(0) exit() a[i] >>= cnt m >>= cnt num = 1 for i in range(n): num = lcm(num, a[i]) if num > m: print(0) exit() m //= num ans = (m + 1) // 2 print(ans)
[]
617,450
617,449
u305366205
python
p02814
from math import gcd from math import ceil n,m=map(int,input().split()) a=list(map(int,input().split())) c=len(bin(a[0]))-bin(a[0]).rfind("1") for i in range(1,n): if c!=len(bin(a[i+1]))-bin(a[i+1]).rfind("1"): print(0) exit() g=a[0] for i in range(n-1): g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1]) g//=2 print(ceil((m//g)/2))
from math import gcd from math import ceil n,m=map(int,input().split()) a=list(map(int,input().split())) c=len(bin(a[0]))-bin(a[0]).rfind("1") for i in range(1,n): if c!=len(bin(a[i]))-bin(a[i]).rfind("1"): print(0) exit() g=a[0] for i in range(n-1): g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1]) g//=2 print(ceil((m//g)/2))
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
617,467
617,468
u169138653
python
p02814
import math n,m = map(int,input().split()) a = list(map(int, input().split())) s = set(a) c = set() l = 1 k = (a[0] // 2) % 2 for i in a: l = l * i // math.gcd(l,i) if l // 2 > m: ans = 0 break count = 0 while True: if (i>>count) % 2 == 0: count += 1 else: c.add(count) break if len(c) > 1: ans = 0 break else: ans = (M + l // 2) // l print(ans)
import math n,m = map(int,input().split()) a = list(map(int, input().split())) s = set(a) c = set() l = 1 k = (a[0] // 2) % 2 for i in a: l = l * i // math.gcd(l,i) if l // 2 > m: ans = 0 break count = 0 while True: if (i>>count) % 2 == 0: count += 1 else: c.add(count) break if len(c) > 1: ans = 0 break else: ans = (m + l // 2) // l print(ans)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
617,476
617,477
u204842730
python
p02814
from math import gcd from functools import reduce def lcm(x, y): res = (x * y) // gcd(x, y) if 10 ** 9 < res: res = 0 return res def solve(): N, M, *a = map(int, open(0).read().split()) half_a = [ai // 2 for ai in a] half_lcm = reduce(lcm, half_a) for ai in a: if (half_lcm // ai) % 2 == 0: print(0) exit() if half_lcm == 0: ans = 0 else: ans = (M // half_lcm) - (M // (2 * half_lcm)) print(ans) if __name__ == '__main__': solve()
from math import gcd from functools import reduce def lcm(x, y): res = (x * y) // gcd(x, y) if 10 ** 9 < res: res = 0 return res def solve(): N, M, *a = map(int, open(0).read().split()) half_a = [ai // 2 for ai in a] half_lcm = reduce(lcm, half_a) for ai in half_a: if (half_lcm // ai) % 2 == 0: print(0) exit() if half_lcm == 0: ans = 0 else: ans = (M // half_lcm) - (M // (2 * half_lcm)) print(ans) if __name__ == '__main__': solve()
[ "identifier.change" ]
617,507
617,508
u935984175
python
p02814
def gcd(a,b): while b: a,b=b,a%b return a n,m=map(int,input().split()) a=list(map(int,input().split())) for i in range(n): a[i]//=2 x=a[0] for j in range(30): if x%2==0: x//=2 else: p=j for i in range(1,n): x=a[i] for j in range(30): if x%2==0: x//=2 else: if p!=j: print(0) exit() ans = a[0] for i in range(1, n): ans = ans * a[i] // gcd(ans, a[i]) if ans>m: print(0) exit() if (m//ans)%2==0: print(m//ans//2) else: print(m//ans//2+1)
def gcd(a,b): while b: a,b=b,a%b return a n,m=map(int,input().split()) a=list(map(int,input().split())) for i in range(n): a[i]//=2 x=a[0] for j in range(30): if x%2==0: x//=2 else: p=j break for i in range(1,n): x=a[i] for j in range(30): if x%2==0: x//=2 else: if p!=j: print(0) exit() break ans = a[0] for i in range(1, n): ans = ans * a[i] // gcd(ans, a[i]) if ans>m: print(0) exit() if (m//ans)%2==0: print(m//ans//2) else: print(m//ans//2+1)
[ "control_flow.break.add" ]
617,509
617,510
u225388820
python
p02814
#! /usr/bin/env python # -*- coding: utf-8 -*- import pdb import sys import functions F = sys.stdin N, M = list(map(int,F.readline().rstrip().split())) a_list = list(map(int,F.readline().rstrip().split())) num = 1 while a_list[0] % 2**(num + 1) == 0: num += 1 def lcm(a, b): return (a * b) // functions.gcd(a, b) lcm_before = 1 for a in a_list: if (a/(2**num)) % 2 != 1: print(0) sys.exit() lcm_before = lcm(lcm_before, a//2) ans1 = M // lcm_before ans = (ans1 + 1) // 2 print(ans)
#! /usr/bin/env python # -*- coding: utf-8 -*- import pdb import sys import math F = sys.stdin N, M = list(map(int,F.readline().rstrip().split())) a_list = list(map(int,F.readline().rstrip().split())) num = 1 while a_list[0] % 2**(num + 1) == 0: num += 1 def lcm(a, b): return (a * b) // math.gcd(a, b) lcm_before = 1 for a in a_list: if (a/(2**num)) % 2 != 1: print(0) sys.exit() lcm_before = lcm(lcm_before, a//2) ans1 = M // lcm_before ans = (ans1 + 1) // 2 print(ans)
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
617,524
617,525
u637413735
python
p02814
n,m=map(int,input().split()) a = [int(x)//2 for x in input().split()] import math lmc=a[0] for i in range(1,n): lmc=lmc*a[i]//math.gcd(lmc,a[i]) if lmc>m: print("0") exit() for i in range(n): if (lmc//a[i])%2==0: print("0") exit() if (m//lmc)%2==0: print((m//lmc)%2) else: print(((m//lmc)+1)%2)
n,m=map(int,input().split()) a = [int(x)//2 for x in input().split()] import math lmc=a[0] for i in range(1,n): lmc=lmc*a[i]//math.gcd(lmc,a[i]) if lmc>m: print("0") exit() for i in range(n): if (lmc//a[i])%2==0: print("0") exit() if (m//lmc)%2==0: print((m//lmc)//2) else: print(((m//lmc)+1)//2)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
617,533
617,534
u747220349
python
p02814
import math N,M=map(int, input().split()) A = [int(a) for a in input().split()] A2 = [a>>1 for a in A] lcm = A2[0] for i in range(1, N): lcm = lcm * A2[i] // math.gcd(lcm, A2[i]) if lcm>M: print(0) exit() B = sum([1 for a in A if lcm%a==0]) if B>0: print(0) else: print((M//lcm+1)//2)
import sys import math N,M=map(int, input().split()) A = [int(a) for a in input().split()] A2 = [a>>1 for a in A] lcm = A2[0] for i in range(1, N): lcm = lcm * A2[i] // math.gcd(lcm, A2[i]) if lcm>M: print(0) sys.exit() B = sum([1 for a in A if lcm%a==0]) if B>0: print(0) else: print((M//lcm+1)//2)
[]
617,634
617,635
u425061801
python
p02814
import math def lcm(x, y): return x * y // math.gcd(x, y) N, M = [int(x) for x in input().split()] l = [int(x) // 2 for x in input().split()] ans = l[0] for i in reversed(range(30)): if ans % 2 ** i == 0: numof2 = 2 ** i for i in range(1, N): if l[i] % numof2 == 0 and (l[i] // numof2) % 2 == 1: ans = lcm(ans, l[i]) else: ans = M + 1 break ans2 = M // ans print(ans2 // 2 + ans2 % 2)
import math def lcm(x, y): return x * y // math.gcd(x, y) N, M = [int(x) for x in input().split()] l = [int(x) // 2 for x in input().split()] ans = l[0] for i in reversed(range(30)): if ans % 2 ** i == 0: numof2 = 2 ** i break for i in range(1, N): if l[i] % numof2 == 0 and (l[i] // numof2) % 2 == 1: ans = lcm(ans, l[i]) else: ans = M + 1 break ans2 = M // ans print(ans2 // 2 + ans2 % 2)
[ "control_flow.break.add" ]
617,655
617,656
u930574673
python
p02814
import math n,m = map(int, input().split( )) a = list(map(int, input().split( ))) for i in range(n): a[i]//=2 pow2 = 2**50 p2 = set() for i in range(n): tmp = math.gcd(pow2,a[i]) p2.add(tmp) if len(set())>1: print(0) exit() def lcd(x,y): tmp = math.gcd(x,y) x//=tmp y//=tmp return x*y*tmp tmp = a[0] for i in range(n): tmp = lcd(tmp,a[i]) if tmp > m: print(0) exit() tmp2 = tmp*2 ans = m//tmp ans2 = m//tmp2 ans -= ans2 print(ans)
import math n,m = map(int, input().split( )) a = list(map(int, input().split( ))) for i in range(n): a[i]//=2 pow2 = 2**50 #10**9 <= 2**30 p2 = set() for i in range(n): tmp = math.gcd(pow2,a[i]) p2.add(tmp) if len(p2)>1:### print(0) exit() def lcd(x,y): tmp = math.gcd(x,y) x//=tmp y//=tmp return x*y*tmp tmp = a[0] for i in range(n): tmp = lcd(tmp,a[i]) if tmp > m: print(0) exit() tmp2 = tmp*2 ans = m//tmp ans2 = m//tmp2 ans -= ans2 print(ans)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "call.arguments.change" ]
617,678
617,679
u520276780
python
p02814
import sys def input(): return sys.stdin.readline()[:-1] from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) m *= 2 if n == 1: print((m//a[0]+1)//2) else: lcm = a[0]*a[1]//gcd(a[0], a[1]) for i in range(2, n): lcm = lcm * a[i] // gcd(lcm, a[i]) if lcm > x: print(0) sys.exit() divs = 0 for x in a: divs += (lcm//x)%2 if divs < n: print(0) else: print((m//lcm+1)//2)
import sys def input(): return sys.stdin.readline()[:-1] from math import gcd n, m = map(int, input().split()) a = list(map(int, input().split())) m *= 2 if n == 1: print((m//a[0]+1)//2) else: lcm = a[0]*a[1]//gcd(a[0], a[1]) for i in range(2, n): lcm = lcm * a[i] // gcd(lcm, a[i]) if lcm > m: print(0) sys.exit() divs = 0 for x in a: divs += (lcm//x)%2 if divs < n: print(0) else: print((m//lcm+1)//2)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
617,706
617,707
u218843509
python
p02814
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd from functools import reduce N,M,*A = map(int,read().split()) # 「奇数倍」に帰着 A = [x >> 1 for x in A] def merge(a,b): g = gcd(a,b) a //= g; b //= g if a % 2 == 0: return 0 if b % 2 == 0: return 0 n = a * b if n > 10 ** 9: return 0 return n x = reduce(merge, A) if x == 0: answer = 0 else: answer = (M//x) - (M//(x+x)) print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd from functools import reduce N,M,*A = map(int,read().split()) # 「奇数倍」に帰着 A = [x >> 1 for x in A] def merge(a,b): g = gcd(a,b) a //= g; b //= g if a % 2 == 0: return 0 if b % 2 == 0: return 0 n = a * b * g if n > 10 ** 9: return 0 return n x = reduce(merge, A) if x == 0: answer = 0 else: answer = (M//x) - (M//(x+x)) print(answer)
[ "assignment.change" ]
617,714
617,715
u102461423
python
p02815
import sys input = sys.stdin.readline n = int(input()) mod = 10**9+7 a = list(map(int,input().split())) a.sort() ans = 0 const = pow(2,n,mod) if n == 1: print(a[0]*3) exit() for i in range(n): ans = (ans + a[i]*const*(pow(2,n-1,mod)+pow(2,n-2,mod)*(n-i-1))%mod)%mod print(ans)
import sys input = sys.stdin.readline n = int(input()) mod = 10**9+7 a = list(map(int,input().split())) a.sort() ans = 0 const = pow(2,n,mod) if n == 1: print(a[0]*2%mod) exit() for i in range(n): ans = (ans + a[i]*const*(pow(2,n-1,mod)+pow(2,n-2,mod)*(n-i-1))%mod)%mod print(ans)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
617,748
617,749
u905582793
python
p02815
n=int(input()) c=list(map(int,input().split())) c.sort(reverse=True) res=0 ans=0 mod=10**9+7 p=pow(2,n*2-2,mod) for i in range(n): ans+=(c[i]*(i+2)%mod)*p prit(ans)
n=int(input()) c=list(map(int,input().split())) c.sort(reverse=True) res=0 ans=0 mod=10**9+7 p=pow(2,n*2-2,mod) for i in range(n): ans+=(c[i]*(i+2)%mod)*p print(ans%mod)
[ "identifier.change", "call.function.change" ]
617,754
617,755
u747220349
python
p02815
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): res = list(sys.stdin.readline()) if res[-1] == "\n": return res[:-1] return res def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def solve(): n = I() c = LI() c.sort() if n == 1: print(2*c[0]%mod) return k = pow(2,n-2,mod) p = pow(2,n,mod) f = [k*(i+2)*p%mod for i in range(n)][::-1] ans = 0 for i in range(n): ans += c[i]*f[i] ans %= mod print(ans*p%mod) return #Solve if __name__ == "__main__": solve()
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): res = list(sys.stdin.readline()) if res[-1] == "\n": return res[:-1] return res def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def solve(): n = I() c = LI() c.sort() if n == 1: print(2*c[0]%mod) return k = pow(2,n-2,mod) p = pow(2,n,mod) f = [k*(i+2)%mod for i in range(n)][::-1] ans = 0 for i in range(n): ans += c[i]*f[i] ans %= mod print(ans*p%mod) return #Solve if __name__ == "__main__": solve()
[ "expression.operation.binary.remove" ]
617,870
617,871
u585482323
python
p02815
import sys,collections as cl,bisect as bs,math sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] aa = x[0] su = 1 for i in range(len(x)-1): if aa != x[i+1]: a.append([aa,su]) aa = x[i+1] su = 1 else: su += 1 a.append([aa,su]) return a def jo(x): #listをスペースごとに分ける return " ".join(map(str,x)) def max2(x): #他のときもどうように作成可能 return max(map(max,x)) def In(x,a): #aがリスト(sorted) k = bs.bisect_left(a,x) if k != len(a) and a[k] == x: return True else: return False from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) def gcd_list(numbers): return reduce(math.gcd, numbers) def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) """ def nibu(x,n,r): ll = 0 rr = r while True: mid = (ll+rr)//2 if rr == mid: return ll if (ここに評価入れる): rr = mid else: ll = mid+1 """ n = onem() c = l() c.sort(reverse = True) po = 1 for i in range(n-1): po *= 4 po %= mod co = 0 for i in range(n): co += (i+2)*c[i] co %= mod print(po,co) print((co * po) % mod)
import sys,collections as cl,bisect as bs,math sys.setrecursionlimit(100000) input = sys.stdin.readline mod = 10**9+7 Max = sys.maxsize def l(): #intのlist return list(map(int,input().split())) def m(): #複数文字 return map(int,input().split()) def onem(): #Nとかの取得 return int(input()) def s(x): #圧縮 a = [] aa = x[0] su = 1 for i in range(len(x)-1): if aa != x[i+1]: a.append([aa,su]) aa = x[i+1] su = 1 else: su += 1 a.append([aa,su]) return a def jo(x): #listをスペースごとに分ける return " ".join(map(str,x)) def max2(x): #他のときもどうように作成可能 return max(map(max,x)) def In(x,a): #aがリスト(sorted) k = bs.bisect_left(a,x) if k != len(a) and a[k] == x: return True else: return False from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) def gcd_list(numbers): return reduce(math.gcd, numbers) def lcm_base(x, y): return (x * y) // math.gcd(x, y) def lcm(*numbers): return reduce(lcm_base, numbers, 1) def lcm_list(numbers): return reduce(lcm_base, numbers, 1) """ def nibu(x,n,r): ll = 0 rr = r while True: mid = (ll+rr)//2 if rr == mid: return ll if (ここに評価入れる): rr = mid else: ll = mid+1 """ n = onem() c = l() c.sort(reverse = True) po = 1 for i in range(n-1): po *= 4 po %= mod co = 0 for i in range(n): co += (i+2)*c[i] co %= mod print((co * po) % mod)
[ "call.remove" ]
617,880
617,881
u807772568
python
p02815
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) a.sort(reverse = True) mod = 10 ** 9 + 7 res = 0 if N == 1: print(a[0] * 2) exit(0) for i in range(N): res += a[i] * (pow(2, N - 1, mod) % mod + pow(2, N - 2, mod) * i % mod) % mod res %= mod print(res * pow(2, N, mod) % mod)
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) a.sort(reverse = True) mod = 10 ** 9 + 7 res = 0 if N == 1: print(a[0] * 2 % mod) exit(0) for i in range(N): res += a[i] * (pow(2, N - 1, mod) % mod + pow(2, N - 2, mod) * i % mod) % mod res %= mod print(res * pow(2, N, mod) % mod)
[ "expression.operation.binary.add" ]
617,890
617,891
u141610915
python
p02815
n = int(input()) c = sorted(list(map(int, input().split()))) p = 10**9+7 print(sum([(i+2) * c[i] for i in range(n)]) * pow(4, n-1, p) % p)
n = int(input()) c = sorted(list(map(int, input().split())), reverse=True) p = 10**9+7 print(sum([(i+2) * c[i] for i in range(n)]) * pow(4, n-1, p) % p)
[ "call.arguments.add" ]
617,900
617,901
u652057333
python
p02815
n = int(input()) c = sorted(list(map(int, input().split())),reverse=True) mod = 10**9 + 7 ans = 0 two = [1] for i in range(n*2): two += [(two[i]*2) % mod] for i in range(n): ans += (i+1) * c[i] ans %= mod ans *= two[2*n - 2] print(ans%mod)
n = int(input()) c = sorted(list(map(int, input().split())),reverse=True) mod = 10**9 + 7 ans = 0 two = [1] for i in range(n*2): two += [(two[i]*2) % mod] for i in range(n): ans += (i+2) * c[i] ans %= mod ans *= two[2*n - 2] print(ans%mod)
[ "literal.number.integer.change", "expression.operation.binary.change" ]
617,929
617,930
u934868410
python
p02815
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i+2) ans%=mod print(ans*pow(4,n-1,mod)%mod)
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i+1) ans%=mod print((ans*pow(4,n-1,mod))%mod)
[ "literal.number.integer.change", "expression.operation.binary.change", "call.arguments.change" ]
617,968
617,969
u223904637
python
p02815
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i) ans%=mod print(2*ans*pow(4,n-1,mod)%mod)
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i+1) ans%=mod print((ans*pow(4,n-1,mod))%mod)
[ "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
617,970
617,969
u223904637
python
p02815
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i) ans%=mod print(ans*pow(4,n-1,mod)%mod)
n=int(input()) mod=10**9+7 c=list(map(int,input().split())) c.sort() ans=0 for i in range(n): ans+=c[i]*(n-i+1) ans%=mod print((ans*pow(4,n-1,mod))%mod)
[ "call.arguments.change" ]
617,971
617,969
u223904637
python
p02817
import sys S, T = next(sys.stdin).strip().split() print(T, S)
import sys S, T = next(sys.stdin).strip().split() print(T + S)
[ "call.arguments.change", "io.output.change" ]
617,993
617,994
u317423698
python
p02817
s,t=input().split() print(s+t)
s,t=input().split() print(t+s)
[ "expression.operation.binary.remove" ]
617,995
617,996
u906769651
python
p02817
s,t = input().split() print(s + t)
s,t = input().split() print(t + s)
[ "expression.operation.binary.remove" ]
618,007
618,008
u833416137
python
p02817
a,b=input().split() for i in a,b: print(i,end="")
a,b=input().split() for i in b,a: print(i,end="")
[]
618,023
618,024
u773440446
python
p02817
a,b = input().split() print(a+b, sep = "", end="")
a,b = input().split() print(b+a, sep = "", end="")
[ "expression.operation.binary.remove" ]
618,027
618,028
u440960093
python
p02817
a=input().split() print(a[0]+a[1])
a=input().split() print(a[1]+a[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,039
618,040
u094102716
python
p02817
S,T = list(map(int, input().split())) print(T+S)
S,T = map(str, input().split()) print(T+S)
[ "call.remove", "assignment.value.change", "identifier.change", "call.arguments.change" ]
618,045
618,046
u118760114
python
p02817
s, t = input().split() print(s + t)
s, t = input().split() print(t + s)
[ "expression.operation.binary.remove" ]
618,051
618,052
u363421241
python
p02817
s, t = map(str, input().split()) print(''.join([s, t]))
s, t = map(str, input().split()) print(''.join([t, s]))
[]
618,055
618,056
u773580152
python
p02817
a = input().split() print("".join(a))
a = input().split() print("".join(reversed(a)))
[ "call.add", "call.arguments.change" ]
618,059
618,060
u192433528
python
p02817
a,b=input().split() print(a+b)
a,b=input().split() print(b+a)
[ "expression.operation.binary.remove" ]
618,094
618,095
u243159381
python
p02817
s=input().split() print(s[0]+s[1])
s=input().split() print(s[1]+s[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,100
618,101
u556594202
python
p02817
S, T = list(map(str,input().split())) print(S + T)
S, T = list(map(str,input().split())) print(T + S)
[ "expression.operation.binary.remove" ]
618,106
618,107
u426205961
python
p02817
print(*input().split(),sep='')
print(*input().split()[::-1],sep='')
[]
618,108
618,109
u014333473
python
p02817
s,t=map(str,input().split()) print(s,t,sep="")
s,t=map(str,input().split()) print(t,s,sep="")
[ "call.arguments.change", "call.arguments.add" ]
618,110
618,111
u438189153
python
p02817
a=list(map(str, input().split())) print('{} {}'.format(a[1],a[0]))
a=list(map(str, input().split())) print('{}{}'.format(a[1],a[0]))
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
618,112
618,113
u029056424
python
p02817
S,T = input().split() print(S + T)
S,T = input().split() print(T + S)
[ "expression.operation.binary.remove" ]
618,120
618,121
u840841119
python
p02817
a,b = map(str,input().split()) print(b+c)
a,b = map(str,input().split()) print(b+a)
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,126
618,127
u638970023
python
p02817
s = input() t = input() print(t+s)
s, t = input().split() print(t+s)
[ "assignment.variable.change", "call.remove", "call.add" ]
618,142
618,143
u941644149
python
p02817
def stringconcant(S,T): a = S b = T c = a+b return c S= input() T= input() a = stringconcant(T,S) print(a)
def stringconcant(S,T): a=S b=T c=a+b return c S,T = input().split() a = stringconcant(T,S) print(a)
[ "assignment.variable.change", "call.remove", "call.add" ]
618,154
618,153
u863370423
python
p02817
s = list(input().split()) print(s[0]+s[1])
s = list(input().split()) print(s[1]+s[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,158
618,159
u869519920
python
p02817
ls = list(map(str, input().split())) print(ls[0]+ls[1])
ls = list(map(str, input().split())) print(ls[1]+ls[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,162
618,163
u026155812
python
p02817
s = input() print(s[1] + s[0])
s = input().split() print(s[1] + s[0])
[ "call.add" ]
618,172
618,173
u780698286
python
p02817
S, T = map(str,input().split()) print(''.join(map(str,S+T)))
S, T = map(str,input().split()) print(''.join(map(str,T+S)))
[ "expression.operation.binary.remove" ]
618,187
618,188
u509029769
python
p02817
S,T = input().split() print(S+T)
S,T = input().split() print(T+S)
[ "expression.operation.binary.remove" ]
618,205
618,206
u507145838
python
p02817
#<ABC149> #<A> S, T = map(str,input().split()) print(S+T)
#<ABC149> #<A> S, T = map(str,input().split()) print(T+S)
[ "expression.operation.binary.remove" ]
618,216
618,217
u880480312
python
p02817
str_list = list(input().split(' ')) print(str_list[0]+str_list[1])
str_list = list(input().split(' ')) print(str_list[1]+str_list[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
618,224
618,225
u295148058
python
p02817
s,t=list(map(str,input().split())) print(s+t)
s,t=list(map(str,input().split())) print(t+s)
[ "expression.operation.binary.remove" ]
618,226
618,227
u437351386
python