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

Fixed submission:
def someone_ans():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    x_max = a[n - 1]
    center = a[0]
    for i in range(1, n - 1):
        if abs(center - x_max / 2) > abs(a[i] - x_max / 2):
            center = a[i]
    return "{0} {1}".format(x_max, center)


print(someone_ans())

Buggy submission (verdict: Runtime Error):

def ans():
    n = int(input())
    a = list(map(int, input().split()))

    def comb(x, y):
        c = 1
        p = 1
        for i in range(y, 0, -1):
            c = c * i
        for i in range(x, x - y, -1):
            p = p * i
        return p / c

    p = max(a)
    want_near = p // 2
    tmp = 1
    tmpdiff = 9999999
    for i in a:
        diff = abs(i - want_near)
        if diff < tmpdiff:
            tmpdiff = diff
            tmp = i

    return "{0} {1}".format(p, tmp)


print(m())
Problem p03386 (python)

Fixed submission:
def main():
    A, B, K = map(int, input().split())
    r = set()
    for i in range(A, A + K):
        if A <= i and B >= i:
            r.add(i)

    for i in range(B, B - K, -1):
        if A <= i and B >= i:
            r.add(i)
    O = list(r)
    O.sort()
    for o in O:
        print(o)


main()

Buggy submission (verdict: Runtime Error):
def main():
    A, B, K = map(int, input().split())
    r = set()
    for i in range(A, A + K):
        r.add(i)

    for i in range(B, B - K, -1):
        r.add(i)
    O = list(r).sort()
    for o in O:
        print(o)


main()
Problem p03387 (python)

