Harryxun/stf_run huggingface dataset:
n,m = map(int,input().split())
s = [0]*m
c = [0]*m

for i in range(m):
    s[i],c[i] = map(int,input().split())

sw = [[0]*2]*m
num = [0]*m
ans = 0
ss = [0]*m
for i in range(m):
    if s[i] == 1 and c[i] == 0:
        ans = 1
        break
    if sw[s[i]-1][0] == 1 and sw[s[i]-1][1] - 1 != c[i]:
        ans = 1
        break
    ss[s[i]-1] = c[i]
    sw[s[i]-1][0] = 1
    sw[s[i]-1][1] = c[i] + 1
if ans ==1:
    print(-1)
else:
    for i in range(m):
        print(ss[i], end="")
    print()

### FIXED CODE ###

n,m = map(int,input().split())
sc = [0]*m
for i in range(m):
    sc[i] = list(map(int,input().split()))
ans = 10**5
z = 10**5
if n == 1:
    z = 0
for i in range(min(10**(n-1),z),10**n):
    x = list(str(i))
    sw = 1
    for j in range(m):
        if x[sc[j][0]-1] == str(sc[j][1]):
            pass
        else:
            sw = 0
            break
    if sw == 1:
        ans = min(ans,i)
if ans == 10**5:
    print(-1)
else:
    print(ans)
import sys
 
def solve(N, T, A, ls_H):
    temperature = []
    difference = []
    near = []
    ti = 10**5//1
    for x in ls_H :
        air = T - x * 0.006
        temperature.append(air)
    #print(temperature)
    
    for y in temperature :
        til = A - y
        difference.append(til)
    #print(difference)
    
    for z in difference :
        near.append(abs(z))
    #print(near)
    
    for i in near :
        if ti > i :
            ti = i
    #print(ti)
    return titen1.index(ti) + 1


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 # Uncomment before submission
main()

### FIXED CODE ###

import sys
 
def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 10**5//1
    for x in ls_H :
        do = T - x * 0.006
        dosi.append(do)
    #print(dosi)
    
    for y in dosi :
        til = A - y
        titen.append(til)
    #print(titen)
    
    for z in titen :
        titen1.append(abs(z))
    #print(titen1)
    
    for i in titen1 :
        if ti > i :
            ti = i
    #print(ti)
    return titen1.index(ti) + 1
 
def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 # Uncomment before submission
main()
n,k = map(int,input().split())
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

for i in range(1,k+1):
    ans = (cmb(n-k+1,i)*cmb(k-1,i-1))
    print(ans%(10**9+7))

### FIXED CODE ###

import math

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

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))



for i in range(1,k+1):
    if n-k+1>=i:
        ans = (combinations_count(n-k+1,i)%(10**9+7)*combinations_count(k-1,i-1)%(10**9+7))
        print(ans%(10**9+7))
    else:
        print(0)
import math
from functools import reduce
import fractions
import sys


def gcd(*numbers):
    return reduce(fractions.gcd,numbers)

n, x = list(map(lambda x : int(x),input().split()))

zahyo = list(map(lambda x : int(x),input().split()))

zahyo.append(x)
zahyo.sort()

min = zahyo[1] - zahyo[0]

is_odd = False
is_even = False

odds = list()

for i in range(n):
    diff = zahyo[i+1] - zahyo[i]

    if diff % 2 == 0:
        is_even == True
    else:
        is_odd = True
        odds.append(diff)

    if diff < min:
        min = zahyo[i+1] - zahyo[i]

# print(is_odd)
# print(is_even)
if is_odd == True and is_even == True or gcd(*odds) == 1:
    print(1)
    sys.exit()

# print(gcd(*odds))

print(min)


### FIXED CODE ###

import math
from functools import reduce
import fractions
import sys


def gcd(*numbers):
    return reduce(fractions.gcd,numbers)


n, x = list(map(lambda x : int(x),input().split()))

zahyo = list(map(lambda x : int(x),input().split()))

