Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
city = 0
all = []
roop = []
while sub[city] != 2:
  if sub[city] == 0:
    all.append(city+1)
  else:
    roop.append(city+1)
  sub[city] += 1
  city = A[city] -1
if len(roop)<k:
  print(roop[(k-(len(all)-len(roop)))%len(roop)])
else:
  print(all[k])


Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
city = 0
all = []
roop = []
while sub[city] != 2:
  if sub[city] == 0:
    all.append(city+1)
  else:
    roop.append(city+1)
  sub[city] += 1
  city = A[city] -1
if len(all) > k:
  print(all[k])
else:
  print(roop[(k-(len(all)-len(roop)))%len(roop)])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
ans = 1
cir = 0
a = 0
b = 0
if k < n:
  for i in range(k+1):
    sub[i] = ans
    ans = A[ans-1]
  print(sub[k])
else:
  for i in range(n):
    sub[i] = ans
    b = A[ans-1]
    if b in sub:
      a = sub.index(b)
      cir = i+1 - a
      break
    else:
      ans = b
  print(sub[a + (k - a) % cir])


Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
city = 0
all = []
roop = []
while sub[city] != 2:
  if sub[city] == 0:
    all.append(city+1)
  else:
    roop.append(city+1)
  sub[city] += 1
  city = A[city] -1
if len(all) > k:
  print(all[k])
else:
  print(roop[(k-(len(all)-len(roop)))%len(roop)])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
ans = 1
cir = 0
a = 0
if k < n:
  for i in range(k+1):
    sub[i] = ans
    ans = A[ans-1]
  print(sub[k])
else:
  for i in range(n):
    sub[i] = ans
    if A[ans-1] in sub:
      a = sub.index(A[ans-1])
      cir = i+1 - a
      break
    else:
      ans = A[ans-1]
  print(sub[a + (k - a) % cir])

Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
sub = [0]*n
city = 0
all = []
roop = []
while sub[city] != 2:
  if sub[city] == 0:
    all.append(city+1)
  else:
    roop.append(city+1)
  sub[city] += 1
  city = A[city] -1
if len(all) > k:
  print(all[k])
else:
  print(roop[(k-(len(all)-len(roop)))%len(roop)])
Buggy python submission (verdict: Runtime Error):
X = int(input())
for a in range(-120,120):
  for b in range(-120,120):
    if a**5 - b**5 == X:
      print(A,B)
      exit(0)

