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

Fixed submission:
s = input()

print(min(s.count('0'), s.count('1'))*2)

Buggy submission (verdict: Runtime Error):
import copy as copy
s = input()
dic={}

def pre():
    global s
    n = 0
    while '1100' in s:
        s=s.replace('1100', '10', 1)
        n+=2

    while '0011' in s:
        s=s.replace('0011', '01', 1)
        n+=2
    
    while '10101' in s:
        s=s.replace('10101', '101', 1)
        n+=2
    
    while '01010' in s:
        s=s.replace('01010', '010', 1)
        n+=2

    return n

def func(val, n):
    if val in dic:
        return dic[val]

    if not ('1' in val):
        return n
    elif not ('0' in val):
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(val.replace('01', '', 1), n+2)
    if '10' in val:
        b = func(val.replace('10', '', 1), n+2)
    
    ans=max(a, b, n)
    dic[val]=ans

    return ans

ans=pre()
print(func(s, ans))

Buggy submission (verdict: Runtime Error):
import copy as copy
s = input()
dic={}

def func(val, n):
    if val in dic:
        return dic[val]

    if not ('1' in val):
        return n
    elif not ('0' in val):
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(val.replace('01', '', 1), n+2)
    if '10' in val:
        b = func(val.replace('10', '', 1), n+2)
    
    ans=max(a, b, n)
    dic[val]=ans

    return ans

print(func(s, 0))

Buggy submission (verdict: Runtime Error):
import copy as copy
s = input()
dic={}

def func(val, n):
    if val in dic:
        return dic[val]

    if not ('1' in val):
        return n
    elif not ('0' in val):
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(val.replace('01', '', 1), n+2)
    if '10' in val:
        b = func(val.replace('10', '', 1), n+2)
    
    ans=max(a, b, n)

    dic[val]=ans

    return ans

print(func(s, 0))

Buggy submission (verdict: Runtime Error):
import copy as copy
s = input()

def func(val, n):
    if len(val) < 2:
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(copy.copy(val.replace('01', '', 1)), n+2)
    if '10' in val:
        b = func(copy.copy(val.replace('10', '', 1)), n+2)
    
    return max(a, b, n)

print(func(s, 0))

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

def func(val, n):
    if len(val) < 2:
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(val.replace('01', '', 1), n+2)
    if '10' in val:
        b = func(val.replace('10', '', 1), n+2)
    
    return max(a, b, n)

print(func(s, 0))
Problem p03108 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

data = input().split()
n = int(data[0])
m = int(data[1])
edge=[]
for i in range(m):
    tmp = []
    data = input().split()
    tmp.append(int(data[0])-1)
    tmp.append(int(data[1])-1)
    edge.append(tmp)

grp=list(range(0, n))
def group(num):
    if grp[num] == num:
        return num
    return group(grp[num])

def merge(p_num, c_num):
    grp[c_num]=grp[p_num]

res=[]
ans = [1]*n
ben = int(n*(n-1)/2)
edge.reverse()
for e in edge:
    #print(e, ans, ben, grp)
    res.append(ben)
    g0 = group(e[0])
    g1 = group(e[1])
    if g0 != g1:
        ben -= ans[g0]*ans[g1]
        sum = ans[g0]+ans[g1]
        if ans[g0] > ans[g1]:
            merge(g0, g1)
        else:
            merge(g1, g0)
        ans[g0]=sum
        ans[g1]=sum

res.reverse()
for r in res:
    print(r)

#print(int(n*(n-1)/2))

Buggy submission (verdict: Runtime Error):
data = input().split()
n = int(data[0])
m = int(data[1])
edge=[]
for i in range(m):
    tmp = []
    data = input().split()
    tmp.append(int(data[0])-1)
    tmp.append(int(data[1])-1)
    edge.append(tmp)

grp=list(range(0, n))
def group(num):
    if grp[num] != num:
        return group(grp[num])
    return num

def merge(num1, num2):
    grp[num2]=grp[num1]

