Harryxun/stf_run huggingface dataset:
import sys
import math
from  collections import defaultdict

sys.setrecurisonlimit(1000000000)

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	n, w = map(int, input().split())
	val = [None] * n
	wgt = [None] * n
	for i in range(n):
		wgt[i], val[i] = map(int, input().split())
	dp = {}
	ans = knapsack(wgt, val, 0, n, dp, w)
	print(ans)

def knapsack(wgt, val, i, n, dp, w):
	if (i, w) in dp:
		return dp[(i, w)]
	elif i >= n:
		return 0
	else:
		dp[(i, w)] = knapsack(wgt, val, i + 1, n, dp, w)
		if wgt[i] <= w:
			dp[(i, w)] = max(dp[(i, w)], val[i] + knapsack(wgt, val, i + 1, n, dp, w - wgt[i]))
		return dp[(i, w)]


if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


### FIXED CODE ###

import sys
import math
from  collections import defaultdict


# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	n, w = map(int, input().split())
	val = [None] * n
	wgt = [None] * n
	for i in range(n):
		wgt[i], val[i] = map(int, input().split())
	dp = [[0 for j in range(w + 1)] for i in range(n + 1)]
	for i in range(1, n + 1):
		for j in range(1, w + 1):
			dp[i][j] = dp[i - 1][j]
			if wgt[i - 1] <= j:
				dp[i][j] = max(dp[i][j], val[i - 1] + dp[i - 1][j - wgt[i - 1]])
	ans = dp[-1][-1]
	print(ans)



if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)
T=0
X=1
Y=2
item = input()
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
    tabiji.append(input().split(' '))

a='Yes'
for i in range(0, len(tabiji)-1):
    time = int(tabiji[i+1][T]) - int(tabiji[i][T])
    dX = int(tabiji[i+1][X]) - int(tabiji[i][X])
    dY = int(tabiji[i+1][Y]) - int(tabiji[i][Y])
    for j in range(time):
        if dX > 0:
            dX -= 1
        elif dX < 0:
            dX += 1
        elif dY > 0:
            dY -= 1
        elif dY < 0:
            dY += 1
        if dX == 0 and dY == 0 and (time - j+1) % 2 == 1:
            a = 'No'
            break
        elif dX == 0 and dY == 0 and (time - j+1) % 2 == 0:
            break
    if dX != 0 or dY != 0:
        a = 'No'

print(a)

### FIXED CODE ###

item = input().split(' ')
if ((int(item[0]) * int(item[1])) % 2) == 0:
    print('Even')
else:
    print('Odd')
loop = input()
a = map(int, input().split())
cnt = 0

while(1):
  flg = 0
  for i in a:
    if(a%2 == 1):
      flg = 1
    else:
      i = i/2
      
  if(flg == 0):
    cnt += 1
  else:
    break

print(cnt)
  

### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
from collections import Counter

n = int(input())
x = [0]*n ; y = [0]*n
for i in range(n):
    x[i],y[i] = map(int, input().split())

dc_c = []
dc_c = []
dc_ans = []
for i in range(n-1):
    ii = 0
    d = [[-1]*2 for i in range(n-1)]
    for j in range(i,n):
        if i != j:
            d[ii][0] = abs(x[i]-x[j])
            d[ii][1] = abs(y[i]-y[j])
            ii += 1
    dc = Counter(map(tuple, d))
    dc_ans = Counter(dc_ans) + dc
dc_ans = dc_ans.most_common()
if dc_ans[0][0] == (-1, -1):
    print(n-dc_ans[1][1])
else:
    print(n-dc_ans[0][1])

### FIXED CODE ###

import sys

n = int(input())
x = [0]*n ; y = [0]*n
for i in range(n):
    x[i],y[i] = map(int, input().split())

if n == 1:
    print(1)
    sys.exit()

