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

Fixed submission:
x, n = map(int, input().split())
c_list = []

for i in range (-101, 102, 1):
  c_list.append(i)

if n == 0:
  ans = x
else:
  p = list(map(int, input().split()))
  for i in range(len(p)):
    c_list[c_list.index(p[i])] = 250
  # print(c_list)
  diff = 500
  for i in range(len(c_list)):
    if abs(x - c_list[i]) < diff:
      diff = x - c_list[i]
      ans = c_list[i]

print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
c_list = []

for i in range (-100, 100, 1):
  c_list.append(i)

if n == 0:
  ans = x
else:
  p = list(map(int, input().split()))
  for i in range(len(p)):
    c_list[c_list.index(p[i])] = 250
  # print(c_list)
  diff = 500
  for i in range(len(c_list)):
    if abs(x - c_list[i]) < diff:
      diff = x - c_list[i]
      ans = c_list[i]

print(ans)
Problem p02657 (python)

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

print(a*b)

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

a_sorted=sorted(a)
ans = 1

if a_sorted[len(a_sorted)-1] == 0:
  ans = 0
else:
  for i in range(len(a_sorted)):
    ans = ans * a_sorted[i]
    if ans > 1000000000000000000:
      ans = -1
      break

print(ans)
Problem p02811 (python)

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

total = k * 500
ans = "No"

if total >= x:
  ans = "Yes"

print(ans)

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

ans = 0

for i in range(n-2):
  if s[i:i+3] == "ABC":
    ans +=1

print(ans)
Problem p04045 (python)

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

n_str = str(n)
# print(n_str)

l = list(({0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - set(d)))

# print(l)

ans = n
found = False
while not found:
  found = True
  ans_str = str(ans)
  for i in range(len(ans_str)):
    if int(ans_str[i]) not in l:
      # print("NOT FOUND", ans_str[i])
      found = False
  ans +=1

ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = list(map(int, input().split()))

n_str = str(n)
# print(n_str)

l = list(({0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - set(d)))

# print(l)
ans_list = []

for i in range(len(n_str)):
  if int(n_str[i]) in l:
    ans_list.append(n_str[i])
  elif int(n_str[i]) < l[-1]:
    for j in range(len(l)):
      if l[j] > int(n_str[i]):
        ans_list.append(l[j])
        break
    for k in range(i+1, len(n_str)):
      ans_list.append(l[0])
    break

# print(ans_list)

ans = ''
for i in range(len(ans_list)):
  ans += str(ans_list[i])

print(int(ans))
Problem p02600 (python)

Fixed submission:
x=input()
x=int(x)
if x>=400 and x<600:
  rank=8
elif 600<=x and x<800:
  rank=7
elif 800<=x and x<1000:
  rank=6
elif 1000<=x and x<1200:
  rank=5
elif 1200<=x and x<1400:
  rank=4
elif 1400<=x and x<1600:
  rank=3
elif 1600<=x and x<1800:
  rank=2
elif 1800<=x and x<2000:
  rank =1
print(rank)

Buggy submission (verdict: Runtime Error):
x=input()
if 400<=x and x<600:
 rank=8
elif 600<=x and x<800:
  rank=7
elif 800<=x and x<1000:
  rank=6
elif 1000<=x and x<1200:
  rank=5
elif 1200<=x and x<1400:
  rank=4
elif 1400<=x and x<1600:
  rank=3
elif 1600<=x and x<1800:
  rank=2
elif 1800<=x and x<2000:
  rank =1
print(rank)
Problem p02742 (python)

Fixed submission:
import math


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

if n[0] == 1 or n[1] == 1:
  print('1')
  
else:
  print(math.floor((n[0] * n[1] + 1)/ 2))

Buggy submission (verdict: Runtime Error):
import math


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

if n[0] % 2 == 0:
  print(math.ceil(n[0] / 2 * n[1]))
  
elif n[1] % 2 ==0:
  print(math.ceil(n[1]/ 2 * n[0]))
  
  elif n[0] == 1 or n[1] == 1:
    print('1')
else:
  result = math.ceil(n[0] / 2) * math.ceil(n[1] / 2) + math.floor(n[0] / 2) *math.floor(n[1] / 2)
  print(result)

Buggy submission (verdict: Runtime Error):
import math


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

if n[0] % 2 == 0:
  print(math.ceil(n[0] / 2 * n[1]))
  
elif n[1] % 2 ==0:
  print(math.ceil(n[1]/ 2 * n[0]))
  
  elif n[0] == 1 or n[1] == 1
else:
  result = math.ceil(n[0] / 2) * math.ceil(n[1] / 2) + math.floor(n[0] / 2) *math.floor(n[1] / 2)
  print(result)
Problem p02909 (python)

Fixed submission:
S = input()

if S=='Sunny':
  print('Cloudy')
else:
  if S=='Cloudy':
    print('Rainy')
  else:
    print('Sunny')

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

A = Aorg

A.sort(reverse=True)

for m in range(M):
  #print(int(A[0]/2))
  A[0] = int(A[0]/2)
  if A[0]<A[1]:
    A.sort(reverse=True)

print(sum(A))

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

if S=='Sunny':
  print('Cloudy')
else:
  if S=='Cloudy':
    print('Rainy')
  else:
    print('Sunny')
Problem p02981 (python)

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

print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

ans = 0
min_mod = 2019

if R-L+1<2019 :
  if R % 2019 > 0:
    if R-L == 0:
      min_mod = (L*R) % 2019
    else :
      for i in range(L,R) :
        print(i)
        for j in range(i+1,R):
          if min_mod > (i*j) % 2019:
            min_mod = (i*j) % 2019

    ans = min_mod
    
print(ans)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

ans = 0
min_mod = 2019

if R-L+1<2019 :
  if R % 2019 > 0:
    for i in range(L,R) :
      if L+1 == R :
        min_mod = (L*R) % 2019
      else :
        for j in range(L+1,R):
          if min_mod > (i*j) % 2019:
            min_mod = (i*j) % 2019

    ans = min_mod
    
print(ans)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())

ans = 0
min_mod = 2019

if R-L<2019-1 :
  if R % 2019 > 0:
    for i in range(R-L) :
      if min_mod > (L + i) % 2019 :
        min_mod = (L + i) % 2019
    
    ans = min_mod * (min_mod + 1)

print(ans)
Problem p02988 (python)

Fixed submission:
#x = input().split()
#print (x)
#n = int(x[0])
n = int(input())

#print(n)

#p = list(map(int,x[1:]))
p = list(map(int,input().split()))

#print(p)

#print(len(p))
c = 0
#print(len(p))
#print(p)
for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c += 1
      

print(c)

Buggy submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])

