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

Fixed submission:
from operator import itemgetter

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC =[]

for i in range(M):
    BC.append(list(map(int,input().split())))

A.sort()
BC_sorted = sorted(BC, key=itemgetter(1), reverse=True)
# print(BC_sorted)

cur = 0

for i in range(M):
    if cur == N or A[cur]>= BC_sorted[i][1]:
        break
    for j in range(BC_sorted[i][0]):
        for k in range(cur, N):
            if A[k] < BC_sorted[i][1]:
                A[k] = BC_sorted[i][1]
                cur = k+1
                break
            elif A[k] > BC_sorted[i][1]:
                cur = k+1
                break
    # print(i, ':', A, 'cur:', cur)


print(sum(A))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC =[]

for i in range(M):
    BC.append(list(map(int,input().split())))

A.sort()
BC_sorted = sorted(BC, key=itemgetter(1), reverse=True)
# print(BC_sorted)

cur = 0

for i in range(M):
    if A[cur]>= BC_sorted[i][1]:
        break
    for j in range(BC_sorted[i][0]):
        for k in range(cur, N):
            if A[k] < BC_sorted[i][1]:
                A[k] = BC_sorted[i][1]
                cur = k+1
                break
            elif A[k] > BC_sorted[i][1]:
                cur = k+1
                break
    # print(i, ':', A, 'cur:', cur)


print(sum(A))
Problem p03208 (python)

Fixed submission:
import math

n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10**9

for i in range(0,math.ceil((n-k+1)/2)):
    tmp1 = h[i+k-1] - h[i]
    tmp2 = h[-1-i] - h[-i-k]
    if tmp1==0 or tmp2==0:
        crr_min=0
        break

    if tmp1<crr_min:
        crr_min = tmp1

    if tmp2<crr_min:
        crr_min = tmp2


print(crr_min)

Buggy submission (verdict: Runtime Error):
import math

n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10^9

for i in range(0,math.ceil((n-k+1)/2)):
    tmp1 = abs(h[n-k+i] - h[i])
    tmp2 = abs(h[n-1-i] - h[n-k-i])
    if tmp1==0 or tmp2==0:
        crr_min=0
        break

    if tmp1<crr_min:
        crr_min=tmp1

    if tmp2<crr_min:
        crr_min=tmp2


print(crr_min)

Buggy submission (verdict: Runtime Error):
import math

n,k = map(int, input().split())
h = [int(input()) for i in range(n)] 
h.sort()

crr_min = 10^9
crr_min += 1

for i in range(0,math.ceil((n-k+1)/2)):
    tmp1 = h[n-k+i] - h[i]
    tmp2 = h[n-1-i] - h[n-k-i]
    if tmp1<crr_min:
        crr_min=tmp1

    if tmp2<crr_min:
        crr_min=tmp2

print(crr_min)

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

crr_min = 10^9

for i in range(0,n-k+1):
    tmp = h[n-k+i] - h[0+i]
    if tmp<crr_min:
        crr_min=tmp

print(crr_min)
Problem p03834 (python)

Fixed submission:
s=input().split(",")
print(s[0],s[1],s[2])

Buggy submission (verdict: Runtime Error):
s=input()
s[5] = " "
s[13] = " "
print(s)
Problem p02881 (python)

Fixed submission:
n = int(input())
move =[]
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        move.append(i+n//i)
# print(move)
print(min(move)-2)

Buggy submission (verdict: Runtime Error):
n = int(input())
# divisors = []
move =[]
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
#         divisors.append(i)
        move.append(i+n//i)
        if i != n // i:
            divisors.append(n//i)
        
# divisors.sort()
# print(divisors)
# print(move)
print(min(move)-2)
Problem p03073 (python)

Fixed submission:
#2019/10/24
# S = list(map(int, list(open(0).read())))
S = list(map(int, input()))
# print(S)
print(S[::2].count(0) + S[1::2].count(1) if S[0]==1 else S[::2].count(1) + S[1::2].count(0))

Buggy submission (verdict: Runtime Error):
#2019/10/24
S = list(map(int, list(open(0).read())))
# print(S)
print(S[::2].count(0) + S[1::2].count(1) if S[0]==1 else S[::2].count(1) + S[1::2].count(0))
Problem p03107 (python)

Fixed submission:
S = input()
# print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
#         print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
#         print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
        print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
        print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC120 C - Unification
# 2019/10/28

def main():
    S = list(map(int, list(open(0).read())))
#     print(S)
    
    cnt = 0
    i=0

    while (i<len(S)-1):
        if (S[i] == 0 and S[i+1] == 1) or (S[i] == 1 and S[i+1] == 0):
            S.pop(i)
            S.pop(i)
            cnt+=2
#             print("i={0}, S={1}, cnt={2}".format(i, S, cnt))
            i=0
        i+=1
    
    print(cnt)
    
    
if __name__ == "__main__":
    main()
Problem p03013 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))
M = 1000000007
dp = {}
dp[0] = 1
for i in range(1, n+1):
    if i in a:
        dp[i] = 0
        continue
    if i - 2 < 0:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[n] % M)

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))
M = 1000000007
dp = {}
dp[0] = 1
dp[1] = 1
for i in range(2, n+1):
    if i in a:
        dp[2] = 0
    else:
        dp[2] = dp[0] + dp[1]
    dp[0] = dp[1]
    dp[1] = dp[2]

