Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

#リスト l の最大公約数
def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = gcd(a,l[i])
    return a

gcd_ref = [A[0]]

for i in range(1, N):
    new_gcd = gcd(gcd_ref[-1], A[i])
    gcd_ref.append(new_gcd)
    
best = gcd_ref[N - 1]
for i in range(N - 1, -1, -1):
    if i > 0:
        if i == N - 1:
            a = gcd_ref[i - 1]
            if best < a:
                best = a
        else:
            a = gcd_ref[i - 1]
            l = A[i + 1:]
            gcd_without_i = gcd(a, gcdlist(l))
            if gcd_without_i > best:
                best = gcd_without_i
    else:
        l = A[1:]
        gcd_without_i = gcdlist(l)
        if gcd_without_i > best:
            best = gcd_without_i

print(best)
    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

gcd_L = [A[0]]
gcd_R = [A[N - 1]]

for i in range(1, N):
    new_gcd_l = gcd(gcd_L[-1], A[i])
    gcd_L.append(new_gcd_l)
    new_gcd_r = gcd(gcd_R[-1], A[N - i - 1])
    gcd_R.append(new_gcd_r)
    
best = gcd_L[N - 1]
for i in range(N):
    if i > 0:
        if i == N - 1:
            a = gcd_L[i - 1]
            if best < a:
                best = a
        else:
            l = gcd_L[i - 1]
            r = gcd_R[N - 2 - i]
            gcd_without_i = gcd(l, r)
            if gcd_without_i > best:
                best = gcd_without_i
    else:
        a = gcd_R[N - 2]
        if a > best:
            best = a

print(best)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import heapq

X, Y, Z , K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))

ans_heapq = []

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            abc = -1 * (A[i] + B[j] + C[k])
            heapq.heappush(ans_heapq, abc)
            
for _ in range(K):
    print(heapq.heappop(ans_heapq) * (-1))

Fixed submission:
import sys
import heapq

X, Y, Z , K = map(int, sys.stdin.readline().split())
A = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
B = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
C = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)

ans_heapq = []
i = 0
j = 0
k = 0
heapq.heappush(ans_heapq, [-1 * (A[0] + B[0] + C[0]), i, j, k])
ijk_list = [[0, 0, 0]]
            
for _ in range(K):
    ans, i, j, k = heapq.heappop(ans_heapq)
    print(-1 * ans)
    if i < X - 1 and [i + 1, j, k] not in ijk_list:
        abc = -1 * (A[i + 1] + B[j] + C[k])
        heapq.heappush(ans_heapq, [abc, i + 1, j, k])
        ijk_list.append([i + 1, j, k])
    if j < Y - 1 and [i, j + 1, k] not in ijk_list:
        abc = -1 * (A[i] + B[j + 1] + C[k])
        heapq.heappush(ans_heapq, [abc, i, j + 1, k])
        ijk_list.append([i, j + 1, k])
    if k < Z - 1 and [i, j, k + 1] not in ijk_list:
        abc = -1 * (A[i] + B[j] + C[k + 1])
        heapq.heappush(ans_heapq, [abc, i, j, k + 1])
        ijk_list.append([i, j, k + 1])
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A > 2 * B:
    print(A - 2 * B)
else:
    pritn(0)

Fixed submission:
A, B = map(int, input().split())
if A > 2 * B:
    print(A - 2 * B)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N, M =map(int, input().split())
li = []
l, r = map(int, input().split())
for j in range(r-l+1):
    li.append(j + l)
for i in range(M-1):
    l, r = map(int, input().split())
    # for j in range(r-l+1):
    li = [s for s in li if l <= s and s <= r]
print(len(li))

Fixed submission:
N, M =map(int, input().split())

l, r = map(int, input().split())

for i in range(M-1):
    l2, r2 = map(int, input().split())
    if l2 > l:
        l = l2
    if r > r2:
        r = r2