ans = []
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        p = x[i]-x[j]
        q = y[i]-y[j]
        count = 0
        for k in range(n):
            for l in range(n):
                if p == x[k]-x[l] and q == y[k]-y[l]:
                    count += 1
                ans.append(count)

print(n-max(ans))
n, k = map(int, input().split())
ans = 0
while True:
    if n // (k ** ans) == 0:
        break
    a += 1
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
ans = 0
while True:
    if n // (k ** ans) == 0:
        break
    ans += 1
print(ans)
# Next Prime
import numpy as np

# input
X = int(input())

# solve
primes = np.array([])
numbers = np.array(list(range(2, 10**5 + 1)))
while len(numbers) > 0:
    primes = np.append(primes, numbers[0])
    numbers = numbers[numbers % numbers[0] != 0]

res = int(min(primes[primes >= X]))

# output
print(res)

### FIXED CODE ###

# Next Prime
import numpy as np

# input
X = int(input())

# solve
prime = 0
numbers = np.array(list(range(2, 10**5 + 4)))

while prime < X:
    prime = numbers[0]
    numbers = numbers[numbers % prime != 0]

# output
print(prime)
C = []
C.append([int(i) for i in input().split()])

D_h = [[C[idx][jdx+1]-C[idx][jdx] for idx in range(2)] for jdx in range(2)]
D_v = [[C[idx+1][jdx]-C[idx][jdx] for idx in range(2)] for jdx in range(2)]

for idx in range(2):
	if D_h[0][idx] != D_h[1][idx]:
		print("No")
	elif D_h[0][idx] != D_h[2][idx]:
		print("No")

for idx in range(2):
	if D_v[0][idx] != D_v[1][idx]:
		print("No")
	elif D_v[0][idx] != D_v[2][idx]:
		print("No")

### FIXED CODE ###

C = []
for i in range(3):
	C.append([int(i) for i in input().split()])

D_h = [[C[idx][jdx+1]-C[idx][jdx] for idx in range(3)] for jdx in range(2)]
D_v = [[C[idx+1][jdx]-C[idx][jdx] for idx in range(2)] for jdx in range(3)]

for idx in range(2):
	if D_h[idx][0] != D_h[idx][1]:
		print("No")
		exit(0)
	elif D_h[idx][0] != D_h[idx][2]:
		print("No")
		exit(0)

for idx in range(2):
	if D_v[0][idx] != D_v[1][idx]:
		print("No")
		exit(0)
	elif D_v[0][idx] != D_v[2][idx]:
		print("No")
		exit(0)

print("Yes")
h,w = list(map(int,input().split()))
sx, sy = list(map(int,input().split()))
gx, gy = list(map(int,input().split()))
maze = [list(input()) for _ in range(h)]
sx -= 1; sy -= 1; gx -= 1; gy -= 1

mx = [0,1,0,-1]
my = [1,0,-1,0]
mazemap = [[10**9]*w for _ in range(h)]
from collections import deque
q = deque()
nq = deque()
q.append([sx,sy,0])

while q or nq:
    x,y,z = q.popleft() if q else nq.popleft()
    if x == gx and y == gy:
        ans = z
        break
    for i in range(4):
        nx = x + mx[i]; ny = y + my[i]
        if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z:
            q.append([nx,ny,z])
            mazemap[nx][ny] = z
            fast += 1
        for i in range(-2,3):
            for j in range(-2,3):
                nx = x+i; ny = y+j
                if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z+1:
                    nq.append([nx,ny,z+1])
                    mazemap[nx][ny] = z+1
else:
    ans = -1

print(ans)

### FIXED CODE ###

h,w = list(map(int,input().split()))
sx, sy = list(map(int,input().split()))
gx, gy = list(map(int,input().split()))
maze = [list(input()) for _ in range(h)]
sx -= 1; sy -= 1; gx -= 1; gy -= 1

mx = [0,1,0,-1]
my = [1,0,-1,0]
mazemap = [[10**9]*w for _ in range(h)]
from collections import deque
q = deque()
nq = deque()
q.append([sx,sy,0])