p = list(map(int,x[1:]))

c = 0

for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c += 1
      

print(c)

Buggy submission (verdict: Runtime Error):
x = input().split()
n = int(x[0])

p = list(map(int,x[1:]))
c = 0

for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c += 1
      

print(c)
Problem p02947 (python)

Fixed submission:
ans = 0
s = {}
N = int(input())
for i in range(N):
	tmp = []
	string = input()
	for st in string:
		tmp.append(st)
	tmp.sort()
	stmp = ''.join(tmp)
	if stmp in s and s[stmp] > 0:
		ans += s[stmp]
		s[stmp] = s[stmp]+1
	else:
		s[stmp] = 1
print(ans)

Buggy submission (verdict: Runtime Error):
    from collections import Counter
    ans = 0
    s = []
    N = int(input())
    for i in range(N):
    	tmp = []
    	string = input()
    	for st in string:
    		tmp.append(st)
    	s.append(tmp)
     
    for m in range(len(s)):
    	for n in range(len(s)):
    		if Counter(s[n])==Counter(s[m]) and s[m] != s[n]:
    			ans+=1
    print(int(ans/2))
Problem p03556 (python)

Fixed submission:
#coding:utf-8

a = int(input())
i=0
while i*i <= a:
  i=i+1

i=i-1

print(i*i)

Buggy submission (verdict: Runtime Error):
#coding:utf-8

a = int(input())
while i*i <= a:
  i=i+1

i=i-1

print(i*i)

Buggy submission (verdict: Runtime Error):
#coding:utf-8

a = int(input())
while i*i <= a:
  i=i+1

i=i-1

print(i*i)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
abc =input().split()
a,b,c= int(abc[0]),int(abc[1]),int(abc[2])

if a+b == c:
  print("+")
  if a-b == c:
    print("?")
