Harryxun/stf_run huggingface dataset:
import sys
 
def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm
   
n = int(input())

a = list(map(int, input().split()))

MOD = 10 ** 9 + 7

ans = 1
d = 1
cur = 0

for i in a:
	ans = compute_lcm(ans, i)

for i in a:
	cur += ans / i

print(cur % MOD)


### FIXED CODE ###

import sys

def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm

def lcm(a):
	x = a[0]
	for i in range(1, len(a)):
		x = compute_lcm(x, a[i])
	return x

n = int(input())

a = list(map(int, input().split()))

MOD = 10 ** 9 + 7

ans = lcm(a)
cur = 0

for i in a:
	cur += ans // i

print(cur % MOD)
# solution
k=int(input())

from collections import deque
todo = deque([i for i in range(1, 10)])
count = 0

while len(todo) > 0:
    value = todo.popleft()
    seen.append(value)
    value_digit1 = value % 10
    count += 1
    if count == k:
        print(value)
        break
    if value_digit1==0:
        todo.append(10*value)
        todo.append(10*value+1)
    elif value_digit1==9:
        todo.append(10*value+8)
        todo.append(10*value+9)
    else:
        todo.append(10*value+value_digit1-1)
        todo.append(10*value+value_digit1)
        todo.append(10*value+value_digit1+1)

### FIXED CODE ###

# solution
k=int(input())

from collections import deque
todo = deque([i for i in range(1, 10)])
count = 0

while len(todo) > 0:
    value = todo.popleft()
    value_digit1 = value % 10
    count += 1
    if count == k:
        print(value)
        break
    if value_digit1==0:
        todo.append(10*value)
        todo.append(10*value+1)
    elif value_digit1==9:
        todo.append(10*value+8)
        todo.append(10*value+9)
    else:
        todo.append(10*value+value_digit1-1)
        todo.append(10*value+value_digit1)
        todo.append(10*value+value_digit1+1)
H, A = map(int, input().split())
 
if A > H:
  print(1)
  
else:
  if H % A = 0:
    answer = H // A
  else:
    answer = H // A + 1
  
  print(answer)

### FIXED CODE ###

H, A = map(int, input().split())
 
if A > H:
  print(1)
  
else:
  if H % A == 0:
    answer = H // A
  else:
    answer = H // A + 1
  
  print(answer)
def ac(m,n):
  if m==n:
    return 'YES'
  else:
    return 'NO'
  
m,n=map(int,imput().split())
ac(m,n)

### FIXED CODE ###

m,n=map(int,input().split())
if m==n:
  print('Yes')
else:
  print('No')
S = input()

week = {
  "MON": 1,
  "TUE": 2,
  "WED": 3,
  "THU": 4,
  "FRI": 5,
  "SAT": 6
}

if __name__ == "main":
  if S == "SUN":
    return 7
  else:
    return 7 - week[S]

### FIXED CODE ###



S = input()


week = {
  "MON": 1,
  "TUE": 2,
  "WED": 3,
  "THU": 4,
  "FRI": 5,
  "SAT": 6
}

if S == "SUN":
  print(7)
else:
  print(7 - week[S])
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = 0
b = 0
ans = 0
if sum(A) + sum(B) <= K:
    print(N+M)
    exit()
A.append(10**9+1)
B.append(10**9+1)
while min(A[a],B[b]) <= K:
    if A[a] == B[b]:
        AA = A[a+1:N]
        BB = B[b+1:M]
        for i in range(1,len(AA)):
            AA[i] += AA[i-1]
        for i in range(1,len(BB)):
            BB[i] += BB[i-1]
        l = 0
        r = len(AA)-1
        w = K - A[a]
        while r - l > 1:
            m = (r+l)//2
            if AA[m] == w:
                r = m
                break
            elif AA[m] < w:
                l = m
            else:
                r = m
        if BB[l+1] <= w:
            K -= B[b]
            b += 1
        else:
            K -= A[a]
            a += 1
    elif A[a] == min(A[a],B[b]):
        K -= A[a]
        a += 1
    else:
        K -= B[b]
        b += 1
    ans += 1
print(ans)

### FIXED CODE ###

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AA = A
BB = B
for i in range(1,N):
    AA[i] += AA[i-1]
for i in range(1,M):
    BB[i] += BB[i-1]
AA = [0] + AA
BB = [0] + BB
import bisect
c = bisect.bisect_right(AA,K)
ans = 0
for i in range(c):
    ans = max(ans, i + bisect.bisect_right(BB,K-AA[i]) - 1)
print(ans)
h, w =map(int,input().split())

