Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
An = [int(i) for i in input().split()]

mod = int(math.pow(10, 9) + 7)

sum_result = 0

for i in range(N - 1):
    Ai = An[i]
    An_ = An[i + 1:]
    sum_result += (Ai * sum(An_)) % mod


print(sum_result % mod)


Fixed submission:
import math

N = int(input())
An = [int(i) for i in input().split()]


mod = int(math.pow(10, 9) + 7)

sum_an = sum(An)
sum_result = 0

for i in range(N - 1):
    Ai = An[i]
    sum_an -= Ai
    sum_result += (Ai * sum_an) % mod


print(sum_result % mod)

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

N = int(input())
An = [int(i) for i in input().split()]

mod = int(math.pow(10, 9) + 7)

sum = 0
for i in range(N - 1):
    Ai = An[i]
    for j in range(i + 1, N):
        Aj = An[j]
        sum += (Ai * Aj) % mod


print(sum % mod)


Fixed submission:
import math

N = int(input())
An = [int(i) for i in input().split()]


mod = int(math.pow(10, 9) + 7)

sum_an = sum(An)
sum_result = 0

for i in range(N - 1):
    Ai = An[i]
    sum_an -= Ai
    sum_result += (Ai * sum_an) % mod


print(sum_result % mod)

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

N = int(input())
An = [int(i) for i in input().split()]

sum = 0
for i in range(N - 1):
    Ai = An[i]
    for j in range(i + 1, N):
        Aj = An[j]
        sum += Ai * Aj

mod = int(math.pow(10, 9) + 7)

print(sum % mod)


Fixed submission:
import math

N = int(input())
An = [int(i) for i in input().split()]


mod = int(math.pow(10, 9) + 7)

sum_an = sum(An)
sum_result = 0

for i in range(N - 1):
    Ai = An[i]
    sum_an -= Ai
    sum_result += (Ai * sum_an) % mod


print(sum_result % mod)
Buggy python submission (verdict: Runtime Error):
import math
def calc(x, y, z):
    return x * x + y * y + z * z + x * y + y * z + z * x

def calc_combination_num(x, y, z):
    if x == y and y == z:
        # 全部同じ数字なら組み合わせの個数は1個
        return 1
    if x == y or y == z:
        # どれか2つが同じ数字なら組み合わせの個数は3C2 = 3個
        return 3
    # 全部違う数字なら組み合わせの個数は3P2 = 6個
    return 6

N = int(input())

result_map = {}
for i in range(1, N):
    result_map[i] = 0

# x <= y <= zとしてループを回し
for x in range(1, N):
    tempFn1 = calc(x, 0, 0)
    if tempFn1 > N:
        # もう数値は増える一方なのでやる必要なし
        break
    for y in range(x, N):
        tempFn2 = calc(x, y, 0)
        if tempFn2 > N:
            # もう数値は増える一方なのでやる必要なし
            break
        for z in range (y, N):
            fn = calc(x, y, z)
            if fn > N:
                # もう数値は増える一方なのでやる必要なし
                break
            # 組み合わせの個数の算出
            combination_num = calc_combination_num(x, y, z)
            result_map[fn] = result_map[fn] + combination_num

for result in result_map.values():
    print(result)


Fixed submission:
import math
def calc(x, y, z):
    return x * x + y * y + z * z + x * y + y * z + z * x

def calc_combination_num(x, y, z):
    if x == y and y == z:
        # 全部同じ数字なら組み合わせの個数は1個
        return 1
    if x == y or y == z:
        # どれか2つが同じ数字なら組み合わせの個数は3C2 = 3個
        return 3
    # 全部違う数字なら組み合わせの個数は3P2 = 6個
    return 6

N = int(input())

result_map = {}
for i in range(1, N + 1):
    result_map[i] = 0

# x <= y <= zとしてループを回し
for x in range(1, N):
    tempFn1 = calc(x, 0, 0)
    if tempFn1 > N:
        # もう数値は増える一方なのでやる必要なし
        break
    for y in range(x, N):
        tempFn2 = calc(x, y, 0)
        if tempFn2 > N:
            # もう数値は増える一方なのでやる必要なし
            break
        for z in range (y, N):
            fn = calc(x, y, z)
            if fn > N:
                # もう数値は増える一方なのでやる必要なし
                break
            # 組み合わせの個数の算出
            combination_num = calc_combination_num(x, y, z)
            result_map[fn] = result_map[fn] + combination_num

