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

Fixed submission:
import heapq
n,m = map(int,input().split())
a=  list(map(int,input().split()))
h = list(map(lambda x:-1*x,a))
heapq.heapify(h)
for i in range(m):
    heapq.heapreplace(h,-(-h[0]//2))
print(-1*sum(h))

Buggy submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
a=  list(map(int,input().split()))
h = list(map(lambda x:-1*x,a))
heapq.heapify(h)
for i in range(m):
    heapq.heapreplace(h,-(-h[0]//2))
    print(h)
Problem p02959 (python)

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

cnt = 0
res = 0 #余力
for i in range(n):

    ch = min(a[i],res)
    cnt += ch
    a[i] -= ch
    if b[i] > a[i]:
        cnt += a[i]
        res = b[i] - a[i]
    else:
        cnt += b[i]
        res = 0

cnt += min(a[n],res)

print(cnt)

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

    cnt = 0
    res = 0 #余力
    for i in range(n):

        ch = min(a[i],res)
        cnt += ch
        a[i] -= ch
        if b[i] > a[i]:
            cnt += a[i]
            res = b[i] - a[i]
        else:
            cnt += b[i]
            res = 0
    
    cnt += min(a[n],res)

    print(cnt)

Buggy submission (verdict: Runtime Error):
def check(al,bl,cnt,i,j):

    if(i==len(al) or j==len(bl)):
        return cnt

    elif(j>i):
        c = check(al,bl,cnt,i+1,j)
        
    elif(al[i] > bl[j]) :
        al[i] = al[i]-bl[j]
        cnt += bl[j]
        c = check(al,bl,cnt,i,j+1)
    elif(al[i] < bl[j]):
        bl[j] = bl[j] - al[i]
        cnt += al[i]
        c= check(al,bl,cnt,i+1,j)
    elif(al[i] == bl[j]):
        cnt += al[i]
        c = check(al,bl,cnt,i+1,j+1)

    return c

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

cnt = 0

print(check(a,b,cnt,0,0))

Buggy submission (verdict: Runtime Error):
def check(al,bl,cnt,i,j):


    if(i==-1 or j==-1):
        return cnt

    elif(j >i):
        c = check(al,bl,cnt,i,j-1)
        
    elif(al[i] > bl[j]) :
        al[i] = al[i]-bl[j]
        cnt += bl[j]
        c = check(al,bl,cnt,i,j-1)
    elif(al[i] < bl[j]):
        bl[j] = bl[j] - al[i]
        cnt += al[i]
        c= check(al,bl,cnt,i-1,j)
    elif(al[i] == bl[j]):
        cnt += al[i]
        c = check(al,bl,cnt,i-1,j-1)

    return c

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

cnt = 0

print(check(a,b,cnt,len(a)-1,len(b)-1))
Problem p02987 (python)

Fixed submission:
import collections

x = input()
TF =  x.isupper() and x.isalpha()
flg  = 0
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    if(list == [2,2]):
        print("Yes")
        flg = 1
if(flg == 0):
    print("No")

Buggy submission (verdict: Runtime Error):
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
flg  = 0
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print("Yes")
        flg = 1

if(flg == 0):
    print("No")

Buggy submission (verdict: Runtime Error):
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print("Yes")

elif(TF==False):
    print("No")

Buggy submission (verdict: Runtime Error):
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print("Yes")
        
print("No")

Buggy submission (verdict: Runtime Error):
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print("Yes")
    else:
        print("No")
print("No")

Buggy submission (verdict: Runtime Error):
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print(True)
    else:
        print(False)
print(False)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=set([int(input()) for i in range(m)])
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in a:dp[i]=0
print(dp[n])

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

dp = [0]*(n+1)
dp[0] = 1

for i in range(1,n+1):
    dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
    if i in a : dp[i]=0
print(dp[n])
Problem p03107 (python)

Fixed submission:
from collections import deque
 
s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
  if(len(d)>=1 and d[-1]!=crr):
    d.pop()
  else:
    d.append(crr)
print(len(s)-len(d))

Buggy submission (verdict: Runtime Error):
from collections import deque

s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
    if(len(d)>=1 and d[-1]!=crr):
      d.pop()
      else:
        d.append(crr)
print(len(s)-len(d))
Problem p02990 (python)

Fixed submission:
import math

n, k = map(int, input().split())

p = 1000000007

b = k
r = n - k


def P(n, r):
    return (math.factorial(n) // math.factorial(n - r))


def C(n, r):
    return (P(n, r) // math.factorial(r))


for i in range(k):
    t = i + 1
    if (b - 1) < (t - 1):
        print("0")
    elif (r + 1) < t:
        print("0")
    else:
        x = C(b - 1, t - 1)
        y = C(r + 1, t)
        print((x * y) % p)

Buggy submission (verdict: Runtime Error):
import math

p = 1000000007

n, k = map(int, input().split())

b = k
r = n - k

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

for i in range(k):
    t = i + 1
    x = C(b - 1, t - 1)
    y = C(r + 1, t)
    print((x * y) % p)
Problem p03013 (python)

Fixed submission:
import collections as c
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
N,M = ip()
a = set()
for i in range(M):
    a.add(int(input()))
dp = [0]*(N+1)
dp[0] = 1
if 1 in a:
    pass
else:
    dp[1] = dp[0]
if N>1:
    for i in range(2,N+1):
        if i in a:
            continue
        dp[i] += dp[i-2] + dp[i-1]
        dp[i] = int(dp[i] % mod)
print(dp[N])

Buggy submission (verdict: Runtime Error):
import collections as c
from math import gcd
ip = lambda : map(int, input().split())
# ##############
mod = 1e9+7
N,M = ip()
a = set()
for i in range(M):
    a.add(int(input()))
dp = [0]*(N+1)
dp[0] = 1
if 1 in a:
    pass
else:
    dp[1] = dp[0]
if N>1:
    for i in range(2,N+1):
        if i in a:
            continue
        dp[i] += dp[i-2] + dp[i-1]
        dp[i] = int(dp[i] % mod)
print(dp[N])
Problem p03221 (python)

Fixed submission:
def main():
    n, m = map(int, input().split())
    lines = [input() for j in range(m)]
 
    cities = {}
    for i in range(m):
        p, y = map(int, lines[i].split())
        if p in cities:
            cities[p].append((i, y))
        else:
            cities[p] = [(i, y)]
 
    outputs = [None] * m
    for pref, city_list in cities.items():
        city_list.sort(key=lambda x: x[1])
        #print(pref, city_list)
        city_no = 1
        for city in city_list:
            outputs[city[0]] = "{:06d}{:06d}".format(pref, city_no)
            city_no += 1
 
    for output in outputs:
        print(output)
    return
 
 
main()

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

N,M=map(int, input().split())
lis={}
ly=[]
for i in range(M):
    t1,t2 =list(map(int,input().split()))
    lis[t2]=t1
    ly.append(t2)
d={}
for i in sorted(lis):
    d[lis[i]]=d.get(lis[i],0)+1
    ly[ly.index(i)]=[lis[i],d[lis[i]]



for i in ly:print('{:0=6}{:0=6}'.format(i[0],i[1]))
Problem p03253 (python)

Fixed submission:
def cmb(n,r):
    r=min(r,n-r)
    result=1
    for i in range(n-r+1,n+1):
        result*=i
    for i in range(1,r+1):
        result//=i
    return result

def factorize(n):
    i=2
    result={}
    while True:
        if i**2>n:
            break
        count=0
        while n%i==0:
            n//=i
            count+= 1
        if count!=0:
            result[i]=count
        i+=1
    if n>1:
        result[n]=1
    return result


N,M = map(int,input().split())
l = factorize(M)

r = 1
for i,j in l.items():
    r *= cmb(j+N-1,j)%(10**9+7)
    r %= (10**9+7)
print(r)

Buggy submission (verdict: Runtime Error):
N, M=map(int,input().split())
dic={}
def f(num):
    if not num in dic:
        lis=[]
        for i in range(1,int(num**0.5)+1):
            if num%i==0:
                lis.append(i)
                if i**2!=num:
                    lis.append(num//i)
        lis.sort()
        dic[num]=lis
    return dic[num]

res=0
def c(m,n):
    if n>0:
        for i in f(m):
            j=m//i
            c(j,n-1)
    else:
        global res
        res+=len(f(m))

c(M,n=N-2)
print(res)

Buggy submission (verdict: Runtime Error):
N, M=map(int,input().split())
def f(num):
    lis=[]
    for i in range(1,int(num**0.5)+1):
        if num%i==0:
            lis.append(i)
            if i**2!=num:
                lis.append(num//i)
    lis.sort()
    return lis

res=0
def c(m,n):
    if n>0:
        print(n,m,f(m))
        for i in f(m):
            j=m//i
            c(j,n-1)
    else:
        global res
        res+=len(f(m))

c(M,n=N-2)
print(res)
Problem p02595 (python)

Fixed submission:
from math import sqrt
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if sqrt(x**2 + y**2) <= d:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if sqrt(x**2 + y**2) <= d:
        ans += 1
print(ans)
Problem p02693 (python)

Fixed submission:
import math as M
k = int(input())
a, b = map(int, input().split())

a_1 = M.floor(a/k)
b_1 = M.floor(b/k)

if a%k == 0 or b%k == 0:
    print('OK')
elif b_1 - a_1 < 1:
    print('NG')

else :
    print('OK')

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

a_1 = A[0] / s
b_1 = A[1] / s

if b_1 - a_1 > 1 :
    print('OK')
else :
    print('NG')

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

a_1 = a / s
b_1 = b / s

if b_1 - a_1 > 1 :
    print('OK')
else :
    print('NG')

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

a_1 = a / s
b_1 = b / s

if b_1 - a_1 > 1 :
    print('OK')
else :
    print('NG')
Problem p03045 (python)

Fixed submission:
class UnionFind:
    def __init__(self,n):
        self.parent=[i for i in range(n)]
        self.rank=[0 for _ in range(n)]

    def find(self,x):
        if self.parent[x]==x:
            return x
        else:
            rootx=self.find(self.parent[x])
            self.parent[x]=rootx
            return rootx

    def union(self,x,y):
        rootx=self.find(x)
        rooty=self.find(y)
        if self.rank[rootx]<self.rank[rooty]:
            self.parent[rootx]=rooty
        else:
            self.parent[rooty]=rootx
            if self.rank[rootx]==self.rank[rooty]:
                self.rank[rootx]+=1

n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(m)]
uf=UnionFind(n)
for x,y,z in xyz:
    x,y=x-1,y-1
    uf.union(x,y)

# print(uf.parent)
for i in range(n):
    uf.find(i)
print(len(set(uf.parent)))

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self,n):
        self.parent=[i for i in range(n)]
        self.rank=[0 for _ in range(n)]

    def find(self,x):
        if self.parent[x]==x:
            return x
        else:
            rootx=self.find(self.parent[x])
            self.parent[x]=rootx
            return rootx

    def union(self,x,y):
        rootx=self.find(x)
        rooty=self.find(y)
        if self.rank[rootx]<self.rank[rooty]:
            self.parent[rootx]=rooty
        else:
            self.parent[rooty]=rootx
            if self.rank[rootx]==self.rank[rooty]:
                self.rank[rootx]+=1

n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(m)]
uf=UnionFind(n)
for x,y,z in xyz:
    x,y=x-1,y-1
    uf.union(x,y)

# print(uf.parent)
for i in range(n):
    uf.find(n)
print(len(set(uf.parent)))
Problem p03209 (python)

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

thickness=[1]
for i in range(1,n):
    thickness.append(2*thickness[i-1]+3)
patty=[1]
for i in range(1,n):
    patty.append(2*patty[i-1]+1)


def pattyCnt(n,x):
    if n==0:
        return 0 if x<=0 else 1
    elif x<=1+thickness[n-1]:
        return pattyCnt(n-1,x-1)
    else:
        return patty[n-1]+1+pattyCnt(n-1,x-2-thickness[n-1])

print(pattyCnt(n,x))

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

def makeBurger(n):
    if n==1:
        return [1,3,1]
    else:
        burger=makeBurger(n-1)
        newBurger=[*burger,1,*burger]
        newBurger[0]+=1
        newBurger[-1]+=1
        # print(newBurger)
        return newBurger

burger=makeBurger(n)
size=0
index=0
cnt=0
while size<=x:
    layerSize=burger[index]
    if index%2:
        if size+layerSize>x:
            cnt+=x-size
            break
        else:
            cnt+=layerSize
    size+=layerSize
    index+=1
print(cnt)

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

def makeBurger(n):
    if n==1:
        return [1,3,1]
    else:
        burger=makeBurger(n-1)
        newBurger=[*burger,1,*burger]
        newBurger[0]+=1
        newBurger[-1]+=1
        print(newBurger)
        return newBurger

burger=makeBurger(n)
size=0
index=0
cnt=0
while size<=x:
    layerSize=burger[index]
    if index%2:
        if size+layerSize>x:
            cnt+=x-size
            break
        else:
            cnt+=layerSize
    size+=layerSize
    index+=1
print(cnt)

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

def makeBurger(n):
    if n==1:
        return 'bpppb'
    else:
        burger=makeBurger(n-1)
        print(n)
        return 'b'+burger+'p'+burger+'b'

burger=makeBurger(n)
cnt=0
for i in range(x):
    if burger[i]=='p':
        cnt+=1
print(cnt)
Problem p03253 (python)

Fixed submission:
# うまく効率化できなかった
# 2 6=>4 (1,6)*2,(2,3)*2
# 3 12=>18 (1,1,12)*3,(1,2,6)*6,(1,3,4)*6,(2,2,3)*3
# import math
# def comb(a,b):
#     return math.factorial(a)//math.factorial(a-b)//math.factorial(b)
def comb(a,b): # aCb
    b=min(b,a-b)
    result=1
    for i in range(a,a-b,-1):
        result*=i
    for i in range(1,b+1):
        result//=i
    return result

n,m=map(int,input().split())
divisor={}
tmp=m
# for i in range(2,m+1):
#     while tmp%i==0:
#         tmp//=i
#         divisor.setdefault(i,0)
#         divisor[i]+=1
#         if tmp==1:
#             break
i=2
while i*i<=m:
    while tmp%i==0:
        tmp//=i
        divisor.setdefault(i,0)
        divisor[i]+=1
    i+=1
if tmp>1:
    divisor[tmp]=1
# print(divisor)
cnt=1
for key in divisor:
    c=divisor[key]
    cnt*=comb(c+n-1,c)
print(cnt%1000000007)

Buggy submission (verdict: Runtime Error):
# 2 6=>4 (1,6)*2,(2,3)*2
# 3 12=>18 (1,1,12)*3,(1,2,6)*6,(1,3,4)*6,(2,2,3)*3
import math
def comb(a,b): # aCb
    return math.factorial(a)//math.factorial(a-b)//math.factorial(b)

n,m=map(int,input().split())
rootm=int(m**0.5)
divisor={}
tmp=m
for i in range(2,m+1):
    while tmp%i==0:
        tmp//=i
        divisor.setdefault(i,0)
        divisor[i]+=1
    if tmp==1:
        break
print(divisor)
cnt=1
for key in divisor:
    tmp=0
    for c in range(1,divisor[key]+1):
        tmp+=comb(n,c)
    cnt*=tmp
print(cnt%1000000007)

Buggy submission (verdict: Runtime Error):
# 2 6=>4 (1,6)*2,(2,3)*2
# 3 12=>18 (1,1,12)*3,(1,2,6)*6,(1,3,4)*6,(2,2,3)*3
import math
def comb(a,b): # aCb
    return math.factorial(a)//math.factorial(a-b)//math.factorial(b)

n,m=map(int,input().split())
rootm=int(m**0.5)
divisor={}
tmp=m
for i in range(2,m+1):
    while tmp%i==0:
        tmp//=i
        divisor.setdefault(i,0)
        divisor[i]+=1
    if tmp==1:
        break
print(divisor)
cnt=1
for key in divisor:
    tmp=0
    for c in range(1,divisor[key]+1):
        tmp+=comb(n,c)
    cnt*=tmp
print(cnt%1000000007)
Problem p02580 (python)

Fixed submission:
h, w, m = map(int, input().split())
s = dict()
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[(hi, wi)] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

if len(max_h_list) * len(max_w_list) > m:
    print(max_h_val + max_w_val)
    exit()
for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s.get((max_hi, max_wi), False) == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)

Buggy submission (verdict: Runtime Error):
h, w, m = map(int, input().split())
s = [[False] * w for _ in range(h)]
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[hi][wi] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s[max_hi][max_wi] == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)
Problem p02580 (python)

Fixed submission:
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)


H, W, M = map(int, input().split())

num_bombs_each_row = [0] * H
num_bombs_each_col = [0] * W
bombs = set()

for _ in range(M):
    h, w = map(int, input().split())
    # 0-index
    h -= 1
    w -= 1

    bombs.add((h, w))
    num_bombs_each_row[h] += 1
    num_bombs_each_col[w] += 1

max_bombs_in_row = max(num_bombs_each_row)
max_bombs_in_col = max(num_bombs_each_col)

rows_with_max_bombs = []
for row in range(H):
    if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row)

cols_with_max_bombs = []
for col in range(W):
    if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col)

found = False
for row in rows_with_max_bombs:
    for col in cols_with_max_bombs:
        if not (row, col) in bombs:
            found = True
            break

ans = max_bombs_in_row + max_bombs_in_col
if found:
    print(ans)
else:
    print(ans - 1)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)


