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

Fixed submission:
A,B,C,X,Y=map(int,input().split())

def dp(num_a,num_b):
    """
    if num_a<=0 and num_b<=0:return 0
    elif num_b>0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
    """
    if A+B>2*C:
        if min(num_a,num_b)>0:
            if num_a > num_b:
                return num_b*2*C+dp(num_a-num_b,0)
            else :
                return num_a*2*C+dp(0,num_b-num_a)
        elif num_a==0 and num_b>0:
            if B<2*C:
                return num_b*B
            else :
                return C*2*num_b
        elif num_a>0 and num_b==0:
            if A<2*C:
                return A*num_a
            else :
                return 2*C*num_a
        else :
            return 0
    else :
        return num_a*A+num_b*B
print(dp(X,Y))

Buggy submission (verdict: Runtime Error):

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

def dp(num_a,num_b):
    if num_a<=0 and num_b<=0:return 0
    elif num_b!=0:
        if B<2*C:return B+dp(num_a,num_b-1)
        else :return C*2+dp(num_a-1,num_b-1)
    else:
        if A<2*C:return A+dp(num_a-1,num_b)
        else: return C*2+dp(num_a-1,num_b-1)
print(dp(X,Y))

Buggy submission (verdict: Runtime Error):

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

def dp(num_a,num_b,num_ab_a,num_ab_b):
    if num_a<=0 and num_b<=0:return 0
    elif num_b!=0:
        return min(B+dp(num_a,num_b-1,num_ab_a,num_ab_b),C*2+dp(num_a-1,num_b-1,num_ab_a,num_ab_b))
    else:
        return min(A+dp(num_a-1,num_b,num_ab_a,num_ab_b),C*2+dp(num_a-1,num_b-1,num_ab_a,num_ab_b))
print(dp(X,Y,0,0))
Problem p03597 (python)

Fixed submission:
N=int(input())
A=int(input())
print(N*N-A)

Buggy submission (verdict: Runtime Error):

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):#//は切り捨て除算
    #Aの何倍が最適かを網羅的に走査
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w)),sorted(list(s))
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

Buggy submission (verdict: Runtime Error):

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])
Problem p03323 (python)

Fixed submission:
l = map(int, raw_input().split())
a = l[0]
b = l[1]

if a > 8:
	print ":("
elif b > 8:
	print ":("
else:
	print "Yay!"

Buggy submission (verdict: Runtime Error):

a = input()
b = input()

if a > 8:
	print ":("
elif b > 8:
	print ":("
else:
	print "Yay!"
Problem p03339 (python)

Fixed submission:
n = input()
l = list(raw_input())
left = 0
right = l.count("E")
count = []

for i in range(0, n):
	if l[i] == "E":
		right -= 1

	count += [left + right]

	if l[i] == "W":
		left += 1

print min(count)

Buggy submission (verdict: Runtime Error):
n = input()
l = list(raw_input(x))
ans = n

for i in range(0, n):
  tmp = l[:i].count("W") + l[i+1:].count("E")
  if tmp < ans:
    ans = tmp

print ans
Problem p03817 (python)

Fixed submission:
X = int(raw_input())
minZ = (X / 11)*2
remainder = X % 11
if remainder == 0:
   print minZ
elif remainder > 6:
   print minZ+2
else:
   print minZ+1

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
A = map(int, raw_input().split())
D = dict()
for a in A:
   if not a in D:
      D[a] = 0
   D[a] += 1

total = 0
for num, count in D.iteritems():
   if count > 1: total += count - 1
if total % 2 != 0: total += 1
print (N - total)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
A = map(int, raw_input().split())
D = dict()
for a in A:
   if a not in D:
      D[a] = 0
   D[a] += 1

total = 0
for num, count in D.iteritems():
   if count > 1: total += count - 1
if total % 2 != 0: total += 1
print N - total
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')

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

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')
Problem p03477 (python)

Fixed submission:
a, b, c, d = list(map(int, input().split()))
l = a+b
r = c+d
if l > r: print('Left')
elif l < r: print('Right')
else: print('Balanced')

Buggy submission (verdict: Runtime Error):
a, b, c, d = list(map(int, input().split()))
l = a+b
r = c+d
if l > r: print('Left')
elif: l < r: print('Right')
else: print('Balanced')

