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

Fixed submission:
from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
c = S()
# 最終的に RR...RWW...WWW という状態になる
# R の個数を r とすると、左から r 個の石のうち R はそのままで W だけ入れ替えたら良い
r = Counter(list(c))['R']
ans = 0
for elem in c[:r]:
    if elem == 'W':
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


def rle(s):
    t = s[0]
    cnt = 1
    res = []
    for i in range(1, len(s)):
        if t == s[i]:
            cnt += 1
        else:
            res.append([t, cnt])
            t = s[i]
            cnt = 1
    res.append([t, cnt])
    return res


INF = float('inf')


n = I()
c = S()
if len(set(list(c))) < 2:
    print(0)
    exit()

# R と W のまとまり
rw = rle(c)
# print(rw)
ans = 0
for i, elem in enumerate(rw):
    if i < n - 1 and elem[0] == 'W' and rw[i+1][0] == 'R':
        ans += min(elem[1], rw[i+1][1])
print(ans)
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input())//2 + 1) if int(input()) % 2 else print(int(input())//2)

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

Fixed submission:
a, b = int(input()), int(input())
ans = 1 if 1 not in (a, b) else 2 if 2 not in (a, b) else 3
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
ans = 1 if 1 not in (a, b) else 2 if not in (a, b) else 3
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 1 if 1 not in (a, b) else 2 if not in (a, b) else 3
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 1 if 1 not in (a, b) else 2 not in (a, b) else 3
print(ans)
Problem p02847 (python)

Fixed submission:
day = input()
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
print(7 - days.index(day) if day != 'SAT' else 1)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
ans =0
left = 0
right = 10**9+1

def dN(n):
  return len(str(n))

def cal_price(a, b, n):
  return a*n + b*dN(n)

while right - left > 1:
  mid = (left + right)//2
  if a*mid + b*dN(mid) > x: right = mid
  else: left = mid
    
print(left)
Problem p02873 (python)

Fixed submission:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
n = len(s)
ans = 0
cnt = 0
before_cnt = 0
now = s[0]
for x in s:
    if now == x:  # 同じ不等号が連続しているとき
        cnt += 1
    else:  # 不等号が変わるとき
        ans += cnt * (cnt + 1) // 2
        if now == '>':  # > から < に変わるとき
            if before_cnt < cnt:
                ans -= before_cnt
            else:
                ans -= cnt

        before_cnt = cnt
        cnt = 1
        now = x

ans += cnt * (cnt + 1) // 2
if now == '>':
    if before_cnt < cnt:
        ans -= before_cnt
    else:
        ans -= cnt
print(ans)

Buggy submission (verdict: Runtime Error):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


s = S()
n = len(s)
a = [0] * (n + 1)
for i in range(len(s)):
    if '<' == s[i]:
        a[i + 1] = a[i] + 1
for i in reversed(range(len(s))):
    if '>' == s[i]:
        a[i] = max(a[i], a[i + 1] + 1)
    print(a)
print(sum(a))
Problem p02880 (python)

Fixed submission:
n = int(input())
ans = 'No'
for i in range(1, 10):
  if n % i == 0 and 1 <= n // i <= 9:
      ans = 'Yes'
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
flag = False
a, b = 0
for i in range(2, 9):
    if(n % i): continue
    else: flag = True
if(flag and (n/i <= 9)): print('Yes')
else: print('No')
Problem p02916 (python)

Fixed submission:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()
a = list(map(lambda x: x - 1, a))
b = LI()
c = LI()

ans = 0
for i in range(n):
    ans += b[a[i]]
    if i > 0 and a[i - 1] + 1 == a[i]:
        ans += c[a[i - 1]]
print(ans)

Buggy submission (verdict: Runtime Error):
2
1 2
50 50
50
Problem p03107 (python)

Fixed submission:
s = list(input())
n = len(s)
cntd = {'0':0, '1':0}

