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

from fractions import Fraction
import sys
sys.setrecursionlimit(15000)

def fibMul(fn1, fn2):
    a = fn1[0]
    b = fn1[1]
    c = fn2[0]
    d = fn2[1]
    return (a*c + 5*b*d, a*d + b*c)

def fibExp(fn, n):
    if (n == 0):
        return (Fraction(1), Fraction(1));
    if (n % 2 == 0):
        return fibExp(fibMul(fn, fn), n / 2);
    return fibMul(fn, fibExp(fn, n - 1));

def fibMin(fn1, fn2):
    a = fn1[0]
    b = fn1[1]
    c = fn2[0]
    d = fn2[1]
    return (a - c, b - d)

def fibMain(n):
    fibNum1 = (Fraction(1, 2), Fraction( 1, 2))
    fibNum2 = (Fraction(1, 2), Fraction(-1, 2))
    fibNum3 = fibMin(fibExp(fibNum1, n), fibExp(fibNum2, n)) 
    fibNum4 = (Fraction(0, 1), Fraction(1, 5))
    return fibMul(fibNum3, fibNum4)

def fib(n):
    return fibMain(n)[0].numerator



n, m =map(int, input().split())  #複数数値入力
a = [-1]
for i in range(m):
    ai = int(input())
    a.append(ai)
a.append(n+1)

count = 1
root5 = math.sqrt(5)
for i in range(m+1):
    x = a[i+1] - a[i] -1
    if x == 0:
        count = 0
        break
    else:
#         y = 1/root5 *(((1+root5)/2)**x - ((1-root5)/2)**x) 
        count *= fib(x)
print(int(count)%1000000007)

Fixed submission:
import math
from fractions import Fraction
import sys


class multipliable_2x2matrix(object):
    def __init__(self, a, b, c, d):
        self.a = a;
        self.b = b;
        self.c = c;
        self.d = d;
    def mul(self, b):
        return multipliable_2x2matrix(
            self.a * b.a + self.b * b.c,
            self.a * b.b + self.b * b.d,
            self.c * b.a + self.d * b.c,
            self.c * b.b + self.d * b.d)
    
def fib(n):
    if n == 0: return 0
    m = multipliable_2x2matrix(1, 1, 1, 0)
    f = multipliable_2x2matrix(1, 0, 0, 1)
    n = n - 1
    while n > 0:
        if n & 1 == 1:
            f = f.mul(m)
        n = n >> 1
        m = m.mul(m)
    return f.a



n, m =map(int, input().split())  #複数数値入力
a = [-1]
for i in range(m):
    ai = int(input())
    a.append(ai)
a.append(n+1)

count = 1
root5 = math.sqrt(5)
for i in range(m+1):
    x = a[i+1] - a[i] -1
    if x == 0:
        count = 0
        break
    else:
#         y = 1/root5 *(((1+root5)/2)**x - ((1-root5)/2)**x) 
        count *= fib(x)
print(int(count)%1000000007)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools
import matplotlib as mpl

x1, y1, x2, y2 =map(int, input().split())  #複数数値入力

x3 = y1-y2+x2
y3 = x2-x1+y2
x4 = y1-y2+x1
y4 = x2-x1+y1

L = [x3,y3,x4,y4]
print(' '.join(map(str, L)))

Fixed submission:
import numpy as np

x1, y1, x2, y2 =map(int, input().split())  #複数数値入力

x3 = y1-y2+x2
y3 = x2-x1+y2
x4 = y1-y2+x1
y4 = x2-x1+y1