res=[]
ans = [1]*n
ben = int(n*(n-1)/2)
edge.reverse()
for e in edge:
    #print(e, ans, ben, grp)
    res.append(ben)
    g0 = group(e[0])
    g1 = group(e[1])
    if g0 != g1:
        ben -= ans[g0]*ans[g1]
        sum = ans[g0]+ans[g1]
        merge(g0, g1)
        ans[g0]=sum

res.reverse()
for r in res:
    print(r)

#print(int(n*(n-1)/2))

Buggy submission (verdict: Runtime Error):
data = input().split()
n = int(data[0])
m = int(data[1])
edge=[]
for i in range(m):
    tmp = []
    data = input().split()
    tmp.append(int(data[0])-1)
    tmp.append(int(data[1])-1)
    edge.append(tmp)

grp=list(range(0, n))
def group(num):
    if grp[num] != num:
        return group(grp[num])
    return num

def merge(num1, num2):
    grp[num2]=grp[num1]

res=[]
ans = [1]*n
ben = int(n*(n-1)/2)
edge.reverse()
for e in edge:
    #print(e, ans, ben, grp)
    res.append(ben)
    if group(e[0]) != group(e[1]):
        ben -= ans[group(e[0])]*ans[group(e[1])]
        sum = ans[group(e[0])]+ans[group(e[1])]
        merge(group(e[0]), group(e[1]))
        ans[group(e[0])]=sum

res.reverse()
for r in res:
    print(r)

#print(int(n*(n-1)/2))
Problem p03135 (python)

Fixed submission:
data = input().split()
  
t = int(data[0])
x = int(data[1])


print(t/x)

Buggy submission (verdict: Runtime Error):
data = input().split()  
n = int(data[0])
m = int(data[1])
x = [int(s) for s in input().split()]

x.sort()

y=[]
tmp=0
for i in x:
    y.append(i-tmp)
    tmp=i
y.pop(0)

y.sort()
y.reverse()

res=x[-1]-x[0]

if(len(y)+1 < n):
    n = len(y)+1

for i in range(n-1):
    res-=y[i]

print(res)

Buggy submission (verdict: Runtime Error):
data = input().split()  
n = int(data[0])
m = int(data[1])
x = [int(s) for s in input().split()]

x.sort()

y=[]
tmp=0
for i in x:
    y.append(i-tmp)
    tmp=i
y.pop(0)

y.sort()
y.reverse()

res=x[-1]-x[0]

print(x)
print(y)

if(len(y)+1 < n):
    n = len(y)+1

for i in range(n-1):
    res-=y[i]

print(res)
Problem p03137 (python)

Fixed submission:
data = input().split()  
n = int(data[0])
m = int(data[1])
x = [int(s) for s in input().split()]

x.sort()

y=[]
tmp=0
for i in x:
    y.append(i-tmp)
    tmp=i
y.pop(0)

y.sort()
y.reverse()

res=x[-1]-x[0]

if(len(y)+1 < n):
    n = len(y)+1

for i in range(n-1):
    res-=y[i]

print(res)

Buggy submission (verdict: Runtime Error):
data = input().split()  
n = int(data[0])
m = int(data[1])
x = [int(s) for s in input().split()]

x.sort()

y=[]
tmp=0
for i in x:
    y.append(i-tmp)
    tmp=i

y.sort()
y.reverse()


res=x[-1]-x[0]


for i in range(n-1):
    res-=y[i]


print(res)
Problem p02753 (python)

Fixed submission:

S = input()

print("Yes" if S.count("A")==2 or S.count("B")==2 else "No")

Buggy submission (verdict: Runtime Error):

S = input()

pritn("Yes" if S.count("A")==2 and S.count("B")==2 else "No")

Buggy submission (verdict: Runtime Error):

S = input()

pritn("Yes" if S.count(A)==2 and S.count(B)==2 else "No")
Problem p02771 (python)

Fixed submission:

ABC = list(input().split())

