problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02696
u676091297
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n \na,b,n = map(int,input().split())\ncnt = 0\nt = 0\nif n<=b:\n #print(math.floor(a*n/b))\n exit()\nfor i in range(math.floor(n/b)):\n t = math.floor(a*(b(i+1))/b)-a*i\n #print("a")\n if cnt <= t:\n cnt=t\n \nprint(cnt)', 'import math\n \na,b,n = map(int,input().split())\ncnt = 0\nt = 0\nif n<=b-1:\n print(math.floor(a*n/b))\n# exit()\nelse:\n print(math.floor(a*(b-1)/b))\n']
['Runtime Error', 'Accepted']
['s967910616', 's715845188']
[9112.0, 9104.0]
[21.0, 20.0]
[251, 152]
p02696
u676458682
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from math import floor\nA,B,N=map(int,input().split())\n\nx=N\nresult=[]\nmaxr=0\nfor x in reversed(range(1,N+1)):\n xb=0 if x<B else x/B\n r=A*floor(xb)\n l=floor(A*xb)\n ans=l-r\n result.append(ans)\n if len(result) == 1:\n maxr = ans \n if len(result) > 1 and max(result) == maxr:\n pass\n\nprint(max(result))\n', 'from math import floor\nA,B,N=map(int,input().split())\n\nx=N\nresult=[]\nfor x in reversed(range(1,N+1)):\n ans=floor(A*x/B)-A*floor(x/B)\n result.append(ans)\n if len(result) == 1:\n maxr = ans \n if len(result) > 1 max(result) == maxr:\n pass\n\nprint(max(result))\n', 'from math import floor\nA,B,N=map(int,input().split())\n\nx=min(B-1,N)\n\nprint(floor(A*x/B)-A*floor(x/B))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s351546576', 's976763094', 's143715854']
[9744.0, 9008.0, 9156.0]
[2205.0, 19.0, 21.0]
[331, 281, 102]
p02696
u678505520
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int, input().split())\nM = [0]*b\nfor x in range(0,b):\n M[x] = int(a*x/b) - a*int(x/b)\n\nprint(max(M))', 'a,b,n = map(int, input().split())\nprint(int(a*(b-1)/b)-a*int((b-1)/b))', 'a,b,n = map(int, input().split())\nm = min(n,b-1)\nprint(int(a*m/b)-a*int(m/b))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s019722129', 's322347357', 's204741370']
[9324.0, 9164.0, 9168.0]
[26.0, 20.0, 21.0]
[114, 70, 77]
p02696
u681323954
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\na,b,n=map(int,input().split())\nans=0\nfor x in range(1,b+1):\n tui=math.floor(a*x/b)-a*math.floor(x/b)\n ans=max(ans,tui)\nprint(ans)', 'import math\na,b,n=map(int,input().split())\nans=0\nfor x in range(b):\n tui=math.floor(a*x/b)-a*math.floor(x/b)\n ans=max(ans,tui)\nprint(ans)', 'import math\na,b,n=map(int,input().split())\nc=min(b-1,n)\nprint(math.floor(a*c/b)-a*math.floor(c/b))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s059095744', 's282695783', 's445422808']
[9164.0, 9168.0, 9056.0]
[2205.0, 2205.0, 21.0]
[147, 143, 98]
p02696
u684267998
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = map(int,input().split())\nres = 0\nans = 0\nfor i in range(1,N+1):\n res_bar = math.floor((A*i)/B)-A*math.floor(i/B)\n if res_bar >= res:\n res = res_bar\n ans = i\n else:\n break\n\n \n \nprint(res)\n ', 'A,B,N = map(int,input().split())\nres = 0\nans = 0\nfor i in range(1,N+1):\n res_bar = math.floor((A*i)/B)-A*math.floor(i/B)\n if res_bar > res:\n res = res_bar\n ans = i\nprint(ans)', 'import math\n \na, b, n = map(int, input().split())\nans = 0\ntmp = 0\n \nif n > b - 1:\n n = b-1\n \nans = math.floor(a*n/b) - a*math.floor(n/b)\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s069053956', 's126660036', 's125124795']
[9144.0, 9124.0, 9152.0]
[23.0, 23.0, 20.0]
[243, 194, 152]
p02696
u685983477
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nimport collections\ndef f(a,b,x):\n return math.floor((a*x)/b) - a*math.floor(x/b)\na,b,n=map(int, input().split())\ndd = collections.defaultdict(int)\n\nif(f(a,b,b-1)>0):\n print(f(a,b,b-1))\nelse:\n print(0)\n', 'import math\nimport collections\ndef f(a,b,x):\n return math.floor((a*x)/b) - a*math.floor(x/b)\na,b,n=map(int, input().split())\ndd = collections.defaultdict(int)\nfor i in range(n):\n k = f(a,b,i)\n if(dd[k]==0):\n dd[k]+=1\n print(k)\nif(f(a,b,b-1)>0):\n print(f(a,b,b-1))\nelse:\n print(0)\n', 'import math\nimport collections\ndef f(a,b,x):\n return math.floor((a*x)/b) - a*math.floor(x/b)\na,b,n=map(int, input().split())\n\nprint(f(a,b,b-1))\n', 'import math\nimport collections\ndef f(a,b,x):\n return math.floor((a*x)/b) - a*math.floor(x/b)\na,b,n=map(int, input().split())\ndd = collections.defaultdict(int)\n\nprint(f(a,b,min(b-1,x)))\n', 'import math\nimport collections\ndef f(a,b,x):\n return math.floor((a*x)/b) - a*math.floor(x/b)\na,b,n=map(int, input().split())\ndd = collections.defaultdict(int)\n\nprint(f(a,b,min(b-1,n)))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s035381143', 's515451759', 's735682827', 's809648575', 's081285437']
[9304.0, 10116.0, 9356.0, 9376.0, 9380.0]
[30.0, 2213.0, 30.0, 30.0, 33.0]
[222, 305, 147, 188, 188]
p02696
u687553041
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import sys\nimport math\n\nif __name__ == '__main__':\n a, b, n = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))\n old = 0\n x = b - 1\n print(math.floor(a*x/b)-a*math.floor(x/b))", "import sys\nimport math\n\nif __name__ == '__main__':\n a, b, n = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))\n old = 0\n if 0 <= b-1 and b-1 <= n:\n x = b - 1\n print(math.floor(a*x/b)-a*math.floor(x/b))\n else:\n x = n\n print(math.floor(a*x/b)-a*math.floor(x/b))"]
['Wrong Answer', 'Accepted']
['s213374778', 's670163377']
[9180.0, 9132.0]
[20.0, 22.0]
[198, 311]
p02696
u687574784
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = list(map(int, input().split()))\ndef f(x):\n return a*x//b - a*(x//b)\n\nleft=1\nright=n\nfor _ in range(100):\n delta=(right-left)/3\n midl=left+delta\n midr=midl+delta\n\n if f(midl)>f(midr):\n right=midr\n else:\n left=midl\nprint(max(f(int(midl)),f(min(int(midl)+1),n)))', 'a,b,n = list(map(int, input().split()))\ndef f(x):\n return a*x//b - a*(x//b)\n\nleft=1\nright=n\nfor _ in range(100):\n delta=(right-left)/3\n midl=left+delta\n midr=midl+delta\n\n if f(midl)>f(midr):\n right=midr\n else:\n left=midl\nprint(max(f(int(midl)),f(min(int(midl)+1,n))))']
['Runtime Error', 'Accepted']
['s758053075', 's819688984']
[9076.0, 9196.0]
[24.0, 22.0]
[363, 363]
p02696
u688858450
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math as m\nA, B, N = map(int, input().split())\nprint(m.floor(A * -1 / B) - A * m.floor(-1 / B))', 'import math as m\nA, B, N = map(int, input().split())\nif N >= B: print(m.floor(A * -1 / B) - A * m.floor(-1 / B))\nelse: print(m.floor(A * N / B) - A * m.floor(N / B))']
['Wrong Answer', 'Accepted']
['s922069691', 's944232569']
[9008.0, 9076.0]
[24.0, 22.0]
[101, 165]
p02696
u689890477
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nx = int(input())\nm = 100\ncount = 0\nwhile(m<x):\n m += math.floor(m/100)\n count += 1\nprint(count)', 'import math\na,b,n = map(int,input().split())\nif n <= b-1:\n print(math.floor(a*n/b))\nelse:\n print(math.floor(a*(b-1)/b))']
['Runtime Error', 'Accepted']
['s396864826', 's289096742']
[9104.0, 9156.0]
[22.0, 20.0]
[113, 125]
p02696
u690536347
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nans = 0\nfor x in range(N-B, N+1):\n ans = max(ans, (A*x)//B-A*(x//B))\nprint(ans)', 'A, B, N = map(int, input().split())\nans = 0\nx = min(B-1, N)\nprint((A*x)//B-A*(x//B))\n']
['Wrong Answer', 'Accepted']
['s018577089', 's637485120']
[9164.0, 9132.0]
[2205.0, 21.0]
[119, 85]
p02696
u692311686
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA,B,N=map(int,input().split())\nx=min(B-1,N)\nans=math.ceil(A*x/B)-math.ceil(x/B)*A\nprint(ans)\n\n', 'import math\nA,B,N=map(int,input().split())\nx=min(B-1,N)\nans=math.ceil(A*x/B)-A*math.ceil(x/B)\nprint(int(ans))\n\n', 'import math\nA,B,N=map(int,input().split())\nx=min(B-1,N)\nans=math.floor(A*x/B)-A*math.floor(x/B)\nprint(int(ans))\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s385951925', 's787200562', 's447039216']
[9160.0, 9164.0, 9164.0]
[21.0, 21.0, 23.0]
[106, 111, 113]
p02696
u692746605
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\nA,B,N=map(int,input().split())\nprint(math.floor(A/B*(~-B/B if B>N else N)))\n', 'import math\n\nA,B,N=map(int,input().split())\nprint(math.floor(A/B*(~-B if N>=B else N)))\n']
['Wrong Answer', 'Accepted']
['s569230370', 's795656402']
[9156.0, 8992.0]
[20.0, 22.0]
[89, 88]
p02696
u693007703
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA, B, N = [int(i) for i in input().split()]\n\nmax_n = 0\noutput = 0\nmemo = set()\nfor x in range(1,B+1):\n f = math.floor((A*x)/B) - (A* math.floor(x/B))\n if f > max_n:\n max_n = f\n output = x\nprint(output)', 'import math\nA, B, N = [int(i) for i in input().split()]\n\ndef floor_calc(x):\n return math.floor((A * x)/B) - (A * math.floor(x / B))\n\nx = min(B-1,N)\n\nprint(floor_calc(x))']
['Wrong Answer', 'Accepted']
['s325311150', 's394822675']
[9040.0, 9160.0]
[2205.0, 20.0]
[233, 172]
p02696
u693048766
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N=map(int,input().split())\nimport math\ndef f(x):\n return math.floor(A*x/B) - A*math.floor(x/B)\n\nans = 0\nfor i in range(0, N//B+1):\n ans = max(ans, f(B*i-1))\nans = max(ans, f(N))\n#print(f(N))\nprint(ans)', '\nA,B,N=map(int,input().split())\nimport math\ndef f(x):\n return math.floor(A*x/B) - A*math.floor(x/B)\n\nans = []\nfor i in range(0, N//B+1):\n ans.append(f(B*i-1))\nans.append(f(N))\n#print(f(N))\nprint(max(ans))', '\nA,B,N=map(int,input().split())\nimport math\ndef f(x):\n return math.floor(A*x/B) - A*math.floor(x/B)\n\n\nprint(f(min(B-1,N)))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s257364499', 's393956249', 's440365905']
[9168.0, 41560.0, 9052.0]
[2206.0, 2207.0, 24.0]
[211, 210, 125]
p02696
u696444274
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from fractions import gcd\nfrom functools import reduce\n# from collections import deque\n# from math import factorial\n# import collections\nimport math\nimport sys\nsys.setrecursionlimit(2000000)\n# import itertools\n# import statistics\n# import numpy as np\n# x = int(input())\na, b, n = list(map(int, input().split()))\n# a, b = list(map(int, input().split()))\n# sy, sx = map(int, input().split())\n# gy, gx = map(int, input().split())\n\nans = a*n//b - a*(n//b)\ncount = 0\nsame = 0\n# print(ans)\nfor i in range(n, int(pow(n, 0.75))-1, -1):\n if ans < a*i//b - a*(i//b):\n ans = a*i//b - a*(i//b)\n if count == 1:\n print(ans)\n exit()\n elif a*i//b - a*(i//b) == 0:\n count += 1\nprint(ans)', 'import math\nimport sys\nsys.setrecursionlimit(2000000)\n\na, b, n = list(map(int, input().split()))\n\nans = a*n//b - a*(n//b)\nprint(ans)\nfor i in range(n, int(math.sqrt(n)), -1):\n if ans < a*i//b - a*(i//b):\n ans = a*i//b - a*(i//b)\n #print(ans, end=" ")\n #print(a*i//b - a*(i//b))\n\nprint(ans)\n', 'a, b, n = list(map(int, input().split()))\n\nx = min(b-1, n)\nans = a*x//b - a*(x//b)\n\nprint(ans)\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s535686483', 's853325442', 's533890279']
[10680.0, 9124.0, 9100.0]
[2206.0, 2205.0, 21.0]
[719, 306, 95]
p02696
u697386253
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nsys.setrecursionlimit(10**7)\na,b,n = map(int, input().split())\n\ndef num(x):\n return (a*x)//b - a*(x//b)\n\nma = num(1)\n\nfor i in range(2, n+1):\n if num(i) > ma:\n ma = num(i)\n else:\n if num(i) >= num(i-1):\n print(ma)\n exit()\nprint(ma)', 'a,b,n = map(int, input().split())\n\nx = min(b-1, n)\nprint(int(a*x/b) - a*int(x/b))']
['Runtime Error', 'Accepted']
['s874710511', 's466477083']
[8976.0, 9152.0]
[20.0, 20.0]
[279, 82]
p02696
u698919163
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = map(float,input().split())\n\nif N%B == 0:\n tmp = (N//B)*B + (N%B)\n print(int(A*(tmp-1)/B) - A*int((tmp-1)/B))\nelse:\n tmp = (N//B)*B + (N%B)\n print(int(A*(tmp)/B) - A*int((tmp)/B))', 'A,B,N = map(int,input().split())\n\ntmp = min(B-1,N)\n\nprint(int(A*(tmp)/B) - A * int(tmp/B))']
['Wrong Answer', 'Accepted']
['s524625556', 's570398826']
[9124.0, 9164.0]
[20.0, 20.0]
[198, 90]
p02696
u699296734
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n=map(int,input().split())\nres=0\nx=n\nfor x in range(min(b,n+1,1000000)):\n res=max(res,int(a*x/b)-a*int(x/b))\n print(res)', 'def fanc():\n a,b,n=map(int,input().split())\n x=min(b-1,n)\n max_res=int(a*x/b)-a*int(x/b)\n print(max_res)\n \nif __name__=="__main__":\n fanc()']
['Wrong Answer', 'Accepted']
['s762669857', 's332729456']
[9332.0, 9124.0]
[807.0, 24.0]
[130, 145]
p02696
u702582248
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\nprint(a * (b-1) // b))', 'a, b, n = map(int, input().split())\nprint(a * (b-1) // b)\n', 'a, b, n = map(int, input().split())\nprint(a * min((b-1), n) // b)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s016377964', 's132237388', 's361844718']
[9024.0, 9072.0, 9144.0]
[21.0, 23.0, 25.0]
[58, 58, 66]
p02696
u704284486
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\ninput = sys.stdin.readline\n\ndef main():\n a,b,n = map(int,input().split())\n l = gcd(a,b)\n print(a*min(n,(b-1))//b-a*(min(b-1,n)//b))\n\nif __name__ == "__main__":\n main()', 'import sys\ninput = sys.stdin.readline\n\ndef main():\n a,b,n = map(int,input().split())\n print(a*min(n,(b-1))//b-a*(min(b-1,n)//b))\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s962448038', 's022383277']
[9180.0, 9176.0]
[19.0, 23.0]
[190, 173]
p02696
u707808519
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nx = max(N, B-1)\nans = (A*x)//B - A*(x//B)\nprint(ans)', 'A, B, N = map(int, input().split())\n\nx = B - 1\nans = (A*x)//B-A*(x//B)\n\nprint(ans)', 'A, B, N = map(int, input().split())\nx = min(N, B-1)\nans = (A*x)//B - A*(x//B)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s117596390', 's531716563', 's367633676']
[9120.0, 9032.0, 9056.0]
[22.0, 23.0, 25.0]
[88, 82, 88]
p02696
u708255304
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nfrom copy import deepcopy\nsys.setrecursionlimit(10**7)\n\n\ndef dfs(now):\n global ans\n if len(now) == N:\n tmp_ans = 0\n for a, b, c, d in query:\n a -= 1\n b -= 1\n if now[b] - now[a] == c:\n tmp_ans += d\n ans = max(tmp_ans, ans)\n else:\n for i in range(now[-1], M+1):\n tmp = deepcopy(now)\n tmp.append(i)\n dfs(tmp)\n\n\nN, M, Q = map(int, input().split()) \nquery = [list(map(int, input().split())) for _ in range(Q)]\n\nA = [1]\nans = 0\ndfs(A)\nprint(ans)\n', 'A, B, N = map(int, input().split())\nans = int(A*(min(N, B-1)/B))-A*int(min(N, B-1)/B)\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s706074392', 's544568963']
[9232.0, 9072.0]
[26.0, 20.0]
[612, 97]
p02696
u708890186
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\na,b,n=map(int,input().split())\nans=0\nfor i in range(1,b):\n tmp=math.floor(a*i/b)+a*math.floor(i/b)\n if tmp > ans:\n ans=tmp\nprint(ans)', 'import math\nA,B,N=map(int,input().split())\ncnt=math.floor(A*(B-1)/B)\nfor i in range(B,N+1):\n tmp=math.floor(A*i/B)+A*math.floor(i/B)\n if cnt<tmp:\n cnt=tmp\nprint(cnt)', 'import math\na,b,n=map(int,input().split())\nans=0\nfor i in range(b+1):\n tmp=math.floor(a*i/b)+a*math.floor(i/b)\n if tmp > ans:\n ans=tmp\nprint(ans)\n', 'import math\na,b,n=map(int,input().split())\nc=min(b-1,n)\nf=math.floor(a*c/b)\nprint(f)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s116664172', 's257506113', 's475354907', 's016304383']
[9004.0, 9180.0, 9028.0, 9012.0]
[2205.0, 2205.0, 2206.0, 22.0]
[150, 170, 151, 84]
p02696
u714732628
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = list(input().split())\nA = float(A)\nB = float(B)\nN = int(N)\n\ntmp_pre = 0\nfor i in range(1, N+1):\n tmp = math.floor(A*i/B) - A*math.floor(i/B)\n if tmp > tmp_pre:\n tmp_pre = tmp\nprint(int(tmp_pre))', 'A, B, N = list(map(int, input().split()))\n\nif B==1:\n print(0)\nelse:\n tb = B - 1\n tp_pre = 0\n while(True):\n tp = (A*tb)//B - A*(tb//B)\n if tp > tp_pre:\n tp_pre = tp\n tb += B\n if tb > N:\n break\n if (B > N):\n print((A*N)//B - A*(N//B))\n else:\n print(int(tp_pre))']
['Runtime Error', 'Accepted']
['s897183366', 's801060379']
[9192.0, 9200.0]
[21.0, 21.0]
[209, 293]
p02696
u716530146
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["#!/usr/bin/env python3\nimport sys, math, itertools, collections, bisect\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\ninf = float('inf') ;mod = 10**9+7\nmans = inf ;ans = 0 ;count = 0 ;pro = 1\n\na,b,n = map(int,input().split())\nif b-1 >= n:\n x = b-1\nelse:\n x = n\nprint((a*x//b)-(a*(x//b)))", "#!/usr/bin/env python3\nimport sys, math, itertools, collections, bisect\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\ninf = float('inf') ;mod = 10**9+7\nmans = inf ;ans = 0 ;count = 0 ;pro = 1\n\na,b,n = map(int,input().split())\nif b-1 <= n:\n x = b-1\nelse:\n x = n\nprint((a*x//b)-(a*(x//b)))"]
['Wrong Answer', 'Accepted']
['s483603912', 's823088841']
[9524.0, 9476.0]
[24.0, 21.0]
[312, 312]
p02696
u716660050
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N=map(int,input().split())\nprint(min(B-1,N))', 'A,B,N=map(int,input().split())\nprint(max(B-1,N))', 'A,B,N=map(int,input().split())\nmax(B-1,N)', 'A,B,N=map(int,input().split())\ndef f(x):return int(A*x/B)-A*int(x/B)\nprint(f(min(B-1,N)))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s345397853', 's431560181', 's621480565', 's501899459']
[9152.0, 9032.0, 9116.0, 9112.0]
[27.0, 26.0, 23.0, 30.0]
[48, 48, 41, 89]
p02696
u724687935
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nsys.setrecursionlimit(10 ** 6)\n\n\ndef dfs(num):\n global N, ans, M\n n = len(num)\n if n == N:\n cnt = 0\n for a, b, c, d in con:\n a -= 1; b -= 1\n if num[b] - num[a] == c:\n cnt += d\n ans = max(ans, cnt)\n else:\n e = 1 if n == 0 else num[-1]\n for i in range(e, M + 1):\n dfs((*num, i))\n\n\nN, M, Q = map(int, input().split())\ncon = [tuple(map(int, input().split())) for _ in range(Q)]\n\nans = 0\ndfs(tuple())\n\nprint(ans)\n', 'import math\n\n\ndef f(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x / B)\n\n\ndef main(A, B, N):\n if N < B:\n return f(A, B, N)\n else:\n return f(A, B, B - 1)\n\n\nA, B, N = map(int, input().split())\nprint(main(A, B, N))\n']
['Runtime Error', 'Accepted']
['s253736141', 's810439397']
[9072.0, 8940.0]
[23.0, 28.0]
[514, 247]
p02696
u725993280
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\n\nmax = (a*2)//b - a*(2//b)\n\nfor i in range(n,2):\n if (a*i)//b - a*(i//b) >= max:\n max = (a*i)//b - a*(i//b)\n\nprint(max)', 'a,b,n = map(int,input().split())\n\nif n >= b-1:\n x = b-1\nelse:\n x = n\n\nans = (a*x)//b - a*(x//b)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s064901184', 's370794472']
[9048.0, 9168.0]
[21.0, 27.0]
[162, 112]
p02696
u727980193
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from math import floor\nA,B,N=list(map(int,input().split()))\nans = floor(1/B)\nprint(ans)', 'from math import floor\nA,B,N=list(map(int,input().split()))\nx=min((B-1),N)\nans=floor(A*x/B)-A*floor(x/B)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s511920969', 's959350966']
[9104.0, 9164.0]
[21.0, 22.0]
[87, 115]
p02696
u731322489
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\nprint(min(n, b - 1))', 'a, b, n = map(int, input().split())\nx = min(n, b - 1)\nprint(((a * x) // b) - (a * (x // b)))']
['Wrong Answer', 'Accepted']
['s471307032', 's322357199']
[9096.0, 9080.0]
[21.0, 23.0]
[56, 92]
p02696
u732870425
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\n\nprint(A * min(B-1, N) / B // 1)', 'A, B, N = map(int, input().split())\n\nprint(min(B-1, N))', 'A, B, N = map(int, input().split())\n\nprint(int(A * min(B-1, N) / B // 1))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s475745064', 's738432143', 's114742969']
[9160.0, 9060.0, 9136.0]
[25.0, 24.0, 24.0]
[68, 55, 73]
p02696
u734195782
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['#include <stdio.h>\n\nint main(void){\n long long int a,b,n;\n scanf("%lld %lld %lld",&a,&b,&n);\n printf("%lld\\n",(a*(n-1))/b-a*((n-1)/b));\n return 0;\n}', 'a,b,n=(int(x) for x in input().split())\nn = min(b-1,n)\nprint((a*n)//b-a*(n//b))']
['Runtime Error', 'Accepted']
['s280843305', 's664714050']
[8884.0, 9112.0]
[20.0, 21.0]
[160, 79]
p02696
u737135713
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\n\nif n//b > 0:\n z = b-1\nelse:\n z = n\n\nd = ((a*z)/b)//1\ne = a*((z/b)//1)\ny = d - e\nprint(y)', 'import math\n\na,b,n = map(int,input().split())\n\nif n//b > 0:\n z = b-1\nelse:\n z = n\n\nd = ((a*z)/b)//1\ne = a*((z/b)//1)\ny = d - e\nv = math.floor(y)\nprint(v)']
['Wrong Answer', 'Accepted']
['s278141933', 's073063817']
[9164.0, 9160.0]
[23.0, 21.0]
[124, 155]
p02696
u737298927
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\na, b, n = map(int, input().split())\n\nif n >= b:\n x = b-1\nelse:\n x = b\n\nprint(a*x//b-a*(x//b))', '#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\na, b, n = map(int, input().split())\n\n\ndef f(x):\n return a*x//b-a*(x//b)\n\nhigh = n\nlow = 0\nwhile high - low > 0.000000001:\n print(high, low)\n mid_left = high/3+low*2/3\n mid_right = high*2/3+low/3\n if f(mid_left) <= f(mid_right):\n low = mid_left\n else:\n high = mid_right\nprint(f(int(high)))\n', '#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n \na, b, n = map(int, input().split())\n \nif n >= b:\n x = b-1\nelse:\n x = n\n \nprint(a*x//b-a*(x//b))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s066916192', 's883169342', 's451216258']
[9132.0, 33004.0, 9068.0]
[23.0, 2257.0, 20.0]
[146, 368, 149]
p02696
u744695362
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
[',b,n=map(int, input().split())\nlist =[]\nfor x in range(n+1) :\n list.append(int(a*x/b) - a* int(x/b))\nprint(max(list))\n', 'import numpy as np\na,b,n=map(int, input().split())\nc = np.array([])\nfor x in range(n+1) :\n c = np.append(c,int(a*x/b)-a* int(x/b))\n \nprint(np,max(c))', 'a,b,n = map(int, input().split())\nx = (b-1,n)\nprint(int(a*x/b))', 'import numpy as np\na,b,n=map(int, input().split())\nc = np.array([])\nfor x in range(n+1) :\n c = np.append(c,int(a*x/b)-a* int(x/b))\nprint(np.max(c))', 'a,b,n = map(int, input().split())\nx = min(b-1,n)\nprint(int(a*x/b))']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s229060193', 's244308039', 's391661295', 's964650074', 's383183776']
[8948.0, 27920.0, 24312.0, 27880.0, 9160.0]
[24.0, 2206.0, 30.0, 2206.0, 20.0]
[121, 156, 63, 151, 66]
p02696
u747391638
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int, input().split(" "))\n\ndef floor(x):\n return ((a*x/b)//1) - a*((x/b)//1)\n\nans = floor(max(b-1,n))\n\nprint(int(ans))', 'a,b,n = map(int, input().split(" "))\n\ndef floor(x):\n return ((a*x/b)//1) - a*((x/b)//1)\n\nans = max(floor(b-1),floor(n))\n\nprint(ans)\n', 'a,b,n = map(int, input().split(" "))\n\ndef floor(x):\n return ((a*x/b)//1) - a*((x/b)//1)\n\nans = max(floor(b-1),floor(n))\n\nprint(int(ans))', 'a,b,n = map(int, input().split(" "))\n\ndef floor(x):\n return ((a*x/b)//1) - a*((x/b)//1)\n\nans = floor(min(b-1,n))\n\nprint(int(ans))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s016584178', 's098795961', 's934026036', 's852039160']
[9092.0, 8932.0, 9108.0, 9060.0]
[21.0, 24.0, 24.0, 23.0]
[132, 135, 139, 132]
p02696
u751843916
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n=map(int,input().split())\nm=0\nfor x in range(b-50000,b+1):\n if x<0:continue\n m=max(int(a*(x-1)/b)-a*int((x-1)/b),int(a*x/b)-a*int(x/b))\nprint(m)', 'a,b,n=map(int,input().split())\np=int(a*n/b)-a*int(n/b)\nq=int(a*(b-1)/b)-a*int((b-1)/b)\nprint(p if b-1>n else q)']
['Wrong Answer', 'Accepted']
['s606125216', 's742226228']
[9056.0, 9008.0]
[87.0, 21.0]
[155, 111]
p02696
u758884263
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import numpy as np\n\ndef fLOOR(a,b,x):\n return np.floor(a * x / b) - a * np.floor(x / b)\n"""\ndef fLOOR1(a,b,x):\n return np.floor(a * x / b)\n\ndef fLOOR2(a,b,x):\n return np.floor(x / b)\n"""\ndef main():\n a,b,n = map(int, input().split(" "))\n \n """\n for x in range(n):\n x += 1\n val = fLOOR(a,b,x)\n val1 = fLOOR1(a,b,x)\n val2 = fLOOR2(a,b,x)\n print(val)\n """\n if b <= n:\n ans = fLOOR(a,b,b-1)\n else:\n ans = fLOOR(a,b,n)\n print(ans)\n\nif __name__ == \'__main__\':\n main()', 'import numpy as np\n\ndef fLOOR(a,b,x):\n return np.floor(a * x / b) - a * np.floor(x / b)\n"""\ndef fLOOR1(a,b,x):\n return np.floor(a * x / b)\n\ndef fLOOR2(a,b,x):\n return np.floor(x / b)\n"""\ndef main():\n a,b,n = map(int, input().split(" "))\n \n """\n for x in range(n):\n x += 1\n val = fLOOR(a,b,x)\n val1 = fLOOR1(a,b,x)\n val2 = fLOOR2(a,b,x)\n print(val)\n """\n if b <= n:\n ans = fLOOR(a,b,b-1)\n else:\n ans = fLOOR(a,b,n)\n print(int(ans))\n\nif __name__ == \'__main__\':\n main()']
['Wrong Answer', 'Accepted']
['s724814053', 's910674789']
[27140.0, 27120.0]
[109.0, 103.0]
[546, 551]
p02696
u759651152
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["#-*-coding:utf-8-*-\n\ndef main():\n a, b, n = map(int, input().split())\n if b - 1 > n:\n ans = (a * (b - 1)) // b\n else:\n ans = (a * n) // b\n print(ans)\n \nif __name__ == '__main__':\n main()", "#-*-coding:utf-8-*-\n\ndef main():\n a, b, n = map(int, input().split())\n ans = (a * min(b-1, n) // b)\n print(ans)\n \nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s966111706', 's933251080']
[9104.0, 9108.0]
[22.0, 21.0]
[218, 163]
p02696
u760831084
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nans = []\ncnt = 0\n\nfor i in reversed(range(N-B+1, N+1)):\n ans.append((A * i // B) - A * (i // B))\n cnt += 1\n if cnt >= 10:\n break\n\nprint(max(ans))', 'import math\n\nA, B, N = map(int, input().split())\nx = min(B-1, N)\nans = math.floor(A * (x % B) / B)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s480801376', 's170893439']
[9212.0, 9164.0]
[22.0, 19.0]
[197, 109]
p02696
u762755436
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\nA,B,N = map(int,input().split())\nif A>B:\n print( math.floor(A*N/B) - A * math.floor(N/B))\n exit()\nans =0\nfor x in range(1,B):\n num = math.floor(A*x/B) - A * math.floor(x/B)\n if num > ans:\n ans = num\nprint(ans)', 'import math\n\nA,B,N = map(int,input().split())\nif A>B:\n print(N)\n exit()\nans =0\nfor x in range(1,B):\n num = math.floor(A*x/B) - A * math.floor(x/B)\n if num > ans:\n ans = num\nprint(ans)', 'A,B,N =map(int,input().split())\nans =0\nfor x in range(1,N+1):\n num = math.floor(A*x/B) - A * math.floor(x/B)\n if num > ans:\n ans = num\n\nprint(ans)', 'import math\n\nA,B,N = map(int,input().split())\nif B>N:\n print( math.floor(A*N/B) - A * math.floor(N/B))\n exit()\nprint( math.floor(A*(B-1)/B) - A * math.floor((B-1)/B))']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s189954619', 's847557323', 's993272827', 's082818869']
[9124.0, 9004.0, 9176.0, 9128.0]
[2205.0, 2205.0, 24.0, 21.0]
[229, 190, 151, 168]
p02696
u763383823
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nfrom math import floor\ninput = sys.stdin.readline\na,b,n = map(int,input().split())\nli = []\nappend = li.append\n \n#for x in range(n+1):\n# append(int((a*(x))/b) - a * int(x/b))\n#print(max(li))\ndef f(x):\n return floor((a*(x))/b) - a * floor(x/b) \nli = [f(x) for x in range(n+1)]\nprint(li)\nif max(li) > n:\n print(0)\nelse:\n print(max(li))', 'import math\na,b,n = map(int,input().split())\n#li = []\n \n#for x in range(n+1):\nans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))\n\n \n#print(max(li))\nif max(li) > n:\n print(0)\nelse:\n print(max(li))\n', 'import math\n \nA, B, N = map(int, input().split())\n \n \nans1 = 0\n \nif N > B - 1:\n x = B-1\n print(int((A * x) / B) - A * int(x / B))\nelif N <= B - 1:\n x = N\n print(int((A * x) / B) - A * int(x / B))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s531112815', 's631609845', 's621482039']
[72416.0, 9116.0, 9124.0]
[2207.0, 22.0, 26.0]
[355, 205, 207]
p02696
u764215612
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\nans = 0\nfor i in range(int(b/a), n+1):\n if ans < int(a*i/b)-a*int(i/b);\n ans = ans, int(a*i/b)-a*int(i/b)\n else:\n break\nprint(ans)', 'a, b, n = map(int, input().split())\nans = 0\ne = min(n+1,b)\ns = max(int(b/a),e-1000)\nfor i in range(s, e):\n x = (int(a*i/b)-a*int(i/b))\n if ans < x:\n ans = x\nprint(ans)']
['Runtime Error', 'Accepted']
['s842094970', 's682619652']
[8900.0, 9192.0]
[26.0, 22.0]
[174, 172]
p02696
u764501786
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(A / B * x) - A * math.floor(x / B) \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n maxM = calcM(A, B, N)\n max_x = max(list(filter(lambda x: (x + 1) % B == 0, range(N+1-B, N+1))), default=N)\n # print('max_x:', max_x)\n return max(maxM, calcM(A, B, max_x))\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n", "\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(A / B * x) - A * math.floor(x / B) \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n maxM = calcM(A, B, N)\n\n k, r = divmod(N, B)\n # if k:\n \n maxM = max(maxM, calcM(A, B, k * B - 1))\n # if r == 0:\n # maxM = max(maxM, calcM(A, B, N - 1))\n\n\n return maxM\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n", "\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(A / B * x) - A * math.floor(x / B) \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n maxM = calcM(A, B, N)\n if B < N:\n max_x = max(list(filter(lambda x: (x + 1) % B == 0, range(N-B, N+1))), default=N)\n # print('max_x:', max_x)\n return max(maxM, calcM(A, B, max_x))\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n", "\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(A / B * x) - A * math.floor(x / B) \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n maxM = calcM(A, B, N)\n max_x = max(list(filter(lambda x: (x + 1) % B == 0, range(N-B, N+1))), default=N)\n # print('max_x:', max_x)\n return max(maxM, calcM(A, B, max_x))\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n", "\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(A / B * x) - A * math.floor(x / B) \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n maxM = calcM(A, B, N)\n\n \n # if k and B * k -1 <= N:\n \n maxM = max(maxM, calcM(A, B, B - 1))\n # if r == 0:\n # maxM = max(maxM, calcM(A, B, N - 1))\n\n \n\n\n return maxM\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n", "\n\n\n\n\n\n# floor(Ak + Ar) = M + A floor(k + r)\n\n# floor(Ar) = M\n\n# r = x / B - k\n# M = floor(A * (x / B - k))\n\n\n\n\n# A B N\n# 5 7 4\n\n# M = floor(5/7 * x) - 5 * (x // 7)\n\n\n# A B N \n# 11 10 9\n# M = floor(11 / 10 * x) - 11 * (x // 10)\n\nimport math\n\ndef calcM(A, B, x):\n return math.floor(x / B * A) - int(math.floor(x / B)) * A \n\ndef resolve_v1(A, B, N):\n maxM = 0\n for x in range(N+1): # O(N)\n M = calcM(A, B, x)\n maxM = max(maxM, M)\n\n return maxM\n\ndef resolve_v2(A, B, N):\n # x == kB - 1\n maxM = calcM(A, B, N)\n\n for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): \n maxM = max(maxM, calcM(A, B, x))\n return maxM\n\n\ndef resolve_v3(A, B, N):\n return calcM(A, B, min(N, B - 1))\n\nif __name__ == '__main__':\n A, B, N = map(int, input().split())\n M = resolve_v3(A, B, N)\n print(M)\n\n\n"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s011874371', 's135167339', 's235490121', 's312477783', 's327869786', 's431712983']
[9104.0, 9172.0, 9276.0, 9192.0, 9224.0, 9156.0]
[2205.0, 22.0, 2206.0, 2205.0, 22.0, 21.0]
[1265, 1300, 1281, 1263, 1357, 1124]
p02696
u767664985
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\n\nif N < B:\n print((A*N)//B)\n\nans = 0\nfor x in range(N+1):\n fir = (A*x)//B\n sec = x//B\n ans = max(ans, fir - A * sec)\n\n \n if ans == B-1:\n break\n\nprint(ans)\n', 'A, B, N = map(int, input().split())\n\nif N < B:\n print((A*N)//B)\nelse:\n qa, ra = divmod(A, B)\n rx = B-1\n print(qa*rx + (ra*rx)//B)\n']
['Wrong Answer', 'Accepted']
['s335142312', 's649488812']
[9112.0, 9168.0]
[2205.0, 24.0]
[230, 142]
p02696
u767995501
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\nA, B, N = map(int, input().split())\n\ni = 1\nmaxnum = 1\nwhile i <= N:\n if ((A * (i-1) // B) - A * ((i-1) // B)) < ((A * (i) // B) - A * ((i) // B)):\n maxnum = ((A * (i) // B) - A * ((i) // B))\n i = i + 1\n\nprint(maxnum)\n', 'import math\n\nA, B, N = map(int, input().split())\n\ni = 1\nmaxnum = 1\nwhile i <= N:\n if (math.floor(A * (i-1) // B) - A * ((i-1) // B)) < math.floor((A * (i) // B) - A * ((i) // B)):\n maxnum = math.floor((A * (i) // B) - A * ((i) // B))\n i = i + 1\n\nprint(maxnum)\n', 'a, b, n = list(map(int, input().split()))\nx = min(b - 1, n)\nans = int(a * x / b)\nprint(ans)\n\n']
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s104749931', 's368862561', 's310614521']
[9088.0, 9192.0, 9048.0]
[2206.0, 2205.0, 23.0]
[247, 277, 93]
p02696
u769870836
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,c=map(float,input().split())\nx=max(b-1,c)\nimport math\nprint(math.floor(a*x/c)-a*math.floor(x/c))', 'a,b,c=map(float,input().split())\nx=min(b-1,c)\nimport math\nprint(int(math.floor(a*x/b)-a*math.floor(x/b)))']
['Wrong Answer', 'Accepted']
['s595135742', 's432435895']
[9032.0, 9040.0]
[26.0, 21.0]
[100, 105]
p02696
u770077083
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\nif a == 1 or b == 1:\n print(0)\n exit()\n\nprev = 0\n\nfor x in range(min(b-1,n),n+1, b):\n val = floor(a*x/b) - a*floor(x/b)\n if val < prev:\n print(prev)\n exit()\n prev = val\n\nval = floor(a*n/b) - a*floor(n/b)\nprint(max(prev,val))\n\n', 'from math import floor\na,b,n = map(int,input().split())\nif a == 1 or b == 1:\n print(0)\n exit()\n\nprev = 0\n\nfor x in range(min(b-1,n),n+1, b):\n val = floor(a*x/b) - a*floor(x/b)\n if val < prev:\n print(prev)\n exit()\n prev = val\n\nval = floor(a*n/b) - a*floor(n/b)\nprint(max(prev,val))\n\n']
['Runtime Error', 'Accepted']
['s088724180', 's953088672']
[9140.0, 9204.0]
[23.0, 20.0]
[288, 311]
p02696
u770558697
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\na,b,n = map(int,input().split())\n\nx = 0\nk = 0\nwhile x<n:\n x += b/a\n k += 1\n print(x,k)\nprint(k-1)', 'import math\na,b,n = map(int,input().split())\n\nif b =< n:\n k = math.floor(n/b)\n ans = max(math.floor(a*(b-1)/b), math.floor(a*n/b)- a*math.floor(n/b),math.floor(a*(k*b-1)/b)-a*math.floor((k*b-1)/b))\n print(ans)\nelse:\n print(math.floor(a*n/b))\n', 'import math\na,b,n = map(int,input().split())\nprint(min(math.floor(a*n/b),math.floor(a*(b-1)/b)))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s467691440', 's883705527', 's245543262']
[49648.0, 9016.0, 9088.0]
[2290.0, 22.0, 21.0]
[118, 254, 97]
p02696
u771007149
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['#D\na,b,n = map(int,input().split())\n\nprint(min(n,b-1))\n', '#D\na,b,n = map(int,input().split())\nk = min(n,b-1)\n\nprint(int(a*k / b) - a * int(k/b))\n']
['Wrong Answer', 'Accepted']
['s095399493', 's781587211']
[9156.0, 9156.0]
[23.0, 22.0]
[55, 87]
p02696
u773865844
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import sys\nimport math\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nA = int(X[0])\nB = int(X[1])\nN = int(X[2])\n\nm = A // B\nj = A % B\n\nif N >=B-1:\n print(m*(B-1)-1+j)\nelse:\n k = B-N\n print(max(0,j+m*N-math.ceil(j*k/B))\n ", "import sys\nimport math\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nA = int(X[0])\nB = int(X[1])\nN = int(X[2])\n\nm = A // B\nj = A % B\n\nif N >=B-1:\n print(max(0,m*(B-1)-1+j))\nelse:\n k = B-N\n print(max(0,j+m*N-math.ceil(j*k/B)))"]
['Runtime Error', 'Accepted']
['s814738401', 's359575097']
[9056.0, 9084.0]
[23.0, 19.0]
[241, 244]
p02696
u779728630
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\n\n\n\nr = N if N < B else r = B-1\n\nprint( A*r // B )', 'A, B, N = map(int, input().split())\n\n\n\nif N < B:\n r = N\nelse:\n r = B-1\n\nprint( A*r // B )']
['Runtime Error', 'Accepted']
['s469470450', 's553934406']
[9088.0, 9164.0]
[22.0, 20.0]
[124, 130]
p02696
u781535828
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\nx = min(b-1, n)\nans = max(int((a*x)/b) - a*int(x/b))\nprint(ans)\n', 'a, b, n = map(int, input().split())\nx = min(b-1, n)\nans = int((a*x)/b) - a*int(x/b)\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s207092748', 's424520102']
[9104.0, 9036.0]
[20.0, 21.0]
[100, 95]
p02696
u784022244
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from math import floor\nA,B,N=map(int, input().split())\n\ndef calc(x):\n return floor((A*x)/B)-A*floor(x/B)\n\nprint(calc(B-1))', 'from math import floor\nA,B,N=map(int, input().split())\n\ndef calc(x):\n return floor((A*x)/B)-A*floor(x/B)\nif B-1<=N:\n print(calc(B-1))\nelse:\n print(calc(N))']
['Wrong Answer', 'Accepted']
['s271677968', 's634976144']
[9164.0, 9176.0]
[21.0, 20.0]
[125, 164]
p02696
u786229198
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n=map(int,input().split())\npmax=0\nfor i in range(1,n+1):\n p = i/b - i//b\n if pmax < p:\n pmax=p\n print(i,pmax)\nprint(int(pmax*a))', 'a,b,n=map(int,input().split())\nif n>=b:\n print(int((b-1)/b*a))\nelse:\n print(int(n/b*a))']
['Wrong Answer', 'Accepted']
['s241877942', 's778861887']
[47000.0, 9100.0]
[2308.0, 22.0]
[152, 93]
p02696
u787131053
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split(" "))\nans = 0\nx = B-1\nif B-1 > N:\n floor = int(A*x/B)\nelse:\n floor = int(A*N/B) - A * int(N/B)\nprint(floor)', 'A, B, N = map(int, input().split(" "))\nans = 0\nx = B-1\nfloor1 = int(A*x/B)\nfloor2 = int(A*N/B) - A * int(N/B)\nprint(max(floor1,floor2))', 'A, B, N = map(int, input().split(" "))\nans = 0\nx = min(B-1,N)\nfloor = int(A*x/B) - A * int(x/B)\nprint(floor)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s226988023', 's866180786', 's767411609']
[9176.0, 9172.0, 9168.0]
[25.0, 20.0, 20.0]
[146, 135, 108]
p02696
u789436713
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA,B,N = [int(i)for i in input().split()]\ntmpmax=0\nfor i in range(N+1):\n tmp=math.floor(A*i/B)-A*math.floor(i/B)\n if tmp > tmpmax:\n tmpmax = tmp\n elif tmp < tmpmax:\n continue\n elif tmp == tmpmax:\n break\nprint(tmpmax)', 'import math\nA,B,N = [int(i)for i in input().split()]\ntmpmax=0\nfor i in range(N+1):\n tmp=math.floor(A*i/B)-A*math.floor(i/B)\n if tmp > tmpmax:\n tmpmax=tmp\n if tmp == tmpmax:\n break\nprint(tmpmax)', 'import math\nA,B,N = [int(i)for i in input().split()]\n\ndef func(A, B, N):\n if N>B-1:\n return math.floor(A*(B-1)/B)-A*math.floor((B-1)/B)\n else:\n return math.floor(A*N/B)-A*math.floor(N/B)\n\n\nprint(func(A,B,N))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s566395718', 's767355642', 's961813790']
[9068.0, 9064.0, 9020.0]
[21.0, 21.0, 23.0]
[240, 202, 215]
p02696
u790171360
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA,B,N = map(int,input().split())\nC = N - N%B\nD = A*(C-1)\nans = math.floor(D/B)\u3000-\u3000A * math.floor((C-1)/B)\nif B > N:\n ans = math.floor(A*N/B) - A*math.floor(N/B)\nprint(ans)', 'import math\nA,B,N = map(int,input().split())\nC = N - N%B\nans = A*(C-1) // B - A*math.floor((C-1)/B)\nif B > N:\n ans = math.floor(A*N/B) - A*math.floor(N/B)\nprint(ans)']
['Runtime Error', 'Accepted']
['s504488051', 's536532937']
[8900.0, 9212.0]
[21.0, 21.0]
[189, 168]
p02696
u796044734
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\n\nx = max(b,n-1)\nans = a*x//b - a*(x//b)\n\nprint(ans)', 'a,b,n = map(int,input().split())\n\nx = list()\nif n<=b:\n for i in range(n+1):\n y = int(a*i/b) - a*int(i/b)\n x.append(y)\nelse:\n for i in range(b):\n y = int(a*i/b) - a*int(i/b)\n x.append(y)\nx = sort(x)\nprint(x[-1])\n', 'import bisect\na,b,n = map(int,input().split())\n\nx = list()\nif n<=b:\n for i in range(n+1):\n y = int(a*(i+1)/b) - a*int((i+1)/b)\n x.insert(bisect.bisect_left(x,y),y)\nelse:\n for i in range(b):\n y = int(a*(i+1)/b) - a*int((i+1)/b)\n x.insert(bisect.bisect_left(x,y),y)\n\nprint(x[-1])\n', 'import bisect\na,b,n = map(int,input().split())\n\nx = list()\nfor i in range(n):\n y = int(a*(i+1)/b) - a*int((i+1)/b)\n x.insert(bisect.bisect_left(x,y))\n\nprint(x[-1])\n', 'a,b,n=map(int,input().split())\nx=min(b-1,n)\nprint((a*x)//b-a*(x//b))\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s091663664', 's256048525', 's305797859', 's616082122', 's742019843']
[9088.0, 49216.0, 9892.0, 9176.0, 9072.0]
[24.0, 2207.0, 2206.0, 21.0, 20.0]
[84, 225, 292, 166, 69]
p02696
u811202694
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = [int(v) for v in input().split()]\n\ndef calc(a,b,x):\n return int(((a*x)/B)) - a * int(x/b)\n\nans = -1\nx = 0\nwhile True:\n c = calc(A,B,x)\n if ans >= c:\n break\n else:\n ans = c\n x+=1\nprint(ans)\n', 'A,B,N = [int(v) for v in input().split()]\n\ndef calc(a,b,x):\n return int(((a*x)/B)) - a * int(x/b)\n\nans = -1\nx = 0\nwhile True:\n c = calc(A,B,x)\n if ans >= c or x > N:\n break\n else:\n ans = c\n x+=1\nprint(ans)\n', 'A,B,N = [int(v) for v in input().split()]\n\ndef calc(a,b,x):\n return int(((a*x)/B)) - a * int(x/b)\n\nans = -1\nx = 0\nfor x in range(0,min(A,N)+1):\n c = calc(A,B,x)\n if ans >= c or x > N:\n break\n else:\n ans = c\n x+=1\nprint(ans)\n', 'A,B,N = [int(v) for v in input().split()]\n\ndef calc(a,b,x):\n return int(((a*x)/B)) - a * int(x/b)\n\ndef lcm(a,b):\n if a < b:a,b = b,a\n while a%b != 0:\n a,b = b,a%b\n return b\n\nif B <= N+1:\n print(calc(A,B,B-1))\nelse:\n print(calc(A,B,N))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s111157647', 's158985302', 's246660898', 's155551409']
[9192.0, 9212.0, 9188.0, 9140.0]
[24.0, 27.0, 26.0, 22.0]
[226, 235, 253, 260]
p02696
u812576525
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N= list(map(int,input().split()))\n\nans = 0\nimport math\nfor i in range(B-1,N+1):\n cnt = math.floor(A*i/B) - A *math.floor(i/B)\n ans = max(cnt,ans)\nprint(ans)', 'A,B,N= list(map(int,input().split()))\n\nimport math\n\nif B-1 < N:\n print(math.floor(A*(B-1)/B) - A*math.floor((B-1)/B) )\nelse:\n print(math.floor(A*N/B) - A*math.floor(N/B))']
['Wrong Answer', 'Accepted']
['s862927115', 's684472526']
[9168.0, 9028.0]
[2205.0, 25.0]
[166, 176]
p02696
u815878613
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import math\n\nA, B, N = map(int, input().split())\n\nif B - 1 <= N:\n x = B - 1\nelse:\n x = N\n print('h')\n\nans = math.floor(A * x / B) - A * math.floor(x / B)\nprint(ans)\n\n", 'import math\n\nA, B, N = map(int, input().split())\n\nif B - 1 <= N:\n x = B - 1\nelse:\n x = N\n\nans = math.floor(A * x / B) - A * math.floor(x / B)\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s122979260', 's250751936']
[9112.0, 9160.0]
[21.0, 24.0]
[175, 160]
p02696
u816265237
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['q = min(b-1,n)\nni = int(a*q/b)\nif ni > nmax:\n nmax = ni\nprint(nmax)', '#abc 165\n# d\na,b,n = map(int,input().split())\nnmax = 0\n\n\n# ni = int(a*i/b)\n# if ni > nmax:\n# nmax = ni\n# print(nmax)\n\nq = min(b-1,n)\nni = int(a*q/b)\nif ni > nmax:\n nmax = ni\nprint(nmax)']
['Runtime Error', 'Accepted']
['s731209881', 's991586077']
[9096.0, 9168.0]
[23.0, 22.0]
[74, 239]
p02696
u817692975
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['i = list(map(int, input().split()))\nA = i[0]\nB = i[1]\nN = i[2]\na = -10 ** 20\nfor x in range(1, N+1):\n s = A * x // B\n t_0 = x // B\n t = A * t\n u = s - t\n if u > a:\n a = u\nprint(a) ', '[A, B, N] = list(map(int, input().split()))\nif N < B-1:\n print(A * N // B)\nelse:\n print(A * (B-1) // B)\n \n \n']
['Runtime Error', 'Accepted']
['s487462947', 's237969060']
[9192.0, 9152.0]
[23.0, 21.0]
[191, 120]
p02696
u829249049
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nA,B,N=map(int,input().split())\nX=B-1\nX=max(B-1,N)\nans=(A*X)//B-A*(X//B)\nprint(ans) ', 'import sys\nA,B,N=map(int,input().split())\nX=B-1\nX=min(B-1,N)\nans=(A*X)//B-A*(X//B)\nprint(ans) ']
['Wrong Answer', 'Accepted']
['s222471705', 's852777268']
[9040.0, 9168.0]
[20.0, 23.0]
[94, 94]
p02696
u830054172
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from math import floor, ceil\n\na, b, n = map(int, input().split())\n# a, b, n = 10, 8, 10\n\n\nnum1= n-n%b-1\nnum2= n-n%b\n\nprint(max(floor(a*n/b) - a*floor(n/b), floor(a*num1/b) - a*floor(num1/b), floor(a*num2/b) - a*floor(num2/b)))\n\n', 'from math import floor, ceil\n\na, b, n = map(int, input().split())\n# a, b, n = 10, 8, 10\n\n\nnum = n-n%b-1\n\nprint(max(floor(a*n/b) - a*floor(n/b), floor(a*num/b) - a*floor(num/b)))\n', 'from math import floor, ceil\n\na, b, n = map(int, input().split())\n# a, b, n = 10, 8, 10\n\n\nnum1= n-n%b-1\nnum2= n-n%b\nnum3= n-n%b+1\n\nprint(max(floor(a*n/b) - a*floor(n/b), floor(a*num1/b) - a*floor(num1/b), floor(a*num2/b) - a*floor(num2/b), floor(a*num3/b) - a*floor(num3/b)))\n\n', 'from math import floor, ceil\n\na, b, n = map(int, input().split())\n# a, b, n = 10, 8, 10\n\nnum = min(b-1, n)\n\nprint(floor(a*num/b) - a*floor(num/b))\n\n\n\n# ans = 0\n\n# tmp = floor(a*i/b) - a*floor(i/b)\n# print("i", i, "tmp", tmp)\n# ans = max(ans, tmp)\n\n\n# if a > b:\n# print(floor(a-a/b))\n# elif a<b:\n\n# else:\n# print(a-1)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s256582601', 's495514990', 's533345641', 's687865718']
[9120.0, 9124.0, 9124.0, 9120.0]
[29.0, 28.0, 30.0, 27.0]
[258, 208, 307, 412]
p02696
u830881690
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\n\nl = []\nfor i in range(n//b +1):\n result = a*(b*(i+1)-1)//b - a*i\n l.append(result)\nans = max(l)\n\nprint(ans)', 'a, b, n = map(int, input().split())\n\nprint(int(a*min(n,b-1)/b))']
['Wrong Answer', 'Accepted']
['s654950345', 's466929515']
[61208.0, 9100.0]
[2207.0, 21.0]
[150, 63]
p02696
u835924161
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n=map(int,input().split())\nx=0\nif n>b:\n x=b\nelse:\n x=n\nans1=int(a*x/b)-a*int(x/b)\nprint(ans2)', 'a,b,n=map(int,input().split())\nx=0\nif n>b-1:\n x=b-1\nelse:\n x=n\nans=int(a*x/b)-a*int(x/b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s943063966', 's762902595']
[9036.0, 8984.0]
[23.0, 23.0]
[101, 103]
p02696
u842797390
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\na, b, n = [int(x) for x in input().split()]\n\nm = 0\nfor i in range(min(a, b, n), n + 1):\n print(math.floor(a * i / b), a * math.floor(i / b))\n m = max(m, math.floor(a * i / b) - a * math.floor(i / b))\n\nprint(m)', 'import math\n\na, b, n = [int(x) for x in input().split()]\n# a = 10 ** 6\n# b = 10 ** 12\n# n = 10 ** 12\n\nm = 0\nif (n < b):\n # math.floor(x / b) = 0\n m = math.floor(a * n / b) # - a * math.floor(n / b)\nelse:\n m = math.floor(a * (b - 1) / b) - a * math.floor((b - 1) / b)\n \n \n \n \n\nprint(m)\n']
['Wrong Answer', 'Accepted']
['s183452039', 's029394748']
[40528.0, 9164.0]
[2248.0, 19.0]
[228, 535]
p02696
u845620905
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nprint(B)', 'A, B, N = map(int, input().split())\nx = min(B-1, N)\nans = int(A*x/B) - A * int(x/B)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s489317454', 's551577395']
[9148.0, 9068.0]
[22.0, 21.0]
[44, 94]
p02696
u851035514
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = [int(i) for i in input().split()]\nx = N\nM = A*N//B\nans = -float("inf")\n\nfor _ in range(10**6):\n s = A*x//B - A*(x//B)\n ans = max([ans,s])\n x -= 1\n\nprint(ans)', 'A,B,N = [int(i) for i in input().split()]\nt = min([N,B-1])\nprint((A*t//B))']
['Wrong Answer', 'Accepted']
['s997029596', 's492622883']
[9192.0, 9164.0]
[639.0, 20.0]
[174, 74]
p02696
u851706118
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\n\nx = 0\nans = 0\nif n < b:\n x = n\n ans = math.floor(a*x/b) - a * math.floor(x/b)\nelse:\n x = n - 1\n ans = math.floor(a*x/b) - a * math.floor(x/b)\nprint(ans)', 'import math\na, b, n = map(int, input().split())\n\nx = 0\nans = 0\nif n < b:\n x = n\n ans = math.floor(a*x/b) - a * math.floor(x/b)\nelse:\n x = b - 1\n ans = math.floor(a*x/b) - a * math.floor(x/b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s383012586', 's763394545']
[9196.0, 9220.0]
[22.0, 20.0]
[201, 213]
p02696
u853064660
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import math\n\nA, B, N = map(int, input().split())\nmax = 0\ntemp = 0\nbk_temp = 0\n\nfor i in range(1, N + 1):\n temp = math.floor(A*i/B) - (A * math.floor(i/B))\n print(str(i) + ' ' + str(temp))\n if bk_temp > temp:\n max = bk_temp\n break\n if max < temp:\n max = temp\n bk_temp = temp\n\nprint(max)", "import math\n\nA, B, N = map(int, input().split())\nmax = 0\ntemp = 0\nbk_temp = 0\n\nif B <= N:\n max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))\nelse:\n \n \n # print(str(i) + ' ' + str(temp))\n # if bk_temp > temp:\n # max = bk_temp\n # break\n # if max < temp:\n # max = temp\n # bk_temp = temp\n max = math.floor(A * N / B) - (A * math.floor((N) / B))\n\nprint(max)"]
['Wrong Answer', 'Accepted']
['s153892815', 's218584231']
[23060.0, 9016.0]
[2238.0, 21.0]
[321, 522]
p02696
u857293613
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b, n = map(int, input().split())\ndef func(i, j, k):\n return (i*k)//j\nm = min(n, b)\nr = (a*min(n, b)) // b\nwhile ((a*m) // b) == r:\n print(m)\n m -= 1\nprint(func(a, b, m+1))', 'a, b, n = map(int, input().split())\ndef func(i, j, k):\n return (i*k)//j - i*(k//j)\nm = min(n, b-1)\nr = (a*min(n, b-1)) // b\nwhile ((a*m) // b) == r:\n m -= 1\nprint(func(a, b, m+1))']
['Wrong Answer', 'Accepted']
['s713016061', 's654141513']
[9180.0, 9184.0]
[258.0, 580.0]
[183, 185]
p02696
u857428111
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['#!/usr/bin/env python3\n\nimport sys\ninput= lambda: sys.stdin.readline().rstrip()\ndef pin(type=int):return map(type,input().split())\ndef tupin(t=int):return tuple(pin(t))\n#%%code\ndef resolve():\n A,B,N=pin()\n def f(A,B,x):\n t=(A*x)//B\n s=x//B\n return t-A*s\n xans=N-(N%B)-1\n if xans>N:xans=N\n print(f(A,B,xans))\n#%%submit!\nresolve()', '#!/usr/bin/env python3\n\nimport sys\ninput= lambda: sys.stdin.readline().rstrip()\ndef pin(type=int):return map(type,input().split())\ndef tupin(t=int):return tuple(pin(t))\n#%%code\nimport random\ndef resolve():\n A,B,N=pin()\n def f(A,B,x):\n t=(A*x)//B\n s=x//B\n return t-A*s\n ans=0\n for i in range(10**6):\n k=random.randint(0,N)\n ans=max(ans,f(A,B,k))\n print(ans)\n#%%submit!\nresolve()']
['Wrong Answer', 'Accepted']
['s159957987', 's660433747']
[9148.0, 9432.0]
[22.0, 1226.0]
[393, 456]
p02696
u867848444
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\n\nif n >= 2 * b - 1:\n ans = (a * (2 * b - 1)) // b - a\n print(ans)\nelse:\n ans = (a * (2 * n - 1)) // b - a * n //b\n print(ans)', 'a,b,n = map(int,input().split())\nk = n // b\nprint((a - 1) * (k + 1))', 'a, b, n = map(int,input().split())\n\nans = min(b - 1, n)\nprint(ans)', 'import math\na,b,n = map(int,input().split())\n\ntemp = a * b // math.gcd(a, b) - 1\ntemp = min(temp, n - (n%b+1))\nans = (a * temp)//b - a * (temp//b)\nprint(ans)', 'a,b,n = map(int,input().split())\n\nif n >= 2 * b - 1:\n ans = a * (2 * b - 1) // b - a\n print(ans)\nelse:\n ans = (a * (2 * n - 1)) // b - a * n //b\n print(ans)', 'import math\na,b,n = map(int,input().split())\n\ntemp = a * b // math.gcd(a, b) - 1\ntemp1 = n - (n % b + 1) if n%b != n else n\ntemp = min(temp, temp1)\n#print(temp)\nans = (a * temp)//b - a * (temp//b)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s114690802', 's270843362', 's671531981', 's721963757', 's933659797', 's477708732']
[9028.0, 9168.0, 9160.0, 9124.0, 9160.0, 9188.0]
[21.0, 21.0, 22.0, 20.0, 22.0, 25.0]
[170, 68, 66, 157, 168, 207]
p02696
u869917163
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = map(int, input().split())\nmax = 0\nfor i in range(1,B):\n if max <= int(i*A/B):\n max = int(i*A/B)\nprint(max)', 'A,B,N = map(int, input().split())\nif N < B:\n print(int(N*A/B))\nelse:\n print(int((B-1)*A/B))']
['Wrong Answer', 'Accepted']
['s778881028', 's794695726']
[9168.0, 9104.0]
[2205.0, 21.0]
[124, 97]
p02696
u870736713
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N=map(int,input().split())\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nprint(f(max(N,B-1)))', 'A,B,N=map(int,input().split())\nimport numpy as np\nprint(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))])', 'A,B,N=map(int,input().split())\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nprint(f(min(N,B-1)))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s071695730', 's643098724', 's188537920']
[9168.0, 8860.0, 9024.0]
[19.0, 23.0, 21.0]
[93, 123, 93]
p02696
u873616440
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(0, 10**3):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nfor x in range(N-10**7, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(1, N//(10**6)+1 ):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(N+1, B):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(N-1000, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(0, 10**3):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nfor x in range(N-10**7, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(B, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(0, 10**6):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nfor x in range(N-10**6, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(N-10**6, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))\n', 'import math\nA, B, N = map(int, input().split())\nans = []\nfor x in range(0, 10**5):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nfor x in range(N-10**5, N+1):\n cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))\n ans.append(cal)\nprint(max(ans))', 'a, b, n = map(int, input().split())\nn = min(n, b-1)\n \nprint(int((a * n) / b) - a * int(n / b))']
['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s077286722', 's291420974', 's350891944', 's591806891', 's619586608', 's733745606', 's742963993', 's851801651', 's869327514', 's549346414']
[176436.0, 16872.0, 142464.0, 9176.0, 167172.0, 42660.0, 87860.0, 48488.0, 16928.0, 9144.0]
[2211.0, 561.0, 2210.0, 24.0, 2211.0, 2207.0, 1264.0, 759.0, 149.0, 19.0]
[286, 185, 175, 180, 286, 175, 286, 182, 286, 94]
p02696
u876438858
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import sys\nfrom math import sqrt, floor\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 6)\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\ndef main():\n a, b, n = MI()\n\n if b - 1 <= n:\n print((a * (b - 1)) // b)\n else:\n print((a * n) // b)) #- (a * (n // b)))\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\nfrom math import sqrt, floor\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10 ** 6)\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\ndef main():\n a, b, n = MI()\n\n if b - 1 <= n:\n print((a * (b - 1)) // b)\n else:\n print((a * n) // b)\n\n\nif __name__ == "__main__":\n main()\n']
['Runtime Error', 'Accepted']
['s951051970', 's733261588']
[8976.0, 9196.0]
[26.0, 20.0]
[368, 348]
p02696
u878545651
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import math\n\n\ndef main():\n A, B, N = map(int, input().split())\n ans = 0\n\n for x in range(1, 100):\n temp = math.floor(A*x/B) - A * math.floor(x/B)\n if temp < N:\n ans = temp\n else:\n print(ans)\n break\n\n\nif __name__ == '__main__':\n main()", "def main():\n A, B, N = map(int, input().split())\n x = min(B - 1, N)\n ans = A * x // B - A * (x // B)\n print(ans)\n \n \nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s127248791', 's670708301']
[9020.0, 9008.0]
[29.0, 29.0]
[300, 172]
p02696
u880400515
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\ndef func(A, B, x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nA, B, N = list(map(int, input().split()))\n\n\n\nprint(func(A, B, B-1))', 'import math\n\ndef func(A, B, x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nA, B, N = list(map(int, input().split()))\n\ni = 1\nmax_x = -9999999\nmax = -9999999\nwhile (i <= N):\n ans =func(A, B, i) \n if (ans > max):\n max = ans\n max_x = i\n\nprint(max)', 'import math\n\ndef func(A, B, x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nA, B, N = list(map(int, input().split()))\n\n\n\nprint(func(A, B, min(B-1, N)))']
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s024501362', 's462368784', 's847645432']
[9168.0, 9108.0, 9104.0]
[19.0, 2205.0, 21.0]
[311, 268, 319]
p02696
u891945807
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n = map(int,input().split())\n\n\nx = b-1\n\nif b > n:\n res = int(a/b)\n\nelse :\n res = int((a/b)*(b-1))\n \nprint(res)\n', 'a,b,n = map(int,input().split())\n\n\nx = b-1\n\nif b > n:\n res = int((a/b)*n)\n\nelse :\n res = int((a/b)*(b-1))\n \nprint(res)\n']
['Wrong Answer', 'Accepted']
['s420671964', 's818158859']
[9020.0, 9104.0]
[23.0, 21.0]
[118, 122]
p02696
u892305365
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\na,b,n = list(map(int, input().split()))\n\nif b <= 10**6\n maxVal = 0\n\n for i in range(b):\n if i > n:\n break\n val = math.floor(a*i/b)-a*math.floor(i/b)\n if val > maxVal:\n maxVal = val\n\n print(maxVal)\nelif n > b:\n print(a-1)\nelif n == b:\n m = n - 1\n print(math.floor(a*m/b)-a*math.floor(m/b))\nelse:\n print(math.floor(a*n/b)-a*math.floor(n/b))', 'import math\n\na,b,n = list(map(int, input().split()))\n\nif b <= 10**6:\n maxVal = 0\n\n for i in range(b):\n if i > n:\n break\n val = math.floor(a*i/b)-a*math.floor(i/b)\n if val > maxVal:\n maxVal = val\n\n print(maxVal)\nelif n > b:\n print(a-1)\nelif n == b:\n m = n - 1\n print(math.floor(a*m/b)-a*math.floor(m/b))\nelse:\n print(math.floor(a*n/b)-a*math.floor(n/b))\n']
['Runtime Error', 'Accepted']
['s285100778', 's589622952']
[8996.0, 9040.0]
[23.0, 27.0]
[415, 417]
p02696
u894265012
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["import numpy as np\ndef main():\n A, B, N = map(int, input().split())\n max_value = 0\n if N < B:\n np.floor(A*(N-1)/B)\n else:\n for x in range(N+1):\n value = np.floor(A*x/B) - A * np.floor(x/B)\n #print(x, value)\n if value > max_value:\n max_value = value\n print(int(max_value))\n \nif __name__ == '__main__':\n main()", "import numpy as np\ndef main():\n A, B, N = map(int, input().split())\n max_value = 0\n if N < B:\n np.floor(A*N/B)\n else:\n for x in range(N+1):\n value = np.floor(A*x/B) - A * np.floor(x/B)\n #print(x, value)\n if value > max_value:\n max_value = value\n print(int(max_value))\n \nif __name__ == '__main__':\n main()", "import numpy as np\ndef main():\n A, B, N = map(int, input().split())\n max_value = 0\n if N < B:\n np.floor(A*(B-1)/B)\n else:\n for x in range(N+1):\n value = np.floor(A*x/B) - A * np.floor(x/B)\n #print(x, value)\n if value > max_value:\n max_value = value\n print(int(max_value))\n \nif __name__ == '__main__':\n main()", "import numpy as np\ndef main():\n A, B, N = map(int, input().split())\n max_value = 0\n x = np.min([B-1, N])\n max_value = int(np.floor(A*x/B))\n print(max_value)\n \nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s006884618', 's061080431', 's390041238', 's402542136']
[27112.0, 27136.0, 26964.0, 27244.0]
[2206.0, 2206.0, 2206.0, 105.0]
[391, 387, 391, 214]
p02696
u897940702
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['\nimport math\n\na, b, n = map(int, input().split())\nans = 0\ntmp = 0\n\n\nfor x in range(1, n+1):\n if x > b - 1:\n break\n tmp = math.floor(a*x/b) - a*math.floor(x/b)\n print(x, tmp)\n if tmp >= ans:\n ans = tmp\n\nprint(ans)', 'import math\n\na, b, n = map(int, input().split())\nans = 0\ntmp = 0\n\nif n > b - 1:\n n = b-1\n\nans = math.floor(a*n/b) - a*math.floor(n/b)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s741782494', 's578646322']
[24724.0, 9172.0]
[2229.0, 21.0]
[238, 148]
p02696
u898967808
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['from math import floor,ceil\na,b,n = map(int,input().split())\n\ndef f(x):\n return floor(a*x/b) - a*floor(x/b)\n\n\nif a*n < b:\n print(f(b-1))\nelse: \n ans = 0\n for i in range(1,min(a+1,n+1)):\n ans = max(ans,f(i))', 'from math import floor\n\ndef f(x):\n return floor(a*x/b) - a*floor(x/b)\n\na,b,n = map(int,input().split()) \nprint(min(b-1,n)) ', 'from math import floor\n\ndef f(x):\n return floor(a*x/b) - a*floor(x/b)\n\na,b,n = map(int,input().split()) \nprint(f(min(b-1,n)))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s395107337', 's558277871', 's619158231']
[9192.0, 9084.0, 9164.0]
[555.0, 23.0, 23.0]
[214, 128, 129]
p02696
u900139929
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nYmax=0\n\nfor i in range(B+1):\n x = i+1\n XB = float(x)/float(B)\n Y = int(float(A)*XB) - A * int(XB)\n if Y>Ymax:\n Ymax = Y\nprint(Ymax)', 'A, B, N = map(int, input().split())\nprint(A*x//B - A*(x//B))', 'A, B, N = map(int, input().split())\nYmax=0\n\nfor i in range(N,N-B,-1):\n x = i+1\n Y = int(float(A)*float(x)/float(B)) - A * int(float(x)/float(B))\n if Y>Ymax:\n Ymax = Y\nprint(Ymax)', 'A, B, N = map(int, input().split())\nYmax=0\n\nfor i in range(N,N-B,-1):\n x = i+1\n Y = int(float(A)*float(x)/float(B)) - A * int(float(x)/float(B))\n if Y>Ymax:\n Ymax = Y\n print(x)\nprint(Ymax)', 'A, B, N = map(int, input().split())\nY = A*x//B - A*(x//B)\nprint(Y)', 'A, B, N = map(int, input().split())\nYmax=0\nif A*N < B:\n print(0)\nelif N<B:\n Ymax = A*N // B\n print(Ymax)\nelse:\n x = B-1\n Ymax = A*x//B - A*(x//B)\n print(Ymax)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s045109869', 's194087431', 's412699250', 's421384164', 's559055459', 's760840848']
[9000.0, 9084.0, 9004.0, 24712.0, 9160.0, 9176.0]
[2205.0, 19.0, 2205.0, 2244.0, 19.0, 20.0]
[174, 60, 184, 195, 66, 164]
p02696
u901060001
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['def main():\n A, B, N = (int(x) for x in input().split())\n mini = 0\n if N >= B:\n for x in range(B-1, N+1, B):\n k = x / B\n ans = int(A*k) - int(k)\n if ans > mini:\n mini = ans\n else:\n ans = int(A*(B-1)/B)\n print(ans)\n\n\nif __name__ == "__main__":\n main()', 'def main():\n A, B, N = (int(x) for x in input().split())\n mini = 0\n if N >= B:\n ans = int(A*(B-1)/B)\n else:\n ans = int(A*(N)/B)\n print(ans)\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s922822387', 's382123403']
[9140.0, 9084.0]
[2205.0, 22.0]
[330, 208]
p02696
u909802005
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
["#!/usr/bin/env python3\nimport sys\nimport math\n\ndef solve(A: int, B: int, N: int):\n\n x = min(B-1, N)\n print(math.floor(A*x/B) - A*math.floor(x/B)\n\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n solve(A, B, N)\n\nif __name__ == '__main__':\n main()\n", " #!/usr/bin/env python3\n import sys\n import math\n \n def solve(A: int, B: int, N: int):\n \n x = min(B-1, N)\n print(math.floor(A*x/B) - A*math.floor(x/B))\n \n return\n \n \n def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n solve(A, B, N)\n \n if __name__ == '__main__':\n main()", "#!/usr/bin/env python3\nimport sys\nimport math\n\ndef solve(A: int, B: int, N: int):\n x = min(B-1, N)\n print(math.floor(A*x/B) - A*math.floor(x/B))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n solve(A, B, N)\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s272653792', 's976370250', 's976932311']
[8960.0, 8844.0, 9196.0]
[18.0, 21.0, 24.0]
[504, 610, 503]
p02696
u909991537
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\nA, B, N = (int(i) for i in input().split()) \nans = 0\nfor x in range(N, N - A - 1, -1):\n result = math.floor(A * x / B) - A * math.floor(x/B)\n ans = max(ans, result)\nprint(ans)\n\n', 'import math\nA, B, N = (int(i) for i in input().split()) \nans = 0\nfor x in range(0, 100000):\n result = math.floor(A * x / B) - A * math.floor(x/B)\n ans = max(ans, result)\n \nprint(ans)\n\n', 'import math\nA, B, N = (int(i) for i in input().split()) \nans = 0\nfor x in range(0, A+10):\n result = math.floor(A * x / B) - A * math.floor(x/B)\n ans = max(ans, result)\n \nprint(ans)\n\n', 'import math\nA, B, N = (int(i) for i in input().split()) \n\ndef func(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x/B)\n\nprint(func(A, B, min(N, B-1)))\n\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s695260707', 's779703857', 's879568744', 's466698833']
[8892.0, 9168.0, 9168.0, 9148.0]
[736.0, 79.0, 575.0, 20.0]
[192, 190, 188, 164]
p02696
u914002690
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['import math\n\n\nnums = [int(e) for e in input().split()]\n\na = nums[0]\nb = nums[1]\nn = nums[2]\n\nmax_score = -1\nscore = -1\n\nwhile True:\n score = math.floor(a*x/b) - a* math.floor(x/b)\n if max_score < score:\n max_score = score\n elif x > n:\n break\n\nprint(max_score)', 'import math\n\n\nnums = [int(e) for e in input().split()]\n\na = nums[0]\nb = nums[1]\nn = nums[2]\n\nmax_score = -1\nscore = -1\nx = 1\n\nwhile True:\n score = math.floor(a*x/b) - a* math.floor(x/b)\n if max_score < score:\n max_score = score\n x += 1\n elif x > n:\n break\n\nprint(max_score)\n', 'import math\n\n\nnums = [int(e) for e in input().split()]\n\na = nums[0]\nb = nums[1]\nn = nums[2]\n\nmax_score = -1\nscore = -1\n\n# for x in range(1, n+1):\n# score = math.floor(a*x/b) - a* math.floor(x/b)\n# if max_score < score:\n# max_score = score\n# elif x > b:\n# break\n\nif b > n:\n max_score = math.floor(a*n/b)\nelse:\n max_score = math.floor(a*(b-1)/b)\n\nprint(max_score)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s025883900', 's229905221', 's299318658']
[9196.0, 9192.0, 9104.0]
[21.0, 2206.0, 20.0]
[282, 304, 395]
p02696
u918601425
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N=[int(s) for s in input().split()]\nprint(((B-1)*A)//B)', 'import time\nstart=time.time()\nA,B,N=[int(s) for s in input().split()]\nx=((N+1)//B)*B-1\nans=set()\nans.add((A*N)//B-A*(N//B))\nwhile x>0:\n ans.add((A*x)//B-A*(x//B))\n x-=B\n if (time.time()-start)>1.7:\n break\nprint(max(ans))\n']
['Wrong Answer', 'Accepted']
['s690717716', 's761843971']
[9160.0, 9128.0]
[22.0, 1717.0]
[59, 227]
p02696
u919235786
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a,b,n=map(int,input().split())\nimport math\nx=b-1\nm=[0]\nwhile x<=n:\n f=math.floor(a*x/b)-a*(math.floor(x/b))\n m.append(f)\n x+=b\nprint(max(m))', 'a,b,n=map(int,input().split())\nimport math\nx=b-1\nm=math.floor(a*x/b)\nprint(m)', 'a,b,n=map(int,input().split())\nimport math\nif n<b-1:\n m=[math.floor(a*n/b)]\nelse:\n e=n//b\n n=b*e-1\n m=[math.floor(a*n/b)-a*(math.floor(n/b))]\nprint(m)', 'import sys\ninput=sys.stdin.readline\nimport math\na,b,n=map(int,input().split())\nfor x in range(n+1):\n f=math.floor(a*x/b)-a*math.floor(x/b)\n m.append(f)\nprint(max(m))', 'a,b,n=map(int,input().split())\nimport math\nif n<b:\n m=math.floor(a*n/b)\nelse:\n e=b-1\n m=math.floor(a*e/b)\nprint(m)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s017569160', 's111246542', 's168846951', 's237417182', 's837551206']
[43280.0, 9056.0, 9176.0, 9208.0, 9012.0]
[2207.0, 20.0, 23.0, 19.0, 20.0]
[149, 77, 162, 171, 123]
p02696
u920103253
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['def n0():return int(input())\ndef n1():return [int(x) for x in input().split()]\ndef n2(n):return [int(input()) for _ in range(n)]\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\na,b,n=n1()\nimport math\nif b<=n:\n i=b-1\nelse:\n i=n\nm=math.floor((a*i)/b)-a*math.floor(i//b)\nprint(i,m)', 'def n0():return int(input())\ndef n1():return [int(x) for x in input().split()]\ndef n2(n):return [int(input()) for _ in range(n)]\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n \na,b,n=n1()\nimport math\nif b<=n:\n i=b-1\nelse:\n i=n\nm=math.floor((a*i)/b)-a*math.floor(i/b)\nprint(m)\n']
['Wrong Answer', 'Accepted']
['s370915779', 's836660192']
[9208.0, 9132.0]
[19.0, 21.0]
[308, 307]
p02696
u921729430
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A, B, N = map(int, input().split())\nf = [int(A*x/B)-(A * int(x/B)) for x range(N+1)]\nprint(max(f))', 'def f(a, b, x):\n return int(a*x/b) - (a*int(x/b))\nA, B, N = map(int, input().split())\nprint(f(A, B, min(B-1, N))', 'A, B, N = map(int, input().split())\nf = [int(A*x/B) - (A * int(x/B)) for x range(N+1)]\nprint(max(f))', 'A, B, N = map(int, input().split())\nmax = 0\nimax = 0\nfor x in range(N+1):\n if int(A*x/B) - (A * int(x/B)) > max:\n imax = x\nprint(x)', 'A, B, N = map(int, input().split())\nmax = 0\nfor x in range(N+1):\n if int(A*x/B) - (A * int(x/B)) > max:\n max = int(A*x/B) - (A * int(x/B))', 'def f(a, b, x):\n return int(a*x/b) - (a*int(x/b))\nA, B, N = map(int, input().split())\nprint(f(A, B, min(B-1, N)))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s002511409', 's008654003', 's248603900', 's500795700', 's917314897', 's672381924']
[8960.0, 9032.0, 8944.0, 9164.0, 9008.0, 9172.0]
[20.0, 19.0, 21.0, 2205.0, 2205.0, 21.0]
[98, 113, 100, 135, 142, 114]
p02696
u927282564
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N=list(map(int,input().split()))\nlist_ans=[]\nfor i in range(B-1,B):\n print(int(A*i/B)-A*int(i/B))\n \n#print(list_ans)\n#print(int(max(list_ans)))', 'A,B,N=list(map(int,input().split()))\nlist_ans=[]\nminimum=min(B-1,N)\nprint(int(A*minimum/B)-A*int(minimum/B))']
['Wrong Answer', 'Accepted']
['s395192416', 's088625058']
[9132.0, 9040.0]
[22.0, 22.0]
[188, 108]
p02696
u927373043
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['A,B,N = map(int,input().split())\ndef f(x):\n f = int((A*x)/B)-A*int(x/B)\n return f\nif(f(B-1) < f(N)):\n print(f(N))\nelse:\n print(f(B-1))', 'A,B,N = map(int,input().split())\ndef f(x):\n f = int(A*x/B)-A*int(x/B)\n return f\nif(f(B-1)< f(N)):\n print(f(N))\nelse:\n print(f(B-1))', 'A,B,N = map(int,input().split())\ndef f(x):\n f = int((A*x)/B)-A*int(x/B)\n return f\nif(B-1 < N):\n print(f(B-1))\nelse:\n print(f(N))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s785338547', 's828697929', 's517514429']
[9020.0, 9180.0, 9176.0]
[26.0, 30.0, 26.0]
[138, 135, 132]
p02696
u931011688
2,000
1,048,576
Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t.
['a, b , n= input().split() \n\nif b > n :\n print(n)\nelse:\n max = 0\n for i in range(1,int(n)+1,1):\n r = (int(a)*i // int(b)) - (int(a)* (i//int(b)))\n if r > max:\n max = r\n\n print(max)\n', 'a, b , n= input().split() \na = int(a)\nb = int(b)\nn = int(n)\np = min(b,n)\nif p % b ==0:\n print(int(a*(p-1)/b))\nelse:\n print(int(a*p/b))']
['Wrong Answer', 'Accepted']
['s832161325', 's817111807']
[8988.0, 9116.0]
[2205.0, 23.0]
[217, 140]