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 = map(int, input().split())

2 ans = N // (A + B) * A

3 rem = N % (A + B)

4 ans += min(rem, A)

5 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: 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 = N // (A+B)
    b = i*A
    t = N % (A+B)

    if t > A:
        t = A

    print(b+t)

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


i = N // (A+B)
b = i*A
t = N % (A+B)
if t > A:
   t = A
print(b+t)

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 = ""
cnt = 0
for i in range(10 **100):
    n1 = "b" * A
    n2 = "r" * B
    l += n1 + n2
    for j in range(N):
       if j == "b":
           cnt += 1
print(cnt)

n, a, b = map(int,input().split())
if a == 0 and b == 0:
    print(0)
if a != 0 or b != 0:
         
    kumi = n // (a + b)
    nokori = n % (a + b)
    if nokori == 0:
        print(a * kumi)
    elif nokori >= 1 and nokori < a:
        print(a * kumi + nokori)
    elif nokori >= a:
        print(a * kumi + 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):
import math

N, A, B = map(int, input().split())
x = math.floor(N // (A + B))
y = N % (A + B)

print(x)

if y >= A:
  print(A * x + A)
else:
  print(A * x + y)

import math

N, A, B = map(int, input().split())
x = math.floor(N // (A + B))
y = N % (A + B)

print(A * x + min(A, y))

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 python3
import sys


def solve(N: int, A: int, B: int):

    # if A+B < N : N = A+B
    if N <= A : print(N)
    else : 
        k = N // (A+B)
        rem = N - (A+B)*k
        b_ = A - rem
        if  b_ >= 0: print(k*A+rem+1)
        else : print(k*A)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


#!/usr/bin/env python3
import sys
 
 
def solve(N: int, A: int, B: int):
 
    # if A+B < N : N = A+B
    if N <= A : print(N)
    else : 
        k = N // (A+B)
        rem = N - (A+B)*k
        b_ = A - rem
        if  b_ >= 0: print(k*A+rem+1)
        else : print(k*A)
 
 
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)
 
if __name__ == 

#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):

    if N <= A : print(N)    
    else :
        k = N // (A+B)
        rem = N - (A+B)*k
        if  rem >= A:
            print(k*A+A)
        elif rem >= 0:
            print(k*A+rem)
        else : print(k*A)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


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):
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S ;
    int Q;
    string query1,query;
    cin>>S;
    cin>>Q;
    for(int i = 1; i <= Q;i++){
        getline(cin, query1);
        query = query1;
        if(query[0]=='1'){
            reverse(S.begin(), S.end()); 
        }else{
            if(query[2]=='1'){
                S = query[4] + S;
            }else
            {
                S = S + query[4];
            }
            
        }
    }
    cout<<S<<endl;
	return 0;
}

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

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):
text = list(map(int, input().split()))

reply = 0
color_blue = True
color_num = 0
for i in range(text[0]):
    if color_blue == True:
        if color_num < text[1]:
            color_num += 1
            reply += 1
        else:
            color_blue = False
            color_num = 0
    else:
        if color_num < text[2]:
            color_num += 1
        else:
            color_blue = True
            color_num = 0

print(reply)

text = list(map(int, input().split()))

reply = text[0] // (text[1] + text[2]) * text[1]

reply += text[1] if text[0] % (text[1] + text[2]) > text[1]else text[0] % (text[1] + text[2])

print(reply)

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):
def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < n else x = n
    print(q*a+x)

if __name__ == "__main__":
    main()


def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < a else a
    print(q*a+x)

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())
c = n//(a+b)
d = (n%(a+b))
if a ==0:
    print(0)
elif n%(a+b)==0:
    print(c*a)
elif n%(a+b)!== 0 and d <=a :
    print((c*a)+d)
else:
    print((c*a)+a)


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

n,a,b = map(int,input().split())
c = n//(a+b)
if n%(a+b) >= a:
    print((c*a)+a)