Fixed submission:
X = int(input())
for a in range(-120,120):
  for b in range(-120,120):
    if a**5 - b**5 == X:
      print(a,b)
      exit(0)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
  for x in range(B+1):
    list.append(floor((A*x)/B)-(A*floor(x/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))


Fixed submission:
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
  for x in range(B+1):
    list.append(floor((A*x)/B)-(A*floor(x/B)))
else:
  for x in range(N+1):
    list.append(floor((A*x)/B)-(A*floor(x/B)))
print(max(list))

Fixed submission:
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
def floor(x):
  return (x//1)
list = []
for x in range(N+1):
  if x % B != 0:
    list.append(floor((A*x)/B)-(A*floor(x/B)))
print(int(max(list)))

Fixed submission:
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())

def floor(x):
  return int(x//1)

list = []
for x in range(N+1):
  list.append(floor((A*x)/B)-(A*floor(x/B)))
print(max(list))

Fixed submission:
A,B,N = map(int,input().split())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]
count = N
for i in range(N-1):
  for j in range(i+1, N):
    if S[i] == S[j]:
      count -= 1
      break
print(count)

Fixed submission:
N = int(input())
list=[]
for _ in range(N):
  S = input()
  list.append(S)
print(len(set(list)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]
count = N

for i in range(N-1):
  for j in range(i+1, N):
    if S[i] == S[j]:
      count -= 1
      break
      
print(count)


Fixed submission:
N = int(input())
list=[]
for _ in range(N):
  S = input()
  list.append(S)
print(len(set(list)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [str(input()) for i in range(N)]
count = 0
output = 0

for i in range(N):
  for j in range(N):
    if S[i] == S[j]:
      count += 1
      
if count == N**2:
  output = 1
else:
  count -= N
  count //= 2
  output = N - count
  
print(output)

Fixed submission:
N = int(input())
list=[]
for _ in range(N):
  S = input()
  list.append(S)
print(len(set(list)))
Buggy python submission (verdict: Time Limit Exceeded):
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)

Fixed submission:
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(str(input()))
ans = 0
ans += S.count('0')

if len(S) > 4:
  for i in range(len(S)-4):
    for j in range(i+4,len(S)+1):
      if int(''.join(S[i:j])) % 2019 == 0:
        ans += 1
else:
  if int(''.join(S))%2019==0:
    ans += 1
print(ans)

Fixed submission:
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
ans = S.count('0')
num = 0
for i in range(len(S)):
  for j in range(i+3,len(S)):
    num = ''.join(map(str,S[i:j+1]))
    if int(num) % 2019 == 0:
      ans += 1
print(ans)

Fixed submission:
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
ans = 0
num = 0
x = len(S)
sub = []
for i in range(x):
  for j in range(i,x):
    if i == j and S[i] == '0':
      ans += 1
    elif j-i >=  3:
      sub = S[i:j+1]
      num = ''.join(map(str,sub))
      if int(num) % 2019 == 0:
        ans += 1
print(ans)

Fixed submission:
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
ans = 0
sub = []
num = 0
for i in range(len(S)):
  for j in range(i,len(S)):
    if i == j and S[i] == '0':
      ans += 1
    elif j-i >=  3:
      sub = S[i:j+1]
      num = ''.join(map(str,sub))
      if int(num) % 2019 == 0:
        ans += 1
print(ans)

Fixed submission:
S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = 0
for i in range(0,N):
  B = A.count(i+1)
  print(B)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = {}
for i in A:
  if i not in B:
    B[i] = 0
  B[i] += 1
  
for j in range(1,N+1):
  try:
    print(B[j])
  except KeyError:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range(0,N):
  B[i] = A.count(i+1)
for j in range(N):
  print(B[j])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = {}
for i in A:
  if i not in B:
    B[i] = 0
  B[i] += 1
  
for j in range(1,N+1):
  try:
    print(B[j])
  except KeyError:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
sub = [0]*N
for i in range(N):
  sub[i] = A.count(i+1)
for j in range(N):
  print(sub[j])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = {}
for i in A:
  if i not in B:
    B[i] = 0
  B[i] += 1
  
for j in range(1,N+1):
  try:
    print(B[j])
  except KeyError:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
def sum1(k):
  a = list(range(k))
  return sum(a)
def sum2(n,k):
  a = list(range(n-k+1,n+1))
  return sum(a)
mod = 10**9 + 7
ans = 0
for i in range(K,N+2):
  ans += (sum2(N,i) - sum1(i) + 1)%mod
  
print(ans%mod)

Fixed submission:
N,K = map(int,input().split())
x = [0]*(N+2)
x[1] = 1
ans = 0
for i in range(2,N+2):
  x[i] = i + x[i-1]
for k in range(K,N+2):
  small = x[k]
  big = x[N+1] - x[N-k+1]
  ans += big - small + 1

print(ans % (10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
def sum1(a):
  t = list(range(a))
  return sum(t)
def sum2(b,n):
  s = list(range(n-b+1,n+1))
  return sum(s)

N,K = map(int,input().split())
x = [0]*(N+2)
for k in range(K,N+2):
  x[k] = sum2(k,N) - sum1(k) + 1

print(sum(x) % (10**9 + 7))  

Fixed submission:
N,K = map(int,input().split())
x = [0]*(N+2)
x[1] = 1
ans = 0
for i in range(2,N+2):
  x[i] = i + x[i-1]
for k in range(K,N+2):
  small = x[k]
  big = x[N+1] - x[N-k+1]
  ans += big - small + 1

print(ans % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = min(n % k,k % n)
t = s
for _ in range(t):
  if abs(s-k)<s:
    s = abs(s-k)
print(s)

Fixed submission:
n,k = map(int,input().split())
s = n % k
list = [s]
for _ in range(s):
  if abs(s-k) in list:
    break
  elif abs(s-k)<s:
    list.append(abs(s-k))
print(min(list))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
s = n % k
t = s
for _ in range(t):
  if abs(s-k)<s:
    s = abs(s-k)
print(s)

Fixed submission:
n,k = map(int,input().split())
s = n % k
list = [s]
for _ in range(s):
  if abs(s-k) in list:
    break
  elif abs(s-k)<s:
    list.append(abs(s-k))
print(min(list))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = []
for v in itertools.combinations(n,2):
  l.append(min(abs(Y-v[1]) + abs(X-v[0]) + 1,abs(X-v[1]) + abs(Y-v[0]) + 1,v[1] - v[0]))
for k in range(1,N):
  print(l.count(k))

Fixed submission:
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = [0]*N
for v in itertools.combinations(n,2):
  l[min(abs(Y-v[1]) + abs(X-v[0]) + 1,v[1] - v[0])] += 1
for k in range(1,N):
  print(l[k])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = []
for v in itertools.combinations(n,2):
  if v[1] - v[0] > abs(Y-v[1]) + abs(X-v[0]) + 1:
    l.append(abs(Y-v[1]) + abs(X-v[0]) + 1)
  else:
    l.append(v[1] - v[0])
    
for k in range(1,N):
  print(l.count(k))

Fixed submission:
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = [0]*N
for v in itertools.combinations(n,2):
  l[min(abs(Y-v[1]) + abs(X-v[0]) + 1,v[1] - v[0])] += 1
for k in range(1,N):
  print(l[k])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = []
for v in itertools.combinations(n,2):
  if v[1] - v[0] > abs(Y-v[1]) + abs(X-v[0]) + 1:
    l.append(abs(Y-v[1]) + abs(X-v[0]) + 1)
  else:
    l.append(v[1] - v[0])
    
for k in range(1,N):
  print(l.count(k))

Fixed submission:
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = [0]*N
for v in itertools.combinations(n,2):
  l[min(abs(Y-v[1]) + abs(X-v[0]) + 1,v[1] - v[0])] += 1
for k in range(1,N):
  print(l[k])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
m = []
l = []
for v in itertools.combinations(n,2):
  m.append(v)
for u in range((N*(N-1))//2):
  if m[u][1] - m[u][0] > abs(Y-m[u][1]) + abs(X-m[u][0]) + 1:
    l.append(abs(Y-m[u][1]) + abs(X-m[u][0]) + 1)
  else:
    l.append(m[u][1] - m[u][0])
    
for k in range(1,N):
  print(l.count(k))

Fixed submission:
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = [0]*N
for v in itertools.combinations(n,2):
  l[min(abs(Y-v[1]) + abs(X-v[0]) + 1,v[1] - v[0])] += 1
for k in range(1,N):
  print(l[k])
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = 0
S = [""]*N
for _ in range(M):
  s, c = map(int,input().split())
  else:
    if S[s-1] == "" or S[s-1] == c:
      S[s-1] = c
    elif S[s-1] != "" and S[s-1] != c:
      print(-1)
      exit(0)
if N == 3:
  if S[0] == "":
    S[0] = 1
  if S[0] = 0:
    print(-1)
    exit(0)
  if S[1] == "":
    S[1] = 0
  if S[2] == "":
    S[2] = 0
  print(S[0],end="")
  print(S[1],end="")
  print(S[2])
elif N == 2:
  if S[0] == "":
    S[0] = 1
  if S[0] == 0:
    print(-1)
    exit(0)
  if S[1] == "":
    S[1] = 0
  print(S[0],end="")
  print(S[1],end="")
elif N == 1:
  if S[0] == "":
    print(0)


Fixed submission:
N,M = map(int, input().split())
ans = 0
S = [""]*N
for _ in range(M):
  s, c = map(int,input().split())
  if S[s-1] == "" or S[s-1] == c:
    S[s-1] = c
  elif S[s-1] != "" and S[s-1] != c:
    print(-1)
    exit(0)
if N != 1:
  if S[0] == "":
    S[0] = 1
  if S[0] == 0:
    print(-1)
    exit(0)
  for i in range(1,N):
    if S[i] == "":
      S[i] = 0
elif N == 1:
  if S[0] == "":
    S[0] = 0
print(''.join(map(str,S)))

Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = 0
c1 = []
c2 = []
c3 = []
for _ in range(M):
  s, c = map(int,input().split())
  if s == 1 and c == 0:
    print(-1)
      exit(0)
  if N == 1:
    elif not c in c1:
      ans += c
      c1.append(c)
      if len(c1) > 1:
        print(-1)
        exit(0)
  if N == 2:
    elif s == 1 and not c in c2:
      ans += 10*c
      c2.append(c)
      if len(c2) > 1:
        print(-1)
        exit(0)
    elif s == 2 and not c in c3:
      ans += c
      c3.append(c)
      if len(c3) > 1:
        print(-1)
        exit(0)
  if N == 3:
    elif s == 1 and not c in c1:
      ans += 100*c
      c1.append(c)
      if len(c1) > 1:
        print(-1)
        exit(0)
    elif s == 2 and not c in c2:
      ans += 10*c
      c2.append(c)
      if len(c2) > 1:
        print(-1)
        exit(0)
    elif s == 3 and not c in c3:
      ans += c
      c3.append(c)
      if len(c3) > 1:
        print(-1)
        exit(0)
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = 0
S = [""]*N
for _ in range(M):
  s, c = map(int,input().split())
  if S[s-1] == "" or S[s-1] == c:
    S[s-1] = c
  elif S[s-1] != "" and S[s-1] != c:
    print(-1)
    exit(0)
if N != 1:
  if S[0] == "":
    S[0] = 1
  if S[0] == 0:
    print(-1)
    exit(0)
  for i in range(1,N):
    if S[i] == "":
      S[i] = 0
elif N == 1:
  if S[0] == "":
    S[0] = 0
print(''.join(map(str,S)))
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
c=int(a)
d=float(b)
print(int(a*b))

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b.replace(".",""))
print(a*b//100)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys
a,b=map(int,input().split())
List=[list(map(int,input().split())) for i in range(b)]
l=[0]*(a+1)
line=deque([1])
while line:
  i=line.popleft()
  bye=[]
  for j in range(len(List)):
    x,y=List[j]
    if x==i:
      if l[y]==0:
        l[y]=i
        bye+=[j]
        line.append(y)
    if y==i:
      if l[x]==0:
        l[x]=i
        bye+=[j]
        line.append(x)
  for p in range(len(bye)):
    List.pop(bye[p]-p)
print("Yes")
for h in range(a-1):
  print(l[h+2])

Fixed submission:
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=[[] for i in range(a)]
for j in range(b):
  x,y=mi()
  l[x-1].append(y-1)
  l[y-1].append(x-1)
lst=[-1]*a
q=deque([0])
while q:
  s=q.popleft()
  for j in l[s]:
    if lst[j]==-1:
      lst[j]=s
      q.append(j)
print("Yes")
for k in range(a-1):
  print(lst[k+1]+1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys
a,b=map(int,input().split())
List=[list(map(int,input().split())) for i in range(b)]
l=[0]*(a+1)
line=deque([1])
while line:
  i=line.popleft()
  bye=[]
  for j in range(len(List)):
    x,y=List[j]
    if x==i:
      if l[y]==0:
        l[y]=i
        bye+=[j]
        line.append(y)
    if y==i:
      if l[x]==0:
        l[x]=i
        bye+=[j]
        line.append(x)
  for p in range(len(bye)):
    List.pop(bye[p]-p)
print("Yes")
for h in range(a-1):
  print(l[h+2])

Fixed submission:
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=[[] for i in range(a)]
for j in range(b):
  x,y=mi()
  l[x-1].append(y-1)
  l[y-1].append(x-1)
lst=[-1]*a
q=deque([0])
while q:
  s=q.popleft()
  for j in l[s]:
    if lst[j]==-1:
      lst[j]=s
      q.append(j)
print("Yes")
for k in range(a-1):
  print(lst[k+1]+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
a=int(input())
i=1
j=1
t=True
while i**5<=a:
  if a-i**5>=0:
    if int((a-i**5)**0.2)==(a-i**5)**0.2:
      print(i,int((-1)*(a-i**5)**0.2))
      sys.exit()
  else:
    if int((-a+i**5)**0.2)==(-a+i**5)**0.2:
      print(i,int((-a+i**5)**0.2))
      sys.exit()
  i+=1
while t:
  if i**5-j**5>a:
    j+=1
  elif i**5-j**5<a:
    i+=1
  else:
    print(i,j)
    sys.exit()

Fixed submission:
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a=int(input())
i=0
j=1
t=True
while i**5<=a:
  if a-i**5>=0:
    if int((a-i**5)**0.2)==(a-i**5)**0.2:
      print(i,int((-1)*(a-i**5)**0.2))
      sys.exit()
  else:
    if int((-a+i**5)**0.2)==(-a+i**5)**0.2:
      print(i,int((-a+i**5)**0.2))
      sys.exit()
  i+=1
while t:
  if i**5-j**5>a:
    j+=1
  elif i**5-j**5<a:
    i+=1
  else:
    print(i,j)
    sys.exit()

Fixed submission:
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a=int(input())
i=0
j=1
t=True
while i**5<=a:
  if int((a-i**5)**0.2)==(a-i**5)**0.2:
    print(i,int((-1)*(a-i**5)**0.2))
    sys.exit()
  i+=1
while t:
  if i**5-j**5>a:
    j+=1
  elif i**5-j**5<a:
    i+=1
  else:
    print(i,j)
    sys.exit()

Fixed submission:
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a=int(input())
t=True
i=0
while t:
  if ((a-i**5)**0.2)**5==a-i**5:
    print(i,int((-1)*(a-i**5)**0.2))
    sys.exit()
  i+=1

Fixed submission:
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
s=input()
x=[]
y=[]
z=[]
for i in range(a):
    if s[i]=="R":
        x+=[i]
    elif s[i]=="B":
        y+=[i]
    else:
        z+=[i]
count=len(x)*len(y)*len(z)
for i in x:
    for j in y:
        p=2*i-j
        q=2*j-i
        r=(i+j)/2
        t=0
        if 0<=p<=a:
            if p in z:
                t+=1
        if 0<=q<=a:
            if q in z:
                t+=1
        if int(r)==r:
            if int(r) in z:
                t+=1
        count-=t
print(count)

Fixed submission:
a=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for i in range(a):
  for j in range(i+1,(a+i+1)//2):
    if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
      ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
s=input()
count=0
x=[]
y=[]
z=[]
for i in range(a):
    if s[i]=="R":
        x+=[i]
    elif s[i]=="B":
        y+=[i]
    else:
        z+=[i]
for i in x:
    for j in y:
        p=2*i-j
        q=2*j-i
        r=(i+j)/2
        t=0
        if p in z:
            t+=1
        if q in z:
            t+=1
        if r in z:
            t+=1
        count+=len(z)-t
print(count)

Fixed submission:
a=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for i in range(a):
  for j in range(i+1,(a+i+1)//2):
    if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
      ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
s=input()
count=0
for i in range(a-2):
    for j in range(i+1,a-1):
        if s[i]!=s[j]:
            for h in range(j+1,a):
                if s[i]!=s[h] and s[j]!=s[h] and h+i!=2*j:
                    count+=1
print(count)

Fixed submission:
a=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for i in range(a):
  for j in range(i+1,(a+i+1)//2):
    if s[i]!=s[j] and s[i]!=s[2*j-i] and s[j]!=s[2*j-i]:
      ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
List=[]
for i in range (1,1000000):
    x=str(i)
    b=True
    for j in range(len(x)-1):
        if abs(int(x[j])-int(x[j+1]))<=1:
            continue
        else:
            b=False
            break
    if b:
        List+=[i]
print(List[a-1])

Fixed submission:
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
q=deque(list(range(1,10)))
c=0
while c<a:
  t=q.popleft()
  c+=1
  if t%10!=0:
    q.append(10*t+(t%10)-1)
  q.append(10*t+(t%10))
  if t%10!=9:
    q.append(10*t+(t%10)+1)
print(t)