if r - l + 1 > 0:
    print(r - l + 1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    if x > y:
        tmp = x
        x = y
        y = tmp
    if x == 0:
        return y
    else:
        return gcd(y%x, x)

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

# if N == 2:
#     print(max(A[0], A[1]))
#     return 0

Llist = [0]
Rlist = [0]

for i in range(N):
    Llist.append(gcd(Llist[i], A[i])) 
    Rlist.insert(0, gcd(Rlist[0], A[N-1-i]))

ans = 0
for i in range(N):
    t = gcd(Llist[i], Rlist[i+1])
    if ans < t:
        ans = t

print(ans)


Fixed submission:
def gcd(x, y):
    if x > y:
        tmp = x
        x = y
        y = tmp
    if x == 0:
        return y
    else:
        return gcd(y%x, x)

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

Llist = [0]
Rlist = [0]

for i in range(N):
    Llist.append(gcd(Llist[i], A[i])) 
    # Rlist.insert(0, gcd(Rlist[0], A[N-1-i]))
    Rlist.append(gcd(Rlist[i], A[N-1-i]))
Rlist = Rlist[::-1]
ans = 0
for i in range(N):
    t = gcd(Llist[i], Rlist[i+1])
    if ans < t:
        ans = t

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    if x > y:
        tmp = x
        x = y
        y = tmp
    if x == 0:
        return y
    elif y%x == 0:
        return x
    else:
        return gcd(y%x, x)

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

# if N == 2:
#     print(max(A[0], A[1]))
#     return 0

Llist = [0]
Rlist = [0]

for i in range(N):
    Llist.append(gcd(Llist[i], A[i])) 
    Rlist.insert(0, gcd(Rlist[0], A[N-1-i]))

ans = []
for i in range(N):
    ans.append(gcd(Llist[i], Rlist[i+1]))

print(max(ans))


Fixed submission:
def gcd(x, y):
    if x > y:
        tmp = x
        x = y
        y = tmp
    if x == 0:
        return y
    else:
        return gcd(y%x, x)

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

Llist = [0]
Rlist = [0]

for i in range(N):
    Llist.append(gcd(Llist[i], A[i])) 
    # Rlist.insert(0, gcd(Rlist[0], A[N-1-i]))
    Rlist.append(gcd(Rlist[i], A[N-1-i]))
Rlist = Rlist[::-1]
ans = 0
for i in range(N):
    t = gcd(Llist[i], Rlist[i+1])
    if ans < t:
        ans = t

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

count = 0
h = H[0]

for i in range(H):
    if h <= H[i]:
        count += 1
        h = H[i]

print(count)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

count = 0
h = H[0]

for i in range(N):
    if h <= H[i]:
        count += 1
        h = H[i]

print(count)
Buggy python submission (verdict: Runtime Error):
S = input()
s1 = '0'
s2 = '1'
c1 = 0
c2 = 0

for i in range(len(S)):
    if i == 0:
        s1 = '0'
        s2 = '1'
    elif i % 2 == 1:
        s1 += 1
        s2 += 0
    else:
        s1 += 0
        s2 += 1

for i in range(len(S)):
    if S[i] == s1[i]:
        c2 += 1
    else:
        c1 += 1

print(min(c1, c2))

Fixed submission:
S = input()
c1 = 0
c2 = 0

for i in range(len(S)):
    if i == 0:
        s1 = '0'
        s2 = '1'
    elif i % 2 == 1:
        s1 += '1'
        s2 += '0'
    else:
        s1 += '0'
        s2 += '1'

for i in range(len(S)):
    if S[i] == s1[i]:
        c2 += 1
    else:
        c1 += 1

print(min(c1, c2))
Buggy python submission (verdict: Runtime Error):
a = int(intpu())
b= int(intpu())
c = int(intpu())
d = int(intpu())
e = int(intpu())
k = int(intpu())

if e - a > k:
    print(':(')
else:
    print('Yay!')


Fixed submission:
a = int(input())
b= int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
A, B =map(int, input().split())

L = []
R = []

for i in range(int((B-A+1) / 2)):
    L.append((A + 2 * i) ^ (A + 2 * i + 1))
if (B - A+1) % 2 == 1:
    L.append(B)

while len(L) != 1 and len(R) != 1:
    if len(L) == 0:
        if len(R) % 2 == 1:
            R.append(0)
        for i in range(int(len(R)/2)):
            L.append(R[2*i] ^ R[2*i+1])
        # if len(R) % 2 == 1:
        #     L.append(R[-1])
        R = []#.clear
    else:
        if len(L) % 2 == 1:
            L.append(0)
        for i in range(int(len(L)/2)):
            R.append(L[2*i] ^ L[2*i+1])
        # if len(L) % 2 == 1:
        #     R.append(L[-1])
        L = []

if len(L) == 0:
    print(R[0])
else:
    print(L[0])

Fixed submission:
A, B =map(int, input().split())

def f(n):
    if n % 2 == 0:
        if int(n / 2) % 2 == 0:
            return n
        else:
            return 1 ^ n
    else:
        if (int(n + 1) / 2) % 2 == 0:
            return 0
        else:
            return 1

if A > 0:
    print(f(A-1) ^ f(B))
else:
    print(f(B))

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

ans = A

for i in range(B-A):
    ans = ans ^ (A + i + 1)

print(ans)

Fixed submission:
A, B =map(int, input().split())

def f(n):
    if n % 2 == 0:
        if int(n / 2) % 2 == 0:
            return n
        else:
            return 1 ^ n
    else:
        if (int(n + 1) / 2) % 2 == 0:
            return 0
        else:
            return 1

if A > 0:
    print(f(A-1) ^ f(B))
else:
    print(f(B))
Buggy python submission (verdict: Runtime Error):
if __name__=='__main__':
    N = int(input())
        #pc, pr = map(int, input().split())
        #N = list(map(int,input().split()))
	print("Yes" if N%9 ==0 else "No")

Fixed submission:
if __name__=='__main__':
    N = int(input())
    print("Yes" if N%9 ==0 else "No")

Buggy python submission (verdict: Runtime Error):
if __name__=='__main__':
    for i in range(int(input())):
        N = int(input())
        #pc, pr = map(int, input().split())
        #N = list(map(int,input().split()))
        print("Yes" if N%9 ==0 else "No")

Fixed submission:
if __name__=='__main__':
    N = int(input())
    print("Yes" if N%9 ==0 else "No")
Buggy python submission (verdict: Runtime Error):
X,Y,Z = map(int,input().split())
 
print({} {} {} .format(Y,Z,X))

Fixed submission:
X,Y,Z = map(int,input().split())
 
print('{} {} {} '.format(Z,X,Y))

Buggy python submission (verdict: Runtime Error):
X,Y,Z = map(int,input().split())
 
print(Y Z X)

Fixed submission:
X,Y,Z = map(int,input().split())
 
print('{} {} {} '.format(Z,X,Y))
Buggy python submission (verdict: Runtime Error):
N = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = input()
K = int(K)
print(N[K])


Fixed submission:
N = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = input()
K = int(K)
print(N[K-1])
Buggy python submission (verdict: Runtime Error):
N ,R = map(int, input().split())
if N >=10:
  print(R)
  
else:
  r = 100*(10 - N)
  R = R -n
  print(R)
  

Fixed submission:
N ,R = map(int, input().split())
if N >=10:
  print(R)
  
else:
  r = 100*(10 - N)
  R = R + r
  print(R)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
 
while K <= N:
  N = N // K
  a +=a
 
print(a)

Fixed submission:
N,K=map(int,input().split())
a = 1
while K <= N:
  N = N // K
  a =a+1
  
print(a)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
a = 0
while R <= N:
  N = N // R
  a +=a
 
print(a)

Fixed submission:
N,K=map(int,input().split())
a = 1
while K <= N:
  N = N // K
  a =a+1
  
print(a)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())