for i in range(n):
    cntd[s[i]] += 1
ans = 0
ans = 2 * min(cntd.values())
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
s = list(sys.stdin.readline())
n = len(s)
cntd = {'0':0, '1':0}
for i in range(n):
    cntd[s[i]] += 1
ans = 2 * min(cntd.values())
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
*s, = sys.stdin.readline()
n = len(s)
cntd = {'0':0, '1':0}

for i in range(n):
    cntd[s[i]] += 1

ans = 2 * min(cntd.values())
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
*s, = sys.stdin.readline()
n = len(s)
cntd = {'0':0, '1':0}
for i in range(n):
    cntd[s[i]] += 1
ans = 2 * min(cntd.values())
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
*s, = sys.stdin.readline()
n = len(s)
cntd = {'0':0, '1':0}
for i in range(n):
    cntd[s[i]] += 1
ans = 2 * min(cntd.values())
print(ans)
Problem p03127 (python)

Fixed submission:
import sys
import fractions
import functools
f = sys.stdin
n = int(f.readline())
a = list(map(int, f.readline().split()))
gcd = functools.reduce(fractions.gcd, a)
print(gcd)

Buggy submission (verdict: Runtime Error):
import sys
import math
f = sys.stdin
n = int(f.readline())
a = list(map(int, f.readline().split()))
a.sort()
gcd = math.gcd(a[0], a[1])
print(gcd)
Problem p03723 (python)

Fixed submission:
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


a, b, c = LI()
if a == b == c:
    if a % 2:
        print(0)
    else:
        print(-1)
else:
    ans = 0
    while True:
        if a % 2 or b % 2 or c % 2:
            break
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2
        ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


a, b, c = LI()
if a == b == c:
    print(-1)
else:
    ans = 0
    while True:
        if a % 2 or b % 2 or c % 2:
            break
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2
        ans += 1
print(ans)
Problem p03821 (python)

Fixed submission:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = []
b = []
for _ in range(n):
    ai, bi = LI()
    a.append(ai)
    b.append(bi)
p = 0
for ai, bi in zip(a[::-1], b[::-1]):
    ai += p
    if ai % bi == 0:
        continue
    elif bi > ai:
        p += bi - ai
    else:
        p += bi - (ai % bi)
print(p)

Buggy submission (verdict: Runtime Error):
import math
import sys
from typing import Reversible


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = []
b = []
for _ in range(n):
    ai, bi = LI()
    a.append(ai)
    b.append(bi)
p = 0
for ai, bi in zip(a[::-1], b[::-1]):
    ai += p
    if ai % bi == 0:
        continue
    elif bi > ai:
        p += bi - ai
    else:
        p += bi - (ai % bi)
print(p)
Problem p03307 (python)

Fixed submission:
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
n = float(input())
ans = n*2/gcd(n,2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ans = (n*2)//math.gcd(n,2)
print(ans)
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
    for l in range(k+1):
        if (s-i-l) >= 0 and (s-i-l) <= k:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
ans = 0
debug = []
for i in range(k+1):
    for l in range(k+1):
        if (s-i-l) >= 0 and (s-i-l) <= k:
            if i+l+(s-i-l) == s:
                ans += 1
                debug.append(str(i)+"+"+str(l)+"+"+str(s-i-l))
                print(debug)
print(ans)
Problem p03072 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
ans=1
for i in range(1,n):
  if max(h[:i])<=h[i]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input()))
ans=1
for i in range(1,n):
  if max(h[:i])<h[i]:
    ans+=1
print(ans)
Problem p03127 (python)

Fixed submission:
n=int(input())
def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y,x%y)
a=list(map(int,input().split()))
stack=a.pop()
for i in a:
  stack=gcd(i,stack)
print(stack)

Buggy submission (verdict: Runtime Error):
number=int(input())
hitpoint=list(map(int,input().split()))
xyz=[]
png=[]
m=min(hitpoint)
for i in range(len(hitpoint)):
    xyz.append(hitpoint[i]%2)
