Harryxun/stf_run huggingface dataset:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p=[0]* m 
x=[0]* m 
for i in range(m):
    p[i],x[i]= map(int(input().split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])


### FIXED CODE ###

n=int(input())
t=list(map(int,input().split()))
m=int(input())
p=[0]*m
x=[0]*m
for i in range(m):
  p[i],x[i]=map(int,input().split())  
for i in range(m):
  print(sum(t)-t[p[i]-1]+x[i])
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)

if len(set(v)) == 1:
    print(xx)

m = sum(v[:A])/A
print(m)


n = v[:A].count(min(v[:A]))
m = v.count(min(v[:A]))
print(n,m)
print(cmb(m,n))

### FIXED CODE ###

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)

if len(set(v)) == 1:
    print(1)
    print(1125899906842623)
    exit()

m = sum(v[:A])/A
print(m)

if len(set(v[:A]))==1:
    ans = 0
    c = v.count(v[0])
    for i in range(A,B+1):
        if i <= c:
            ans += cmb(c,i)
    print(ans)
    exit()

mi = min(v[:A])
n = v[:A].count(mi)
m = v.count(mi)
print(cmb(m,n))
INFTY = 10**9+7
N = int(input())
A = list(map(int,input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
if N%2==0:
    flag = 0
    for i in range(1,N,2):
        if C[i]==2:
            pass
        else:
            flag = 1
            break
else:
    flag = 0
    for i in range(2,N,2):
        if C[i]==2:
            pass
        else:
            flag = 1
            break
    if C[0]!=1:
        flag = 1
if flag==0:
    cnt = 1
    for i in range(N//2):
        cnt = (cnt*2)%INFTY
else:
    cnt = 0
print(cnt)

### FIXED CODE ###

INFTY = 10**9+7
N = int(input())
A = list(map(int,input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
if N%2==0:
    flag = 0
    for i in range(1,N,2):
        if i in C and C[i]==2:
            pass
        else:
            flag = 1
            break
else:
    flag = 0
    for i in range(2,N,2):
        if i in C and C[i]==2:
            pass
        else:
            flag = 1
            break
    if 0 not in C or C[0]!=1:
        flag = 1
cnt = 0
if flag==0:
    cnt = 1
    for i in range(N//2):
        cnt = (cnt*2)%INFTY
print(cnt)
import sys
from  collections import deque
sys.setrecursionlimit(10^5)
memo = deque()
def dfs(base, n, s, cur):
  if cur == n:
    if not s in memo:
      memo.append(s)
      return 1
    else:
      return 0
  else:
    return (dfs(base, n, s, cur+1)+(0 if base[cur] in s else dfs(base, n, s+base[cur], cur+1)))%(10^9+7)

N = int(input())
S = list(input().strip())
print(dfs(S,N,"",0)-1)



### FIXED CODE ###

from itertools import combinations
N = int(input())
S = list(input().strip())
d = {}
for c in S:
  if c in d.keys():
    d[c] += 1
  else:
    d[c] = 1
ans = 0
for n in d.values():
  ans = (ans+n+ans*n)%(10**9+7)
print(ans)
import numpy as np
n,k,q=map(int,input().split())	
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;
a=np.repeat(k-q,n)
for word in listA:
    a[word-1]+=1
result=[]
for i in range(len(a)):
    if a[i]<=0:
        result.append('No')
    else:
        result.append('Yes')
print(result)

### FIXED CODE ###

import numpy as np
n,k,q=map(int,input().split())	
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(int(input()))
    except:
        break;
a=np.repeat(k-q,n)
for word in listA:
    a[word-1]+=1
result=[]
for i in range(len(a)):
    if a[i]<=0:
        print('No')
    else:
        print('Yes')
N=input()

if (N ="ABC"):
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

n=input()

if (n =="ABC"):
    print("ARC")
else:
    print("ABC")
n=int(input())
l=list(map(int,input().split()))
xl=list(reversed(l))
g=[]
a=1
k=0
f=0
for i in xl:
  k+=i
  g.append(k)
g.reverse()
for i in range(len(g)):
  if a<=0:
    f+=1
    break
  if g[i]>=a:
    g[i]=a
  a-=l[i]
  a*=2
if f==0 and n!=0:
  print(sum(g))
elif n==0:
  print(len[l])
else:
  print(-1)


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
xl=list(reversed(l))
g=[]
a=1
k=0
f=0
for i in xl:
  k+=i
  g.append(k)
g.reverse()
for i in range(len(g)):
  if g[i]>=a:
    g[i]=a
  a-=l[i]
  a*=2
  if a<=0 and i!=len(g)-1:
    f+=1
    break
  if a<0 and i==len(g)-1:
    f+=1
    break
if f==0 and n!=0:
  print(sum(g))
elif n==0:
  if l[0]==1:
    print(1)
  else:
    print(-1)
else:
  print(-1)
X,A=map(int,input().split())
if X < A:
    Print("0")

else:
    print("10")    
    

### FIXED CODE ###

X,A=map(int,input().split())
Y=0
if X<A:
    Y=0
else:
    Y=10

print(Y)
S=input("Enter String: ")
N=len(S)
B=int(input("Enter K: "))
K=B-1
if N<0 or N>50:
  print("Error")
else:
  A=S[:K]+S[K].lower()+S[K+1:]
  print(A)

### FIXED CODE ###

import sys
a=sys.stdin.readline()
res = [int(i) for i in a.split() if i.isdigit()] 
N,K = [res[i] for i in (0,1)]
S=sys.stdin.readline(N)
K-=1
if N<0 or N>50:
  print("Error")
else:
  x=S[:K]
  y=S[K].lower()
  z=S[K+1:]
  print(x+y+z)
print raw_input()**3

### FIXED CODE ###

print int(raw_input()) ** 3
if (a * b) % 2 == 0:
    return 'Even'
else:
    return 'Odd'

### FIXED CODE ###

a, b = map(int, input().split())
if a*b%2==0:
    print('Even')
else:
    print('Odd')
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
xyh = [None]*n
for i in range(n):
    x,y,h = map(int, input().split())
    xyh[i] = (x,y,h)
    
minh = min(item[2] for item in xyh) - 200
minh = max(minh, 1)
minh = max(item[2] for item in xyh) + 200
for i in range(101):
    for j in range(101):
        x,y,h = xyh[0]
        H = h + abs(x-i) + abs(y-j)
        bad = False
        for x,y,h in xyh:
            if max(0, H - abs(x-i) - abs(y-j))!=h:
                bad = True
                break
        if bad:
            continue
        else:
            ans = (i,j,H)
            break
    if not bad:
        break
print(" ".join(map(str, ans)))

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
xyh = [None]*n
for i in range(n):
    x,y,h = map(int, input().split())
    xyh[i] = (x,y,h)
ans = []
bx,by,bh = max(xyh, key=lambda p: p[2])
for i in range(101):
    for j in range(101):
        H = bh + abs(bx-i) + abs(by-j)
        bad = False
        for x,y,h in xyh:
            if max(0, H - abs(x-i) - abs(y-j))!=h:
                bad = True
                break
        if bad:
            pass
        else:
            ans = (i,j,H)
            break
    if not bad:
        break
print(" ".join(map(str, ans)))
import sys


def Sieve(N, AList):
    AList.sort()
    N_NotDivisible = 0
    while( len(AList) > 0 ):
        if(len(AList) > 1):
            if(AList[0]!= AList[1]):
                N_NotDivisible+= 1
                value = AList[0]
                pops = [0]
                for i in range(1, len(AList)):
                    if(AList[i]%value==0):
                        pops.append(i)
                AList.pop(pops)
            else:
                index = 2
                while(index < len(AList) and AList[index-1] == AList[index]):
                    index += 1
                for i in range(index):
                    AList.pop(0)

        else:
            N_NotDivisible+= 1
            break
    #print(Mins)
    return N_NotDivisible

if(__name__ == "__main__"):

    N = int( input().strip() )
    AList_str = input().strip().split()

    AList = [0] * N
    for i in range(N):
        AList[i] = int(AList_str[i])
    N_NotDivisible= Sieve(N, AList)
    print(N_NotDivisible)


### FIXED CODE ###

import sys

def Sieve2(N, AList, Bools, Max_A):
    N_NotDivisible = 0
    value = 0
    for i in range(N):
        if(AList[i]>value):
            value = AList[i]
            if(Bools[value]==True):
                N_NotDivisible += 1

            for j in range(2, Max_A//value+1, 1 ):
                Bools[j*value] = False
    #print(Mins)
    return N_NotDivisible


if(__name__ == "__main__"):

    N = int( input().strip() )
    AList_str = input().strip().split()
    Max = 0
    AList = [0] * N
    for i in range(N):
        AList[i] = int(AList_str[i])
        Max = max(AList[i], Max)
    Bools = [False] * (Max+1)
    AList.sort()
    Dups = []
    for Num in range(N):
        value = AList[Num]
        Bools[value] = True
        if(Num < N-1 and AList[Num] == AList[Num+1]):
            Dups.append(value)
    for Num in range(len(Dups)):
        value = Dups[Num]
        Bools[value] = False


    N_NotDivisible= Sieve2(N, AList, Bools, Max)
    print(N_NotDivisible)
import math

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n > s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))):
            if func((n-s)/p+1, n) == s:
                ans = int((n-s)/p+1)
print(ans)

### FIXED CODE ###

import math

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n < s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))+1):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))+1):
            b = int((n-s)/p+1)
            if b >= 2 and func(b, n) == s:
                ans = b
