Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
lis = list(input().split())
a=lis.count(lis[0])
b=lis.count(lis[1])
c=lis.count(lis[2])
if a+b+C == 4:
    print("Yes")
else:
    print("No")

Fixed submission:
lis = list(input().split())
a=lis.count(lis[0])
b=lis.count(lis[1])
c=lis.count(lis[2])
if a+b+c == 5:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import math
a=[0]*3
sum=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      a[0]=i+1
      a[1]=j+1
      a[2]=k+1
      ans=a[2]
      for l in range(2):
        ans = math.gcd(ans, a[l])
      sum+=ans
print(int(sum))
  

Fixed submission:
n=int(input())
import math
a=[0]*3
sum=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      a[0]=i+1
      a[1]=j+1
      a[2]=k+1
      ans=a[2]
      for l in range(2):
        ans = math.gcd(ans, a[l])
      sum+=ans
print(int(sum))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
S=sum(a)
p=0
for i in range(n):
       if a[i]>=S/(4*m):
              p+=1
if p>=m:
       print("Yes")
else:
       print("No")


Fixed submission:
X,Y,Z= input().split()
d=X
a=Y
b=d
d=a
a=Z
c=d

print(a, b, c)

Buggy python submission (verdict: Runtime Error):
s= input().split(' ')
s[0]=X
s[1]=Y
s[2]=Z
d=X
a=Y
b=d
d=a
a=c
c=d

print(a, b, c)



Fixed submission:
X,Y,Z= input().split()
d=X
a=Y
b=d
d=a
a=Z
c=d

print(a, b, c)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
l=len(a)
s=0
for i in range(l):
  for j in range(l):
    if i!=j:
      if a[i]!=a[j]:
        s+=1
if s==n*(n-1):
  print("YES")
else:
  print("NO")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=len(a)
m=len(set(a))

print("YES" if l==m else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
def number(m,l):
  count=0
  for i in range(m):
    if min(l[:i+1])==l[i]:
      count+=1
  return count

n=int(input())
p=list(map(int,input().split()))
result=number(n,p)
print(result)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
count=0
min=1000000
for i in range(n):
  if p[i]<=min:
    count+=1
    min=p[i]
  
print(str(count))

Buggy python submission (verdict: Time Limit Exceeded):
def number(m,l):
  count=0
  for i in range(m):
    if min(sorted(l[:i+1]))==l[i]:
      count+=1
  return count

n=int(input())
p=list(map(int,input().split()))
result=number(n,p)
print(result)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
count=0
min=1000000
for i in range(n):
  if p[i]<=min:
    count+=1
    min=p[i]
  
print(str(count))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int,input().split()))
sum=0
for i in range(n):
  count=0
  l=i
  for j in range(l):
    if p[l]<=p[j]:
      count+=1
  if count==i:
    sum+=1
print(str(sum))


Fixed submission:
n=int(input())
p=list(map(int,input().split()))
count=0
min=1000000
for i in range(n):
  if p[i]<=min:
    count+=1
    min=p[i]
  
print(str(count))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
x=[0]*n

for i in range(n-1):
  t=0
  H=h[i]
  
  for j in range(i+1,n):
    if h[j]<=H: 
      H=h[j]
      t+=1
    else:
      break
  x[i]=t

print(str(max(x)))
    

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
b=[0]*n

for i in range(n-1):
  b[i]=h[i]-h[i+1]
  if b[i]>=0:
    b[i]=1
  else:
    b[i]=0
b=[str(x) for x in b]
c="".join(b)
d=c.split("0")
print(len(max(d)))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(1, n+1):
    if l[i] == -1:
        l[i] = 0
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Fixed submission:
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1
if l[0] == 0:
    if n != 1:
        r = False
        
for i in range(1, n):
    if l[i] == -1:
        l[i] = 0
        
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(1, 3):
    if l[i] == -1:
        l[i] = 0
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Fixed submission:
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1
if l[0] == 0:
    if n != 1:
        r = False
        
