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 |
|---|---|---|---|---|---|---|---|
p02793
|
N=int(input())
A=[int(i) for i in input().split(" ")]
mod=10**9+7
def GCD(a,b):
if min(a,b)==0:
return max(a,b)
else:
return GCD(min(a,b),max(a,b)%min(a,b))
def LCM(a,b):
return (a*b/GCD(a,b))
lcm=1
for a in A:
lcm=LCM(lcm,a)
retval=0
for a in A:
retval+=lcm/a
print(int(retval%mod))
|
N=int(input())
A=[int(i) for i in input().split(" ")]
mod=10**9+7
def GCD(a,b):
if min(a,b)==0:
return max(a,b)
else:
return GCD(min(a,b),max(a,b)%min(a,b))
def LCM(a,b):
return int(a*b//GCD(a,b))
lcm=1
for a in A:
lcm=LCM(lcm,a)
retval=0
for a in A:
retval+=lcm//a
print(int(retval%mod))
|
[
"call.add",
"type_conversion.to_integer.change",
"type_conversion.to_number.change",
"function.return_value.change",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 599,481
| 599,482
|
u922952729
|
python
|
p02793
|
import fraction
from functools import reduce
def lcm_base(x, y):
return (x * y) // fraction.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
LCM = lcm_list(A)
ans = 0
for i in range(N):
ans+=LCM//A[i]
print(ans%mod)
|
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)
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
LCM = lcm_list(A)
ans = 0
for i in range(N):
ans+=LCM//A[i]
print(ans%mod)
|
[
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 599,502
| 599,503
|
u189479417
|
python
|
p02793
|
#import math
#from functools import reduce
from math import gcd
#from functools import lru_cache
#def lcm_base(x, y):
# return (x * y) // gcd(x, y)
#def lcm(numbers):
# return reduce(lcm_base, numbers, 1)
#@lru_cache(maxsize=1000)
def lcm(a):
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n = int(input())
A = [int(x) for x in input().split()]
t_lcm = lcm(A)
count = 0
for i in A:
count += t_lcm/i
print(int(count%(10**9+7)))
|
#import math
#from functools import reduce
from math import gcd
#from functools import lru_cache
#def lcm_base(x, y):
# return (x * y) // gcd(x, y)
#def lcm(numbers):
# return reduce(lcm_base, numbers, 1)
def lcm(a):
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n = int(input())
A = [int(x) for x in input().split()]
t_lcm = lcm(A)
count = 0
for i in A:
count += t_lcm//i
print(count%(10**9+7))
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 599,523
| 599,524
|
u917363866
|
python
|
p02793
|
import math
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
c=c*A_//math.gcd(c,A_)
for A_ in A:
a+=c/A_
print(int(a%w))
|
import math
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
c=c*A_//math.gcd(c,A_)
for A_ in A:
a+=c//A_
print(int(a%w))
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 599,537
| 599,538
|
u391066416
|
python
|
p02793
|
import sys
from math import gcd
from functools import reduce
sys.setrecursionlimit(2147483647)
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
def main():
N = int(input())
A = list(map(int, input().split()))
lcm = lcm_list(A)
S = 0
for i in range(N):
S += lcm // A[i]
print(round(S % (1e9 + 7)))
main()
|
import sys
from math import gcd
from functools import reduce
sys.setrecursionlimit(2147483647)
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
def main():
N = int(input())
A = list(map(int, input().split()))
lcm = lcm_list(A)
S = 0
for i in range(N):
S += lcm // A[i]
print(round(S % (round(1e9) + 7)))
main()
|
[
"call.add",
"call.arguments.change"
] | 599,545
| 599,546
|
u582333355
|
python
|
p02793
|
n=int(input())
list1=list(map(int,input().split()))
import math
ans=list1[0]
for i in range(1, n):
ans = ans * list1[i] // math.gcd(ans, list1[i])
sum1=0
for i in list1:
sum1+=ans//i
print(sum1//(10**9+7))
|
n=int(input())
list1=list(map(int,input().split()))
import math
ans=list1[0]
for i in range(1, n):
ans = ans * list1[i] // math.gcd(ans, list1[i])
sum1=0
for i in list1:
sum1+=ans//i
print(sum1%(10**9+7))
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 599,547
| 599,548
|
u755801379
|
python
|
p02793
|
import sys #追加
sys.setrecursionlimit(500*500)
def lcm(a):
from math import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return int(x)
N = int(input())
A = list(map(int, input().split()))
LCM = lcm(A)
ans = 0
for a in A:
ans += int(LCM/a)
ans %= 1000000007
print(ans)
|
import sys #追加
sys.setrecursionlimit(500*500)
def lcm(a):
from math import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return int(x)
N = int(input())
A = list(map(int, input().split()))
LCM = lcm(A)
ans = 0
for a in A:
ans += LCM//a
ans %= 1000000007
print(ans)
|
[
"call.remove",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 599,549
| 599,550
|
u843070415
|
python
|
p02793
|
import sys
sys.setrecursionlimit(500*500)
def lcm(a):
from math import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
N = int(input())
A = list(map(int, input().split()))
LCM = lcm(A)
ans = 0
for a in A:
ans += LCM/a
ans %= 1000000007
print(ans)
|
import sys #追加
sys.setrecursionlimit(500*500)
def lcm(a):
from math import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return int(x)
N = int(input())
A = list(map(int, input().split()))
LCM = lcm(A)
ans = 0
for a in A:
ans += LCM//a
ans %= 1000000007
print(ans)
|
[
"call.add",
"call.arguments.change",
"function.return_value.change",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 599,551
| 599,550
|
u843070415
|
python
|
p02793
|
from sys import stdin
from collections import defaultdict
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
mod = 10 ** 9 + 7
g = defaultdict(int)
for i in range(N):
tmp = 1
a = A[i]
while tmp <= A[i] ** 0.5:
cnt = 0
while tmp > 1 and a % tmp == 0:
a //= tmp
cnt += 1
if cnt > 0:
g[tmp] = max(g[tmp], cnt)
tmp += 1
if a > 1:
if a not in g:
g[a] = 1
l = 1
ans = 0
print(g)
for i in g:
l *= pow(i, g[i], mod)
l %= mod
for a in A:
ans += l * pow(a, mod - 2, mod)
ans %= mod
print(ans)
|
from sys import stdin
from collections import defaultdict
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
mod = 10 ** 9 + 7
g = defaultdict(int)
for i in range(N):
tmp = 1
a = A[i]
while tmp <= A[i] ** 0.5:
cnt = 0
while tmp > 1 and a % tmp == 0:
a //= tmp
cnt += 1
if cnt > 0:
g[tmp] = max(g[tmp], cnt)
tmp += 1
if a > 1:
if a not in g:
g[a] = 1
l = 1
ans = 0
for i in g:
l *= pow(i, g[i], mod)
l %= mod
for a in A:
ans += l * pow(a, mod - 2, mod)
ans %= mod
print(ans)
|
[
"call.remove"
] | 599,611
| 599,612
|
u390618988
|
python
|
p02793
|
from math import gcd
def lcm(a):
from math import gcd
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0
for i in a:
ans+=A/i
print(ans%(10**9+7))
|
from math import gcd
def lcm(a):
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0
for i in a:
ans+=A//i
print(ans%(10**9+7))
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 599,613
| 599,614
|
u189326411
|
python
|
p02793
|
from math import gcd
def lcm(a):
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0
for i in a:
ans+=A/i
print(int(ans)%(10**9+7))
|
from math import gcd
def lcm(a):
x = a[0]
for i in range(1, len(a)):
x = (x * a[i]) // gcd(x, a[i])
return x
n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0
for i in a:
ans+=A//i
print(ans%(10**9+7))
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change",
"call.remove",
"call.arguments.change"
] | 599,615
| 599,614
|
u189326411
|
python
|
p02793
|
from math import gcd
n=int(input())
a=list(map(int, input().split()))
mod=10**9+7
l=1
ans=0
for i in a:
l=l*i//gcd(l,i)
for i in a:
ans+=l/i
print(int(ans%mod))
|
from math import gcd
n=int(input())
a=list(map(int, input().split()))
mod=10**9+7
l=1
ans=0
for i in a:
l=l*i//gcd(l,i)
for i in a:
ans+=l//i
print(ans%mod)
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 599,616
| 599,617
|
u189326411
|
python
|
p02793
|
import math
def lcm(a, b):
return a * b / math.gcd(a, b)
N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ll = A[0]
for i in A:
ll = lcm(ll, i)
ans = 0
for i in A:
ans += ll // i
print(int(ans%mod))
|
import math
def lcm(a, b):
return a * b // math.gcd(a, b)
N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ll = A[0]
for i in A:
ll = lcm(ll, i)
ans = 0
for i in A:
ans += ll // i
print(int(ans%mod))
|
[
"expression.operator.arithmetic.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 599,618
| 599,619
|
u534953209
|
python
|
p02793
|
import math
def lcm_list(numbers):
ans = numbers[0]
for number in numbers[1:]:
ans = (((number * ans)) / (math.gcd(number, ans)))
return ans
MOD = 10**9+7
N = input()
i = 0
arrs = list(map(int, input().split()))
lcms = lcm_list(arrs)
result = 0
for arr in arrs:
result += (lcms/arr)
result = result%MOD
ans = str(result).replace('.0','')
print(ans)
|
import math
def lcm_list(numbers):
ans = numbers[0]
for number in numbers[1:]:
ans = (((number * ans)) //(math.gcd(number, ans)))
return ans
MOD = 10 ** 9 + 7
N = input()
i = 0
arrs = list(map(int, input().split()))
lcms = lcm_list(arrs)
result = 0
for arr in arrs:
result += (lcms // arr)
result = result % MOD
ans = str(result).replace('.0', '')
print(ans)
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 599,623
| 599,624
|
u686175224
|
python
|
p02793
|
import math
N = int(input())
A = list(map(int, input().split(' ')))
lcm = 1
for a in A:
lcm *= (a // math.gcd(lcm, a)) % (10**9 + 7)
for i in range(len(A)):
A[i] = int(lcm / A[i])
print(sum(A) % (10**9 + 7))
|
import math
N = int(input())
A = list(map(int, input().split(' ')))
lcm = 1
for a in A:
lcm *= (a // math.gcd(lcm, a)) % (10**9 + 7)
for i in range(len(A)):
A[i] = lcm // A[i]
print(sum(A) % (10**9 + 7))
|
[
"identifier.change",
"expression.operation.binary.change",
"call.remove",
"expression.operator.arithmetic.change",
"assignment.value.change",
"call.arguments.change"
] | 599,629
| 599,628
|
u485859160
|
python
|
p02793
|
import math
def xgcd(a, b):
x0, y0, x1, y1 = 1, 0, 0, 1
while b != 0:
q, a, b = a // b, b, a % b
x0, x1 = x1, x0 - q * x1
y0, y1 = y1, y0 - q * y1
return a, x0, y0
def modinv(a, m):
g, x, y = xgcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m
#最小公倍数
def union_lcm(lists):
if len(lists)==1:
return lists[0]
elif len(lists)>1:
num=lists[0]
for i in range(1,len(lists)):
num=num*lists[i]//math.gcd(num,lists[i])
return num
#最大公約数
def union_gcd(lists):
if len(lists)==1:
return lists[0]
elif len(lists)>1:
num=lists[0]
for i in range(1,len(lists)):
num=math.gcd(num,lists[i])
return num
mod=10**9+7
n=int(input())
lists=list(map(int,input().split()))
a=union_gcd(lists)
c=0
a=a%mod
for i in range(n):
c+=a*modinv(lists[i],mod)
c=c%mod
print(c)
|
import math
def xgcd(a, b):
x0, y0, x1, y1 = 1, 0, 0, 1
while b != 0:
q, a, b = a // b, b, a % b
x0, x1 = x1, x0 - q * x1
y0, y1 = y1, y0 - q * y1
return a, x0, y0
def modinv(a, m):
g, x, y = xgcd(a, m)
if g != 1:
raise Exception('modular inverse does not exist')
else:
return x % m
#最小公倍数
def union_lcm(lists):
if len(lists)==1:
return lists[0]
elif len(lists)>1:
num=lists[0]
for i in range(1,len(lists)):
num=num*lists[i]//math.gcd(num,lists[i])
return num
#最大公約数
def union_gcd(lists):
if len(lists)==1:
return lists[0]
elif len(lists)>1:
num=lists[0]
for i in range(1,len(lists)):
num=math.gcd(num,lists[i])
return num
mod=10**9+7
n=int(input())
lists=list(map(int,input().split()))
a=union_lcm(lists)
c=0
a=a%mod
for i in range(n):
c+=a*modinv(lists[i],mod)
c=c%mod
print(c)
|
[
"assignment.value.change",
"identifier.change",
"call.function.change"
] | 599,630
| 599,631
|
u780962115
|
python
|
p02793
|
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
lcm_a = a[0]
for i in range(1, n):
lcm_a = lcm(lcm_a, a[i])
ans = 0
for i in a:
ans += lcm_a // i
print(ans)
|
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
lcm_a = a[0]
for i in range(1, n):
lcm_a = lcm(lcm_a, a[i])
ans = 0
for i in a:
ans += lcm_a // i
print(ans%1000000007)
|
[
"expression.operation.binary.add"
] | 599,636
| 599,637
|
u794652722
|
python
|
p02793
|
import math
from functools import reduce
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // math.gcd(x, y) % mod
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
n = int(input())
a = list(map(int, input().split()))
a_ = []
for i in range(n):
a_.append(pow(a[i], mod - 2, mod))
num_lcm = lcm(*a) % mod
ans = 0
for i in range(n):
ans = (ans + num_lcm * a_[i] % mod) % mod
print(ans)
|
import math
from functools import reduce
mod = 10**9 + 7
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
n = int(input())
a = list(map(int, input().split()))
a_ = []
for i in range(n):
a_.append(pow(a[i], mod - 2, mod))
num_lcm = lcm(*a) % mod
ans = 0
for i in range(n):
ans = (ans + num_lcm * a_[i]) % mod
print(ans)
|
[
"expression.operation.binary.remove"
] | 599,638
| 599,639
|
u287132915
|
python
|
p02793
|
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)
n=int(input())
l=list(map(int,input().split()))
a=lcm_list(l)
ans_l = []
for i in l:
ans_l.append(a/i)
print(int(sum(ans_l)%(10**9+7)))
|
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)
n=int(input())
l=list(map(int,input().split()))
a=lcm_list(l)
ans_l = []
for i in l:
ans_l.append(a//i)
print(int(sum(ans_l)%(10**9+7)))
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 599,642
| 599,643
|
u007018214
|
python
|
p02793
|
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)
n=int(input())
l=list(map(int,input().split()))
a=lcm_list(l)
ans_l = []
for i in l:
ans_l.append(a/i)
print(int(sum(ans_l)%(10**9+7)))
|
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)
n=int(input())
l=list(map(int,input().split()))
a=lcm_list(l)
ans_l = []
for i in l:
ans_l.append(a//i)
print(int(sum(ans_l)%(10**9+7)))
|
[
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change",
"expression.operator.arithmetic.change",
"call.arguments.change"
] | 599,644
| 599,643
|
u007018214
|
python
|
p02793
|
import sys
from collections import Counter
read = sys.stdin.read
def gcd(a, b):
while b:
a, b = b, a % b
return a
def sieve_of_eratosthenes(n):
sieve = [True] * n
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i]:
sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
return [2] + [i for i in range(3, n, 2) if sieve[i]]
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
N, *A = map(int, read().split())
mod = 10 ** 9 + 7
primes = sieve_of_eratosthenes(max(A))
dic = {i: 0 for i in primes}
n = len(primes)
p = [0] * n
for i in A:
tmp = Counter(prime_factorize(i))
for key, value in tmp.items():
#print(key, value)
if dic[key] < value:
dic[key] = value
lcm = 1
for i, j in dic.items():
if j == 0:
continue
lcm *= pow(i, j, mod)
lcm %= mod
answer = 0
for i in A:
answer += lcm * pow(i, mod - 2, mod)
answer %= mod
print(answer)
|
import sys
from collections import Counter
read = sys.stdin.read
def gcd(a, b):
while b:
a, b = b, a % b
return a
def sieve_of_eratosthenes(n):
sieve = [True] * n
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i]:
sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
return [2] + [i for i in range(3, n, 2) if sieve[i]]
def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
N, *A = map(int, read().split())
mod = 10 ** 9 + 7
primes = sieve_of_eratosthenes(max(A) + 1)
dic = {i: 0 for i in primes}
n = len(primes)
p = [0] * n
for i in A:
tmp = Counter(prime_factorize(i))
for key, value in tmp.items():
#print(key, value)
if dic[key] < value:
dic[key] = value
lcm = 1
for i, j in dic.items():
if j == 0:
continue
lcm *= pow(i, j, mod)
lcm %= mod
answer = 0
for i in A:
answer += lcm * pow(i, mod - 2, mod)
answer %= mod
print(answer)
|
[
"assignment.change"
] | 599,645
| 599,646
|
u945181840
|
python
|
p02793
|
P=1000000007
def power(x,p):
if(p==0):
return 1;
if(p%2):
return power(x,p-1)*x%P;
a=power(x,p//2);
return a*a%P;
def inv(x):
return power(x,P-2);
N=int(input());A=list(map(int,input().split()));
#N=10000;A=[1000000 for i in range(N)];
L=[0 for i in range(max(A)+1)]
for a in A:
t=a;i=2;
while(i**2<=a):
c=0;
while(t%i==0):
t/=i;c+=1;
L[i]=max(L[i],c)
i+=1;
if(t!=1):
L[t]=max(L[t],1)
l=1;
for i in range(2,len(L)):
l=l*power(i,L[i])%P;
b=0;
for a in A:
b=(b+inv(a))%P
print(l*b%P)
|
P=1000000007
def power(x,p):
if(p==0):
return 1;
if(p%2):
return power(x,p-1)*x%P;
a=power(x,p//2);
return a*a%P;
def inv(x):
return power(x,P-2);
N=int(input());A=list(map(int,input().split()));
#N=10000;A=[1000000 for i in range(N)];
L=[0 for i in range(max(A)+1)]
for a in A:
t=a;i=2;
while(i**2<=a):
c=0;
while(t%i==0):
t//=i;c+=1;
L[i]=max(L[i],c)
i+=1;
if(t!=1):
L[t]=max(L[t],1)
l=1;
for i in range(2,len(L)):
l=l*power(i,L[i])%P;
b=0;
for a in A:
b=(b+inv(a))%P
print(l*b%P)
|
[
"expression.operator.change"
] | 599,651
| 599,652
|
u236193715
|
python
|
p02793
|
from math import gcd
P = 10**9 + 7
n = int(input())
def lcm(p,q):
return p*q//gcd(p,q)
a = list(map(int, input().split()))
x = a[0]
for i in range(1,n):
x = lcm(x,a[i])
ans = 0
for i in range(n):
ans += x//a[i]
if i%5==0:
ans = ans%P
print(ans)
|
from math import gcd
P = 10**9 + 7
n = int(input())
def lcm(p,q):
return p*q//gcd(p,q)
a = list(map(int, input().split()))
x = a[0]
for i in range(1,n):
x = lcm(x,a[i])
ans = 0
for i in range(n):
ans += x//a[i]
if i%10==0:
ans = ans%P
print(ans%P)
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 599,671
| 599,672
|
u117348081
|
python
|
p02793
|
def main():
import math
n = int(input())
array = list(map(int, input().split()))
lcm = array[0]
for i in range(1, n):
lcm = lcm * array[i] // math.gcd(lcm, array[i])
total = 0
for i,num in enumerate(array):
total += lcm / num
print(int(total%(10**9+7)))
if __name__ == '__main__':
main()
|
def main():
import math
n = int(input())
array = list(map(int, input().split()))
lcm = array[0]
for i in range(1, n):
lcm = lcm * array[i] // math.gcd(lcm, array[i])
total = 0
for i,num in enumerate(array):
total += lcm // num
print(int(total%(10**9+7)))
if __name__ == '__main__':
main()
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 599,690
| 599,691
|
u324197506
|
python
|
p02793
|
import collections
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
def sieve(n):
is_prime = [True for _ in range(n+1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if is_prime[i]:
for j in range(i*2, n+1, i):
is_prime[j] = False
return [i for i in range(n+1) if is_prime[i]]
primes = sieve(10**3)
def primeFactorization(n):
ans = []
temp = n
for p in primes:
while temp%p == 0:
ans.append(p)
temp /= p
if temp > 1:
ans.append(temp)
return collections.Counter(ans)
AFactorized = list(map(primeFactorization, A))
lcm = collections.Counter()
for a in AFactorized:
for p, n in a.items():
lcm[p] = max(lcm[p], n)
lcm_val = 1
for p, n in lcm.items():
lcm_val *= pow(p, n, mod)
ans = 0
for a in A:
ans += lcm_val * pow(a, mod-2, mod)
ans %= mod
print(ans)
|
import collections
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
def sieve(n):
is_prime = [True for _ in range(n+1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5)+1):
if is_prime[i]:
for j in range(i*2, n+1, i):
is_prime[j] = False
return [i for i in range(n+1) if is_prime[i]]
primes = sieve(10**3)
def primeFactorization(n):
ans = []
temp = n
for p in primes:
while temp%p == 0:
ans.append(p)
temp //= p
if temp > 1:
ans.append(temp)
return collections.Counter(ans)
AFactorized = list(map(primeFactorization, A))
lcm = collections.Counter()
for a in AFactorized:
for p, n in a.items():
lcm[p] = max(lcm[p], n)
lcm_val = 1
for p, n in lcm.items():
lcm_val *= pow(p, n, mod)
ans = 0
for a in A:
ans += lcm_val * pow(a, mod-2, mod)
ans %= mod
print(ans)
|
[
"expression.operator.change"
] | 599,694
| 599,695
|
u648881683
|
python
|
p02793
|
import sys
import math
sys.setrecursionlimit(100000)
def lcm(x,y):
return x/math.gcd(x,y)*y
n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
LCM = lcm(LCM,i)
ans=0
for i in a:
ans += LCM/i
print(int(ans)%1000000007)
|
import sys
import math
sys.setrecursionlimit(100000)
def lcm(x,y):
return x//math.gcd(x,y)*y
n = int(input())
a = list(map(int,input().split()))
LCM=a[0]
for i in a:
LCM = lcm(LCM,i)
ans=0
for i in a:
ans += LCM//i
print(int(ans)%1000000007)
|
[
"expression.operator.arithmetic.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 599,705
| 599,706
|
u679951803
|
python
|
p02793
|
from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9+7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.max_map = defaultdict(int)
self.sieve()
def rep_sqr(self, base, k):
# 繰り返し二乗法
if k == 0:
return 1
elif k % 2 == 0:
return (self.rep_sqr(base, k / 2) ** 2) % self.p
else:
return (self.rep_sqr(base, k - 1) * base) % self.p
def sieve(self):
"""
エラトステネスの篩 O(n)
nまでに含まれる素数を導出
"""
self.prime[0], self.prime[1] = 1, 1
for i in range(2, self.max_num):
if self.prime[i] == 0:
for j in range(i * 2, self.max_num, i):
if self.prime[j] == 0:
self.prime[j] = i
self.prime[i] = i
def lcm_list_mod(self, arr):
"""
listのそれぞれの要素について、素因数分解する
それぞれの因数について最大であれば更新する
"""
for i in range(len(arr)):
num = arr[i]
d = defaultdict(int)
while num > 1:
fact = self.prime[num]
d[fact] += 1
num //= fact
for i in d.keys():
self.max_map[i] = max(self.max_map[i], d[i])
ans = 1
for i in self.max_map.keys():
ans = (ans * self.rep_sqr(i, self.max_map[i])) % self.p
return ans
class FLT:
def __init__(self, mod=10**9+7):
self.mod = mod
def rep_sqr(self, base, k):
if k == 0:
return 1
elif k % 2 == 0:
return (self.rep_sqr(base, k // 2) ** 2) % self.mod
else:
return (self.rep_sqr(base, k - 1) * base) % self.mod
def inv(self, a):
""" 逆元を取る """
return self.rep_sqr(a, self.mod-2)
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
lcm_mod = LCM_mod(max(a), MOD)
lcm_all = lcm_mod.lcm_list_mod(a)
flt = FLT(MOD)
b = list(map(lambda x: lcm_all * flt.inv(x, MOD), a))
ans = 0
for i in range(len(b)):
ans += b[i]
ans %= MOD
print(ans)
|
from collections import defaultdict
class LCM_mod:
"""
最小公倍数の計算を行う
オーバーフローが発生しないように素因数分解し,
因数の積を逐次余りに置き換えて最小公倍数を導出する.
"""
def __init__(self, max_num, p=10**9+7):
self.max_num = max_num + 1
self.p = p
self.prime = [0 for _ in range(self.max_num)]
self.max_map = defaultdict(int)
self.sieve()
def rep_sqr(self, base, k):
# 繰り返し二乗法
if k == 0:
return 1
elif k % 2 == 0:
return (self.rep_sqr(base, k / 2) ** 2) % self.p
else:
return (self.rep_sqr(base, k - 1) * base) % self.p
def sieve(self):
"""
エラトステネスの篩 O(n)
nまでに含まれる素数を導出
"""
self.prime[0], self.prime[1] = 1, 1
for i in range(2, self.max_num):
if self.prime[i] == 0:
for j in range(i * 2, self.max_num, i):
if self.prime[j] == 0:
self.prime[j] = i
self.prime[i] = i
def lcm_list_mod(self, arr):
"""
listのそれぞれの要素について、素因数分解する
それぞれの因数について最大であれば更新する
"""
for i in range(len(arr)):
num = arr[i]
d = defaultdict(int)
while num > 1:
fact = self.prime[num]
d[fact] += 1
num //= fact
for i in d.keys():
self.max_map[i] = max(self.max_map[i], d[i])
ans = 1
for i in self.max_map.keys():
ans = (ans * self.rep_sqr(i, self.max_map[i])) % self.p
return ans
class FLT:
def __init__(self, mod=10**9+7):
self.mod = mod
def rep_sqr(self, base, k):
if k == 0:
return 1
elif k % 2 == 0:
return (self.rep_sqr(base, k // 2) ** 2) % self.mod
else:
return (self.rep_sqr(base, k - 1) * base) % self.mod
def inv(self, a):
""" 逆元を取る """
return self.rep_sqr(a, self.mod-2)
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
lcm_mod = LCM_mod(max(a), MOD)
lcm_all = lcm_mod.lcm_list_mod(a)
flt = FLT(MOD)
b = list(map(lambda x: lcm_all * flt.inv(x), a))
ans = 0
for i in range(len(b)):
ans += b[i]
ans %= MOD
print(ans)
|
[
"call.arguments.change"
] | 599,707
| 599,708
|
u652057333
|
python
|
p02793
|
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
N = int(input())
A = list(map(int, input().split()))
lcm_A = 1
for i in range(N):
lcm_A = lcm(lcm_A, A[i])
ans = 0
for i in range(N):
ans += lcm_A // A[i]
mod = 10**9+7
print(ans & mod)
|
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
N = int(input())
A = list(map(int, input().split()))
lcm_A = 1
for i in range(N):
lcm_A = lcm(lcm_A, A[i])
ans = 0
for i in range(N):
ans += lcm_A // A[i]
mod = 10**9+7
print(ans % mod)
|
[
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 599,717
| 599,718
|
u572193732
|
python
|
p02793
|
from functools import reduce
from math import gcd
import numpy as np
MOD = 10**9+7
def lcm_base(x, y):
return x * (y // gcd(x, y))
def main():
N = int(input())
a = [int(i) for i in input().split()]
A = np.array(a)
lcm = reduce(lcm_base, A, 1)
B = lcm // A
print(np.sum(B) % MOD)
if __name__ == "__main__":
main()
|
from functools import reduce
from math import gcd
import numpy as np
MOD = 10**9+7
def lcm_base(x, y):
return x * (y // gcd(x, y))
def main():
N = int(input())
a = [int(i) for i in input().split()]
A = np.array(a)
lcm = reduce(lcm_base, a, 1)
B = lcm // A
print(np.sum(B) % MOD)
if __name__ == "__main__":
main()
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 599,734
| 599,735
|
u638456847
|
python
|
p02793
|
from functools import reduce
from math import gcd
import numpy as np
MOD = 10**9+7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def main():
N = int(input())
a = [int(i) for i in input().split()]
A = np.array(a)
lcm = reduce(lcm_base, A, 1)
B = lcm // A
print(np.sum(B) % MOD)
if __name__ == "__main__":
main()
|
from functools import reduce
from math import gcd
import numpy as np
MOD = 10**9+7
def lcm_base(x, y):
return x * (y // gcd(x, y))
def main():
N = int(input())
a = [int(i) for i in input().split()]
A = np.array(a)
lcm = reduce(lcm_base, a, 1)
B = lcm // A
print(np.sum(B) % MOD)
if __name__ == "__main__":
main()
|
[
"function.return_value.change",
"call.arguments.change",
"assignment.value.change",
"identifier.change"
] | 599,736
| 599,735
|
u638456847
|
python
|
p02793
|
n = int(input())
arr = list(map(int,input().split()))
N = pow(10,9)+7
def gcd(a,b):
if a==0:return b
return gcd(b%a,a)
def lcm(a,b):
tmp = (a*b)//gcd(a,b)
return tmp
hcm = arr[0]
for i in range(1,n):
hcm = lcm(hcm,arr[i])
res = 0
for num in arr:
res += (hcm//num)
print(res)
|
n = int(input())
arr = list(map(int,input().split()))
N = pow(10,9)+7
def gcd(a,b):
if a==0:return b
return gcd(b%a,a)
def lcm(a,b):
tmp = (a*b)//gcd(a,b)
return tmp
hcm = arr[0]
for i in range(1,n):
hcm = lcm(hcm,arr[i])
res = 0
for num in arr:
res += (hcm//num)
print(res%N)
|
[
"expression.operation.binary.add"
] | 599,742
| 599,743
|
u424241608
|
python
|
p02793
|
import functools
MOD = 10**9 + 7
def lcm(a, b):
c, d = a, b
while d != 0:
c, d = d, c % d
return a / c * b
def inv_mod(x):
return pow(x, MOD - 2)
def pow(x: int, n: int) -> int:
res = 1
while n > 0:
if n & 1 == 1:
res = res * x % MOD
x = x * x % MOD
n >>= 1
return res
def main():
N = int(input())
an = list(map(int, input().split()))
lcm_an = functools.reduce(lcm, an)
lcm_an %= MOD
ans = 0
for a in an:
ans = (ans + lcm_an * inv_mod(a)) % MOD
print(ans)
if __name__ == '__main__':
main()
|
import functools
MOD = 10**9 + 7
def lcm(a, b) -> int:
c, d = a, b
while d != 0:
c, d = d, c % d
return a // c * b
def inv_mod(x):
return pow(x, MOD - 2)
def pow(x: int, n: int) -> int:
res = 1
while n > 0:
if n & 1 == 1:
res = res * x % MOD
x = x * x % MOD
n >>= 1
return res
def main():
N = int(input())
an = list(map(int, input().split()))
lcm_an = functools.reduce(lcm, an)
lcm_an %= MOD
ans = 0
for a in an:
ans = (ans + lcm_an * inv_mod(a)) % MOD
print(ans)
if __name__ == '__main__':
main()
|
[
"expression.operator.arithmetic.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 599,746
| 599,747
|
u574189773
|
python
|
p02793
|
def gcd(x, y):
while y > 0:
tmp = x % y
x = y
y = tmp
return x
def lcm(x, y):
if x == 0 or y == 0:
return 0
else:
return x / gcd(x, y) * y
def main():
mod = int(1e9 + 7)
n = int(input())
a = list(map(int, input().split()))
l = 1
for i in range(n):
l = lcm(l, a[i])
ans = 0
for i in range(n):
ans += l // a[i]
ans %= mod
print(int(ans))
if __name__ == '__main__':
main()
|
def gcd(x, y):
while y > 0:
tmp = x % y
x = y
y = tmp
return x
def lcm(x, y):
if x == 0 or y == 0:
return 0
else:
return x // gcd(x, y) * y
def main():
mod = int(1e9 + 7)
n = int(input())
a = list(map(int, input().split()))
l = 1
for i in range(n):
l = lcm(l, a[i])
ans = 0
for i in range(n):
ans += l // a[i]
ans %= mod
print(int(ans))
if __name__ == '__main__':
main()
|
[
"expression.operator.arithmetic.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 599,751
| 599,752
|
u095266283
|
python
|
p02793
|
import fractions
import functools
MOD = int(1e9) + 7
def lcm(a, b):
c, d = a, b
while d != 0:
c, d = d, c % d
return a // c * b
class Inv:
@classmethod
def pow(cls, x: int, n: int) -> int:
ret = 1
while n > 0:
if n % 2 == 1:
ret = ret * x % MOD
x = x * x % MOD
n >>= 1
return ret
@classmethod
def inv(cls, x: int) -> int:
return cls.pow(x, MOD - 2)
N = int(input())
A = list(map(int, input().split()))
v = functools.reduce(lcm, A)
v %= MOD
ans = 0
for a in A:
ans = (ans + v // a) % MOD
print(ans)
|
import fractions
import functools
MOD = int(1e9) + 7
def lcm(a, b):
c, d = a, b
while d != 0:
c, d = d, c % d
return a // c * b
class Inv:
@classmethod
def pow(cls, x: int, n: int) -> int:
ret = 1
while n > 0:
if n % 2 == 1:
ret = ret * x % MOD
x = x * x % MOD
n >>= 1
return ret
@classmethod
def inv(cls, x: int) -> int:
return cls.pow(x, MOD - 2)
N = int(input())
A = list(map(int, input().split()))
v = functools.reduce(lcm, A)
v %= MOD
ans = 0
for a in A:
ans = (ans + v * Inv.inv(a)) % MOD
print(ans)
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.add",
"call.arguments.change"
] | 599,753
| 599,754
|
u726872801
|
python
|
p02795
|
n, h, w = [int(input()) for i in range(3)]
k = max(h, w)
ans = (n+k-1)//k
print(ans)
|
h, w, n= [int(input()) for i in range(3)]
k = max(h, w)
ans = (n+k-1)//k
print(ans)
|
[] | 599,897
| 599,898
|
u595952233
|
python
|
p02795
|
a = int(input())
b = int(input())
n = int(input())
t = max(a, b)
print(n + t - 1 / t)
|
a = int(input())
b = int(input())
n = int(input())
t = max(a, b)
print((n + t - 1) // t)
|
[
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 599,899
| 599,900
|
u468972478
|
python
|
p02795
|
a = int(input())
b = int(input())
n = int(input())
t = max(a, b)
print(n + t - 1 // t)
|
a = int(input())
b = int(input())
n = int(input())
t = max(a, b)
print((n + t - 1) // t)
|
[
"call.arguments.change"
] | 599,901
| 599,900
|
u468972478
|
python
|
p02795
|
x=int(input())
y=int(input())
z=max(x,y)
print(int(input())//z)
|
x=int(input())
y=int(input())
z=max(x,y)
print(-int(input())//z*-1)
|
[
"expression.operation.unary.add",
"call.arguments.change"
] | 599,912
| 599,913
|
u130900604
|
python
|
p02795
|
h=int(input())
w=int(input())
m=max(h,w)
x=int(input())
print(x//m)
|
h=int(input())
w=int(input())
m=max(h,w)
x=int(input())
print((x+m-1)//m)
|
[
"call.arguments.change"
] | 599,914
| 599,915
|
u130900604
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
cnt = 0
ans = 0
max_num = 0
while ans < n:
if h < w:
ans += w
w -= 1
else:
ans += h
w -= 1
cnt += 1
print(cnt)
|
h = int(input())
w = int(input())
n = int(input())
cnt = 0
ans = 0
while ans < n:
if h < w:
ans += w
h -= 1
else:
ans += h
w -= 1
cnt += 1
print(cnt)
|
[
"identifier.change"
] | 599,951
| 599,950
|
u143051858
|
python
|
p02794
|
from collections import defaultdict
from heapq import heappop, heappush
class Graph(object):
def __init__(self):
self.graph = defaultdict(list)
def __len__(self):
return len(self.graph)
def add_edge(self, From, To, cost=1):
self.graph[From].append((To,cost))
def get_nodes(self):
return self.graph.keys()
class Dijkstra(object):
def __init__(self, graph, start):
self.g = graph.graph
self.dist = defaultdict(lambda:float('inf'))
self.dist[start] = 0
self.prev = defaultdict(lambda: None)
self.Q = []
heappush(self.Q,(self.dist[start], start))
while self.Q:
dist_u, u = heappop(self.Q)
if self.dist[u] < dist_u:
continue
for v, cost in self.g[u]:
alt = dist_u + cost
if self.dist[v] > alt:
self.dist[v] = alt
self.prev[v] = u
heappush(self.Q,(alt, v))
def shortest_distance(self, goal):
return self.dist[goal]
def shortest_path(self, goal):
path = []
node = goal
while node is not None:
path.append(node)
node = self.prev[node]
return path[::-1]
N = int(input())
g = Graph()
d = {}
for i in range(N-1):
a,b = map(int,input().split())
a -= 1
b -= 1
d[(min(a,b),max(a,b))] = i
g.add_edge(a,b)
g.add_edge(b,a)
M = int(input())
l = [0]*M
for i in range(M):
u,v = map(int,input().split())
u -= 1
v -= 1
dij = Dijkstra(g,u)
path = dij.shortest_path(v)
for j in range(len(path)-1):
a,b = path[j],path[j+1]
l[i] += 2**d[(min(a,b),max(a,b))]
c = [0]*(M+1)
p2 = [2**i for i in range(N)]
for n in range(2**M):
cnt = 0
x = 0
for i in range(M):
if n&2**p2[i]==p2[i]:
cnt += 1
x |= l[i]
y = 0
for i in range(N-1):
if x&p2[i]==p2[i]:
y += 1
c[cnt] += p2[N-1-y]
ans = 0
for i in range(M+1):
if i%2==0:
ans += c[i]
else:
ans -= c[i]
print(ans)
|
from collections import defaultdict
from heapq import heappop, heappush
class Graph(object):
def __init__(self):
self.graph = defaultdict(list)
def __len__(self):
return len(self.graph)
def add_edge(self, From, To, cost=1):
self.graph[From].append((To,cost))
def get_nodes(self):
return self.graph.keys()
class Dijkstra(object):
def __init__(self, graph, start):
self.g = graph.graph
self.dist = defaultdict(lambda:float('inf'))
self.dist[start] = 0
self.prev = defaultdict(lambda: None)
self.Q = []
heappush(self.Q,(self.dist[start], start))
while self.Q:
dist_u, u = heappop(self.Q)
if self.dist[u] < dist_u:
continue
for v, cost in self.g[u]:
alt = dist_u + cost
if self.dist[v] > alt:
self.dist[v] = alt
self.prev[v] = u
heappush(self.Q,(alt, v))
def shortest_distance(self, goal):
return self.dist[goal]
def shortest_path(self, goal):
path = []
node = goal
while node is not None:
path.append(node)
node = self.prev[node]
return path[::-1]
N = int(input())
g = Graph()
d = {}
for i in range(N-1):
a,b = map(int,input().split())
a -= 1
b -= 1
d[(min(a,b),max(a,b))] = i
g.add_edge(a,b)
g.add_edge(b,a)
M = int(input())
l = [0]*M
for i in range(M):
u,v = map(int,input().split())
u -= 1
v -= 1
dij = Dijkstra(g,u)
path = dij.shortest_path(v)
for j in range(len(path)-1):
a,b = path[j],path[j+1]
l[i] += 2**d[(min(a,b),max(a,b))]
c = [0]*(M+1)
p2 = [2**i for i in range(50)]
for n in range(2**M):
cnt = 0
x = 0
for i in range(M):
if n&p2[i]==p2[i]:
cnt += 1
x |= l[i]
y = 0
for i in range(N-1):
if x&p2[i]==p2[i]:
y += 1
c[cnt] += p2[N-1-y]
ans = 0
for i in range(M+1):
if i%2==0:
ans += c[i]
else:
ans -= c[i]
print(ans)
|
[
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 600,145
| 600,144
|
u170201762
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
print((N+max(H,W)-1)/max(H,W))
|
H = int(input())
W = int(input())
N = int(input())
print(int((N+max(H,W)-1)/max(H,W)))
|
[
"call.arguments.add",
"call.arguments.change"
] | 600,216
| 600,217
|
u796708718
|
python
|
p02795
|
import math
h = int(input())
w = int(input())
n = int(input())
h = max(h,w)
print(math.ceil(h/n))
|
import math
h = int(input())
w = int(input())
n = int(input())
h = max(h,w)
print(math.ceil(n/h))
|
[
"expression.operation.binary.remove"
] | 600,222
| 600,223
|
u101442050
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
k = max(h, w)
print((n - k + 1) // k)
|
h = int(input())
w = int(input())
n = int(input())
k = max(h, w)
print((n + k - 1) // k)
|
[
"expression.operation.binary.remove"
] | 600,226
| 600,227
|
u917872021
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
ans = 0
sum = 0
while(sum < n):
if h >= w :
sum += h
ans += 1
w -= 1
else :
sum += w
asn += 1
h -= 1
print(ans)
|
h = int(input())
w = int(input())
n = int(input())
ans = 0
sum = 0
while(sum < n):
if h >= w :
sum += h
ans += 1
w -= 1
else :
sum += w
ans += 1
h -= 1
print(ans)
|
[
"identifier.change"
] | 600,246
| 600,247
|
u242293911
|
python
|
p02795
|
import sys
H = int(sys.stdin.readline())
W = int(sys.stdin.readline())
N = int(sys.stdin.readline())
print((N - 1) / max(H, W) + 1)
|
import sys
H = int(sys.stdin.readline())
W = int(sys.stdin.readline())
N = int(sys.stdin.readline())
print((N - 1) // max(H, W) + 1)
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 600,254
| 600,255
|
u899782392
|
python
|
p02795
|
import math
h = int(input())
w = int(input())
n = int(input())
print(math.floor(n / max(h, w)) + 1)
|
import math
h = int(input())
w = int(input())
n = int(input())
print(math.ceil(n / max(h, w)))
|
[
"misc.opposites",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"expression.operation.binary.remove"
] | 600,261
| 600,262
|
u250100102
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N//H != 0:print(N//H + 1)
else: print(N//H)
else:
if N//W != 0:print(N//W + 1)
else: print(N//W)
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N%H != 0:print(N//H + 1)
else: print(N//H)
else:
if N%W != 0:print(N//W + 1)
else: print(N//W)
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 600,270
| 600,271
|
u181195295
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N//H != 0:print(N//H + 1)
else: print(N//H)
else:
if N//H != 0:print(N//W + 1)
else: print(N//W)
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N%H != 0:print(N//H + 1)
else: print(N//H)
else:
if N%W != 0:print(N//W + 1)
else: print(N//W)
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 600,272
| 600,271
|
u181195295
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if H%2 != 0:print(N//H + 1)
else: print(N//H)
else:
if W%2 != 0:print(N//W + 1)
else: print(N//W)
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N%H != 0:print(N//H + 1)
else: print(N//H)
else:
if N%W != 0:print(N//W + 1)
else: print(N//W)
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"identifier.replace.add",
"literal.replace.remove"
] | 600,273
| 600,271
|
u181195295
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
print((N // max(H, W) + 1) if N % max(H, W) == 0 else (N // max(H, W)))
|
H = int(input())
W = int(input())
N = int(input())
print((N // max(H, W)) if N % max(H, W) == 0 else (N // max(H, W) + 1))
|
[
"expression.operation.binary.remove"
] | 600,283
| 600,284
|
u536600145
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
cnt = 0
while paint >= N:
paint += max(H,W)
cnt += 1
print(cnt)
|
H = int(input())
W = int(input())
N = int(input())
cnt, paint = 0, 0
while paint < N:
paint += max(H,W)
cnt += 1
print(cnt)
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 600,285
| 600,286
|
u536600145
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
if n // max(h,w) == 0:
print(n // max(h,w))
else:
print(n // max(h,w) + 1)
|
h = int(input())
w = int(input())
n = int(input())
if n % max(h,w) == 0:
print(n // max(h,w))
else:
print(n // max(h,w) + 1)
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 600,291
| 600,292
|
u068142202
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
h = max(h, w)
print(n // h)
|
h = int(input())
w = int(input())
n = int(input())
h = max(h, w)
print((n -1) // h + 1)
|
[
"call.arguments.change"
] | 600,298
| 600,299
|
u333183691
|
python
|
p02795
|
H=int(input())
W=int(input())
N=int(input())
k=max(H, W)
cnt=0
while k*cnt<=N:
cnt+=1
print(cnt)
|
H=int(input())
W=int(input())
N=int(input())
k=max(H, W)
cnt=0
while k*cnt<N:
cnt+=1
print(cnt)
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 600,302
| 600,303
|
u337626942
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
answer = 0
if H >= W:
answer = N // H
if N % H != 0:
answer += 1
else:
answer = N // W
if N % H != 0:
answer += 1
print(answer)
|
H = int(input())
W = int(input())
N = int(input())
answer = 0
if H >= W:
answer = N // H
if N % H != 0:
answer += 1
else:
answer = N // W
if N % W != 0:
answer += 1
print(answer)
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 600,312
| 600,313
|
u617718239
|
python
|
p02795
|
h=int(input())
w=int(input())
n=int(input())
ans=0
x=max(h,w)
while n>0:
ans+=1
n=n-ans*x
print(ans)
|
#1
h=int(input())
w=int(input())
n=int(input())
ans=0
x=max(h,w)
while n>0:
ans+=1
n=n-x
print(ans)
|
[
"expression.operation.binary.remove"
] | 600,339
| 600,340
|
u723583932
|
python
|
p02795
|
a = int(input())
b = int(input())
c = int(input())
d = max(a,b)
e = c // d
f = c % d
if d == 0:
print(e)
elif d != 0:
print(int(e) + int(1))
|
a = int(input())
b = int(input())
c = int(input())
d = max(a,b)
e = c // d
mod = c % d
if mod == 0:
print(e)
elif mod != 0:
print(int(e) + int(1))
|
[
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 600,360
| 600,361
|
u529500825
|
python
|
p02795
|
import math
H = int(input())
W = int(input())
N = int(input())
if(H >= W):
print(math.ceil(N // H))
else:
print(math.ceil(N // W))
|
import math
H = int(input())
W = int(input())
N = int(input())
if(H >= W):
print(math.ceil(N / H))
else:
print(math.ceil(N / W))
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 600,366
| 600,367
|
u841924362
|
python
|
p02793
|
#!/usr/bin/python3
# -*- coding:utf-8 -*-
def calc_gcd(a, b):
if a > b:
a, b = b, a
while True:
a, b = b%a, a
if a == 0:
return b
def calc_lcm(a, b):
gcd = calc_gcd(a, b)
return int(a * b / gcd)
def main():
n = int(input())
As = list(map(int, input().strip().split()))
lcm = As[0]
total = 0
for a in As[1:]:
lcm = calc_lcm(lcm, a)
for a in As:
total += lcm / a
print(int(total) % (10**9+7))
if __name__=='__main__':
main()
|
#!/usr/bin/python3
# -*- coding:utf-8 -*-
def calc_gcd(a, b):
if a > b:
a, b = b, a
while True:
a, b = b%a, a
if a == 0:
return b
def calc_lcm(a, b):
gcd = calc_gcd(a, b)
return int(a * b // gcd)
def main():
n = int(input())
As = list(map(int, input().strip().split()))
lcm = As[0]
total = 0
for a in As[1:]:
lcm = calc_lcm(lcm, a)
for a in As:
total += lcm // a
print(total % (10**9+7))
if __name__=='__main__':
main()
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change",
"call.remove"
] | 600,402
| 600,403
|
u210440747
|
python
|
p02793
|
def e_flatten_prime_factorization(MOD=10**9 + 7):
N = int(input())
A = [int(i) for i in input().split()]
def prime_factorization_dict(n):
from collections import defaultdict
"""nを素因数分解したときの素数とその指数の辞書"""
if n == 1:
return {2: 0} # 1は素数の0乗の積とみなす
i, table = 2, defaultdict(int)
while i**2 <= n:
while n % i == 0:
table[i] += 1
n //= i
i += 1
if n > 1:
table[n] = 1
return table
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
continue
for k in range(j * 2, n + 1, j):
is_prime[k] = False # jの倍数は素数でない
return {i: 0 for i in range(n + 1) if is_prime[i]}
lcm_prime = prime_table(1000)
for a in A:
for base, exp in prime_factorization_dict(a).items():
lcm_prime[base] = max(lcm_prime[base], exp)
lcm = 1
for base, exp in lcm_prime.items():
lcm *= pow(base, exp, MOD)
lcm %= MOD
coefficient = sum(pow(a, MOD - 2, MOD) for a in A)
return (lcm * coefficient) % MOD
print(e_flatten_prime_factorization())
|
def e_flatten_prime_factorization(MOD=10**9 + 7):
N = int(input())
A = [int(i) for i in input().split()]
def prime_factorization_dict(n):
from collections import defaultdict
"""nを素因数分解したときの素数とその指数の辞書"""
if n == 1:
return {2: 0} # 1は素数の0乗の積とみなす
i, table = 2, defaultdict(int)
while i**2 <= n:
while n % i == 0:
table[i] += 1
n //= i
i += 1
if n > 1:
table[n] = 1
return table
def prime_table(n):
"""n以下の素数のリスト(エラトステネスの篩)"""
is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False # 0と1は素数でない
for j in range(2, int(n**0.5) + 1):
if not is_prime[j]:
continue
for k in range(j * 2, n + 1, j):
is_prime[k] = False # jの倍数は素数でない
return {i: 0 for i in range(n + 1) if is_prime[i]}
lcm_prime = prime_table(10**6)
for a in A:
for base, exp in prime_factorization_dict(a).items():
lcm_prime[base] = max(lcm_prime[base], exp)
lcm = 1
for base, exp in lcm_prime.items():
lcm *= pow(base, exp, MOD)
lcm %= MOD
coefficient = sum(pow(a, MOD - 2, MOD) for a in A)
return (lcm * coefficient) % MOD
print(e_flatten_prime_factorization())
|
[
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change"
] | 600,413
| 600,414
|
u952708174
|
python
|
p02793
|
from collections import *
import sys
input = sys.stdin.readline
#n以下の素数列挙(O(n log(n))
def primes(n):
ass = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
for i in range(len(is_prime)):
if is_prime[i]:
ass.append(i)
return ass
mod = 10**9+7
n = int(input())
a = tuple(map(int,input().split()))
pr = primes(10**6+1)
d = defaultdict(lambda : 0)
for elt in a:
for p in pr:
if elt < p:
break
c = 0
while not elt%p:
c += 1
elt //= p
if c > d[p]:
d[p] = c
if elt > 1 and d[elt] == 0:
d[elt] = 1
print(d)
lcm = 1
for elt in d:
lcm = lcm*pow(elt,d[elt],mod)%mod
res = 0
for e in a:
res = (res + pow(e,mod-2,mod))%mod
print(res*lcm%mod)
|
from collections import *
import sys
input = sys.stdin.readline
#n以下の素数列挙(O(n log(n))
def primes(n):
ass = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
for i in range(len(is_prime)):
if is_prime[i]:
ass.append(i)
return ass
mod = 10**9+7
n = int(input())
a = tuple(map(int,input().split()))
pr = primes(10**3+1)
d = defaultdict(lambda : 0)
for elt in a:
for p in pr:
if elt < p:
break
c = 0
while not elt%p:
c += 1
elt //= p
if c > d[p]:
d[p] = c
if elt > 1 and d[elt] == 0:
d[elt] = 1
lcm = 1
for elt in d:
lcm = lcm*pow(elt,d[elt],mod)%mod
res = 0
for e in a:
res = (res + pow(e,mod-2,mod))%mod
print(res*lcm%mod)
|
[
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change",
"call.remove"
] | 600,422
| 600,421
|
u284854859
|
python
|
p02793
|
from math import gcd
from functools import reduce
lcm=lambda x,y:x//gcd(x,y)*y
MOD=10**9+7
n=int(input())
A=list(map(int,input().split()))
c=sum(pow(a,MOD-2,MOD) for a in A)//MOD
l=reduce(lcm,A)//MOD
print(c*l//MOD)
|
from math import gcd
from functools import reduce
lcm=lambda x,y:x//gcd(x,y)*y
MOD=10**9+7
n=int(input())
A=list(map(int,input().split()))
c=sum(pow(a,MOD-2,MOD) for a in A)%MOD
l=reduce(lcm,A)%MOD
print(c*l%MOD)
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change",
"io.output.change"
] | 600,425
| 600,426
|
u440566786
|
python
|
p02793
|
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)
n = int(input())
inp_list = list(map(int,(input().split())))
lcm = lcm_list(inp_list)
ans = 0
for i in inp_list:
ans += lcm // i
print(ans % (10**9+7))
|
from functools import reduce
import math
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
n = int(input())
inp_list = list(map(int,(input().split())))
lcm = lcm_list(inp_list)
ans = 0
for i in inp_list:
ans += lcm // i
print(ans % (10**9+7))
|
[
"identifier.change"
] | 600,460
| 600,461
|
u186206732
|
python
|
p02793
|
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)
n = int(input())
a = list(map(int,input().split()))
c=0
z=lcm_list(a)
for i in range(0,n):
c+=(z//a[i])
print(z)
print(c%((10**9)+7))
|
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)
n = int(input())
a = list(map(int,input().split()))
c=0
z=lcm_list(a)
for i in range(0,n):
c+=(z//a[i])
#print(z)
print(c%((10**9)+7))
|
[
"call.remove"
] | 600,466
| 600,467
|
u866374539
|
python
|
p02793
|
from math import gcd
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
LCM = 1
for i in A:
GCD = gcd(LCM,i)
LCM = LCM*i//GCD
ans = 0
for i in A:
ans += (LCM//i)%mod
print(ans)
|
from math import gcd
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
LCM = 1
for i in A:
GCD = gcd(LCM,i)
LCM = LCM*i//GCD
ans = 0
for i in A:
ans += LCM//i
print(ans%mod)
|
[
"expression.operation.binary.remove"
] | 600,472
| 600,473
|
u540761833
|
python
|
p02793
|
from math import gcd
from functools import reduce
lcm = lambda a, b: b // lcm(a, b) * a
mod = 10 ** 9 + 7
N, *A = map(int, open(0).read().split())
L = reduce(lcm, A) % mod
print(sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod)
|
from math import gcd
from functools import reduce
lcm = lambda a, b: b // gcd(a, b) * a
mod = 10 ** 9 + 7
N, *A = map(int, open(0).read().split())
L = reduce(lcm, A) % mod
print(sum(L * pow(a, mod - 2, mod) for a in A) % mod)
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 600,479
| 600,480
|
u606045429
|
python
|
p02793
|
from math import gcd
from functools import reduce
lcm = lambda a, b: b // lcm(a, b) * a
mod = 10 ** 9 + 7
N, *A = map(int, open(0).read().split())
L = reduce(lcm, A) % mod
print(sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod)
|
from math import gcd
from functools import reduce
lcm = lambda a, b: b // gcd(a, b) * a
mod = 10 ** 9 + 7
N, *A = map(int, open(0).read().split())
L = reduce(lcm, A) % mod
print(sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod)
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"expression.operation.binary.change"
] | 600,479
| 600,481
|
u606045429
|
python
|
p02793
|
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]
n = int(input())
p = list(map(int, input().split()))
if n == 1:
print(1)
exit()
MOD = 10 ** 9 + 7
def gcd(a, b):
while b:
a, b = b, a%b
return a
c = p[0]
for x in p[1:]:
c = c * x // gcd(c, x)
ans = 0
for x in p:
ans += c // x
print(ans)
|
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]
n = int(input())
p = list(map(int, input().split()))
if n == 1:
print(1)
exit()
MOD = 10 ** 9 + 7
def gcd(a, b):
while b:
a, b = b, a%b
return a
c = p[0]
for x in p[1:]:
c = c * x // gcd(c, x)
ans = 0
for x in p:
ans += c // x
print(ans % MOD)
|
[
"expression.operation.binary.add"
] | 600,482
| 600,483
|
u824237520
|
python
|
p02793
|
from math import gcd
import random
n = int(input())
a = list(map(int, input().split( )))
random.shuffle(a)
#最小公倍数でよいか?
#全てのjについてAiBiはAjで割り切れる
#計算時間は?
mod =10**9+7
def lcd(x,y):
g = gcd(x,y)
return x*y//g
ag1 = 1
for i in range(n//2):
ag1 = lcd(ag1,a[i])
ag2 = 1
for i in range(n//2,n):
ag2 = lcd(ag2,a[i])
ag3 = lcd(ag1,ag2)
ans = 0
for i in range(n//2):
ans += ag1//a[i]
ans*=ag3//ag1
ans %=mod
ans2 = 0
for i in range(n//2,n):
ans2 += ag2//a[i]
ans2*= ag3//ag2
ans2%=mod
ans += ans2
print(ans)
|
from math import gcd
import random
n = int(input())
a = list(map(int, input().split( )))
random.shuffle(a)
#最小公倍数でよいか?
#全てのjについてAiBiはAjで割り切れる
#計算時間は?
mod =10**9+7
def lcd(x,y):
g = gcd(x,y)
return x*y//g
ag1 = 1
for i in range(n//2):
ag1 = lcd(ag1,a[i])
ag2 = 1
for i in range(n//2,n):
ag2 = lcd(ag2,a[i])
ag3 = lcd(ag1,ag2)
ans = 0
for i in range(n//2):
ans += ag1//a[i]
ans*=ag3//ag1
ans %=mod
ans2 = 0
for i in range(n//2,n):
ans2 += ag2//a[i]
ans2*= ag3//ag2
ans2%=mod
ans += ans2
ans %=mod
print(ans)
|
[] | 600,500
| 600,501
|
u520276780
|
python
|
p02793
|
def gcd(x, y):
x = x % y
if x == 0:
return y
return gcd(y, x)
def lcm(x, y):
return x // gcd(x, y) * y
n = int(input())
a = list(map(int, input().split(' ')))
l = 1
for ai in a:
l = lcm(l, ai)
print(l)
mod = 1000000007
ans = 0
for ai in a:
ans += l // ai
ans %= mod
print(ans)
|
def gcd(x, y):
x = x % y
if x == 0:
return y
return gcd(y, x)
def lcm(x, y):
return x // gcd(x, y) * y
n = int(input())
a = list(map(int, input().split(' ')))
l = 1
for ai in a:
l = lcm(l, ai)
mod = 1000000007
ans = 0
for ai in a:
ans += l // ai
ans %= mod
print(ans)
|
[
"call.remove"
] | 600,504
| 600,505
|
u500496457
|
python
|
p02793
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand / num
print(int(sum % (10 ** 9 + 7)))
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand // num
print(sum % (10**9 + 7))
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 600,512
| 600,511
|
u293838812
|
python
|
p02793
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand / num
print(int(sum % (10**9 + 7)))
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand // num
print(sum % (10**9 + 7))
|
[
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change",
"expression.operator.arithmetic.change",
"assignment.value.change",
"call.arguments.change"
] | 600,513
| 600,511
|
u293838812
|
python
|
p02793
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand / num
print(int(sum % (10 ** 9 + 7)))
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand // num
print(sum % (10**9 + 7) )
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 600,512
| 600,514
|
u293838812
|
python
|
p02793
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand / num
print(int(sum % (10**9 + 7)))
|
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 = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]
cand = lcm_list(As)
sum = 0
for num in As:
sum = sum + cand // num
print(sum % (10**9 + 7) )
|
[
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change",
"expression.operator.arithmetic.change",
"assignment.value.change",
"call.arguments.change"
] | 600,513
| 600,514
|
u293838812
|
python
|
p02793
|
from math import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
n = int(input())
a = [int(x) for x in input().split()]
sum = 0
G=1
for elem in a:
G=lcm(G,elem)
for elem in a:
sum+=G//elem
print(sum)
|
from math import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
n = int(input())
a = [int(x) for x in input().split()]
sum = 0
G=1
for elem in a:
G=lcm(G,elem)
for elem in a:
sum+=G//elem
print(sum%1000000007)
|
[
"expression.operation.binary.add"
] | 600,521
| 600,522
|
u169212791
|
python
|
p02793
|
#coding:utf-8
from math import gcd
n = int(input())
a = list(map(int, input().split(' ')))
mod = 10 ** 9 + 7
#最小公倍数を取得
g = a[0]
for num in a[1:]:
g = g * num // gcd(num, g)
ans = 0
#計算後なのでmodオッケー
l = g % mod
for num in a:
ans += l * pow(num, nod-2, mod)
ans %= mod
print(ans % mod)
|
#coding:utf-8
from math import gcd
n = int(input())
a = list(map(int, input().split(' ')))
mod = 10 ** 9 + 7
#最小公倍数を取得
g = a[0]
for num in a[1:]:
g = g * num // gcd(num, g)
ans = 0
#計算後なのでmodオッケー
l = g % mod
for num in a:
ans += l * pow(num, mod-2, mod)
ans %= mod
print(ans % mod)
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 600,528
| 600,529
|
u724563664
|
python
|
p02793
|
import math
mod = 1e9 + 7;
N = int(input())
A = list(map(int, input().split()))
l = 1
for i in A:
l = l * i // math.gcd(l, i)
sum = 0
for i in A:
sum += l // i
print(int(sum % mod))
|
import math
mod = 10**9 + 7;
N = int(input())
A = list(map(int, input().split()))
l = 1
for i in A:
l = l * i // math.gcd(l, i)
sum = 0
for i in A:
sum += l // i
print(int(sum % mod))
|
[
"assignment.value.change",
"expression.operation.binary.change"
] | 600,532
| 600,531
|
u788717734
|
python
|
p02795
|
h=int(input())
w=int(input())
n=int(input())
print((n-1)//max(h,w)+2)
|
h=int(input())
w=int(input())
n=int(input())
print((n-1)//max(h,w)+1)
|
[
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 600,541
| 600,542
|
u143612492
|
python
|
p02795
|
h=int(input())
w=int(input())
n=int(input())
print(n//max(h,w)+1)
|
h=int(input())
w=int(input())
n=int(input())
print((n-1)//max(h,w)+1)
|
[
"call.arguments.change"
] | 600,543
| 600,542
|
u143612492
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split())
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,544
| 600,545
|
u644516473
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split())
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,546
| 600,545
|
u644516473
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split())
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,548
| 600,545
|
u644516473
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().rstrip().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,544
| 600,550
|
u644516473
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().rstrip().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,546
| 600,550
|
u644516473
|
python
|
p02795
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
def resolve():
import sys
import math
H, W, N = map(int, sys.stdin.read().rstrip().split('\n'))
m = max(H, W)
print(math.ceil(N / m))
resolve()
|
[] | 600,548
| 600,550
|
u644516473
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
M = max(H, W)
if N % M:
S = N // M
else:
S = N // M + 1
print(S)
|
H = int(input())
W = int(input())
N = int(input())
M = max(H, W)
if N % M == 0:
S = N // M
else:
S = N // M + 1
print(S)
|
[
"control_flow.branch.if.condition.change"
] | 600,560
| 600,561
|
u984276646
|
python
|
p02795
|
h=int(input())
n=int(input())
w=int(input())
v=max(h,n)
print(w+v-1//v)
|
h=int(input())
n=int(input())
w=int(input())
v=max(h,n)
print((w+v-1)//v)
|
[
"call.arguments.change"
] | 600,572
| 600,573
|
u269724549
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
ans(-(-n//max(h,w)))
|
h = int(input())
w = int(input())
n = int(input())
print(-(-n//max(h,w)))
|
[
"identifier.change",
"call.function.change"
] | 600,583
| 600,584
|
u597455618
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
if(h>=w):
big=h
else:
big=w
print(int(n/big))
|
h = int(input())
w = int(input())
n = int(input())
import math
if(h>=w):
big=h
else:
big=w
print(math.ceil(n/big))
|
[
"call.arguments.change",
"io.output.change"
] | 600,585
| 600,586
|
u142223843
|
python
|
p02795
|
N = int(input())
M = int(input())
K = int(input())
print(-(-K//M))
|
N = int(input())
M = int(input())
K = int(input())
print(-(-K//max(N,M)))
|
[
"call.add",
"call.arguments.change"
] | 600,589
| 600,590
|
u941407962
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
if N % 2 == 0:
print(N // max(H,W))
else:
print(N // max(H,W) + 1)
|
H = int(input())
W = int(input())
N = int(input())
if N % max(H,W) == 0:
print(N // max(H,W))
else:
print(N // max(H,W) + 1)
|
[
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change",
"call.arguments.add"
] | 600,591
| 600,592
|
u185424824
|
python
|
p02795
|
import math
H, W, N = [int(input()) for i in range(3)]
if H >= W:
long = H
else:
long = W
c = math.ceil(N // long )
print(c)
|
import math
H, W, N = [int(input()) for i in range(3)]
if H >= W:
long = H
else:
long = W
c = math.ceil(N / long )
print(c)
|
[
"expression.operator.arithmetic.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 600,600
| 600,601
|
u196675341
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N%H == 0:
count = N/H
else:
count = int(N/H) + 1
else:
if N%H == 0:
count = N/W
else:
count = int(N/W) + 1
print(int(count))
|
H = int(input())
W = int(input())
N = int(input())
if H >= W:
if N%H == 0:
count = N/H
else:
count = int(N/H) + 1
else:
if N%W == 0:
count = N/W
else:
count = int(N/W) + 1
print(int(count))
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 600,615
| 600,616
|
u786168796
|
python
|
p02795
|
from math import ceil
H = int(input())
W = int(input())
N = int(input())
m = max(H, W)
print(ceil(N // m))
|
from math import ceil
H = int(input())
W = int(input())
N = int(input())
m = max(H, W)
print(ceil(N / m))
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 600,619
| 600,620
|
u347064383
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
large = max(H,W)
ans = int(N / large)+1
print(ans)
|
H = int(input())
W = int(input())
N = int(input())
large = max(H,W)
ans = int((N-1) / large)+1
print(ans)
|
[
"call.arguments.change"
] | 600,625
| 600,626
|
u769383879
|
python
|
p02795
|
H=int(input())
W=int(input())
N=int(input())
if H<W:
H,W=W,H
ans = N // H
if N % H > 0: N += 1
print(ans)
|
H=int(input())
W=int(input())
N=int(input())
if H<W:
H,W=W,H
ans = N // H
if N % H > 0: ans += 1
print(ans)
|
[
"identifier.change"
] | 600,627
| 600,628
|
u731368968
|
python
|
p02795
|
import math
def main():
h = int(inout())
w = int(input())
n = int(input())
print(math.ceil(n/(max(h,w))))
main()
|
import math
def main():
h = int(input())
w = int(input())
n = int(input())
print(math.ceil(n/(max(h,w))))
main()
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 600,643
| 600,644
|
u041401317
|
python
|
p02795
|
h = int(input())
w = int(input())
n = int(input())
if h < w:
t = n / w
else:
t = n / h
print(int(t))
|
import math
h = int(input())
w = int(input())
n = int(input())
if h < w:
t = n / w
else:
t = n / h
print(math.ceil(t))
|
[
"call.arguments.change",
"io.output.change"
] | 600,662
| 600,663
|
u575101291
|
python
|
p02795
|
H = int(input())
W = int(input())
N = int(input())
a = max(H,W)
x = int(N/a)
print(x)
|
import math
H = int(input())
W = int(input())
N = int(input())
a = max(H,W)
x = math.ceil(N/a)
print(x)
|
[
"assignment.value.change"
] | 600,668
| 600,669
|
u100277898
|
python
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.