Problem p02754 (python)

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

count = N//(A+B)
if (N-count*(A+B))>A:
    print(count*A+A)
else:
    print(count*A+(N-count*(A+B)))

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

list_ab = []
list_b = ['b']*A
list_ab.extend(list_b)
list_a = ['a']*B
list_ab.extend(list_a)


count = (N//(A+B)+1)
str = list_ab*count


str = str[:N]
if str.count('b') != 0:
    print(str.count('b'))
else:
    print('0')

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

list_ab = []
list_b = ['b']*A
list_ab.extend(list_b)
list_a = ['a']*B
list_ab.extend(list_a)


count = (N//(A+B)+1)
str = list_ab*count


str = str[:N]
print(str.count('b'))

Buggy submission (verdict: Runtime Error):

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

if A==0 and B==0:
    print('0')

else:

    list_ab = []
    list_b = ['b']*A
    list_ab+=(list_b)
    list_a = ['a']*B
    list_ab+=list_a

    count = (N//(A+B))+1
    str = list_ab*count

    str = str[:N]
    print(str)
    print(str.count('b'))

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
if A==0 and B==0:
    print('0')

else:
    
    list_ab = []
    list_b = ['b']*A
    list_ab+=(list_b)
    list_a = ['a']*B
    list_ab+=list_a

    count = (N//(A+B))+1
    str = list_ab*count

    str = str[:N]
    print(str.count('b'))

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
if A==0 and B==0:
    print('0')

else:
    from math import floor
    list_ab = []
    list_b = ['b']*A
    list_ab+=(list_b)
    list_a = ['a']*B
    list_ab+=list_a

    count = (floor(N/(A+B))+1)
    str = list_ab*count




    str = str[:N]
    print(str.count('b'))

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
from math import floor
list_ab = []
list_b = ['b']*A
list_ab+=(list_b)
list_a = ['a']*B
list_ab+=list_a

count = (floor(N/(A+B))+1)
str = list_ab*count




str = str[:N]
print(str.count('b'))

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
from math import floor
list_ab = []
list_b = ['b']*A
list_ab.append(list_b)
list_a = ['a']*B
list_ab.append(list_a)

count = (floor(N/(A+B))+1)
str.append(list_ab*count)


import itertools
str = list(itertools.chain.from_iterable(str))
str = list(itertools.chain.from_iterable(str))

str = str[:N]
print(str.count('b'))

Buggy submission (verdict: Runtime Error):

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

list_ab = []
list_b = ['b']*A
list_ab.append(list_b)
list_a = ['a']*B
list_ab.append(list_a)

str.append(list_ab*(N//(A+B)+1))


import itertools
str = list(itertools.chain.from_iterable(str))
str = list(itertools.chain.from_iterable(str))

str = str[:N]
print(str.count('b'))

Buggy submission (verdict: Runtime Error):

N, A,B = map(int, input().split())
str = []
for j in range(N//(A+B)+1):
    list_b = ['b']*A
    str.append(list_b)
    list_a = ['a']*B
    str.append(list_a)

    if len(str)>N:
        break


import itertools
str = list(itertools.chain.from_iterable(str))

count = 0
for k in range(N):
    if str[k] == 'b':
        count+=1
print(count)