if (h * w) % 2 == 0:
  print((h * w) // 2)
else:
  print(((h * W) // 2) + 1)
  

### FIXED CODE ###

h, w =map(int,input().split())

if h == 1 or w == 1:
  print(1)
else:
  if (h * w) % 2 == 0:
    print((h * w) // 2)
  else:
    print(((h * w) // 2) + 1)
import math
N = int(input())
a = list(map(int,input().split())
s = 0
t = 0
for i in range(N):
    s += a[i]
    t += (a[i])**2
a = math.floor(s/N)
if (s/N) - a > 0.5:
    a += 1
ans = N*a**2 - 2*s*a + t
print(ans)

### FIXED CODE ###

import math
N = int(input())
a = list(map(int,input().split()))
s = 0
t = 0
for i in range(N):
    s += a[i]
    t += (a[i])**2
a = math.floor(s/N)
if (s/N) - a > 0.5:
    a += 1
ans = N*a**2 - 2*s*a + t
print(ans)
import math

def main():
    a,b = map(int,input().split())
    gcd = math.gcd(max(a,b),min(a,b))
    lcm = a*b//gcd

    print(lcm)

main()


### FIXED CODE ###

def gcd(a,b):
    if b == 0:
        return a
    if b > a:
        return gcd(b,a)
    return gcd(b,a%b)

def main():
    a,b = map(int,input().split())
    g = gcd(max(a,b),min(a,b))
    lcm = a*b//g

    print(lcm)

main()
x, n = map(int, input().split())
l = list(map(int, input().split()))
flg = false
t = x
while flg == False:
  if t in l:
    t -= 1
  else:
    ans = t
    flg = True
flg = False
t = x
while flg == False:
  if t in l:
    t += 1
  else:
    if abs(x-ans) > abs(x-t):
      ans = t
    flg = True
print(ans)


### FIXED CODE ###

x, n = map(int, input().split())
l = list(map(int, input().split()))
flg = False
t = x
while flg == False:
  if t in l:
    t -= 1
  else:
    ans = t
    flg = True
flg = False
t = x
while flg == False:
  if t in l:
    t += 1
  else:
    if abs(x-ans) > abs(x-t):
      ans = t
    flg = True
print(ans)
string = input()
num = int(input())
data = [input().split(' ') for i in range(kai)]

for i in range(num):
    if(data[i][0] == '1'):
        if(len(string) == 2):
            string = string[1] + string[0]
        elif(len(string) >= 3):
            string = string[-1] + string[1:-1] + string[0]
        
    else:
        if(data[i][1] == '1'):
            string = data[i][2] + string
        else:
            string = string + data[i][2]

print(string)


### FIXED CODE ###

string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start
former = []
latter = []

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        former.append(data[i][2])
    else:
        latter.append(data[i][2])

string = ''.join(former[::-1]) + string + ''.join(latter)
if(key == 0):
    print(string)
else:
    print(string[::-1])
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    a, b = map(int , input().split())
    sum = a + b
    print(len(str(a + b)))

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    try:
        a, b = map(int , input().split())
        sum = a + b
        print(len(str(a + b)))
    except:
        break
from math import pow






def compute_score(target_collection):
    keys = {neta_point[0] for neta_point in target_collection}
    points = [neta_point[1] for neta_point in target_collection]
    cardinality = len(keys)
    score = pow(cardinality, 2) + sum(points)
    return score

# exchange one record and compare
def optimize(full_collection, target_collection, target_collection_len, idx):
    while True:
        ex_record = full_collection[idx]
        # check on the idx-th record
        idx += 1
        # bump up for return value
        if ex_record in target_collection:
            continue # cardinality score will not increase
        else:
            for i in range(target_collection_len-1):
                if target_collection[i][0] == target_collection[i-1][0]:
                    target_collection[i] = ex_record
                    new_score = compute_score(target_collection)
                    return new_score, target_collection, idx
        # default
        return 0, target_collection, idx



def cal_score(N, K, records):
    sorted_recs = sorted(records, reverse=True, key=lambda x: x[1])
    target_collection = sorted_recs[0:K]
    score =  compute_score(target_collection)

    # optimzie at most K times
    idx = K
    for i in range(K):
        new_score, new_target_collection, idx = optimize(sorted_recs, target_collection, K, idx)
        if new_score <= score: # no optimization occured
            break
        else:
            score = new_score
    return score
  
N, K = map(int, input().split())
records = [tuple(map(int, input().split())) for i in range(N)] 
score =cal_score(N, K, records)
print(score)


### FIXED CODE ###

a, b, c = map(int, input().split())
print(a*b//2)
def sig(x):
    return 1 if x==1 else sig(x-1)+x


a,b=map(int,input().split())

upper=int(sig(b-a))
print(upper-b)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

def sig(x):
    return 1 if x==1 else sig(x-1)+x


a,b=map(int,input().split())

upper=int(sig(b-a))
print(upper-b)
n = int(input())
h = list(map(int, input().split()))
count = 1
for i in range(1, n):
    if all(h[i] >= h[j] for j in range(0, i-1)):
        count += 1
if h[0] > h[1]:
    print(count-1)
else:
    print(count)

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(1,n+1):
    exam = h[0:i]
    sorted_exam = sorted(exam)
    if exam[-1] == sorted_exam[-1]:
        count += 1
print(count)
abcde = []
for i in range(5):
    abcde.append(int(input()))
ans = sum([(abcde[i]//10+1)*10 for i in range(5)]) + min([abcde[i]%10 for i in range(5) if abcde[i]%10 != 0])-10
print(ans)

### FIXED CODE ###

abcde = []
for i in range(5):
    abcde.append(int(input()))
ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])
amari = [abcde[i]%10 for i in range(5) if abcde[i]%10 != 0]
if len(amari) == 0:
    ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])
else:
    ans = sum([-(-abcde[i] // 10)*10 for i in range(5)])-10+min(amari)
    
print(ans)
import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
	for j in range(i + 1, n - 1):
    	bi = bisect.bisect_left(li, li[i] + li[j])
    	count += bi - j - 1
print(count)

### FIXED CODE ###

import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)
def main():
    x, y = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    y, x = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()
def main():
    N,M,K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    indb = M-1
    now = sum(B)
    count = M
    while now > K:
        now -= B[indb]
        count -= 1
        indb -= 1
    
    ans = count
    
    for a in A:
        count += 1
        now += a
        
        while now >K and indb >= 0:
            now -= B[indb]
            count -= 1
            indb -= 1
        
        if now <= K:
            if ans < count:
                ans = count
    print(ans)
    

if __name __ == "__main__":
    main()

### FIXED CODE ###

from itertools import accumulate
from bisect import bisect_right

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))

result = 0
for i in range(N + 1):
    if a[i] > K:
        break
    j = bisect_right(b, K - a[i])
    result = max(result, i + j - 1)
print(result)
a,b = map(int,input().split()

if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b = map(int, input().split())

if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    print(-1)
resolve()

### FIXED CODE ###

def resolve():
    H1, M1, H2, M2, K = map(int, input().split())
    import datetime
    AwakeTime = (H2*60 + M2)-(H1*60 + M1)
    ans = AwakeTime -K
    print(ans)
resolve()
a=input()
b=input()
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
from math import gcd

def lcm(x, y):
    return x * y // gcd(x, y)

def kosu(b, c, d):
    return b - ((b // c) + (b // d) - (b // lcm(c, d)))

a, b, c, d = map(int, input().split())
print(kosu(b, c, d) - kosu(a - 1, c, d))


### FIXED CODE ###

def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

def lcm(x, y):
    return x * y // gcd(x, y)

def kosu(b, c, d):
    return b - ((b // c) + (b // d) - (b // lcm(c, d)))

a, b, c, d = map(int, input().split())
print(kosu(b, c, d) - kosu(a - 1, c, d))
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,0,1,2,3][rest]
    rest = 0
  elif rest < whole[i]:
    rest -= 1
  elif rest == whole[i]:
    rest -= whole[i]
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break

### FIXED CODE ###

#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest <= whole[i] - (i-1):
    rest -= 1
  elif rest <= whole[i]:
    rest = 0
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break
import math
N, K = map(int,input().split())
for i in range(1,K+1):
    ans = (math.factorial(K-1) // (math.factorial(K-1-i+1)*math.factorial(i-1))) * (math.factorial(N-K+1) // (math.factorial(N-K-i)*math.factorial(i)))
    tans = int(ans % (10**9+7))
    print(tans)

### FIXED CODE ###

import math
N, K = map(int,input().split())
for i in range(1,K+1):
    if N-K+1-i >= 0:
        ans = (math.factorial(K-1) // (math.factorial(K-1-i+1)*math.factorial(i-1))) * (math.factorial(N-K+1) // (math.factorial(N-K+1-i)*math.factorial(i)))
        tans = int(ans % (10**9+7))
        print(tans)
    else:
        print(0)
n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort(reverse=True)

sum = 0

for i in range(K):
    sum += l[i]

print(sum)

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort(reverse=True)

sum = 0

for i in range(k):
    sum += l[i]

print(sum)
from functools import lru_cache

n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

k = min(n-1, k)

inf = 100000000

dp = [inf for _ in [0]*n]

@lru_cache
def cost(i, j):
	return abs(h[i] - h[j])

for i in range(k+1):
	dp[i] = cost(0, i)

for i in range(k+1, n):
	
	dp[i] = min([dp[i-j] + cost(i-j, i) for j in range(1, k+1)])

print(dp[-1])


### FIXED CODE ###

n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

k = min(n-1, k)

inf = 100000000

dp = [inf for _ in [0]*n]

def cost(i, j):
	return abs(h[i] - h[j])

for i in range(k+1):
	dp[i] = cost(0, i)

for i in range(k+1, n):
	
	dp[i] = min([dp[i-j] + cost(i-j, i) for j in range(1, k+1)])

print(dp[-1])
import math

n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main(divisors, o):
    for i in range(o):
        a = divisors[i]
        b = divisors[::-1][i]
        
        if a <= 9 and b <= 9:
            return 'Yes'
    return 'No'


divs = make_divisors(n)

o = len(divs)/2 + len(divs) % 2

print(main(divs, o))


### FIXED CODE ###

import math

n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main(divisors, o):
    for i in range(o):
        a = divisors[i]
        b = divisors[::-1][i]
        
        if a <= 9 and b <= 9:
            return 'Yes'
    return 'No'


divs = make_divisors(n)

o = int(len(divs)/2 + len(divs) % 2)

print(main(divs, o))
from collections import defaultdict
n = int(input())
di = [list(map(int, input().split(' '))) for _ in range(n)]
#result = {0:0}
md = defaultdict(int)
#md[0] = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            p = di[i][0] - di[j][0]
            q = di[i][1] - di[j][1]
            #result[(p,q)] = result.get((p,q), 0)+1
            md[(p,q)] += 1
#print(result)
#print(n - max(result.values()))
#print(md)
print(n - max(md.values()))

### FIXED CODE ###

#from collections import defaultdict
n = int(input())
di = [list(map(int, input().split(' '))) for _ in range(n)]
result = {0:0}
#md = defaultdict(int)
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            p = di[i][0] - di[j][0]
            q = di[i][1] - di[j][1]
            result[(p,q)] = result.get((p,q), 0)+1
            #md[(p,q)] += 1
#print(result)
print(n - max(result.values()))
#print(md)
#print(n - max(md.values()))
a, b = map(str, input().split())

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c = i**2:
        print('Yes')
        exit()

print('No')


### FIXED CODE ###

a, b = map(str, input().split())

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c == i**2:
        print('Yes')
        exit()

print('No')
hp = int(input())
hissatsu = int(input())
hissatsuatk = list(map(int, input().split()))

if hp <= sum(hissatsuatk):
    print('YES')
else:
    print('NO')


### FIXED CODE ###

kazu1 = list(map(int, input().split()))
kazu2 = list(map(int, input().split()))

if kazu1[0] <= sum(kazu2):
    print('Yes')
else:
    print('No')
N, A, B, C, D = map(int, input().split())
S = input()
s = []
for i in range(N):
    if S[i] == '.':
        s.append(0)
    else:
        s.append(1)
if C < B and B < D: #ACBDの順番
    flag = 0
    for i in range(C-A):
        if s[A + i] == 1 and s[A + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(D-B):
            if s[B + i] == 1 and s[B + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
elif B < C and C < D: # ABCDの順番
    flag = 0
    for i in range(D-B):
        if s[B + i] == 1 and s[B + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(B-A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
else: #ABDCの順番
    flag1 = 0
    flag2 = 0
    for i in range(D - B + 1):
        if s[B + i - 1] == 0 and s[B + i] == 0 and s[B + i + 1] == 0:
            flag1 = 1
            break
    if flag1 == 1:
        for i in range(C - A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag2 = 1
                break
    if flag1 == 1 and flag2 == 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

N, A, B, C, D = map(int, input().split())
S = input()
s = [0]
for i in range(N):
    if S[i] == '.':
        s.append(0)
    else:
        s.append(1)
if C < B and B < D: #ACBDの順番
    flag = 0
    for i in range(C - A):
        if s[A + i] == 1 and s[A + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(D - B):
            if s[B + i] == 1 and s[B + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
elif B < C and C < D: # ABCDの順番
    flag = 0
    for i in range(D - B):
        if s[B + i] == 1 and s[B + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(B - A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
else: #ABDCの順番
    flag = 0
    for i in range(D - B + 1):
        if s[B + i - 1] == 0 and s[B + i] == 0 and s[B + i + 1] == 0:
            flag = 1
            break
    if flag == 1:
        for i in range(C - A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag = 0
                break
    if flag == 1:
        print('Yes')
    else:
        print('No')