Harryxun/stf_run huggingface dataset:
N, M, K = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

import numpy as np

a =[]
flag = True
while flag:
    if A[0] >= K or B[0] >= K:
        flag = False
    elif not A and not B:
        flag = False
    elif not A:
        a.append(B[0])
        B = B[1:]
    elif not B:
        a.append(A[0])
        A = A[1:]
    elif A[0] <= B[0]:
        a.append(A[0])
        A = A[1:]
    else:
        a.append(B[0])
        B = B[1:]

res = np.cumsum(a)
r = list(res)

cnt = 0
for i in r:
    if i <= K:
        cnt += 1
    else:
        break
print(cnt)

### FIXED CODE ###

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

a = [0]
b = [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

j=M
ans = 0
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)
A, B, C = map(int, input().split())
S = A * B // 2
print(S)

### FIXED CODE ###

T, X = map(int, input().split())
t = T / X
print(t)
while True:
 a,b=map(int,input().split())
 digit=(a+b)
 digit2=str(digit)
 print(len(digit2))

### FIXED CODE ###

try:
 while True:
  a,b=map(int,input().split())
  digit=(a+b)
  digit2=str(digit)
  print(len(digit2))
except:
   pass
n = int(input())
l = map(int, input().split())
 
print(l[::-1])

### FIXED CODE ###

input()
xs=reversed(input().split())
print(" ".join(xs))
from fractions import gcd
N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())
def lcm(a, b):
    return int((a*b)/gcd(a, b))
lcm_ans = lcm(T[0], T[1])
for i in range(N):
    lcm_ans = lcm(T[i], lcm_ans)
print(lcm_ans)

### FIXED CODE ###

from functools import reduce
N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())
def gcd(x, y):
    while y > 0:
        x, y = y, x % y
    return x
def lcm(x, y):
    return x*y//gcd(x, y)
print(reduce(lcm, T))
def how_many(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
  return ans

n = int(input())
line = map(int , input().split())
answer = min(map(how_many , line))
             
print(answer)


### FIXED CODE ###

line = input()
count = 0
for i in range(3):
  if line[i] == "1":
    count += 1
print(count)
d, n = map(int, input().split())
 
if d==0:
	print(n)
elif d==1:
	if n<100:
		print(n*100)
    else:
        print(10100)
elif d==2:
  	if n<100:
		print(n*10000)
    else:
        print(n*10000+10000)

### FIXED CODE ###

d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)
x,y,r = map(int,input().split())

AREA = ((x*Y)/2)


print(AREA)

### FIXED CODE ###

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

AREA = x*y

AREA2 =(AREA//2) 


print(AREA2)
x,n=map(int,input().split())
if n!=0:
  p=list(int(i) for i in input().split())

  for i in range(100):
    kouho1=x+i
    kouho2=x-i
    if kouho2 not in p:
      print(kouho2)
      break
    elif kouho1 not in p:
      print(kouho1)
      breaak
else:
  print(x)

### FIXED CODE ###

x,n=map(int,input().split())
if n!=0:
  p=list(int(i) for i in input().split())

  for i in range(100):
    kouho1=x+i
    kouho2=x-i
    if kouho2 not in p:
      print(kouho2)
      break
    elif kouho1 not in p:
      print(kouho1)
      break
else:
  print(x)
a = int(input())
b = int(input())

if a != 1 and b != 1:
	print(1)
elif a != 2 and b != 2:
	print(2)
elif a != 3 and b != :
	print(3)


### FIXED CODE ###

a = int(input())
b = int(input())
list = [1, 2, 3]

list.remove(a)
list.remove(b)
print(list[0])
N = input()
if N >= 90:
    print("Yes")
elif (N+1)%10 is 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())

if N >= 90:
    print("Yes")
elif (N+1)%10 is 0:
    print("Yes")
else:
     print("No")
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5)
for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    ans[BC[i][0]] = 0 

    S = 0
    for i in range(maxlen+1):
        S += ans [i]*i
    print(S)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5+1)

for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
S = 0
for i in range(maxlen+1):
        S += ans [i]*i
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    S = S + ans[BC[i][0]] *BC[i][1] - ans[BC[i][0]]*BC[i][0]
    ans[BC[i][0]] = 0
    print(S)
sentence = ''
while True:
    try:
        sentence += input().lower()
        except:
            break

for i in range(ord('a'), ord('z') + 1):
    print('{} : {}'.format(chr(i),sentence.count(chr(i))))

### FIXED CODE ###

sentence = ''
while True:
    try:
        sentence += input().lower()
    except:
            break