for i in range(1, n):
    if l[i] == -1:
        l[i] = 0
        
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
def f2(n):
    c = len(n)-1
    nn = n[1:]
    s = c*(c-1)//2 * 9*9 
    s += c * (int(n[0])-1)*9
    s += (len(nn)-1)*9 + int(nn[0])
    return s

n = input()
k = int(input())

if k == 1:
    print((len(n)-1)*9 + int(n[0]))
if k == 2:
    print(f2(n))

if k == 3:
    c = len(n)-1
    nn = n[1:]
    s = c*(c-1)*(c-2)//(3*2) * 9*9*9
    s += (int(n[0])-1) * c*(c-1)//2 * 9*9 
    s += f2(nn)
    print(s)

Fixed submission:
def f2(n):
    c = len(n)-1
    nn = n[1:]
    s = c*(c-1)//2 * 9*9 
    s += c * (int(n[0])-1)*9
    nn = str(int(nn))
    s += (len(nn)-1)*9 + int(nn[0])
    return s

n = input()
k = int(input())

if k == 1:
    print((len(n)-1)*9 + int(n[0]))
if k == 2:
    if len(n) >= 2:
        print(f2(n))
    else:
        print(0)
        
if k == 3:
    if len(n) >= 3:
        c = len(n)-1
        nn = n[1:]
        nn = str(int(nn))
        s = c*(c-1)*(c-2)//(3*2) * 9*9*9
        s += (int(n[0])-1) * c*(c-1)//2 * 9*9 
        if len(nn) >= 2:
            s += f2(nn)
        print(s)
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
c = [0]*n
m = [0]*n

mc = 0
for i in range(n):
    c[i], m[i] = map(int, input().split())
    if mc < c[i]:
        mc = c[i]
    
dp = [10**10]*(h+mc)
dp[0] = 0

for i in range(1, h + mc):
    for j in range(n):
        dp[i] = min(dp[i-c[j]] + m[j], dp[i])
        
print(min(dp[h:]))

Fixed submission:
h, n = map(int, input().split())
c = [0]*n
m = [0]*n

mc = 0
for i in range(n):
    c[i], m[i] = map(int, input().split())
    if mc < c[i]:
        mc = c[i]
    
dp = [10**10]*(h+mc)
dp[0] = 0

for i in range(1, h + mc):
    dp[i] = min(dp[i-a] + b for a, b in zip(c, m))
        
print(min(dp[h:]))

Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
c = [0]*n
m = [0]*n

mc = 0
for i in range(n):
    c[i], m[i] = map(int, input().split())
    if mc < c[i]:
        mc = c[i]
    
dp = [0]*(h+1+mc)
dpn = [0]*(h+1+mc)

while True:
    for i in range(len(dp)):
        for j in range(n):
            if i == c[j]:
                if dp[i] == 0 and dpn[i] == 0:
                    dpn[i] = m[j]
                elif dpn[i] > 0:
                    dpn[i] = min(m[j], dpn[i])
            elif i > c[j]:
                if dp[i-c[j]] > 0:
                    if dpn[i] == 0:
                        dpn[i] = dp[i-c[j]] + m[j]
                    else:
                        dpn[i] = min(dp[i-c[j]] + m[j], dpn[i])
    if dp == dpn:
        break
    dp = dpn
    dpn = dpn[:]

mi = 10**9    
for i in dpn[h:]:
    if i > 0 and i < mi:
        mi = i

print(mi)

Fixed submission:
h, n = map(int, input().split())
c = [0]*n
m = [0]*n

mc = 0
for i in range(n):
    c[i], m[i] = map(int, input().split())
    if mc < c[i]:
        mc = c[i]
    
dp = [10**10]*(h+mc)
dp[0] = 0

for i in range(1, h + mc):
    dp[i] = min(dp[i-a] + b for a, b in zip(c, m))
        
print(min(dp[h:]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(input()) for i in range(n)]

for i in range(n):
    a = l[0]
    del l[0]
    print(max(l))
    l.append(a)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
ll = sorted(l, reverse = True)
m1 = ll[0]
m2 = ll[1]

for i in range(n):
    if l[i] == m1:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(input()) for i in range(n)]