elif a-b == c:
  print("-")
else:
  print("!")
Problem p02780 (python)

Fixed submission:
from copy import copy
N,K = map(int, input().split())
p=list(map(int, input().split()))
expP = [(1+i)/2 for i in p]
id_H = N-K
id_T = N
minus = sum(expP[:id_H])
minimum = minus
for i in range(id_H):
    minus -= expP[id_H - i -1]
    minus += expP[id_T - i -1]
    if minus < minimum:
        minimum = copy(minus)
ans = sum(expP) - minimum
print(ans)

Buggy submission (verdict: Runtime Error):
from copy import copy
N=10
K=4
p=list(map(int, input().split()))
expP = [(1+i)/2 for i in p]
id_H = N-K
id_T = N
minus = sum(expP[:id_H])
minimum = minus
for i in range(id_H):
    minus -= expP[id_H - i -1]
    minus += expP[id_T - i -1]
    if minus < minimum:
        minimum = copy(minus)
ans = sum(expP) - minimum
print(ans)
Problem p02817 (python)

Fixed submission:
s,t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from itertools import accumulate
from bisect import bisect_left

def solve(N: int, M: int, A: "List[int]"):
    A.sort()

    right = 2*A[-1]+1
    left = 0

    while right - left > 1:
        mid = (left+right)//2

        # A[i]+A[j] >= midになるようなi,jの組み合わせの個数 mを 求めたい
        # m >= Mならok
        m = 0
        for i in range(N):
            a = A[i]
            res = mid - a
            # Aからres以上のものを探す
            index = bisect_left(A,res)
            m += N-index
        
        if m >= M:
            left = mid
        else:
            right = mid

    # M通り以上の握手ができる最小の組み合わせの幸福度
    B = sorted(A,reverse=True)
    accum_B = list(accumulate(B))
    answer = 0
    handshake_count = 0
    for i in range(N):
        res = left - A[i]
        if res > A[-1]:
            continue
        index = bisect_left(A,res)
        answer += (N-index)*A[i]+accum_B[N-index-1]
        handshake_count += (N-index)

    # 握手の回数がmを越えたときはその分の幸福度を引く
    if handshake_count>M:
        answer -= left*(handshake_count-M)
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

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

Fixed submission:
import numpy as np
N,M  = map(int,input().split())
coeff = np.zeros((M,N))
for i in range(M):
    inputs = list(map(int,input().split()))
    for switch in inputs[1:]:
        coeff[i][switch-1] = 1
onlist = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    vec = [int(num) for num in bin(i)[2:]]
    fill = N - len(vec)
    vec = np.append(np.zeros(fill),np.array(vec))
#     print(vec)
    if sum(onlist == np.dot(coeff,vec)%2) == M:
        ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M  = map(int,input().split())
coeff = np.zeros((M,N))
for i in range(M):
    inputs = list(map(int,input().split()))
    for switch in inputs[1:]:
        coeff[i][switch-1] = 1
onlist = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    vec = [int(num) for num in bin(i)[2:]]
    fill = N - len(vec)
    vec = np.append(np.zeros(fill),np.array(vec))
#     print(vec)
    if sum(onlist == np.matmul(coeff,vec)%2) == M:
        ans +=1
print(ans)
Problem p03060 (python)

Fixed submission:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in range(N):
    tmp = V[i]-C[i]
#     print(tmp)
    if tmp > 0:
        ans += tmp
#     print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(N):
    tmp = V[i]-C[i]
    if tmp > 0:
        ans += tmp
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
V = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(N):
    tmp = V[i]-C[i]
    if tmp > 0:
        ans += tmp
print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=gcd(l[i-1],A[i])
    r[i]=gcd(r[i-1],A[N-1-i])    