while R <= N:
  N = N // R
  a +=a

print(a)
  
  
  


Fixed submission:
N,K=map(int,input().split())
a = 1
while K <= N:
  N = N // K
  a =a+1
  
print(a)
Buggy python submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
c0, c1, c2, c3 = 0,0,0,0
for i in range(N):
    if S() == "AC":
        c0 += 1
    elif S() == "WA":
        c1 += 1
    elif S() == "TLE":
        c2 += 1
    elif S() == "RE":
        c3 += 1

print("AC x " + c0)
print("WA x " + c1)
print("TLE x " + c2)
print("RE x " + c3)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
c0, c1, c2, c3 = 0,0,0,0
for i in range(N):
    s = S()
    if s == "AC":
        c0 += 1
    elif s == "WA":
        c1 += 1
    elif s == "TLE":
        c2 += 1
    elif s == "RE":
        c3 += 1

print("AC x " + str(c0))
print("WA x " + str(c1))
print("TLE x " + str(c2))
print("RE x " + str(c3))
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()
P = LI()

X = list(itertools.combinations(P,K))

ans = 10**9
for x in X:
   ans = min(ans, sum(x))


print(ans)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()
P = LI()

P = sorted(P)

ans = sum(P[:K])

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

X,N = MI()

if N == 0:
    print(X)
    exit()

P = LI()

_min = 10**9
ans = []
for p in range(1,101):
    if p in P:
        continue

    if abs(X-p) == _min:
        ans.append(p)
    elif abs(X-p) < _min:
        _min = abs(X-p)
        ans = []
        ans.append(p)

print(min(ans))



Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

X,N = MI()

if N == 0:
    print(X)
    exit()

P = LI()

_min = 10**9
ans = []
for p in range(X+1):
    for i in [-1,1]:
        a = X + (i * p)
        if a not in P:
            print(a)
            exit()