else:
    print((c*a)+n%(a+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 = list(map(int,input().split()))
kurikaeshi = n // (a + b)
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
if(amari - len(blue) < 0):
    ans = 0
if(amari - len(blue) == 0):
    ans = len(blue)
else:
    ans = len(blue) - amari
print(ans)

n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
ans = kurikaeshi * a
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
for i in range(1,kurikaeshi+2):
    ball_list.append(blue)
    ball_list.append(red)
for l in range(0,a+1):
    if(list(ball_list)[amari] == 'b'):
        ans += 1
print(ans)

n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += mod
if(a == 0):
    ans = 0
print(ans)

n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
if(amari - len(blue) < 0):
    ans = 0
else:
    ans = len(blue) - amari
print(ans)

n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += a
    else:
        ans += mod
if(a == 0):
    ans = 0
print(ans)

Verdicts: Runtime Error

Runtime Error

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())
l = ('b'*a+'r'*b)*10**100
print(l[:n].count('b'))

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())
if A > (N % (A + B)):
    print(N // (A + B) + N % (A + B))
else:
    print(N // (A + B) + A)

N, A, B = map(int, input().split())
if A > (N % (A + B)):
    print((N // (A + B)) * A + N % (A + B))
else:
    print((N // (A + B)) * A + 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):
if A == 0:
  print(0)
elif B == 0:
  print(N)
else:
  ans = 0
  div = N //( A + B ) # A > 0
  ans = div * A
  ans += min( N % (A + B) , A)
  # mod = N % ( A + B )


  # if mod > A :
  #   ans += A
  # else :
  #   ans += mod
  
  print(ans)

s = input()

ss = s.split(" ")

N = int(ss[0])
A = int(ss[1])
B = int(ss[2])

if A == 0:
  print(0)
elif B == 0:
  print(N)
else:
  ans = 0
  div = N //( A + B ) # A > 0
  ans = div * A
  ans += min( N % (A + B) , A)
  # mod = N % ( A + B )


  # if mod > A :
  #   ans += A
  # else :
  #   ans += mod
  
  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=[int(e) for e in input().split()]
if N[1]==0:
    A=0
else:
    M=N[0]//(N[1]+N[2])
    if M==0:
        if N[0]>N[1]:
            A=N[1]
        else:
            A=N[0]
    else:
        A=M+N[0]%(N[1]+N[2])
print(A)




N=[int(e) for e in input().split()]
A=N[0]//(N[1]+N[2])*N[1]
M=N[0]%(N[1]+N[2])
if N[1]>M:
    A+=M
else:
    A+=N[1]
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):
import math
a = input().split(" ")
res = int(a[0])
div = int(a[1])+int(a[2])
mult = math.floor(res/div)
plus = res%div
answer = int(a[1])*mult + min([plus,int(a[1])])
answer

import math
a = input().split(" ")
res = int(a[0])
div = int(a[1])+int(a[2])
mult = math.floor(res/div)
plus = res%div
answer = int(a[1])*mult + min([plus,int(a[1])])
print(answer)

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+b)*a
rem = n%(a+b)
if rem>=a:
    print(ans+a)
else 
    print(ans + rem)

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

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

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):
# import module
import sys
import math
import numpy as np

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

x = int(N / (A+B)) 

if N - x*(A+B) > A:
    print(x*A+ A)
else:
    print(x*A + N)



# import module
import sys
import math
import numpy as np

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

x = int(N / (A+B)) 
y = N % (A+B)

if y > A:
    print(x*A+ A)
else
    print(x*A + y )



# import module
import sys
import math
import numpy as np

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

x = N / (A+B) 

if N - x*(A+B) > A:
    print(x*A+ A)
else:
    print(x*A + N) 

# import module
import sys
import math
import numpy as np

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

x = int(N / (A+B)) 
y = N % (A+B)

if y > A:
    print(x*A+ A)
else:
    print(x*A + y )



Verdicts: Wrong Answer

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())
ans=(N//(A+B))*B+N%(A+B)-A
print(ans)

N, A, B=map(int, input().split())
ans=(N//(A+B))*A+min(A, N%(A+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):
Me, a, b = map(int, input().split())
period = a+b
times = Me//period
k = Me%period
n =  a if k >a else k
print(times*a + Me)

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

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 = list(map(int,input().split()))

tmp = 0
suc = 0
num = 0

for i in range(1000):
    tmp += A
    if tmp > N:
        num = i + 1
        break
    else:
        suc = "B"
    tmp += B
    if tmp > N:
        num = i + 1
        break
    else:
        suc = "R"

if suc == "R":
    print(num * A + (N - (A + B) * num))
if suc == "B":
    print(num * A)


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

tmp = 0
suc = 0
num = 0

for i in range(1000):
    tmp += A
    if tmp > N:
        num = i + 1
        break
    else:
        suc = "B"
    tmp += B
    if tmp > N:
        num = i + 1
        break
    else:
        suc = "R"

print(suc,num)

if suc == "R":
    print(num * A + (N - (A + B) * num))
if suc == "B":
    print(num * A)


# coding cell (SUBMIT ONLY THIS CELL)

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

X = N // (A + B) * A
Y = N % (A + B)
if Y <= A:
    Z = Y
else:
    Z = A

print(X + Z)

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):
import math

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

d = n // (a + b)
m = n % (a + b)

blue = a * k
if m >= a:
  blue = blue + a
else:
  blue = blue + m
  
print(blue)


n, a, b = input().split()
 
d = n // (a + b)
m = n % (a + b)
 
blue = a * d
if m >= a:
  blue = blue + a
else:
  blue = blue + m
  
print(blue)

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

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())
print(int(n/(a+b))*a + n%(a+b) - (n%(a+b)%a))

n,a,b = map(int,input().split())
uni = int(n/(a+b))
if n > (a+b)*uni + a:
  print(a*uni + a)
else:
  print(a*uni + 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 = map(int,input().split())
ans = []
blue = ["b"]*a
red = ["r"]*b

while len(ans) < (n-min(a,b)):
	ans.extend(blue)
	ans.extend(red)

print(ans[:n].count("b"))

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())
ans = 0
count = 0
for _ in range(10**100):
  ans += A
  count += A+B
  print(ans,count)
  if count > N:
    ans += min(0,B-(count-N))
    print(ans)
    exit()

N,A,B = map(int, input().split())
ans = ""
while len(ans) <= N:
    ans += "b"*A + "r"*B
print(ans)
print(ans[:N].count("b"))

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

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())
n = N // (A+B)
ans = A * n
m = N % n
if m > A:
    print(ans+A)
else:
    print(ans+m)


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)


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)


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)

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)



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