if hitpoint.count(hitpoint[0])==len(hitpoint):
    print(hitpoint[0])
elif hitpoint[len(hitpoint)]%m==0:
    for i in range(len(hitpoint)):
        png.append(hitpoint[i]%m)
    if png.count(0)==len(png):
        print(min(hitpoint))
    else:
        if hitpoint.count(1)!=0:
            print(1)
        elif xyz.count(0)!=len(xyz):
            print(1)
        elif xyz.count(1)==len(xyz):
            print(1)
        else:
            print(2)
elif hitpoint.count(1)!=0:
    print(1)
elif xyz.count(0)!=len(xyz):
    print(1)
elif xyz.count(1)==len(xyz):
    print(1)
else:
    print(2)

Buggy submission (verdict: Runtime Error):
number=int(input())
hitpoint=list(map(int,input().split()))
xyz=[]
png=[]
m=min(hitpoint)
for i in range(len(hitpoint)):
    xyz.append(hitpoint[i]%2)
if hitpoint.count(hitpoint[0])==len(hitpoint):
    print(hitpoint[0])
elif hitpoint[len(hitpoint)]%m==0:
    for i in range(len(hitpoint)):
        png.append(hitpoint[i]%m)
    if png.count(0)==len(png):
        print(min(hitpoint))
elif hitpoint.count(1)!=0:
    print(1)
elif xyz.count(0)!=len(xyz):
    print(1)
elif xyz.count(1)==len(xyz):
    print(1)
else:
    print(2)
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
line=list(map(int,input().split()))
if n >= m:
  print(0)
else:
  line.sort()
  stock=0
  distance=[]
  for i in line:
    distance.append(i-stock)
    stock=i
  distance.pop(0)
  distance.sort()
  ans=0
  for i in range(m-n):
    ans+= distance[i]
  print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
line=list(map(int,input().split()))
if n >= m:
  print(0)
line.sort()
stock=0
distance=[]
for i in line:
  distance.append(i-stock)
  stock=i
distance.pop(0)
for i in range(n-1):
  distance.pop(distance.index(max(distance)))
ans=0
for i in distance:
  ans+= i
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
line=list(map(int,input().split()))
if n >= m:
  print(0)
line.sort()
stock=0
distance=[]
for i in line:
  stock=i
  distance.append(i-stock)
distance.pop(0)
for i in range(n-1):
  distance.pop(distance.index(max(distance)))
ans=0
for i in distance:
  ans+= i
print(ans)
Problem p03221 (python)

Fixed submission:
import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1])))

Buggy submission (verdict: Runtime Error):
import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1]))

Buggy submission (verdict: Runtime Error):
import sys
import bisect
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0] for i in range(10**5+1)]
for i in l:
  s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:06}{:06}'.format(i[0],bisect.bisect_left(s[i[0]],i[1]))

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
s=[[0]*(10**5+1)]
for i in l:
  if s[i[0]].append(i[1])
for i in range(len(s)):
  s[i].sort()
for i in l:
  print('{:0>6}{:0>6}'.format(str(i[0]),str(s[i[0]].index(i[1]))))
Problem p03232 (python)

Fixed submission:
import math
n=int(input())
number=list(map(int,input().split()))
SUM=[]
sum=0
p=10**9 +7
x=math.factorial(n)%(10**9 +7)
for i in range(1,n+1):
  k=pow(i,p-2,p)
  sum+= (x*k)%p
  sum= sum%(p)
  SUM.append(sum)
ans=0
for i in range(n):
  ans+= number[i]*(SUM[n-1-i]+SUM[i]-x)
  ans=ans%(p)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
number=list(map(int,input().split()))
SUM=[]
sum=0
p=10**9 +7
#Nの階乗
x=math.factorial(N)%p
#0からにすると1/0でエラーになる
for i in range(1,N+1):
  #kは逆元
  k=pow(i,p-2,p)
  sum+= (x*k)%p
  sum= sum%p
  SUM.append(sum)