for result in result_map.values():
    print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
total = 0
mod = 10**9+7
for i in range(N):
  for k in range(N):
    if i!=k and i<k:
      total+=(A[i]*A[k])%mod
print(total%(mod)) 

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
total = 0
mod = 10**9+7
an = sum(A)

for i in range(N):
  total+=(an-A[i])*A[i]
s = total//2
print(s%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
total = 0
for i in range(N):
  for k in range(N):
    if i!=k and i<k:
      total+=A[i]*A[k]
print(total%(10**9+7)) 

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
total = 0
mod = 10**9+7
an = sum(A)

for i in range(N):
  total+=(an-A[i])*A[i]
s = total//2
print(s%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
total = 0
for i in range(N):
  for k in range(N):
    if i!=k and i<k:
      total+=A[i]*A[k]
  
print(total%(10**9+7)) 

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
total = 0
mod = 10**9+7
an = sum(A)

for i in range(N):
  total+=(an-A[i])*A[i]
s = total//2
print(s%mod)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
a = list(map(int,input().split()))

ans = []
g = 0
for i in range(N-K+1):
  k = 1
  for s in range(K):
    k *= a[s+i]%10**9
  ans.append(k)
  if len(ans)>1:
    if ans[0]<ans[1]:
      print("Yes")
    else:
      print("No")
    del ans[0]


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


for i in range(N-K):
  if a[i]<a[i+K]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
a = list(map(int,input().split()))

ans = []
g = 0
for i in range(N-K+1):
  k = 1
  for s in range(K):
    k *= a[s+i] 
  ans.append(k)
  if len(ans)>1:
    if ans[0]<ans[1]:
      print("Yes")
    else:
      print("No")
    del ans[0]

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


for i in range(N-K):
  if a[i]<a[i+K]:
    print("Yes")
  else:
    print("No")

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

ans = []
g = 0
for i in range(K):
  k = 1
  for s in range(K):
    k += a[s+i] 
  ans.append(k)
  if len(ans)>1:
    if ans[g]<ans[g+1]:
      print("Yes")
    else:
      print("No")
    g+=1

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


for i in range(N-K):
  if a[i]<a[i+K]:
    print("Yes")
  else:
    print("No")

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

ans = []
for i in range(K):
  k = 1
  for s in range(K):
    k *= a[s+i] 
  ans.append(k)
  

for s in range(N-K):
  if ans[s]<ans[s+1]:
    print("Yes")
  else:
    print("No")

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


for i in range(N-K):
  if a[i]<a[i+K]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = [0 for i in range(n)]
for i in range(6,n+1):
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        if x**2+y**2+z**2+x*y+y*z+z*x == i:
          ans[i-1]+=1
for i in ans:
  print(i)

Fixed submission:
n = int(input())
ans = [0 for i in range(10001)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v = x**2+y**2+z**2+x*y+y*z+z*x
      if v<=10000:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

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

for i in range(1,n+1):
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        if x**2+y**2+z**2+x*y+y*z+z*x == i:
          
          ans[i-1]+=1
          
for i in ans:
  print(i)

Fixed submission:
n = int(input())
ans = [0 for i in range(10001)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v = x**2+y**2+z**2+x*y+y*z+z*x
      if v<=10000:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])

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

for i in range(1,n+1):
  for x in range(1,n+1):
    for y in range(1,n+1):
      for z in range(1,n+1):
        if x**2+y**2+z**2+x*y+y*z+z*x == i:
          ans[i-1]+=1
for i in ans:
  print(i)

Fixed submission:
n = int(input())
ans = [0 for i in range(10001)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v = x**2+y**2+z**2+x*y+y*z+z*x
      if v<=10000:
        ans[v]+=1
for i in range(n):
  print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 1
if 0 in a:
  print("0")
  exit()

for i in range(n):
  total*=a[i]
  if total > 10**18:
    print("-1")
    exit()

print(total)
  
  

Fixed submission:
a,b = list(map(int,input().split()))
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
total = 1
for i in range(n):
  total*=a[i]
if 0 in a:
  print(0)
elif total > 10**18:
  print(-1)
else:
  print(total)
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
total = 1
if 0 in a:
  print("0")
  exit()

for i in range(n):
  total*=a[i]
  if total > 10**18:
    print("-1")
    exit()

print(total)

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

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
total = 1
if 0 in a:
  print("0")
  exit()

for i in range(n):
  total*=a[i]
  if total > 10**18:
    print("-1")
    exit()

print(total)
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
if K-A

A_num = A
B_num = 0
C_num = 0
if K>A:
  B_num = K-A
elif K-A>0:
  C_num = K-A-B

print(A_num*1+B_num*0+C_num*(-1))



Fixed submission:
n = input()
a = input()
len_n = len(n)

if a[0:len_n]==n:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())

if K==1:
  print(0)
  exit()
  
s = N
for i in range(10**9):
  s = min(s,abs(N-K))
  N -= K
print(s)
  

Fixed submission:
N,K = map(int,input().split())
a = N%K

print(min(a,K-a))

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

if K==1:
  print(0)
  exit()
  
s = N
for i in range(10**18):
  s = min(s,abs(N-K))
  N -= K
print(s)

Fixed submission:
N,K = map(int,input().split())
a = N%K

print(min(a,K-a))
Buggy python submission (verdict: Runtime Error):
n = int(input())

for i in range(1,10):
  for s in range(1,10):
    if i*s==n:
      print("Yes")
      exit()
print("No")
    
    

Fixed submission:
a,b = map(int,input().split())

if a>=10 or b>=10:
  print("-1")
else:
  print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N,M = map(int,input().split())


s = []
count = 0
for _ in range(M):
  a,b = map(int,input().split())
  if M==1:
    print(b-a+1)
    exit()
  for i in range(a,b+1):
    s.append(i)
    k = collections.Counter(s)
    
for d in k.values():
    if d==M:
      count+=1
      
print(count)

Fixed submission:
N,M = map(int,input().split())
right = N
left = 1
for _ in range(M):
  a,b = map(int,input().split())
  right = min(right,b) 
  left = max(left,a)

ans = right-left+1
print(max(0,ans))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
tree = sorted([int(input())for i in range(N)])
d = 10**18  

for i in range(N-K+1):
  d = min(d,tree[i+2]-tree[i])
if d>0:
  print(d)
else:
  print(d)

Fixed submission:
N,K = map(int,input().split())
tree = sorted([int(input())for i in range(N)])
d = 10**18  


for i in range(N-K+1):
  d = min(d,tree[i+K-1]-tree[i])
print(d)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
tree = sorted([int(input())for i in range(N)])
d = 10**18  

for i in range(N-K+1):
  d = min(d,tree[i+2]-tree[i])
print(d)

Fixed submission:
N,K = map(int,input().split())
tree = sorted([int(input())for i in range(N)])
d = 10**18  


for i in range(N-K+1):
  d = min(d,tree[i+K-1]-tree[i])
print(d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(filter(lambda x: x >= 3, t)) == 0):
    print("No")
else:
    print("Yes")


Fixed submission:
n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(list(filter(lambda x: x >= 3, t))) == 0):
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
grid = []
d = [(1, 0), (0, 1)]
for _ in range(H):
    grid.append(input())
dp = [[0 for _ in range(W)] for _ in range(H)]
mod = 1e9 + 7
dp[0][0] = 1
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            continue
        if h > 0 and grid[h - 1][w] == '.':
            dp[h][w] += dp[h - 1][w]
        if w > 0 and grid[h][w - 1] == '.':
            dp[h][w] += dp[h][w - 1]
print(int(dp[H - 1][W - 1] % mod))


Fixed submission:

H, W = map(int, input().split())
grid = []
d = [(1, 0), (0, 1)]
for _ in range(H):
    grid.append(input())
dp = [[0 for _ in range(W)] for _ in range(H)]
mod = 1e9 + 7
dp[0][0] = 1
for h in range(H):
    for w in range(W):
        if h > 0 and grid[h - 1][w] == '.':
            dp[h][w] = (dp[h][w] + dp[h - 1][w]) % mod
        if w > 0 and grid[h][w - 1] == '.':
            dp[h][w] = (dp[h][w] + dp[h][w - 1]) % mod
print(int(dp[H - 1][W - 1]))
Buggy python submission (verdict: Runtime Error):
k=int(input())
print((k/2)**2 if k%2==0 else ((k/2)-0.5)((k/2)+0.5))

Fixed submission:
import math
k=int(input())
if k%2==0:
  print((k//2)**2)
else:
  a=int(math.floor(k/2))
  print(a*(a+1))
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
count=0
for one in s:
  if one=="1":
    count+=1
  else:
    break
print(int(s.replace("1","")[0]) if k>=count else 1)

Fixed submission:
s=input()
k=int(input())
count=0
for one in s:
  if one=="1":
    count+=1
  else:
    break
print(int(s.replace("1","")[0]) if k>count else 1)
Buggy python submission (verdict: Runtime Error):
  a=list(map(int,input().split()))
  print(max(a)-min(a))
         


Fixed submission:
a=list(map(int,input().split()))
print(max(a)-min(a))
Buggy python submission (verdict: Runtime Error):
print(sum([1 if x=="+" else 01 for x in input()]))


Fixed submission:
S=[1 if x=="+" else -1 for x in input()]

print(sum(S))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print("yay" if a<=8 and b<=8 else ":(")

Fixed submission:
a,b=map(int,input().split())
print("Yay!" if a<=8 and b<=8 else ":(")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split)
print(a if a<=b else a-1)

Fixed submission:
a,b=map(int,input().split())
print(a if a<=b else a-1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split)
print(a-b if b<a else a-b+1)

Fixed submission:
a,b=map(int,input().split())
print(a if a<=b else a-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
l = []
n = 0
for i in range(1,N):
    n += A[i]*sum(A[:i])

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = sum(A)
new_A = A.reverse()
n = 0
for i in range(N-1):
    n += A[i]*(B-A[i])
    B = B-A[i]

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

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
l = []

for i in range(1,N):
    n = A[i]*sum(A[:i])
    l.append(n)

ans = sum(l)

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = sum(A)
new_A = A.reverse()
n = 0
for i in range(N-1):
    n += A[i]*(B-A[i])
    B = B-A[i]

print(n%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,K = map(int,input().split())
P = list(map(int,input().split()))
Sigmas = []
for M in itertools.combinations(P,K):
    Sigma = sum(list(M))
    Sigmas.append(Sigma)
print(min(Sigmas))


Fixed submission:
import itertools
N,K = map(int,input().split())
P = list(map(int,input().split()))
Sigma = sorted(P,reverse = False)
print(sum(Sigma[:K]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
a = np.prod(A)
if a > 10**18:
  print(-1)
else:
  print(a)

Fixed submission:
A, B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = []
S[K-1] = S[K-1].lower()
print(S)

Fixed submission:
N,K = map(int,input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

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

sum=1

for i in a:
    sum*=i
if sum > 10**18:
    sum = -1
print(sum)


Fixed submission:
n=int(input())

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

sum=1

for i in a:
    sum*=i
    if sum > 10**18:
        if 0 in a:
            sum = 0
            break
        else:
            sum = -1
            break
print(sum)
Buggy python submission (verdict: Runtime Error):
3 3 10
60 2 2 4
70 8 7 9
50 2 3 9

Fixed submission:
from collections import deque
import itertools

n,m,x=map(int, input().split())

li = deque()

sum = -1
ans = 0
for i in range(n):
    li.append(list(map(int, input().split())))

for i in range(1,n+1):
    for v in itertools.combinations(li, i):
        ok = True
        for j in range(1,m+1):
            ans = 0
            for k in v:
                ans += k[j]
                if ans >= x:
                    break
            if ans < x:
                ok = False
                break

        if ok == True:
            s=0
            for j in range(i):
                s+=v[j][0]
            if sum > s or sum == -1:
                sum=s


print(sum)

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

n,m,x=map(int, input().split())

li = deque()

sum = -1
ans = 0
for i in range(n):
    li.append(list(map(int, input().split())))

for i in range(1,n+1):
    for v in itertools.permutations(li, i):
        ok = True
        for j in range(1,m+1):
            ans = 0
            for k in v:
                ans += k[j]
                if ans >= x:
                    break
            if ans < x:
                ok = False
                break

        if ok == True:
            s=0
            for j in range(i):
                s+=v[j][0]
            if sum > s or sum == -1:
                sum=s


print(sum)

Fixed submission:
from collections import deque
import itertools

n,m,x=map(int, input().split())

li = deque()

sum = -1
ans = 0
for i in range(n):
    li.append(list(map(int, input().split())))

for i in range(1,n+1):
    for v in itertools.combinations(li, i):
        ok = True
        for j in range(1,m+1):
            ans = 0
            for k in v:
                ans += k[j]
                if ans >= x:
                    break
            if ans < x:
                ok = False
                break

        if ok == True:
            s=0
            for j in range(i):
                s+=v[j][0]
            if sum > s or sum == -1:
                sum=s


print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
X=int(input())
m = X
pf={}
if X == 1:
    pf[1] = 1
else:
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1

for p in pf.keys():
    i = 0
    while True:
        if pow(i,5) - pow(i-p,5) == X:
            print(i,i-p)
            exit()
        i+=1

Fixed submission:
import math
X=int(input())
end=False
for i in range(-120,120):
    for j in range(-120,120):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            end=True
            break
    if end==True:
        break
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int, input().split()))

for i in range(1,n+1):
    print(A.count(i))


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

for i in range(n-1):
    B[A[i]-1] += 1

for j in range(n):
    print(B[j])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

K = int(input())

list = [1,2,3,4,5,6,7,8,9]
i = 0
for i in range(K):
    v = list.pop(0)

    t = v%10

    if t != 0:
        list.append(10*v + (t-1))

    list.append(10*v + t)

    if t != 9:
        list.append(10*v + (t+1))


print(v)


Fixed submission:
from collections import deque

K = int(input())

list = deque(range(1,10))
i = 0
for i in range(K):
    v = list.popleft()

    t = v%10

    if t != 0:
        list.append(10*v + (t-1))

    list.append(10*v + t)

    if t != 9:
        list.append(10*v + (t+1))


print(v)

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

list = [1,2,3,4,5,6,7,8,9]
i = 0
while len(list) != 0:
    v = list.pop(0)

    i += 1
    if i == K:
        break

    t = v%10

    if t != 0:
        list.append(10*v + (t-1))

    list.append(10*v + t)

    if t != 9:
        list.append(10*v + (t+1))


print(v)

Fixed submission:
from collections import deque

K = int(input())

list = deque(range(1,10))
i = 0
for i in range(K):
    v = list.popleft()

    t = v%10

    if t != 0:
        list.append(10*v + (t-1))

    list.append(10*v + t)

    if t != 9:
        list.append(10*v + (t+1))


print(v)

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

list = [1,2,3,4,5,6,7,8,9]
i = 0
while len(list) != 0:
    v = list.pop(0)

    i += 1
    if i == K:
        break

    if v%10 == 0:
        list.append(v*10)
        list.append(v*10+1)
    elif v%10 == 9:
        list.append(v*10+8)
        list.append(v*10+9)
    else:
        t = v%10
        list.append(v*10 + (t-1))
        list.append(v*10 + t)
        list.append(v*10 + (t+1))

print(v)

Fixed submission:
from collections import deque

K = int(input())

list = deque(range(1,10))
i = 0
for i in range(K):
    v = list.popleft()

    t = v%10

    if t != 0:
        list.append(10*v + (t-1))

    list.append(10*v + t)

    if t != 9:
        list.append(10*v + (t+1))


print(v)
Buggy python submission (verdict: Runtime Error):
n=input()

if n[-1]!='s':

	print(n+'s')elif n[-1]=='s':

	print(n+'es')

Fixed submission:
n=input()
if n[-1]!='s':
	print(n+'s')
elif n[-1]=='s':
	print(n+'es')
Buggy python submission (verdict: Runtime Error):
n=int(input())
count=0
counts=[]
for i in range(n):
	i,j=list(map(int,input().split()))
	if i==j:
		count+=1
	else:
		counts.append(count)
		count=0
if max(counts)>=3:
	print('Yes')
else:
	print('No')

Fixed submission:
n=int(input())
count=0
counts=[]
z=[]
for i in range(n):
	x,y=list(map(int,input().split()))
	z.append([x,y])
z.append([-14,-20])
for i in z:
	if i[0]==i[1]:
		count+=1
	else:
		counts.append(count)
		count=0
if max(counts)>=3:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
d, t, s=list(map(int,input().split()))

x=s*t

if x>=d:

	print('Yes')else:

	print('No')

Fixed submission:
d, t, s=list(map(int,input().split()))
x=s*t
if x>=d:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
list = [a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z]

C = str(input())

print(list[(list.index(C)+1)%len(list)])

Fixed submission:
list = ['a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

C = str(input())

print(list[(list.index(C)+1)%len(list)])