gcdlist = [1,l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(gcd(l[i],r[N-3-i]))
#print(gcdlist)
print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
# from math import gcd
import math
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=math.gcd(l[i-1],A[i])
    r[i]=math.gcd(r[i-1],A[N-1-i])    
gcdlist = [1,l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(math.gcd(l[i],r[N-3-i]))
# print(gcdlist)
print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
# from math import gcd
import math
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=math.gcd(l[i-1],A[i])
    r[i]=math.gcd(r[i-1],A[N-1-i])    
gcdlist = [l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(math.gcd(l[i],r[N-3-i]))
# print(gcdlist)
print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
from math import gcd
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=gcd(l[i-1],A[i])
    r[i]=gcd(r[i-1],A[N-1-i])    
gcdlist = [l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(gcd(l[i],r[N-3-i]))
# print(gcdlist)
print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
from math import gcd
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=gcd(l[i-1],A[i])
    r[i]=gcd(r[i-1],A[i])    
gcdlist = [l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(gcd(l[i],r[N-3-i]))
# print(gcdlist)
print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
from math import gcd
N = int(input())
A = list(map(int,input().split()))
# N=3
# A=[12 ,15 ,18]
l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
    l[i]=gcd(l[i-1],A[i])
    r[i]=gcd(r[i-1],A[i])    
gcdlist = [l[N-2],r[N-2]]
for i in range(N-2):
    gcdlist.append(gcd(l[i],r[N-3-i]))
print(gcdlist)
print(max(gcdlist))
Problem p03111 (python)

Fixed submission:

N, A, B, C =map(int,input().split())
l = []
for i in range(N):
    a = int(input())
    l.append(a)

infty = 1000000

def DFS(i,uselist0,uselista,uselistb,uselistc):
    if i == N:
        return calc_mp(uselista,uselistb,uselistc)
    mplist = []
    u0 = uselist0 + [l[i]]
    ua = uselista + [l[i]]
    ub = uselistb + [l[i]]
    uc = uselistc + [l[i]]
    mplist.append(DFS(i+1, u0,uselista,uselistb,uselistc))
    mplist.append(DFS(i+1, uselist0,ua,uselistb,uselistc))
    mplist.append(DFS(i+1, uselist0,uselista,ub,uselistc))
    mplist.append(DFS(i+1, uselist0,uselista,uselistb,uc))
    return min(mplist)


def calc_mp(uselista,uselistb,uselistc):
    mp = 0
    #合成魔法
    mp += (max(len(uselista) - 1, 0)) * 10
    mp += (max(len(uselistb) - 1, 0)) * 10
    mp += (max(len(uselistc) - 1, 0)) * 10

    #その他魔法
    mp += abs(A - sum(uselista))
    mp += abs(B - sum(uselistb))
    mp += abs(C - sum(uselistc))

    if len(uselista)==0:
        mp += infty
    if len(uselistb)==0:
        mp += infty
    if len(uselistc)==0:
        mp += infty
    return mp

print(DFS(0,[],[],[],[]))

Buggy submission (verdict: Runtime Error):

N, A, B, C =map(int,input().split())
l = []
for i in range(N):
    a = input()
    l.append(a)

def DFS(i,uselist0,uselista,uselistb,uselistc):
    if i == N:
        uselist = [uselist0,uselista,uselistb,uselistc]
        return calc_mp(uselist)
    mplist = []
    u0 = uselist0 + [l[i]]
    ua = uselista + [l[i]]
    ub = uselistb + [l[i]]
    uc = uselistc + [l[i]]
    mplist.append(DFS(i+1, u0,uselista,uselistb,uselistc))
    mplist.append(DFS(i+1, uselist0,ua,uselistb,uselistc))
    mplist.append(DFS(i+1, uselist0,uselista,ub,uselistc))
    mplist.append(DFS(i+1, uselist0,uselista,uselistb,uc))
    return min(mplist)


def calc_mp(uselist):
    mp = 0

    #合成魔法
    mp += (max(len(uselist[1]) - 1, 0)) * 10
    mp += (max(len(uselist[2]) - 1, 0)) * 10
    mp += (max(len(uselist[3]) - 1, 0)) * 10

    #その他魔法
    mp += abs(A - sum(uselist[1]))
    mp += abs(B - sum(uselist[2]))
    mp += abs(C - sum(uselist[3]))

    return mp

print(DFS(0,[],[],[],[]))
Problem p03149 (python)

Fixed submission:
nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#問題D
M,N = list(map(int,input().split())) 
ROW = list(map(int,input().split())) 
COL = list(map(int,input().split())) 
#M= 3
#N= 3 
#ROW = [8,9,7]
#COL = [6,9,8]
#N,M = 14,13
#ROW = [158, 167, 181, 147, 178, 151, 179, 182, 176, 169, #180, 129, 175, 168]
#COL = [181, 150, 178, 179, 167, 180, 176, 169, 182, 177, #175, 159, 173]
import numpy as np
row = 0
col = 0
nums = np.arange(1,M*N+1)[::-1]
pattern = np.zeros(M*N)
ans = 1
#print(nums)
for i in nums:
    if i in ROW and i in COL:
        row += 1
        col += 1
#        pattern[i-1] = 1
    elif i in ROW and i not in COL:
        row += 1
#        pattern[i-1] = col
        ans *= col
    elif i not in ROW and i in COL:
        col += 1
#        pattern[i-1] = row
        ans *= row

    elif i not in ROW and i not in COL:
#        pattern[i-1] = row * col - (M*N-i)
        ans *= (row * col - (M*N-i))
       
        if row * col - (M*N-i) <= 0:
            ans = 0
            break
    ans %= (10**9+7)
#    print(i,row,col,pattern[i-1])
#print(pattern)
#ans = int(pattern.prod())
#ans = ans % (10**9+7)
print(ans)
Problem p03160 (python)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
# N=4
# h=[10, 30, 40, 20]
l = [0]*N
l[1]=abs(h[0]-h[1])
#print(l[0],l[1])
for i in range(2,N):
    l[i] = min(l[i-1]+abs(h[i]-h[i-1]),l[i-2]+abs(h[i]-h[i-2]))
print(l[N-1])

Buggy submission (verdict: Runtime Error):
#問題 D
import numpy as np
N, W = map(int,input().split())
#普通に書くとTLEだったのでNumpy化
dp = np.zeros(W+1)
for i in range(N):
    w,v = map(int,input().split())
    dp[w:] = np.maximum(dp[w:],dp[:-w]+v)
print(int(dp[-1]))


#dpをN*(W+1)配列とかにしてもnumpyなら間に合う。コピーに時間がかかるのかな？

# numpy化してもやっぱりTLEなので、どうもコピーが悪かったらしい
# N, W = map(int,input().split())
# VAL = np.zeros(W+1)
# val = np.zeros(W+1)
# for n in range(N):
#     w,v = map(int,input().split())
#     for weight in range(w,W+1):
#         val[weight] = max(VAL[weight],VAL[weight-w]+v)
#     VAL = np.copy(val)
# print(int(VAL[W]))

# VAL = [0]*(W+1)
# val = [0]*(W+1)
# for n in range(N):
#     w,v = map(int,input().split())
#     for weight in range(w,W+1):
#         val[weight] = max(VAL[weight],VAL[weight-w]+v)
#     VAL = val[:]
#print(VAL[W])
    # listをコピーするときは注意　https://qiita.com/utgwkk/items/5ad2527f19150ae33322
    # listへのアクセスは重いらしい。 https://qiita.com/pegasusBS15/items/620985fdc21c75ad8026
Problem p02719 (python)

Fixed submission:
n,k=map(int,input().split(" "))

r1= n%k;

r2=k-r1;

print(min(r1,r2))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input()split(" "))

print(min(n%k, k-(n%k)))
Problem p02658 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>10**18:
            s=-1
            break
    print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>1000000000000000000:
            s=-1
            break
            
     print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>1000000000000000000:
            s=1
            break
            
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>1000000000000000000:
            s=1
            
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if min(l)=0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
    
    if s>1000000000000000000:
        print(-1)
    else:
        print(s)
Problem p02795 (python)

Fixed submission:
H=int(input())
W=int(input())
N=int(input())

X=max([W,H])
Y=N//X
if X*Y==N:
  print(Y)
else:
  print(Y+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=[[0 for j in range(2)] for i in range(N)]


for i in range(N):
  X[i]=list(map(int,input().split()))


X.sort()
n=1
i=0
k=0
flag=0
while(1):
  if X[i][0]+X[i][1]>X[n][0]-X[n][1]:
    n+=1
    flag=0
  else:
    i+=1
    if flag==0:
      k+=1
      flag=1
  if i>=N-1 or n>=N:
    break
    
print(k+1)
Problem p02681 (python)

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

if S[0:(len(S))] == T[0:(len(S))]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if S[0:(len(S))] == T[0:(len(S))]:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

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 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)
Problem p02765 (python)

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 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)