TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N , A , B = int(input().split())
a = N // ( A + B )
b = N % ( A + B )

if b >> A:
    print( a * A + A )
else:
    print( a * A + b ) 

N , A , B = map(int, input().split())
AB = A + B
a = N // AB
b = N % AB



if b > A:
    print( a * A + A )
else:
    print( a * A + b ) 

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
i = 0
AB = A+B
ans = 0
for x in range(N):
    if i < A:
        ans += 1
    if i == AB:
        i = 0
    i += 1

print(ans)

N, A, B = map(int, input().split())
ans = 0
amari = N % (A + B)
o = N // (A + B)
if amari > A:
    amari = A

print(amari + A * o)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = int(input().split(' '))
a = N % (A + B)
b = N // (A + B)

if a > A:
  print(B*b+a)
else:
  print(B*b)

N,A,B = list(map(int,input().split()))
a = N//(A+B)
b = N%(A+B)
if b >= A:
    b = A
print(a*A+b)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int,input().split())
a=N//(A+B)
if N%(A+B)==0:
    print(a*A)
elif N%(A+B)>=A:
    print(a*A+A))
elif N%(A+B)<A:
    print(a*A+(N%(A+B)))

n,a,b=map(int,input().split())
i=n%(a+b)
print(i)
if i>a:
    print(a*(n//(a+b))+a)
else:
    print(a*(n//(a+b))+i)

n,a,b=map(int,input().split())
i=n%(a+b)
if i>a:
    print(a*(n//(a+b))+a)
else:
    print(a*(n//(a+b))+i)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = list(map(int, input().split(' ')))
ab = ''

while len(ab) < n and len(ab) != 0:
    ab = ab + ('a' * a) + ('b' * b)

print(ab[:n].count('a'))


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

blue_ball = 0
if n / (a + b) > 1:
    answer = divmod(n, a + b)
    blue_ball = answer[0] * a
    n = answer[1]

if n > a:
    blue_ball += a
else:
    blue_ball += n

print(blue_ball)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
print(0)

N, a, b = map(int, input().split())
print(N)

import math
N, a, b = map(int, input().split())

all = a + b

# a = 0
if a == 0:
    print(0)
    exit(0)

if N <= a:
    print(N)
    exit(0)

# a > 0
c = math.floor(N / all)
d = N % all

roundCnt = a * c
amariCnt = 0

if d != 0:
    if d <= a :
        amariCnt = d
    else:
        amariCnt = a

print(roundCnt + amariCnt)


#a = 0 print 0
#a > 0
# N <= a print N
# N > a




#


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N = list(map(int, input().split()))
print((N[0]//(N[1]+N[2])*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))

N = list(map(int, input().split()))
print((N[0]//(N[1]+N[2]))*N[1] + min([N[0]%(N[1]+N[2]), N[1]]))


Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

ans = n // (a+b) * n
tmp = n % (a+b)
ans += min(a, tmp)

print(ans)

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

ans = n // (a+b) * a
tmp = n % (a+b)
ans += min(a, tmp)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,blue,red = input().split()
count = 0
while(1):
  if N > 0:
    N -= blue
    count += 1
  if N > 0:
    N -= red
  else:
    break
print(blue*count + N)

N,blue,red = map(int,input().split())
count = N // (blue + red)
amari = N % (blue + red)
if N%(blue+red) >= blue:
    print(blue*(count + 1))
else:
    print(blue * count + amari)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())
ans = n // (a + b)
x = n % (a + b)
ans += min(a, x)
print(ans)

n, a, b = map(int, input().split())
ans = n // (a + b) * a
x = n % (a + b)
ans += min(a, x)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import math
n,a,b = map(int,input().split())
r = math.ceil(n/(a+b))
retukaioh = ""
for i in range(r):
  retukaioh = retukaioh + "b"*a + "r"*b
print(retukaioh[0:n].count("b"))
print(retukaioh)

n,a,b = map(int,input().split())
rest = n%(a+b)
ans = n//(a+b)*a
print(ans+a if rest >=a else ans+rest)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
print(n if n<=a else a)

n,a,b=map(int,input().split())
if n<=a:
  print(n)
else:
  d=n//(a+b)
  z=n-(a+b)*d
  print(a*d+min(a,z))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
S = Input()
N,A,B = S.split(' ')
N = int(N)
A = int(A)
B = int(B)
ans = N //(A+B) * A
left = N % (A+B)
if left > A:
    ans += A
else:
    ans += left
print(ans)

S = input()
N,A,B = S.split(' ')
N = int(N)
A = int(A)
B = int(B)
print(int(N/(A+B))*A)

S = input()
N,A,B = S.split(' ')
N = int(N)
A = int(A)
B = int(B)
ans = N //(A+B) * A
left = N % (A+B)
if left > A:
    ans += A
else:
    ans += left
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n=input()
A=input()
B=input()
z=A+B
if n%z<=A:
    print(int(n/z)*A+n%z)
elif A<=n%z<=z:
    print(int(n/z)*A)

n,A,B=map(int,input().split())
z=A+B
if n%z<=A:
    print(int(n/z)*A+n%z)
elif A<=n%z<=z:
    print(int(n/z)*A+A)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n = list(map(int, input().split()))
s = b * n[1]
t = r * n[2]
u = 10**100
v = (s + t) * u
w = v.count("b", 0, n[0])
print(w)

N, A, B = map(int, input().split())
C = A + B
D = N // C
E = N % C
if N <= A:
    print(N)
elif N <= C:
    print(A)
else:
    if E <= A:
        print(A*D + E)
    else:
        print(A*D + A)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
C = A + B
x = N // C
y = N % C
p = x * A
q = min(y, A)
p + q

N, A, B = map(int, input().split())
C = A + B
x = N // C
y = N % C
p = x * A
q = min(y, A)
print(p + q)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
total,blue,red=map(int,input().split())
num = -(-total)//(blue+red)
if blue == 0:
    print(0)
else:
    if (total%(red+blue)) >= blue:
        print(num*blue+(total%(red+blue)))
    else:
        print(num*blue+blue)

total,blue,red=map(int,input().split())
num = -(-total)//(blue+red)
if blue == 0:
    print(0)
else:
    if (total%(red+blue)) <= blue:
        print(num*blue+(total%(red+blue)))
    else:
        print(num*blue+blue)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a = input().split(" ")
n = int(a[0])
b = int(a[1])
r = int(a[2])
c = a // (b + r)
bb = c * b
d = a % (b + r)
if d >= b:
	bb += b
else:
	bb += d 
print(bb)

a = input().split(" ")
n = int(a[0])
b = int(a[1])
r = int(a[2])
c = n // (b + r)
bb = c * b
d = n % (b + r)
if d >= b:
	bb += b
else:
	bb += d 
print(bb)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):

i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

answer = divmod(kazoeru, (i[1]+i[2]))

if ao == 0:
    print(0)
    exit()


aa = ao * answer[0]



if answer[1] >= kazoeru:
    aa += answer[1]

else:
    aa += ao

print(aa)


i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

answer = divmod(kazoeru, (i[1]+i[2]))

if ao == 0:
    print(0)
    exit()


aa = ao * answer[0]


if answer[1] == 0:
    print(aa)
    exit()

if answer[1] > kazoeru:
    aa += answer[1]

else:
    aa += ao
print(aa)


i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

answer = divmod(kazoeru, (i[1]+i[2]))

if ao == 0:
    print(0)
    exit()


aa = ao * answer[0]


if answer[1] == 0:
    print(aa)
    exit()


if answer[1] >= kazoeru:
    aa += kazoeru

else:
    aa += ao
print(aa)


i = list(map(int, input().split()))
kazoeru = i[0]
ao = i[1]
aka= i[2]
kaisuu = i[0]/(i[1]+i[2])

answer = divmod(kazoeru, (i[1]+i[2]))

if ao == 0:
    print(0)
    exit()


aa = ao * answer[0]


if answer[1] == 0:
    print(aa)
    exit()



if answer[1] >= ao:
    aa += ao

else:
    aa += answer[1]
print(aa)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = map(int,input().split())
if N//(A+B) >= 10**100:
    print(A*N//(A+B) + min(N%(A+B),A))
else :
    print(A * 10**100)

N,A,B = map(int,input().split())
print( N//(A+B)*A + min(N%(A+B), A))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
print(int(A * (N / (A + B))))

N, A, B = map(int, input().split())
i = int((N / (A + B)))
n = A * i
if N - (A + B) * i > A:
    n += A
else:
    n += N - (A + B) * i
print(n)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = [int(v) for v in input().strip().split(" ")]

items = []
while len(items) < N:
     items.append('b' * A)
     items.append('r' * B)

print(items.count("b"))

N, A, B = [int(v) for v in input().strip().split(" ")]

loop, m = divmod(N, A + B)
print(loop * A + (m if m < A else A))

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = map(int,input().split())
repete = N//(A+B)
sub = N%(A+B)
print(repete+sub)

N,A,B = map(int,input().split())
repete = N//(A+B)
sub = N%(A+B)
if sub <= A:
	print(A*repete+sub)
else:
	print(A*repete+A)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
#!/usr/bin/env python

n, a, b = [int(val) for val in input().split()]

print(n, a, b)

ro = a + b
s = int(n / ro)
r = n % ro
ra = min(r, a)
print(s * a + ra)


#!/usr/bin/env python

n, a, b = [int(val) for val in input().split()]

ro = a + b
s = int(n / ro)
r = n % ro
ra = min(r, a)
print(s * a + ra)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
nums=input().split(" ")
N,B,R=[int(nums[i]) for i in range(len(nums))]
if N>=B:
  print(B)
else:
  print(N)


nums=input().split(" ")
N,B,R= [int(nums[i]) for i in range(len(nums))]
sum=B+R

sets,amari=N//sum,N%sum
if amari>=B:
	x=B
else:
	x=amari

print(sets*B+x)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
ans=B+(S-B-A)
print(ans)

inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)
y=S//(B+R)
print(b*x+y)

inp=list(map(int,input().split()))
s=inp[0]
b=inp[1]
r=inp[2]
print(s//(b+r)*b+min(s%(b+r),b))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int, input().split())

shou = n // (a+b)
amari = n % (a+b)

ans = shou * a + a if amari >= a　else ans = shou*a+amari

print(ans)

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

shou = n // (a+b)
amari = n % (a+b)

print(shou * a + a) if amari >= a

print(shou * a + amari) if amari < a

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

shou = n // (a+b)
amari = n % (a+b)

ans = shou*a+a if amari >= a　else shou*a+amari

print(ans)

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

shou = n // (a+b)
amari = n % (a+b)

print(shou * a + a) if amari >= a　else print(shou*a+amari)

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

shou = n // (a+b)
amari = n % (a+b)

ans = shou * a + a if amari >= a　else shou*a+amari

print(ans)

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

shou = n // (a+b)
amari = n % (a+b)

ans = shou*a+a if amari >= a else shou*a+amari

print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
number = input().split(" ")
N = int(number[0])
B = int(number[1])
R = int(number[2])

a = int(B+R)
b = int(N/a)
c = int(N%a)

print(R)
if b <= 0:
    print(B)
elif R == 0:
    print(N)
elif B == 0:
    print(0)
else:
    print((b*B)+c)

number = input().split(" ")
N = int(number[0])
B = int(number[1])
R = int(number[2])

a = int(B+R)
b = int(N/a)
c = int(N%a)

if b <= 0:
    if R ==0:
        print(N)
    else:
        if B > N:
            print(N)
        else:
            print(B)
else:
    if R == 0:
        print(N)
    else:
        if B == 0:
            print(0)
        else:
            if c > B:
                print((b*B)+B)
            else:
                print((b*B)+c)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())
c=0
while n>=a and n>0:
    c+=a
    n=n-a-b
    if n<a:
        break
    else:
        continue
print(c)

n,a,b=map(int,input().split())
c=a+b
d=n//c
e=n%c
if d>=0 and e>=a:
    print(d*a+a)
elif d>=0 and e<a:
    print(d*a+e)
else:
    print(a)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
print((n//(a+b))*a + max(0,n%(a+b)-b))

n,a,b = map(int,input().split())
print((n//(a+b))*a + min(a,n%(a+b)))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b=map(int,input().split())

ans=n//(a+n)*a
rem=n%(a+b)
ans+=min(rem,a)
print(ans)

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

ans=n//(a+b)*a
rem=n%(a+b)
ans+=min(rem,a)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())

a = int(N - B)

pritn(a)

N, A, B = map(int, input().split())
ans = N //(A + B)*A
rem = N % (A +B)
ans += min(rem, A)

print(ans)


Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map((int,input().split())

balls_list = []
while len(balls_list) <= n:
    balls_list.append(['r'] * a)
    balls_list.append(['b'] * b)

new_list = balls_list[ :n]

from collections import Counter

count = Counter(new_list)

x = count['b']

print(x)

N, A, B = map(int,input().split())
x = N // (A + B)
y = N % (A + B)
ans = x * A + min(y,A)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B=map(int,input().split());B+=A;print(N/B*A+min(N%B,A))

N,A,B=map(int,input().split());print(N/B*A+min(N%B,A))

N,A,B=map(int,input().split());B+=A;print(N//B*A+min(N%B,A))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):

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

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else:
    res = ((n // sum)*a) + (n % sum)
    
    if n%sum > a: 
        print( ((n // sum)*a) + a

    else:
        print(res)



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

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else: 
    if n%sum > a: 
        print (((n // sum)*a) + a)

    else:
        res = ((n // sum)*a) + (n % sum)
        print(res)


Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
l = []
for i in range(n):
    for j in range(a):
        l.append("b")
    for k in range(b):
        l.append("r")
print(l.count("b"))

import math
ans = 0
n,a,b = map(int,input().split())
setu = math.floor(n/(a+b))
mod = n % (a+b)
if mod >= a:
    ans += a
else:
    ans += mod
ans += setu * a
print(ans)
# ans = setu*a+mod

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
import unittest
from solution import Solution


class TestSolution(unittest.TestCase):

    def test_001(self):
        
        solution = Solution()

        # actual
        N, A, B = 6, 2, 4

        actual = solution.solve(N, A, B)

        # expect
        expect = 2

        
        self.assertEqual(actual, expect)

    def test_002(self):
        
        solution = Solution()

        # actual
        N, A, B = 10**18, 5, 5

        actual = solution.solve(N, A, B)

        # expect
        expect = 5 * 10**17

        
        self.assertEqual(actual, expect)


if __name__ == '__main__':
    unittest.main()


class Solution:
    def solve(self, N: int, A: int, B: int) -> int:

        return (N // (A+B)) * A + min(N % (A+B), A)


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(N, A, B))


Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = (int(x) for x in input().split())
S =  n % (A+B) - A
Acount = n % (A+B)
Ansn = n / (A+ B) * A
if S <= 0
    print(Ansn + Acount)
else
    print(Ansn + A)

N,A,B = (int(x) for x in input().split())
S =  N % (A+B) - A
Acount = N % (A+B)
Ansn = int(N / (A + B)) * A
if S <= 0:
    print(Ansn + Acount)
else:
    print(Ansn + A)


Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
count = N // (A+B)
result = A * count

nokori = N - result
if N % (A+B):
    if nokori - A <= 0:
        result += nokori
    else:
        result += A

print(result)

N, A, B = map(int, input().split())
count = N // (A+B)
result = N - (B*count)

if N % (A+B) != 0:
    nokori = N - result
    if nokori - A >= 0:
        result += nokori
    else:
        result += A

print(result)

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

while N!=0:
    if N-A<0:
        result += A - N
        N = 0
    else:
        result += A
        N -= A
    if N-B<0:
        N = 0
    else:
        N -= B
print(result)

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

result = A * count
if N % (A+B) != 0:
    result += N - result

print(result)

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

count = N // (A+B)
result = A * count

nokori = N - (result+(B*count))
if N % (A+B):
    if nokori <= A:
        result += nokori
    else:
        result += A

print(result)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
#!/usr/bin/env python

def input():
    return sys.stdin.readline()[:-1]

def main():
    n, a, b = map(int, input().split())
    print(n // (a+b) * a + min(n % (a+b), a))

if __name__ == '__main__':
    main()

#!/usr/bin/env python

def main():
    n, a, b = map(int, input().split())
    print(n // (a+b) * a + min(n % (a+b), a))

if __name__ == '__main__':
    main()



Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

x = n // (a + b) * a
k = n % (a + b)
if k <= a:
    print(n + k)
else:
    print(n + a)

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

x = n // (a + b) * a
k = n % (a + b)
if k <= a:
    print(x + k)
else:
    print(x + a)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
if 0 <= other <= A:
    hashi_ bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)

N, A, B = map(int, input().split())
set_bule = //(A+B) * A
other = N - N//(A+B) * (A+B)
if 0 <= other <= A:
    hashi_ bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule) 

N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
hashi_bule=0
if 0 <= other <= A:
    hashi_bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule) 

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
ans = (N // (A+B)) * A
N -= ((A+B) * (N // (A+B)))
if N >= A:
    ans+=A
else:
    ans+=N

print(ans)

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

if B==0:
    print(N)
elif A==0:
    print(0)
else:
    n = (N//(A+B))
    ans = n * A
    N -= n*(A+B)
    if N >= A:
        ans+=A
    else:
        ans+=N
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,b,r=map(int,input().split())
alist=[]
count=0

while len(alist)>n:
  for i in range(b):
    alist.append('b')
  for i in range(r):
    alist.append('r')

del alist[n:]

for i in alist:
  if i=='b':
    count+=1

print(count)

n,b,r=map(int,input().split())

ans=n//(b+r)*b
sur=n%(b+r)
ans+=min(sur,b)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
a,b,n = input().split()
set = n//(a+b)
rem = n % (a+b)
if rem <= a:
	return set * (a+b) + a
else:
	return set * (a+b) + rem


n,a,b = map(int, input().split())
if a==0 and b==0:
  	print(0)
else:
	set = n//(a+b)
	rem = n % (a+b)
	if rem >= a:
		print( set * a + a)
	else:
		print( set * a + rem)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())
if a == 0:
  print(0)
else:
  print( (n //(a+b))*a + max(a, n%(a+b)) )

n, a, b = map(int, input().split())
if a == 0:
  print(0)
else:
  print( (n //(a+b))*a + min(a, n%(a+b)) )

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())
cnt = 0
ans = 0
if n//(a+b) <= 10**100:
    ans += a * n//(a+b)
    cnt += (n//(a+b))*(a+b)
else:
    ans += a * (10**100//(a+b))
    cnt += (10**100//(a+b))*(a+b)

if n - cnt >= a:
    ans += a:
else:
    ans += n - cnt
print(ans)

n, a, b = map(int, input().split())
cnt = 0
ans = 0
l = (a+b)
if n//l <= 10**100:
    ans += a * (n//l)
    cnt += (n//l)*l
    if n - cnt >= a:
        ans += a
    else:
        ans += max(n - cnt, 0)
else:
    ans += a * 10**100
    cnt += 10**100

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N, A, B = map(int, input().split())
print(min((N//(A+B))*A + N-(N//(A+B)), (N//(A+B))*A + A))

N, A, B = map(int, input().split())
print(min((N//(A+B))A + N-(N//(A+B), (N//(A+B))A + A))

N, A, B = map(int, input().split())
print(min((N//(A+B))*A + N - (N//(A+B))*(A+B), (N//(A+B))*A + A))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):

N, A,B = map(int, input().split())
str = []
for j in range(N//(A+B)+1):
    for i in range(A):
        if i==N+1:
            break
        str.append('b')

    for i in range(B):
        if i==N+1:
            break
        str.append('r')
print(str)
count = 0
for k in range(N):
    if str[k] == 'b':
        count+=1
print(count)



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'))


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)))


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
x, b, r = map(int, input().split())
count=0
flag_b=0
flag_r=0
while:
  count+=b if count!=x else break
  flag_b+=1
  count+=r if count!=x else break
  flag_r+=1
  
  
print(x-(flag_r*r))

x, b, r = map(int, input().split())
k=x/(b+r)
print(k*b+min(x%(b+r), b))

x, b, r = map(int, input().split())
k=int(x/(b+r))
print(k*b+min(x%(b+r), b))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int, input().split())

array = []

t = 0

while t < 10 ** 100:
    for p in range(a):
        array.append('blue')
    for q in range(b):
        array.append('red')
    t += 1
    
x = 0

for i in range(n):
    if array[i] == 'blue':
        x += 1

print(x)

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

f = n // (a+b)
g = n % (a+b)

if g <= a:
    print(a * f + g)
    
else:
    print(a * (f+1))

Verdicts: Time Limit Exceeded

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n, a, b = map(int,input().split())
a_b = n//(a+b)*a
print(a_b)
if n - n//(a+b)*(a*b) < a:
    print(a_b + (n - n//(a+b)*(a+b)))
else:
    print(a_b + a)

n, a, b = map(int,input().split())
a_b = n//(a+b)*a
if n%(a+b) < a:
    print(a_b + n%(a+b))
else:
    print(a_b + a)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
N,A,B = map(int,input().split())
print((N//(A+B))*A)

N,B,R = map(int,input().split())
if B == 0:
  print(0)
if B == 0 and R != 0:
  print(N)
limit = N//(B+R) 
blue = limit * B
print(blue)
red = limit * R
N-=(blue+red)
count = 0
while N > 0 and count < blue:
  N-=1
  blue += 1
  count += 1
  if count == B:
    N-=R
    if N>0:
      count = 0
      continue
print(blue)

import sys
import math
N,B,R = map(int,input().split())
blue = 0
if B == 0:
  print(0)
if B != 0 and R == 0:
  print(N)
limit = N//(B+R) 
blue = limit*B
print(blue) #15 of 100,10,7
difference = N - (limit * (B+R))
if B <= difference:
  blue += B
  print(blue)
else:
  blue += difference
  print(blue)

N,A,B = map(int,input().split())
R = N%(A+B)
res = (N//(A+B))*A
if R == 0:
  print(res)
else:
  if R<A:
    print(res+R)
  else:
    print(res+A)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
 n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    ans += min(n%(a+b),a)
    print(ans)

    n,a, b = map(int, input().split())
    l = []
    for i in range(10 ^100):
        l.extend([1]*a)
        l.extend([0]*b)
    
    print(sum(l[:n]))

    n,a, b = map(int, input().split())
    l = []
    for i in range(10 ^100):
        l.extend([1]*a)
        l.extend([0]*b)
    
    print(sum(l[:n]))

    n,a, b = map(int, input().split())
    ans = n //(a+b) *a
    tmp = n%(a+b)
    ans += min(tmp,a)
    print(ans)

n,a, b = map(int, input().split())
ans = n //(a+b) *a
tmp = n%(a+b)
ans += min(tmp,a)
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = map(int,input().split())
x=n//(a+b)
y=n - x*(a+b)
if y >= a
    y=a
print(a*y+x)

n,a,b = map(int,input().split())
x=n//(a+b)
y=n - C1*(a+b)
if y >= a:
  y=a
print(a*x+y)

n,a,b = map(int,input().split())
x=n//(a+b)
y=n - x*(a+b)
if y >= a:
  y=a
print(a*x+y)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi has many red balls and blue balls. Now, he will place them in a row.  Initially, there is no ball placed.  Takahashi, who is very patient, will do the following operation 10^{100} times:    * Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.  How many blue balls will be there among the first N balls in the row of balls made this way?

Submission attempts (in order):
n,a,b = list(map(int,input().split()))
cnt = 0
c = n//(a+b)
d = n%(a+b)
if d <= a:
  cnt = c+d
else:
  cnt = c+a
print(cnt)

n,a,b = list(map(int,input().split()))
cnt = 0
c = n//(a+b)
d = n%(a+b)
if d <= a:
  cnt = a*c+d
else:
  cnt = a*c+a
print(cnt)

Verdicts: Wrong Answer

Accepted