zahyo.append(x)
zahyo.sort()

min = zahyo[1] - zahyo[0]

is_odd = False
is_even = False

odds = list()

for i in range(n):
    diff = zahyo[i+1] - zahyo[i]

    if diff % 2 == 0:
        is_even == True
    else:
        is_odd = True
        odds.append(diff)

    if diff < min:
        min = zahyo[i+1] - zahyo[i]

# print(is_odd)
# print(is_even)
if is_odd == True and is_even == True:
    print(1)
    sys.exit()

elif is_odd == True:
    print(gcd(*odds))
else:

    print(min)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a =< k:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a <= k:
  print("Yay!")
else:
  print(":(")
a,b,c = map(int,input().split)
if a==b!=c or a==c!=b or b==c!=a:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a,b,c = map(int, input().split())
if a==b!=c or a==c!=b or b==c!=a:
    print('Yes')
else:
    print('No')
a,b=(int(x) for x in input().split())
ans=a*b
if ans%2==0:
    print("Even")
elif ans%2==1:

### FIXED CODE ###

a,b=(int(x) for x in input().split())
ans=a*b
if ans%2==0:
    print("Even")
elif ans%2==1:
    print("Odd")
a,b,c = list(map(int, input()))
print("Yes" if a <= c and c <= b else "No")

### FIXED CODE ###

a,b,c = list(map(int, input().split()))
print("Yes" if a <= c and c <= b else "No")
n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  p=[list(map(str,input().split())) for i in range(m)]
  q=[]
  s=[0]*n
  t=0
  for i in range(len(p)):
    if p[i][1]=='AC' and  not p[i][0] in q:
      q.append(p[i][0])
      t+=s
      
    elif p[i][1]=="WA":
      if not p[i][0] in q:
        s[i]+=1
  
  
  
  
  print(len(q),len(s))
  

### FIXED CODE ###

n,m=map(int,input().split())
if m==0:
  print(0,0)
else:
  q=[0]*(n+1)
  s=[0]*(n+1)
  t=0
  for i in range(m):
    p,u=map(str,input().split())
    p=int(p)
    if q[p]==1:
      continue
    
    elif u=='AC':
      q[p]=1
      
      t+=s[p]
      
      
    elif u=="WA":
      if q[p]==0:
        s[p]+=1
        
  
  
  
  
  print(sum(q),t)
X = int(input())
k = 1
n = 1

while true:
  ans = 360 * n % X
  if ans == 0:
    print(360 * n / X)
    break:
  else:
    n += 1


### FIXED CODE ###

X = int(input())
i = 1

while (360*i) % X != 0:
  i += 1
ans = 360*i//X
print(ans)
N = int(input())
s = [input() for v in range(N)]
for v in ["AC", "WA", "TLE", "RE"]
    print("{0} x {1}".format(v, s.count(v)))

### FIXED CODE ###

N = int(input())

R = ["AC", "WA", "TLE", "RE"]
C = [0, 0, 0, 0]

for i in range(N):
    S = input()
    if S == R[0]:
        C[0] += 1
    elif S == R[1]:
        C[1] += 1
    elif S == R[2]:
        C[2] += 1
    elif S == R[3]:
        C[3] += 1

for i in range(len(C)):
    print(R[i], "x", C[i])
#from collections import Counter
import math
N=int(input())
A=list(map(int,input().split()))
l=[]
n=1
for i in A:
    l.append(i-n)
    n+=1
l.sort()
#中央値
#切り捨て
c=int(math.floor(N/2))
b=A[c]
ans_l=[]
ans=0
for j in l:
    ans+=abs(j-l[b])

print(ans)

### FIXED CODE ###

#from collections import Counter
import math
N=int(input())
A=list(map(int,input().split()))
l=[]
n=1
for i in A:
    l.append(i-n)
    n+=1
l.sort()
#中央値
#切り捨て
c=int(math.floor(N/2))

ans_l=[]
ans=0
for j in l:
    ans+=abs(j-l[c])

