ZhenlongDai/ACPR huggingface dataset:
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = [int(i) for i in input().strip().split()]
res = 0
cnt = 0

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

print(A*q + r)


Failing test case input:
50 -7 14

Expected output:
-56


Actual output:
-48


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):
import math
N,A,B = map(int,input().split())
c = N%(A+B)
p = math.floor(N/(A+B))
print((A*p)+c)

Failing test case input:
32 -13 14

Expected output:
-429


Actual output:
-416


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

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 + q2) * a + mod2
  print(ans)

Failing test case input:
9 -7 14

Expected output:
-14


Actual output:
-5


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

line = round(num / (blue + red))
amari = round(num % (blue + red))

b1 = line * blue


if blue > amari:
    print(b1 + amari)
else:
    print(b1 + blue)

Failing test case input:
189 -3 -1

Expected output:
141


Actual output:
138


Fixed submission (verdict: Accepted):
import math
num, blue, red = map(int, input().split())

line = math.floor(num / (blue + red))
amari = num % (blue + red)

b1 = line * blue


if blue > amari:
    print(b1 + amari)
else:
    print(b1 + blue)

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

a=list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]

ans = math.floor(A*(N/(A+B)))
amari = math.floor(N%(A+B))
if amari <= A:
    ans += amari
else:
    ans += A

print(ans)


Failing test case input:
7 24 -1

Expected output:
7


Actual output:
14


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

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

print(ans)
Problem: p02754
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
def main():
  n, a, b = map(int, input().split())
  total = 0
  
  if n <= a + b:
    print(int(n - b))
  else:
    x = math.floor(n / (a+b))
    total = a * x
    y = n % (a+b)
    if y >= a:
      total += a
    else:
      total += y
      
      
  print(total)
  
  
main()

Failing test case input:
0 2 7

Expected output:
0


Actual output:
-7
0


Fixed submission (verdict: Accepted):
import math
def main():
  n, a, b = map(int, input().split())
  total = 0
  
  
  
  
  x = math.floor(n / (a+b))
  total = a * x
  y = n % (a+b)
  if y >= a:
    total += a
  else:
    total += y
      
      
  print(total)
  
  
main()

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:
9 -7 14

Expected output:
-14


Actual output:
-61


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 (Python (3.4.3), verdict: Wrong Answer):
n, a, b = [int(i) for i in input().split()]
ans = n 
mod = n % (a + b)
print(a * ans + mod)


Failing test case input:
22 22 1

Expected output:
22


Actual output:
506


Fixed submission (verdict: Accepted):
n, a, b = [int(i) for i in input().split()]
ans = (n 
rem = n % (a + b)
ans += min(rem, a)
print(ans)

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)

print(a * x + mod)

Failing test case input:
69 -13 9

Expected output:
221


Actual output:
231


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.4.3), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, A, B = [int(x) for x in input().split()]

    q, r = divmod(N, (A + B))
    ans = q * A
    ans += r

    print(ans)





if __name__ == '__main__':
    main()


Failing test case input:
9 -7 17

Expected output:
-7


Actual output:
9


Fixed submission (verdict: Accepted):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, A, B = [int(x) for x in input().split()]

    q, r = divmod(N, (A + B))
    ans = 0
    ans += q * A
    ans += min(r, A)

    print(ans)





if __name__ == '__main__':
    main()

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

if(a==0):
 A=0

print(A)

Failing test case input:
453 -2 1

Expected output:
904


Actual output:
906


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 (Python (3.8.2), verdict: Wrong Answer):
n,b,r = map(int, input().split())

t = n % (b + r)

if t >= b: print(b)
else: print(t)
  


Failing test case input:
96 -4 9

Expected output:
-80


Actual output:
-4


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

t = n % (b + r)