print(ans)
N = int(input())
a = list(input().space())
b = list(input.space())

ans = 0
for n in range(N):
    ap = a[:n]
    bp = b[n-1:]
    apsum = sum(ap)
    bpsum = sum(bp)
    s = apsum +bpsum
    if s > ans:
        ans = s
print(ans)


### FIXED CODE ###

N = int(input())
a = list(int(i) for i in input().split())
b = list(int(i) for i in input().split())

ans = 0
for n in range(N+1):
    ap = a[:n]
    bp = b[n-1:]
    apsum = sum(ap)
    bpsum = sum(bp)
    s = apsum +bpsum
    if s > ans:
        ans = s
print(ans)
while True:
    a=input()
    if a=='-':
        break
     else:
        n=int(input())
        for i in range(n):
             h=int(input())
             a=a[h:]+a[:h]
    print(a)

### FIXED CODE ###

while True:
    a=raw_input()
    if a=='-':
        break
    else:
        n=int(raw_input())
        for i in range(n):
             h=int(raw_input())
             a=a[h:]+a[:h]
    print a
n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] == "A":
        num[s-1] = c
    elif num[s-1] != "A" and num[s-1] != c:
        print(-1)
        exit()

for j in range(3):
    if num[j] == "A":
        num[j] = 0
    if num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))