print(ans)
N,M,C = map(int, input().split())
B = [int(_) for _ in input().split()]

count = 0
for i in range(len(N)):
  A = [int(_) for _ in input().split()] 
  sum = 0
  for j in range(M):
    sum = B[j]*A[j]
  if sum-C > 0:
    count += 1

print(count)

### FIXED CODE ###

N,M,C = map(int, input().split())
B = [int(_) for _ in input().split()]

count = 0
for i in range(N):
  A = [int(_) for _ in input().split()] 
  sum = 0
  for j in range(M):
    sum += B[j]*A[j]
  if sum+C > 0:
    count += 1

print(count)
N=int(input())
W=list(map(int,input().split()))

diff=[]
for i in range(N-1):
    diff.append(abs(sum(W[:i+1])-sum(W[i+1:])))
print(min(diff)

### FIXED CODE ###

N=int(input())
W=list(map(int,input().split()))

diff=[]
for i in range(N-1):
    diff.append(abs(sum(W[:i+1])-sum(W[i+1:])))
print(min(diff))
data = [int(n) for n in input()];

def gcd(m, n):
    m = m % n;
    if m == 0:
        return n;
    return gcd(n, m);

print(gcd(max(data), min(data));


### FIXED CODE ###

data = [int(n) for n in input().split(" ")];

def gcd(m, n):
    m = m % n;
    if m == 0:
        return n;
    return gcd(n, m);

print(gcd(max(data), min(data)));
N, X = map(int, input().split())
*L, = map(int, input().split())

D = [0]
for i in range(1, N+1):
    D.append(D[i-1] + L[i-1])

num = 0
i = 0
d = D[i]
while d <= X and num < N+1:
    num += 1
    i += 1
    d = D[i]

print(num)

### FIXED CODE ###

N, X = map(int, input().split())
*L, = map(int, input().split())

D = [0]
for i in range(1, N+1):
    D.append(D[i-1] + L[i-1])

num = 0
i = 0
d = D[i]
while d <= X and num < N+1:
    num += 1
    i += 1
    if i != N+1:
        d = D[i]

print(num)
# coding: utf-8
# Your code here!

n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()
"""
print(a[0])
print(a[1])
print(a[2])
"""
def bin_upper(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[0][pc]>=b and a[0][pc-1]<b:
            return pc
        elif a[0][pc]<b:
            pl=pc+1
            if pl>n-1:
                return n
        else:
            pr=pc-1
            if pr<0:
                return 0
                
def bin_lower(b):    
    pl=0
    pr=n-1
    
    while True:
        pc=(pl+pr)//2
        if a[2][pc]<=b and a[2][pc+1]>b:
            return n-1-pc
        elif a[2][pc]>b:
            pr=pc-1
            if pr<0:
                return n
        else:
            pl=pc+1
            if pl>n-1:
                return 0
"""
print(bin_upper(a[1][0]))
print(bin_lower(a[1][0]))
print(bin_upper(a[1][1]))
print(bin_lower(a[1][1]))
print(bin_upper(a[1][2]))
print(bin_lower(a[1][2]))
"""

cnt=0
for i in range(n):
    #val=bin_upper(a[1][0])
    #print(val)
    cnt+=bin_upper(a[1][i])*bin_lower(a[1][i])
print(cnt)



### FIXED CODE ###

import sys
input=sys.stdin.readline
from bisect import bisect_right, bisect_left
n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()



cnt=0
for i in range(n):
    index_1 = bisect_left(a[0],a[1][i])
    index_2 = n-bisect_right(a[2],a[1][i])
    cnt+=index_1*index_2
print(cnt)
N, K = input().split()
N = list(N)
N[int(K)] = N[int(K)].lower()
print(N)


### FIXED CODE ###

N, K = map(int,input().split())
S = input()
S = list(S)
S[K-1] = S[K-1].lower()
print(''.join(S))
ans = 0
for i in range(1, n):
    if 0 != i%3 and 0 != i%5:
        ans += i
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1, n+1):
    if 0 != i%3 and 0 != i%5:
        ans += i
print(ans)
N,X,M = map(int,input().split())
A = [100001]*(10**5+1)
A[1] = X
S = {X}
ans = X
for i in range(2,min(2*M+1,N)+1):
  X = X**2
  X %= M
  ans += X
  A[i] = X
  if X in S:
    break
  S.add(X)
  #print(i)
#[print(A[i]) for i in range(6)]
  
if i == N:
  print(ans)
else:
  j = A[:i+1].index(A[i])
  if i == j:
    print(ans)
  k = (N-i)//(i-j)
  l = (N-i)%(i-j)
  #print(j,k,l)
  ans += k*sum(A[j+1:i+1])+sum(A[j+1:j+l+1])
  print(ans)




### FIXED CODE ###

N,X,M = map(int,input().split())
A = [100001]*(2*(10**5)+100)
A[1] = X
S = {X}
ans = X
for i in range(2,min(2*M+1,N)+1):
  X = X**2
  X %= M
  ans += X
  A[i] = X
  if X in S:
    break
  S.add(X)
  #print(i)
#[print(A[i]) for i in range(6)]
if N == 1:
  print(X)
  exit()
elif i == N:
  print(ans)
else:
  j = A[:i+1].index(A[i])
  if i == j:
    print(ans)
  k = (N-i)//(i-j)
  l = (N-i)%(i-j)
  #print(j,k,l)
  ans += k*sum(A[j+1:i+1])+sum(A[j+1:j+l+1])
  print(ans)
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for i in range(q)]

aclist = [0]
acsum = 0

for i in range(1,n):
    if s[i-1] == "A" and s[i] == "C":
        acsum += 1
    aclist.append(acsum)

for i in range(q):
    ans = aclist [lr[i][0]-1] - aclist [lr[i][0]-2]
    if aclist [lr[i][0]-1] - aclist [lr[i][0]-2] != 0:
        ans -= 1
    print(ans)


### FIXED CODE ###

b = input()

if b == "A":
    ans = "T"
elif b == "T":
    ans = "A"
elif b == "C":
    ans = "G"
else:
    ans = "C"

print(ans)
N = int(input())
K = int(input())
count = 0
for i in range(1,N+1):
    n = int(input())
    if n >= K:
        count += 1
    else: continue
print(count)

### FIXED CODE ###

N,K=map(int,input().split())
count = 0
for i in range(1,N+1):
    h = list(map(int,input().split()))
    for j in h:
        if j >= K:
            count += 1
        else: continue
    break
print(count)
from sys import exit

N = int(input())

q = {}

for i in range(N):
    q[i + 1] = []

for i in range(N - 1):
    _u, _v, _w = map(int, input().split())

    q[_u].append((_v, _w))
    q[_v].append((_u, _w))

reached = []
distances = {}


def search(x, distance):
    if x in reached:
        # 既に達しているところだったら
        return

    # 達したことを記録
    reached.append(x)
    distances[x] = distance

    for s in q[x]:
        search(s[0], distance + s[1])


search(1, 0)

for i in range(N):
    if i == 0:
        print(0)
        continue
    if distances[i + 1] % 2 == 0:
        print(0)
    else:
        print(1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

N = int(input())

q = {}

for i in range(N):
    q[i] = []

for _ in range(N - 1):
    _u, _v, _w = map(int, input().split())

    q[_u - 1].append((_v - 1, _w))
    q[_v - 1].append((_u - 1, _w))

ans = [None] * N
ans[0] = 0


def search(x, parent_num):
    for s in q[x]:
        if ans[s[0]] is None:
            ans[s[0]] = (parent_num + s[1]) % 2
            search(s[0], ans[s[0]])


search(0, 0)

for i in range(N):
    print(ans[i])
n, x = map(int,input().split())
xi = list(map(int,input().split()))

for i, n in enumerate(xi):
    xi[i] = abs(xi[i]-x)

while 1:
    out = min(xi)
    for i, n in enumerate(xi):
        if n%out!=0:
            for j in range(2,out+1):
                if out%j==0:
                    out = out / j
            continue
    print(int(out))
    exit()


### FIXED CODE ###

from fractions import gcd
n, x = map(int,input().split())
xi = list(map(int,input().split()))

for i, n in enumerate(xi):
    xi[i] = abs(xi[i]-x)
ans = xi[0]
for i in range(len(xi)):
    ans = gcd(ans, xi[i])
print(ans)
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = maap(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = res // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

### FIXED CODE ###

D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = (res+k) // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)
N = int(input())
S = list(map(input().split()))

if N % 2 == 0 and S[0:N / 2] == S[N / 2 + 1:N - 1]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
S = input()

if N % 2 == 0 and S[0:round(N / 2)] == S[round(N / 2):N]:
    print('Yes')
else:
    print('No')
n = int(input())
if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-100+10)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(i-10000+910)
else:
    print(90909)

### FIXED CODE ###

n = int(input())
if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-100+10)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-10000+910)
else:
    print(90909)