print(dp[2] % M)

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))
M = 1_000_000_007
dp = {}
dp[0] = 1
for i in range(1, n+1):
    if i in a:
        dp[i] = 0
        continue
    if i - 2 < 0:
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[n] % M)
Problem p02879 (python)

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

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a * b)

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

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a * b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a >= 10 or b >= 10:
    print(-1)
else:
    print(a * b)
Problem p02912 (python)

Fixed submission:
from heapq import heappush, heappop, heapify

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

obj = input().strip().split(' ')
val_list = [-1 * item for item in list(map(int, obj))]

heapify(val_list)

for _ in range(M):
    val = (-1) * ((heappop(val_list) * (-1)) // 2)
    heappush(val_list, val)

print(-1 * sum(val_list))

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

obj = input().strip().split(' ')
val_list = [-1 * item for item in list(map(int, obj))]

heapify(val_list)

for _ in range(M):
    val = (-1) * ((heappop(val_list) * (-1)) // 2)
    heappush(val_list, val)

print(-1 * sum(val_list))
Problem p02897 (python)

Fixed submission:
n=int(input())
count=0
for i in range(1,n+1,2):
    count+=1
print(count/n)

Buggy submission (verdict: Runtime Error):
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


a,b=map(int,input().split())

ansa=prime_factorize(a)
ansb=prime_factorize(b)
count=0

for i in range(len(ansa)):
    if ansa[i] in ansb:
        count+=1
    


print(count)
Problem p02916 (python)

Fixed submission:
n=int(input())
a= list(map(int,input().split()))
a=[i-1 for i in a]
b= list(map(int,input().split()))
c= list(map(int,input().split()))

count=0
cook=-4
for i in a:
    if i==cook:
        count+=c[i-1]
    
    count+=b[i] 
    cook=i+1
    
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
a= list(map(int,input().split()))
a=[i-1 for i in a]
b= list(map(int,input().split()))
c= list(map(int,input().split()))

count=0

for i in a:
    if i==cook:
        count+=c[i-1]
    
    count+=b[i] 
    cook=i+1
    
print(count)
Problem p02935 (python)

Fixed submission:
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista.sort()

for i in range(n-1):
    lista.append((lista[0]+lista[1])/2)
    lista.pop(0)
    lista.pop(0)
    lista.sort()
    
print(lista[0])

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista=sorted(lista)
for i in range(n-1):
    lista.append((lista[i]+lista[i+1])/2)
    lista.pop(i+1)
    lista.pop(i)
print(lista[0])

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista=sorted(lista)
for i in range(n-1):
    lista.append((lista[i]+lista[i+1])/2)
    lista.pop(i+1)
    lista.pop(i)
print(lista)
Problem p03745 (python)

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

count=0
zougen=""
for i in range(n-1):
    if zougen=="":
        if lista[i]<lista[i+1]:
            zougen="up"
        if lista[i]>lista[i+1]:
            zougen="down"
    elif  zougen=="up":
        if lista[i]>lista[i+1]:
            count+=1
            zougen=""
    elif zougen=="down":
        if lista[i]<lista[i+1]:
            count+=1
            zougen=""
print(count+1)

Buggy submission (verdict: Runtime Error):
n,c,k=map(int,input().split())
lista=[int(input())for i in range(n)]
listb=sorted(lista)
count=0
bustime=0
buspeople=0
for i in listb:
    if buspeople==0 or bustime<i:
        count+=1
        buspeople=c-1
        bustime=i+k
    else :
        buspeople-=1
print(count)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
v = np.array(list(map(int,input().split())))
v_sort = np.sort(v)
temp = 0

for index in range(n-1):
  temp = (v_sort[0]+v_sort[1])/2
  v_sort = np.delete(v_sort,0)
  v_sort = np.delete(v_sort,0)
  v_sort = np.append(v_sort,temp)
  v_sort = np.sort(v_sort)

print(v_sort[0])
Problem p02954 (python)

Fixed submission:
# initialize
s = list(input())
s2 = {}
s2_index = 1
num = 1

# RunLength
for index in range(len(s)):
  if index<len(s)-1:
    if s[index]!=s[index+1]:
      s2[s2_index] = num
      num = 1
      s2_index += 1
    else:
      num += 1
  s2[s2_index] = num

# initialize
zero = ""
zero2 = ""
s3 = ""
s4 = ""

def countzero(zero_number):
  temp = ""
  for index in range(zero_number-1):
    temp += "0 "
  return temp

for key,value in s2.items():
  if key%2!=0:
    # when R=L
    if s2[key]==s2[key+1]:
      zero += countzero(s2[key])
      if s2[key]=="1":
        s3 += "1 1 "
      else:
        s3 += zero+str(s2[key])+" "+str(s2[key])+" "+zero
        zero = ""
    # when (R+L)/2 is even
    elif (s2[key]+s2[key+1])%2 == 0:
      number = str(int((s2[key]+s2[key+1])/2))
      zero += countzero(s2[key])
      zero2 += countzero(s2[key+1])
      s3 += zero+number+" "+number+" "+zero2
      zero = ""
      zero2 = ""
    # when (R+L)/2 is odd
    else:
      number = str(int((s2[key]+s2[key+1])//2)+1)
      number2 = str(int((s2[key]+s2[key+1])//2))
      zero += countzero(s2[key])
      zero2 += countzero(s2[key+1])
      if int(s2[key])<int(s2[key+1]):
        if s2[key+1]%2==0:
          s3 += zero+number+" "+number2+" "+zero2
        else:
          s3 += zero+number2+" "+number+" "+zero2
      else:
        if s2[key]%2==0:
          s3 += zero+number2+" "+number+" "+zero2
        else:
          s3 += zero+number+" "+number2+" "+zero2
      zero = ""
      zero2 = ""

print(s3[:-1])

Buggy submission (verdict: Runtime Error):
# initialize
s = list(input())
s2 = s[0]
num = 1

# RunLength
for index in range(len(s)):
  if index<len(s)-1:
    if s[index]!=s[index+1]:
      s2 += str(num)
      s2 += s[index+1]
      num = 1
    else:
      num += 1
s2 += str(num)

# split strings
s3 = [s2[i:i+4] for i in range(0,len(s2),4)]

# initialize
zero = ""
zero2 = ""
s4 = ""
s5 = ""

def countzero(zero_number):
  temp = ""
  for index in range(zero_number-1):
    temp += "0"
  return temp

for value in s3:
  # when R=L
  if value[1]==value[3]:
    zero += countzero(int(value[1]))
    if value[1]=="1":
      s4 += value[1]+value[3]
    else:
      s4 += zero+value[1]+value[3]+zero
      zero = ""
  # when (R+L)/2 is even
  elif (int(value[1])+int(value[3]))%2 == 0:
    number = str(int((int(value[1])+int(value[3]))/2))
    zero += countzero(int(value[1]))
    zero2 += countzero(int(value[3]))
    s4 += zero+number+number+zero2
    zero = ""
    zero2 = ""
  else:
  # when (R+L)/2 is odd
    number = str(int((int(value[1])+int(value[3]))//2)+1)
    number2 = str(int((int(value[1])+int(value[3]))//2))
    zero += countzero(int(value[1]))
    zero2 += countzero(int(value[3]))
    if int(value[1])<int(value[3]):
      if int(value[3])%2==0:
        s4 += zero+number+number2+zero2
      else:
        s4 += zero+number2+number+zero2
    else:
      if int(value[1])%2==0:
        s4 += zero+number2+number+zero2
      else:
        s4 += zero+number+number2+zero2
    zero = ""
    zero2 = ""

# insert blank
for char in s4:
  s5 += char+" "
s5 = s5[:-1]

print(s5)
Problem p02987 (python)

Fixed submission:
from collections import defaultdict as dedict
counter = dedict(int)

a = input()
for i in list(a):
  counter[i] += 1
  
if ( len(counter) == 2) and (  counter [a[0]] == 2):
  print ("Yes")
  
else:
  print('No')

Buggy submission (verdict: Runtime Error):
from collections import defaultdict as dedict
counter = dedict(int)

a = input()
for i in list(a):
  counter[i] += 1
  
if ( len(counter) == 2) and (  counter [counter.keys()[0]] == 2):
  print ("Yes")
  
else:
  print('No')
Problem p02989 (python)

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

a.sort()
k = int(n/2)    
print(a[k]-a[k-1])

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

a.sort()
    
print(a[int(n/2)+1]-a[int(n/2)])

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

def swap(a,i,j):
  c = a[i]
  d = a[j]
  if a[i]>a[j]:
    a[j] = c
    a[i] = d
  return a

for i in range (int(n/2)+1):
  for j in range (i+1,n):
    swap(a,i,j)
    
print(a[int(n/2)+1]-a[int(n/2)])

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

def swap(a,i,j):
  c = a[i]
  d = a[j]
  if a[i]>a[j]:
    a[j] = c
    a[i] = d
  return a

for i in range (int(n/2)+1):
  for j in range (i+1,n):
    swap(a,i,j)
    
print(a[int(n/2)+1]-a[int(n/2)])

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

def swap(a,i,j):
  c = a[i]
  d = a[j]
  if a[i]>a[j]:
    a[j] = c
    a[i] = d
  return a

for i in range (n/2+1):
  for j in range (i+1,n):
    swap(a,i,j)
    
print(a[n/2+1]-a[n/2])
Problem p02860 (python)

Fixed submission:
n=int(input())
s=list(str(input()))
if n % 2 ==0:
    ans=0
    for i in range(n//2):
        if s[i]==s[n//2+i]:
            ans+=1
        else:
            ans+=0

    if ans==n//2:
        print('Yes')
    else:
        print('No')   

else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
print(n**2)
#B
n=int(input())
s=list(str(input()))
if n % 2 ==0:
    ans=0
    for i in range(n//2):
        if s[i]==s[n//2+i]:
            ans+=1
        else:
            ans+=0

    if ans==n//2:
        print('Yes')
    else:
        print('No')   

else:
    print('No')
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a <= 9 and b <= 9:
    pritn(a*b)
else:
    print(-1)
Problem p02989 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = sorted(A)
print(B[N//2]-B[N//2-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = sorted(A)
print(B[N/2]-B[N/2-1])
Problem p03011 (python)

Fixed submission:
P,Q,R = map(int,input().split())
print(min(P+Q,P+R,Q+R))

Buggy submission (verdict: Runtime Error):
P,Q,R = int(input().split())
print(min(P+Q,P+R,Q+R))
Problem p03012 (python)

Fixed submission:
n = int(input())
w = list(map(int, input().split()))
 
min_diff = 1000
for i in range(n):
	diff = abs(sum(w[0:i]) - sum(w[i:]))
	if diff < min_diff:
		min_diff = diff
print(min_diff)

Buggy submission (verdict: Runtime Error):
N = map(int,input().split())
W = list(map(int,　input().split()))
 
min_list = []
for i in range(N):
    mi = abs(sum(W[0:i]) - sum(W[i:]))
    min_list.append(mi)
print(min(min_list))

Buggy submission (verdict: Runtime Error):
N = map(int,input().split())
W = list(map(int,input().split()))
 
min_list = []
for i in range(N):
    mi = abs(sum(W[0:i]) - sum(W[i:]))
    min_list.append(mi)
print(min(min_list))

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
 
ans = 10000
for i in range(N):
    mi = abs(sum(W[0:i]) - sum(W[i:])
    if mi < ans:
        ans = mi
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
 
ans = 10000
for i in range(N):
    mi = abs(sum(W[0:i]) - sum(W[i:])
    if mi < ans:
        ans = mi
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int,input().split()))
 
ans = 10000
for i in range(N+1):
    if abs(sum(W[0:i]) - sum(W[i:]) < min_first:
        ans = abs(sum(W[0:i]) - sum(W[i:])
print(ans)

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

ans = 10000
for i in range(N):
    dif = abs(sum(W[0:i])-sum(W[i:]))
    if dif < ans:
        ans = dif 
    else:
        pass
print(ans)

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

min_first = 10000
for i in range(N):
    m = abs(sum(W[0:i])-sum(W[i:])
    if m < min_first:
        m = min_first
    else:
        pass
print(m)

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

min_list = []
for i in range(N):
    S1 = sum(W[0:i])
    S2 = sum(W) - sum(W[0:i])
    mi = abs(S1-S2)
    min_list.append(mi)
print(min(min_list))
Problem p03042 (python)

Fixed submission:
s = int(input())
f = s // 100
b = s % 100
if 1 <= f <= 12 and  1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= b <= 12 and not  1 <= f <= 12:
    print("YYMM")
elif 1 <= f <= 12 and not  1 <= b <= 12:
    print("MMYY")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
s = str(input())
w = list(map(int, input().split()))
f = "".join(w[0:2])
b = "".join(w[2:4])
if 1 <= int(f) <= 12 and  1 <= int(b) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(b) <= 12 and not  1 <= int(f) <= 12:
    print("YYMM")
elif 1 <= int(f) <= 12 and not  1 <= int(b) <= 12:
    print("MMYY")
else:
    print("NA")
Problem p03265 (python)

Fixed submission:
x1,y1,x2,y2=map(int,input().split())
x3=x2+y1-y2
y3=y2+x2-x1
x4=x3+y2-y3
y4=y3+x3-x2
print(x3,y3,x4,y4)

Buggy submission (verdict: Runtime Error):
x1,y1,x2,y2=map(int,input().split())
print(x2+y1-y2,y2+x2-x1,x3+y2-y3,y3+x3-x2)
Problem p03072 (python)

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

NH = 1
for i in range(N-1):
    if H[i+1] >= max(H[0:i+1]):
        NH = NH + 1
    else:
        NH = NH

print(NH)

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

NH = 1
for i in range(N-1):
    if H[i+1]=>max(H[0:i+1]):
        NH = NH + 1
    else:
        NH = NH

print(NH)
Problem p02860 (python)

Fixed submission:
input()
a=input()
if len(a)%2==0 and a[:len(a)//2]==a[len(a)//2:]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
input()
a=input()
if len(a)%2==0 and a[:len(a)/2]==a[len(a)/2:]:
	print("Yes")
else:
	pritn("No")

Buggy submission (verdict: Runtime Error):
input()
s=input()
if len(a)%2==0 and a[:len(a)/2]==a[len(a)/2:]:
	print("Yes")
else:
	pritn("No")
Problem p02860 (python)

Fixed submission:
l = int(input())
s = input()
s1 = s[:l // 2]
s2 = s[l//2:]
if s1 == s2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
len = int(input())
s = input()
s1 = s[:len / 2]
s2 = s[len/2:]
if s1 == s2:
  print('Yes')
else:
  print('No')
Problem p02933 (python)

Fixed submission:
import sys

lines = sys.stdin.readlines()
a = int(lines[0])
s = lines[1].strip()

if a < 3200:
    s = 'red'

print(s)
print('\n')

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.readline()
a = lines[0]
b = lines[1].strip()

if a >= 3200:
    b = 'red'

print(b)
Problem p03012 (python)

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


LtoR = []

for i in range(len(w)):
    if i==0:
        LtoR.append(w[i])
    else:
        LtoR.append(w[i]+LtoR[-1])
        
RtoL = []
for i in range(len(w)):
    
    if i==0:
        RtoL.append(w[-i-1])
    else:
        RtoL.append(w[-i-1]+RtoL[-1])
RtoL.reverse()

i = 0
val = abs(LtoR[i]-RtoL[i+1])
while i<len(w)-1:
#     print(val)
    next_val = abs(LtoR[i]-RtoL[i+1])
    if next_val > val:
        break
    else:
        val = next_val
        i+=1
        
print(val)

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


LtoR = []

for i in range(len(w)):
    if i==0:
        LtoR.append(w[i])
    else:
        LtoR.append(w[i]+LtoR[-1])
        
RtoL = []
for i in range(len(w)):
    
    if i==0:
        RtoL.append(w[-i-1])
    else:
        RtoL.append(w[-i-1]+RtoL[-1])
RtoL.reverse()

i = 0
val = abs(LtoR[i]-RtoL[i+1])
while i<len(w):
#     print(val)
    next_val = abs(LtoR[i]-RtoL[i+1])
    if next_val > val:
        break
    else:
        val = next_val
        i+=1
        
print(val)
Problem p02951 (python)

Fixed submission:
def resolve():
    a, b, c = map(int, input().split(" "))
    print(max(0, c - a + b))
    
    
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b, c = map(int, input())
    return c - a + b
  
resolve()