if t >= b: print(b * int(n
else: print(b * int(n

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20


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

tmp = 0
ans = 0
while 1:
    if tmp+(a+b)>n:
        ans += n%(a+b)
        break
    tmp+=n
    ans += a
print(ans)




Failing test case input:
96 -4 13

Expected output:
-44


Actual output:
2


Fixed submission (verdict: Accepted):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import copy

sys.setrecursionlimit(10**9)
mod = 10**7+9
inf = 10**20


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

if n<=a+b:
    l = n
    p = min(n%(a+b),a)
    print((l*a)+p)
else:
    ans = (n
    ans += min(n%(a+b),a)
    print(ans)

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

Failing test case input:
51 -3 21

Expected output:
-9


Actual output:
9


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

Problem: p02754
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,a,b = map(int,input().split())
x,y = divmod(n,a+b)
print((x*a)+y)


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,y = divmod(n,a+b)
if y > a: y = a
print((x*a)+y)

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 <= a:
    print(n)
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:
96 -4 12

Expected output:
-52


Actual output:
-48


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 = list(map(int,input().split()))
if A == 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print(N - B)

Failing test case input:
189 -3 -1

Expected output:
141


Actual output:
190


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):
import math
N, A, B = (int(x) for x in input().split(' '))
print(A * math.floor(N/(A+B)) + ( N % (A+B)))


Failing test case input:
453 -2 1

Expected output:
904


Actual output:
906


Fixed submission (verdict: Accepted):
import math
N, A, B = (int(x) for x in input().split(' '))
tmp = A * math.floor(N/(A+B))

if ( N % (A+B) ) > A:
  print(tmp+A) 
else:
  print(tmp+( N % (A+B)))

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

Failing test case input:
9 -7 14

Expected output:
-14


Actual output:
135


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
x=(n
y=min(a,n%(a+b))
print(x+y)

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

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

QUO = math.floor(N / (A + B))

if N - (A + B) < A:
  print(QUO * A + N - (A + B))
  
else:
  print(QUO * A + A)
  

Failing test case input:
87 -3 -4

Expected output:
35


Actual output:
36


Fixed submission (verdict: Accepted):
import math

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

QUO = math.floor(N / (A + B))

if N - (A + B) * QUO < A:
  print(QUO * A + N - (A + B) * QUO)
  
else:
  print(QUO * A + A)

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

Failing test case input:
5 12 0

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
n,a,b=map(int,input().split())
p,q=divmod(n,(a+b))
print(p*a + [a,q][q<a])

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
list = input().rstrip().split(" ")
n = int(list[0])
a = int(list[1])
b = int(list[2])
n_num = n / (a + b) 
n_number = int(math.floor(n_num))
b_num1 = math.floor(n_num) * b 
n_amari = n % (a + b) 
b_num2 = n_amari - a 
if b_num2 >= 0:
  b_total = b_num1 + b_num2
else:
  b_total = b_num1
print(b_total)

Failing test case input:
56 18 0

Expected output:
56


Actual output:
0


Fixed submission (verdict: Accepted):
import math
list = input().rstrip().split(" ")
n = int(list[0])
a = int(list[1])
b = int(list[2])
n_num = n / (a + b) 
n_number = int(math.floor(n_num)) 
a_num = n_number * a 
n_amari = n % (a + b) 
n_min_a = n_amari - a 
if n_min_a >= 0:
  a_total = a_num + a
else:
  a_total = a_num + n_amari
print(a_total)
Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, A, B = list(map(int, input().split()))
a = N % (A + B)
x = N - a
if x > A:
    a += A
print(a)

Failing test case input:
8 3 7

Expected output:
3


Actual output:
8


Fixed submission (verdict: Accepted):
N, A, B = list(map(int, input().split()))
x = (N 
a = x * A
x = N - (x * (A + B))
if x >= A:
    a += A
else:
    a += x
print(a)

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

str = input() 
print(str)
print(str.split(' '))

ary = str.split(' ')
N = int(ary[0])
B = int(ary[1])
R = int(ary[2])

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

a = N % (B+R)
ret = math.floor(N / (B+R))*B + (a if a < B else B)
print(ret)  


Failing test case input:
0 -1 12

Expected output:
-1


Actual output:
0 -1 12
['0', '-1', '12']
-1


Fixed submission (verdict: Accepted):
import sys
import math

str = input() 



ary = str.split(' ')
N = int(ary[0])
B = int(ary[1])
R = int(ary[2])

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

a = N % (B+R)
ret = math.floor(N / (B+R))*B + (a if a < B else B)
print(ret)

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

Failing test case input:
453 -2 1

Expected output:
904


Actual output:
906


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

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
x=n
y=n%(a+b)
if b!=0:
  if n-(a+b)<=a:
    print(a*x+n-(a+b))
  else:
    print(a*x+a)
else:
  print(n)

Failing test case input:
9 -7 17

Expected output:
-7


Actual output:
-70


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

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

Failing test case input:
8 3 7

Expected output:
3


Actual output:
8


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
c = 0
d = a+b
if a==0:
    print(0)
else:   
    q, mod = divmod(n, d)
    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())
q, mod = divmod(ｎ, a+b)
print(b * q + min(mod, a))

Failing test case input:
56 18 -1

Expected output:
59


Actual output:
2


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):
import math
from collections import deque
def main():
    n,a,b = tuple([int(t)for t in input().split()])

    if b == 0:
        print(n)
    else:
        print(min(n,a))

if __name__ == "__main__":
    main()

Failing test case input:
8 1 5

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
from collections import deque
def main():
    n,a,b = tuple([int(t)for t in input().split()])

    if b == 0:
        print(n)
    else:
        t = a+b
        res = (n 
        print(res)
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)
else:
  q1, mod1 = divmod(n, (a + b))
  q2, mod2 = divmod(mod1, a)
  ans = q1 * a + q2 + mod2
  print(ans)

Failing test case input:
248 -3 -1

Expected output:
183


Actual output:
186


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

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

if a == 0  or n < (a + b):
    print(a)
elif n <= a:
    print(n)
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:
12 -1 4

Expected output:
-5


Actual output:
-4


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

str = input()

nums = [int(x) for x in str.split(' ')]

ct = nums[0] / (nums[1] + nums[2])
res = nums[0] % (nums[1] + nums[2])

if res > nums[1]:
  res = nums[1]

blue_ball = nums[1] * ct + res

print(math.floor(blue_ball))

Failing test case input:
56 18 -1

Expected output:
59


Actual output:
64


Fixed submission (verdict: Accepted):
import math

str = input()

nums = [int(x) for x in str.split(' ')]

ct = nums[0] / (nums[1] + nums[2])
ct = math.floor(ct)
res = nums[0] % (nums[1] + nums[2])
res = math.floor(res)

if res > nums[1]:
  res = nums[1]

blue_ball = nums[1] * ct + res

print(blue_ball)
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 -7 9

Expected output:
-343


Actual output:
-679


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())
ans = N
R = N%(A+B)
ans += min(R, A)
print(ans)

Failing test case input:
453 -3 1

Expected output:
678


Actual output:
450


Fixed submission (verdict: Accepted):
N, A, B = map(int,input().split())
ans = (N
R = N%(A+B)
ans += min(R, 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_x = 0
  num_a = int(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:
96 -4 13

Expected output:
-44


Actual output:
-42


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

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

print((A * q) + max((mod - B), mod))


Failing test case input:
9 24 -1

Expected output:
9


Actual output:
10


Fixed submission (verdict: Accepted):


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

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

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

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    result = int(N / C) * A + N % C
else:
    result = N

print(result)

Failing test case input:
87 -3 -1

Expected output:
63


Actual output:
62


Fixed submission (verdict: Accepted):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    q, mod = divmod(N, C)
    result = q * A + min(mod, A)
else:
    result = N

print(result)

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

r = 3*math.floor(n/7)
res = n%7
if res>3:
  r += 3
else:
  r += res

print(str(int(r)))

Failing test case input:
8 1 7

Expected output:
1


Actual output:
4


Fixed submission (verdict: Accepted):
import math
n, a, b = map(int, input().split())
 
r = a*math.floor(n/(a+b))
res = n%(a+b)
if res>a:
  r += a
else:
  r += res
 
print(str(int(r)))
Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = [int(n) for n in input().split()]
if A == 0:
    print(0)
else:
    c , d = divmod(N, A+B)
    print(A*c+d)

Failing test case input:
96 -4 9

Expected output:
-80


Actual output:
-75


Fixed submission (verdict: Accepted):
N, A, B = [int(n) for n in input().split()]
if A == 0:
    print(0)
else:
    C, D = divmod(N, A+B)
    print(A*C+min(A, D))

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

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

ans = q * b
if(mod > a):
  ans = q * b + (q - a)

print(ans)

Failing test case input:
13 16 1

Expected output:
13


Actual output:
0


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

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

ans = q * a + min(mod, a)
print(ans)

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

ans=a*n
if n%(a+b)<=a:
    ans+=n%(a+b)
else:
    ans+=a
print(ans)


Failing test case input:
41 8 -1

Expected output:
46


Actual output:
334


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

ans=a*(n

if n%(a+b)<=a:
    ans+=n%(a+b)
else:
    ans+=a
print(ans)

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

Failing test case input:
8 3 7

Expected output:
3


Actual output:
6


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


def main():
    input = sys.stdin.buffer.readline
    n, a, b = map(int, input().split())
    q, mod = divmod(n, a + b)
    print(q * a + mod)


if __name__ == "__main__":
    main()


Failing test case input:
248 -3 -1

Expected output:
183


Actual output:
186


Fixed submission (verdict: Accepted):
import sys


def main():
    input = sys.stdin.buffer.readline
    n, a, b = map(int, input().split())
    if a + b == 0:
        print(0)
    else:
        q, mod = divmod(n, a + b)
        print(q * a + min(mod, a))


if __name__ == "__main__":
    main()

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    q, mod = divmod(N, C)
    result = q * A + mod
else:
    result = N

print(result)

Failing test case input:
2 1 9

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    q, mod = divmod(N, C)
    result = q * A + min(mod, A)
else:
    result = N

print(result)
Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

N, A, B = [int(x) for x in input().split()]

AB = A + B

if AB == 0:
    print(0)
    sys.exit()

ans = A * N 
ans_mod = N % AB 

if ans_mod == 0:
    print(ans)
    sys.exit()

if ans_mod > A:
    ans += A
else:
    ans += ans_mod

print(ans)

Failing test case input:
8 3 7

Expected output:
3


Actual output:
27


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

N, A, B = [int(x) for x in input().split()]

AB = A + B

if AB == 0:
    print(0)
    sys.exit()

ans = A * (N 
ans_mod = N % AB 

if ans_mod == 0:
    print(ans)
    sys.exit()

if ans_mod >= A:
    ans += A
elif ans_mod < A:
    ans += ans_mod

print(ans)

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


Failing test case input:
80 18 0

Expected output:
80


Actual output:
98


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

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

ans = int(A*(N/(A+B)))
amari = int(N%(A+B))
if amari <= A:
    ans += amari
else:
    ans += A

print(ans)


Failing test case input:
80 18 0

Expected output:
80


Actual output:
88


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

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

print(ans)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b=map(int,input().split())
q=n
r=n%(a+b)
print(q*a+min(r,b))

Failing test case input:
40 24 1

Expected output:
39


Actual output:
961


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

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

Failing test case input:
18 12 0

Expected output:
18


Actual output:
222


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

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<b else d*a+m-b)

Failing test case input:
2 -1 2

Expected output:
-3


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=[int(x) for x in input().split()]
a,b = divmod(N,A+B)
print(a*(A+1) if b>A else a*A+b)

Failing test case input:
0 -1 12

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
N,A,B=[int(x) for x in input().split()]
a,b = divmod(N,A+B)
print((a+1)*A if b>A else a*A+b)

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

Failing test case input:
6 4 3

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
N , A , B = (map(int , input().split()))
def divmod_(a ,b):
    q, mod = divmod(a ,b)
    return q, mod
c , d = divmod_(N ,A+B)
if (d - A) > 0:
    d = A
print((c * A) + d)

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

Failing test case input:
51 -3 21

Expected output:
-9


Actual output:
-153


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

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

Failing test case input:
51 -5 21

Expected output:
-20


Actual output:
30


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

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

p, q = divmod(n, a+b)

print(p*(a+b)-p*b+ (q if q <= a else 0))


Failing test case input:
96 -7 9

Expected output:
-343


Actual output:
-336


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

p, q = divmod(n, a+b)

print(p*(a+b)-p*b + (q if q <= a else a))

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


import math

[n, a, b] = map(int, input().split())
total = math.floor(n / (a + b)) * a
total += min(b, (n % (a + b)))
print(total)


Failing test case input:
453 -3 1

Expected output:
678


Actual output:
680


Fixed submission (verdict: Accepted):


import math

[n, a, b] = map(int, input().split())
total = math.floor(n / (a + b)) * a
total += min(a, (n % (a + b)))
print(total)

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

Failing test case input:
9 -7 14

Expected output:
-14


Actual output:
-5


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 (PyPy3 (2.4.0), verdict: Wrong Answer):
n,a,b=map(int,input().split())
x=n
y=n%(a+b)
if n-(a+b)<=a:
  print(a*x+n-(a+b))
else:
  print(a*x+a)



Failing test case input:
0 1 19

Expected output:
0


Actual output:
-20


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

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 + min(N,p))

Failing test case input:
29 12 0

Expected output:
29


Actual output:
353


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 (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:
69 -13 9

Expected output:
221


Actual output:
-897


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())
d=int(N%(A+B))
ans = A*d+min(A,(N%(A+B)))
print(ans)

Failing test case input:
27 2 2

Expected output:
14


Actual output:
8


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

Problem: p02754
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

N, A, B = [int(x) for x in input().split()]

AB = A + B

if AB == 0:
    print(0)
    sys.exit()

ans = A * N 
ans_mod = N % AB 

if ans_mod == 0:
    print(ans)
    sys.exit()

if ans_mod > A:
    ans += A
else:
    ans += ans_mod - B

print(ans)

Failing test case input:
28 21 4

Expected output:
24


Actual output:
587


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

N, A, B = [int(x) for x in input().split()]

AB = A + B

if AB == 0:
    print(0)
    sys.exit()

ans = A * (N 
ans_mod = N % AB 

if ans_mod == 0:
    print(ans)
    sys.exit()

if ans_mod >= A:
    ans += A
elif ans_mod < A:
    ans += ans_mod

print(ans)

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
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(B,AB)


if amari > A:
    amari = A
answer = waru * A + amari

print(answer)

Failing test case input:
96 -13 9

Expected output:
299


Actual output:
26


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

str = input()

nums = [int(x) for x in str.split(' ')]

ct = nums[0] / (nums[1] + nums[2])
res = nums[0] % (nums[1] + nums[2])

blue_ball = nums[1] * ct + res

print(math.floor(blue_ball))

Failing test case input:
453 -3 0

Expected output:
450


Actual output:
453


Fixed submission (verdict: Accepted):
import math

str = input()

nums = [int(x) for x in str.split(' ')]

ct = nums[0] / (nums[1] + nums[2])
ct = math.floor(ct)
res = nums[0] % (nums[1] + nums[2])
res = math.floor(res)

if res > nums[1]:
  res = nums[1]

blue_ball = nums[1] * ct + res

print(blue_ball)

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

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

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

ans = d*a + m

print(ans)



Failing test case input:
27 2 2

Expected output:
14


Actual output:
15


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

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

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

ans = d*a + min(m, a)

print(ans)

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 A == 0 and B == 0:
        return 0
    
    
    sumBlue = A * N 

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

    return sumBlue

if __name__ == "__main__":

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

Failing test case input:
19 12 0

Expected output:
19


Actual output:
228


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):
inp = input().split()
inp = list(map(int, inp))
n, a, b = inp[0], inp[1], inp[2]
div, mod = divmod(n, a+b)
if a == 0:
    print(0)
else:
    if mod < a: print(div*a + mod)
    else: print(div*(a+1))

Failing test case input:
96 -4 12

Expected output:
-52


Actual output:
-36


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

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

if __name__ == "__main__":
    main()


Failing test case input:
48 -13 9

Expected output:
143


Actual output:
156


Fixed submission (verdict: Accepted):
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()
Problem: p02754
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, a, b = map(int, input().split())
ret = 0
ret += a*n
rem = n%(a+b)
ret += min(rem, a)
print(ret)

Failing test case input:
9 24 -1

Expected output:
9


Actual output:
225


Fixed submission (verdict: Accepted):
n, a, b = map(int, input().split())
ret = 0
ret += a*(n
rem = n%(a+b)
ret += min(rem, a)
print(ret)

Problem: p02754
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,a,b = [int(i) for i in input().split()]

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

print(div * a + mod)


Failing test case input:
453 -2 1

Expected output:
904


Actual output:
906


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

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

print(div * a + min(mod,a))

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

if __name__ == "__main__":
    main()


Failing test case input:
248 -3 -1

Expected output:
183


Actual output:
186


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

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

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)
print(q*a + min(mod,a))

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

Failing test case input:
0 1 5

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,A,B=map(int,input().split())
print(N
Problem: p00101
Buggy submission (Python3, verdict: Wrong Answer):
num = int(input())

for i in range(num):
    box = input()
    box.replace("Hoshino", "Hoshina")
    print(box)

Failing test case input:
3
Hoshimo
Hashino
Masayuki Hoshino was the grandspn of Ieyasu Tokugawa.

Expected output:
Hoshimo
Hashino
Masayuki Hoshina was the grandspn of Ieyasu Tokugawa.


Actual output:
Hoshimo
Hashino
Masayuki Hoshino was the grandspn of Ieyasu Tokugawa.


Fixed submission (verdict: Accepted):
num = int(input())

for i in range(num):
    box = input()
    print(box.replace("Hoshino", "Hoshina"))

Problem: p00101
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
s=[input() for i in range(n)]
for i in s:
    if "Hoshino" in i:
        i=i.replace("Hoshino","Hoshina")
for i in s:
    print(i)

Failing test case input:
3
Hoshino
Hashino
Masayuki Hoshino was the grandson of Ieyasu Tokugawa.

Expected output:
Hoshina
Hashino
Masayuki Hoshina was the grandson of Ieyasu Tokugawa.

Actual output:
Hoshino
Hashino
Masayuki Hoshino was the grandson of Ieyasu Tokugawa.


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for i in range(n)]
for i in range(n):
    if "Hoshino" in s[i]:
        s[i]=s[i].replace("Hoshino","Hoshina")
for i in s:
    print(i)

Problem: p00101
Buggy submission (Python3, verdict: Wrong Answer):
var1 = int(input())
str2 = "Hoshino"
str3 = "Hoshina"


for i in range(0, var1):

    str1 = input()
    if str1.find(str2) >= 0:
        str1 = str1.replace(str2, str3)
        print(str1)




Failing test case input:
3
Imsiioo
iatHoni
Masaykuj onohsiH vta htf gr`ndspo fo ufsazG .awaTugpk

Expected output:
Imsiioo
iatHoni
Masaykuj onohsiH vta htf gr`ndspo fo ufsazG .awaTugpk


Actual output:

Fixed submission (verdict: Accepted):
var1 = int(input())
str2 = "Hoshino"
str3 = "Hoshina"


for i in range(0, var1):

    str1 = input()
    if str1.find(str2) >= 0:
        str1 = str1.replace(str2, str3)
    print(str1)

Problem: p00101
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
for i in range(n):
    print(input().replace("Hoshino","hoshina"))

Failing test case input:
3
Hoshimo
Hashino
Masayuki Hoshino was the grandspn of ueyasI Tokugawa.

Expected output:
Hoshimo
Hashino
Masayuki Hoshina was the grandspn of ueyasI Tokugawa.


Actual output:
Hoshimo
Hashino
Masayuki hoshina was the grandspn of ueyasI Tokugawa.


Fixed submission (verdict: Accepted):
n=int(input())
for i in range(n):
    print(input().replace("Hoshino","Hoshina"))
Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):

import math

while 1:
    n = int(input())
    if n == 0:
        break
    max = 0
    min = 9999
    sum = 0
    for i in range(n):
        s = int(input())
        if max < s:
            max = s
        elif min > s:
            min = s
        sum = sum + s
    ans = math.floor((sum - min - max) / (n-2))
    print(ans)

Failing test case input:
3
1100
342
0
5
1
2
10
11
932
5
260
1000
0
200
400
8
297
242
924
363
426
132
402
523
0

Expected output:
342
7
286
375


Actual output:
342
-3325
286
375


Fixed submission (verdict: Accepted):

import math

while 1:
    n = int(input())
    if n == 0:
        break
    max = 0
    min = 9999
    sum = 0
    for i in range(n):
        s = int(input())
        if max < s:
            max = s
        if min > s:
            min = s
        sum = sum + s
    ans = math.floor((sum - min - max) / (n-2))
    print(ans)

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(j)
    
main()


Failing test case input:
3
1010
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
297
242
924
274
5
132
402
361
0

Expected output:
342
7
300
284


Actual output:
1712


Fixed submission (verdict: Accepted):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m))/(n-2)))
    for j in r:
        print(j)

main()

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(res)

main()



Failing test case input:
3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
708
274
283
132
13
523
0

Expected output:
342
7
300
301


Actual output:
342239001817


Fixed submission (verdict: Accepted):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m))/(n-2)))
    for j in r:
        print(j)