while q or nq:
    x,y,z = q.popleft() if q else nq.popleft()
    if x == gx and y == gy:
        ans = z
        break
    for i in range(4):
        nx = x + mx[i]; ny = y + my[i]
        if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z:
            q.append([nx,ny,z])
            mazemap[nx][ny] = z
        for i in range(-2,3):
            for j in range(-2,3):
                nx = x+i; ny = y+j
                if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z+1:
                    nq.append([nx,ny,z+1])
                    mazemap[nx][ny] = z+1
else:
    ans = -1

print(ans)
N = input()
if N >= 1000:
    print("ABD")
else:
    print("ABC")

### FIXED CODE ###

N = int(input())
if N >= 1000:
    print("ABD")
else:
    print("ABC")
def sig():
    key=[input()]   q
    a=key[0]
    if a =='0':
       key.append('0')
    elif a=='1':
       key.append('1')
    else:
       key.append('')
    for i in key:
        b=key[i]
        if b =='0':
           key.append('0')
        elif b=='1':   
           key.append('1')
        else:
            key.pop(i-1)

    print(key)

sig()


### FIXED CODE ###

def key():
    a=input()
    b=''
    for i in range(0,len(a)):
        if a[i]=='0':
            b+='0'
        elif a[i]=='1':
            b+='1'
        elif a[i]=='B':
            if len(b)==0:
                continue
            else:
                b=b[0:-1]
    print(b)

key()
import sys
N, M = map(int, input().split())
X = sorted(list(map(int,input().split())))
A = []
if M == 1:
    print(0)
    sys.exit()
for i in range(M - 1):
    dif = X[i + 1] - X[i]
    A.append(dif)
for i in range(N - 1):
    A.remove(max(A))
print(sum(A))

### FIXED CODE ###

import sys
N, M = map(int, input().split())
X = sorted(list(map(int,input().split())))
A = []
sum = 0
if N >= M:
    print(0)
    sys.exit()
else:
    for i in range(M - 1):
        A.append(X[i + 1] - X[i])
    A = sorted(A, reverse = True)
    for k in A[N - 1:]:
        sum += k
print(sum)
moji_S=input()
moji_T=input()

flag=0
for i in range(len(moji_S)):
	if moji_S==moji_T:
		flag =1
		break
	s=s[-1]+s[0:len-1]
if flag:
	print("Yes")
else:
	print("No")



### FIXED CODE ###

#! python3

moji_S=input()
moji_T=input()

flag=0
for i in range(len(moji_S)):
	if moji_S==moji_T:
		flag =1
		break
	moji_S=moji_S[-1]+moji_S[0:-1]
if flag:
	print("Yes")
else:
	print("No")
# -*- coding: utf-8 -*-
S = []
for i in range(3):
    S.append(input())
for i in range(3):
    S[i] = S[i].replace('a', '0').replace('b', '1').replace('c', '2')
    
idx = int(S[0][0])
S[0] = S[0][1:]

while True:
    tmp = int(S[idx][0])
    S[tmp] = S[tmp][1:]
    idx = tmp
    if len(S[0]) == 0:
        print('A')
        break
    elif len(S[1]) == 0:
        print('B')
        break
    elif len(S[2]) == 0:
        print('C')
        break


### FIXED CODE ###

SA = input()
SB = input()
SC = input()

Aidx, Bidx, Cidx = 0, -1, -1
X = SA[0]
i = 0

while True:
    if X == 'a':
        Aidx += 1
        if Aidx == len(SA):
            ans = 'A'
            break
        X = SA[Aidx]
    elif X == 'b':
        Bidx += 1
        if Bidx == len(SB):
            ans = 'B'
            break
        X = SB[Bidx]
    elif X == 'c':
        Cidx += 1
        if Cidx == len(SC):
            ans = 'C'
            break
        X = SC[Cidx]