Buggy submission (verdict: Runtime Error):
a, b, c, d = list(map(int, input().split())
l = a+b
r = c+d
if l > r: print('Left')
elif: l < r: print('Right')
else: print('Balanced')
Problem p03288 (python)

Fixed submission:
n = int(input())
if n < 1200:
    print ("ABC")
elif n < 2800:
    print ("ARC")
else:
    print ("AGC")

Buggy submission (verdict: Runtime Error):
n = input()
if n < 1200:
    print ("ABC")
elif n < 2800:
    print ("ARC")
else:
    print ("AGC")
Problem p03288 (python)

Fixed submission:
R = int(input())
if R < 1200:
	print('ABC')
elif R < 2800:
	print('ARC')
else:
	print('AGC')

Buggy submission (verdict: Runtime Error):
R = input()
if R < 1200:
	print('ABC')
elif R < 2800:
	print('ARC')
else:
	print('AGC')
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(A+B, A-B, A*B)
Problem p03359 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())
M = max([A, B, C])
print(M ** K + A + B+ C - M)
Problem p03361 (python)

Fixed submission:
H,W=map(int,input().split())
s = [['.' for i in range(W+2)] for j in range(H+2)]
f=0
for i in range(H):
 s[i+1] = ['.'] + list(input()) + ['.']
for i in range(H+2):
 if f == 0:
  for j in range(W+2):
   if s[i][j] == '#':
    if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
     f = 1
     print('No')
     break
if f == 0:
 print('Yes')

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
s = [['.' for i in range(H+2)] for j in range(W+2)]
f=0
for i in range(H):
 s[i+1] = ['.'] + list(input()) + ['.']
for i in range(H+2):
 if f == 0:
  for j in range(W+2):
   if s[i][j] == '#':
    if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
     f = 1
     print('No')
     break
if f == 0:
 print('Yes')
Problem p03472 (python)

Fixed submission:
import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
d = 0
if sum(b_effective) < H:
    c = len(b_effective)
    rest = H - sum(b_effective)
    if rest % maxa == 0:
        d = rest//maxa
    else:
        d = rest//maxa + 1
else:
    b = np.sort(b_effective)[::-1]
    s = 0
    for i in range(len(b)):
        s += b[i]
        if s >= H:
            c = i + 1
            d = 0
            break
print(c+d)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
d = 0
if sum(b_effective) < Y:
    c = len(b_effective)
    rest = H - sum(b_effective)
    if rest % maxa == 0:
        d = rest//maxa
    else:
        d = rest//maxa + 1
else:
    b = np.sort(b_effective)[::-1]
    s = 0
    for i in range(len(b)):
        s += b[i]
        if s >= Y:
            c = i + 1
            d = 0
            break
print(c+d)

Buggy submission (verdict: Runtime Error):
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
d = 0
if sum(b_effective) < Y:
    c = len(b_effective)
    rest = H - sum(b_effective)
    if rest % maxa == 0:
        d = rest//maxa
    else:
        d = rest//maxa + 1
else:
    b = np.sort(b_effective)[::-1]
    s = 0
    for i in range(len(b)):
        s += b[i]
        if s >= Y:
            c = i + 1
            d = 0
            break
print(c+d)

Buggy submission (verdict: Runtime Error):
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
b = np.sort(b_effective)[::-1]
s = 0
for i in range(len(b)):
    s += b[i]
    if s >= Y:
        c = i + 1
        break
rest = max(H-sum(b_effective), 0)
if rest % maxa == 0:
    d = rest//maxa
else:
    d = rest//maxa + 1
print(c+d)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
b = np.sort(b_effective)[::-1]
s = 0
i = 0
while s < Y and i < len(b):
 s += b[i]
 i += 1
rest = H-sum(b_effective)
if rest % maxa == 0:
 d = rest//maxa
else:
 d = rest//maxa + 1
print(i+d)
Problem p03493 (python)

