Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N_all = int(readline())
A_all = list(map(int,readline().split()))
A = [A_all[0]]
for i in range(1,N_all):
    if A[-1] != A_all[i]:
        A.append(A_all[i])
N = len(A) 
money = 1000
kabu = 0 
for i in range(N):
    money += A[i]*kabu
    kabu = 0
    if i == 0:
        if A[i] < A[i+1]:
        	kabu = money // A[i]
        	money -= kabu * A[i]
    elif i == N-1:
        continue
    else:
        if A[i-1] > A[i] and A[i] < A[i+1]:
            kabu = money // A[i]
            money -= kabu * A[i]
print(money)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N_all = int(readline())
A_all = list(map(int,readline().split()))
A = [A_all[0]]
for i in range(1,N_all):
    if A[-1] != A_all[i]:
        A.append(A_all[i])
N = len(A) 
if N == 1:
    print(1000)
    sys.exit()
money = 1000
kabu = 0 
for i in range(N):
    if i == 0:
        if A[i] > A[i+1]:
            continue
        else:
        	kabu = money // A[i]
        	money -= kabu * A[i]
    elif i == N-1:
        money += A[i]*kabu
        kabu = 0
    else:
        if A[i-1] < A[i] and A[i] > A[i+1]:
            money += A[i]*kabu
            kabu = 0
        if A[i-1] > A[i] and A[i] < A[i+1]:
            kabu = money // A[i]
            money -= kabu * A[i]
print(money)
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))+1))):
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%i==0:
        ans=i
        break:
print(ans)

### FIXED CODE ###

import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(round(math.pow(P,(1/N)))+1)):
    tmp=math.pow(i,N)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)
S = input()
K = int(input())

k = -1
while S[k+1] == "1":
  k += 1

if K <= k:
  print(1)
else:
  print(S[k+1])

### FIXED CODE ###

import sys
S = input()
K = int(input())

for i in range(K):
  if S[i] != "1":
    print(S[i])
    sys.exit()
print(1)
s = int(input())
t = input()

if len(t) =< s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

### FIXED CODE ###

s = int(input())
t = input()

if len(t) <= s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")
n,m=map(int,input().split())
# a,b,c=map(int,input().split())
# s=input()
# s,t=map(str,input().split())
ans=[0]*n
anss=""
l=[]
L=[]
for i in range(m):
  s,c=map(int,input().split())
  l.append(str(s)+str(c))
  if s==1 and c==0:
    print(-1)
    exit()

l=list(set(l))
for x in l:
  L.append([x[0],x[1]])
X=[]

for i in range(len(L)):

  ans[int(L[i][0])-1] = int(L[i][1])
  if L[i][0] in X:
    print(-1)
    exit()
  else:
      X.append(L[i][0])
print(ans)
if ans[0]==0:
  if n!=1:
    ans[0]="1"
    for x in ans:
      anss+=str(x)
      print(anss)
  else:
    print(0)
else:
  for x in ans:
    anss+=str(x)
  print(anss)

### FIXED CODE ###


# n,m=map(int,input().split())
# a,b,c=map(int,input().split())
# s=input()
# s,t=map(str,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
L=[]
L.append(A)
L.append(B)
L.append(C)
n=int(input())

for i in range(n):
  x=int(input())
  for a in range(3):
    for b in range(3):
      if L[a][b] == x:
        L[a][b]=0

if L[0][0]==0 and L[0][1]==0 and L[0][2]==0:
  print("Yes")
  exit()

if L[1][0]==0 and L[1][1]==0 and L[1][2]==0:
  print("Yes")
  exit()

if L[2][0]==0 and L[2][1]==0 and L[2][2]==0:
  print("Yes")
  exit()

if L[0][0]==0 and L[1][0]==0 and L[2][0]==0:
  print("Yes")
  exit()
if L[0][1]==0 and L[1][1]==0 and L[2][1]==0:
  print("Yes")
  exit()
if L[0][2]==0 and L[1][2]==0 and L[2][2]==0:
  print("Yes")
  exit() 
if L[0][0]==0 and L[1][1]==0 and L[2][2]==0:
  print("Yes")
  exit()
if L[0][2]==0 and L[1][1]==0 and L[2][0]==0:
  print("Yes")
  exit()


print("No")
import sys

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

array = [[int(x) for x in input().split()] for x in range(m)]

if m == 0 or m == 1:
    print(1)
    sys.exit()

