ZhenlongDai/ACPR huggingface dataset:
Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
usa = list(map(int, input().split()))
flag = [0 for x in range(N)]
count = 0
for i, j in enumerate(usa):
    if(flag[i]):
        continue
    if(usa[j-1]-1 == i):
        count+=1
        flag[i] = 1

print (count)


Failing test case input:
5
5 5 5 -1 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
usa = list(map(int, input().split()))
flag = [0 for x in range(N)]
count = 0
for i, ai in enumerate(usa):
    if(flag[i]):
        continue
    if(usa[ai-1]-1 == i):
        count+=1
        flag[ai - 1] = 1

print (count)

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a_list = list(map(int, input().split()))

cnt = 0
index_list = list(range(0,n,1))
print(index_list)

for i in (index_list):
    if a_list[a_list[i]-1] == i+1:
        cnt += 1
        index_list.remove(a_list[i]-1)
        index_list.remove(i)
print(cnt)

Failing test case input:
5
5 3 4 2 1

Expected output:
1


Actual output:
[0, 1, 2, 3, 4]
1


Fixed submission (verdict: Accepted):
n = int(input())
a_list = list(map(int, input().split()))

cnt = 0
index_list = list(range(0,n,1))

for i in (index_list):
    if a_list[a_list[i]-1] == i+1:
        cnt += 1
print(cnt

Problem: p03993
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = [int(x) for x in input().split()]

print(a)



count = 0


for i in range(n + 1):
    if(i == a[a[i - 1] - 1]):
        count += 1


print(int(count/2))


Failing test case input:
5
3 5 5 5 1

Expected output:
0


Actual output:
[3, 5, 5, 5, 1]
0


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(x) for x in input().split()]





count = 0


for i in range(n + 1):
    if(i == a[a[i - 1] - 1]):
        count += 1


print(int(count/2))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split(' ')]

friends = 0
for i in range(N):
    if a[i] == -1:
        continue
    if a[a[i] - 1] == i + 1:
        friends += 1
        a[i] = -1
        a[a[i]-1] = -1

print(friends)

Failing test case input:
5
5 4 5 2 1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]

friends = 0
for i in range(0,len(a)):
    if a[i] == -1 or a[i] == -2:
        continue
    if a[a[i] - 1] == (i+1) :
        friends += 1
        a[ (a[i] - 1) ] = -1
        a[i] = -1
print(int(friends))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
c = 1
for i in range(N):
  if A[A[i]-1]==i-1:
    c += 1
print(int(c/2))

Failing test case input:
5
5 3 1 0 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
c = 0
for i in range(N):
  if A[A[i]-1]==i+1:
    c += 1
print(int(c/2))
Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
alist = list(map(int, input().split()))
ans = 0

for i in range(N):
    if alist[alist[i]-1]+1 == i:
        ans += 1
print(ans)

Failing test case input:
5
5 5 2 1 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
alist = list(map(int, input().split()))
ans = 0

for i in range(N):
    if alist[alist[i]-1]-1 == i:
        ans += 1
