Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())

c = [[0 for i in range(9)] for j in range(9)]
for i in range(9):
    for j in range(9):
        c[str(i)[0]][str(j)[-1]] += 1

ans = 0
for i in range(9):
    for j in range(9):
        ans += c[i][j]*c[j][i]

print(ans)

Fixed submission:
N = int(input())

c = [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    str_i = str(i)
    c[int(str_i[0])][int(str_i[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j]*c[j][i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def i__j(i, j, N):
    ans = 0
    for k in range(1, N+1):
        str_k = str(k)
        if str_k[0] == str(i) and str_k[-1] == str(j):
            ans += 1

    return ans

N = int(input())

c = [[0 for i in range(9)] for j in range(9)]
for i in range(9):
    for j in range(9):
        c[i][j] = i__j(i+1, j+1, N)

ans = 0
for i in range(9):
    for j in range(9):
        ans += c[i][j]*c[j][i]

print(ans)

Fixed submission:
N = int(input())

c = [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    str_i = str(i)
    c[int(str_i[0])][int(str_i[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j]*c[j][i]

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

ans_1 = 0
for i in range(N):
  str_i = str(i)
  length = len(str_i)
  if str_i[0] == str_i[length-1]:
    ans_1 += 1

ans_2 = 0
half = N // 2
for i in range(half):
  if i <= 9:
    j = 0
    tmp_num =int(str(i)+str(j)+str(i))
    while tmp_num <= N:
      ans_2 += 1
      j += 1
      tmp_num =int(str(i)+str(j)+str(i))
   
  else:
    j = 0
    tmp_num =int(str(i[-1])+str(j)+str(i[0]))
    while tmp_num <= N:
      ans_2 += 1
      j += 1
      tmp_num =int(str(i[-1])+str(j)+str(i[0]))

print(ans_1+2*ans_2)
    
      


Fixed submission:
N = int(input())

c = [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    str_i = str(i)
    c[int(str_i[0])][int(str_i[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j]*c[j][i]

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

ans_1 = 0
for i in range(N):
  str_i = str(i)
  length = len(str_i)
  if str_i[0] == str_i[length-1]:
    ans_1 += 1

ans_2 = 0
for i in range(N // 2):
  if i <= 9:
    j = 0
    tmp_num =int(str(i)+str(j)+str(i))
    while tmp_num <= N:
      ans_2 += 1
      j += 1
      tmp_num =int(str(i)+str(j)+str(i))
   
  else:
    j = 0
    tmp_num =int(str(i[-1])+str(j)+str(i[0]))
    while tmp_num <= N:
      ans_2 += 1
      j += 1
      tmp_num =int(str(i[-1])+str(j)+str(i[0]))

print(ans_1+2*ans_2)
    
      

Fixed submission:
N = int(input())

c = [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    str_i = str(i)
    c[int(str_i[0])][int(str_i[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += c[i][j]*c[j][i]

print(ans)
Buggy python submission (verdict: Runtime Error):
x= int(input())

def prime_check(num,count):
    if (num % count) != 0:
        if num <= count**2:
            return num
        else:
            return prime_check(num,count+1)
    else :
        return prime_check(num+1,2)

if x==2 :
    print (2)
else:
    print(prime_check(x,2))


Fixed submission:
X = int(input())

def get_sieve_of_eratosthenes_new(n):
    import math
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

prime = get_sieve_of_eratosthenes_new(10**6)
for num in prime:
    if num >= X:
        print(num)
        break

Buggy python submission (verdict: Runtime Error):
x= int(input())

def prime_check(num,count):
    if (num % count) != 0:
        if num <= count**2:
            print(num)
        else:
            prime_check(num,count+1)
    else :
        prime_check(num+1,2)

if x==2 :
    print (2)
else:
    print(prime_check(x,2))


Fixed submission:
X = int(input())

def get_sieve_of_eratosthenes_new(n):
    import math
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

prime = get_sieve_of_eratosthenes_new(10**6)
for num in prime:
    if num >= X:
        print(num)
        break

Buggy python submission (verdict: Runtime Error):
x= int(input())

def prime_check(num,count):
    if (num % count) != 0:
        if num <= count**2:
            return num
        else:
            return prime_check(num,count+1)
    else :
        return prime_check(num+1,2)

if x==2 :
    print (2)
else:
    prime_check(x,2)


Fixed submission:
X = int(input())

def get_sieve_of_eratosthenes_new(n):
    import math
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

prime = get_sieve_of_eratosthenes_new(10**6)
for num in prime:
    if num >= X:
        print(num)
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = 0
for i in range(1000):
    s = list()
    s.append(str(i // 100))
    s.append(str((i//10) % 10))
    s.append(str(i % 10))

    ind = 0
    cnt = 0
    while cnt < 3 and ind < N:
        if S[ind] == s[cnt]:
            cnt += 1
        ind += 1

        if cnt == 3:
            ans += 1

print(ans)


Fixed submission:
def check(num, N): #Nからnumが作れるならreturn 1
    length = len(N)

    get_target = 0
    for i in range(length):
        if get_target == 0 and N[i] == num[0]:
            get_target = 1
            # print("target1", num)
        elif get_target == 1 and N[i] == num[1]:
            get_target = 2
            # print("target2", num)
        elif get_target == 2 and N[i] == num[2]:
            get_target = 3
            # print("target3", num)
    
    if get_target == 3:
        # print(num)
        return 1
    else:
        return 0


N = int(input())
S = input()

counter = 0
for i in range(1000):
    str_i = str(i)
    while len(str_i) <3:
        str_i = "0" + str_i
    
    counter += check(str_i, S)
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
def check(num, N): #Nからnumが作れるならreturn 1
    length = len(N)

    get_target = 0
    for i in range(length):
        if get_target == 0 and N[i] == num[0]:
            get_target = 1
            # print("target1", num)
        elif get_target == 1 and N[i] == num[1]:
            get_target = 2
            # print("target2", num)
        elif get_target == 2 and N[i] == num[2]:
            get_target = 3
            # print("target3", num)
    
    if get_target == 3:
        # print(num)
        return 1
    else:
        return 0


N = int(input())
S = input()

counter = 0
for i in range(1000):
    str_i = str(i)
    while len(str_i) <3:
        str_i = "0" + str_i
    
    counter += check(str_i, S)
print(counter)


Fixed submission:
def check(num, N): #Nからnumが作れるならreturn 1
    length = len(N)

    get_target = 0
    for i in range(length):
        if get_target == 0 and N[i] == num[0]:
            get_target = 1
            # print("target1", num)
        elif get_target == 1 and N[i] == num[1]:
            get_target = 2
            # print("target2", num)
        elif get_target == 2 and N[i] == num[2]:
            get_target = 3
            # print("target3", num)
    
    if get_target == 3:
        # print(num)
        return 1
    else:
        return 0


N = int(input())
S = input()

counter = 0
for i in range(1000):
    str_i = str(i)
    while len(str_i) <3:
        str_i = "0" + str_i
    
    counter += check(str_i, S)
print(counter)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]

path = [list() for _ in range(N+1)]
for i in range(N-1):
    a, b = ab[i][0], ab[i][1]
    path[a].append([b, i])
    path[b].append([a, i])

color_max = 0
color_list = [0]*(N-1)
visit = [False]*(N+1)
visit[1] = True
def dfs(node, color, used_path):
    global visit
    nxt_color = 0
    for nxt in path[node]:
        nxt_node = nxt[0]
        use_path = nxt[1]
        if visit[nxt_node] == False:
            visit[nxt_node] = True
            nxt_color += 1
            if nxt_color == color:
                nxt_color += 1
            dfs(nxt_node, nxt_color, use_path)
    
    global color_list
    if used_path != -1:
        color_list[used_path] = color

dfs(1, 0, -1)


for c in color_list:
    color_max = max(c, color_max)
print(color_max)
print("\n".join(map(str, color_list)))
            

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]

path = [list() for _ in range(N+1)]
for i in range(N-1):
    a, b = ab[i][0], ab[i][1]
    path[a].append([b, i])
    path[b].append([a, i])

color_max = 0
color_list = [0]*(N-1)
visit = [False]*(N+1)
visit[1] = True
def dfs(node, color, used_path):
    global visit
    nxt_color = 0
    for nxt in path[node]:
        nxt_node = nxt[0]
        use_path = nxt[1]
        if visit[nxt_node] == False:
            visit[nxt_node] = True
            nxt_color += 1
            if nxt_color == color:
                nxt_color += 1
            dfs(nxt_node, nxt_color, use_path)
    
    global color_list
    if used_path != -1:
        color_list[used_path] = color

dfs(1, 0, -1)


for c in color_list:
    color_max = max(c, color_max)
print(color_max)
print("\n".join(map(str, color_list)))
Buggy python submission (verdict: Runtime Error):
import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    if b = upper:
        theta = 90
    else:
        theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)

Fixed submission:
import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    if b == upper:
        theta = 90
    else:
        theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)

Buggy python submission (verdict: Runtime Error):
import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)

Fixed submission:
import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    if b == upper:
        theta = 90
    else:
        theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

N = len(s)

d = dict()
for i in range(N):
    for j in range(i, N):
        sub = s[i:j+1]
        if d.get(sub) == None:
            d[sub] = 1

d2 = sorted(d.items())
print(d2[K-1][0])


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

N = len(s)

d = dict()
for i in range(N):
    for j in range(i, min(N, i+K)):
        sub = s[i:j+1]
        if d.get(sub) == None:
            d[sub] = 1

d2 = sorted(d.items())
print(d2[K-1][0])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

N = len(s)

d = dict()
for i in range(N):
    for j in range(i, N):
        sub = s[i:j+1]
        if d.get(sub) == None:
            d[sub] = 1

d2 = sorted(d.items())
print(d2[K-1][0])

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

N = len(s)

d = dict()
for i in range(N):
    for j in range(i, min(N, i+K)):
        sub = s[i:j+1]
        if d.get(sub) == None:
            d[sub] = 1

d2 = sorted(d.items())
print(d2[K-1][0])
Buggy python submission (verdict: Runtime Error):
S = input()

length = len(S)
ans = 0

for i in range(n-1):
  if S[i] != S[i+1]:
    ans += 1

print(ans)

Fixed submission:
S = input()

length = len(S)
ans = 0

for i in range(length-1):
  if S[i] != S[i+1]:
    ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
INF=1001001001
dy=[0,1,0,-1]
dx=[1,0,-1,0]
my=[-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2]
mx=[2,1,0,-1,-2,2,1,-1,-2,2,-2,2,1,-1,-2,2,1,0,-1,-2]
h,w=map(int,input().split())
ch,cw=map(int,input().split())
ch-=1
cw-=1
dh,dw=map(int,input().split())
dh-=1
dw-=1
s=[list(input()) for i in range(h)]
dist=[[INF for i in range(w)] for j in range(h)]
dist[ch][cw]=0
d=deque([])
d.append([ch,cw])

while d:
  nowh,noww=d.popleft()
  for i in range(4):
    th=nowh+dy[i]
    tw=noww+dx[i]
    if 0<=th<=h-1 and 0<=tw<=w-1 and dist[th][tw]>dist[nowh][noww] and s[th][tw]==".":
      d.appendleft([th,tw])
      dist[th][tw]=dist[nowh][noww]
  for i in range(20):
    th=nowh+my[i]
    tw=noww+mx[i]
    if 0<=th<=h-1 and 0<=tw<=w-1 and dist[th][tw]>dist[nowh][noww]+1 and s[th][tw]==".":
      d.append([th,tw])
      dist[th][tw]=dist[nowh][noww]+1

ans=dist[dh][dw]
if ans==INF:
  ans=-1
print(ans)

Fixed submission:
from collections import deque
INF=1001001001
dy=[0,1,0,-1]
dx=[1,0,-1,0]
my=[-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2]
mx=[2,1,0,-1,-2,2,1,-1,-2,2,-2,2,1,-1,-2,2,1,0,-1,-2]
h,w=map(int,input().split())
ch,cw=map(int,input().split())
ch-=1
cw-=1
dh,dw=map(int,input().split())
dh-=1
dw-=1
s=[list(input()) for i in range(h)]
dist=[[INF for i in range(w)] for j in range(h)]
dist[ch][cw]=0
d=deque([])
d.append([ch,cw])

while d:
  nowh,noww=d.popleft()
  for i in range(4):
    th=nowh+dy[i]
    tw=noww+dx[i]
    if 0<=th<=h-1 and 0<=tw<=w-1 and dist[th][tw]>dist[nowh][noww] and s[th][tw]==".":
      d.appendleft([th,tw])
      dist[th][tw]=dist[nowh][noww]
  for i in range(20):
    th=nowh+my[i]
    tw=noww+mx[i]
    if 0<=th<=h-1 and 0<=tw<=w-1 and dist[th][tw]>dist[nowh][noww]+1 and s[th][tw]==".":
      d.append([th,tw])
      dist[th][tw]=dist[nowh][noww]+1

ans=dist[dh][dw]
if ans==INF:
  ans=-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
if ans>10**18:
  ans=-1
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
flag=True
if 0 in a:
  ans=0
  flag=False
if flag:
  for i in a:
    #print(ans)
    ans*=i
    if ans>10**18:
      ans=-1
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations_with_replacement
n,m,x=map(int,input().split())
l=[0,1]
hon=list(combinations_with_replacement(l,n))

c=[]
a=[]

ans=1001001001

for i in range(n):
  tmp=list(map(int,input().split()))
  c.append(tmp[0])
  a.append(tmp[1:])

for i,k in enumerate(hon):
  skill=[0 for i in range(m)]
  cost=0
  flag=True
  for j in range(m):
    if k[j]==1:
      for _ in range(m):
        skill[_]+=a[j][_]
      cost+=c[j]
  for j in range(m):
    if skill[j]<x:
      flag=False
      break
  if flag:
    ans=min(ans,cost)
if ans==1001001001:
  ans=-1
print(ans)

Fixed submission:
from itertools import combinations_with_replacement
n,m,x=map(int,input().split())

c=[]
a=[]

INF=1001001001
ans=INF

for i in range(n):
  tmp=list(map(int,input().split()))
  c.append(tmp[0])
  a.append(tmp[1:])

for i in range(1<<n):
  cost=0
  skill=[0 for _ in range(m)]
  for j in range(n):
    if (i>>j)&1==1:
      #print("i,j,(i>>j&1)",i,j,(i>>j&1))
      cost+=c[j]
      for k in range(m):
        skill[k]+=a[j][k]
  #print("skill",skill,"i",i)
  flag=True
  for j in range(m):
    if skill[j]<x:
      flag=False
      break
  if flag:
    ans=min(ans,cost)
if ans==INF:
  ans=-1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
num=[0 for i in range(n)]
first=[0 for i in range(n)]
first[0]=1
a=list(map(int,input().split()))
for i in range(n):
  a[i]-=1
num[0]=1
loop=0
s=0
for i in range(n):
  if num[a[s]]==0:
    num[a[s]]+=1
    first[a[s]]=i
  if num[a[s]]==2:
    loop1=loop
    break
  s=a[s]

kai=first[a[s]]+(k-first[a[s]])%(loop1-first[a[s]])
s=0
for i in range(kai):
  s=a[s]
print(s+1)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]-=1
kai=[-1 for i in range(n)]
nx=0
now=0
kai[0]=0

if k<=n:
  for i in range(k):
    nx=a[now]
    now=nx
    #print(nx)
  ans=nx+1
else:
  for i in range(n):
    nx=a[now]
    if kai[nx]==-1:
      kai[nx]=i+1
      now=nx
    else:
      T=i+1-kai[nx]
      break
  times=kai[nx]+(k-kai[nx])%T
  now=0
  nx=0
  for i in range(times):
    nx=a[now]
    now=nx
    #print(nx)
  ans=nx+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
tenbo=[i for i in range(1,n+1)]
t=list(map(int,input().split()))
h=[0]+t
for i in range(m):
  a,b=map(int,input().split())
  if h[a]>=h[b] and b in tenbo:
    tenbo.remove(b)
  if h[a]<=h[b] and a in tenbo:
    tenbo.remove(a)
print(len(tenbo))

Fixed submission:
n,m=map(int,input().split())
tenbo=[1 for i in range(n+1)]
t=list(map(int,input().split()))
h=[0]+t
tenbo[0]=0
for i in range(m):
  a,b=map(int,input().split())
  if h[a]>=h[b]:
    tenbo[b]=0
  if h[a]<=h[b]:
    tenbo[a]=0
print(sum(tenbo))
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
flag=True
l=[]
for i in range(2,int(x**0.5)+1):
  if x%i==0:
    l.append(i)
    #print(q)
while flag:
  for i in range(-100,100):
    for j in l:
      if (i+j)**5-i**5==x:
        flag=False
        a=i+j
        b=i
print(a,b)

Fixed submission:
x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)

Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
flag=True
l=[]
for i in range(2,int(x**0.5)+1):
  if x%i==0:
    l.append(i)
    #print(q)
while flag:
  for i in range(-100000,100000):
    for j in l:
      if (i+j)**5-i**5==x:
        flag=False
        a=i+j
        b=i
print(a,b)

Fixed submission:
x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)

Buggy python submission (verdict: Runtime Error):
x=int(input())

for i in range(2,int(x**0.5)+1):
  if x%i==0:
    q=i
    #print(q)
    break

for i in range(-100000,100000):
  if (i+q)**5-i**5==x:
    break
print(i+q,i)

Fixed submission:
x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)

Buggy python submission (verdict: Runtime Error):
x=int(input())

for i in range(-70,71):
  for j in range(-70,71):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)

Fixed submission:
x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
que=[1,2,3,4,5,6,7,8,9]
k=int(input())
for i in range(k-1):
  q=que.pop(0)
  #print("q",q)
  m=q%10
  #print("m",m,"que",que)
  if m==0:
    que.append(q*10)
    que.append(q*10+1)
  elif m==9:
    que.append(q*10+8)
    que.append(q*10+9)
  else:
    que.append(q*10+m-1)
    que.append(q*10+m)
    que.append(q*10+m+1)
print(que[0])

Fixed submission:
from collections import deque
que=deque([1,2,3,4,5,6,7,8,9])
k=int(input())
for i in range(k-1):
  q=que.popleft()
  #print("q",q)
  m=q%10
  #print("m",m,"que",que)
  if m==0:
    que.append(q*10)
    que.append(q*10+1)
  elif m==9:
    que.append(q*10+8)
    que.append(q*10+9)
  else:
    que.append(q*10+m-1)
    que.append(q*10+m)
    que.append(q*10+m+1)
print(que[0])

Buggy python submission (verdict: Time Limit Exceeded):
que=[1,2,3,4,5,6,7,8,9]
k=int(input())
for i in range(k-1):
  q=que.pop(0)
  #print("q",q)
  m=q%10
  #print("m",m,"que",que)
  if m==0:
    que.append(q*10)
    que.append(q*10+1)
  elif m==9:
    que.append(q*10+8)
    que.append(q*10+9)
  else:
    que.append(q*10+m-1)
    que.append(q*10+m)
    que.append(q*10+m+1)
print(que[0])

Fixed submission:
from collections import deque
que=deque([1,2,3,4,5,6,7,8,9])
k=int(input())
for i in range(k-1):
  q=que.popleft()
  #print("q",q)
  m=q%10
  #print("m",m,"que",que)
  if m==0:
    que.append(q*10)
    que.append(q*10+1)
  elif m==9:
    que.append(q*10+8)
    que.append(q*10+9)
  else:
    que.append(q*10+m-1)
    que.append(q*10+m)
    que.append(q*10+m+1)
print(que[0])
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start):
  #global d
  #global g
  q=[start]
  while q:
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    num[d[i][j]]+=1

for i in range(1,n):
  print(num[i])

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

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start,dist=0):
  #global d
  #global g
  q=[start]
  while q:

    dist+=1
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    if d[i][j]>=n:
      continue
    num[d[i][j]]+=1

for i in range(1,n):
  print(num[i])

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

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start,dist=0):
  #global d
  #global g
  q=[start]
  while q:

    dist+=1
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    if d[i][j]>=n:
      continue
    num[d[i][j]]+=1

for i in range(1,n):
  print(num[i])

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

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start,dist=0):
  #global d
  #global g
  q=[start]
  while q:

    dist+=1
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    if d[i][j]>=n:
      continue
    num[d[i][j]]+=1

for i in range(1,n):
  print(num[i])