L = [x3,y3,x4,y4]
print(' '.join(map(str, L)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans=a[i]*ans

if ans>10**18:
    print(-1)
else:
    print(ans)

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

a.sort()
if a[0]==0:
    print(0)
else:
    a.sort(reverse=True)
    # print(a)

    ans=1
    for i in range(n):
        ans=a[i]*ans
        if ans>10**18:
            break

    if ans>10**18:
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
counter=[0,0]
i=2
while True:
    while True:
        counter.append(0)
        if n%i==0:
            counter[i]+=1
            n/=i
        else:
            break
    if n==1:
        break
    i+=1

ans=0
for j in range(len(counter)):
    k=1
    while True:
        if counter[j]-k>=0:
            counter[j]-=k
            ans+=1
        else:
            break
        k+=1

print(ans)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
li=factorization(n)
ans=0
for i in range(len(li)):
    k=1
    while True:
        if li[i][1]-k>=0:
            li[i][1]-=k
            ans+=1
        else:
            break
        k+=1
if n<=1:
    print(0)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
value=[]
for i in range(a):
  value.append(1)
for i in range(b):
  value.append(0)
for i in range(c):
  value.append(-1)
sum=0
for i in range(k):
  sum+=value[i]
print(sum)

Fixed submission:
a,b,c,k=map(int,input().split())
if k<=a:
  print(k)
elif k<=a+b:
  print(a)
elif k<=a+b+c:
  print(a-(k-(a+b)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
s=[]
count=0
for i in range(n+1):
  count+=i
  s.append(count)

t=[]
for i in range(n+1):
  tmp=0
  for j in range(i+1):
    tmp+=n-j
  t.append(tmp)

ans=0
for i in range(k-1,n+1):
  ans+=t[i]-s[i]+1
  ans%=(10**9+7)

print(ans)

Fixed submission:
n,k=map(int,input().split())
s=[]
count=0
for i in range(n+1):
  count+=i
  s.append(count)

t=[n]
tmp=n
for i in range(1,n+1):
  tmp-=1
  t.append(t[i-1]+tmp)
# print(t)

ans=0
for i in range(k-1,n+1):
  ans+=t[i]-s[i]+1
  ans%=(10**9+7)

print(ans)
Buggy python submission (verdict: Runtime Error):
1000000000 1000000000

Fixed submission:
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
elif h%2==0 or w%2==0:
  print(h*w//2)
else:
  print((h*w+1)//2)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
A=[]
B=[]
for i in range(9):
  A.append(a+i/10)
  B.append(b+i/10)
for i in range(len(A)):
  A[i]=A[i]/0.08
  B[i]=B[i]/0.1
ans=[]
for i in range(len(A)):
  for j in range(len(A)):
    if math.isclose(A[i],B[j]):
      ans.append(A[i])
      break
if ans==[]:
  print(-1)
else:
  print(int(ans[0]))

Fixed submission:
import sys
input = sys.stdin.readline

a,b=map(int,input().split())
ans=-1
for i in range(1,1001):
  if i*0.08//1 == a and i*0.1//1 == b:
    ans=i
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li=list(map(int, input().split()))
ans="YES"
for i in range(n):
  if li.count(li[i]) >= 2:
    ans="NO"
    break
print(ans)

Fixed submission:
n=int(input())
li=list(map(int, input().split()))
if n==len(set(li)):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li=list(map(int, input().split()))
ans="YES"
for i in range(n):
  for j in range(i+1, n):
    if li[i]==li[j]:
      ans="NO"
      break
  else:
    continue
  break
print(ans)

Fixed submission:
n=int(input())
li=list(map(int, input().split()))
if n==len(set(li)):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
li=list(map(int, input().split()))
max=0
for i in range(n-k+1):
  tmp=0
  for j in range(k):
    tmp+=li[i+j]
  if max <= tmp:
    max=tmp
print((max+k)/2)

Fixed submission:
n,k=map(int,input().split())
li=list(map(int, input().split()))
tmp=0
for i in range(k):
  tmp+=li[i]

max=tmp
for i in range(1,n-k+1):
  tmp=tmp-li[i-1]+li[i+k-1]
  if max<=tmp:
    max=tmp
print((max+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
li=list(map(int, input().split()))
max=0
for i in range(n-k+1):
  tmp=0
  for j in range(k):
    tmp+=(li[i+j]+1)/2
  if max <= tmp:
    max=tmp
print(max)

Fixed submission:
n,k=map(int,input().split())
li=list(map(int, input().split()))
tmp=0
for i in range(k):
  tmp+=li[i]

max=tmp
for i in range(1,n-k+1):
  tmp=tmp-li[i-1]+li[i+k-1]
  if max<=tmp:
    max=tmp
print((max+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
li=list(map(int, input().split()))
max=0
for i in range(n-k+1):
  tmp=0
  for j in range(k):
    tmp+=(li[i+j]+1)/2
  if max <= tmp:
    max=tmp
print(max)

Fixed submission:
n,k=map(int,input().split())
li=list(map(int, input().split()))
tmp=0
for i in range(k):
  tmp+=li[i]

max=tmp
for i in range(1,n-k+1):
  tmp=tmp-li[i-1]+li[i+k-1]
  if max<=tmp:
    max=tmp
print((max+k)/2)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int, input().split()))
count=1
if not n==1:
  for i in range(1, n):
    for j in range(i):
      if not p[i] <= p[j]:
        break
      elif j==i-1:
        count+=1
  print(count)
else:
  print(1)

Fixed submission:
n=int(input())
p=list(map(int, input().split()))
min=200000
count=0
for i in range(n):
  if p[i] <= min:
    min=p[i]
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
for i in range(1, a*b +1):
  if i%a == 0 and i%b == 0:
    print(i)
    break

Fixed submission:
import math
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
i=1
while True:
  if a*i % b == 0:
    print(a*i)
    break
  i+=1
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
  print(a.index(i)+1, end=" ")

Fixed submission:
import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))

turn=[" " for _ in range(n)]
for i in range(n):
  turn[a[i]-1]=i+1

for i in range(n):
  print(turn[i], end=" ")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
print(counts[-1])

Fixed submission:
import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
if N==1:
  print(0)
else:
  print(counts[-1])
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
l=c*d//math.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
l=c*d//fractions.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
l=c*d//math.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
l=c*d//fractions.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())
count=0
for i in range(a,b+1):
  if i%c!=0 and i%d!=0:
    count+=1
print(count)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
l=c*d//fractions.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
list = list(map(int, input().split()))
count = 0
end = 0
while True:
  for i in range(len(list)):
    list[i] /= 2
    if not list[i].is_integer():
      end += 1
  if end == 1:
    break
  count += 1
print(count)

Fixed submission:
n = input()
nList = list(map(int,input().split()))
count = 0
while True:
  for i in range(len(nList)):
    nList[i] = nList[i]/2
    if not(nList[i].is_integer()):
      print(count)
      exit()
  count += 1
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
q = [list(input().split()) for _ in range(Q)]


flip = 0
for i in range(len(q)):

    if q[i][0] == "1":
        flip ^= 1
    else:
        if flip == 0 and q[i][1] == "1":
            S = q[i][2] + S
        elif flip == 0 and q[i][1] == "2":
            S = S + q[i][2]
        elif flip == 1 and q[i][1] == "1":
            S = S + q[i][2]
        else:
            S = q[i][2] + S

if flip == 1:
    print(S[::-1])
else:
    print(S)            
    

Fixed submission:
S = list(input())
Q = int(input())
q = [list(input().split()) for _ in range(Q)]
head = []
tail = []
flip = 0
for i in range(len(q)):

    if q[i][0] == "1":
        flip ^= 1
    else:
        if flip == 0 and q[i][1] == "1":
            head.append(q[i][2])
        elif flip == 0 and q[i][1] == "2":
            tail.append(q[i][2])
        elif flip == 1 and q[i][1] == "1":
            tail.append(q[i][2])
        else:
            head.append(q[i][2])

if flip == 0:
    ans = "".join(head[::-1] + S + tail)
    # print(head)
    # print(S)
    # print(tail)
    print( ans )
else:
    ans = "".join(tail[::-1] + S[::-1] + head)
    print( ans )
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = [int(x) for x in input().split()]

sum = 0
e = [0] * 1001
for i in range(1, 1000 + 1):
    sum += i
    e[i] = sum / i
    # print(i, e[i])

maxV = 0
maxI = 0
for i in range(N-K+1):
    tmp = 0
    for j in range(i, i+K):
        tmp += p[j] 
    if tmp > maxV:
        maxV = tmp
        maxI = i

ans = 0
for i in range(maxI, maxI + K):
    ans += e[p[i]]

print(ans)

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

sum = 0
e = [0] * 1001
for i in range(1, 1000 + 1):
    sum += i
    e[i] = sum / i
    # print(i, e[i])


maxV = 0
maxI = 0
for i in range(0, K):
    maxV += p[i]

tmp = maxV
# [1 ..  2]
for i in range(1, N-K+1):
    tmp -= p[i-1]
    tmp += p[i+K-1] 
    if tmp > maxV:
        maxV = tmp
        maxI = i
    
    
    
    
    

ans = 0
for i in range(maxI, maxI + K):
    ans += e[p[i]]

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs(''))

Fixed submission:
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
member = [0]*(10**5+1)

li = list(map(int,input().split()))
for i in range(n):
  member[li[i]] +=1

q = int(input())
for j in range(q):
  x,y = input().split()
  x=int(x)
  y=int(y)
  member[y]+=member[x]
  member[x]=0
  total = 0
  for k in range(10**5+1):
    total += k*member[k]
  print(total)

Fixed submission:
n=int(input())
member = [0]*(10**5+1)
 
li = list(map(int,input().split()))
total = sum(li)
for i in range(n):
  member[li[i]] +=1
 
q = int(input())
for j in range(q):
  x,y = input().split()
  x=int(x)
  y=int(y)
  total += (y-x)*member[x]
  print(total)
  member[y]+=member[x]
  member[x]=0

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
member = [0]*(10**5+1)

li = list(map(int,input().split()))
for i in range(n):
  member[li[i]] +=1

q = int(input())
for j in range(q):
  x,y = map(int,input().split())
  member[y]+=member[x]
  member[x]=0
  total = 0
  for k in range(10**5+1):
    total += k*member[k]
  print(total)

Fixed submission:
n=int(input())
member = [0]*(10**5+1)
 
li = list(map(int,input().split()))
total = sum(li)
for i in range(n):
  member[li[i]] +=1
 
q = int(input())
for j in range(q):
  x,y = input().split()
  x=int(x)
  y=int(y)
  total += (y-x)*member[x]
  print(total)
  member[y]+=member[x]
  member[x]=0
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
A = int(a)
B = int(b*100)
ans = A*B//100
print(ans)

Fixed submission:
from decimal import *
a,b = map(Decimal,input().split())
exp = Decimal(a*b)
print(int(exp))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
 
total=0
for nn in range(1,n+1):
  for k in range(1,n+1):
    for l in range(1,n+1):
      total+=math.gcd(nn,math.gcd(k,l))
 
print(total)

Fixed submission:
import math

n=int(input())
 
def diffs(n):
  total=0
  for k in range(1,n):
    for l in range(k+1,n):
      total+=math.gcd(n,math.gcd(k,l))*6
  for k in range(1,n):
    total+=math.gcd(n,k)*6
  total += n
  return total

sum=0
for i in range(1,n+1):
  sum += diffs(i)

print(sum)

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

total=0
for nn in range(1,n+1):
  for k in range(1,n+1):
    for l in range(1,n+1):
      total+=math.gcd(nn,math.gcd(k,l))

print(total)

Fixed submission:
import math

n=int(input())
 
def diffs(n):
  total=0
  for k in range(1,n):
    for l in range(k+1,n):
      total+=math.gcd(n,math.gcd(k,l))*6
  for k in range(1,n):
    total+=math.gcd(n,k)*6
  total += n
  return total

sum=0
for i in range(1,n+1):
  sum += diffs(i)

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

A = int(input())
lst = [int(x) for x in input().split()]
res = reduce(lambda a, b: a * b, lst)
print(res if res <= pow(10, 18) else -1)


Fixed submission:
res = 1

A = int(input())
N = sorted([int(x) for x in input().split()])

for x in N:
    res *= x
    if res > pow(10, 18):
        res = -1
        break

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for x in range(N):
    S.append(input())
P = sorted([x for x in set(S) if S.count(x) == max([S.count(x) for x in set(S)])])
for x in P:
    print(x)

Fixed submission:
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for x in range(N):
    S.append(input())
P = sorted(set(S))
maxi = max([S.count(x) for x in P])
for x in P:
    if S.count(x) == maxi:
        print(x)

Fixed submission:
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for x in range(N):
    S.append(input())
maxi = max([S.count(x) for x in S])
P = sorted(set([x for x in S if S.count(x) == maxi]))
for x in P:
    print(x)

Fixed submission:
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for x in range(N):
    S.append(input())
P = sorted(set(S))
maxi = max([S.count(x) for x in P])
done = []
for x in P:
    if S.count(x) == maxi:
        print(x)

Fixed submission:
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
K, X = input().split()
K = int(K)
X = int(X)
print(("Yes" if K * 500 >= X else "No")


Fixed submission:
K, X = input().split()
K = int(K)
X = int(X)
print("Yes" if K * 500 >= X else "No")
Buggy python submission (verdict: Runtime Error):
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(a + " " + b)

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= 0 if a != 0 else k
b = 0 if b < 0 else b

print(a, end=" ")
print(b)

Buggy python submission (verdict: Runtime Error):
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(f"{a} {b}")


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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= 0 if a != 0 else k
b = 0 if b < 0 else b

print(a, end=" ")
print(b)

Buggy python submission (verdict: Runtime Error):
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(f"{a} {b}")

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= 0 if a != 0 else k
b = 0 if b < 0 else b

print(a, end=" ")
print(b)
Buggy python submission (verdict: Runtime Error):

n=int(input())
arr=list(map(int,input().split()))
sumv=0
d={}
for i in arr:
    sumv+=i
    try:
        d[i]+=1
    except:
        d[i]=1

q=int(input())

while q:
    
    b,c=map(int,input().split())
    sumv+=(c-b)*d[b]
    try:
        d[c]+=d[b]
    except:
        d[c]=d[b]
    d[b]=0
    print(sumv)


    q-=1


Fixed submission:

n=int(input())
arr=list(map(int,input().split()))
sumv=0
d={}
for i in arr:
    sumv+=i
    try:
        d[i]+=1
    except:
        d[i]=1

q=int(input())

while q:
    
    b,c=map(int,input().split())
    if b in d:
        sumv+=(c-b)*d[b]
   
        try:
            d[c]+=d[b]
        except:
            d[c]=d[b]
    d[b]=0
    print(sumv)


    q-=1
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
for i in range(n):
    res *= a[i]
if res > 10**18:
    print(-1)
    sys.exit()
print(res)

Fixed submission:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
if 0 in a:
    print(0)
    sys.exit()

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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
for i in range(n):
    res *= a[i]
if res > 10**18:
    print(-1)
    sys.exit()
print(res)

Fixed submission:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
if 0 in a:
    print(0)
    sys.exit()

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