Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

cnt = 0
step = 0

for i in range(N):
    if A[step] == B[i]:
        cnt += 1
    else:
        step += 1



flag = 0

for j in range(100):
    C = B[cnt+j:]+B[:cnt+j]
    flag = 0
    for i in range(N):
        if A[i] == C[i]:
            flag = 1
            break
    if i == N-1 and flag == 0:
        break
    
    
if flag == 1:
    print('No')
else:
    print('Yes')
    print(' '.join(map(str, C)))

Fixed submission:
x = int(input())
if x == 0:
    print(1)
else:
    print(0)

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

cnt = 0
step = 0

for i in range(N):
    if A[step] == B[i]:
        cnt += 1
    else:
        step += 1

C = B[cnt:]+B[:cnt]

flag = 0
for i in range(N):
    if A[i] == C[i]:
        flag = 1
        break

if flag == 1:
    print('No')
else:
    print('Yes')
    print(' '.join(map(str, B[cnt:]+B[:cnt])))

Fixed submission:
x = int(input())
if x == 0:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
#####segfunc######
def segfunc(x,y):
    return x | y

def init(init_val):
    #set_val
    for i in range(n):
        seg[i+num-1]=set([init_val[i]])  
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
ide_ele = set()

#num:n以上の最小の2のべき乗

n, Q = map(int, input().split())

num =2**(n-1).bit_length()
seg=[ide_ele]*2*num

c = list(map(int,input().split()))
init(c)
for _ in range(Q):
    l, r = map(int, input().split())
    ans = query(l-1,r)
    print(len(ans))

Fixed submission:
x = int(input())
if x >= 30:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
i = 1
cnt = 0


while(i+3<=N):
    j = i+3
    num = int(S[i-1:j])
    r = num % 2019
    while(j<N):
        if r >= 10000:
            r = r % 2019
        if r in [0, 2019, 4038, 6057, 8076]:
            cnt += 1
        r = r * 10 + int(S[j])
        j += 1
    if r % 2019 == 0:
        cnt += 1
    i += 1

print(cnt)

Fixed submission:
s = input()
n = len(s)
p = 2019
 
 
 
digit_rm = [0 for _ in range(n)]
for i in range(n):
	digit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p
 
remain = [0 for _ in range(n)]
for i in range(n):
	if i == 0:
		remain[i] = digit_rm[i]
	else:
		remain[i] = (remain[i-1] + digit_rm[i]) % p
 
pcnt = [0 for _ in range(p)]
 
for i in remain:
	pcnt[i] += 1
 
if 10 % p == 0:
	ans = 0
	for i in range(n):
		if int(s[n-1-i]) % p == 0:
			ans += n - i
	print(ans)
else:
	ans = pcnt[0]
	for num in pcnt:
		if num != 0:
			ans += num * (num - 1) // 2
 
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
i = 1
cnt = 0

while(i+3<=N):
    j = i+3
    num = int(S[i-1:j])
    while(j<N):
        r = num % 2019
        if r == 0:
            cnt += 1
        num = r * 10 + int(S[j])
        j += 1
    r = num % 2019
    if r == 0:
        cnt += 1
    i += 1

print(cnt)

Fixed submission:
s = input()
n = len(s)
p = 2019
 
 
 
digit_rm = [0 for _ in range(n)]
for i in range(n):
	digit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p
 
remain = [0 for _ in range(n)]
for i in range(n):
	if i == 0:
		remain[i] = digit_rm[i]
	else:
		remain[i] = (remain[i-1] + digit_rm[i]) % p
 
pcnt = [0 for _ in range(p)]
 
for i in remain:
	pcnt[i] += 1
 
if 10 % p == 0:
	ans = 0
	for i in range(n):
		if int(s[n-1-i]) % p == 0:
			ans += n - i
	print(ans)
else:
	ans = pcnt[0]
	for num in pcnt:
		if num != 0:
			ans += num * (num - 1) // 2
 
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
i = 1
cnt = 0

while(i+3<=N):
    j = i+3
    num = int(S[i-1:j])
    while(j<N):
        r = num % 2019
        if r == 0:
            cnt += 1
        num = r * 10 + int(S[j])
        j += 1
    r = num % 2019
    if r == 0:
        cnt += 1
    i += 1

print(cnt)

Fixed submission:
s = input()
n = len(s)
p = 2019
 
 
 
digit_rm = [0 for _ in range(n)]
for i in range(n):
	digit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p
 
remain = [0 for _ in range(n)]
for i in range(n):
	if i == 0:
		remain[i] = digit_rm[i]
	else:
		remain[i] = (remain[i-1] + digit_rm[i]) % p
 
pcnt = [0 for _ in range(p)]
 
for i in remain:
	pcnt[i] += 1
 
if 10 % p == 0:
	ans = 0
	for i in range(n):
		if int(s[n-1-i]) % p == 0:
			ans += n - i
	print(ans)
else:
	ans = pcnt[0]
	for num in pcnt:
		if num != 0:
			ans += num * (num - 1) // 2
 
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

from collections import Counter

m = Counter(S)

ans = m['R']*m['G']*m['B']
non = 0


for i in range ((N-1)//2):
    st = 0
    while st + (i+1)*2 < N:
        if S[st] != S[st+i+1] and S[st+i+1] != S[st+2*(i+1)] and S[st] != S[st+2*(i+1)]:
            non += 1
        st += 1
        
print(ans-non)

Fixed submission:
N = int(input())
S = input()

from collections import Counter

m = Counter(S)

ans = m['R']*m['G']*m['B']
non = 0


for i in range ((N-1)//2):
    st = 0
    while st + (i+1)*2 < N:
        if S[st] != S[st+i+1] and S[st+i+1] != S[st+2*(i+1)] and S[st] != S[st+2*(i+1)]:
            non += 1
        st += 1
        
print(ans-non)
Buggy python submission (verdict: Runtime Error):
X,Y,A,B,C = map(int, input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p = sorted(p)[::-1]
q = sorted(q)[::-1]
r = sorted(r)[::-1]

Ca = 0
Cb = 0
Cc = 0

ans = 0

while Ca + Cb + Cc != X + Y:
    if Ca == X:
        if q[Cb] > r[Cc]:
            ans = ans + q[Cb]
            Cb = Cb + 1
        else:
            ans = ans + r[Cc]
            Cc = Cc + 1
    else:
        if Cb == Y:
            if p[Ca] > r[Cc]:
                ans = ans + p[Ca]
                Ca = Ca + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
        else:
            if p[Ca] >= q[Cb] and p[Ca] > r[Cc]:
                ans = ans + p[Ca]
                Ca = Ca + 1
            elif q[Cb] > p[Ca] and q[Cb] > r[Cc]:
                ans = ans + q[Cb]
                Cb = Cb + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
print(ans)

Fixed submission:
X,Y,A,B,C = map(int, input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p = sorted(p)[::-1]
q = sorted(q)[::-1]
r = sorted(r)[::-1]

Ca = 0
Cb = 0
Cc = 0

ans = 0

while Ca + Cb + Cc != X + Y:
    if Cc == C:
        if q[Cb] > p[Ca]:
            ans = ans + q[Cb]
            Cb = Cb + 1
        else:
            ans = ans + p[Ca]
            Ca = Ca + 1
    else:
        if Ca == X:
            if q[Cb] > r[Cc]:
                ans = ans + q[Cb]
                Cb = Cb + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
        else:
            if Cb == Y:
                if p[Ca] > r[Cc]:
                    ans = ans + p[Ca]
                    Ca = Ca + 1
                else:
                    ans = ans + r[Cc]
                    Cc = Cc + 1
            else:
                if p[Ca] >= q[Cb] and p[Ca] > r[Cc]:
                    ans = ans + p[Ca]
                    Ca = Ca + 1
                elif q[Cb] > p[Ca] and q[Cb] > r[Cc]:
                    ans = ans + q[Cb]
                    Cb = Cb + 1
                else:
                    ans = ans + r[Cc]
                    Cc = Cc + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A = input()
B = A.split()
a = int(B[0])
b = int(B[1])
c = int(B[2])
d = int(B[3])

if a <= 0 and b <= 0 and c <= 0 and d <= 0:
    print(a*c)
elif a > 0 and b > 0 and c > 0 and d > 0:
    print(b*d)
elif a > 0 and b > 0 and c<=0 and d<=0:
    print(a*d)
elif a<=0 and b<=0 and c>0 and d>0:
    print(b*c)
elif a<=0 and b<=0 and c<=0 and d>0:
    print(a*c)
elif a>0 and b>0 and c<=0 and d>0:
    print(b*d)
elif a <= 0 and b > 0:
    if c <= 0 and d > 0:
        if -c <= d and -a <= b:
            print(d*b)
        elif -c <= d and -a > b:
            if a*c > b*d:
                print(a*c)
            elif a*c <= b*d:
                print(b*d)
        elif -c > d and -a <= b:
            if a*c > b*d:
                print(a*c)
            elif a*c <= b*d:
                print(b*d)
        elif -c > d and -a > b:
            print(a*c)
    elif c> 0 and d <= 0:
        print()
    elif c<=0 and d<=0:
        print(a*c)

Fixed submission:
x = int(input())
if x == 1:
    print(0)
elif x == 0:
    print(1)
Buggy python submission (verdict: Runtime Error):
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    ans = 9999999999
    lists = []
    if n == 0:
        print(x)
        exit()
    for i in range(-1000, 1000):
        if not i in p:
            lists.append(i)
    for i in lists:
        if ans > abs(x - i):
            ans = abs(x-i)
            m = i
     
    print(m)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
lists = []
if n == 0:
    print(x)
    exit()
for i in range(-1000, 1000):
    if not i in p:
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = prod(a)
    if s > 10**18:
        print(-1)
    else:
        print(s)

Fixed submission:
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    a.sort()
    x = True
    for i in range(len(a)):
        s = s * a[i]
        if s > 10**18:
            print(-1)
            x = False
            break
    if x:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
#
# author Sidratul
#

from functools import reduce

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = reduce((lambda x, y: x*y), a)
    if s > 10**18:
        print(-1)
    else:
        print(s)

Fixed submission:
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    a.sort()
    x = True
    for i in range(len(a)):
        s = s * a[i]
        if s > 10**18:
            print(-1)
            x = False
            break
    if x:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
#
# author Sidratul
#

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    for i in a:
        s = s*i
    if s > 10**18:
        print(-1)
    else:
        print(s)

Fixed submission:
#
# author Sidratul
#

from math import prod

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split(' ')))
    s = 1
    a.sort()
    x = True
    for i in range(len(a)):
        s = s * a[i]
        if s > 10**18:
            print(-1)
            x = False
            break
    if x:
        print(s)
Buggy python submission (verdict: Time Limit Exceeded):
m = input()
N = list(map(int, input().split(' ')))
# m = int(input())
# k = int(input())
c = 0
N.sort()
for i in N:
    
    if N.count(i) > 1:
        c = 1
        break
if c == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
m = input()
N = list(map(int, input().split(' ')))
# m = int(input())
# k = int(input())
c = 0
N.sort()
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        print('NO')
        exit()

print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
m = input()
N = list(map(int, input().split(' ')))
# m = int(input())
# k = int(input())
c = 0
for i in N:
    
    if N.count(i) > 1:
        c = 1
        break
if c == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
m = input()
N = list(map(int, input().split(' ')))
# m = int(input())
# k = int(input())
c = 0
N.sort()
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        print('NO')
        exit()

print('YES')
Buggy python submission (verdict: Runtime Error):
#B問題
n = int(input())

# ある整数に対し、各桁の和を与える

sum = 0
while n > 0:
    sum += n % 10
    n = int(n / 10)
    
ans = sum % 9
    
if ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
#A問題

import math
N, X, T = map(int, input().split())
ans = T * math.ceil(N/X)
print(ans)
Buggy python submission (verdict: Runtime Error):
#B問題
n = int(input())

# ある整数に対し、各桁の和を与える

sum = 0
while n > 0:
    sum += n % 10
    n = int(n / 10)
    
ans = sum % 9
    
if ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
#B問題

#ABSの定石使うとなぜかRE

#今回はPython解説サイト参照

#①入力を文字列で受け取る→②一文字ずつ整数に変換して、forループで回しながら足し算する

N = input()
cur = 0

for i in N:
    cur += int(i)

if cur % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
#B問題
n = int(input())
# ある整数に対し、各桁の和を与える

def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = int(n / 10)
    return sum

ans = findSumOfDigits(n) % 9 

if ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
#B問題

#ABSの定石使うとなぜかRE

#今回はPython解説サイト参照

#①入力を文字列で受け取る→②一文字ずつ整数に変換して、forループで回しながら足し算する

N = input()
cur = 0

for i in N:
    cur += int(i)

if cur % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#C問題解説

n = int(input())  
chars = "Xabcdefghijklmnopqrstuvwxyz" # x番目がほしいときにchars[x-1]としたくないので、chars[0]は使わないことにします
n_rem = n  # 入力を直接操作すると、もし後々必要になったときに面倒なので
res = "" #最終的な答え格納用

while True:
    x = n_rem % 26
    # 余りが0、つまりzの場合は、26にします
    if x == 0:
        x = 26
    #1番目(a)~26番目(z)から対応する文字を取ってく
    res += chars[x] 
    
    #xを引いて26で割る
    n_rem -= x
    if n_rem == 0:
        break
    
    n_rem // = 26

# 0桁目が先頭で、最後の桁が末尾になっているので、反転させます
print(res[::-1])

Fixed submission:
n = int(input())
chars = "Xabcdefghijklmnopqrstuvwxyz"  # x番目がほしいときにchars[x-1]としたくないので、chars[0]は使わないことにします

n_rem = n  # 入力を直接操作すると、もし後々必要になったときに面倒なので
res = ""

while True:
    x = n_rem % 26
    # 余りが0、つまりzの場合は、26にします
    if x == 0:
        x = 26
    res += chars[x]

    # xを引いて、26で割ります
    n_rem -= x

    # 0なら終了します
    if n_rem == 0:
        break

    n_rem //= 26

# 0桁目が先頭で、最後の桁が末尾になっているので、反転させます
print(res[::-1])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
x = a
y = c
max = x * y
if b < 0:
  print(max)
else:
  for x in range(a,b + 1):
    for y in range(c,d + 1):
      if x * y > max:
        max = x * y
  print(max)


Fixed submission:
num = int(input())
if num == 0:
  print(1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
x = a
y = c
max = x * y
for x in range(a,b + 1):
  for y in range(c,d + 1):
    if x * y > max:
      max = x * y
print(max)

Fixed submission:
num = int(input())
if num == 0:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_str = input().split()
sum = 0
for i in range(N):
  for j in range(N-i-1):
    sum += int(a_str[i]) * int(a_str[i+j+1])
print(sum%(pow(10,9)+7))


Fixed submission:
import itertools
import math

N = int(input())
a_list = list(map(int, input().split()))
a_accumulate = list(itertools.accumulate(a_list))
a_sum = sum(a_list)
result = 0
i = 0
for a in a_list:
  result += a * (a_sum - a_accumulate[i])
  i += 1
print(result%(pow(10,9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
input_N = input()
N = int(input_N)
a_str = input().split()
a_int = []
sum = 0
for a in a_str:
  a_int.append(int(a))
for i in range(N):
  for j in range(N-i-1):
    sum += a_int[i] * a_int[i+j+1]
print(sum%(pow(10,9)+7))

Fixed submission:
import itertools
import math

N = int(input())
a_list = list(map(int, input().split()))
a_accumulate = list(itertools.accumulate(a_list))
a_sum = sum(a_list)
result = 0
i = 0
for a in a_list:
  result += a * (a_sum - a_accumulate[i])
  i += 1
print(result%(pow(10,9)+7))
Buggy python submission (verdict: Runtime Error):
input_string = input()
while n < len(input_string):
  if n == '7':
    print('Yes')
    n += 1
    break
  

Fixed submission:
input_string = input()
yes = 0
for n in input_string:
  if n == '7':
    print('Yes')
    yes = 1
    break
if not yes:
  print('No')
Buggy python submission (verdict: Runtime Error):
box = []
box = input().split()
box[0], box[1] = box[1], box[0]
box[0], box[2] = box[2], box[0]
print(box[0] box[1] box[2])

Fixed submission:
box = []
box = input().split()
box[0], box[1] = box[1], box[0]
box[0], box[2] = box[2], box[0]
print(box[0],  box[1],  box[2])

Buggy python submission (verdict: Runtime Error):
box = []
box = input().rstrip()
print(box[2] box[0] box[1])

Fixed submission:
box = []
box = input().split()
box[0], box[1] = box[1], box[0]
box[0], box[2] = box[2], box[0]
print(box[0],  box[1],  box[2])
Buggy python submission (verdict: Runtime Error):
N, M = input().split()
a = list.split()
a.sort(reverse=True)
if (a[M-1] >= sum(a) / 4*M)==True
	print("Yes")
else print("No")


Fixed submission:
N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[M-1] >= sum(a) / (4*M):
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N, M = input.split()
a = list.split()
a.sort(reverse=True)
if a[M-1] >= sum(a) / 4*M:
  print("Yes")
else:
  print("No")


Fixed submission:
N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[M-1] >= sum(a) / (4*M):
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
N, M = input.split()
a = list.split()
a.sort(reverse=True)
if (a[M-1] >= sum(a) / 4*M)==True
	print("Yes")
else print("No")

Fixed submission:
N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[M-1] >= sum(a) / (4*M):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
x = []
count = 0
while N - K >= 0:
  N = N - K
x.append(N)
while (N - K)*(-1) <= x[0 + count]:
  count = count + 1
  x.append((N - K)*(-1))
  N = N - K
print(x[0 + count])


Fixed submission:
N, K = map(int,input().split())
r = N%K
a = min(r, K-r)
print(a)
Buggy python submission (verdict: Runtime Error):
inp = input()
if inp == 1:
print(0)
else:
print(1)

Fixed submission:
if int(input())==1:
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
if input() == 1:
print(0)
else:
print(1)

Fixed submission:
if int(input())==1:
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
if input() == "1":
print(0)
else:
print(1)

Fixed submission:
if int(input())==1:
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
if(input()) == 0:
print(0)
else:
print(1)

Fixed submission:
if int(input())==1:
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
if(input()) is 0:
print(0)
else:
print(1)

Fixed submission:
if int(input())==1:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

Z = N/X-N%X
time = Z*T

print(time)

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

if A%B == 0:
	Z = A//B
else :
    Z = A//B + 1
time = Z*C

print(time)

Buggy python submission (verdict: Runtime Error):
var N = 20;
var X = 12;
var T = 6;
var Z = N/X-N%T;
var time = Z*T;
print(time);

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

if A%B == 0:
	Z = A//B
else :
    Z = A//B + 1
time = Z*C

print(time)

Buggy python submission (verdict: Runtime Error):
var Takoyaki = [N,X,T]
N = 20 
X = 12
T = 6
N / X -- N % X = Z
Z*T = time
print(time)

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

if A%B == 0:
	Z = A//B
else :
    Z = A//B + 1
time = Z*C

print(time)
Buggy python submission (verdict: Runtime Error):
n,*s=open(0);for t in['AC','WA','TLE','RE']:print(t,'x',s.count(t+'\n'))

Fixed submission:
n,*s=open(0).read().split()
for t in['AC','WA','TLE','RE']:print(f'{t} x {s.count(t)}')
Buggy python submission (verdict: Time Limit Exceeded):
input();a=sorted(map(int,input().split()));z=1
for i in a:z*=i
if z>1e18:z=-1
print(z)

Fixed submission:
n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(0 if 0in a else z)

Buggy python submission (verdict: Runtime Error):
input();a=sorted(map(int,input().split()));z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(z)

Fixed submission:
n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(0 if 0in a else z)

Buggy python submission (verdict: Runtime Error):
input();a=eval(input().replace(' ','*'));print((a,-1)[a>1e18])

Fixed submission:
n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(0 if 0in a else z)

Buggy python submission (verdict: Runtime Error):
input();a=eval(input().replace(' ','*'));print((a,-1)[a>10**18])

Fixed submission:
n,*a=map(int,open(0).read().split());z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(0 if 0in a else z)
Buggy python submission (verdict: Time Limit Exceeded):
r=range;x,y,z,k=map(int,input().split())
a,b,c=eval("list(map(int,input().split())), "*3)
ab=sorted([a[i]+b[j]for i in r(x)for j in r(y)],reverse=True)
abc=sorted([ab[i]+c[j]for i in r(min(3000,x*y))for j in r(z)],reverse=True)
print(*[abc[i]for i in r(k)])

Fixed submission:
r=range;x,y,z,k=map(int,input().split())
a,b,c=eval("list(map(int,input().split())), "*3)
ab=sorted([a[i]+b[j]for i in r(x)for j in r(y)],reverse=True)
abc=sorted([ab[i]+c[j]for i in r(min(3000,x*y))for j in r(z)],reverse=True)
print(*[abc[i]for i in r(k)])
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input();a=[]
for i in range(n+1):
 a+=[s[:i].count("AC")]
for _ in range(q):
 l,r=map(int,input().split())
 print(a[r]-a[l])

Fixed submission:
n,q=map(int,input().split())
s=input();a=[0]*2
for i in range(2,n+1):
 a+=[a[i-1]+s[i-2:i].count("AC")]
for _ in range(q):
 l,r=map(int,input().split())
 print(a[r]-a[l])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=input().split()
s=input()
for _ in range(int(q)):
 l,r=map(int,input().split())
 print(s[l-1:r].count("AC"))

Fixed submission:
n,q=map(int,input().split())
s=input();a=[0]*2
for i in range(2,n+1):
 a+=[a[i-1]+s[i-2:i].count("AC")]
for _ in range(q):
 l,r=map(int,input().split())
 print(a[r]-a[l])
Buggy python submission (verdict: Runtime Error):
H,W,h,w=map(int,open(0));print((H-h)*(W-w))

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
Buggy python submission (verdict: Runtime Error):
from math import factorial
n,k=map(int,input().split())
print(["NO","YES"][factorial(n)/factorial(k)-(n-1)*factorial(n-2)/factorial(k-2)>1])

Fixed submission:
n,k=map(int,input().split())
print(["NO","YES"][n+n%2>=k*2])