for i in range(ord('a'), ord('z') + 1):
    print('{} : {}'.format(chr(i),sentence.count(chr(i))))
def main():    
	N, Q = map(int, input().split())
    S = input()

    list = [0] * (N + 1)

    for i in range(N):
        list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)

    for i in range(Q):
        a, b = map(int, input().split())
        output = list[b - 1] - list[a - 1]
        print(output)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, Q = map(int, input().split())
    S = input()

    list = [0] * (N + 1)

    for i in range(N):
        list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)

    for i in range(Q):
        a, b = map(int, input().split())
        output = list[b - 1] - list[a - 1]
        print(output)


if __name__ == '__main__':
    main()
n, m, x = map(int, input().split())
a = map(int, input().split())

left = 0
right = 0

for ai in a:
    if ai < x:
        lef += 1
    else:
        right += 1
print(min(left, right))

### FIXED CODE ###

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

to_0 = 0
if A[-1] < X:
    to_0 = M
    to_N = 0
elif A[0] < X < A[-1]:
    for i in A:
        if i < X:
            to_0 += 1
    to_N = M - to_0
elif X < A[0]:
    to_0 = 0
    to_N = M
print(min(to_0, to_N))
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def dfs(graph, nd, toprogy, is_visited):
    is_visited.add(nd)
    for adj in graph[nd]:
        if adj not in is_visited:
            dfs(graph, adj, toprogy, is_visited)

    toprogy.appendleft(nd)

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [int(input_raw[0]), int(input_raw[1])]
    graph = {}
    inv_graph = {}
    for i in range(1, N + 1):
        graph[i] = []
        inv_graph[i] = []

    for i in range(N - 1 + M):
        input_raw = read_func().strip().split()
        [a, b] = [int(input_raw[0]), int(input_raw[1])]
        graph[a].append(b)
        inv_graph[b].append(a)


    toprogy = deque([])
    is_visited = set([])
    for i in range(1, N + 1):
        if i not in is_visited:
            dfs(graph, i, toprogy, is_visited)

    toprogical_order = {}
    for i in range(N):
        toprogical_order[toprogy[i]] = i + 1

    for i in range(1, N + 1):
        max_toprogy = 0
        true_parent = 0
        for pare in inv_graph[i]:
            if max_toprogy < toprogical_order[pare]:
                max_toprogy =toprogical_order[pare]
                true_parent = pare
        print true_parent

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def dfs(graph, nd, toprogy, is_visited):
    is_visited.add(nd)
    for adj in graph[nd]:
        if adj not in is_visited:
            dfs(graph, adj, toprogy, is_visited)

    toprogy.appendleft(nd)

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [int(input_raw[0]), int(input_raw[1])]
    graph = {}
    inv_graph = {}
    for i in range(1, N + 1):
        graph[i] = []
        inv_graph[i] = []

    for i in range(N - 1 + M):
        input_raw = read_func().strip().split()
        [a, b] = [int(input_raw[0]), int(input_raw[1])]
        graph[a].append(b)
        inv_graph[b].append(a)

    sys.setrecursionlimit(200000)
    toprogy = deque([])
    is_visited = set([])
    for i in range(1, N + 1):
        if i not in is_visited:
            dfs(graph, i, toprogy, is_visited)

    toprogical_order = {}
    for i in range(N):
        toprogical_order[toprogy[i]] = i + 1

    for i in range(1, N + 1):
        max_toprogy = 0
        true_parent = 0
        for pare in inv_graph[i]:
            if pare not in toprogical_order:
                continue
            if max_toprogy < toprogical_order[pare]:
                max_toprogy =toprogical_order[pare]
                true_parent = pare
        print true_parent

if __name__ == '__main__':
    main()
#!/usr/bin/env python
# coding: utf-8

# In[90]:


import math


# In[102]:


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


# In[103]:


lcm = int(C*D / math.gcd(C, D))


# In[104]:


c_part_a = int((A - 1) / C)
d_part_a = int((A - 1) / D)
cd_part_a = int((A - 1) / lcm)

c_part_b = int(B / C)
d_part_b = int(B / D)
cd_part_b = int(B / lcm)


# In[105]:


ans1 = (A-1) - (c_part_a + d_part_a - cd_part_a)
ans2 = B - (c_part_b + d_part_b - cd_part_b)


# In[106]:


print(ans2 - ans1)


# In[ ]:






### FIXED CODE ###

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

# In[8]:


import math


# In[5]:


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


# In[14]:


ac = (A-1)//C
bc = B//C
ad = (A-1)//D
bd = B//D
a_both = (A-1)//(C*D//math.gcd(C,D))
b_both = B//(C*D//math.gcd(C,D))
print((B-A+1) - (bc-ac) - (bd-ad) + (b_both-a_both))


