Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02658 (python)

Fixed submission:
N=int(input())
D=False
ans=1
List=list(map(int,input().split()))
if 0 in List:
  print(0)
else:
  for i in range(N):
    ans=ans*List[i]
    if ans>10**18:
      print(-1)
      D=True
      break
  if D==False:
    print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
D=False
ans=1
List=list(map(int,input()split()))
if 0 in List:
  print(0)
else:
  for i in ragne(N):
    ans=ans*List[i]
    if ans>10**18:
      print(-1)
      D=True
      break
  if D==False:
    print(ans)
Problem p02678 (python)

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

from collections import defaultdict, deque

G = defaultdict(set)


results = [-1]*N
flags   = [False]*N

for _ in range(M):
    A, B = map(int, input().split())
    G[A-1].add(B-1)
    G[B-1].add(A-1)

seen    = [False]*N
partner = [0]*N

q = deque([0])
seen[0] = True


while q:
    now = q.popleft()
    for i in G[now]:
        if seen[i]:
            continue
        seen[i] = True
        partner[i] = now
        q.append(i)

if len(seen) != N:
    print('No')
else:
    print('Yes')
    for i in partner[1:]:
        print(i+1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

from collections import defaultdict

G = defaultdict(set)


results = [-1]*N
flags   = [False]*N

for _ in range(M):
    A, B = map(int, input().split())
    G[A-1].add(B-1)
    G[B-1].add(A-1)

#print(G)

### 最初の段階は、全て繋がっているかどうか。
seen = [False]*N
def rec(i):
    seen[i] = True
    for j in G[i]:
        if seen[j]:
            continue
        rec(j)

for i in range(N):
    if seen[i]:
        continue
    rec(i)

#print(seen)
#全て繋がっているなら、whileループを実装して良い
if sum(seen) != N:
    print('No')
else:
    searchs = set(range(1,N))
    for i in list(searchs):
        if 0 in G[i]:
            results[i] = 0
            flags[i]   = True
            searchs.remove(i)
    while len(searchs) != 0:
        for i in list(searchs):
            for j in G[i]:
                if flags[j] == True:
                    results[i] = j
                    searchs.remove(i)
                    break

    print('Yes')
    for i,v in enumerate(results[1:]):
        print(f'{v+1}')
Problem p02681 (python)

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

if S == T[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    A    = [int(i)-1 for i in input().split()]

    visited_town = []
    current_town = 0
    loop_flg     = False
    visited_town.append(current_town)
    set_visted_town = set(visited_town)
    for i in range(K):
        current_town = A[current_town]
        if current_town in set_visted_town:
            visited_town.append(current_town)
            loop_flg = True
            break
        visited_town.append(current_town)
        set_visted_town.add(current_town)


    if loop_flg:
        loop_start = visited_town.index(current_town)
        loop_end   = len(visited_town) - 1
        loop_length = loop_end - loop_start
        last_index = (K-loop_start)%loop_length
        current_town = visited_town[loop_start+last_index]

    print(current_town+1)


if __name__ == '__main__':
    main()
Problem p02756 (python)

Fixed submission:
from collections import deque

S = str(input())
Q = int(input())

d = deque([S[i] for i in range(len(S))])
#print(d)

flg = 0

for i in range(Q):
    query = input()
    if query[0] == '1':
        flg = flg%2 + 1
    else:
        t, f, c = query.split()
        if f == '1':
            if flg % 2 == 0:
                d.appendleft(c)
            else:
                d.append(c)
        else:
            if flg % 2 == 0:
                d.append(c)
            else:
                d.appendleft(c)
if flg % 2 == 0:
    print(''.join(list(d)))
else:
    tmp = ''.join(list(d))
    print(tmp[::-1])

Buggy submission (verdict: Runtime Error):
S = str(input())
Q = int(input())

qs = [input().split() for i in range(Q)]

i = 0
while i < len(qs):
    q = qs[i]
    if q[0] == '1':
        if qs[i+1][0] == '1':
            i += 2
        else:
            S = S[::-1]
            i += 1
    else:
        if q[1] == '1':
            S = q[2] + S
        else:
            S = S + q[2]
        i += 1



print(S)
Problem p02658 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input().split())
ans = 1
for i in l:
  ans *= i
  if ans > 10**18:
    ans = -1
    break
if 0 in ;:
  ans = 0
print(ans)
Problem p02706 (python)

Fixed submission:
n,m = map(int,input().split())
s = sum(map(int,input().split()))
print(max([n-s,-1]))

Buggy submission (verdict: Runtime Error):
print(int(input())*6.283)

Buggy submission (verdict: Runtime Error):
print(int(input())*6.283)
Problem p02818 (python)

Fixed submission:
a,b,k = map(int,input().split())
if k > a:
  k-=a
  a=0
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([str(a),str(b)]))

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if k > a:
  a=0
  k-=a
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([str(a),str(b)])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
if k > a:
  a=0
  k-=a
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([a,b])