print(ans

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = ''
while i < n:
    b += str(a[i] + j)
    i += 1
    j += 1
l = len(set(b))
print(str(n - l))


Failing test case input:
5
5 3 5 -2 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = list(range(2))
c = []
while i < n:
    b[0] = a[i]
    b[1] = j
    b.sort()
    c.append(''.join(str(b)))
    i += 1
    j += 1
l = len(set(c))
print(str(n - l))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
arr = [sorted([i, j]) for i, j in enumerate(a,1)]
counter = 0
print(arr)
for i in range(n):
    if i == n-1:
        if arr[-1][0] == arr[0][0] and arr[-1][1] == arr[0][1]:
            counter +=1
    elif arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
        counter +=1
print(counter)

Failing test case input:
4
0 1 4 3

Expected output:
1


Actual output:
[[0, 1], [1, 2], [3, 4], [3, 4]]
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
arr = [sorted([i, j]) for i, j in enumerate(a,1)]
arr = sorted(arr)
counter = 0
for i in range(n-1):
    if arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
        counter +=1
print(counter)

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    if a[a[i]-1]==i+1:
        ans+=1
        a[a[i]-1]=-1
        a[i]=-1
print(ans)


Failing test case input:
5
5 5 5 5 2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    if a[a[i]-1]==i+1 and a[i]==a[a[a[i]-1]-1]:
        ans+=1
        a[a[i]-1]=0
        a[i]=0
print(ans)

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = ''
while i < n:
    if (a[i] != j):
        b += str(a[i] + j)
    i += 1
    j += 1
l = len(set(b))
print(str(n - l))


Failing test case input:
5
4 0 5 2 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = list(range(2))
c = []
while i < n:
    b[0] = a[i]
    b[1] = j
    b.sort()
    c.append(''.join(str(b)))
    i += 1
    j += 1
l = len(set(c))
print(str(n - l))
Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s1 = input()
s2 = input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
    if str(s2[int(b)-1]) == str(a+1):
        f = f+1
print (str(f/2))

Failing test case input:
5
2 5 5 5 1

Expected output:
0


Actual output:
0.0


Fixed submission (verdict: Accepted):
s1 = input()
s2 = input()
s2 = s2.split(" ")
f = 0
for a,b in enumerate(s2):
    if str(s2[int(b)-1]) == str(a+1):
        f = f+1
print (int(f/2))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    pair = 0
    for i in range(n):
        if a[i-1] == i - 1 and a[i-1] >= i - 1:
            pair += 1
            
    print(pair)
    
    
if __name__ == "__main__":
    main()

Failing test case input:
5
3 1 5 5 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    pair = 0
    for i in range(n):
        if a[a[i]-1] == i + 1 and a[a[i]-1] <= a[i]:
            pair += 1
            
    print(pair)
    
    
if __name__ == "__main__":
    main()

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
res = 0

for i in range(n):
  sel = a[i] - 1
  if a[sel] == i-1:
    res += 1
else:
  print(res)

Failing test case input:
5
0 5 1 1 2

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
res = 0

for i in range(n):
  sel = a[i] -1
  if a[sel] == i+1:
    res += 1
else:
  print(int(res/2))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
n = list(map(int,input().split()))
ans  = 0
for i in range(N):
    if n[n[i]-1] == i:
        ans += 1 
print(ans)

Failing test case input:
5
4 3 5 2 1

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
n = list(map(int,input().split()))
ans  = 0
for i in range(N):
    if n[n[i]-1] == i+1:
        ans += 1 
print(ans

Problem: p03993
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))

ans = 0
for c in range(N):
    if a.index(a[c]) == a[a[c] - 1] - 1:
        
        ans += 1
print(round(ans / 2))


Failing test case input:
5
5 5 5 1 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    if i + 1 == A[A[i] - 1]:
        ans += 1

print(round(ans / 2))
Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split(' ')]

friends = 0
for i in range(0,len(a)):
    if a[i] == -1:
        continue
    if a[a[i]-1] == i+1:
        friends += 1
        a[i-1] = -1
        a[a[i-1]] = -1

print(friends)

Failing test case input:
5
4 0 5 1 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]

friends = 0
for i in range(0,len(a)):
    if a[i] == -1 or a[i] == -2:
        continue
    if a[a[i] - 1] == (i+1) :
        friends += 1
        a[ (a[i] - 1) ] = -1
        a[i] = -1
print(int(friends))

Problem: p03993
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
k = 0
b = ''
while i < n:
    if (a[i] != j):
        b += str(a[i] + j)
    else:
        k += 1
    i += 1
    j += 1
l = len(set(b))
print(str(n - (l + k)))


Failing test case input:
5
5 3 5 -2 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = list(range(2))
c = []
while i < n:
    b[0] = a[i]
    b[1] = j
    b.sort()
    c.append(''.join(str(b)))
    i += 1
    j += 1
l = len(set(c))
print(str(n - l))

Problem: p03993
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a = [None] + a
print (a)
cnt = 0
for i in range(1, n):
  j = a[i]
  if j > i and a[j] == i:
    cnt += 1
print(cnt)

Failing test case input:
5
5 1 5 5 1

Expected output:
1


Actual output:
[None, 5, 1, 5, 5, 1]
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
a = [None] + a
cnt = 0
for i in range(1, n):
  j = a[i]
  if j > i and a[j] == i:
    cnt += 1
print(cnt)
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

l=a+b

if n%l>=a:
  print(round(n/l)*a+a)
else:
  print(round(n/l)*a+n%l)



Failing test case input:
12 14 -1

Expected output:
12


Actual output:
26


Fixed submission (verdict: Accepted):
import math
n,a,b=map(int,input().split())

l=a+b

if n%l>=a:
  print(math.floor(n/l)*a+a)
else:
  print(math.floor(n/l)*a+n%l)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())
num = A * N 
if N % (A + B) > A:
  print(num + A)
else:
  print(num + (N % (A + B)))

Failing test case input:
96 -4 9

Expected output:
-80


