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

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
a = int(input())
s = int(input())
if a >= 3200:
    print(s)
else:
    print('red')
Problem p03315 (python)

Fixed submission:
s = input()
p = s.count("+")
print(2 * p - 4)

Buggy submission (verdict: Runtime Error):
s = input()
n = 0
for o in s:
    if o == '+':
        ans += 1
    else:
        ans -= 1
print(ans)
Problem p02577 (python)

Fixed submission:
N = input()
num = 0

for i in range(len(N)):
    num += int(N[i])
if num % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
num = 0

for i in range(len(N)):
    num += int(N[i])
if num % 9 == 0:
    print("Yes")
else:
    print("No")
Problem p02759 (python)

Fixed submission:
n=int(input())
if n%2:
	print(int(n/2)+1)
else:	
	print(int(n/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2:
  print(int(n/2)+1)
else:
  print(int(n/2)
Problem p02598 (python)

Fixed submission:
n,k=map(int,input().split())
arr=list(map(int,input().split()))
def isvalid(mid,k):
    if mid==0:
        return False
    ans=k
    for i in arr:
        if i>mid:
            ans-=i//mid
    return ans>=0


l=0
r=10**9
while(l<r):
    mid=(l+r)//2
    if isvalid(mid,k):
        r=mid
    else:
        l=mid+1
print(l)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
arr=list(map(int,input().split()))
def isvalid(mid,k):
    ans=k
    for i in arr:
        if i>mid:
            ans-=i//mid
    return ans>=0


l=0
r=10**9
while(l<r):
    mid=(l+r)//2
    if isvalid(mid,k):
        r=mid
    else:
        l=mid+1
print(l)
Problem p02623 (python)

Fixed submission:
from bisect import bisect_left,bisect_right
n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
for i in range(1,n):
    arr1[i]=arr1[i]+arr1[i-1]
for i in range(1,m):
    arr2[i]=arr2[i]+arr2[i-1]
ma=0
for i in range(n):
    if arr1[i]<=k:
        ma=max(ma,bisect_right(arr2,k-arr1[i])+i+1)
for i in range(m):
    if arr2[i]<=k:
        ma=max(ma,bisect_right(arr1,k-arr2[i])+i+1)
print(ma)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left,bisect_right
n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
for i in range(1,n):
    arr1[i]=arr1[i]+arr1[i-1]
for i in range(1,m):
    arr2[i]=arr2[i]+arr2[i-1]
ma=0
for i in range(n):
    c=k-arr1[i]
    ind=bisect_right(arr2,c)
    if arr2[ind]<=c:
        ma=max(ma,ind+i+1)
print(ma)
Problem p02659 (python)

Fixed submission:
from fractions import Fraction
a,b=map(Fraction,input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int((a*b*100)/100))

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    a,b=map(int,input().split())
    if(n%2==0 and i==n//2-1):
        ans=b-a+2
    if(n%2!=0 and i==n//2):
        ans=b-a+1
print(ans)
Problem p02661 (python)

Fixed submission:
n=int(input())
aa=[]
bb=[]
for i in range(n):
    a,b=map(int,input().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if(n%2==0):
    print(bb[n//2-1]+bb[n//2]-aa[n//2]-aa[n//2-1]+1)
else:
    print(bb[n//2]-aa[n//2]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
aa=[]
bb=[]
for i in range(n):
    a,b=map(int,input().split())
    aa.append(a)
    bb.append(b)
aa.sort()
bb.sort()
if(n%2==0):
    print(b[n//2-1]+b[n//2]-a[n//2]-a[n//2-1]+1)
else:
    print(b[n//2]-a[n//2]+1)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
res = []
for i in range(len(s)-len(t)+1):
    x = s[i:i+len(t)]
    count = sum(1 for a, b in zip(t, x) if a != b)
    res.append(count)

print(min(res))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
count = 0
res = ''
ans = ''

for x in t:
  if x not in s:
    continue
  elif t.index(x) > s.index(x):
    continue
  else:
    i = s.index(x)
    ans = x
  
res = s[i-t.index(ans):i-t.index(ans)+len(t)]

if res:
  if len(res) < len(t):
    print(len(t))
  else:
    for i in range(len(res)):
      if res[i] != t[i]:
        count += 1
    print(count)
else:
  print(len(t))
Problem p02729 (python)

Fixed submission:
from itertools import combinations

n,m = map(int, input().split())
a = list(combinations(range(n),2))
b = list(combinations(range(m),2))

print(len(a)+len(b))

Buggy submission (verdict: Runtime Error):
from itertools import combninations

n,m = map(int, input().split())
a = list(combinations(range(n),2))
b = list(combinations(range(m),2))

print(len(a)+len(b))
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)

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

if a == 0:
  print(0)
elif b == 0:
  print(n)
else:
  while len(res) < n:
      res += 'b'*a
      res += 'r'*b

  res = res[:n]
  print(res)
  print(res.count('b'))

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

while len(res) < n:
  res += 'b'*a
  res += 'r'*b
  
res = res[:n]
print(res.count('b'))
Problem p02771 (python)

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

if a == b == c:
  print('No')
elif a != b and b != c and a != c:
  print('No')
elif a == b and a != c:
  print('Yes')
elif a == c and a != b:
  print('Yes')
elif b == c and a != b:
  print('Yes')
else:
  print('No')

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

for i in range(n-1):
    for j in range(i+1, n):
        newLst.append(lst[i]*lst[j])

newLst = sorted(newLst)
print(newLst[k-1])

Buggy submission (verdict: Runtime Error):
a,b,c = int(input().split())

if a == b == c:
  print('No')
elif a != b and b != c and a != c:
  print('No')
elif a == b and a != c:
  print('Yes')
elif a == c and a != b:
  print('Yes')
elif b == c and a != b:
  print('Yes')
else:
  print('No')
Problem p02781 (python)

Fixed submission:
from math import factorial


def nCr(n, r):
    if r <= 0:
        return 0

    if n >= r:
        return factorial(n) // (factorial(n - r) * factorial(r))
    else:
        return 0

def main():
    N = input()
    K = int(input())

    ans = func(N, K)

    print(ans)

def func(N, K):
    N = N.lstrip('0')
    if len(N) < K:
        return 0

    if K == 0:
        return 1

    n = int(N[0])

    if len(N) == 1:
        if K > 1:
            return 0
        else:
            return n

    ret = 0
    if K > 1:
        ret += func(N[1:], K-1)
    else:
        ret += 1
    l = len(N[1:])

    ret += (n - 1) * func('9' * l, K - 1)
    if l >= K:
        ret += func('9'* l, K)

    # ret += (n - 1) * nCr(l-1, K - 2) * 9 ** (K - 1)
    # ret += nCr(l-1, K - 1) * 9 ** K 

    return ret
    

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
rom math import factorial


def nCr(n, r):
    if r <= 0:
        return 0

    if n >= r:
        return factorial(n) // (factorial(n - r) * factorial(r))
    else:
        return 0

def main():
    N = input()
    K = int(input())

    ans = func(N, K)

    print(ans)

def func(N, K):
    if len(N) < K:
        return 0

    if K == 0:
        return 1

    n = int(N[0])

    if len(N) == 1:
        if K > 1:
            return 0
        else:
            return n

    ret = 0
    if K > 1:
        ret += func(N[1:], K-1)
    else:
        ret += 1
    l = len(N[1:])

    ret += (n - 1) * func('9' * l, K - 1)
    ret += func('9'* l, K)

    # ret += (n - 1) * nCr(l-1, K - 2) * 9 ** (K - 1)
    # ret += nCr(l-1, K - 1) * 9 ** K 

    return ret
    

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

Fixed submission:
H, W, M = map(int, input().split())
hw = []
sh = [0] * H
sw = [0] * W
for i in range(M):
    h, w = map(int, input().split())
    hw.append((h - 1, w - 1))

    sh[h - 1] += 1
    sw[w - 1] += 1

mh = max(sh)
mw = max(sw)

count = 0
for i in range(M):
    if sh[hw[i][0]] == mh and sw[hw[i][1]] == mw:
        count += 1

if sh.count(mh) * sw.count(mw) > count:
    print(mh + mw)
else:
    print(mh + mw - 1)

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

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]
hw = np.array(hw) - 1

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i, 0]] += 1
    sw[hw[i, 1]] += 1
    bomb[hw[i, 0], hw[i, 1]] = 1

h_list = [i for i, x in enumerate(sh) if x == max(sh)]
w_list = [i for i, x in enumerate(sw) if x == max(sw)]
    
print(6)

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

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i][0] - 1] += 1
    sw[hw[i][1] - 1] += 1
    bomb[hw[i][0] - 1, hw[i][1] - 1] = 1
    
print(6)

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

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i][0] - 1] += 1
    sw[hw[i][1] - 1] += 1
    bomb[hw[i][0] - 1, hw[i][1] - 1] = 1

h_list = [i for i, x in enumerate(sh) if x == max(sh)]
w_list = [i for i, x in enumerate(sw) if x == max(sw)]

print(6)

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

H, W, M = map(int, list(input().split()))
hw = [list(map(int, list(input().split()))) for i in range(M)]

sh = [0] * H
sw = [0] * W
bomb = np.zeros((H, W), dtype=int)
for i in range(M):
    sh[hw[i][0] - 1] += 1
    sw[hw[i][1] - 1] += 1
    bomb[hw[i][0] - 1, hw[i][1] - 1] = 1

h_list = [i for i, x in enumerate(sh) if x == max(sh)]
w_list = [i for i, x in enumerate(sw) if x == max(sw)]

m = 0
for h in h_list:
    for w in w_list:
        if bomb[h, w]:
            m = max(m, sh[h] + sw[w] - 1)
        else:
            m = max(m, sh[h] + sw[w])

print(m)
Problem p02597 (python)

Fixed submission:
N = int(input())
c = str(input())

Rcount = 0
Wcount = 0
for i in range(len(c)):
    if c[i] == 'R':
        Rcount += 1
for i in range(Rcount):
    if c[i] == 'W':
        Wcount += 1

print(Wcount)

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

left = 0
right = 0
Wcount = 0
Rcount = 0
for i in range(len(c)):
    while c[left] != 'W':
        left += 1
    while c[len(c)-1-right] != 'R':
        right += 1
    if (left + right) >= len(c):
        break
    Wcount += 1
    Rcount += 1
    left += 1
    right += 1

print(Wcount)

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

firstRidx = None
Rrenzoku = 0
Rcount = 0
flag = True
for i in range(len(c)):
    if c[i] == 'R':
        Rcount += 1
        if firstRidx is None:
            firstRidx = i
        if i != 0 and i != firstRidx and c[i-1] == 'W':
            flag = False
        if flag:
            Rrenzoku += 1

if firstRidx <= Rcount - Rrenzoku:
    print(Rcount - Rrenzoku)
elif firstRidx > Rcount - Rrenzoku:
    print(firstRidx)
Problem p02625 (python)

Fixed submission:
mod = 10 ** 9 + 7
N, M = map(int, input().split())

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % mod
            self.inv[i] = -self.inv[mod % i] * (mod // i) % mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % mod

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % mod

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % mod) % mod

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

comb = Combination(M + 100)

A = comb.npr(M, N) % mod

B = 0
for i in range(N + 1):
    B += (-1) ** i * comb.ncr(N, i) * comb.npr(M - i, N - i) % mod

print(A * B % mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb

mod = 10 ** 9 + 7
N, M = map(int, input().split())

A = perm(M, N, exact=True) % mod

B = 0
for i in range(N + 1):
    B += (-1) ** i * comb(N, i, exact=True) * perm(M - i, N - i, exact=True) % mod

print(A * B)
Problem p02659 (python)

Fixed submission:
import math

A, B = input().split(' ')

A = int(A)
B = round(float(B) * 100)
print(math.floor(A * B // 100))

Buggy submission (verdict: Runtime Error):
import math

A, B = input().split(' ')

B = round(B * 100)
print(math.floor(A * B // 100))

Buggy submission (verdict: Runtime Error):
import math

AB = list(map(int, input().split(' ')))

print(math.floor(AB[0] * AB[1]))
Problem p03250 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(10*a[2]+a[1]+a[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split())
a.sort()
print(10*a[2]+a[1]+a[0])

Buggy submission (verdict: Runtime Error):
a = list(int,input().split())
a.sort()
print(10*a[2]+a[1]+a[0])
Problem p02571 (python)

Fixed submission:
S=input()
T=input()
cnt=[]
if len(S)==len(T):
    kazu=0
    for i in range(len(S)):
        if S[i]!=T[i]:
            kazu+=1
    cnt.append(kazu)


for i in range(len(S)-len(T)):
    count=0
    kari=S[i:i+len(T)]
    for j in range(len(T)):
        if kari[j]!=T[j]:
            count+=1
    cnt.append(count)
print(min(cnt))

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
cnt=[]
for i in range(len(S)-len(T)):
    count=0
    kari=S[i:i+len(T)]
    for j in range(len(T)):
        if kari[j]!=T[j]:
            count+=1
    cnt.append(count)
print(min(cnt))
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
うんし
Problem p02831 (python)

Fixed submission:
from fractions import gcd
x,y=map(int,input().split())
print((x * y) // gcd(x, y))

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())

print(math.ceil(A*B / math.gcd(A,B)))
Problem p02832 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
count = 0
k=0
t=0

while t<len(A):
    if A[t] == k+1:
            k += 1
            t += 1
    else:
            count += 1
            t += 1
if count == N:
    print(-1)
else:
    print(count)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
count = 0
k=0
t=0

while k<len(A):
    if A[t] == k+1:
            k += 1
            t += 1
    else:
            count += 1
            t =+ 1
if count == N:
    print(-1)
else:
    print(count)
Problem p02847 (python)

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

Buggy submission (verdict: Runtime Error):
S=int(input())
MON=6
TUE=5
WED=4
THU=3
FRI=2
SAT=1
SUN=0
print(7-S)
Problem p02879 (python)

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

if A < 10 and B < 10 :
    print(A*B)
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A < 10 and B < 10 :
    print(A*B)
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
if A < 10 and B < 10 :
    print(A*B)
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
if A <= 10 and if B <= 10 :
  print(A*B)
else :
  print(-1)

Buggy submission (verdict: Runtime Error):
if A <= 10 and B <= 10 :
    print(A*B)
else :
    print(-1)
Problem p02880 (python)

Fixed submission:
N = int(input())
number = []
for a in range(1,10):
    for b in range(1,10):
        number.append(b*a)
if N in number :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for a in range(1,10):
        for b in range(1,10):
            number.append(b*a)
if N in number :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for A in range(1,10):
        for B in range(1,10):
            number.append(A*B)
if N in number :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for A in range(1,10):
        for B in range(1,10):
            number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for A in range(1,10):
      for B in range(1,10):
        number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for A in range(1,10):
    for B in range(1,10):
      number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    for A in range(1,10)
    for B in range(1,10)
    number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = []
    A in range(1,10)
    B in range(1,10)
    number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for A in range(1,9) :
  if N / A < 10 and N % A == 0 :
    print("Yes")
    
    else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for A in range(1,10) :
  if N / A < 10 and N % A == 0 :
    print("Yes")
    
  else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for A in range(9) :
  if N / A < 10 and N % A == 0 
    print("Yes")
    
  else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for B in range(9) :
  for A in N :
  if A / B < 10 and A % B =0 :
    print("Yes")
    
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
number = [1,2,3,4,5,6,7,8,9]
for B in number :
  for A in N :
  if A / 9 < 10 and A % B :
    print("Yes")
    
else :
  print("No")
Problem p02881 (python)

Fixed submission:
import math
n=int(input())
kouho = []
ans = []
for i in range(1,math.ceil(math.sqrt(n)+1)):
    if n % i == 0 :
        kouho.append([i,n//i])
for j in range(len(kouho)):
    ans.append(kouho[j][0]+kouho[j][1]-2)
print(min(ans))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
kouho = []
ans = []
for i in range(1,math.floor(math.sqrt(n))):
    if n % i == 0 :
        kouho.append([i,n//i])
for j in range(len(kouho)):
    ans.append(kouho[j][0]+kouho[j][1]-2)
print(min(ans))
Problem p02897 (python)

Fixed submission:
N = int(input())
print((N-(N//2))/N)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt =　0
for i in range(n):
  if (i+1)%2　==　1:
    cnt +=　1
print(cnt/n)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt =　0
for i in range(1,n+1):
  if i%2　==　1:
    cnt +=　1
print(cnt/n)
Problem p03135 (python)

Fixed submission:
T,X=map(int,input().split())
print(T/X)

Buggy submission (verdict: Runtime Error):
T,X=int(input())
print(T/X)
Problem p03250 (python)

Fixed submission:
A,B,C=map(int,input().split())
ichi=10*A+B+C
two=A+10*B+C
three=C*10+A+B
print(max(ichi,two,three))

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
ichi=eval(AB+C)
two=eval(A+BC)
print(max(ichi,two))
Problem p02790 (python)

Fixed submission:
a, b = input().split()
s = a * int(b)
t = b * int(a)
print(s if s < t else t)

Buggy submission (verdict: Runtime Error):
a, b = input().split()
s = a * int(b)
t = b * int(a)
print(s if s < t else t)* int(b)
t = b * int(a)
print(s if s < t else t)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))
Problem p03104 (python)

Fixed submission:
a, b = map(int, input().split())
A = str(bin(a))[2:]
B = str(bin(b))[2:]
if A[-1] == '0':
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        if a <= 1:
            c = '0'
        else:
            c = A[:-1]
        mae = str(bin(int(c, 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 1:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
else:
    if (b-a+1)%2 == 0:
        if a <= 1:
            c = '0'
        else:
            c = A[:-1]
        if b <= 1:
            d = '0'
        else:
            d = B[:-1]

        mae = str(bin(int(c, 2)^int(d, 2)))[2:]
    else:
        mae = A[:-1]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = str(bin(a))[2:]
B = str(bin(b))[2:]
if A[-1] == '0':
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = str(bin(int(A[:-1], 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 1:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
else:
    if (b-a+1)%2 == 0:
        mae = str(bin(int(A[:-1], 2)^int(B[:-1], 2)))[2:]
    else:
        mae = A[:-1]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = str(bin(a))[2:]
if A[-1] == '0':
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = str(bin(int(A[:-1], 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
else:
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = A[:-1]
    if (b-a+1)%4 == 2 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = str(bin(a))[2:]
if A[-1] == '0':
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = str(bin(int(A[:-1], 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 1:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
else:
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = A[:-1]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = str(bin(a))[2:]
if A[-1] == '0':
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = str(bin(int(A[:-1], 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 1:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
else:
    if (b-a+1)%2 == 0:
        mae = '0'
    else:
        mae = str(bin(int(A[:-1], 2)+int((b-a)/2)))[2:]
    if (b-a+1)%4 == 0 or (b-a+1)%4 == 3:
        print(int(mae+'0', 2))
    else:
        print(int(mae+'1', 2))
Problem p03207 (python)

Fixed submission:
N = int(input())
p = [int(input()) for x in range(N)]
print(int(sum(p)-max(p)/2))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        int p;
        cin >>p;
        a[i] = p;
    }
    int sum = 0;
    int yasui = 100000;
    for(int i = 0; i < n; ++i){
        sum += a[i];
        if(yasui > a[i]) yasui = a[i];
    }
    cout << sum - yasui/2 << endl;
}