### FIXED CODE ###

n, m = map(int, input().split())
num = ["A"] * n
for i in range(m):
    s, c = map(int, input().split())
    if n>1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s - 1] != "A" and num[s - 1] != c:
        print(-1)
        exit()
    num[s - 1] = c

for j in range(n):
    if num[j] == "A":
        num[j] = 0
    if n>1 and num[0] == 0:
        num[0] = 1
print(int("".join(map(str, num))))
N,M = map(int,input().split())
E = [[] for _ in range(N)]
for i in range(M):
  x,y = map(int,input().split())
  x -= 1
  y -= 1
  E[x].append(y)
#print(E)

# dp[i]:頂点iを始点とする最長パスの長さ
dp = [-1 for _ in range(N)]

def rec(v):
  if dp[v] != -1:
    return dp[v]
  res = 0
  for u in E[v]:
    res = max(res, rec(u)+1)
  dp[v] = res
  return dp[v]

for i in range(N):
  rec(i)
print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N,M = map(int,input().split())
E = [[] for _ in range(N)]
for i in range(M):
  x,y = map(int,input().split())
  x -= 1
  y -= 1
  E[x].append(y)
#print(E)

# dp[i]:頂点iを始点とする最長パスの長さ
dp = [-1 for _ in range(N)]

def rec(v):
  if dp[v] != -1:
    return dp[v]
  res = 0
  for u in E[v]:
    res = max(res, rec(u)+1)
  dp[v] = res
  return dp[v]