if a==0:
    print(0)
elif n>a:
    print(n-b)
elif n<=a:
    print(n)


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

ans = n//(a + b)*a
ans += min(n%(a + b),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) = list(map(int, input().split()))

cnt = int(N / (A + B))
rest = N % (A + B) 
if A == 0:
    print(0)
elif rest > A:
    print(cnt*A + rest)
else:
    print(cnt*A + A)


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

cnt = int(N / (A + B))
rest = N % (A + B) 
if A == 0:
    print(0)
elif rest > A:
    print(cnt*A + A)
else:
    print(cnt*A + rest)


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

fulls = n // (a+b)
lefts = n % (a+b)

print(fulls*a + min(left, a))

n, a, b = map(int, input().split())
 
fulls = n // (a+b)
lefts = n % (a+b)
 
print(fulls*a + min(lefts, 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 ,Blue,Red = map(int,input().split())

ans = N //(A+B) *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: 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 = a*(n//(a+b)) + min(N%(a+b),a)
print(ans)

n,a,b = map(int,input().split())
ans = a*(n//(a+b)) + min(n%(a+b),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 = int(input())
A = int(input())
B = int (input())

if A == 0:
    print 0 
else: 
    print(  N - 2 )

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

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):
nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
   print(n / (a+b) * a)

nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(a)
else:
   print(n // (a+b) * a)

nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
   print(n // (a+b) * a)

nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(a)
else:
   print(int(n / (a+b) * a))

nums = list(map(int, input().split()))
n = nums[0]
a = nums[1]
b = nums[2]

if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
   c = n // (a+b) * a
   mod = n % (a+b)
   if mod > a :
       mod = a
   print(c + mod)

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):
N=input()
A=input()
B=input()
i=((A+B)*(10**100)//N)*A
if ((A+B)*(10**100))%N>A:
    i=i+A
else:
    i=i+((A+B)*(10**100)%N)
print(i)


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


N,A,B=map(int,input().split())
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(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):
import math
a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
num_one_gr = y + z
num_gr = math.floor(x/num_one_gr)
amari = x - num_one_gr*num_gr
if amari <= y:
    total = y * num_gr + amari
else:
    total = y*(num_gr + 1)

import math
a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
num_one_gr = y + z
num_gr = math.floor(x/num_one_gr)
amari = x - num_one_gr*num_gr
if amari <= y:
    total = y * num_gr + amari
else:
    total = y*(num_gr + 1)
print(total)

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())
n = int(N/(A+B))
amari = (A+B)%N
if amari >= A:
  Ans = (n*A) + A
else:
  Ans = (n*A) + amari
print(Ans)

N,A,B = map(int,input().split())
n = int(N/(A+B))
amari = N%(A+B)
if amari >= A:
  Ans = (n*A) + A
else:
  Ans = (n*A) + amari
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())
ans=b*(n//(a+b))
ans+=min(b,n%(a+b))
print(ans)

n,a,b=map(int,input().split())
m=a+b
ans=(n//m)*a
n%=m
ans+=min(a,n)
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())
p = n // (a+b)
ans = a*b + min(a,(n%(a + b)))
print(ans)

n, a, b = map(int,input().split())
p = n // (a+b)
ans = a*p + min(a,(n%(a + 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):
N,b,r = map(int,input().split())
if(b == 0 and r == 0):
  print(0)
elif (b ==0):
  print(0)
else :
  sets = N/(b+r)
  surplus = N%(b+r)
  Number_of_Blue = sets * b + b
  print(Number_of_Blue)

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

N,b,r = input().split()
if(b==0 and r == 0):
  print(0)
else :
  set = N/(b+r)
  surplus = N%(b+r)
  Numbe_of_Blue = set * b + b
  print(Numbe_of_Blue)


N,b,r = input().split()
if(b==0 and r == 0):
  print(0)
else :
  sets = N/(b+r)
  surplus = N%(b+r)
  Numbe_of_Blue = sets * b + b
  print(Numbe_of_Blue

N,b,r = map(int,input().split())
if(b == 0 and r == 0):
  print(0)
else :
  sets = int(N/(b+r))
  surplus = int(N%(b+r))
  Number_of_Blue = sets * b + b
  print(Number_of_Blue)

N,b,r = map(int,input().split())
if(b==0 and r == 0):
  print(0)
else :
  sets = N/(b+r)
  surplus = N%(b+r)
  Numbe_of_Blue = sets * b + b
  print(Numbe_of_Blue)

N,b,r = map(int,input().split())
if(b == 0 and r == 0):
  print(0)
elif (b ==0):
  print(0)
else :
  sets = N//(b+r)
  surplus = N%(b+r)
  if(surplus - b > 0):
    residue = b
  elif(surplus - b < 0):
    residue = surplus  
  Number_of_Blue = sets * b + residue
  print(Number_of_Blue)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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 a==0:
  print(0)
else:
  s= n//(a+b)
  sn = n%(a+b)
  if sn > a:
    print (s*a+a)
  else:
    print (s*a+a-sn)




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

if a==0:
  print(0)
else:
  s= n//(a+b)
  sn = n%(a+b)
  if sn > a:
    print (s*a+a)
  else:
    print (s*a+sn)



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):
if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    if a == 0: print(0)
    elif n <= a+b:
        print(a)
    else:
    set_count = int(n/(a+b))*a+1
    print(set_count)

if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    a = n//(a+b)
    m = min(n%(a+b), a)
    print(a+m)

if __name__ == '__main__':
    (n, a, b) = tuple(map(int, input().split()))
    ans = n // (a + b) * a
    ans += min(n % (a + b), a)
    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,A,B=map(int,input().split())
ans=0
if A>=N:
  ans=N
elif A<N<=A+B:
  ans=A
elif N>A+B:
  num=int(N/(A+B))
  ans=num*A+N-(A+B)*num
  if n-(A+B)*num>=A:
    ans=(num+1)*A
print(ans)



N,A,B=map(int,input().split())
num=N//(A+B)
rest=min(N%(A+B),A)
ans=num*A+rest
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())
ana=N//(A+B)*A
rem=N%(A+B)
ana=ana+max(rem,A)
print(ana)

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

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

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

print(A)

a=0
for i in range(10^100):
  N, A, B=list(map(int, input().split()))
  if A+B==N:
    a=a+A
  else:
    a=a+A+N-(A+B)
  
    
print(a)

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

if N%(A+B)==0:
    print(N//(A+B)*A)

else:
    rem=min(N%(A+B),A)
    print(N//(A+B)*A+rem)

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):
import math

def main():
  n,a,b = (int(x) for x in input().split())

  num_x = 0
  num_a = (math.floor(n/(a + b)))
  num_b = int(n % (a + b))
  
  if(num_a == 0):
    num_x = a
  elif(n < (a + b)):
    if(num_b >= a):
      num_x = a
    else:
      num_x = num_b

  print(int(num_a * a + num_x))
  
if __name__ == '__main__':
  main()  


import math

def main():
  n,a,b = (int(x) for x in input().split())

  num_x = 0
  num_a = (math.floor(n/(a + b)))
  num_b = int(n % (a + b))
  
  if(num_a == 0):
    nun_x = a
  elif(n < (a + b)):
    if(num_b >= a):
      num_x = a
    else:
      num_x = num_b

  print(int(num_a * a + num_x))
  
if __name__ == '__main__':
  main()  


import math

def main():
  n,a,b = (int(x) for x in input().split())

  num_a = (math.floor(n/(a + b)))
  num_b = int(n % (a + b))

  print(int(num_a * a + min(a, num_b)))
  
if __name__ == '__main__':
  main()  


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):
import math
N, A, B = list(map(int, input().split(' ')))
S = A + B
count = N // S if S != 0 else 0
mod = N % S if S != 0 and count % 2 == 0 else 0
print(A*count + mod)


import math
N, A, B = list(map(int, input().split(' ')))
S = A + B
count = N // S if S != 0 else 0
mod = min(N % S, A) if S != 0 else 0
print(A*count + 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):
# -*- coding: utf-8 -*-

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

q, mod = divmod(N, A + B)

print((A * q) + min(mod, A)))


# -*- coding: utf-8 -*-

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

q, mod = divmod(N, A + B)

print((A * q) + min(mod, 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 = tuple(input().split())
print((N // (A + B)) * A + N % (A + B))

inp = input().split()
inp = [int(i) for i in inp]
N, A, B = inp
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):
nums = [int(e) for e in input().split()]
n = nums[0]
a = nums[1]
b = nums[2]
22 3 4
bbb4444bbb4444bbb4444b
sum = a + b
iter = n // sum
amari = n % sum
if amari >= b:
	print(iter * a + (b))
else:
  print(iter * a + (amari))

nums = [int(e) for e in input().split()]
n = nums[0]
a = nums[1]
b = nums[2]

sum1 = a + b
iter1 = n // sum1
amari = n % sum1
if amari >= a:
	print(iter1 * a + (a))
else:
  print(iter1 * a + (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())

x = n // (a + b)
ans = a * a + min(a, n - (a + b)*x)
print(ans)


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

x = n // (a + b)
ans = a * x + min(a, n - (a + b) * 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):
n, blue, red = map(int, input().split())
ball = blue + red

if blue == 0:
    print(0)
if n <= blue:
    print(n)
if n <= ball:
    print(blue + (n - red))



ans = n / ball
additional = n % ball
if additional == 0:
    print(ans * blue)
elif additional <= blue:
    print(ans * blue + additional)


n, blue, red = map(int, input().split())
ball = blue + red

if blue == 0:
    print(0)
if n <= blue:
    print(n)
if n <= ball:
    print(blue + (n - red))

ans = n / ball
additional = n % ball
if additional == 0:
    print(ans * blue)
elif additional <= blue:
    print(ans * blue + additional)
else:
    print(ans * blue + (additional - red))

n, blue, red = map(int, input().split())
ball = blue + red

if blue == 0:
    print(0)
if n <= blue:
    print(n)
if n <= ball:
    print(blue + (n - red))



ans = n / ball
additional = n % ball
if additional == 0:
    print(ans * blue)
elif additional <= blue:
    print((ans -1) * blue + additional)


import sys

n, blue, red = map(int, input().split())
ball = blue + red

if blue == 0:
    print(0)
    sys.exit()
if n <= blue or red == 0:
    print(n)
    sys.exit()
if n <= ball:
    print(blue)
    sys.exit()

ans = n // ball
additional = n % ball

if additional == 0:
    print(ans * blue)
elif additional <= blue:
    print(ans * blue + additional)
else:
    print((ans + 1) * blue)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted