Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

k=[0]*60
K=[0]*60
for i in range(N):
  t=A[i]
  for j in range(60):
    if t%2==1:
      k[j]+=1
    t=t//2
    if t<1:
      break
a=1
sumxor=0
for i in range(60):
  K[i]=k[i]*(N-k[i])
  a=a%(10**9+7)
  sumxor=(sumxor+K[i]*a%(10**9+7))%(10**9+7)
  a=a*2
print(sumxor)

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

k=[0]*60
K=[0]*60
for i in range(N):
  t=A[i]
  for j in range(60):
    if t%2==1:
      k[j]+=1
    t=t//2
    if t<1:
      break
a=1
sumxor=0
for i in range(60):
  K[i]=k[i]*(N-k[i])
  a=a%(10**9+7)
  sumxor=(sumxor+K[i]*a%(10**9+7))%(10**9+7)
  a=a*2
print(sumxor)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))

L.sort()
X=0
for i in range(N):
  for k in range(N-(i+1)):
    j=i+1+k
    s=L[i]+L[j]
    d=max(L[i]-L[j],L[j]-L[i])
    lb=0
    ub=N-1
    while lb<ub:
      mn=(lb+ub)//2
      if L[mn]<=d:
        lb=mn+1
      else:
        ub=mn
    dmin=lb
    
    lb=0
    ub=N-1
    while lb<ub:
      mn=(lb+ub)//2
      if mn*2 != lb+ub:
        mn=mn+1
      if L[mn]>=s:
        ub=mn-1
      else:
        lb=mn
    smax=lb
    a=smax-dmin+1
    if dmin<=i and i<=smax:
      a-=1
    if dmin<=j and j<=smax:
      a-=1
    X+=a
print(int(X/3))

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

L.sort()
X=0
for i in range(N):
  for k in range(N-(i+1)):
    j=i+1+k
    s=L[i]+L[j]
    d=max(L[i]-L[j],L[j]-L[i])
    lb=0
    ub=N-1
    while lb<ub:
      mn=(lb+ub)//2
      if L[mn]<=d:
        lb=mn+1
      else:
        ub=mn
    dmin=lb
    
    lb=0
    ub=N-1
    while lb<ub:
      mn=(lb+ub)//2
      if mn*2 != lb+ub:
        mn=mn+1
      if L[mn]>=s:
        ub=mn-1
      else:
        lb=mn
    smax=lb
    a=smax-dmin+1
    if dmin<=i and i<=smax:
      a-=1
    if dmin<=j and j<=smax:
      a-=1
    X+=a
print(int(X/3))
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
B=[K]*N
def minu(n):
  return n-1
for i in range(Q):
  A=int(input())
  if A==1:
    B[1:]=map(minu,B[1:])
  elif A==N:
    B[:-2]=map(minu,B[:-2])
  else:
    B[:A-1]=map(minu,B[:A-1])
    B[A:]=map(minu,B[A:])
for i in range(N):
  if B[i]>0:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q=map(int,input().split())
B=[0]*N
def minu(n):
  return n-1
for i in range(Q):
  A=int(input())
  B[A-1]+=1
for i in range(N):
  if B[i]>Q-K:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
import numpy as np
B=np.array([K]*N)
for i in range(Q):
  A=int(input())
  if A==1:
    B[1:]-=1
  elif A==N:
    B[:-2]-=1
  else:
    B[:A-1]-=1
    B[A:]-=1
for i in range(N):
  if B[i]>0:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q=map(int,input().split())
B=[0]*N
def minu(n):
  return n-1
for i in range(Q):
  A=int(input())
  B[A-1]+=1
for i in range(N):
  if B[i]>Q-K:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
if S[0:(len(S))] == T[0:(len(S))]:
    print("Yes")
else:
    print("No")


Fixed submission:
S = input()
T = input()

if S[0:(len(S))] == T[0:(len(S))]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
sum = 0

for i in range(N):
    for j in range(N):
        for k in range(N):
            g = math.gcd(i+1,j+1)
            sum += math.gcd(g,k+1)

print(sum)


Fixed submission:
import math

N = int(input())
sum = 0

