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

if s.is_super:
  print("A")
else:
  print("a")

Fixed submission:
x = input()

if x in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:
  print('a')
else:
  print('A')

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

if x in [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]:
  print('a')
else:
  print('A')

Fixed submission:
x = input()

if x in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:
  print('a')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
flag = True
for a in range(101):
  if 2*a + 4*(x-a) == y:
    print("Yes")
    flag = False
    break
if flag:
  print("No")

Fixed submission:
x, y = map(int, input().split())
flag = True
for a in range(x+1):
  if 2*a + 4*(x-a) == y:
    print("Yes")
    flag = False
    break
if flag:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
x = sorted(x)
ans=1
for i in a:
  ans *= i
  if ans > 10 ** 8:
    print(-1)
    exit()
print(ans)



Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)

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

a = list(map(int, input().split()))
m = 1
for i in range(n):
  if a.count(0):
    m = 0
    break
  elif m > 10**18:
    break
  else:
    m *= a[i]
if m == 0:
  print(0)
elif m > 10**18:
  print('-1')
else:
  print(m)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)

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

a = list(map(int, input().split()))
m = 1
for i in range(n):
  m *= a[i]
if m > 10**18:
  print('-1')
else:
  print(m)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input()
a, b=map(int, input().split())

c=0
for i in range(a, b+1):
	if i%k == 0:
        c += 1
if c == 0:
	print("NG")
else:
    print("OK")

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

c=0
for i in range(a, b+1):
  if i%k == 0:
    c += 1
  else:
    pass    
if c == 0:
  print("NG")
else:
  print("OK")
Buggy python submission (verdict: Runtime Error):
S = input()
a = 0
count=[]

for i in range(len(S)):
  if S[i] in ["A", "C", "G", "T"]:
    a += 1
    count.append(a)
  else:
    a = 0
print(max(list(map(int, count))))

Fixed submission:
S = input()
a = 0
count=[]

for i in range(len(S)):
  if S[i] in ["A", "C", "G", "T"]:
    a += 1
    count.append(a)
  else:
    a = 0
    count.append(a)