Actual output:
-388


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
num = A *(N 
if N % (A + B) > A:
  print(num + A)
else:
  print(num + (N % (A + B)))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

count = 0
t1 = (N * A) 
t2 = N % (A + B)

count += t1
count += min(t2, A)

print(count)


Failing test case input:
87 -3 -1

Expected output:
63


Actual output:
-264


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

count = 0
t1 = (N 
t2 = N % (A + B)

count += t1
count += min(t2, A)

print(count)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

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

if A < mod:
	mod_A = A
else:
	mod_A = mod

print(A * q + mod_A)


Failing test case input:
96 -7 9

Expected output:
-343


Actual output:
48 0
-343


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

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

if A < mod:
	mod_A = A
else:
	mod_A = mod

print(A * q + mod_A)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, a, b = map(int, input().split())
    if a+b == 0:
        print("0")
    else:
        ans = a* n
        n %= a+b
        if n > a:
            ans += a
        else:
            ans += n
        print(ans)

if __name__ == "__main__":
    main()

Failing test case input:
13 16 1

Expected output:
13


Actual output:
221


Fixed submission (verdict: Accepted):
def main():
    n, a, b = map(int, input().split())
    ans = a*(n
    n %= a+b
    if n >= a:
        ans += a
    else:
        ans += n
    print(ans)

if __name__ == "__main__":
    main()

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
import math
x=math.floor(n/(a+b))
print(x*a+max(a,n-x*(a+b)))

Failing test case input:
18 12 0

Expected output:
18


Actual output:
24


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
import math
x=math.floor(n/(a+b))
print(x*a+min(a,n-x*(a+b)))
Problem: p02754
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def main():

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

    answer = 0
    if n < a+b:
        answer = a
    else:
        answer += (n / (a+b)) * a
        rest = n % (a+b)
        if rest <= a:
            answer += rest
        else:
            answer += a
    print(answer)


if __name__ == "__main__":
    main()


Failing test case input:
0 1 5

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import math


def main():

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

    answer = 0
    if n < a:
        answer = n
    elif n < a+b:
        answer = a
    elif a == 0 and b == 0:
        answer = 0
    else:
        answer += math.floor(n / (a+b)) * a
        rest = n % (a+b)
        if rest <= a:
            answer += rest
        else:
            answer += a
    print(answer)


if __name__ == "__main__":
    main()

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = map(int, input().split())
AB = A + B

if N >= AB:
    iters, div = divmod(N, AB)
    print((A*iters + div))
elif N >= A:
    print(A)
else:
    print(N)


Failing test case input:
16 -1 4

Expected output:
-6


Actual output:
-4


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
AB = A + B

if N >= AB:
    iters, div = divmod(N, AB)
    if div <= A:
        print((A*iters + div))
    else:
        print((A*(iters + 1)))
elif N >= A:
    print(A)
else:
    print(N)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

import sys
AB = A+B

if A == 0:
    print(0)
    sys.exit()
waru,amari = divmod(B,AB)


answer = waru * A + amari
print(answer)

Failing test case input:
69 -13 9

Expected output:
221


Actual output:
36


Fixed submission (verdict: Accepted):

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

import sys
AB = A+B
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(N,AB)


if amari > A:
    amari = A
answer = waru * A + amari
print(answer)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

if n<=a:
  print(a)
else:
  q,mod=divmod(n,a+b)
  mod=min(mod,a)
  print(a*q + mod)

Failing test case input:
5 12 0

Expected output:
5


Actual output:
12


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

q,mod=divmod(n,a+b)
mod=min(mod,a)
print(a*q + mod)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())

if a == 0:
  print(0)
elif b == 0:
  print(n)
elif a == n:
  print(n)
elif b >= n:
  print(a)
else:
  c = a*n
  print(c)


Failing test case input:
0 4 3

Expected output:
0


Actual output:
4


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

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

else:
  c = a*int(n
  print(c)
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, open(0).read().split())
q, r = divmod(n, a+b)
print(q*a + r)

Failing test case input:
0 -1 12

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = map(int, open(0).read().split())
q, r = divmod(n, a+b)
print(q*a + min(r, a))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n,a,b=(int(x) for x in input().split())
j=0

c=a+b

q, mod=divmod(n,c)

A=q*a+mod

print(A)


Failing test case input:
453 -3 0

Expected output:
450


Actual output:
453


Fixed submission (verdict: Accepted):
import sys
n,a,b=(int(x) for x in input().split())
j=0

c=a+b

q, mod=divmod(n,c)

A=q*a+min(mod,a)


print(A)

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = map(int, input().split())

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

if A>=N:
    print(N)
else:
    s, a = divmod(N, A+B)
    print(s*A+a)

Failing test case input:
8 1 5

Expected output:
2


Actual output:
3


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

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

if A>=N:
    print(N)
else:
    if A+B>=N:
        print(A)
    else:
        s, a = divmod(N, A+B)
        print(s*A+min(A, a))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod<=a:
  print(q*a+mod)
else:
  print(q*b+mod)


Failing test case input:
48 -13 9

Expected output:
143


Actual output:
-108


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod<=a:
  print(q*a+mod)
else:
  print(q*a+a)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = [int(i) for i in input().split()]
answer, amari = divmod(n, a+b)
answer *= a
print(answer + max(a, amari))

Failing test case input:
8 3 4

Expected output:
4

Actual output:
6


Fixed submission (verdict: Accepted):
n, a, b = [int(i) for i in input().split()]
answer, amari = divmod(n, a+b)
answer *= a
print(answer + min(a, amari))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
29 12 0

Expected output:
29


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
ct=a+b
num=(n/ct)*a
s=n%ct
result=num+min(s,a)
print(int(result))

Failing test case input:
87 -3 -1

Expected output:
63


Actual output:
62


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
ct=a+b
num=(n
s=n%ct
result=num
result += min(s,a)
print(int(result))
Problem: p02754
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

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

x, mod = divmod(n, a + b)

if x == 0:
    print(min(a, n))
else:
    print(a * x + mod)

Failing test case input:
96 -7 9

Expected output:
-343


Actual output:
-336


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

x, mod = divmod(n, a + b)

if x == 0:
    print(min(a, n))
else:
    print(a * x + min(mod, a))

Problem: p02754
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

N, A, B = map(int, sys.stdin.buffer.read().split())

if A + B == 0:
  print(0)
  sys.exit(0)


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

ans = div * A + mod
print(ans)

Failing test case input:
9 -7 14

Expected output:
-14


Actual output:
-5


Fixed submission (verdict: Accepted):
import sys

N, A, B = map(int, sys.stdin.buffer.read().split())


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

ans = div * A + min(mod, A)
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
  n,a,b = (int(x) for x in input().split())

  num = int(n % (a + b))
  
  print(n - b)
  
if __name__ == '__main__':
  main()  


Failing test case input:
96 -4 9

Expected output:
-80


Actual output:
87


Fixed submission (verdict: Accepted):
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()

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
ans = divmod(n, a + b)
print(ans[0] * a + ans[1])

Failing test case input:
0 -1 12

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
ans = divmod(n, a + b)
m = a if a < ans[1] else ans[1]
print(ans[0] * a + m)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
[N, A, B] = list(map(int, input().split()))

def main(N, A, B):

    if A == 0:
        return 0
    if B == 0:
        return N
    
    
    sumBlue = A * N 

    
    sumBlue += min(A, N % (A + B))

    return sumBlue

if __name__ == "__main__":

    answer = main(N, A, B)
    print(answer)
    

Failing test case input:
48 -13 9

Expected output:
143


Actual output:
-637


Fixed submission (verdict: Accepted):
[N, A, B] = list(map(int, input().split()))

def main(N, A, B):

    if A == 0:
        return 0
    if B == 0:
        return N
    
    
    sumBlue = A * (N 

    
    sumBlue += min(A, N % (A + B))

    return sumBlue

if __name__ == "__main__":

    answer = main(N, A, B)
    print(answer)
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
 
N, A, B = map(int,input().split())
 
ans = 0
 
if N < A:
  print(N)
  sys.exit()
 
if N < A+B:
  print(A)
  sys.exit()
 
print((int)(A*(N/(A+B))) + (N%(A+B)))



Failing test case input:
51 -3 21

Expected output:
-9


Actual output:
7


Fixed submission (verdict: Accepted):
import sys
 
N, A, B = map(int,input().split())
 
ans = 0
 
if N < A:
  print(N)
  sys.exit()
 
if N < A+B:
  print(A)
  sys.exit()
 
if N%(A+B) <A:
  print((A*(N
else:
  print((A*(N

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = [int(i) for i in input().strip().split()]
if A+B > N and A < N:
  print(A)
else:
  q, r = divmod(N, A+B)
  print(A*q + r)


Failing test case input:
96 -4 13

Expected output:
-44


Actual output:
-34


Fixed submission (verdict: Accepted):
N, A, B = [int(i) for i in input().strip().split()]
q, r = divmod(N, A+B)
if r <= A:
  print(A*q + r)
else:
  print(A*q + A)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if n-a<=0:
    print(n)
else:
    print(a)


Failing test case input:
453 -3 -1

Expected output:
339


Actual output:
-3


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if n%(a+b)<a:
    print((n
else:
    print(((n

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
ans = n
print(ans)

Failing test case input:
2 -1 2

Expected output:
-3


Actual output:
2


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
s = a+b
ans = (n
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    (n, a, b) = [int(e) for e in input().split()]
    print((int(n/(a+b)))*a + n%(a+b))

Failing test case input:
0 -1 12

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    (n, a, b) = map(int, input().split())
    ans = (n
    m = min(n%(a+b), a)
    print(ans+m)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = [int(i) for i in input().strip().split()]
if A < N:
  print(A)
else:
  q, r = divmod(N, A+B)
  print(A*q + r)


Failing test case input:
8 1 5

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, A, B = [int(i) for i in input().strip().split()]
q, r = divmod(N, A+B)
if r <= A:
  print(A*q + r)
else:
  print(A*q + A)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int, input().split())

t = []
i = 0
if n <= a+b:
    print(a)
else:
    while len(t) > n:
        t = "b"*a +"r"*b
        i += 1
    s = t[:n]
    print(s.count("b"))

Failing test case input:
40 19 0

Expected output:
40


Actual output:
0


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

t = n%(a+b)

if n < a:
    print(n)
else:
    if a > t > 0:
        print(n
    elif t >= a:
        print(n
    else:
        print(n
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

N = inputted[0]
A = inputted[1]
B = inputted[2]

AB = A + B

num_of_repeat = math.floor(N / AB) * A
num_of_remainder = N % AB
total = num_of_repeat + num_of_remainder

print(total)


Failing test case input:
96 -7 9

Expected output:
-343


Actual output:
-336


Fixed submission (verdict: Accepted):
import math

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

N = inputted[0]
A = inputted[1]
B = inputted[2]

AB = A + B
remainder = N % AB

num_of_repeat = math.floor(N / AB) * A
num_of_remainder = min(A, remainder)
total = num_of_repeat + num_of_remainder

print(total)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N,A,B = map(int,input().split())
x = A+B
y = N-x
ans = 0
ans += A*(math.floor(N/x))
if y >= A:
  ans += A
else:
  ans += y
print(ans)

Failing test case input:
27 12 0

Expected output:
27


Actual output:
36


Fixed submission (verdict: Accepted):
import math
N,A,B = map(int,input().split())
x = A+B
y = N-x*math.floor(N/x)
ans = 0
ans += A*(math.floor(N/x))
if y >= A:
  ans += A
else:
  ans += y
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong 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])])
answer

Failing test case input:
8 1 7

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
[N, A, B] = list(map(int, input().split()))
pair = A+B
ans = 0
if A != 0:
  num = (N-(N%(pair)))/(pair)
  if N - num*pair < A:
    ans = A*num + N - num*pair
  else:
    ans = A*num + N + A
  
print(int(ans))

Failing test case input:
69 -13 14

Expected output:
-910


Actual output:
-841


Fixed submission (verdict: Accepted):
[N, A, B] = list(map(int, input().split()))
pair = A+B
ans = 0

num = int((N-(N%pair))/pair)

if N - num*pair <= A:
  ans = num*A + N - num*pair
else:
  ans = num*A + A

print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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


Failing test case input:
19 12 0

Expected output:
19


Actual output:
26


Fixed submission (verdict: Accepted):
import math

N, A, B = map(int, input().split())
print(A * math.floor(N / (A + B)) + min(A, N % (A + B)))
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = list(map(int, input().split(' ')))
blueBall = 0

answer = divmod(n, (a + b))

if a == 0 or n <= a:
    print(a)
elif n == 1:
    print('1')
else:
    blueBall = answer[0] * a
    if answer[1] > b:
        blueBall = blueBall + a
    else:
        blueBall = blueBall + answer[1]

    print(blueBall)


Failing test case input:
29 12 0

Expected output:
29


Actual output:
36


Fixed submission (verdict: Accepted):
n, a, b = list(map(int, input().split(' ')))
blueBall = 0
answer = []

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

        print(blueBall)
    else:
        if n <= a:
            print(n)
        elif n <= b:
            print(a)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = (int(i) for i in input().split())
q, mod = divmod(ｎ, a+b)
print(b * q + max(mod - a, 0))

Failing test case input:
96 -13 9

Expected output:
299


Actual output:
-203


Fixed submission (verdict: Accepted):
n, a, b = (int(i) for i in input().split())
q, mod = divmod(ｎ, a+b)
print(a * q + min(mod, a))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

x, y = divmod(N, A+B)
print(x*A + (y if y!= 0 else 0))


Failing test case input:
96 -5 13

Expected output:
-65


Actual output:
-60


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

x, y = divmod(N, A+B)
print(x * A + min(A, y))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

ONE_BLOCK_NUM = A + B

if ONE_BLOCK_NUM != 0:
    ans += math.floor(N / ONE_BLOCK_NUM) * A 
    res = N % ONE_BLOCK_NUM                  

    if res > 0:
        ans += res

print(ans)

Failing test case input:
453 -2 1

Expected output:
904


Actual output:
906


Fixed submission (verdict: Accepted):
import math

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

ans = 0

ONE_BLOCK_NUM = A + B

if ONE_BLOCK_NUM != 0:
    ans += math.floor(N / ONE_BLOCK_NUM) * A 
    res = N % ONE_BLOCK_NUM                  
    if res >= A:
        ans += A
    else:
        ans += res

print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, A, B = list(map(int, input().split()))
    return A * N 
   

print(main())


Failing test case input:
8 3 7

Expected output:
3


Actual output:
24


Fixed submission (verdict: Accepted):
def main():
    N, A, B = list(map(int, input().split()))
    return A * (N 
   

print(main())

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
print(n-b)

Failing test case input:
453 -3 0

Expected output:
450


Actual output:
453


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
print((n
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N, A, B = map(int, input().split(' '))
r = math.floor(N / (A + B))
ans = r * A + N - r * (A + B)
print(ans)


Failing test case input:
50 -7 14

Expected output:
-56


Actual output:
-48


Fixed submission (verdict: Accepted):
import math
N, A, B = map(int, input().split(' '))
r = math.floor(N / (A + B))
ans = r * A + min(N - r * (A + B), A)
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)

if mod > A:
    blue += (mod-B)
else:
    blue += mod

print(blue)

Failing test case input:
8 1 5

Expected output:
2


Actual output:
-2


Fixed submission (verdict: Accepted):


N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)
blue += min(mod, A)

print(blue)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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_b >= a):
    nun_x = a
  else:
    num_x = num_b

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


Failing test case input:
48 -13 9

Expected output:
143


Actual output:
156


Fixed submission (verdict: Accepted):
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()

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = map(int, input().split())
AB = A + B

if N >= AB:
    iters, div = divmod(N, AB)
    print((A*iters + div))
else:
    print(A)


Failing test case input:
51 -5 21

Expected output:
-20


Actual output:
-12


Fixed submission (verdict: Accepted):
N, A, B = map(int, input().split())
AB = A + B

if N >= AB:
    iters, div = divmod(N, AB)
    if div <= A:
        print((A*iters + div))
    else:
        print((A*(iters + 1)))
elif N >= A:
    print(A)
else:
    print(N)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split());B+=A;print(N/B*A+min(N%B,A))

Failing test case input:
28 21 4

Expected output:
24


Actual output:
26.520000000000003


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split());B+=A;print(N
Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    N,A,B = list(map(int, input().split()))
    ans = 0

    if A+B > N:
        ans = A
    else:
        ans = A*N
        if N%(A+B) >= A:
            ans += A
        else:
            ans +=  N%(A+B)

    print(ans)


main()

Failing test case input:
0 1 4

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    N,A,B = list(map(int, input().split()))
    ans = 0

    if A == 0 and B == 0:
        print(ans)
        return

    if A+B > N:
        if A > N:
            ans = N
        else:
            ans = A
    else:
        ans = A*(N
        if N%(A+B) >= A:
            ans += A
        else:
            ans +=  N%(A+B)

    print(ans)


main()

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split(' '))

div, mod = divmod(n, a+b)
ans = div*a+(mod if mod < b else b)
print(ans)

Failing test case input:
11 16 0

Expected output:
11


Actual output:
0


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split(' '))

div, mod = divmod(n, a+b)
ans = div*a+(mod if mod < a else a)
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

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

d,m = divmod(n,a+b)

print(d*a+m if m<a else d*a+m-b)

Failing test case input:
8 1 5

Expected output:
2


Actual output:
-2


Fixed submission (verdict: Accepted):
cmin = lambda a,b : a if a<b else b
cmax = lambda a,b : a if a>b else b
iin = lambda : int(input())
lin = lambda : list(map(int,input().split()))
rin = lambda n : [int(input()) for _ in range(n)]

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

d,m = divmod(n,a+b)

print(d*a+m if m<a else d*a+a)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())

x,y = divmod(N,(A+B))

print(A*x+y)
  

Failing test case input:
248 -3 -1

Expected output:
183


Actual output:
186


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

x,y = divmod(N,(A+B))

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

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B=map(int,input().split())
q,mod=divmod(N,A+B)
print(q*A+mod)




Failing test case input:
87 -3 -1

Expected output:
63


Actual output:
65


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
q,mod=divmod(N,A+B)
if mod<=A:
    print(q*A+mod)
else:
    print((q+1)*A)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
if a==0:
    print(0)
elif a+b==n:
    print(a)
elif a+b<n:
    print(n-b)

Failing test case input:
0 4 3

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
if a==0:
    print(0)
elif n%(a+b)<a:
    print((n
elif a<n%(a+b):
    print((n
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b =map(int,input().split())
c = a+b

sum1 = n/c
l = n%c
if a>l:
  sum2 = l
else:
  sum2 = a
  
print(sum1+sum2)

Failing test case input:
56 18 -1

Expected output:
59


Actual output:
8.294117647058822


Fixed submission (verdict: Accepted):
n,a,b =map(int,input().split())
c = a+b

ans = (n
l = n%c
if a>l:
  ans += l
else:
  ans += a
  
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m,l = map(int,input().split())
x, y = divmod(n, (m + l))
if y <= m:
    print(x*m+y)
else:
    print(x*m+y)

Failing test case input:
32 -13 14

Expected output:
-429


Actual output:
-416


Fixed submission (verdict: Accepted):
n,m,l = map(int,input().split())
x, y = divmod(n, (m + l))
if y <= m:
    print(x*m+y)
else:
    print(x*m+m)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = map(int,input().split())

x,y = divmod(N,(A+B))

if A == 0:
  print(0)
elif B == 0:
  print(N)
else:
  print(A*x+y)

Failing test case input:
96 -5 21

Expected output:
-35


Actual output:
-30


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

x,y = divmod(N,(A+B))

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

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = list(map(int,input().split()))
if A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print(N - B)

Failing test case input:
96 -13 9

Expected output:
299


Actual output:
87


Fixed submission (verdict: Accepted):
N, A, B = list(map(int,input().split()))
if A == 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print((N

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = list(map(int, input().split(' ')))
blueBall = 0

answer = divmod(n, (a + b))

if a == 0:
    print(a)
elif n == 1:
    print('1')
else:
    blueBall = answer[0] * a
    if answer[1] > b:
        blueBall = blueBall + a
    else:
        blueBall = blueBall + answer[1]

    print(blueBall)


Failing test case input:
62 19 -1

Expected output:
65


Actual output:
76


Fixed submission (verdict: Accepted):
n, a, b = list(map(int, input().split(' ')))
blueBall = 0
answer = []

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

        print(blueBall)
    else:
        if n <= a:
            print(n)
        elif n <= b:
            print(a)
Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = map(int, input().split())

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

if A>=N:
    print(N)
else:
    if A+B>=N:
        print(A)
    else:
        s, a = divmod(N, A+B)
        print(s*A+a)

Failing test case input:
453 -3 1

Expected output:
678


Actual output:
680


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

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

if A>=N:
    print(N)
else:
    if A+B>=N:
        print(A)
    else:
        s, a = divmod(N, A+B)
        print(s*A+min(A, a))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int, input().split())

ans = N 
p = N % (A + B)
print(ans*A+p if A<=B else ans*A)

Failing test case input:
10 12 0

Expected output:
10


Actual output:
120


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

ans = (N 
p = N % (A + B)
print(ans+min(p,A))

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b = list(map(int,input().split()))
c =a+b
ans = a*n
print(ans)

Failing test case input:
69 -13 14

Expected output:
-910


Actual output:
-897


Fixed submission (verdict: Accepted):
n,a,b = list(map(int,input().split()))
c = a+b
d = n%c
if n%c > a:
    d = a
ans = a*(n

print(ans)

Problem: p02754
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def main():

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

    answer = 0
    if n < a+b:
        answer = a
    elif a == 0 and b == 0:
        answer = 0
    else:
        answer += int(n / (a+b)) * a
        rest = n % (a+b)
        if rest <= a:
            answer += rest
        else:
            answer += a
    print(answer)


if __name__ == "__main__":
    main()


Failing test case input:
0 4 3

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
import math


def main():

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

    answer = 0
    if n < a:
        answer = n
    elif n < a+b:
        answer = a
    elif a == 0 and b == 0:
        answer = 0
    else:
        answer += math.floor(n / (a+b)) * a
        rest = n % (a+b)
        if rest <= a:
            answer += rest
        else:
            answer += a
    print(answer)


if __name__ == "__main__":
    main()

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())

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


Failing test case input:
189 -3 -1

Expected output:
141


Actual output:
-567


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

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

else:
  c = a*int(n
  print(c)
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B=map(int, input().split())
ans=(N-N%(A+B))*A/(A+B)+min(A,N%(A+B))
print(format(ans))


Failing test case input:
453 -2 1

Expected output:
904


Actual output:
904.0


Fixed submission (verdict: Accepted):
N, A, B=map(int, input().split())
K=int((N-N%(A+B))/(A+B))
ans=(K*A+min(A,N%(A+B)))
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, b, r = list(map(int, input().split(' ')))
q, mod = divmod(N, b + r)
print(q * b + mod)


Failing test case input:
96 -4 13

Expected output:
-44


Actual output:
-34


Fixed submission (verdict: Accepted):
N, b, r = list(map(int, input().split(' ')))
q, mod = divmod(N, b + r)

if mod <= b:
	print(q * b + mod)
else:
  	print(q * b + b)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

ans = 0

ONE_BLOCK_NUM = A + B
ans += math.floor(N / ONE_BLOCK_NUM) * A 
res = N % ONE_BLOCK_NUM                  

if res > 0:
    ans += res

print(ans)

Failing test case input:
87 -3 -1

Expected output:
63


Actual output:
66


Fixed submission (verdict: Accepted):
import math

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

ans = 0

ONE_BLOCK_NUM = A + B

if ONE_BLOCK_NUM != 0:
    ans += math.floor(N / ONE_BLOCK_NUM) * A 
    res = N % ONE_BLOCK_NUM                  
    if res >= A:
        ans += A
    else:
        ans += res

print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())
 
if a == 0:
  print(0)
elif a + b == 0:
  print(0)
else:
  q1, mod1 = divmod(n, (a + b))
  q2, mod2 = divmod(mod1, a)
  ans = q1 * a + q2 + mod2
  print(ans)

Failing test case input:
149 -3 -1

Expected output:
111


Actual output:
115


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
 
if a == 0:
  print(0)
elif a + b == 0:
  print(0)
else:
  q1, mod1 = divmod(n, (a + b))
  if mod1 < a:
    ans = q1 * a + mod1
  else:
    ans = (q1 + 1) * a
  print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())
x = n % (a+b)
if x <= a:
    a += x
elif x > a:
    a += a
print(int(a))

Failing test case input:
56 18 -1

Expected output:
59


Actual output:
23


Fixed submission (verdict: Accepted):
n,a,b = map(int,input().split())
x = n % (a+b)
blue = (n
if x <= a:
    blue += x
elif x > a:
    blue += a
print(int(blue))

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m,l = map(int,input().split())
x = n 
y = n % (m + l)
if y <= m:
    print(x*m+y)
else:
    print(x*m+y)

Failing test case input:
2 -1 2

Expected output:
-3


Actual output:
-2


Fixed submission (verdict: Accepted):
n,m,l = map(int,input().split())
x, y = divmod(n, (m + l))
if y <= m:
    print(x*m+y)
else:
    print(x*m+m)
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
ans=B+(S-B-R)
print(ans)

Failing test case input:
7 24 -1

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
inp=list(map(int,input().split()))
s=inp[0]
b=inp[1]
r=inp[2]
print(s

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,A,B = list(map(int,input().split()))
ans = A*N
if N%(A+B)>=A:
    ans+=A
else: ans+=N%(A+B)
print(ans) 

Failing test case input:
9 -7 17

Expected output:
-7


Actual output:
-70


Fixed submission (verdict: Accepted):
import math
N,A,B = list(map(int,input().split()))
ans = A*(N
if N%(A+B)>=A:
    ans+=A
else: ans+=N%(A+B)
print(ans)

Problem: p02754
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,a,b = list(map(int,input().split()))
k = int(n/(a+b))
l = n%(a+b)
k *=a
if l<b:
    k+=l
else:
    k+=a
print(k)

Failing test case input:
62 -2 40

Expected output:
-4


Actual output:
22


Fixed submission (verdict: Accepted):
n,a,b = list(map(int,input().split()))
ans= (n
rem = n%(a+b)
if rem<a:
    ans+=rem
else:
    ans+=a
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = map(int,input().split())

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

else:
  c = a*n
  print(c)


Failing test case input:
8 1 5

Expected output:
2


Actual output:
8


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

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

else:
  c = a*int(n
  print(c)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())

q,mod=divmod(n,a+b)
print(a*q + mod)


Failing test case input:
96 -5 13

Expected output:
-65


Actual output:
-60


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

q,mod=divmod(n,a+b)
mod=min(mod,a)
print(a*q + mod)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = map(int,input().split())

x = N 

y = N % (A+B)

ans = x + min(A, y)

print(ans)

Failing test case input:
41 8 0

Expected output:
41


Actual output:
42


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())
 
x = A * (N 
 
y = N % (A+B)
 
ans = x + min(A, y)
 
print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, a, b = map(int, input().split())

cnt = 0

cnt += a * n

x = n % (a+b)

if x > a:
    cnt += a
else:
    cnt += x

print(cnt)

Failing test case input:
9 -7 14

Expected output:
-14


Actual output:
-70


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

cnt = 0

cnt += a * (n

x = n % (a+b)

if x > a:
    cnt += a
else:
    cnt += x

print(cnt)