n=int(input())
#n=i*jを満たすi,jで，i+jが最小

lis=prime_factorize(n)
lis.sort()
lis_a=[lis[i] for i in range(len(lis)) if i%2==0]
lis_b=[lis[i] for i in range(len(lis)) if i%2!=0]
print(product(lis_a)+product(lis_b)-2)

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
  
def product(lis):
    res=1
    for i in range(len(lis)):
        res*=lis[i]
    return res

### FIXED CODE ###

n=int(input())
mini=2*n
for a in range(1,int(n**0.5)+1):
    if n%a==0:
        b=n//a
        if mini>a+b:
            mini=a+b
print(mini-2)
import math

a,b,c,d = input().split(' ')

a = int(a)
b = int(b)
c = int(c)
d = int(d)

hoge = (c * d) // math.gcd(c, d)

counter = 0

counter = counter + ((b // c) + (b // d) - (b // hoge))
counter = counter - (((a - 1) // c) + ((a - 1) // d) - ((a - 1) // hoge))

print(b - a + 1 - counter)


### FIXED CODE ###

# 最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)

a,b,c,d = input().split(' ')

a = int(a)
b = int(b)
c = int(c)
d = int(d)

hoge = lcm(c,d)

counter = 0

counter = counter + ((b // c) + (b // d) - (b // hoge))
counter = counter - (((a - 1) // c) + ((a - 1) // d) - ((a - 1) // hoge))

print(b - a + 1 - counter)
N = input()
 
a = int(N/100)
b = int( (N-a*100)/10 )
c = int(N-a*100-b*10)
 
if( a == 7 or b == 7 or c == 7 ):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

num = input();

if num[0] == "7" or num[1] == "7" or num[2] == "7" :
  print("Yes");
else:
  print("No");
import itertools
import math
from scipy.special import comb

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

mod = 10**9+7

# print(list(itertools.combinations(range(6), 3)))
# A = range(6)
# N = 6
# K = 3

ans = 0
for i in range(N):
    # print(comb(i, K-1, exact=True), comb(N-i-1, K-1, exact=True))
    ans += (comb(i, K-1, exact=True) - comb(N-i-1, K-1, exact=True)) * A[i] % mod

print(ans%mod)

### FIXED CODE ###

# import itertools
# import math

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

mod = 10**9+7

# print(list(itertools.combinations(range(6), 3)))
# A = range(6)
# N = 6
# K = 3

# 二項係数を素数で割った余り
def combMod(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
    # fact = [-1 for _ in range(n+1)]
    # fact[0] = 1
    # fact[1] = 1
    # inv = [-1 for _ in range(n+1)]
    # inv[0] = 0
    # inv[1] = 1
    # factinv = [-1 for _ in range(n+1)]
    # factinv[0] = 1
    # factinv[1] = 1
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
p = mod
    
for i in range(2, N + 1):
    # fact[i] = ((fact[i-1] * i) % p)
    # inv[i] = ((-inv[p % i] * (p // i)) % p)
    # factinv[i] = ((factinv[i-1] * inv[i]) % p)
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)




ans = 0
for i in range(N):
    num = combMod(i, K-1, mod) % mod
    ans += num * A[i] % mod
    ans -= num * A[N-i-1] % mod
    ans %= mod

print(ans)
input()
List=list(map(int,input().split()))
ans=0
while all(l%2==0 for l in List):
  List[l/2 for l in List]
  ans+=1
print(ans)

### FIXED CODE ###

input()
A=list(map(int,input().split()))
ans=0
while all(a%2==0 for a in A):
    A=[a/2 for a in A]
    ans+=1
print(ans)
R = int(input())
if R < 1200:
    print('ABC')
elif <2800:
    print('ARC')
else:
    print('AGC')

### FIXED CODE ###

R = int(input())
if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')
N, M = map(int, input().split())
LRD = [tuple(int(x) for x in input().split()) for _ in range(M)]

import numpy as np
Graph = np.full((N,N), np.inf)
for l,r,d in LRD:
    Graph[r-1,l-1] = d
    Graph[l-1,r-1] = -d
import scipy.sparse.csgraph as csg
try:
    Graph = csg.johnson(Graph)
    for l,r,d in LRD:
        if Graph[r-1,l-1] != d or Graph[l-1,r-1] != -d:
            ans = 'No'
            break
    else:
        ans = 'Yes'
except csg.NegativeCycleError:
    ans = 'No'
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
LRD = [tuple(int(x) for x in input().split()) for _ in range(M)]
Graph = [[] for _ in range(N)]
for l,r,d in LRD:
    Graph[r-1].append((l-1,d))
    Graph[l-1].append((r-1,-d))

seen = set()
Dfr = [0] * N #dist from Root
for root in range(N):
    if root in seen: continue
    seen.add(root)
    V = [root]
    while len(V) != 0: #bfs
        v = V.pop(0)
        for nv,d in Graph[v]:
            if nv in seen and Dfr[nv] != Dfr[v] + d: #bfsで発見済みの値が異なる⇔矛盾
                print('No')
                exit()
            if nv in seen: continue
            else:
                seen.add(nv)
                Dfr[nv] = Dfr[v] + d
                V.append(nv)
print('Yes')
a,b,c=map(int,input().split())
if (c-a-b)*(c-a-b)-round4*a*b>=0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if 4*a*b<(c-a-b)*(c-a-b) and c-a-b>=0:
  print("Yes")
else:
  print("No")
x = int(inut())
print(x*x*x)



### FIXED CODE ###

x = int(input())
print(x**3)
import sys
sys.setrecusionlimit(100000)
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append((b-1,c))
    g[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[-1]*n
def f(k,c):
    d[k]=c
    for i,v in g[k]:
        if d[i]==-1:
            f(i,c+v)
f(k-1,0)
for _ in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    g[a-1].append((b-1,c))
    g[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[-1]*n
def f(k,c):
    d[k]=c
    for i,v in g[k]:
        if d[i]==-1:
            f(i,c+v)
f(k-1,0)
for _ in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])
n = int(input())

if n==1:
  print('Hello World')
else:
  a,b = map(int,input().split())
  print(a+b)

### FIXED CODE ###

n = int(input())

if n==1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

print("YES" if max(a-b,b-a)/(w-v)<=t else "NO")

### FIXED CODE ###

a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if w>=v:
  print("NO")
  exit()

print("YES" if max(a-b,b-a)/(v-w)<=t else "NO")
n = int(input())
a = 1

for b in range(n):
    b = int(input())
    a = a*b//gcd(a, b)

print(a)


### FIXED CODE ###

import fractions

n = int(input())
a = 1

for b in range(n):
    b = int(input())
    a = a*b//fractions.gcd(a, b)
print(a)