for i in range(N):
  rec(i)
print(max(dp))
import math
n = int(input())
ls = "abcdefghijklmnopqrstuvwxyz"
cnt = 0

while 26 ** (cnt + 1) < 25 * n / 26 + 1:
    cnt += 1
ans = ""
#print(cnt, n)
n -= 1
for i in range(cnt, -1, -1):
    if i == 0:
        res = n // (26 ** i)
    else:
        res = n // (26 ** i) - 1
    ans += ls[res]
    n -= 26 ** i * (res + 1)
print(ans)

### FIXED CODE ###

import math
n = int(input())
ls = "abcdefghijklmnopqrstuvwxyz"
cnt = 0
base = 26
while n >= base ** cnt:
    n -= base ** cnt
    cnt += 1
ans = ""
#print(cnt, n)
for i in range(cnt-1, -1, -1):
    res = n // (base ** i)
    ans += ls[res]
    n -= base ** i * res
print(ans)
List = [input() for _ in range(5)]

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

minUnitsPlace = min(unitsPlace)

ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]

res = sum(ceilList) + minUnitsPlace - 10

print(res)

### FIXED CODE ###

List = [input() for _ in range(5)]

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

if unitsPlace==[]:
    res = sum([int(List[i]) for i in range(5)])
    print(res)
else:
    minUnitsPlace = min(unitsPlace)
    
    ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]
    res = sum(ceilList) + minUnitsPlace - 10
    
    print(res)
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for q in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

sam = sum(A)
baketu = [0]*(10**5)
for a in A:
    baketu[a] += 1

for q in range(Q):
    sam = sam + baketu[B[q]] * (C[q] - B[q])
    baketu[C[q]] += baketu[B[q]]
    baketu[B[q]] = 0
    print(sam)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for q in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

sam = sum(A)
baketu = [0]*(100001)
for a in A:
    baketu[a] += 1

for q in range(Q):
    sam = sam + baketu[B[q]] * (C[q] - B[q])
    baketu[C[q]] += baketu[B[q]]
    baketu[B[q]] = 0
    #print(baketu)
    print(sam)
N, T = map(int, input().split())

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

discount = 0
for i in range(N - 1):
    if t[i + 1] - t[i] < T:
        discount += (T - (t[i + 1] - t[i]))

X = N * T - discount