H, W, M = map(int, input().split())

num_bombs_each_row = [0] * H
num_bombs_each_col = [0] * W
bombs = set()

for _ in range(M):
    h, w = map(int, input().split())
    # 0-index
    h -= 1
    w -= 1

    bombs.add((h, w))
    num_bombs_each_row[h] += 1
    num_bombs_each_col[w] += 1

max_bombs_in_row = max(num_bombs_each_row)
max_bombs_in_col = max(num_bombs_each_col)

rows_with_max_bombs = []
for row in range(H):
    if num_bombs_each_row[row] == max_bombs_in_row:
        rows_with_max_bombs.append(row)

cols_with_max_bombs = []
for col in range(H):
    if num_bombs_each_col[col] == max_bombs_in_col:
        cols_with_max_bombs.append(col)

found = False
for row in rows_with_max_bombs:
    for col in cols_with_max_bombs:
        if not (row, col) in bombs:
            found = True
            break

ans = max_bombs_in_row + max_bombs_in_col
if found:
    print(ans)
else:
    print(ans - 1)
Problem p02753 (python)

Fixed submission:
#!/usr/bin/env python3

S = str(input())

if (S[0] == S[1] and S[1]== S[2]):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

S = int(input())

if (S[0] == S[1] and S[1]== S[2]):
    print("No")