# In[ ]:
n = int(input())
list_v = map(int,input().split())
list_c = map(int,input().split())
 
ans = 0
for i in range(n):
  if list_v[i] - list_c[i] > 0:
    ans += list_v[i] - list_c[i]
print(int(ans))

### FIXED CODE ###

a,b,t = map(int,input().split())
ans = ((t - t%a)/a)*b
print(int(ans))
from collections import deque



H,W = map(int, input().split())
S = [input() for _ in range(H)]

ans = 0
dyx = [(1,0), (0,1),(-1,0), (0,-1)]
for i in range(H):
    for j in range(W):
        if S[i][j] == "#" continue
        dist = [[0 for _ in range(W)] for _ in range(H)] 
        dist[i][j] = 0
        visited = [[False for _ in range(W)] for _ in range(H)]
        visited[i][j] = True
        tmp = 0
        q = deque()
        q.append((i,j))
        while q:
            y,x = q.popleft()
            for dy,dx in dyx:
                ny, nx = y+dy, x+dx
                if not 0 <= ny <= H-1 or not 0 <= nx <= W-1 or visited[ny][nx] == True or S[ny][nx] == "#":
                    continue
                q.append((ny, nx))
                dist[ny][nx] = dist[y][x] + 1
                visited[ny][nx] = True



        for i in range(H):
            ans = max(ans, max(dist[i]))

            

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def main():
    H,W = map(int, input().split())

    S = ["" for _ in range(H)]
    for i in range(H):
        S[i] = input()

    INF = float("inf")
    N = H*W
    dp = [[INF for _ in range(N)] for _ in range(N)]

    for i in range(H):
        for j in range(W):
            
            if j != W-1 and S[i][j] == "." and S[i][j+1] == ".":
                dp[(W*i)+j][(W*i)+j+1] = 1
                dp[(W*i)+j+1][(W*i)+j] = 1

            if i != H-1 and S[i][j] == "." and S[i+1][j] == ".":

                dp[(W*i)+j][(W*(i+1))+j] = 1
                dp[(W*(i+1))+j][(W*i)+j] = 1
        
            dp[(W*i)+j][(W*i)+j] = 0


    N = H*W
    for k in range(N):
        for i in range(N):
            for j in range(N):
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

    ans = 0
    for i in range(N):
        for j in range(N):
            if dp[i][j] != INF:
                ans = max(ans, dp[i][j])
    
    print(ans)

if __name__ == "__main__":
    main()
n = int(input())
ss = [[int(i) for i in input().split()] for i in range(n)]

flg = True


def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


# print(f'ss: {ss}')
for s in ss:
    x = s[0]
    y = s[1]
    h = s[2]
    if x == y == 0:
        print(x, y, h)
        flg = False

ans = []
for i in range(len(ss)-1):

    temp = [] if i == 0 else get_unique_list(ans)
    ans = []

    x1 = ss[i][0]
    y1 = ss[i][1]
    h1 = ss[i][2]
    x2 = ss[i+1][0]
    y2 = ss[i+1][1]
    h2 = ss[i+1][2]

    for a in range(100):
        for b in range(100):
            left = h1 - abs(x1-a) - abs(y1 - b)
            right = h2 - abs(x2-a) - abs(y2 - b)
            if left == right and left > 0 and right > 0:
                if i == 0:  # 1回目のループ
                    ans.append([a, b])
                elif [a, b] in temp:  # 2回目移行
                    ans.append([a, b])

    # print(f'i: {i}, temp: {temp}, ans: {get_unique_list(ans)}')

h = ss[0][2] + abs(ss[0][0] - ans[0][0]) + abs(ss[0][1] - ans[0][1])

print(ans[0][0], ans[0][1], h)
# print(get_unique_list(list_c))


### FIXED CODE ###

n = int(input())
ss = [[int(i) for i in input().split()] for i in range(n)]

ss = sorted(ss, key=lambda x: x[2], reverse=True)


cx, cy, ch = ss[0]
if len(ss) == 1:
    print(cx, cy, ch)
else:
    for a in range(101):
        for b in range(101):
            H = ch + abs(cx-a) + abs(cy - b)
            for x, y, h in ss[1:]:
                if h != max(H - abs(x-a) - abs(y - b), 0):
                    break
            else:
                print(a, b, H)
                flg = True