Buggy submission (verdict: Runtime Error):
a,b,k = int(input().split())
if k > a:
  a=0
  k-=a
  if k > b:
    b=0
  else:
    b-=k
else:
  a-=k
print(' '.join([a,b])
Problem p02830 (python)

Fixed submission:
n=int(input())
s,t=input().split()
ans=''
for i in range(n):
  ans +=s[i]
  ans +=t[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input)
s,t=input().split()
ans=''
for i in range(n):
  ans +=s[i]
  ans +=t[i]
print(ans)
Problem p02899 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
ans = [0]*n
for i in range(n):
  ans[l[i]-1] = i+1
print(' '.join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input().split())
ans = [0]*n
for i in range(n):
  ans[l[i]-1] = l[i]
print(' '.join(ans))
Problem p02900 (python)

Fixed submission:
#AとBの最大公約数を素因数分解してから考える。
from fractions import gcd
a,b = map(int,input().split())
g = gcd(a,b)
#gを素因数分解し、素因数のセットを作る。
s = set([1])
for i in range(2,int(-(-g**0.5//1)+1)):
  flag = True
  while flag:
    if g%i==0:
      s.add(i)
      g=g//i
    else:
      flag = False
s.add(g)
print(len(s))

Buggy submission (verdict: Runtime Error):
#AとBの最大公約数を素因数分解してから考える。
from fractions import gcd
a,b = map(int,input().split())
g = gcd(a,b)
#gを素因数分解し、素因数のセットを作る。
s = set([1,g])
for i in range(2,int(-(-g**0.5//1)+1)):
  flag = True
  while flag:
    if g%i==0:
      if len(l1) == 0 or l1[-1] != i:
        s.add(i)
      g=g//i
    else:
      flag = False
print(len(s))
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == ('Cloudy'):
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = sorted(list(map(int,input().split())))
l.reverse()
yl = [0]*n
r = [-(-l[0]//i) for i in l]
chk = 1
flag = False
while True:
  #group 1
  for i in range(n):
    if r[i] > chk:
        break
    elif r[i] > chk//2 :
        yl[i]+=1
        m-=1
        if m == 0:
            flag = True
        break
  if flag:
     break
  #group 2
  for i in range(n):
    if r[i] > chk//2:
      break
    else:
      yl[i]+=1
      m-=1
      if m == 0:
        flag = True
        break
  if flag:
    break
  chk *= 2
ans = 0
for i,j in zip(l,yl):
  ans += i//(2**j)
print(ans)
Problem p02922 (python)

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

Buggy submission (verdict: Runtime Error):
a,b =map(int,input())
print((b-1)//(a-1))
Problem p02923 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
ans=0
counter=0
for i in range(1,n):
  if l[i] <= l[i-1]:
    counter+=1
  else:
    ans=max([ans,counter])
    counter=0
print(max([ans,counter]))

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input().split())
ans=0
counter=0
for i in range(1,n):
  if l[i] <= l[i-1]:
    counter+=1
  else:
    ans=max([ans,counter])
    counter=0
print(max[ans,counter])

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input.split())
ans=0
counter=0
for i in range(1,n):
  if l[i] <= l[i-1]:
    counter+=1
  else:
    ans=max([ans,counter])
    counter=0
print(ans)
Problem p02934 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
inv=0
for i in l:
  inv += 1/i
print(1/inv)

Buggy submission (verdict: Runtime Error):
n = int(input())
,l* = map(int,input().split())
inv=0
for i in l:
  inv += 1/i
print(1/inv)
Problem p02963 (python)

Fixed submission:
S = int(input())
 
if S <= 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r == 0:
    print(0,0,0,10**9,q,0)
  else:
    print(0,0,1,10**9,q+1,10**9-r)

Buggy submission (verdict: Runtime Error):
S = int(input())
 
if S =< 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r = 0:
    print(0,0,0,10**9,q,0)
  else:
    print(0,0,1,10**9,q+1,10**9-r)

Buggy submission (verdict: Runtime Error):
S = int(input())

if S =< 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r = 0:
    print(0,0,0,10**9,q,0)
  else:
  	print(0,0,1,10**9,q+1,10**9-r)
Problem p02981 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min([n*a,b]))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(min([n*a,b])
Problem p03035 (python)

Fixed submission:
a, b = map(int,input().split())
if a <= 5:
  print(0)
elif a <= 12:
  print(b//2)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if a <= 5:
  print(0)
elif a < = 12:
  print(b//2)
else:
  print(b)
Problem p03206 (python)

Fixed submission:
d = int(input())
s = 'Christmas'
for i in range(25-d):
  s = s+' Eve'
print(s)

Buggy submission (verdict: Runtime Error):
d = int(input())
s = 'Christmas'
for i range(25-d):
  s = s+' Eve'
print(s)
Problem p03284 (python)

Fixed submission:
n,k = map(int,input().split())
if n%k ==0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
n.k = map(int,input().split())
if n%k ==0:
  print(0)
else:
  print(1)
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
if max([a,b]) >= 9:
  print(':(')
else:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if max([a,b]) >= 9:
  print(':(')
else:
  print('Yay!')
Problem p03342 (python)

Fixed submission:
import sys
n = int(input())
an = list(map(int,input().split()))
l = 1
r = 1
ans = 1
tmpsum=an[0]
while True:
  if r == n:
    print(ans)
    sys.exit()
  while tmpsum^an[r]==tmpsum+an[r]:
    tmpsum+=an[r]
    r += 1
    ans += r-l+1
    if r == n:
      print(ans)
      sys.exit()
  tmpsum -= an[l-1]
  l +=1
  if l>r:
    r=l
    tmpsum=an[l-1]
    ans += 1

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
an = list(map(int,input().split()))
l = 1
r = 1
ans = 1
tmpsum=an[0]
while r<n:
  while tmpsum^an[r]==tmpsum+an[r]and r<n:
    tmpsum+=an[r]
    r += 1
    ans += r-l+1
  tmpsum -= an[l-1]
  l +=1
  if l>r:
    r=l
    tmpsum=an[l-1]
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
an = list(map(int,input().split()))

l = 1
r = 1
ans = 1
tmpsum=an[0]
while True:
  while tmpsum^an[r]==tmpsum+an[r]:
    tmpsum+=an[r]
    r += 1
    ans += r-l+1
    if r == n:
      print(ans)
      sys.exit()
  tmpsum -= an[l-1]
  l +=1
  if l>r:
    r=l
    tmpsum=an[l-1]
    ans += 1
    if r == n:
      print(ans)
      sys.exit()
Problem p03424 (python)

Fixed submission:
_=input()
s=set(input().split())
if len(s) == 3:
  print('Three')
else:
  print('Four')

Buggy submission (verdict: Runtime Error):
_=input()
s=set(map(input().split()))
if len(s) == 3:
  print('Three')
else:
  print('Four')
Problem p03434 (python)

Fixed submission:
_ = input()
l = list(map(int,input().split()))
l.sort()
l.reverse()
print(sum(l[::2])-sum(l[1::2]))

Buggy submission (verdict: Runtime Error):
_ = input()
l = list(map(int,input().split()))
l.sort()
l.reverse()
print(sum(l[::2]-sum(l[1::2])))
Problem p03472 (python)

Fixed submission:
n,h = map(int,input().split())
al=[]
bl=[]
for _ in [0]*n:
  a,b = map(int,input().split())
  al.append(a)
  bl.append(b)
al.sort()
bl.sort()
ans = 0
while h>0:
  if len(bl)>0 and bl[-1]>al[-1]:
    h-=bl[-1]
    ans+=1
    del bl[-1]
  else:
    ans += -(-h//al[-1])
    h=0
print(ans)

Buggy submission (verdict: Runtime Error):
n,h = map(int,input().split())
al=[]
bl=[]
for _ in [0]*n:
  a,b = map(int,input().split())
  al.append(a)
  bl.append(b)
al.sort()
bl.sort()
ans = 0
while h>0:
  if bl[-1]>al[-1]:
    h-=bl[-1]
    ans+=1
    del bl[-1]
  else:
    ans += -(-h//al[-1])
    h=0
print(ans)
Problem p03485 (python)

Fixed submission:
a,b = map(int,input().split())
if (a+b)%2 == 1:
  print (int((a+b+1)/2))
else:
  print(int((a+b)/2))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a+b)% == 1:
  print ((a+b+1)/2)
else:
  print((a+b)/2)
Problem p03556 (python)

Fixed submission:
import math
n = int(input())
print(int(math.sqrt(n))**2)

Buggy submission (verdict: Runtime Error):
import math
print(int(math.sqrt(int(input()))**2)
Problem p03575 (python)

Fixed submission:
import copy
def dfs(tmp):
  for i in range(n):
    if ll[tmp][i] == 1 and seen[i] == 0:
      seen[i] = 1
      dfs(i)

n,m = map(int,input().split())
ll =[[0]*n for _ in [0]*n]
edges = [list(map(int,input().split())) for _ in [0]*m]
for edge in edges:
  ll[edge[0]-1][edge[1]-1] = 1
  ll[edge[1]-1][edge[0]-1] = 1
originalll = ll.copy()
seen = [0]*n
ans = 0

for edge in edges:
  ll = copy.deepcopy(originalll)
  ll[edge[0]-1][edge[1]-1] = 0
  ll[edge[1]-1][edge[0]-1] = 0
  seen = [0]*n
  tmp = 0
  seen[tmp] = 1
  dfs(tmp)
  if sum(seen) < n:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ll =[[0]*n for _ in [0]*n]
edges = [list(map(int,input().split())) for _ in [0]*m]
for edge in edges:
  ll[edge[0]][edge[1]] = 1
  ll[edge[1]][edge[0]] = 1
originalll = ll.copy()
seen = [0]*n
ans = 0

for edge in edges:
  ll = originalll.copy()
  ll[edge[0]][edge[1]] = 0
  ll[edge[1]][edge[0]] = 0
  seen = [0]*n
  tmp = 0
  seen,tmp,ll = dfs(seen,tmp,ll)
print(ans)

def dfs(seen,tmp,ll):
  for i in range(n):
    if ll[tmp][i] = 1 and seen[i] = 0
    seen[i] = 1
    tmp = i
    seen,tmp,ll = dfs(seen,tmp,ll)
  if sum(seen) == n:
    ans+=1
  return seen,tmp,ll

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ll =[[0]*n for _ in [0]*n]
edges = [list(map(int,input().split())) for _ in [0]*m]
for edge in edges:
  ll[edge[0]][edge[1]] = 1
  ll[edge[1]][edge[0]] = 1
originalll = ll.copy()
seen = [0]*n
ans = 0

def dfs(seen,tmp,ll):
  for i in range(n):
    if ll[tmp][i] = 1 and seen[i] = 0
    seen[i] = 1
    tmp = i
    seen,tmp,ll = dfs
Problem p03597 (python)

Fixed submission:
n = int(input())
a = int(input())
print(n**2-a)

Buggy submission (verdict: Runtime Error):
n,a = map(int,input().split())
print(n**2-a)
Problem p03612 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
ans = 0
for i in range(n-1):
  if l[i] == i+1:
    l[i+1] = l[i]
    ans += 1
if l[-1] == n:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input().split())
ans = 0
for i in range(n-1):
  if l[i] == i+1:
    l[i+1] = l[i]
    ans += 1
if l[-1] = n:
  ans += 1
print(ans)
Problem p03845 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
m = int(input())
p_x = []
for i in range(m):
  p_x.append(list(map(int,input().split())))
for i in range(m):
  p = p_x[i][0]
  x = p_x[i][1]
  print(sum(l) - l[p-1] + x)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
m = int(input())
p_x = []
for i in range(m):
  p_x.append(list(map(int,input()).split()))
for i in range(m):
  p = p_x[i][0]
  x = p_x[i][1]
  print(sum(l) - l[p-1] + x)
Problem p04029 (python)

Fixed submission:
n = int(input())
print (int(n*(n+1)/2))

Buggy submission (verdict: Runtime Error):
n = int().input()
print (str(int(n*(n+1)/2)))
Problem p04043 (python)

Fixed submission:
numlist = list(map(int,input().split()))
if max(numlist) == 7 and min(numlist) == 5 and sum(numlist) == 17:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
numlist = list(map(int,input().split()))
if max(numlist) == 7 and min(numlist) == 5 and sum(sumlist) == 17:
  print('YES')
else:
  print('NO')
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = (C * D) // math.gcd(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

num = math.gcd(C,D)
if num != 0:
    tmp = (C * D) // num
else:
    tmp = C*D


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total
print(total-cnt)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

num = math.gcd(C,D)
tmp = (C * D) // num

C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total
print(total-cnt)

Buggy submission (verdict: Runtime Error):
import math

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


total = B - A + 1

tmp =(C * D) // math.gcd(C, D)

cnt = 0

# A
C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2


D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp

tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total

print(total-cnt)
Problem p02969 (python)

Fixed submission:
r = int(input())

print("{}".format(3*r*r))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n // (2*d + 1)
if n % (2*d + 1) == 0:
  print(ans)
else:
  print(ans+1)
Problem p03455 (python)

Fixed submission:
a,b=(int(x) for x in input().split())

#print((a * b) % 2)

if (a * b) % 2 == 1:
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())

#print((a * b) % 2)

if (a * b) % 2 == 1:
    print('Odd')
else:
    print('Even')f
Problem p02658 (python)

Fixed submission:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if a > 1000000000000000000:
        print(-1)
        exit()
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if math.log10(a) > 18:
        print(-1)
        exit()
    ans *= a
    elif ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
la = [int(i) for i in input().split()]
ans = 1
for a in la:
    ans *= a

if(math.log10(ans) > 18):
    print(-1)
else:
    print(ans)
Problem p02657 (python)

Fixed submission:
from sys import stdin

def main():
    for line in stdin:
        factors = line.split()
        break

    print(int(factors[0]) * int(factors[1]))

main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from statistics import median


def main():
    i = 0
    n = 10**10
    a = []
    b = []
    for line in stdin:
        if i == 0:
            n = int(line)
            i += 1
            continue
        (ai, bi) = line.split()
        a.append(int(ai))
        b.append(int(bi))
        i += 1
        if i > n:
            break

    a_mid = median(a)
    b_mid = median(b)
    if a_mid == b_mid:
        print(1)
        return
    if b_mid - a_mid < 1:
        print(3)
        return
    if n % 2 == 0:
        print(int(b_mid - a_mid) * 2 + 1)
    else:
        print(int(b_mid - a_mid) + 1)

main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from math import floor

def main():
    for line in stdin:
        factors_str = line.split()
        break

    a = factor[0]
    b = factor[1] * 100
    prod = a * b / 100

    print(floor(prod))

main()
Problem p03239 (python)

Fixed submission:
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)

Buggy submission (verdict: Runtime Error):
nums = list(map(int, input().split())) # "1 2 3"と入力
n = nums[0]
t = nums[1]
minC = 1001
for i in range(n):
    numss = list(map(int, input().split()))
    c = numss[0]
    ti = numss[1]
    if ti <= t and minC > c:
        minC = c
if minC = 1001:
    print('TLE')
else:
    print(minC)

Buggy submission (verdict: Runtime Error):
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t =< tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)

Buggy submission (verdict: Runtime Error):
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t =< tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)