print("Yes" if len(set(ABC))==2 else "No")

Buggy submission (verdict: Runtime Error):

ABC = set(input())

print("Yes" len(ABC)==2 else "No")

Buggy submission (verdict: Runtime Error):

A, B, C = set(input().split())

print("Yes" len(A, B, C)==2 else "No")

Buggy submission (verdict: Runtime Error):

A, B, C = set(input().split())

print("Yes" len(set)==2 else "No")
Problem p02835 (python)

Fixed submission:

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

print("bust" if sum(A)>=22 else "win")

Buggy submission (verdict: Runtime Error):

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

print("bust" if sum(A)>=22 else "win")
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()

print("Yes" if S[:(N//2)] == S[(N//2):N] else "No")

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

print("Yes" if S[0:(N//2)]==S[(N//2):N] else "No")
Problem p02897 (python)

Fixed submission:
N = int(input())

print("0.5" if (N%2)==0 else ((N//2)+1)/N)

Buggy submission (verdict: Runtime Error):

N = int(input())

print(float(1/2) if (N%2)==0 else float((N+1)/2*N)
Problem p03835 (python)

Fixed submission:

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < i + j :
            break
        if S - i - j <= K :
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):

K, S = map(int, input().split())

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < x + y :
            break
        if S - i - j <= K :
            count += 1
print(count)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

n=int(input())
F = [1]
for i, j in factorization(n):
    for _ in range(j):
        F.append(i)
import itertools
ans = 9999999999999
for flags in itertools.product([0,1], repeat=len(F)):
    a = 1
    b = 1
    for i in range(len(F)):
        if flags[i]:
            a *= F[i]
        else:
            b *= F[i]
    tmp = (a-1) + (b-1)
    if tmp < ans:
        ans = tmp
print(ans)
Problem p02912 (python)

Fixed submission:
n, m = map(int,input().split())
A = list(map(int,input().split()))
A = [x * -1 for x in A]
A.sort()
import heapq
import bisect
heapq.heapify(A)
for _ in range(m):
    min_ = heapq.heappop(A)
    tmp = min_ * -1 // 2 * -1
    index = bisect.bisect_left(A, tmp)
    heapq.heappush(A,tmp)
print(sum(A) * -1)

Buggy submission (verdict: Runtime Error):
def binary_search(l, value):
    if len(l) == 0:
        return 0
    if len(l) < 4:
        for i in range(len(l)):
            if value <= l[i]:
                return i
    low = 0
    high = len(l) - 1
    while low <= high:
        mid = (low + high) // 2
        if l[mid-1] <= value <= l[mid]:
            return mid
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return mid
    
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
d = deque(A)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = binary_search(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
print(1)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
index = bisect.bisect_left(d, 2)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
from collections import deque
import bisect
d = deque(A)
index = bisect.bisect_left(d, 2)
for _ in range(m):
    max_ = d.pop()
    tmp = max_ // 2
    index = bisect.bisect_left(d, tmp)
    d.insert(index, tmp)
print(sum(d))
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
MOD = 1000000007 
D=[0] * (n+2)
D[0] = 1
for _ in range(m):
    D[int(input())] = -1
for i in range(n):
    if D[i] == -1:
        continue
    if D[i+1] != -1:
        D[i+1] += D[i]
    if D[i+2] != -1:
        D[i+2] += D[i]
    D[i]%=MOD
print(D[n] % MOD)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
MOD = 1000000007 
D=[1] * (n + 1)
for _ in range(m):
    D[int(input())] = 0
for i in range(2, n+1):
    if D[i] == 0:
        continue
    D[i] = (D[i-1] + D[i-2]) % MOD
print(D[i])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
MOD = 1000000007 
D=[0] * n
D[0], D[1] = 1, 1
for _ in range(m):
    D[int(input())] = -1
for i in range(2, n):
    if D[i] == -1:
        continue
    if D[i-1] != -1:
        D[i] += D[i-1]
    if D[i-2] != -1:
        D[i] += D[i-2]
    D[i]%=MOD
ans = 0
if D[n-1] != -1:
    ans += D[n-1]
if D[n-2] != -1:
    ans += D[n-2]
print(ans % MOD)
Problem p03038 (python)

Fixed submission:
n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    ql.append([b,c])
ql.sort(key=lambda x: x[1],reverse=True)
i, j = 0,0
while i < len(cl) and j < len(ql):
    if cl[i] < ql[j][1]:
        cl[i] = ql[j][1]
        ql[j][0] -=1
        if ql[j][0] == 0:
            j+=1
    i+=1
print(sum(cl))

Buggy submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
i = 0
for c in cl:
    if i >len(cl):
        break
    if c < ql[i]:
        ans+=ql[i]
        i+=1
    else:
        ans+=c
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
i = 0
for c in cl:
    if c < ql[i]:
        ans+=ql[i]
        i+=1
    else:
        ans+=c
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
for c in cl:
    if c < ql[0]:
        ans+=ql[0]
        del ql[0]
    else:
        ans+=c
print(ans)
Problem p03041 (python)

Fixed submission:
n, k = list(map(int, input().split()))
a = input()
tmp = ""
for i in range(n):
    t = a[i]
    if i == k-1:
        t = t.lower()
    tmp += t
print(tmp)

Buggy submission (verdict: Runtime Error):
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
from collections import deque
stack=deque([])
stack.append(0)
while stack:
    v=stack.popleft()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        stack.appendleft(u)
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
L=[[] for i in range(n)]
for i in range(n-1):
    u,v,w=map(int, input().split())
    u-=1
    v-=1
    L[u].append([v,w])
    L[v].append([u,w])
ans=[-1]*n
ans[0]=0
from collections import deque
que=deque([])
que.append(0)
while que:
    v=que.popleft()
    for u, w in L[v]:
        if ans[u]!=-1:
            continue
        ans[u]=(ans[v]+w)%2
        que.append(u)
for a in ans:
    print(a)
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())
list1 = []
for i in range(9):
  for j in range(9):
    list1.append((i+1)*(j+1))
b = len(list1)
flag = 0
for k in range(b):
  if a == list1[k]:
    flag = 1
    break;
if flag == 1:
  print("Yes")
else:
  print("No")

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

Fixed submission:
a,b,c = map(int,input().split())
for i in range(10):
  c = a*c-b
  print(c)

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

Fixed submission:
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>1 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i-1)
    S.pop(i-1)
    i-=1
  else:
    i+=1
  if i==0:
    i+=1
print(L-len(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>=2 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i-1)
    S.pop(i-1)
    i-=1
  else:
    i+=1

print(L-len(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>1 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i)
    S.pop(i-1)
    i-=1
  else:
    i+=1

print(L-len(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>0 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i)
    S.pop(i-1)
    i-=1
  else:
    i+=1

print(L-len(S))

Buggy submission (verdict: Runtime Error):
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>0 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i-1)
    S.pop(i-1)
    i=i-1
  else:
    i+=1

print(L-len(S))
Problem p03135 (python)

Fixed submission:
a = input().split()
b = float(int(a[0]) / int(a[1]))
print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split()
i = 0
while i < n:
  a[i] = int(a[i])
  i = i + 1 

i = 0
while i < n:
  j = i + 1
  while j < n:
    if a[i] < a[j]:
      temp = a[i]
      a[i] = a[j]
      a[j] = temp
    j = j + 1
  i = i + 1

sum = sum(a)
print(a[0])
if(sum-a[0] > a[0]):
  print("Yes")
else:
  print("No")
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
list = []
for i in range(n):
  list.append(int(input()))
list.sort()
min = list[n-1]
for j in range(n-k+1):
  if list[j+k-1]-list[j] < min:
    min = list[j+k-1]-list[j]
print(min)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
list = []
for i in range(n):
  list.append(int(input()))
list.sort()
min = 10^9
for j in range(n-k+1):
  if list[j+k-1]-list[j] < min:
    min = list[j+k]-list[j]
print(min)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
list = []
for i in range(n):
  list.append(int(input()))
list.sort()
min = 10^9
for j in range(n-k+1):
  if list[j+k-1]-list[j] < min:
    min = list[j+k]-list[j]
print(min)
Problem p03242 (python)

Fixed submission:
n = int(input())
if n == 111:
  print(999)
if n == 119:
  print(991)
if n == 191:
  print(919)
if n == 199:
  print(911)
if n == 911:
  print(199)
if n == 919:
  print(191)
if n == 991:
  print(119)
if n == 999:
  print(111)

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

if(n[0] == 1):
  n[0] = 9
else:
  n[0] = 1
if(n[1] == 1):
  n[1] = 9
else:
  n[1] = 1
if(n[2] == 1):
  n[2] = 9
else:
  n[2] = 1

Buggy submission (verdict: Runtime Error):
n=input()
for i in range(len(n))
if(n[0] == 1):
  n[0] = 9
else:
  n[0] = 1
if(n[1] == 1):
  n[1] = 9
else:
  n[1] = 1
if(n[2] == 1):
  n[2] = 9
else:
  n[2] = 1
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
print(6-a-b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(6-a-b)
Problem p02847 (python)

Fixed submission:
a=input()
if a=="SUN":
    print(7)
elif a=="MON":
    print(6)
elif a=="TUE":
    print(5)
elif a=="WED":
    print(4)
elif a=="THU":
    print(3)
elif a=="FRI":
    print(2)
elif a=="SAT":
    print(1)

Buggy submission (verdict: Runtime Error):
a=input()
b=["SUN","MON","THU","WED","THU","FRI","SAT"]
print(7-b.index(a))
Problem p02897 (python)

Fixed submission:
a=int(input())
d=0
for num in range(a+1):
    c=num%2
    if c==1:
        d+=1
print(d/a)

Buggy submission (verdict: Runtime Error):
a=input()
b=["SUN","MON","THU","WED","THU","FRI","SAT"]
print(7-b.index(a))
Problem p02729 (python)

Fixed submission:
n,m=(input().split())
n=int(n)
m=int(m)
print(int(((n*(n-1))+(m*(m-1)))/2))

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

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r = input()
print(r ** 2)
Problem p03012 (python)

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

res = sum(w)
sum1 = 0
sum2 = sum(w)
for i in range(n):
    sum1 += w[i]
    sum2 -= w[i]
    res = min(res, abs(sum2-sum1))

print(res)

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

res = sum(w)
sum1 = 0
sum2 = sum(w)
for i in range(n):
    sum1 += w[i]
    sum2 -= w[i]
    res = min(res, abs(sum2-sum1))

print(ans)
Problem p03077 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
 
print((a-1) // min(b,c,d,e,f) + 5)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
ans=0
arr=[b,c,d,e,f]
amari=0
gurupu=0
syou=0

for i in range(6):
    if i == 1:
        amari=a % b
        gurupu=a // b + 1
        syou=b
    elif arr[i-1]<arr[i]:
        if amari>arr[i]:
            amari=amari % arr[i]
            gurupu=syou // arr[i] + 1
        else:
            gurupu=syou // arr[i] + 1
            

print(gurupu + 4)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
ans=0
arr=[b,c,d,e,f]
amari=0
gurupu=0
syou=0

for i in range(6):
    if i == 1:
        amari=a % b
        gurupu=a // b + 1
        syou=b
    elif arr[i-1]<arr[i]:
        if amari>arr[i]:
            amari=amari % arr[i]
            gurupu=syou // arr[i] + 1
        else:
            gurupu=syou // arr[i] + 1
            

print(gurupu + 4)
Problem p02847 (python)

Fixed submission:
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days[S])

Buggy submission (verdict: Runtime Error):
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days{(S)})

Buggy submission (verdict: Runtime Error):
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days(S))