else:
    print("Yes")
Problem p02754 (python)

Fixed submission:
#!/usr/bin/env python3

N, A, B = map(int, input().split())

if A == 0:
    print(0)
elif B == 0:
    print(N)
elif A + B == N:
    print(A)
elif A + B > N and N >= A:
    print(A)
elif A + B > N and N < A:
    print(N)
# 8 10 4
# bbbbbbbb bbrrrr
else:
    r = int(N / (A+B))
    q = N % (A+B)
    if (q <= A):
        print(r * A + q)
    else:
        print(r * A + A)

# 8 1 4
# brrrrbrr rr

# -----
# 8 4 2
# bbbbrrbb bb

# 13 4 2
# bbbb rr bbbb rr b

# 2 4 2
# bb

# r = N / (A+B)
# q = N % (A+B)
# r * A + q

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

N, A, B = map(int, input().split())

if A == 0:
    print(0)
elif B == 0:
    print(N)
elif A + B == N or A + B > N and N >= A:
    print(A)
else A + B > N and N < A:
    print(N)
else:
    r = int(N / (A+B))
    q = N % (A+B)
    print(r * A + q)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

N, A, B = map(int, input().split())

if A == 0:
    print(0)
elif B == 0:
    print(N)
elif A + B = N or A + B > N and N >= A:
    print(A)
else A + B > N and N < A:
    print(N)
else:
    r = int(N / (A+B))
    q = N % (A+B)
    print(r * A + q)

# -----
# 8 4 2
# bbbbrrbb bb

# 13 4 2
# bbbb rr bbbb rr b

# 2 4 2
# bb

# r = N / (A+B)
# q = N % (A+B)
# r * A + q