main()
Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import math

def main():
    f = true
    r = []
    while f:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(j)


Failing test case input:
3
1001
342
0
5
3
2
2
11
932
5
127
1000
0
200
400
8
353
242
708
274
283
132
402
1038
0

Expected output:
342
5
242
377


Actual output:

Fixed submission (verdict: Accepted):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m))/(n-2)))
    for j in r:
        print(j)

main()

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        print(j)

main()



Failing test case input:
3
1100
342
0
5
1
2
9
11
932
5
260
1000
0
200
400
8
297
202
924
274
283
132
402
523
0

Expected output:
342
7
286
330


Actual output:
342
22
860
2091


Fixed submission (verdict: Accepted):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m))/(n-2)))
    for j in r:
        print(j)

main()

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(sorted(s[1:-1]))
    print(int(ave))

Failing test case input:
3
1000
473
0
5
-1
2
9
11
932
5
300
1100
0
200
685
8
353
143
402
274
283
31
402
523
0

Expected output:
473
7
395
309


Actual output:
473
7
433
255


Fixed submission (verdict: Accepted):
import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(sorted(s)[1:-1])
    print(int(ave))
Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import math

def main():
    f = true
    r = []
    while f:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floeor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(j)


Failing test case input:
3
1000
342
0
5
2
2
9
11
932
5
300
1000
-1
200
400
8
467
242
924
330
283
132
402
523
0

Expected output:
342
7
300
374


Actual output:

Fixed submission (verdict: Accepted):
import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m))/(n-2)))
    for j in r:
        print(j)

main()

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    n = int(input())
    if n == 0:
        exit()
    score = []
    for i in range(n):
        score.append(int(input()))
    print(sum(sorted(score)[1:-1]))

Failing test case input:
3
1000
342
0
5
2
2
9
11
932
5
260
1000
0
200
400
8
297
242
924
274
283
132
86
523
0

Expected output:
342
7
286
291


Actual output:
342
22
860
1751


Fixed submission (verdict: Accepted):
while True:
    n = int(input())
    if n == 0:
        exit()
    score = []
    for i in range(n):
        score.append(int(input()))
    print(sum(sorted(score)[1:-1])

Problem: p00728
Buggy submission (Python3, verdict: Wrong Answer):
import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(s[1:-1])
    print(int(ave))

Failing test case input:
3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
8
435
924
274
5
132
531
980
0

Expected output:
342
7
300
384


Actual output:
342
7
400
383


Fixed submission (verdict: Accepted):
import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(sorted(s)[1:-1])
    print(int(ave))