adjacency_list = [[] for x in range(m + 1)]

for i in array:
    adjacency_list[i[0]].append(i[1])
    adjacency_list[i[1]].append(i[0])

searched = [False for x in range(m+1)]


def calc(start, maze, searched):
    res = 0
    if searched[start]:
        return 0
    searched[start] = True

    if searched.count(True) == n:
        return 1
    else:
        for next in maze[start]:
            res += calc(next, maze, list(searched))
    return res


print(calc(1, adjacency_list, searched))


### FIXED CODE ###

import sys

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

array = [[int(x) for x in input().split()] for x in range(m)]

if m == 0:
    print(0)
    sys.exit()

adj_array = [[] for x in range(n + 1)]
res_array = [True] + [False for x in range(n)]
for item in array:
    adj_array[item[0]].append(item[1])
    adj_array[item[1]].append(item[0])


def dfs(n, res_array, res):
    res_array[n] = True
    if False not in res_array:
        return res+1
    else:
        for next in adj_array[n]:
            if not res_array[next]:
                res = dfs(next, list(res_array), res)
    return res


res = 0
res_array[1] = True
print(dfs(1, res_array, res))
N = int(input())
C=[0]*(N-1)
for i in range(N-1):
	C[i]=i+1
print(sum(C))


### FIXED CODE ###

N = int(input())
N-=1
print(N*(N+1)//2)
trees_num, illuminations_num = map(int, input().split())
trees = sorted(int(input()) for _ in range(trees_num))

diffs = []

for i in range(trees_num - illuminations_num + 1):
    h_max = max(trees[i:illuminations_num+1])
    h_min = min(trees[i:illuminations_num+1])

    diffs.append(h_max - h_min)

print(min(diffs))


### FIXED CODE ###

trees_num, illuminations_num = map(int, input().split())
trees = sorted(int(input()) for _ in range(trees_num))

diffs = []

for i in range(trees_num - illuminations_num + 1):
    diffs.append(trees[i+illuminations_num-1] - trees[i])

print(min(diffs))
a, b = map(int, input())

if a < b:
  print(a)
else:
  print(a-1)

### FIXED CODE ###

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

if a <= b:
  print(a)
else:
  print(a-1)
import sys
N,M = map(int,input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

cnt = 0
if A < B:
    print('No')
    sys.exit()
else:
    for i in range(N):
        for j in range(M):
            if B[j] in A[i]:
                cnt+=1
                flag = True
            else:
                cnt = 0
                flag = False
        	if cnt == M:
            	break
if flag:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

def comp(x,y):
    for i in range(M):
        for j in range(M):
            if A[x+i][y+j] != B[i][j]:
                return False
    return True
flag = False
for i in range(N-M+1):
    for j in range(N-M+1):
        if comp(i,j):
            flag = True
            break
if flag:
    print('Yes')
else:
    print('No')
n = list(input())
m = sum(n)
if m % 9 == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = list(input())
x = 0
for i in range(len(n)):
    x += int(n[i])
if x % 9 == 0:
    print("Yes")
else:
    print("No")
a, b = map(int, input().split())
for i in range(1, 4):
  if a != i and b!= i:
    print(i)

### FIXED CODE ###

a, b = int(input()), int(input())
for i in range(1, 4):
  if a != i and b!= i:
    print(i)
N, X = map(int, input().split())

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X): 
if N == 0:
    return 0 if X <= 0 else 1
elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))

### FIXED CODE ###

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

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X): 
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))
#!/usr/bin/env python3
#E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def comb(n, r):
    return fact[n]*pow(fact[n-r], mod-2, mod)*pow(fact[r], mod-2, mod) % mod
n = I()
ab = [LI() for _ in range(n)]
ans = pow(2, n, mod) - 1
fact = [1]*(n+1)
for i in range(1, n+1):
    fact[i] = i * fact[i-1]
    fact[i] %= mod

x = []
y = []
for a, b in ab:
    if a == 0 and b == 0:
        ans -= pow(2, n-1, mod) - 1
        ans %= mod
        n -= 1
    elif a == 0:
        x.append(0)
        y.append(-inf)
    elif b == 0:
        x.append(inf)
        y.append(0)
    else:
        x.append(a/b)
        y.append(-b/a)
lst = defaultdict(lambda : 0)
z = defaultdict(lambda : 0)
for i,j in enumerate(x):
    if z[j]:
        lst[j] = max(lst[j], z[j]+1)
    z[y[i]] += 1