Fixed submission:
def main():
    A, B, C = map(int, input().split())
    m = [A,B,C]
    m.sort(reverse=True)
    d = (m[0] - m[1]) + (m[0] - m[2])
    if d % 2 == 0:
        print(d//2)
    else:
        print((d//2)+2)

main()

Buggy submission (verdict: Runtime Error):
def main():
    A, B, C = map(int, input().split())
    m = max(A, B, C)
    d = sum(A, B, C) - m
    if d % 2 == 0:
        print(d//2)
    else:
        print((d//2)+2)

main()
Problem p03480 (python)

Fixed submission:
def ans():
    S = input()
    N = len(S)
    if not ('1' in S and '0' in S):
        return print(N)

    tmp = 1000000
    for i, v in enumerate(S):
        if i == 0:
            continue
        if S[i-1] != v:
            tmp = min(max(i, N-i), tmp)
    return print(tmp)

# main()
ans()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    N = len(S)
    for k in range(N - 1, (N // 2) - 1, -1):
        first = S[0:k]
        union = k * 2 - N
        cut = first[-union:-1] + first[-1]
        if '1' in cut and '0' in cut:
            continue
        else:
            return print(k)


main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    N = len(S)
    for k in range(N - 1, N // 2 - 1, -1):
        first = S[0:k]
        union = k * 2 - len(S)
        cut = first[-union:-1] + first[-1]
        if '1' in cut and '0' in cut:
            continue
        else:
            return print(k)


main()
Problem p03503 (python)

Fixed submission:
def ans():
    tmp = -9999999999999
    N = int(input())
    F = [list(map(int, input().split())) for i in range(N)]
    P = [list(map(int, input().split())) for i in range(N)]

    def calculate(B):
        v = []
        for n in range(N):
            mcnt = 0
            for k in range(10):
                if B[k] == '1' and F[n][k] == 1:
                    mcnt += 1
            v.append(P[n][mcnt])
        return sum(v)

    for i in range(1, 1 << 10):
        bi = bin(i)
        bi = bi[2:]
        bi = '0' * (10 - len(bi)) + bi
        tmp = max(tmp, calculate(bi))
    return print(tmp)


ans()

Buggy submission (verdict: Runtime Error):
def ans():
    tmp = -9999999999999
    N = int(input())
    F = [list(map(int, input().split())) for i in range(N)]
    P = [list(map(int, input().split())) for i in range(N)]

    def calculate(B):
        v = []
        for n in range(N):
            mcnt = 0
            for k in range(10):
                if B[k] == '1' and F[n][k] == 1:
                    mcnt += 1
            v.append(P[n][mcnt])
        return sum(v)

    for i in range(1, 1 << 10):
        bi = bin(i)
        bi = bi[2:]
        bi = '0' * (10 - len(bi)) + bi
        tmp = max(tmp, calculate(bi))
    return print(tmp)
  
  ans()
Problem p03612 (python)

Fixed submission:
def m():
    def is_satisfied(p):
        for i in range(N):
            if i + 1 == p[i]: return False
        return True

    def swap(i):
        tmp = p[i]
        p[i] = p[i + 1]
        p[i + 1] = tmp

    N = int(input())
    p = list(map(int, input().split()))
    if is_satisfied(p):
        return 0

    cnt = 0
    for i in range(N):
        if i + 1 == p[i]:
            if i + 1 == N:
                cnt += 1
                tmp = p[i - 1]
                p[i - 1] = p[i]
                p[i] = tmp
            else:
                swap(i)
                cnt += 1
    return cnt


print(m())

Buggy submission (verdict: Runtime Error):
def m():

    def is_satisfied(p):
        for i in range(N):
            if i+1 == p[i]: return False
        return True

    def swap(i):
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp

    N = int(input())
    p = list(map(int, input().split()))
    if is_satisfied(p):
        return 0

    cnt = 0
    for i in range(N):
        if i+1 == p[i]:
            swap(i)
            cnt +=1
    return cnt

print(m())
Problem p03945 (python)

Fixed submission:
def m():
    s = str(input())
    cnt = 0
    tmp = s[0]
    for i in s:
        if tmp != i:
            tmp = i
            cnt += 1
    return cnt
    pass

print(m())

Buggy submission (verdict: Runtime Error):
def m():
    n, x = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 0
    for i in range(1, n-1, 2):
        if a[i+1] > a[i-1]:
            if a[i+1] + a[i] < x:
                continue
            ans += (a[i+1] + a[i]) -x
            if a[i+1] > x:
                a[i+1] = x
        else:
            if a[i-1] + a[i] < x:
                continue
            ans += (a[i-1] + a[i]) -x
    if len(a) % 2 == 0:
        if a[-1] + a[-2] < x:
            return ans
        ans += (a[-1] + a[-2]) -x
        return ans
    else:
        return ans

print(m())
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a, b = input()
c = a*b
if c%2==0:
  r = 'Even'
else:
  r = 'Odd'
  
print(r)

Buggy submission (verdict: Runtime Error):
a, b = input()
if (a*b)%2==0:
  r = 'Even'
else:
  r = 'Odd'
print(r)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))

print ans

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
    	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans

n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))

print ans

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    count = 0
    while True:
        a[i] *= 1/2
        count++
        if a[i]%2==1 || a[i] = 0:
            a[i] = count
            break

print(min(a))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    while True:
        a[i] *= 1/2
        if a[i]%2!=0 || a[i] = 0:
            break

print(min(a))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    while True:
        a[i] *= 1/2
        if a[i]%2!=0 && a[i] < 0:
            break

print(min(a))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    while True:
        a[i] *= 1/2
        if a[i]%2!=0 && a[i] > 0:
            break

print(min(a))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    while True:
        a[i] = a[i]/2
        if a[i]%2!=0:
            break

print(min(a))

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
for i in range(n):
    while True:
        a[i] = a[i]/2
        if a[i]%2==1:
            break

print(min(a))
Problem p02658 (python)

Fixed submission:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main ()

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
	print(0)
	return
for a in A:
   	ans *= a
   	if ans > 1000000000000000000:
      	print(-1)
      	return
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
	print(0)
	return
else:
	for a in A:
    	ans *= a
    	if ans > 1000000000000000000:
      	print(-1)
      	return
	print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
  print(0)
  return
else:
  for a in A:
    ans *= a
    if ans > 1000000000000000000:
      print(-1)
      return
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
  print(0)
  return
else:
  for a in A:
    ans *= a
    if ans > 10**18:
      print(-1)
      return
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 1
if 0 in A:
  print(0)
  return
else:
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      print(-1)
      return
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
ans = 1
if 0 in A:
  print(0)
  exit()
else:
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      print(-1)
      exit()
  print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
ans = 1
if 0 in A:
  print(0)
  exit()
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)
Problem p02584 (python)

Fixed submission:
n, k, d = map(int, input().split())
n = abs(n)
ok = n // d
if k < ok:
  print(n - (k*d))
else:
  left = k - (ok)
  if left % 2:
  	print(d - (n%d))
  else:
    print(n%d)

Buggy submission (verdict: Runtime Error):
n, k, d = map(int, input().split())
n = abs(n)
ok = n // d
left = k - (ok)
if left % 2:
  print(d - (n%d))
  else:
    print(n%d)

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

for i in range(t):
    n, k, d = map(int, input().split())
    n = abs(n)
    ok = n // d
    left = k - (ok)
    if left % 2:
        print(d - (n%d))
    else:
        print(n%d)
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
votes = list(map(int, input().split()))
total = sum(votes)
satisfied = [x for x in votes if x >= total * (1/(4*m))]
if len(satisfied) >= m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
votes = list(map(int, input().split()))
total = sum(votes)
satisfied = [x for x in votes if x >= votes * (1/(4*m))]
if len(satisfied) > m:
  print("Yes")
else:
  print("No")
Problem p02639 (python)

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

for i in range(len(x)):
    if x[i]==0:
        print(i+1)

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

for i in x:
    if x[i]==0:
        print(i)
Problem p02934 (python)

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

for i in A:
    S+=1/i

print(1/S)

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

for i in A:
    S+=1/i

print(1/S)

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

for i in A:
    S+=1/A

print(1/S)

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

for i in range(N):
    S+=1/A[i]

print(1/S)

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

for i in A:
    S+=1/A[i]

print(1/S)
Problem p02660 (python)

Fixed submission:
import collections
N = int(input())
counter = 0
if N == 1:
  print(0)
  exit()
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def cc(n):
    ans = 0
    i = 1
    while True:
        n = n - i
        ans += 1
        i += 1
        if n < i:
            break
    return ans

s_list = prime_factorize(N)
c = collections.Counter(s_list)
values,counts = zip(*c.most_common())
j = 0
for i in range(len(counts)):
    counter += cc(counts[i])
print(counter)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
counter = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def cc(n):
    ans = 0
    i = 1
    while True:
        n = n - i
        ans += 1
        i += 1
        if n < i:
            break
    return ans

s_list = prime_factorize(N)
c = collections.Counter(s_list)
values,counts = zip(*c.most_common())
j = 0
for i in range(len(counts)):
    counter += cc(counts[i])
print(counter)
Problem p02783 (python)

Fixed submission:

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

count = 0
while H > 0:
    H = H - A
    count += 1
print(count)

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

g = int(H / 2)
ans = 0
if g == 0:
    print(1)
else:
    n = 0
    while True:
        if 2 ** (n + 1) < H:
            n += 1
        elif 2 ** (n + 1) >= H:
            n += 1
            break
    for i in range(n + 1):
        ans = ans + (2 ** i)
print(ans)
Problem p02817 (python)

Fixed submission:
String= list(map(str, input().split()))
print(String[1] + String[0])

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

print(T+S)
Problem p02613 (python)

Fixed submission:
n = int(input())
m = [input() for i in range(n)]
 
ans = [0,0,0,0]
 
for i in m:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        ans[3] += 1
    
    
    
print("AC x "+str(ans[0])) 
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x "+str(ans[3]))

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
m = [input() for i in range(n)]

ans = [0,0,0,0]

for i in m:
    if i == "AC":
        ans[0] += 1
    elif i == "WA":
        ans[1] += 1
    elif i == "TLE":
        ans[2] += 1
    elif i == "RE":
        nas[3] += 1
    
    
    
print("AC x "+str(ans[0])) 
print("WA x "+str(ans[1]))
print("TLE x "+str(ans[2]))
print("RE x"+str(ans[3]))
Problem p02641 (python)

Fixed submission:
n = input().split()
n = [int(i) for i in n]
if not n[1] == 0:
	m = input().split()
	m = [int(i) for i in m]
else:
  	m =[0]

ans_1 = n[0]
ans_2 = n[0]
ans = []
while True:
    if n[1] == 0:
        ans.append(n[0])
    if not n[0] in m:
      ans.append(n[0])
    if len(ans) > 0:
        break    
        
    ans_1 += 1
    ans_2 -= 1
    if not ans_1 in m:
        ans.append(ans_1)
    if not ans_2 in m:
        ans.append(ans_2)
    
    
        
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = input().split()
n = [int(i) for i in n]
m = input().split()
m = [int(i) for i in m]
 
ans_1 = n[0]
ans_2 = n[0]
 
ans = []
while True:
  	if n[1] == 0:
      ans.append(0)
      
    ans_1 += 1
    ans_2 -= 1
    if not ans_1 in m:
        ans.append(ans_1)
        
    elif not ans_2 in m:
        ans.append(ans_2)
    
    if len(ans) > 0:
        break
        
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = input().split()
n = [int(i) for i in n]
m = input().split()
m = [int(i) for i in m]


ans_1 = n[0]
ans_2 = n[0]

ans = []
while True:
  	if n[1] == 0:
      ans.append(0)
      
    ans_1 += 1
    ans_2 -= 1
    if not ans_1 in m:
        ans.append(ans_1)
        
    elif not ans_2 in m:
        ans.append(ans_2)
    
    if len(ans) > 0:
        break
        
print(min(ans))
Problem p02675 (python)

Fixed submission:
n = input()
n = list(n)
l = [0,1,6,8]
if n[-1] == "3":
  print("bon")
elif int(n[-1]) in l:
  print("pon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
n = input()
n = dict(n)

l = [0,1,6,8]
if n[-1] == "3":
  print("bon")
elif str(n[-1]) in l:
  print("pon")
else:
  print("hon")
Problem p02681 (python)

Fixed submission:
n = list(input())
m = list(input())
m.pop()

if n == m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
m = input()
if m[0:len(n)] == n:
  print("Yes")
else:
  print("No)
Problem p02613 (python)

Fixed submission:
N = int(input())

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
  s = input()
  if(s == "AC"):
    AC += 1
  elif(s == "WA"):
    WA += 1
  elif(s == "TLE"):
    TLE += 1
  elif(s == "RE"):
    RE += 1
    
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))

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

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
  s = input()
  if(s == "AC"):
    AC += 1
  elif(s == "WA"):
    WA += 1
  elif(s == "TLE"):
    TLE += 1
  elif(s == "RE"):
    RE += 1
    
print("AC x {}".format(AC))
print("WA x {}".format(WA)
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
p=[int(i) for i in input().split()]


tmp=sum(p[0:k])
Msum=tmp

for i in range(1,n-k+1):
    a=p[i-1]
    b=p[i+k-1]
    tmp=tmp-a+b
    Msum = max(tmp,Msum)

print((Msum+k)/2)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=[int(i) for i in input().split()]


Msum=0
tmp=sum(p[0,k])

for i in range(1,n-k+1):
    a=p[i-1]
    b=p[i+k]
    tmp=tmp-a+b
    Msum = max(tmp,Msum)

print((Msum+k)/2)
Problem p02922 (python)

Fixed submission:
#(A-1)n+1　とB

A,B=map(int,input().split())
n=0
while (A-1)*n+1 <B:
    n += 1
print(n)

Buggy submission (verdict: Runtime Error):
n=int(input())
print(int((n-1)*n//2))
Problem p03029 (python)

Fixed submission:
w = input()
s = w.split()

apple = int(s[0])
piece = int(s[1])


answer = int(( 3 * apple + piece - (( 3 * apple + piece ) % 2 )) /2)

print(answer)

Buggy submission (verdict: Runtime Error):
w = input()
s = w.split()

apple = int(s[0])
piece = int(s[1])


answer = ( 3 * apple + piece - (( 3 * apple + piece ) % 2 ) /2

print(answer)
Problem p02576 (python)

Fixed submission:
a=input().split(' ')
n=int(a[0])
x=int(a[1])
t=int(a[2])
f=x
m=t
while x<n:
  x=x+f
  t=t+m
print(t)

Buggy submission (verdict: Runtime Error):
a=input().split('')
n=int(a[0])
x=int(a[1])
t=int(a[2])
f=x
m=t
while x<n:
  x=x+f
  t=t+m
print(t)
Problem p02639 (python)

Fixed submission:
a=input().split(' ')
m=len(a)
b=0
while b<m:
    if a[b]=='0':
        print(b+1)
    b=b+1

Buggy submission (verdict: Runtime Error):
a=input().split(' ')
m=len()
b=0
while b<m:
    if a[b]=='0':
        print(b)
    m=m+1
Problem p02657 (python)

Fixed submission:
a=input().split(' ')
a[0]=int(a[0])
a[1]=int(a[1])
print(a[0]*a[1])

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input().split(' ')
m=0
s=1
while m<a:
    s=s*int(b[m])
    m=m+1
    if s>10**18:
        print(-1)
        break

else:
    print(s)

Buggy submission (verdict: Runtime Error):
a=input.split(' ')
a[0]=int(a[0])
a[1]=int(a[1])
print(a[0]*a[1])
Problem p02658 (python)

Fixed submission:
a=int(input())
b=input().split(' ')
m=0
s=1
i=0
o=0
while i<a:
    if int(b[i])==0:
        print(0)
        o=o+1
    i=i+1
while m<a and o==0:
    s=s*int(b[m])
    m=m+1
    if s>10**18 and o==0:
        print(-1)
        o=o+1
        break

if o==0:
    print(s)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input().split(' ')
m=0
s=1
j=0
while m<a:
	if b[m]==0:
        print(0)
        j=j+1

    m=m+1

m=0
while m<a and j==0:
    s=s*int(b[m])
    if s>10**18:
		print(-1)

    m=m+1


else:
    print(s)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input().split(' ')
m=0
s=1
j=0
while m<a:
	if b[m]==0:
      print(0)
      j=j+1
    
    m=m+1

m=0
while m<a and j==0:
    s=s*int(b[m])
    if s>10**18:
		print(-1)
    
    m=m+1


else:
    print(s)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input.split(' ')
m=0
s=0
while m<a:
    s=s+int(b[m])
    m=m+1
if s<10**18:
    print(-1)
else:
    print(s)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input.split()
m=0
s=0
while m<a:
    s=s+int(b[m])
    m=m+1
if s<10**18:
    print(-1)
else:
    print(s)
Problem p02664 (python)

Fixed submission:
a=input()
i=0
while i<len(a):
    if a[i]=='?':
        print(end='D')

    else:
        print(end=str(a[i]))
    i=i+1

Buggy submission (verdict: Runtime Error):
a=input()
i=0
while i<a:
    if a[i]=='?':
        print(end='D')

    else:
        print(end=str(a[i]))
    i=i+1

Buggy submission (verdict: Runtime Error):
a=input()
i=0
while i<a:
    if a[i]='?':
        print(end='D')

    else:
        print(end=str(a[i]))
    i=i+1

Buggy submission (verdict: Runtime Error):
a=input()
i=0
while i<a:
    if a[i]='?':
        print(end='D')

    else:
        print(end=str(a[i]))
Problem p02582 (python)

Fixed submission:
S = input()
if "RRR" in S:
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import sys
X, K, D = map(int,input().split())
cnt = 0
a = X
b = 0
tmp = 0
if X >= K*D:
  print(X - K*D)
  sys.exit()
if K % 2 == 0:
  tmp = int(X/D)
  if tmp% 2 == 0:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
else:
  tmp = int(X/D)
  if tmp% 2 == 1:
    a = X - D*tmp
  else:
    a = X - D*tmp + D
  b = a - D*2
print(min(abs(a),abs(b)))
Problem p02601 (python)

Fixed submission:
A,B,C = map(int,input().split())
K = int(input())
card = [[] for _ in range(7)]
card[0].append([A,B,C])

for i in range(K):
  if A >= B:
    B *= 2
  else:
    if B >= C:
      C*=2
if A < B and B < C:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,K =map(int,input().split())
A =list(map(int,input().split()))
points = []
for i in range(K,N+1):
  point = 1
  for k in range(K):
    point *= A[i-k-1]
  points.append(point)
  if i > K:
    if points[i-K] > points[i-1-K]:
      print("Yes")
    else:
      print("No")
Problem p02628 (python)

Fixed submission:
N, K = map(int,input().split())
p = list(map(int,input().split()))
new = sorted(p)
sum = 0
for i in range(K):
  sum += new[i]
print(sum)

Buggy submission (verdict: Runtime Error):
5 3
50 100 80 120 80