a,b=map(str,input())
l=["A","B","C","D","E"",F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

### FIXED CODE ###

a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")
import itertools

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

while True:
    f = False
    for c in itertools.combinations(a, 3):
        if c[0] ^ c[2] == c[1]:
            if len(a) == 3:
                print("Yes")
                exit()
            else:
                a.remove(c[1])
                f = True
        elif c[1] ^ c[2] == c[0]:
            if len(a) == 3:
                print("Yes")
                exit()
            else:
                a.remove(c[0])
                f = True
        elif c[1] ^ c[0] == c[2]:
            if len(a) == 3:
                print("Yes")
                exit()
            else:
                a.remove(c[2])
                f = True
    if f is False:
        print("No")
        exit()

### FIXED CODE ###

a = [input() for i in range(2)]
 
N = int(a[0])
data = a[1].split(' ')
 
data = [int(i) for i in data]
 
result = []
a = 0
for i in range(N):
    a = a ^ data[i]
    
if a == 0:
    print('Yes')
    exit()
    
print('No')
a = str(input())
if a.isupper() == True:
  print(A)
else:
  print(a)

### FIXED CODE ###

x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")
l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i-1)
  lis2.append(abs(m+i-1))

lis.pop(list_name.index(min(lis2)))
print(sum(lis)
  

### FIXED CODE ###

l,m = map(int,input().split())
lis =[]
lis2=[]
for i in range(l):
  lis.append(m+i)
  lis2.append(abs(m+i))

lis.pop(lis2.index(min(lis2)))
print(sum(lis))
import math
 
K = int(input())
 
for i in range(1, K+1):
	for j in range(1,K+1):
  		for k in range(1,K+1):
    		ans += math.gcd(math.gcd(i,j), k)
      
print(ans)

### FIXED CODE ###

from math import gcd
ans = 0
K = int(input())
 
for i in range(1, K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += gcd(gcd(i,j), k)
      
print(ans)
n = int(input())
A = []
for i in range(0, n) :
	temp = int(input())
	A.append(temp)
flag = True
for i in range(0, n) :
	if A[i] % 2 != 0 :
		continue
	elif A[i] % 2 == 0 and (A[i]%3 == 0 or A[i]%5 == 0) :
		continue
	else :
		flag = False
		break
if flag :
	print ("APPROVED")
else :
	print ("DENIED")

### FIXED CODE ###

n = int(input())
A = [int(x) for x in input().split()]
flag = True
for i in range(0, n) :
	if A[i] % 2 != 0 :
		continue
	elif A[i] % 2 == 0 and (A[i]%3 == 0 or A[i]%5 == 0) :
		continue
	else :
		flag = False
		break
if flag :
	print ("APPROVED")
else :
	print ("DENIED")
import sys
input = sys.stdin.readline
def main():
    A, B, C, K = map(int, input().split())
    nums = [1] * A + [0] * B + [-1] * C
    nums.sort(reverse=True)
    print(sum(nums[:K]))
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    A, B, C, K = map(int, input().split())
    rest = K
    ans = 0
    ans += min(A, rest)
    if K > A:
        rest -= A
        if rest > B:
            rest -= B
            ans -= min(rest, C)
    print(ans)
if __name__ == "__main__":
    main()
N = int(input())
p = [int(input()) for _ in N]
print(sum(p) - max(p) // 2)


### FIXED CODE ###

N = int(input())
p = [int(input()) for _ in range(N)]
print(sum(p) - max(p) // 2)
n = int(input())
x = list(map(int, input().split()))
for p in range(1, n+1):
    cnt = 0
    for i in x:
        cnt += (i-p)**2
    ans = min(ans, cnt)
print(ans)

### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
ans = 10 ** 9
for p in range(0, 101):
    cnt = 0
    for i in x:
        cnt += (i-p)**2
    ans = min(ans, cnt)
print(ans)
D = int(input())

print(D.count('0'))

### FIXED CODE ###

D = input()
DL = [D[i] for i in range(3)]

print(DL.count('1'))
N = int(input())
A = sorted([int(x) for x in input().split()])

def check():
    if N % 2 == 0:
        for i in range(1,N)[::2]:
            if A[i-1] != i or A[i] != i: return 0
        return (2**(N/2)) % (1e9+7)
    else:
        if A[0] != 0: return 0
        else:
            for i in range(2,N)[::2]:
                if A[i-1] != i or A[i] != i: return 0
            return (2**((N-1)/2)) % (1e9+7)
        
print(int(check()))


### FIXED CODE ###

N = int(input())
A = sorted([int(x) for x in input().split()])

def check():
    if N % 2 == 0:
        for i in range(1,N)[::2]:
            if A[i-1] != i or A[i] != i:    return 0
        return int(2**(N//2)) % int(1e9+7)
    else:
        if A[0] != 0:   return 0
        else:
            for i in range(2,N)[::2]:
                if A[i-1] != i or A[i] != i:    return 0
            return int(2**((N-1)//2)) % int(1e9+7)
        
print(check())
a,b = map(int,input().split())
if a > 8 || b > 8:
 print(':(')
else:
 print('Yay!')

### FIXED CODE ###

a,b = map(int,input().split())
if a > 8 or b > 8:
 print(':(')
else:
 print('Yay!')
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    x = list(input())
    for i in range(n):
        x[i] = int(x[i])
    A = 0
    for i in range(n):
        A += x[i]*pow(2,n-i-1)
    B = sum(x)
    for i in range(n):
        if x[i] == 0:
            AA = A + pow(2,n-i-1)
            BB = B + 1
        else:
            AA = A - pow(2,n-i-1)
            BB = B - 1
        ans = 1
        while AA%BB:
            AA = AA%BB
            AAA = copy.deepcopy(AA)
            BB = 0
            while AAA != 0:
                BB += AAA%2
                AAA //= 2
            ans += 1
        print(ans)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys, math, copy
sys.setrecursionlimit(10**8)

def main():
    n = int(input())
    x = list(input())
    for i in range(n):
        x[i] = int(x[i])
    A0 = 0
    A1 = 0
    B = sum(x)
    for i in range(n):
        if B+1 != 0:
            A0 += x[i]*pow(2,n-i-1,B+1)
            A0 %= B+1
        if B-1 != 0:
            A1 += x[i]*pow(2,n-i-1,B-1)
            A1 %= B-1
    for i in range(n):
        if x[i] == 0:
            BB = B + 1
            AA = A0 + pow(2,n-i-1,BB)
        else:
            BB = B - 1
            if BB == 0:
                AA = 0
            else:
                AA = A1 - pow(2,n-i-1,BB)
        ans = 1
        if BB == 0:
            print(0)
            continue
        while AA%BB != 0:
            AA = AA%BB
            AAA = AA
            BB = 0
            while AAA != 0:
                BB += AAA%2
                AAA //= 2
            ans += 1
        print(ans)
    
if __name__ == "__main__":
    main()
K,X = map(int, input().split())
v = 500 * K
if s >= X:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

K,X = map(int, input().split())
v = 500 * K
if v >= X:
    print("Yes")
else:
    print("No")
from collections import defaultdict
import math
import numpy as np
# N, K = map(int, input().split(' '))
N = int(input())
run = [list(map(str, range(1, 10)))]
l = 0
count = 9
stop = 10**5
while(1):
    if count > stop:
        break
    nextrun = []
    for i in run[l]:
        if i[-1] == '0':
            nextrun.append(i+'0')
            nextrun.append(i+'1')
        elif i[-1] == '9':
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
        else:
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
            nextrun.append(i+str(int(i[-1])+1))
    run.append(nextrun)
    count += len(nextrun)
    l += 1

newrun = []
for i in run:
    newrun.extend(i)
print(newrun[N-1])


### FIXED CODE ###

from collections import defaultdict
import math
# N, K = map(int, input().split(' '))
N = int(input())
run = [list(map(str, range(1, 10)))]
l = 0
count = 9
stop = 10**5
while(1):
    if count > stop:
        break
    nextrun = []
    for i in run[l]:
        if i[-1] == '0':
            nextrun.append(i+'0')
            nextrun.append(i+'1')
        elif i[-1] == '9':
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
        else:
            nextrun.append(i+str(int(i[-1])-1))
            nextrun.append(i+str(int(i[-1])))
            nextrun.append(i+str(int(i[-1])+1))
    run.append(nextrun)
    count += len(nextrun)
    l += 1

newrun = []
for i in run:
    newrun.extend(i)
print(newrun[N-1])
while 1:
    x, y = map(int, raw_input().split())
    if x == 0 and y == 0:
        break
    if y < x:
        print ' %s %s ' %(y, x)
    else:
        print ' %s %s ' %(x, y)
    

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
a,b =map(int,input().split())
c = 1
for i in range(0,a):
  for k in range(0.a-i):
    if 2*i+4*k ==b:
      c = 0
      break
if c ==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b =map(int,input().split())
c = 1
for i in range(0,a+1):
    if 2*i+4*(a-i) ==b:
      c = 0
      break
if c ==0:
  print("Yes")
else:
  print("No")
s = list(input())

length = len(s)

print(s)
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1

print(ans)



### FIXED CODE ###

s = list(input())

length = len(s)
ans= 0
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1

print(ans)