for i in lst.values():
    j = 0
    while j + 1 < i:
        ans -= comb(i, j+2) * pow(2, n - (i-(j+2)) - (j+2), mod)
        ans %= mod
        j += 1
    n -= i
print(ans)




### FIXED CODE ###

#!/usr/bin/env python3
#E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def comb(n, r):
    return fact[n]*pow(fact[n-r], mod-2, mod)*pow(fact[r], mod-2, mod) % mod
n = I()
ab = [LI() for _ in range(n)]

fact = [1]*(n+1)
for i in range(1, n+1):
    fact[i] = i * fact[i-1]
    fact[i] %= mod

x = defaultdict(lambda : 0)
y = defaultdict(lambda : 0)
z = defaultdict(lambda : 0)
tmp = 0
for a, b in ab:
    if a == 0 and b == 0:
        tmp += 1
    elif a == 0:
        x[0] += 1
        z[0] = 1
    elif b == 0:
        y[0] += 1
        z[0] = 1
    else:
        if a * b > 0:
            g = math.gcd(a, b)
            a //= g
            b //= g
            x[(abs(a), abs(b))] += 1
            z[(abs(a), abs(b))] = 1
        else:
            g = math.gcd(a, b)
            a //= g
            b //= g
            y[(abs(b), abs(a))] += 1
            z[(abs(b), abs(a))] = 1

ans = 1
for i in z.keys():
    ans *= (2**x[i] + 2**y[i] - 1)
    ans %= mod
ans -= 1
ans += tmp
ans %= mod
print(ans)
n, a = map(int,input().split( ))

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

for i in range(n):
    x[i] -= a
mx = max(x)*n+1

dp = [[0 for i in range(3*mx)] for j in range(n)]
dp[0][0] += 1
dp[0][x[0]] += 1

for i in range(1,n) :
    for j in range(-mx,mx):
        dp[i][j] += dp[i-1][j-x[i]]
        dp[i][j] += dp[i-1][j]
    #print(*dp[i])
print(dp[n-1][0]-1)


### FIXED CODE ###

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

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

for i in range(n):
    x[i] -= a

mx = 0
for i in range(n):
    mx += abs(x[i])
mx +=1

dp = [[0 for i in range(3*mx)] for j in range(n)]
dp[0][0] += 1
dp[0][x[0]] += 1

for i in range(1,n) :
    for j in range(-mx,mx):
        dp[i][j] += dp[i-1][j-x[i]]
        dp[i][j] += dp[i-1][j]
    #print(*dp[i])
print(dp[n-1][0]-1)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
for i in range(0, n):
    a = long(raw_input());
    b = long(raw_input());
    if math.log10(a + b) > 80:
        print "overflow"
    else:
        print a + b;

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = int(raw_input());
over = 10 ** 80;
for i in range(0, n):
    a = int(raw_input());
    b = int(raw_input());
    if a + b >= over:
        print "overflow"
    else:
        print a + b;
H = int(input())
x = 2
for i in range(50):
  if x <= H and x*2 > H:
    ans = x*2 - 1
    break
  x = x*2
  
if x == 1:
  ans = 1

print(ans)

### FIXED CODE ###

H = int(input())
x = 2
for i in range(41):
  if x <= H and x*2 > H:
    ans = x*2 - 1
    break
  x = x*2
  
if H == 1:
  ans = 1

print(ans)
A =[input() for i in range(3)]
if A[0]+A[1]>=A[2]:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

A =list(map(int, input().split()))
if A[0]+A[1]>=A[2]:
    print('Yes')
else:
    print('No')
num,ave = map(int,input().split())
numx = list(map(int,input().split()))

L = len(numx)
numy = [0] * L
for i in range(L):
    numy[i] = numx[i] - ave

if abs(min(numy)) < abs(max(numy)):
    maxX = max(numy)
else:
    maxX = abs(min(numy))

dp = [[0]*(2*maxX*L+1) for _ in range(L+1)]
dp[0][maxX*L] = 1
for i in range(L):
    for j in range(2*maxX*L+1):
        if (j-numy[i]) < 0 or (j - numy[i]) > 2*maxX*L:
            dp[i+1][j] = dp[i][j]
        else
        dp[i+1][j] = dp[i][j] + dp[i][j-numy[i]]
print(dp[L][maxX*L]-1)