print(ans)
n=int(input())
s=[input() for _ in range(n)]

print(len(type(s)))

### FIXED CODE ###

n=int(input())
s=[input() for _ in range(n)]

print(len(set(s)))
n, y = map(int,input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
            print(i)
            print(j)
            print(n - i - j)
            exit(1)
print(-1)
print(-1)
print(-1)

### FIXED CODE ###

n, y = map(int,input().split())
y = y / 1000
f = 0
for i in range(n+1):
    for j in range(n-i+1):
        #print(i)
        if 10 * i + 5 * j + 1 * (n - i - j) == y:
            print(i)
            print(j)
            print(n - i - j)
            f = 1
            break
    if f == 1:
        break
if f != 1:
    print(-1)
    print(-1)
    print(-1)
s = input()
k = input()

ss = ""
for _ in range(k):
    ss += s

ss_list = list(ss)
count = 0
answer = 0
prev = ""
for sss in ss_list:
    if prev == "" or sss == prev:
        count+=1
        if count == 2: 
            answer+=1
            count=0

    else:
        count=1
    prev = sss

print(answer)

### FIXED CODE ###

import sys
s = list(input())
k = int(input())

if len(set(s))==1:
	print((len(s)*k)//2)
	sys.exit()
    
def counter(string):
    count = 0
    answer = 0
    prev = ""
    for index,sss in enumerate(string):
        if prev == "" or sss == prev:
            count+=1
            if count == 2: 
                answer+=1
                count=0
                string[index] = "1"
        else:
            count=1
        prev = sss
    return answer,string

answer, string = counter(s.copy())

if string[0] != string[-1]:
    print(answer*k)
else:
    count = 0
    l = len(s)
    for i in range(l):
        if s[i] == s[0]:
            count += 1
        else:
            break
    for i in range(l):
        if s[-1-i] == s[0]:
        	count += 1
        else:
        	break

    if count % 2 ==0:
        print(answer*k + k-1)
    else:
        print(answer*k)
def root(s):
  t=l[s]
  if t<0:
    return s
  return root(t)
def f(s):
  return root(int(s)-1)
n,m=map(int,input().split())
ans=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[ans]
for i in range(m-1,-1,-1):
  x,y=map(f,b[i+1])
  if x!=y:
    l[x]=y
    ans-=a[x]*a[y]
    a[y]+=a[x]
  c[i]=ans
for x in c[1:]:
  print(x)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
n,m=map(int,input().split())
z=n*(n-1)//2
l=[-1]*n
a=[1]*n
b=[input().split() for _ in range(m)]
c=[0]*m+[z]
def r(s):
  t=l[s]
  if t<0:
    return s
  else:
    l[s]=r(t)
    return l[s]
def f(s):
  return r(int(s)-1)
for i in range(m-1,-1,-1):
  x,y=map(f,b[i])
  if x!=y:
    l[x]=y
    z-=a[x]*a[y]
    a[y]+=a[x]
  c[i]=z
for x in c[1:]:
  print(x)
import math
a,b=map(int,input().split())
print(int((a*b)/math.gcd(a, b)))

### FIXED CODE ###

import fractions
a,b=map(int,input().split())
print(int((a*b)/fractions.gcd(a, b)))
N=int(input())
ans=0
for i in range(N):
    a,b=[k for k in input().split()]
    ans+=b-a+1
print(ans)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(N):
    a,b=[int(k) for k in input().split()]
    ans+=b-a+1
print(ans)
H, W = [int(x) for x in input().split()]

def solve(H, W):
  if H % 3 == 0 or W % 3 == 0:
    return 0  
  else:
    target = W/3
    min_ = 1e10
    a = 0
    for i in range(min(int(target)-1, 2), min(int(target)+2, W+1)):
      if abs(i-target) < min_:
        a = i
        min_ = abs(i-target)
    b = W - a
    target = H/2
    min_ = 1e20
    for i in range(min(int(target)-1, 2), min(int(target)+2, H+1)):
      if abs(i-target) < min_:
        c = i
        min_ = abs(i-target)
    d = H - c
    S = [a*H, b*c, b*d]
    return max(S)-min(S)

print(min(solve(H, W), solve(W, H))



### FIXED CODE ###

H, W = [int(x) for x in input().split()]

def solve(H, W):
  if H % 3 == 0 or W % 3 == 0:
    return 0  
  else:
    ans = 1e20
    for i in range(max(W//3-1, 1), min(W//3+2, W)):
      a = i
      b = W - a
      for i in range(max(H//2-1, 1), min(H//2+2, H)):
        c = i
        d = H - c
        S = [a*H, b*c, b*d]
        ans = min(ans, max(S)-min(S))
      for i in range(max(b//2-1, 1), min(b//2+2, b)):
        c = i
        d = b - c
        S = [a*H, c*H, d*H]
        ans = min(ans, max(S)-min(S))
  return ans

print(min(solve(H, W), solve(W, H)))
num = raw_input()
num_list = []
for i in range(int(num)):
        a = raw_input()
        num_list.append(int(a))

minv = num_list[0]

for i in range(1, len(num_list)):
        maxv = max(maxv, num_list[i] - minv)
        minv = min(minv, num_list[i])

print maxv

### FIXED CODE ###

num = raw_input()
num_list = []
for i in range(int(num)):
        a = raw_input()
        num_list.append(int(a))

maxv = float("-inf")
minv = num_list[0]

for i in range(1, len(num_list)):
        maxv = max(maxv, num_list[i] - minv)
        minv = min(minv, num_list[i])

print maxv
import sys

def main():
    n, *a = map(int, sys.stdin.readline().split())

    l = 0
    r = sum(a)
    m = sum(a)
    for i in range(n):
        l += a[i]
        r -= a[i]
        m = min(m, abs(l - r))
    
    print(m)


if __name__ == '__main__':
    main()

### FIXED CODE ###

# 2019-11-23 21:00:35(JST)
import sys
import itertools

def main():
    n, *A = map(int, sys.stdin.read().split())

    S = sum(A)
    l = 0
    for i in range(n):
        l += A[i]
        if l >= S // 2:
            if l == S / 2:
                ans = 0
                break
            else:
                if l == S // 2 - 1:
                    ans = 1
                    break
                else:
                    if l - A[i] >= S - l:
                        ans = A[i] + (S - l) - (l - A[i])
                    else:
                        ans = l - (S - l)
                    break

    print(ans)





if __name__ == '__main__':
    main()
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
d = 0

for l in L :
    d+=l
    if d <= X:
        cnt+=1
    else:
        break
print(cnt+1)

### FIXED CODE ###

# ABC 130
X ,A =map(int,input().split(" "))
if X < A:
    print(0)
elif A<=X:
    print(10)
tmp = map(int, input().split(' '))
if tmp[0] < tmp[1]:
  print(0)
else:
  print(10)

### FIXED CODE ###

# -*- coding: utf-8 -*-
tmp = list(map(int, input().split()))
if tmp[0] < tmp[1]:
  print(0)
else:
  print(10)
K,N=map(int,input().split())
L=list(map(int,input.split()))
A=[]
for i in range(N-1):
  A.append(L[i+1]-L[i])
L.append(K-L[L-1]+L[0])
print(K-max(L))

### FIXED CODE ###

K,N=map(int,input().split())
L=list(map(int,input().split()))
A=[]
for i in range(N-1):
  A.append(L[i+1]-L[i])
A.append(K-L[N-1]+L[0])
print(K-max(A))
def computeMinimumNoOfOperations(candies, x):
  noOfOperations = 0
  for i in range(0, len(candies) - 1):
    if (candies[i] > x):
      eat = candies[i] - x
      candies[i] -= eat
      noOfOperations += eat
    if (candies[i] + candies[i + 1] > x):
      if (candies[i] > candies[i + 1]):
        eat = candies[i] - x
      	candies[i] -= eat
      	noOfOperations += eat 
      else:
        eat = candies[i + 1] - x
      	candies[i + 1] -= eat
      	noOfOperations += eat 
  return noOfOperations


def start():
  n, x = list(map(int, input().split()))
  candies = list(map(int, input().split()))
  return computeMinimumNoOfOperations(candies, x)

print(start())

### FIXED CODE ###


def computeMinimumNoOfOperations(candies, x):
    noOfOperations = 0
    for i in range(len(candies) - 1):
        if (candies[i] > x):
            candiesToEat = candies[i] - x
            candies[i] -= candiesToEat
            noOfOperations += candiesToEat
        if (candies[i] + candies[i + 1] > x):
            candiesToEat = candies[i] + candies[i + 1] - x
            candies[i + 1] -= candiesToEat
            noOfOperations += candiesToEat 
    return noOfOperations


def start():
    n, x = list(map(int, input().split()))
    candies = list(map(int, input().split()))
    return computeMinimumNoOfOperations(candies, x)

print(start())
sorted([int(x) for x in input().split()])
print(sorted[0]+" "+sorted[1]+" "+sorted[2])

### FIXED CODE ###

list=sorted([int(x) for x in input().split()])
print(str(list[0])+" "+str(list[1])+" "+str(list[2]))
a,b,c=map(int,input().split())
if 4a*b<(c*c-2*c*(a+b)+(a+b)*(a+b)):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if c-a-b<0:
  print("No")
elif 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

li = []
for i in range(len(h)):
  li.append(abs(a - t - h[i]*0.006))
  
print(li.index(min(li)))

### FIXED CODE ###

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

yen = x+y/2
print(int(yen))
import sys
K,S = map(int,input().split())
if K < 2 or K > 2500:
  sys.exit()

X = 0
count = 0
while X <= K:
  Y = 0
  while Y <= K:
    Z = S - X - Y
    if Z <= K and Z >= 0:
      count += 1
    Y += 1
  X += 1
print(count)

### FIXED CODE ###

import sys
import re
#X = list(map(str,input().split()))
X = str(input())
print(re.sub(',',' ',X))
def pathSmMax(matrix,i,j,cache):
    if i < 0 or j < 0 or i > len(matrix)-1 or j > len(matrix[0])-1: return 0
    happiness = -float("inf")
    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(len(matrix[0])+1)] 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, R = input().split()
if N>=10 :
  x = R
else:
  x = R - 100*(10-N)
print(x)


### FIXED CODE ###

N, R = input().split()
N = int(N)
R = int(R)
if N>=10 :
  x = R
else:
  x = R + 100*(10-N)
print(x)
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    n = ii()
    tmp = 26
    cnt = 1
    while n > tmp:
        n-=tmp
        tmp*=26
        cnt+=1
    cnt-=1
    tmplist = []
    while cnt > 0:
        tmptmp = 26**cnt
        tmplist.append(n//tmptmp)
        n%=tmptmp
        cnt-=1
    tmplist.append(n-1)

    ans = ''
    for i in tmplist:
        ans+=l[i]

    print(ans)



main()




### FIXED CODE ###

from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    n = ii()
    tmp = 26
    cnt = 1
    while n > tmp:
        n-=tmp
        tmp*=26
        cnt+=1
    cnt-=1
    tmplist = []
    while cnt > 0:
        tmptmp = 26**cnt

        if n%tmptmp == 0:
            tmplist.append(n//tmptmp-1)

        else:
            tmplist.append(n//tmptmp)
        n%=tmptmp
        cnt-=1
    if n%26 == 0:
        tmplist.append(25)
    else:
        tmplist.append(n-1)

    ans = ''
    for i in tmplist:
        ans+=l[i]

    print(ans)



main()