Fixed submission:
import numpy
S = input()
print(numpy.array([i=='1' for i in S]).sum())

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split(' ')]
for i in range(10**9):
 if sum([i%2 for i in A])>0:
  print(i)
  break
 else: A = [i/2 for i in A]

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split(' ')]
for i in range(N):
 if sum([i%2 for i in A])>0:
  print(i)
  break
 else: A = [i//2 for i in A]

Buggy submission (verdict: Runtime Error):
S = raw_input()
(S == '1').sum()
Problem p03337 (python)

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

print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
ia = input()
a = int(ia)
ib = input()
b = int(ib)

ansP = a+b
ansS = a-b
ansM = a*b

max1 = max(ansP,ansS)
max2 = max(max1, ansM)
print(max2)
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 = int(input())
b, c = map(int, input().split())
s = input()
print("{} {}".format(a+b+c, s))
Problem p03493 (python)

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

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

Fixed submission:
#入力を受け取る
a,b = map(int, input().split())

c = a*b

if c % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
c = a * b
if c % 2 == 0:
    print("Even")
else:
    print("odd")
Problem p03377 (python)

Fixed submission:
A,B,X=list(map(int,input().split(" ")))
if A<=X and X<=A+B:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import copy

N=int(input())
X=list(map(int,input().split(" ")))
Y=copy.deepcopy(X)
Y.sort()
Y1=Y[:N//2]
Y2=Y[N//2:]
a=Y[N//2]
b=Y[N//2-1]
for i in X:
  if i in Y1:
    print(a)
  else:
    print(b)

Buggy submission (verdict: Runtime Error):
A,B,C=list(map(int,input().split(" ")))
if B>=X:
  print("YES")
else:
  print("NO")
Problem p03399 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())

S=0

if A>=B:
  S+=B
else:
  S+=A

if C>=D:
  S+=D
else:
  S+=C

print(S)

Buggy submission (verdict: Runtime Error):
N=int(input())
D,X=list(map(int,input().split(" ")))
A=[]

for i in range(N):
  A.append(int(input()))

S=0
  
for i in range(N):
  for j in range(100):
    if (1+j*A[i])>D:
      S+=j
      break
  
print(S+X)

Buggy submission (verdict: Runtime Error):
N=int(input())
D,X=list(map(int,input().split(" ")))
A=[]

for i in range(N):
  A.append(int(input()))

S=0
  
for i in range(N):
  for j in range(1000):
    if (1+j*A[i])>D:
      S+=j
      break
  
print(S+X)
Problem p03455 (python)

Fixed submission:
data = list(map(lambda x:int(x),input().strip().split()))
res = data[0]*data[1]%2
if res ==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
data = list(map(lambda x :int(x), input().strip().split())
res = data[0]*data[1]%2
if res ==0:
	print("Even")
else:
   print("Odd")

Buggy submission (verdict: Runtime Error):
in = map(int(),input().strip().split(" "))
res = in[0] * in [1] %2
if res ==0:
  print("Even")
else:
  print("Odd")
Problem p03470 (python)

Fixed submission:
n=int(input())
li=[0]*n
for i in range(n):
  li[i]=int(input())
print(len(list(set(li))))

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
for i in range(n):
  li[i]=int(input())
print(len(list(set(li))))
Problem p03493 (python)

Fixed submission:
print(sum(list(map(lambda x:int(x),list(input().strip())))))

Buggy submission (verdict: Runtime Error):
data = list(lambda x:int(x),input().strip().split())
print(sum(data))
Problem p03494 (python)

Fixed submission:
N = input()
data = list(map(lambda x :int(x),input().strip().split()))
data.sort()
tmp = data[0]
cnt =0
while tmp >1:
    if sum(list(map(lambda x:x%(2**(cnt+1)), data))) >= 1:break
    tmp//=2
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = input()
data = list(map(lambda x :int(x)%2,input().strip().split("")))
res = sum(data)
if res ==1:
  print(0)
else:
  data.sort()
  tmp = data[0]
  cnt = 0
  while tmp!=1:
    tmp/=2
    cnt+=1
  print(cnt)
Problem p03294 (python)

Fixed submission:
def main(N, a):
    m = getlcm(N, a) - 1
    f = 0
    for i in range(N):
        f += m % a[i]
    print(f)

def getlcm(N, a):
    l = 1
    for i in range(N):
        l = l * a[i] // gcd_(l, a[i])
    return l

def gcd_(a, b):
    if b == 0:
        return a
    else:
        a %= b
        a, b = b, a
        return gcd_(a, b)

if __name__ == '__main__':
    N = int(input())
    a = [int(i) for i in input().split()]

    main(N, a)

Buggy submission (verdict: Runtime Error):
import math

def main(N, a):
    m = getlcm(N, a) - 1
    f = 0
    for i in range(N):
        f += m % a[i]
    print(f)

def getlcm(N, a):
    l = 1
    for i in range(N):
        l = l * a[i] // math.gcd(l, a[i])
    return l
    
if __name__ == '__main__':
    N = int(input())
    a = [int(i) for i in input().split()]

    main(N, a)
Problem p03309 (python)

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

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

b = int(statistics.median(A))
sad = 0
for i in A:
    sad += abs(i - b)
print(sad)

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


for i in range(N):
    A[i] -= i + 1
    
A.sort()

min = A[int(N/2)]
max = A[int(N/2)+1]+1
sad = 2e15
for b in range(min, max):
    s = 0
    for i in range(N):
        s += abs(A[i] - b)

    if s < sad:
        sad = s

print("{}".format(sad))
Problem p03323 (python)

Fixed submission:
A, B = map(int, input().split((' ')))

if A > 8:
    print(":(");
    exit()
if B > 8:
    print(":(");
    exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
def sum_axis(input_list):
    x_sum, y_sum, z_sum = 0, 0, 0
    for i in input_list:
        x_sum += i[0]
        y_sum += i[1]
        z_sum += i[2]

    return x_sum, y_sum, z_sum

N, M = map(int, input().split(' '))

if M == 0:
    print(0)
    exit()

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

signs = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1],
        [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]
results = []

for sign in signs:
    sorted_list = sorted(xyz, key = lambda x: sign[0] * x[0] + sign[1] * x[1] + sign[2] * x[2])

    tmp = sum_axis(sorted_list[-M:])
    results.append(tmp[0] * sign[0] + tmp[1] * sign[1] + tmp[2] * sign[2])

print(max(results))
Problem p03435 (python)

Fixed submission:
cij =[]
for i in range(3):
    cij.append(list(map(int, input().split(" "))))

bi_list = []
for b1 in range(-50000, 50000):
    b2 = b1 - (cij[0][0] - cij[0][1])
    b3 = b1 - (cij[0][0] - cij[0][2])

    a1 = cij[0][0]+cij[0][1]+cij[0][2] -b1-b2-b3
    a2 = cij[1][0]+cij[1][1]+cij[1][2] -b1-b2-b3
    a3 = cij[2][0]+cij[2][1]+cij[2][2] -b1-b2-b3
    if a1/3+b1 ==cij[0][0] and a1/3+b2 ==cij[0][1] and a1/3+b3 ==cij[0][2] and a2/3+b1 ==cij[1][0] and a2/3+b2 ==cij[1][1] and a2/3+b3 ==cij[1][2] and a3/3+b1 ==cij[2][0] and a3/3+b2 ==cij[2][1] and a3/3+b3 ==cij[2][2]:
            print("Yes")
            exit()

print("No")

Buggy submission (verdict: Runtime Error):
cij =[]
for i in range(3):
    cij.append(list(map(int, input().split(" "))))

bi_list = []
for b1 in range(-500000, 500000):
    b2 = b1 - (cij[0][0] - cij[0][1])
    b3 = b1 - (cij[0][0] - cij[0][2])

    a1 = cij[0][0]+cij[0][1]+cij[0][2] -b1-bi2-b3
    a2 = cij[1][0]+cij[1][1]+cij[1][2] -b1-b2-b3
    a3 = cij[2][0]+cij[2][1]+cij[2][2] -b1-b2-b3
    if (a1) % 3 == 0 and (a2) % 3 == 0 and (a3) % 3 == 0:
        print("Yes")
        exit()

print("No")

Buggy submission (verdict: Runtime Error):
cij =[]
for i in range(3):
    cij.append(list(map(int, input().split(" "))))

bi_list = []
for b1 in range(100):
    b2 = b1 - (cij[0][0] - cij[0][1])
    b3 = b1 - (cij[0][0] - cij[0][2])
    if b2 < 0 or b3 < 0 or b2 > cij[0][1] or b3 > cij[0][2] :
        continue
    bi_list.append([b1, b2, b3])

for bi in bi_list:
    a1 = cij[0][0]+cij[0][1]+cij[0][2] -bi[0]-bi[1]-bi[2] 
a2 = cij[1][0]+cij[1][1]+cij[1][2] -bi[0]-bi[1]-bi[2] 
a3 = cij[2][0]+cij[2][1]+cij[2][2] -bi[0]-bi[1]-bi[2] 
    if (a1) % 3 == 0 and (a2) % 3 == 0 and (a3) % 3 == 0 and a1 >=0 and a2 >= 0 and a3 >= 0:
        print("Yes")
        exit()

print("No")
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())

print((x - a) % b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A1 = [[int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")]]

sum_point = A1[0][0] + A1[1][N - 1]
for i in range(N):
    if sum(A1[0][i + 1:]) <= sum(A1[1][i: N - 1]):
        sum_point += sum(A1[1][i: N - 1])
        break
    else:
        sum_point += A1[0][i + 1]

print(sum_point)
Problem p03323 (python)

Fixed submission:
A, B = map(int, input().split())
count = 0
for i in range(16):
  if count == 0:
    A -= 1
    count += 1
  else:
    count -= 1
    B -= 1
if A <= 0 and B <= 0:
	print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
count = 0
for i in range(16):
  if count == 0:
    A -= 1
  else:
    B -= 1
if A <= 0 and B <= 0:
	print(Yay!)
else:
  print(:()
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max([A*B, A+B, A-B]))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max([A*B, A+B, A-B])
Problem p03352 (python)

Fixed submission:
n = int(input())
result = pow(int(n**(1/2)), 2)
for b in range(1, n):
  for p in range(2, n):
    if b**p > n:
        break
    elif b**p > result:
        result = b**p

print(int(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
result = 0
for b in range(n):
  for p in range(n):
    if b**p => n and result < b**p:
      result = b**p
      break

print(int(result))
Problem p03359 (python)

Fixed submission:
a, b = map(int,input().split())
if a <= b:
  print(a)
elif a > b:
  print(a-1)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
  numbers = list(map(int, input().split()))
  k = int(input())
  sum = 0
  for i in range(3):
    if i == numbers.index(max(numbers)):
      sum += max(numbers) * pow(2, k)
    else:
      sum += numbers[i]
  print(sum)

Buggy submission (verdict: Runtime Error):
numbers = list(map(int, input().split()))
k = int(input())
sum = 0
for i in range(3):
  if i == numbers.index(max(numbers)):
    sum += max(numbers) * pow(2, k)
  else:
    sum += numbers[i]
print(sum)

Buggy submission (verdict: Runtime Error):
numbers = list(map(int, input().split()))
k = int(input())
sum = 0
for i in range(3):
  if i == numbers.index(max(numbers)):
    sum += max(numbers) * (2 ** k) 
  else:
    sum += numbers[i]
print(sum)

Buggy submission (verdict: Runtime Error):
numbers = list(map(int, input().split()))
k = int(input())
sum = 0
for i in range(3):
  if i == numbers.index(max(numbers)):
    sum += max(numbers) * (2 ^ k) 
  else:
    sum += numbers[i]
print(sum)
Problem p03363 (python)

Fixed submission:
def get_input():
    N = int(input())
    numbers = [int(i) for i in input().split()]
    return N, numbers

def DPsolve(N, numbers):
    count = 0
    dp = [[1 for i in range(len(numbers))] for j in range(len(numbers))]
    for i in range(N):
        for j in range(N-i):
            if j == 0:
                dp[i][j] = numbers[i]
            else:
                dp[i][j] = dp[i][j-1] + numbers[i+j]
            if dp[i][j] == 0:
                count += 1
    return dp, count

if __name__ == '__main__':
    N, numbers = get_input()
    s = [0]
    for i in range(N):
        s.append(s[-1] + numbers[i])
    s.sort()
    count = 1
    result = 0
    for i in range(N):
        if(s[i] == s[i+1]):
            count += 1
        else:
            result += count * (count -1 ) // 2
            count = 1
    result += count * (count -1 ) // 2
    print(result)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    N, numbers = get_input()
    s = [0]
    for i in range(N):
        s.append(s[-1] + numbers[i])
    s.sort()
    print(s)
    count = 1
    result = 0
    for i in range(N):
        if(s[i] == s[i+1]):
            count += 1
        else:
            result += count * (count -1 ) // 2
            count = 1
    result += count * (count -1 ) // 2
    print(result)
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))

Buggy submission (verdict: Runtime Error):
a,b,h=[int(i) for i in input()]
print((a+b)*h/2)