### FIXED CODE ###

num,ave = map(int,input().split())
numx = list(map(int,input().split()))

L = len(numx)
numy = [0] * L
for i in range(L):
    numy[i] = numx[i] - ave

if abs(min(numy)) < abs(max(numy)):
    maxX = max(numy)
else:
    maxX = abs(min(numy))

dp = [[0]*(2*maxX*L+1) for _ in range(L+1)]
dp[0][maxX*L] = 1
for i in range(L):
    for j in range(2*maxX*L+1):
        if (j-numy[i]) < 0 or (j - numy[i]) > 2*maxX*L:
          dp[i+1][j] = dp[i][j]
        else:
          dp[i+1][j] = dp[i][j] + dp[i][j-numy[i]]
print(dp[L][maxX*L]-1)
s = input.split()
a, b = map(int, input.split())
u = input()

if(u in s[0]):
    print(str(a - 1) + ' ' + str(b))
elif(u in s[1]):
    print(str(a) + ' ' + str(b - 1))
else:
    print(str(a) + ' ' + str(b))


### FIXED CODE ###

from sys import stdin

s, t = stdin.readline().rstrip().split()
a, b = [int(x) for x in stdin.readline().rstrip().split()]
u = input()

if (u in s):
    print(str(a - 1) + ' ' + str(b))
elif (u in t):
    print(str(a) + ' ' + str(b - 1))
else:
    print(str(a) + ' ' + str(b))
import fractions
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
mx = a[-1]
if mx < k:
    ans = 'IMPOSSIBLE'
else:
    gcd = fractions.gcd(a[0],a[1])
    for i in range(2,n):
        tmp_gcd = fractions.gcd(gcd,a[i])
        if tmp_gcd < gcd:
            gcd = tmp_gcd
    if k % gcd == 0:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
print(ans)

### FIXED CODE ###

import fractions
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
mx = a[-1]
if mx < k:
    ans = 'IMPOSSIBLE'
elif n == 1:
    if a[0] == k:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
else:
    gcd = fractions.gcd(a[0],a[1])
    for i in range(0,n):
        gcd = fractions.gcd(gcd,a[i])
    if k % gcd == 0:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
print(ans)
s = string(input())

cnt = 0;

for temp in s:
    if temp == "1":
        cnt += 1
    print(cnt)

### FIXED CODE ###

s = input()

cnt = 0;

for temp in s:
    if temp == "1":
        cnt += 1
print (cnt)
X,N = map(int,input().split())
p = input().split()

for i in range(N):
    p[i] = int(p[i])
    
if N == 0:
    print(X)
else:    
    for i in range(1,N+1):
        if not (X+i) in p:
            print(X+i)
            break
        elif not (X-i) in p:
            print(x-i)

### FIXED CODE ###

X,N = map(int,input().split())
if N != 0:
  p = input().split()

for i in range(N):
    p[i] = int(p[i])
    
if N == 0:
    print(X)
else:    
    for i in range(2*N):
        if not (X-i) in p:
            print(X-i)
            break
        elif not (X+i) in p:
            print(X+i)
            break
        else:
          continue
n, q = map(int, input().split())

root = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    root[a-1].append(b-1)
# print(root)

ans = [0 for _ in range(n)]
def f(r, y):
    for j in root[r]:
        ans[j] += y
        # print(ans)
        s = j
        f(s, y)

for i in range(q):
    p, x = map(int, input().split())
    ans[p-1] += x
    # print(ans)
    f(p-1, x)