print(X

### FIXED CODE ###

N, T = map(int, input().split())

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

discount = 0
for i in range(N - 1):
    if t[i + 1] - t[i] < T:
        discount += (T - (t[i + 1] - t[i]))

X = N * T - discount

print(X)
A,B,C,D,E=map(int,input().split())
if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else E == 0:
    print(5)


### FIXED CODE ###

A,B,C,D,E=map(int,input().split())

if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else:
    print(5)
W, H, x, y = map(int, input().split())
s = H*W/2

if x*2 == W and y*2 == H:
    print(s, 1)
else:
    print(s, 0)

### FIXED CODE ###

X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)
N = int(input())
A = list(map(int, input()))
A.sort()
print(A[N//2] - A[N//2 - 1])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
print(abs(A[N//2]-A[N//2-1]))
a = input()
n = input()
m = input()
first = a.split(" ")
N = n.split(" ")
M = m.split(" ")

totaltime = 0
count = 1
for i in range(int(first[1]) + int(first[0])):
  if totaltime + int(N[0]) > int(first[2]) or totaltime + int(M[0]) > int(first[2]):
    break
  if int(N[0]) < int(M[0]):
    totaltime += int(N[0])
    N.remove(N[0])
    count += 1
  elif int(M[0]) < int(N[0]):
    totaltime += int(M[0])
    M.remove(M[0])
    count += 1
print(count)

### FIXED CODE ###

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
    ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
ソースコード 拡げる

Copy
Copy
import math
import itertools
 
N=int(input())
P=[]
all_dist=[]
 
 
def Len(X,Y):
    return math.sqrt((X[0]-Y[0])**2+(X[1]-Y[1])**2)
 
for _ in range(N):
    a,b=map(int,input().split())
    P.append([a,b])
#print('townmap_is',P)
 
route=list(itertools.permutations(P))
#print(route)
 
for k in range(math.factorial(N)):
    B=0
    A=list(route[k])
    for i in range(len(A)-1):
        B+=Len(A[i],A[i+1])
    all_dist.append(B)
ans=sum(all_dist)/len(all_dist)
 
print(str(ans))

### FIXED CODE ###

import math
import itertools
 
N=int(input())
P=[]
all_dist=[]
 
def Len(X,Y):
    return math.sqrt((X[0]-Y[0])**2+(X[1]-Y[1])**2)

for _ in range(N):
    a,b=map(int,input().split())
    P.append([a,b])
#print('townmap_is',P)
 
route=list(itertools.permutations(P))
#print(route)
 
for k in range(math.factorial(N)):
    B=0
    A=list(route[k])
    for i in range(len(A)-1):
        B+=Len(A[i],A[i+1])
    all_dist.append(B)
ans=sum(all_dist)/len(all_dist)
 
print(str(ans))
def pathSmMax(matrix,i,j,cache):
    if i > len(matrix)-1: return 0
    happiness = 0
    if cache[i][j] != 0:
        return cache[i][j]
    for k in range(3):
        if k != j:
            happiness = max(happiness,pathSmMax(matrix,i+1,k,cache) + matrix[i][j])
    cache[i][j] = happiness
    return cache[i][j]
N = int(input())
matrix = []
for i in range(N):
	matrix.append([int(i) for i in input().split()])
maxs = -float("inf")
cache = [[0 for i in range(4)] for j in range(len(matrix)+1)]
for i in range(len(matrix)):
    maxs = max(maxs,pathSmMax(matrix,0,i,cache))
print(maxs)

### FIXED CODE ###

N = int(input())
matrix = []
for i in range(N):
    matrix.append([int(i) for i in input().split()])
ans = -float("inf")
dp = [[0 for i in range(4)] for j in range(len(matrix)+1)]
for i in range(len(matrix)-1,-1,-1):
    for j in range(len(matrix[0])-1,-1,-1):
        dp[i][j] = -float("inf")
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j],dp[i+1][k]+matrix[i][j])
        ans = max(ans,dp[i][j])
print(ans)
# n,m = map(int,input().split())
h_list = list(map(int,input().split()))
roads = []
for i in range(m):
    a,b = map(int,input().split())
    roads.append([a,b])
#print(roads)
terrace = [1] * n
for road in roads:
    if h_list[road[0]-1] > h_list[road[1]-1]:
        terrace[road[1]-1] = 0
    elif h_list[road[0]-1] == h_list[road[1]-1]:
        terrace[road[0]-1] = 0
        terrace[road[1]-1] = 0
    elif h_list[road[0]-1] < h_list[road[1]-1]:
        terrace[road[0]-1] = 0
print(terrace.count(1))

### FIXED CODE ###

n,m = map(int,input().split())
h_list = list(map(int,input().split()))
roads = []
for i in range(m):
    a,b = map(int,input().split())
    roads.append([a,b])
#print(roads)
terrace = [1] * n
for road in roads:
    if h_list[road[0]-1] > h_list[road[1]-1]:
        terrace[road[1]-1] = 0
    elif h_list[road[0]-1] == h_list[road[1]-1]:
        terrace[road[0]-1] = 0
        terrace[road[1]-1] = 0
    elif h_list[road[0]-1] < h_list[road[1]-1]:
        terrace[road[0]-1] = 0
print(terrace.count(1))
a = input()
print a*(a+1)/2


### FIXED CODE ###

a = input()
print a*(a+1)/2
d = [int(input()) for i in range(0, 3)]
print("Hello World" if d[0] == 1 else sum(d[1:]))

### FIXED CODE ###

n = int(input())
print("Hello World" if n == 1 else sum([int(input()) for i in range(0, 2)]))
import math
a, b, k =map(int, input().split())
divesor_list = []
if min(a, b) == 1:
    divesor_list = [1]
else:
    for i in range(min(a, b), 0, -1):
            if gcd % i == 0:
                divesor_list.append(i)
print(divesor_list[k-1])

### FIXED CODE ###

import math
a, b, k =map(int, input().split())
divesor_list = []
c = min(a, b)
if c == 1:
    divesor_list = [1]
else:
    for i in range(c, 0, -1):
            if (a % i == 0) & (b % i == 0):
                divesor_list.append(i)
print(divesor_list[k-1])
from collections import deque

def num_way(stair):
  if stair == 1 or stair == 0:
    return 1
  elif stair == 2:
    return 2
  else:
    return num_way(stair-1) + num_way(stair-2)

N, M = map(int,input().split())
a = deque([0])
path_poss = 1
ans = 1
for m in range(M):
  start = a.popleft()
  buff = int(input())
  end = buff-1
  if (end-start) <= -1:
    path_poss = 0
    break
  a.append(buff+1)
  ans *= num_way(end-start)
  ans %= 1000000007

if path_poss == 0:
  print(0)
else:
  start = a.popleft()
  end = N
  ans *= num_way(end-start)
  print(ans%1000000007)
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from collections import deque

def num_way(stair):
  memo = ["EMPTY"]*(stair+1)
  def _fib(stair):
    if stair == 1 or stair == 0:
      return 1
    elif stair == 2:
      return 2
    elif memo[stair] != "EMPTY":
      return memo[stair]
    else:
      memo[stair] = _fib(stair-1)+_fib(stair-2)
      return memo[stair]
  return _fib(stair)

N, M = map(int,input().split())
a = deque([0])
path_poss = 1
ans = 1
for m in range(M):
  start = a.popleft()
  buff = int(input())
  end = buff-1
  if (end-start) <= -1:
    path_poss = 0
    break
  a.append(buff+1)
  ans *= num_way(end-start)
  ans %= 1000000007

if path_poss == 0:
  print(0)
else:
  start = a.popleft()
  end = N
  if(end-start) <= -1:
    path_poss = 0
  if path_poss == 0:
    print(0)
  else:
    ans *= num_way(end-start)
    print(ans%1000000007)
N=int(input())
T=int(input())
A=int(input())

def abs_1(x):
    return abs(A-(T-x*0.006))

H=[]
for i in range(N):
    H.append(int(input()))
abslists=list(map(abs_1,H))

print(abslists)

print(min(abslists))

print(abslists.index(min(abslists))+1)

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)
n, total = map(int, input().split())
min = n * 1000
max = n * 10000
if (total > max) or (total < min):
  print('-1 -1 -1')
else
  min_man = total - (5000 * n) // 10000
  n -= min_man
  total -= min_man*10000
  min_sen = (total % 5000) / 1000
  total -= min_sen*1000
  n -= min_sen
  success = False
  for i in range(total // 10000):
    if success:
      break
    ii = total - i*10000
    for j in range(ii // 5000):
      jj = ii - j*5000
      k = jj/1000
      if i + j + k == n:
        print(str(i+min_man) + ' ' + str(j) + ' ' + str(k+min_sen))
        success = True
        break
     
  if not success:
    print('-1 -1 -1')

### FIXED CODE ###

n, total = map(int, input().split())
# n, total = 2000, 20000000
min = n * 1000
max = n * 10000
if (total > max) or (total < min):
    print('-1 -1 -1')
else:
    min_man = (total - (5000 * n)) // 10000 if total - (5000 * n) > 0 else 0
    n -= min_man
    total -= min_man*10000
    min_sen = (total % 5000) // 1000
    total -= min_sen*1000
    n -= min_sen
    success = False
    if total == 0:
        print(str(min_man) + ' 0 ' + str(min_sen))
    else:
        for i in range(int(total // 10000)+1):
            if success:
                break
            ii = total - i*10000
            for j in range(int(ii // 5000)+1):
                jj = ii - j*5000
                k = jj//1000
                if i + j + k == n:
                    print(str(i+min_man) + ' ' + str(j) + ' ' + str(k+min_sen))
                    success = True
                    break

        if not success:
            print('-1 -1 -1')