Buggy python submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(float,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B = input().split()
A = int(A)
B = int(B * 100)

print(A*B // 100)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(float,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B = input().split()
A = int(A)
B = B.replace(".","")
B = int(B)

print(A*B // 100)
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B,N = FLI()
max = 0
for i in range(1,N+1):
    j = floor((A*i)/B) - A * floor(i/B)
    if j > max:
       max = j

print(max)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B,N = FLI()

def f(x):
  return (A*x)//B - A * (x//B)
max = 0
x = min(B-1,N)

print(f(x))
Buggy python submission (verdict: Time Limit Exceeded):
nums = list(map(int, input().split()))
n = nums[0]
k = nums[1]

def absolute(n,k):
    return abs(n-k)

x = absolute(n, k)
if n % k == 0:
    print(0)
elif n < x:
    print(n)
else:
    while absolute(x, k) < x:
        x = absolute(x, k)

    print(x)



Fixed submission:
nums = list(map(int, input().split()))
n = nums[0]
k = nums[1]

def absolute(n,k):
    return abs(n-k)

x = absolute(n, k)
if n % k == 0:
    print(0)
elif n < x:
    print(n)
else:
    while absolute(x, k) < x:
        x = x % k
        x = absolute(x, k)

    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
nums = list(map(int, input().split()))
n = nums[0]
k = nums[1]

def absolute(n,k):
    return abs(n-k)

x = absolute(n, k)
if n < x:
    print(n)
else:
    while absolute(x, k) < x:
        x = absolute(x, k)

    print(x)

Fixed submission:
nums = list(map(int, input().split()))
n = nums[0]
k = nums[1]

def absolute(n,k):
    return abs(n-k)

x = absolute(n, k)
if n % k == 0:
    print(0)
elif n < x:
    print(n)
else:
    while absolute(x, k) < x:
        x = x % k
        x = absolute(x, k)

    print(x)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

p = []
for i in range(1, 10):
  p.append(i)

ans = 0
index = x

while 1:
    if index <= len(p):
      break
    index -= len(p)
    for i in p:
      for j in range(-1, 2):
          d = i % 10 + j
          if d < 0 or d > 9:
              continue

          nx = i * 10 + d
          p.append(nx)

ans = p[x - 1]
print(ans)



Fixed submission:
x = int(input())

p = [None for _ in range(100)]

p[1] = (1,2,3,4,5,6,7,8,9)

def getByKeta(n):
    for i in p[n-1]:
        for j in range(-1, 2):
          d = i % 10 + j
          if d < 0 or d > 9:
              continue

          yield i * 10 + d

for i in range(2, 11):
    p[i] = tuple(getByKeta(i))

ans = 0
for i in range(1, 11):
    if x <= len(p[i]):
        ans = p[i][x-1]
        break
    x -= len(p[i])
print(ans)

# p = []
# for i in range(1, 10):
#   p.append(i)

# ans = 0
# index = x

# while 1:
#     if index <= len(p):
#       break
#     index -= len(p)
#     for i in p:
#       for j in range(-1, 2):
#           d = i % 10 + j
#           if d < 0 or d > 9:
#               continue

#           nx = i * 10 + d
#           p.append(nx)

# print(p)
# print(len(p))
# ans = p[1]
# print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

nums = list(map(int, input().split()))
temp = nums.copy()
for i in range(n):
    nums.pop(i)
    result = 0
    for v in set(nums):
        c = nums.count(v)
        if (c > 1):
            result += int(c*(c-1)/2)
    print(result)
    nums = temp.copy()


Fixed submission:
import collections

n = int(input())

nums = list(map(int, input().split()))

cnt = collections.Counter(nums)

def c2(n):
    return int(n * (n-1) / 2)

total = 0

for c in cnt.values():
    total += c2(c)

for i in range(n):
    d = cnt[nums[i]]
    diff = c2(d) - c2(d-1)
    print(total - diff)

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

nums = list(map(int, input().split()))
temp = nums.copy()
for i in range(n):
    nums.pop(i)
    t = {}
    for j in nums:
        t[j] = nums.count(j)
    result = 0
    for v in t.values():
        if (v > 1):
            result += int(v*(v-1)/2)
    print(result)
    nums = temp.copy()

Fixed submission:
import collections

n = int(input())

nums = list(map(int, input().split()))

cnt = collections.Counter(nums)

def c2(n):
    return int(n * (n-1) / 2)

total = 0

for c in cnt.values():
    total += c2(c)

for i in range(n):
    d = cnt[nums[i]]
    diff = c2(d) - c2(d-1)
    print(total - diff)
Buggy python submission (verdict: Runtime Error):
nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
   print(n / (a+b) * a)

Fixed submission:
list = str(input())

if list == 'AAA' or list == 'BBB' or len(list) != 3:
    print("No")
else : 
    print("Yes")

Buggy python submission (verdict: Runtime Error):
list = str(input())

if list is "AAA" or list is "BBB" or len(list(list)) is not 3:
    print("No")
else : 
    print("Yes")


Fixed submission:
list = str(input())

if list == 'AAA' or list == 'BBB' or len(list) != 3:
    print("No")
else : 
    print("Yes")