for i in range(N):
    for j in range(N):
        g = math.gcd(i+1,j+1)
        for k in range(N):
            sum += math.gcd(g,k+1)

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range(N//2 +1):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)


Fixed submission:
N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range((N-i)//2 +1):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range(N):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)

Fixed submission:
N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range((N-i)//2 +1):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
sum = 0

for i in range(N):
    for j in range(i+1,N):
        a = S[i]
        b = S[j]
        if a == b:
            continue
        for k in range(j+1,N):
            c = S[k]
            if a!=c and b!=c and j-i!=k-j:
                sum += 1

print(sum)


Fixed submission:
N = int(input())
S = input()
sum = 0
r = 0
g = 0
b = 0

for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1

sum = r*g*b

for i in range(N):
    for j in range((N-i)//2 +1):
        try:
            a = S[i]
            b = S[i+j]
            c = S[i+2*j]
            if a!=b and b!=c and c!=a:
                sum -= 1
        except:
            continue

print(sum)
Buggy python submission (verdict: Runtime Error):
N,M =map(int, input().split())
a = [input().split() for l in range(M)]

for i in range(M):
    for j in range(2):
        a[i][j]=int(a[i][j])

a.sort()
for i in range(M-1):
    if a[i]==a[i+1]:
        a[i]=[0,0]
ans = 10**(N-1)

for i in range(M):
    if a[i][0]==1 ans a[i][1]!=0:
        ans += (a[i][1]-1)*10**(N-a[i][0])
    else:
        ans += a[i][1]*10**(N-a[i][0])

for i in range(M):
    for j in range(M-i):
        if a[i][0] == a[i+j][0] and a[i][1] != a[i+j][1]:
            ans = -1

for i in range(M):
    if a[i][0]==1 and a[i][1]==0:
        ans = -1

if M == 0 and N ==1:
    ans = 0

print(ans)

Fixed submission:
import sys
N,M =map(int, input().split())
a = [input().split() for l in range(M)]

for i in range(1000):
    flag = 1
    b = str(i)
    if len(b)!= N:
        flag = 0
        continue
    for j in range(M):
        if b[int(a[j][0])-1] != a[j][1]:
            flag = 0
            break
    if flag == 1:
        print(i)
        sys.exit()

print("-1")
Buggy python submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

s = list(map(int, input().split()))
ans = 0

if s[0]<=10:
    ans = s[1]+100*(10-s[0])
else:
    ans = s[1]

print(ans)


Fixed submission:
s = list(map(int, input().split()))
ans = 0

if s[0]<=10:
    ans = s[1]+100*(10-s[0])
else:
    ans = s[1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
s = [input() for i in range(N)]
k = 0
i = 0
ans =[]

c = collections.Counter(s)
for i in range(len(c)):
    if c.most_common()[i][1] ==c.most_common()[0][1]:
        ans.append(c.most_common()[i][0])

ans_A =sorted(ans)
for i in range(len(ans_A)):
    print(ans_A[i])

Fixed submission:
import collections

N = int(input())
s = [input() for i in range(N)]
k = 0
i = 0
ans =[]

c = collections.Counter(s)
c_mc=c.most_common()
for i in range(len(c)):
    if c_mc[i][1] ==c_mc[0][1]:
        ans.append(c_mc[i][0])

ans_A =sorted(ans)
for i in range(len(ans_A)):
    print(ans_A[i])

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

N = int(input())
s = [input() for i in range(N)]
k = 0
i = 0
ans =[]

ss=sorted(s)
c = collections.Counter(ss)
for i in range(len(c)):
    if c.most_common()[i][1] ==c.most_common()[0][1]:
        ans.append(c.most_common()[i][0])

ans_A =sorted(ans)
for i in range(len(ans_A)):
    print(ans_A[i])

Fixed submission:
import collections

N = int(input())
s = [input() for i in range(N)]
k = 0
i = 0
ans =[]

c = collections.Counter(s)
c_mc=c.most_common()
for i in range(len(c)):
    if c_mc[i][1] ==c_mc[0][1]:
        ans.append(c_mc[i][0])

ans_A =sorted(ans)
for i in range(len(ans_A)):
    print(ans_A[i])
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

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

A.sort()
B.sort()
C.sort()

ans = 0
for i in range(N):
    a=A[i]
    nibanme = bisect.bisect_right(B,a)
    for j in range(nibanme,N):
        b=B[j]
        sanbanme = bisect.bisect_right(C,b)
        ans += N-sanbanme

print(ans)


Fixed submission:
import bisect

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

A.sort()
B.sort()
C.sort()

ans = 0
for i in range(N):
    b=B[i]
    a=bisect.bisect_left(A,b)
    c=bisect.bisect_right(C,b)
    ans+= a*(N-c)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = []
for i in range(N):
    p.append(int(input()))
p.sort()

price = 0
if N > 0:
    for j in range(3):
        price += p[j]
print(price)

Fixed submission:
N, K = map(int, input().split())
p = [int(x) for x in input().split()]
p.sort()

price = 0
if N > 0:
    for j in range(K):
        price += p[j]
print(price)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = []
for i in range(N):
    p.append(int(input()))
p.sort()

price = 0
for j in range(3):
    price += p[j]
print(price)

Fixed submission:
N, K = map(int, input().split())
p = [int(x) for x in input().split()]
p.sort()

price = 0
if N > 0:
    for j in range(K):
        price += p[j]
print(price)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = []
for i in range(N):
    p.append(int(input()))
p.sort()

price = 0
for i in range(3):
    price += p[i]
print(price)

Fixed submission:
N, K = map(int, input().split())
p = [int(x) for x in input().split()]
p.sort()

price = 0
if N > 0:
    for j in range(K):
        price += p[j]
print(price)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = {}

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
# valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = None
for key, value in valSorted:
    if breakKey is None:
        breakKey = value
    if breakKey != value:
        break
    print(str(key))

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

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = -1
for key, value in valSorted:
    if breakKey == -1:
        breakKey = value
    if breakKey != value:
        break
    print(str(key))

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

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = None
for key, value in valSorted:
    if breakKey is None:
        breakKey = value
    if breakKey != value:
        break
    print(str(key)

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

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = -1
for key, value in valSorted:
    if breakKey == -1:
        breakKey = value
    if breakKey != value:
        break
    print(str(key))
Buggy python submission (verdict: Runtime Error):
l, n = map(int, input().split())
s = []
sort = []
for i in range(n):
    s.append(input())
s.sort()
print(''.join(s))

Fixed submission:
n, l = map(int, input().split())
s = []
sort = []
for i in range(n):
    # print(i)
    s.append(input())
s.sort()
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
N = int(input())
result = [0,0,0,0]
for n in range(N):
    S = input()
    if S == "AC":
        result[0] += 1
    elif S == "WA":
        result[1] += 1
    elif S == "TLE":
        result[2] += 1
    else:
        result[3] += 1
name = ["AC","WA","TLE","RE"]
for res,nam in zip(result,name):
    print("%s x %d"%(nam,res))

Fixed submission:
N = int(input())
mod = N%1000
if mod == 0:
  print(0)
else:
  print(1000-(N%1000))
Buggy python submission (verdict: Runtime Error):
vs = map(int,input().split())
for i in range(len(vs)):
    if vs[i] == 0:
        print(i)

Fixed submission:
vs = list(map(int,input().split()))
for i in range(len(vs)):
    if vs[i] == 0:
        print(i+1)

Buggy python submission (verdict: Runtime Error):
as= inst(input().split())
for a in as:
    if a ==0:
       return(a)

Fixed submission:
vs = list(map(int,input().split()))
for i in range(len(vs)):
    if vs[i] == 0:
        print(i+1)
Buggy python submission (verdict: Runtime Error):
N = input()

last = N[-1]

if last == "2":
  ans = "hon"
elif last == "4":
  ans = "hon"
elif last == "5":
 ans = "hon"
elif last =="7":
 ans = "hon"
elif last == "9"
  ans = "hon"
elif last == "0":
  ans = "pon"
elif last == "1":
  ans = "pon"
elif last == "6":
  ans = "pon"
elif last == "8":
  ans = "pon"
else:
  ans = "bon"

print(ans)


Fixed submission:
N = input()
last = int(N[-1])

if last ==3:
  print("bon")
elif last in [0,1,6,8]:
  print("pon")
else:
  print("hon")
Buggy python submission (verdict: Runtime Error):
import numpy as np

A,B,H,M = map(int,input().split())

th_a = 30*H
th_b = 6*M

theta = th_a -th_b

if theta <= 0:
  theta = -theta

if theta == 0:
  if A >= B:
    print(A-B)
  else:
    print(B-A)

elif theta == 180:
  print(A+B)

else:
  print(np.sqrt(A**2 + B**2 - 2*A*B*cos(theta)))

Fixed submission:
import numpy as np

A,B,H,M = map(int,input().split())

th_a = 30*H + 0.5 * M
th_b = 6*M

theta = th_a -th_b

if theta <= 0:
  theta = -theta
if theta >= 180:
  theta = 360 - theta

if theta == 0:
  if A >= B:
    print(A-B)
  else:
    print(B-A)

elif theta == 180:
  print(A+B)

else:
  print(np.sqrt(A**2 + B**2 - 2*A*B*np.cos(theta*np.pi/180)))

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

A,B,H,M = map(int,input().split())

th_a = 30*H
th_b = 6*M

theta = th_a -th_b

if theta == 0:
  if A >= B:
    print(A-B)
  else:
    print(B-A)

elif theta == 180:
  print(A+B)

else:
  print(np.sqrt(A**2 + B**2 - 2*A*B*cos(theta)))

Fixed submission:
import numpy as np

A,B,H,M = map(int,input().split())

th_a = 30*H + 0.5 * M
th_b = 6*M

theta = th_a -th_b

if theta <= 0:
  theta = -theta
if theta >= 180:
  theta = 360 - theta

if theta == 0:
  if A >= B:
    print(A-B)
  else:
    print(B-A)

elif theta == 180:
  print(A+B)

else:
  print(np.sqrt(A**2 + B**2 - 2*A*B*np.cos(theta*np.pi/180)))
Buggy python submission (verdict: Runtime Error):
def main():
  n = int(input())
  li = list(input())
  i = 0
  j = n-1
  ans = 0
  while(i < j):
    while(li[i] == "R" and i < j):
      i += 1
    while(li[j] == "W" and i < j):
      j -= 1
    if li[i] = "W" and li[j] = "R":
      li[i] = "R"
      li[j] = "W"
      ans += 1
  print(ans)    

if __name__ == '__main__':
  main()

Fixed submission:
def main():
  n = int(input())
  li = list(input())
  i = 0
  j = n-1
  ans = 0
  while(i < j):
    while(li[i] == "R" and i < j):
      i += 1
    while(li[j] == "W" and i < j):
      j -= 1
    if li[i] == "W" and li[j] == "R":
      li[i] = "R"
      li[j] = "W"
      ans += 1
  print(ans)    

if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
n = input()
change = n[1:]
change = int(change)
print(change)

Fixed submission:
n = int(input())
for i in range(10):
  pay = 1000 * (i+1)
  change = 0
  if pay >= n:
    change = pay - n
    break
print(change)
Buggy python submission (verdict: Runtime Error):
import math

def main():
  a, b = input().split()
  a = int(a)
  b = float(b)
  c = int(b)
  d = (b - c) * 100
  ans_a = a * c
  ans_b = (a * d) // 100
  ans = math.floor(ans_b) + ans_a
  print(ans)
 
 
if __name__ == '__main__':
  main()

Fixed submission:
def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


if __name__ == '__main__':
  main()

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


if __name__ == '__main__':
  main()

Fixed submission:
def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


if __name__ == '__main__':
  main()

Buggy python submission (verdict: Runtime Error):
def main():
  n = int(input())
  ans = 0
  for i in range(n):
    ans *= int(input())
  if ans >= 10 ** 18:
    print(-1)
  else:
    print(ans)


if __name__ == '__main__':
  main()

Fixed submission:
def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
import math
import decimal

def main():
  a, b = input().split()
  a = int(a)
  b = decimal(b)
  c = int(b)
  d = (b - c) * 100
  ans_a = a * c
  ans_b = (a * d) // 100
  ans = math.floor(ans_b) + ans_a
  print(ans)
 
 
if __name__ == '__main__':
  main()

Fixed submission:
import math

def main():
  a, b = input().split()
  a = int(a)
  b = b[0] + b[2]+ b[3]
  c = int(b)
  ans = a * c // 100
  ans = math.floor(ans)
  print(ans)
 
 
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
def dijkstra(s,n,w,cost):
    #始点sから各頂点への最短距離
    #n:頂点数,　w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf)
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    prev= [0] * n
    
    while True:
        v = -1
        #まだ使われてない頂点の中から最小の距離のものを探す
        for i in range(n):
            if (not used[i]) and (v == -1):
                v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
            break
        used[v] = True

        for j in range(n):
            if d[j] > d[v]+cost[v][j]:
                prev[j] = v
            d[j] = min(d[j],d[v]+cost[v][j])
    return prev

def main():
    n,w = map(int,input().split()) #n:頂点数　w:辺の数
    checker = [0]
    cost = [[float("inf") for i in range(n)] for i in range(n)] 
    #cost[u][v] : 辺uvのコスト(存在しないときはinf この場合は10**10)
    for i in range(w):
        x,y= map(int,input().split()) 
        checker.append(x)
        checker.append(y)
        x -= 1
        y -= 1
        cost[x][y] = 1
        cost[y][x] = 1
    checker = list(set(checker))
    if checker == list(range(n+1)):
        print("Yes")
        for i in dijkstra(0,n,w,cost)[1:]:
            print(i + 1)
    else:
        print("No")
 
 
if __name__ == '__main__':
  main()

Fixed submission:
from collections import deque

def bfs(start, line):
    quene = deque([start])
    d = [None] * len(line) # reset distance from start
    d[start] = 0
    ans = [None] * len(line)
    while quene:
        v = quene.popleft()
        for i in line[v]:
            if d[i] is None:
                d[i] = d[v] + 1
                ans[i] = v
                quene.append(i)
    return ans


def main():
    n,w = map(int,input().split()) #n:頂点数　w:辺の数
    checker = [0]
    line = [[] for _ in range(n)]
    for i in range(w):
        x,y= map(int,input().split()) 
        x -= 1
        y -= 1
        line[x].append(y)
        line[y].append(x)
    print("Yes")
    ans = bfs(0,line)
    for i in ans[1:]:
        print(i+1)

 
 
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = [0 for i in range(max(li))]
count = 0
 
for i in range(n):
    ans_li[li[i]] += 1
 
if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(1,n-1):
    ans *= ans_li[i] ** ans_li[i+1]
 
for i in range(n-1):
    if ans_li[i] == 0 and (not ans_li[i+1] == 0):
        print(0)
        exit()
 
print(ans % 998244353)

Fixed submission:
import collections

n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = collections.Counter(li)

if not li[0] == 0:
    print(0)
    exit()

if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(max(ans_li)+1):
    ans *= ans_li[i] ** ans_li[i+1]
    if ans_li[i] == 0:
        print(0)
        exit()
 
print(ans % 998244353)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = [0 for i in range(max(li))]
count = 0
 
for i in range(n):
    ans_li[li[i]] += 1
 
if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(1,n-1):
    ans *= ans_li[i] ** ans_li[i+1]
 
for i in range(n-1):
    if ans_li[i] == 0 and (not ans_li[i+1] == 0):
        print(0)
        exit()
 
print(ans % 998244353)

Fixed submission:
import collections

n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = collections.Counter(li)

if not li[0] == 0:
    print(0)
    exit()

if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(max(ans_li)+1):
    ans *= ans_li[i] ** ans_li[i+1]
    if ans_li[i] == 0:
        print(0)
        exit()
 
print(ans % 998244353)
Buggy python submission (verdict: Runtime Error):
x = int(input())
count = 0
 
for i in range(2,10):
  if x % i == 0 and (x // i) <= 9:
    print("Yes")
    exit()
  else:
    count += 1
 
if count == 8:
  print("No")

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

if x < 10 and y < 10:
  print(x * y)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
count = 0
li.sort()
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    for k in range(j + 1, n):
      a = li[i]
      b = li[j]
      c = li[k]
      if a < b + c and b < c + a and c < a + b:
        count += 1
 
print(count)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
count = 0
li.sort()
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    ab = li[i] + li[j]
    x = bisect.bisect_left(li, ab, lo=0, hi=n)
    count += (x - j - 1)
 
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    for k in range(j + 1, n):
      a = li[i]
      b = li[j]
      c = li[k]
      if a < b + c and b < c + a and c < a + b:
        count += 1

print(count)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
count = 0
li.sort()
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    ab = li[i] + li[j]
    x = bisect.bisect_left(li, ab, lo=0, hi=n)
    count += (x - j - 1)
 
print(count)