#SUMのi番目は1/1から1/iまで足した和になっている。
#k=i-1となる
#1/1を二回足してしまったので引く
for i in range(N):
  ans+= (number[i]*(SUM[i]+SUM[N-i-1]-x))%p
  ans= ans%p
#答え
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
number=list(map(int,input().split()))
SUM=[]
sum=0
p=10**9 +7
#Nの階乗
x=math.factorial(N)%p
#0からにすると1/0でエラーになる
for i in range(1,N+1):
  #kは逆元
  k=pow(i,p-2,p)
  sum+= (x*k)%p
  SUM.append(sum)
#SUMのi番目は1/1から1/iまで足した和になっている。
#k=i-1となる
#1/1を二回足してしまったので引く
for i in range(N):
  ans+= (number[i]*(SUM[i]+SUM[N-i]-x))%p
  ans= ans%p
#答え
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
number=list(map(int,input().split()))
SUM=[]
sum=0
for i in range(1,n+1):
  sum+= fraction(1,i)
  sum= sum%(10**9 +7)
  SUM.append(sum)
ans=0
x=math.factorial(n)%(10**9 +7)
for i in range(n):
  ans+= number[i]*(x*int(SUM[n-1-i]+SUM[i]-1))
  ans=ans%(10**9 +7)
print(ans)
Problem p03317 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
if a.index(1)<k-1:
  print((n-2)//(k-1) +1)
  exit()
else:
  print((n-2)//(k-1) +1)
  exit()
print((a.index(1)+k-2)//(k-1) + (n-a.index(1)-1+k-2)//(k-1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=(a.index(1)+k-2)//(k-1)
if (a.index(1))%(k-1)!=0:
  x+=1
  y=(n-a.index(1)-1+(a.index(1)+k-2)%(k-1))//(k-1)
else:
  y=(n-a.index(1)-1+k-2)//(k-1)
x2=(n-a.index(1)-1+k-2)//(k-1)
if (n-a.index(1)-1)%(k-1)!=0:
  x2+=1
  y2=(a.index(1)+(n-a.index(1)-1)%(k-1))//(k-1)
print(min(x+y,x2+y2))
Problem p03835 (python)

Fixed submission:
count=0
k,s=map(int,input().split())
for i in range(k+1):
  for j in range(k+1):
    if s-k<=i+j<=s:
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
count=0
k,s=map(int,input().split())
for i in range(s):
  for j in range(s-i):
    for m in range(s-i-j):
      if i<=k ans j<=k ans m<=k:
        count+=1
print(count)
Problem p02881 (python)

Fixed submission:
N = int(input())
min = 10000000000001
for i in range(1, 1000001):
    if N % i == 0:
        val = i + int(N / i) - 2
    if min > val:
        min = val

print(min)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
min = math.inf
for i in range(1, 1000000):
    if N % i == 0:
        val = i + int(N / i) - 2
    if min > val:
        min = val

print(min)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
sunukes = [list(map(int, input().split())) for i in range(k*2)]

names = list(range(1,n+1))
for i in range(0,k):
  j = i*2
  syoji = sunukes[j]
  okashi = sunukes[j+1]
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
sunukes = [list(map(int, input().split())) for i in range(k*2)]

names = list(range(1,n+1))
print(sunukes)
for i in range(0,k+2,2):
  syoji = sunukes[i]
  okashi = sunukes[i+1]
  print(syoji,okashi)
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))
Problem p02723 (python)

Fixed submission:
import sys
input=sys.stdin.readline
S = list(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
S = list(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")import sys
Problem p02729 (python)

Fixed submission:
import sys
input=sys.stdin.readline
N,M = map(int,input().split())
nCr = {}
def cmb(n, r):
    if n == 0:
        return 0
    if r == 0 or r == n:
         return 1
    if r == 1:
         return n
    if (n,r) in nCr:
         return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

a = cmb(N,2)
b = cmb(M,2)
print(a+b)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
N,M = map(int,input().split())
nCr = {}
def cmb(n, r):
    if r == 0 or r == n:
         return 1
    if r == 1:
         return n
    if (n,r) in nCr:
         return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

a = cmb(N,2)
b = cmb(M,2)
print(a+b)
Problem p02753 (python)

Fixed submission:
S = list(input())
if S[0]  == "A" and S[1]  == "A" and S[2]  == "A":
  print("No")
elif S[0]  == "B" and S[1]  == "B" and S[2]  == "B":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if A ==0 :
    print(0)
elif B==0:
    print(N)
else:
    m = N % (A+B)
    n = N // (A+B)
    ans = A * n
    if m > A:
        print(ans+A)
    else:
        print(ans+m)
Problem p02754 (python)

Fixed submission:
N,A,B = map(int,input().split())
if A ==0 :
    print(0)
elif B==0:
    print(N)
else:
    m = N % (A+B)
    n = N // (A+B)
    ans = A * n
    if m > A:
        print(ans+A)
    else:
        print(ans+m)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if A ==0 :
    print(0)
elif B==0:
    print(N)
else:
    m = N % (A+B)
    n = N // (A+B)
    ans = A * n
    if m > A:
        print(ans+A)n
    else:
        print(ans+m)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if A ==0 :
    print(0)
elif B==0:
    print(N)
else:
    n = N // (A+B)
    ans = A * n
    m = N % n
    if m > A:
        print(ans+A)
    else:
        print(ans+m)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
if A+B != 0:
    n = N // (A+B)
    ans = A * n
    m = N % n
    if m > A:
        print(ans+A)
    else:
        print(ans+m)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
n = N // (A+B)
ans = A * n
m = N % n
if m > A:
    print(ans+A)
else:
    print(ans+m)
Problem p02759 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
  print(int(N/2))

else:
  print(int((N+1)/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 = 0:
  a = N / 2
else:
  a = (N+1)/2
print(a)
Problem p02779 (python)

Fixed submission:
N = int(input())
c = 0
A = list(map(int,input().split()))
ans = {}
for i in range(N):
    a = A[i]
    if a not in ans:
        ans[a] = 1
    else:
        c = 1
        break
if c == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
max = 0
for i in range(N-K+1):
    s = 0
    for j in range(i,i+K):
        s += p[j]
    if s > max:
        max = s
print((max+K)/2)
Problem p02785 (python)

Fixed submission:
N,K= map(int,input().split())
H = list(map(int,input().split()))
H.sort()
s = 0
for i in range(N-K):
  s += H[i]
print(s)

Buggy submission (verdict: Runtime Error):
N,K= map(int,input().split())
H = list(map(int,input().split()))
H.sort()
s = 0
for i in range(K):
  s += H[i]
print(s+K)

Buggy submission (verdict: Runtime Error):
N,K= map(int,input().split())
H = list(map(int,input().split()))
H = sort(H)
s = 0
for i in range(N-K):
  s += H[i]
print(s+K)
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
if a<b:
  min = a
  max = b
else:
  min = b
  max = a
c =[min for i in range(max)]
d = map(str,c)
l = "".join(d)
print(l)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a<b:
  min = a
  max = b
else:
  min = b
  max = a
c =[min for i in range(max)]
l = "".join(c)
print(l)
Problem p02881 (python)

Fixed submission:
import sys
input=sys.stdin.buffer.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
N = int(input())
n = int(N**(0.5))
for i in range(n):
  c = n-i
  if N % c == 0:
    a = N/c
    break;
print(int(a+c-2))

Buggy submission (verdict: Runtime Error):
N = int(input())
n = int(n**(0.5))
for i in range(n):
  c = n-i
  if N % c == 0:
    a = N/c
print(a+c-2)