ans = map(str, ans)
print(" ".join(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n, q = map(int, input().split())
tree = [[] for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    tree[a].append(b)
    tree[b].append(a)

ans = [0 for _ in range(n)]

for _ in range(q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

checked = [False] * n
checked[0] = True


def function(now, count):
    ans[now] += count
    for i in tree[now]:
        if checked[i] == False:
            checked[i] = True
            function(i, ans[now])

function(0, 0)

for a in ans:
    print(a)
print(A*B)

### FIXED CODE ###

a,b = (int(x) for x in input().split())
print(a*b)
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
W=S[K-1]
for i in range(N):
  if S[i]!=W:
    S=S.replace(S[i],'*')
print(S)
N = int(intput())
H = list(map(int, input().split()))

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    h = max_H
    ans += 1

print(ans)

### FIXED CODE ###

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

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    max_H = h
    ans += 1

print(ans)
from collections import deque
import math
mod = 10**9+7
N,K = map(int,input().split())

def fact(x):
    a = 1
    for i in range(x):
        a *= i+1
        a = a%mod
    return a

#KPxの計算用。一回だけ使う
def Perm(n,r):#aPb
    return fact(n) // fact(n - r)

#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)


ans = Perm(K,len(child[0])+1)%mod
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)



### FIXED CODE ###

from collections import deque
import math
import sys
mod = 10**9+7
N,K = map(int,input().split())

#k
Kperm =[1,K]
pre = K
for i in range(2,K+1):
    pre = (pre*(K+1-i))%mod
    Kperm.append(pre)


#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)

if len(child[0])>=K:
    print(0);sys.exit()
ans = Kperm[len(child[0])+1]
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0 and len(child[cur])>=K:
        print(0)
        sys.exit()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)
import copy
x,n = list(map(int, input("").split()))
p = list(map(int, input("").split()))

mina =101
y = []
minc = []

if x not in p:
    print(x)
    exit()

for i in range(1,101):
    y.append(i)

if n == 0:
    print(x)
else:
    for j in range(n):
        y.remove(p[j])

    z = copy.copy(y)

    for k in range(len(y)):
        if abs(x - y[k]) < mina:
            mina = abs(x - y[k])
            minb = y[k]
            z.remove(minb)

    minc.append(minb)
    mina = 101

    for m in range(len(z)):
        if abs(x - z[m]) < mina:
            mina = abs(x - z[m])
            minb = z[m]

    minc.append(minb)

    print(min(minc))

### FIXED CODE ###

x,n = list(map(int, input("").split()))
p = list(map(int, input("").split()))

for i in range(101):
    if x-i not in p:
        print(x-i)
        exit()
    elif x+i not in p:
        print(x+i)
        exit()
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])


for x in range(N):
    for y in range(N):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y :
            otoshidama = [x,y,N-x-y]
        else:
            pass

print(otoshidama[0]," ",otoshidama[1]," ",otoshidama[2])   

### FIXED CODE ###

setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])
A = -1
B = -1
C = -1

for x in range(N+1):
    for y in range(N+1):
        if N-x-y >= 0:
            if 10000*x + 5000*y + 1000*(N-x-y) == Y :
                A , B , C = x ,y,N-x-y
                break
    else:
            continue
    break
print(A," ",B," ",C)
N = input()
S = 0
for i in range(len(N)):
    S += int(N[i])
if N % S == 0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = input()
S = 0
for i in range(len(N)):
    S += int(N[i])
if int(N) % S == 0:
    print('Yes')
else:
    print('No')
W, H, x, y, r = map(int, raw_input().split())
if x + r < 0 or x + r > W or y + r < 0 or y + r > H:
print "No"
else:
print "Yes"

### FIXED CODE ###

W, H, x, y, r = map(int, raw_input().split())
if r <= x and r <= W - x and r <= y and r <= H - y:
   print 'Yes'
else:
   print 'No'
N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0

for i in range(N):
  if A[i] not in array:
    array.append(A[i])
    if A.count(A[i]) % 2 == 1:
      ans += 1
  print(i, array, ans)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0
A.sort()
count = 0

for i in range(N):
  count += 1
  if i == N-1:
    if count%2 == 1:
      ans += 1
#    print(A[i], count, ans)
    
#  elif A[i] == A[i+1]:
#    print(A[i], count, ans)
    
  elif A[i] != A[i+1]:
    if count % 2 == 1:
      ans += 1
#    print(A[i], count, ans)
    count = 0

print(ans)
A,B,C=map(int,input())
if((A==B and A!=C)or(B==C and B!=A)or(C==A and C!=B)):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A,B,C=map(int,input().split())
if((A==B and A!=C)or(B==C and B!=A)or(C==A and C!=B)):
  print("Yes")
else:
  print("No")
N = int(input())
alph = {key + 1: val for key, val in enumerate('abcdefghijklmnopqrstuvwxyz')}
answer = ''
while N >= 1:
  answer = alph[N % 26] + answer
  N //= 26

print(answer)

### FIXED CODE ###

N = int(input())
alph = {key + 1: val for key, val in enumerate('abcdefghijklmnopqrstuvwxyz')}
alph[0] = 'z'
answer = ''
while N >= 1:
  answer = alph[N % 26] + answer
  if N == 26:
    break
  N = (N - 1) // 26

print(answer)