for i in range(n):
    ll = l[0:i] + l[i+1:]
    print(max(ll))

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
ll = sorted(l, reverse = True)
m1 = ll[0]
m2 = ll[1]

for i in range(n):
    if l[i] == m1:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.insort_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
 
print(len(now))

Fixed submission:
import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.bisect_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
print(len(now))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(input()) for i in range(n)]
d = {}

c = 1
for i in l:
    while True:
        if c not in d:
            d[c] = i
            break
        else:
            if i > d[c]:
                d[c] = i
                break
            else:
                c += 1             
    c = 1

print(len(d))

Fixed submission:
import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.bisect_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
print(len(now))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(2):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
for i in range(2, n):
    xl.append3(xl[-2] - l[i-2]*2 + l[i-1]*2)
    
print(" ".join(map(str, xl)))

Fixed submission:
n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(2):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
for i in range(2, n):
    xl.append(xl[-2] - l[i-2]*2 + l[i-1]*2)
    
print(" ".join(map(str, xl)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 13:50:17 2019

@author: yama
"""

n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(2):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
for i in range(2, n):
    xl.append3(xl[-2] - l[i-2]*2 + l[i-1]*2)
    
print(" ".join(map(str, xl)))

Fixed submission:
n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(2):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
for i in range(2, n):
    xl.append(xl[-2] - l[i-2]*2 + l[i-1]*2)
    
print(" ".join(map(str, xl)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(n):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
print(" ".join(map(str, xl)))

Fixed submission:
n = int(input())
l = list(map(int, input().split()))

l = l+l
xl = []
for i in range(2):
    a = 0
    m = False
    for j in range(i, n+i):
        if m is False:
            a += l[j]
            m = True
        else:
            a -= l[j]
            m = False
    xl.append(a)
    
for i in range(2, n):
    xl.append(xl[-2] - l[i-2]*2 + l[i-1]*2)
    
print(" ".join(map(str, xl)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
	alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)
  

Fixed submission:
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
    alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab = False:
	alice += i
  else:
    bob += i
    
print(alice - bob)
  

Fixed submission:
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
    alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even")

Fixed submission:
a, b = map(int, input().split())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = map(int, input().split())

min_n = 10**9

 
for i in l:
  num = 0
  while num < min_n:
    if i % 2 == 0:
      i = i//2
      num += 1
  min_n = num

print(min_n)


Fixed submission:
n = int(input())
l = map(int, input().split())

min_n = 10**9

 
for i in l:
  num = 0
  while num < min_n:
    if i % 2 == 0:
      i = i//2
      num += 1
    else:
      break
  min_n = num

print(min_n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))

mn = min(l)
mx = max(l)

ms = 10**9
ll = [0]*n
for j in range(mn, mx+1):
  	for i in range(n):
      ll[i] = (l[i] - j)**2
    s = sum(ll)
    ms = min(ms, s)
    
print(ms)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))

mn = min(l)
mx = max(l)

ms = 10**9
for j in range(mn, mx+1):
    s = sum([(i-j)**2 for i in l])
    ms = min(ms, s)
    
print(ms)
Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int,input().split())
A_list = []
for p in itertools.combinations_with_replacement(range(1,m+1),n):
    A_list.append(p)
# print(A_list)

ans = 0
for v in A_list:
    cur_score = 0
    for i in range(q):
        if v[b[i]-1] - v[a[i]-1] == c[i]:
            cur_score += d[i]
    ans = max(ans,cur_score)
print(ans)

Fixed submission:
import itertools
n, m, q = map(int, input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int,input().split())
A_list = []
for p in itertools.combinations_with_replacement(range(1,m+1),n):
    A_list.append(p)
# print(A_list)

ans = 0
for v in A_list:
    cur_score = 0
    for i in range(q):
        if v[b[i]-1] - v[a[i]-1] == c[i]:
            cur_score += d[i]
    ans = max(ans,cur_score)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
num_rem[0] = 1
for i in range(n):
    # print(int(s[i:]))
    mod = int(s[i:])%p
    num_rem[mod] = num_rem[mod] + 1
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)


Fixed submission:
s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
sums_from_first_mod = [0] * (n+1)
for i in range(1,n+1):
    sums_from_first_mod[i] = (sums_from_first_mod[i-1] + int(s[i-1])) % 3
# print(sums_from_first_mod)
ind0 = [i for i, x in enumerate(sums_from_first_mod) if x == 0]
ind1 = [i for i, x in enumerate(sums_from_first_mod) if x == 1]
ind2 = [i for i, x in enumerate(sums_from_first_mod) if x == 2]
indices = [ind0, ind1, ind2]    
# print(indices)
cnt = 0
for num in range(3):
    for i in indices[num]:
        for j in indices[num]:
            if j >= i+4:
                if int(s[i:j]) % 673 == 0:
                    cnt += 1
print(cnt)

Fixed submission:
s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
sums_from_first_mod = [0] * (n+1)
for i in range(1,n+1):
    sums_from_first_mod[i] = (sums_from_first_mod[i-1] + int(s[i-1])) % 3
# print(sums_from_first_mod)
indices = []    
for num in range(3):
    indices.append([i for i, x in enumerate(sums_from_first_mod) if x == num])
# print(indices)
cnt = 0
for num in range(3):
    for i in indices[num]:
        for j in indices[num]:
            if j >= i+4:
                if int(s[i:j]) % 673 == 0:
                    cnt += 1
print(cnt)


Fixed submission:
s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
length = len(s)
cnt = 0
for i in range(length-3):
    for j in range(i+4,length+1):
        cur_num = int(s[i:j])
        # print(cur_num)
        if cur_num % 2019 == 0:
            cnt += 1
print(cnt)

Fixed submission:
s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)
Buggy python submission (verdict: Runtime Error):
r  = int(input())
print(math.pi * 2 * r)

Fixed submission:
import math

r  = int(input())
print(math.pi * 2 * r)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    a, b = max([a,b]), min([a,b])
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

n = int(input())
ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans += gcd(gcd(i,j),k)
print(ans)
            


Fixed submission:
from math import gcd

n = int(input())
ans = 0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans += gcd(gcd(i,j),k)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                if j-i != k-j:
                    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
s = input()

ans = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
  for j in range(i+1,n):
    k = 2*j-i
    if k < n:
      if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
        ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def lunlun(num):
    output = True
    st_num = str(num)
    for ind in range(len(str(num))-1):
        output = output * (abs(int(st_num[ind])-int(st_num[ind+1])) <= 1)
    return output
        
k = int(input())
num = 0
for ind in range(k):
    num += 1
    while not lunlun(num):
        num += 1
print(num)
    


Fixed submission:
k = int(input())
X = [1,2,3,4,5,6,7,8,9]

start = 0
end = 9
while k > len(X):
    for i in range(end-start):
        n = str(X[start+i])
        # print(n)
        if int(n[-1])-1 >= 0:
            X.append(int(n+str(int(n[-1])-1)))
        X.append(int(n+str(n[-1])))
        if int(n[-1])+1 <= 9:
            X.append(int(n+str(int(n[-1])+1)))
    start = end
    end = len(X)
    # print(X)
print(X[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())

distances = []
for ind1 in range(1,n+1):
    for ind2 in range(ind1+1,n+1):
        cur_dist = min(ind2-ind1, abs(x-ind1)+abs(y-ind2)+1)
        # print(ind1,ind2,cur_dist)
        distances.append(cur_dist)
    
# print(distances)
for k in range(1,n):
    print(len([x for x in distances if x == k]))

Fixed submission:
n, x, y = map(int, input().split())

cnt = [0] *n
for ind1 in range(1,n+1):
    for ind2 in range(ind1+1,n+1):
        cur_dist = min(ind2-ind1, abs(x-ind1)+abs(y-ind2)+1)
        # print(ind1,ind2,cur_dist)
        cnt[cur_dist] += 1
# print(cnt)            
for k in range(1,n):
    print(cnt[k])