print(max(list(map(int, count))))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
I = int(math.sqrt(N) // 1)
print(I)

a = []
for i in range(1, I):
  if N%i==0:
    j=N//i
    k = len(str(i))
    l = len(str(j))
    m = max(k, l)
    a.append(int(m))
print(min(a))

Fixed submission:
N = int(input())
l = []
for a in range(1, 10**5+1):
  if N % a == 0:
    b = N // a
    s = max(len(str(a)), len(str(b)))
    l.append(int(s))
print(min(l))

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

N = int(input())
I = int(math.sqrt(N) // 1)
print(I)

a = []
for i in range(1, I):
  if N%i==0:
    j=N//i
    k = len(list(str(i)))
    l = len(list(str(j)))
    m = max(k, l)
    a.append(m)
print(min(a))

Fixed submission:
N = int(input())
l = []
for a in range(1, 10**5+1):
  if N % a == 0:
    b = N // a
    s = max(len(str(a)), len(str(b)))
    l.append(int(s))
print(min(l))

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

N = int(input())
I = int(math.sqrt(N) // 1)

a = []
for i in range(1, I):
  if N%i==0:
    j=N//i
    i = len(list(str(i)))
    j = len(list(str(j)))
    k = max(i, j)
    a.append(k)
print(min(a))

Fixed submission:
N = int(input())
l = []
for a in range(1, 10**5+1):
  if N % a == 0:
    b = N // a
    s = max(len(str(a)), len(str(b)))
    l.append(int(s))
print(min(l))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = []
for a in range(1, N+1):
  if N % a == 0:
    b = N // a
    s = max(len(str(a)), len(str(b)))
    l.append(int(s))
print(min(l))


Fixed submission:
N = int(input())
l = []
for a in range(1, 10**5+1):
  if N % a == 0:
    b = N // a
    s = max(len(str(a)), len(str(b)))
    l.append(int(s))
print(min(l))
Buggy python submission (verdict: Runtime Error):
print(input[:3])

Fixed submission:
print(input()[:3])
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
res = 0

if i in range(s):
  if s[i] != t[i]:
    res += 1
    
print(res)
  

Fixed submission:
s = input()
t = input()
res = 0
 
for i in range(len(s)):
  if s[i] != t[i]:
    res += 1
    
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = list(map(int, input().split()))
res = arr[0]
 
for a in arr[1:]:
  res *= a
 
if res > 1000000000000000000:
  print("-1")
else:
  print(res)

Fixed submission:
def main():
  n = int(input())
  arr = list(map(int, input().split()))
  
  
  if 0 in arr:
    print(0)
    return 0
  res = arr[0]
  for a in arr[1:]:
    res *= a
    if res > 1000000000000000000:
      print("-1")
      return 0

  print(res)

main()
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = list(map(int, input().split()))

cnt = 0
ret = 0

while(cnt < k):
  if(a > 0):
    ret += 1
    a -= 1
    cnt += 1
  elif(b > 0):
    b -= 1
    cnt += 1
  else:
    ret -= 1
    c -= 1
    cnt += 1

print(ret)

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

cnt = 0
ret = 0

cnt += a
ret += a
if(cnt > k):
  ret -= cnt-k
if(cnt < k):
  cnt += b
if(cnt < k):
  cnt += c
  ret -= c
  if(cnt > k):
    ret += cnt-k

print(ret)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A, B, C, D = map(int, input().split())

if A % C ==0:ca = A//C-1
else: ca = A//C
cb = B//C


if A % D ==0: ad = A//D-1
else:da = A//D 
db = B//D

lcm = C * D //gcd(C,D)
if A % lcm==0: cda = A//lcm-1
else:cda = A//lcm
cdb = B//lcm

print(B-A+1-((cb-ca)+(db-da)-(cdb-cda)))

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

mini = K
right = left = K
for i in range(N):
	l_begin = i-1
	r_begin = i+1
	if i == 0:
		l_begin = N-1
		right = A[l_begin] - A[i]
		left = K - (A[r_begin]-A[i])
	elif i == N-1:
		r_begin = 0
		right = K - (A[i]-A[l_begin])
		left = A[i] - A[r_begin]
	else:
		right = K - (A[i]-A[l_begin])
		left = K - (A[r_begin]-A[i])
	local = min(right, left)
	if local < mini:
		mini = local
		

print(mini)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T  = input().split()

for i in range(N):
    r += S[i] + T[i]
    
print(r)


Fixed submission:
N = int(input())
S, T  = input().split()
r = ''

for i in range(N):
    r += S[i] + T[i]

print(r)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a  = list(map(int, input().split()))
begin = -1
max = N+1

for i in range(1,N+1):
    try:
        begin = a.index(i)
    except ValueError:
        break
    
    a = a[begin+1:]
    max = i

print(N-max)

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

j = 1
for i in range(N):
    if j == a[i]:
        j += 1

if j == 1:
    print(-1)
else:
    print(N-j+1)
Buggy python submission (verdict: Time Limit Exceeded):
#ABC 141
N, K, Q = map(int, input().split())
A = [int(input())-1 for i in range(Q)]
score = [K for i in range(N)]

for a in A:
	for i in range(N):
		if i == a:
			continue
		else:
			score[i] -= 1

# 勝ち抜けチェック 
for i in range(N):
	if score[i] > 0:
		print("Yes")
	else:
		print("No")
		

Fixed submission:
#ABC 141
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
score = [0 for i in range(N)]

for a in A:
	score[a-1] += 1


# 勝ち抜けチェック 
for i in range(N):
	if K-Q+score[i] > 0:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A, B, C, D = map(int, input().split())

if A % C ==0:ca = A//C-1
else: ca = A//C
cb = B//C


if A % D ==0: ad = A//D-1
else:da = A//D 
db = B//D

lcm = C * D //gcd(C,D)
if A % lcm==0: cda = A//lcm-1
else:cda = A//lcm
cdb = B//lcm

print(B-A+1-((cb-ca)+(db-da)-(cdb-cda)))

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())

ca = (A-1)//C 
cb = B//C

da = (A-1)//D
db = B//D

lcm = C * D //gcd(C,D)
cda = (A-1)//lcm
cdb = B//lcm

print(B-A+1-((cb-ca)+(db-da)-(cdb-cda)))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
id = [0 for i in range(N)]

for _ in range(M):
  l, r = map(int, input().split())
  for i in range(l, r+1):
    id[i-1] += 1

print(id.count(M))

Fixed submission:
N, M = map(int, input().split())
id = [0 for i in range(N)]

max_l = 0
min_r = 100000
for _ in range(M):
  l, r = map(int, input().split())
  if max_l < l:
    max_l = l
  if min_r > r:
    min_r = r

id = min_r-max_l+1
print(0 if id <0 else id)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
quiz = [list(map(int, input().split())) for _ in range(Q)]

for q in quiz:
  l = q[0]
  r = q[1]
  print(S[l-1:r].count("AC"))

Fixed submission:
N, Q = map(int, input().split())
S = input()
quiz = [list(map(int, input().split())) for _ in range(Q)]

t = [0] * (N+1)
for i in range(N):
  t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)

for q in quiz:
  l = q[0]
  r = q[1]
  print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

cnt = 0
for i in range(min(A, B)):
  if (A % i == 0) & (B % i == 0):
    cnt += 1
  if cnt == K:
    print(cnt)
    exit(0)

Fixed submission:
A, B, K = map(int, input().split())
 
cnt = 0
for i in range(1, min(A, B)+1)[::-1]:
  if (A % i == 0) and (B % i == 0):
    cnt += 1
  if cnt == K:
    print(i)
    exit(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = 100
for i in range(N+1//2):
  if N % i == 0:
    ans = min(ans, len(str(i))+len(str(N//i)))
print(ans)

Fixed submission:
from math import sqrt
N = int(input())

ans = 100
sq_n = int(sqrt(N))
for i in range(1, sq_n+1):
  if N % i == 0:
    ans = min(ans, max(len(str(i)),len(str(N//i))))
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = b // c - (- (-a // c)) + 1
    warikireru_d = b // d - (-(-a // d)) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = b // lcm_1 - (- (-a // lcm_1)) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))


Fixed submission:
import re

s = input()

if re.findall(r"(.)\1+",s):
    print("Bad")
else:
    print("Good")

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


def lcm(x, y):
    return math.floor((x * y) / fractions.gcd(x, y))


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = math.floor(b / c) - math.ceil(a / c) + 1
    warikireru_d = math.floor(b / d) - math.ceil(a / d) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = math.floor(b / lcm_1) - math.ceil(a / lcm_1) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))

Fixed submission:
import re

s = input()

if re.findall(r"(.)\1+",s):
    print("Bad")
else:
    print("Good")

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


def lcm(x, y):
    return math.floor((x * y) / fractions.gcd(x, y))


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = math.floor(b / c) - math.ceil(a / c) + 1
    warikireru_d = math.floor(b / d) - math.ceil(a / d) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = math.floor(b / lcm_1) - math.ceil(a / lcm_1) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))


Fixed submission:
import re

s = input()

if re.findall(r"(.)\1+",s):
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = math.floor(b / c) - math.ceil(a / c) + 1
    warikireru_d = math.floor(b / d) - math.ceil(a / d) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = math.floor(b / lcm_1) - math.ceil(a / lcm_1) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))


Fixed submission:
import math
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = b // c - (- (-a // c)) + 1
    warikireru_d = b // d - (-(-a // d)) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = b // lcm_1 - (- (-a // lcm_1)) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = math.floor(b / c) - math.ceil(a / c) + 1
    warikireru_d = math.floor(b / d) - math.ceil(a / d) + 1
    lcm = lcm(c, d)
    warikireru_lcm = math.floor(b / lcm) - math.ceil(a / lcm) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))


Fixed submission:
import math
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    warikireru_c = b // c - (- (-a // c)) + 1
    warikireru_d = b // d - (-(-a // d)) + 1
    lcm_1 = lcm(c, d)
    warikireru_lcm = b // lcm_1 - (- (-a // lcm_1)) + 1
    num = b - a + 1
    print(num - (warikireru_c + warikireru_d - warikireru_lcm))
Buggy python submission (verdict: Runtime Error):
import numpy as np

k = 0


def calc(a):
    return np.sum(a) >= k


def main():
    global k
    n, k = map(int, input().split())
    a = np.array(list(map(int, input().split())))
    answer = 0
    list_pattern = []
    for i1 in range(n):
        for i2 in range(len(a)):
            list_pattern.append(a[i1:i2 + 1])

            # if a[i1:i2 + 1].sum() >= k:
            #     answer += 1
    list_answer = map(calc, list_pattern)
    print(sum(list_answer))


if __name__ == "__main__":
    main()


Fixed submission:
if __name__ == '__main__':
    x, a = map(int, input().split())
    if x < a:
        print(0)
    else:
        print(10)
Buggy python submission (verdict: Runtime Error):
    import math
    apple_one, apple_kakera = (int(i) for i in input().split())  
    apple_kakera += apple_one * 3
    print(math.floor(apple_kakera / 2) )

Fixed submission:
import math
apple_one, apple_kakera = (int(i) for i in input().split())  
apple_kakera += apple_one * 3
print(math.floor(apple_kakera / 2) )
Buggy python submission (verdict: Time Limit Exceeded):
lines = []
for i in range(2):
    lines.append(input())
num = int(lines[0])

out = 1
split = lines[1].split()
for i in range(num):
    out = int(split[i]) * out 
if out > 1000000000000000000:
    out = - 1    
print(out)

Fixed submission:
lines = []
for i in range(2):
    lines.append(input())
num = int(lines[0])

out = 1
split = lines[1].split()
if "0" in split:
    out = 0
for i in range(num):
    out = int(split[i]) * out 
    if out > 1000000000000000000:
        out = - 1    
        break
print(out)
Buggy python submission (verdict: Runtime Error):
for i in range(2):
  input = input()
  lines.append(int(input))
searchList = []  
for i in range(lines[0]):
  split = lines[1].split()
  if split[i] % 2 == 0:
    searchList.appned(split[i])
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
print(out)
    

Fixed submission:
lines = []
for i in range(2):
  inp = input()
  lines.append(inp)
searchList = []  
for i in range(int(lines[0])):
  split = lines[1].split()
  if int(split[i]) % 2 == 0:
    searchList.append(int(split[i]))
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
if out == "APPROVED":
    print(out)
Buggy python submission (verdict: Runtime Error):
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
console.log(result)

Fixed submission:
num = input()
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
print(result)
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
K=int(input())
for i in range(K):
    if A>=B:
        B=B*2
        M=K-(i+1)
    if A<B:
        break
C=C*(2**M)
if C>B and A<B:
    print('Yes')
else:
    print('No')

Fixed submission:
A,B,C=map(int,input().split())
K=int(input())
M=K
for i in range(K):
    if A>=B:
        B=B*2
        M=K-(i+1)
    if A<B:
        break
C=C*(2**M)
if C>B and A<B:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
K=int(input())
for i in range(K):
    if A>=B:
        B=B*2
        M=K-(i+1)
    if A<B:
        break
C=C*(2**M)
if C>B:
    print('Yes')
else:
    print('No')

Fixed submission:
A,B,C=map(int,input().split())
K=int(input())
M=K
for i in range(K):
    if A>=B:
        B=B*2
        M=K-(i+1)
    if A<B:
        break
C=C*(2**M)
if C>B and A<B:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=[int(s) for s in input().split()]
dp=[0]*(N-K+2)
dp[1]=1
for j in range(K):
    dp[1]*=A[j]
for i in range(1,N-K+1):
    dp[i+1]=dp[i]*A[K+i-1]/A[i-1]
    if dp[i+1]>dp[i]:
        print('Yes')
    else:
        print('No')

Fixed submission:
N,K=map(int,input().split())
A=[int(s) for s in input().split()]
for i in range(N-K):
    if A[K+i]/A[i]>1:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a,b = map(input().split(), int)
print(a*b)

Fixed submission:
a,b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)

s1 = s[:(n/2)]
s2 = s[(n/2):]

print( s1 == s2 ? 'Yes' : 'No')

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

s1 = s[:(n//2)]
s2 = s[(n//2):]

print( 'Yes' if s1 == s2 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = Counter(map(int, input().split()))
q = int(input())
for i in range(q):
  b, c = map(int, input().split())
  a[c] += a[b]
  del a[b]
  s = sum(x * y for x, y in a.items())
  print(s)


Fixed submission:
from collections import Counter

n = int(input())
a = Counter(map(int, input().split()))
q = int(input())
s = sum(x * y for x, y in a.items())
for _ in range(q):
  b, c = map(int, input().split())
  s = s + (c - b) * a[b]
  a[c] += a[b]
  a[b] = 0
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for ai in a:
  ans *= ai
if ans > 10 ** 18:
  print(-1)
else:
  print(ans)


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

for ai in a:
  ans *= ai
  if ans > 10 ** 18:
    print(-1)
    quit()
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
d = int(input())
s = input()
R, G, B = [], [], [] 

for i, c in enumerate(s):
    if c == "R":
        R.append(i)
    elif c == "G":
        G.append(i)
    else:
        B.append(i)

ans = 0
for r in R:
    for g in G:
        for b in B:
            x = sorted([r, g, b])
            if x[1] - x[0] != x[2] - x[1]:
                ans += 1
print(ans)


Fixed submission:
n = int(input())
s = input()
cnt = s.count("R") * s.count("G") * s.count("B")
for i in range(n-2):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        k = j - i + j
        if k > n-1:
            continue
        if s[i] == s[k] or s[j] == s[k]:
                continue
        cnt -= 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

queue = list(range(1, 10))

for i in range(K):
    x = queue.pop(0)
    shimo1keta = x % 10
    if shimo1keta != 0:
        queue.append(x * 10 + shimo1keta - 1)
    queue.append(x * 10 + shimo1keta)
    if shimo1keta != 9:
        queue.append(x * 10 + shimo1keta + 1)

print(x)


Fixed submission:
from collections import deque

K = int(input())
queue = deque(range(1, 10))

for i in range(K):
    x = queue.popleft()
    shimo1keta = x % 10
    if shimo1keta != 0:
        queue.append(x * 10 + shimo1keta - 1)
    queue.append(x * 10 + shimo1keta)
    if shimo1keta != 9:
        queue.append(x * 10 + shimo1keta + 1)

print(x)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def fn(n):
    if n <= 1:
        return 0
    return n - 1 + fn(n-1)

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

c = Counter(A)
kumi = 0
for k, v in c.items():
    kumi += fn(v)

for ai in A:
    print(kumi - (c[ai] - 1))


Fixed submission:
from collections import Counter
import sys

sys.setrecursionlimit(10**6)

def fn(n):
    if n <= 1:
        return 0
    return n - 1 + fn(n-1)

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

c = Counter(A)
kumi = 0
for k, v in c.items():
    kumi += fn(v)

for ai in A:
    print(kumi - (c[ai] - 1))
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
rev = False

for _ in range(q):
    query = input().split()
    t = query[0]
    if t == "1":
        rev = not rev
        continue
    f = query[1]
    c = query[2]
    if not rev and f == "2" or rev and f == "1":
        s.append(c)
    else:
        s.insert(0, c)
if rev:
    s = reversed(s)
print("".join(s))


Fixed submission:
from collections import deque

s = input()
q = int(input())

deq = deque(s)
rev = False

for _ in range(q):
    query = input().split()
    t = query[0]
    if t == "1":
        rev = not rev
        continue
    f = query[1]
    c = query[2]
    if not rev and f == "2" or rev and f == "1":
        deq.append(c)
    else:
        deq.appendleft(c)
if rev:
    deq = reversed(deq)
print("".join(deq))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(lambda x: (1 + x) / 2, map(int, input().split())))

ans = max(sum(p[i:i+k]) for i in range(n - k + 1))
print(ans)


Fixed submission:
from itertools import accumulate

n, k = map(int, input().split())
p = map(int, input().split())

ac = [0] + list(accumulate(map(lambda x: (1 + x) / 2, p)))
ans = max(ac[i+k] - ac[i] for i in range(n - k + 1))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
pattern = [tuple(s[:3])]
for c in s[3:]:
    for i in range(len(pattern)):
        p1, p2, p3 = pattern[i]
        if (p1, p2, c) not in pattern:
            pattern.append((p1, p2, c))
        if (p1, p3, c) not in pattern:
            pattern.append((p1, p3, c))
        if (p2, p3, c) not in pattern:
            pattern.append((p2, p3, c))
print(len(pattern))


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

for i in range(1000):
    p = str(i).zfill(3)
    p1 = s.find(p[0])
    if p1 == -1: continue
    p2 = s.find(p[1], p1 + 1)
    if p2 == -1: continue
    p3 = s.find(p[2], p2 + 1)
    if p3 == -1: continue
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
ans = 0
if x <= 3:
    ans += 400_000 - x * 100_000
if y <= 3:
    ans += 400_000 - y * 100_000
if x == y == 1:
    ans += 400_000
print(ans)


Fixed submission:
x, y = map(int, input().split())
ans = 0
if x <= 3:
    ans += 400000 - x * 100000
if y <= 3:
    ans += 400000 - y * 100000
if x == y == 1:
    ans += 400000
print(ans)