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
p02682
u700825859
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int, input().split())\nsum = 0\nif a >= k:\n sum += 1*k\n print(sum)\nelif a < k :\n sum += 1*k\n k = k - a\n if b >= k:\n print(sum)\n else :\n k = k - b\n sum += (-1)*k\n print(sum)', 'a,b,c,k = map(int, input().split())\nsum = 0\nif a >= k:\n sum += 1*k\n print(sum)\nelif a < k :\n sum += 1*a\n k = k - a\n if b >= k:\n print(sum)\n else :\n k = k - b\n sum += (-1)*k\n print(sum)']
['Wrong Answer', 'Accepted']
['s444900327', 's375153043']
[9192.0, 9084.0]
[25.0, 22.0]
[230, 230]
p02682
u702018889
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
["!/usr/bin/env python3\nimport sys\n\n\ndef solve(A: int, B: int, C: int, K: int):\n ans=0\n sub=K\n if A>K:\n ans+=1*K\n sub-=K\n else:\n ans+=1*A\n sub-=A\n if sub!=0:\n if B>sub:\n sub=0\n else:\n sub-=B\n if sub!=0:\n ans-=sub\n print(ans)\n\n return\n\n\n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\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 C = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n solve(A, B, C, K)\n\nif __name__ == '__main__':\n main()", 'A,B,C,K=map(int,input().split())\nans=0\nsub=K\nif A>K:\n ans+=1*K\n sub-=K\nelse:\n ans+=1*A\n sub-=A\nif sub!=0:\n if B>sub:\n sub=0\n else:\n sub-=B\nif sub!=0:\n ans-=sub\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s715335344', 's400971910']
[8944.0, 9184.0]
[19.0, 23.0]
[875, 206]
p02682
u703672022
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int, input().split())\nif A >= K:\n\tprint(K)\n\treturn\nK -= A\nif B >= K:\n\tprint(A)\n\treturn\nK -= B\nprint(A - K)', 'A,B,C,K = map(int, input().split())\nif A >= K:\n\tprint(K)\n\texit()\nK -= A\nif B >= K:\n\tprint(A)\n\texit()\nK -= B\nprint(A - K)\n']
['Runtime Error', 'Accepted']
['s402329178', 's072496514']
[8984.0, 9136.0]
[22.0, 20.0]
[120, 121]
p02682
u706121438
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, n = map(int, input().split())\nif a >= n:\n print(n)\nelif n > a and a + b >= n:\n print(a)\nelse\n print(a - (n - a))', 'a, b, c, n = map(int, input().split())\nif a >= n:\n print(n)\nelif n > a and a + b >= n:\n print(a)\nelse:\n print(2a - n + b)', 'a, b, c, n = map(int, input().split())\nif a >= n:\n print(n)\nelif n > a and a + b >= n:\n print(a)\nelse:\n print(a + a - n + b)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s068874475', 's247205612', 's085567333']
[8972.0, 8948.0, 9156.0]
[23.0, 22.0, 21.0]
[130, 130, 134]
p02682
u708890186
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K= map(int,input().split())\n\nif A >= K:\n print(K)\nelif (A+B) >= K\n print(A)\nelse:\n nok =K-(A+B)\n print(A-nok)', 'A,B,C,K= map(int,input().split())\n\nif A >= K:\n print(K)\nelif (A+B) >= K:\n print(A)\nelse:\n nok =K-(A+B)\n print(A-nok)\n']
['Runtime Error', 'Accepted']
['s292635541', 's193837461']
[9016.0, 9168.0]
[21.0, 23.0]
[119, 121]
p02682
u717839182
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
["def actual(A, B, C, K):\n print('\\n')\n\n if K <= A: \n return A\n\n score = 0\n\n if K > A:\n score += A\n K -= A\n\n if K <= B:\n return score\n\n if K > B:\n K -= B\n\n \n \n score -= K\n\n return score\n\nA, B, C, K = map(int, input().split())\n\nprint(actual(A, B, C, K))", 'def actual(a, b, c, k):\n x_a = min(a, k)\n\n k -= x_a\n\n x_b = min(b, k)\n k -= x_b\n\n x_c = k # min(c, k)\n\n score = x_a - x_c\n\n return score\n \nA, B, C, K = [int(x) for x in input().split()]\n\nprint(actual(A, B, C, K))']
['Wrong Answer', 'Accepted']
['s427132930', 's836876776']
[9196.0, 9116.0]
[22.0, 23.0]
[432, 249]
p02682
u720551456
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['li = list(map(int, input().split()))\na, b, c, k = li[0], li[1], li[2], li[3]\n\nif a >= k:\n print(1*k)\nelif (a+b) > k:\n print(1*a)\nelse:\n ans = (1*a) - (k-(a-b))\n print(ans)\n', 'a, b, c, k = input().split()\n\nif a >= k:\n print(1*k)\nelif (a+b) > k:\n print(1*a)\nelse:\n ans = (1*a) - (k-(a-b))\n print(ans)', 'li = list(map(int, input().split()))\na, b, c, k = li[0], li[1], li[2], li[3]\n\nif a >= k:\n print(1*k)\nelif (a+b) >= k:\n print(1*a)\nelse:\n ans = (1*a) - (k-(a+b))\n print(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s206168610', 's391296933', 's167853899']
[9188.0, 9048.0, 9168.0]
[21.0, 20.0, 22.0]
[176, 127, 177]
p02682
u723065526
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int,input().split())\nans = 0\nif(K<=A):\n ans = K\nelse if(K<=A+B):\n ans = A\nelse:\n ans = A-(K-A-B)\nprint(ans)', 'A, B, C, K = map(int,input().split())\nans = 0\nif(K<=A):\n ans = K\nelif(K<=A+B):\n ans = A\nelse:\n ans = A-(K-A-B)\nprint(ans)']
['Runtime Error', 'Accepted']
['s916331995', 's742368991']
[8880.0, 9088.0]
[20.0, 23.0]
[127, 124]
p02682
u723212348
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
["a,b,c,k= map(int,input.split(' '))\nif a>=k:\n print(k)\nelif a+b>=k:\n print(a)\nelif a+b+c>=k:\n print(a-(k-a-b))", 'a,b,c,k= map(int,input().split())\nif a>=k:\n print(k)\nelif a+b>=k:\n print(a)\nelif a+b+c>=k:\n print(a-(k-a-b))']
['Runtime Error', 'Accepted']
['s999355555', 's019950221']
[9040.0, 9196.0]
[18.0, 22.0]
[112, 111]
p02682
u723345499
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['2000000000 0 0 2000000000', 'a,b,c,k = map(int, input().split())\n\nx = k - a\nif x <= 0:\n print(k)\nelse:\n y = x - b\n if y <= 0:\n print(a)\n else: \n print(a + ((k - (a + b)) * (-1)))\n ']
['Runtime Error', 'Accepted']
['s724787222', 's203667473']
[8956.0, 9160.0]
[23.0, 21.0]
[25, 184]
p02682
u724742135
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['from sys import stdin\nA, B, C, K = [int(_) for _ in stdin.readline().rstrip().split()]\nL = [1]*A+[0]*B+[-1]*C\nprint(L[:K])', 'from sys import stdin\nA, B, C, K = [int(_) for _ in stdin.readline().rstrip().split()]\nans = 0\nif K <= A:\n ans = K\nelif K <= A+B:\n ans = A\nelse:\n ans = A-K+A+B\nprint(ans)']
['Runtime Error', 'Accepted']
['s479195204', 's671025540']
[3288624.0, 9148.0]
[2296.0, 20.0]
[122, 179]
p02682
u726154863
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=map(int,input().split())\nif k<=a:\n print(1*a)\nelse:\n if k-a<=b:\n print(1*(k-a))\n else:\n print(1*a-1*(k-a-b))', 'a,b,c,k=map(int,input().split())\nif k<=a:\n print(1*k)\nelse:\n if k-a<=b:\n print(1*a)\n else:\n print(1*a-1*(k-a-b))']
['Wrong Answer', 'Accepted']
['s758365607', 's973556113']
[9004.0, 9176.0]
[22.0, 21.0]
[139, 135]
p02682
u726284577
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=map(int, input().split())\nif a+b-k>=0:\n print(min(a,k))\nelse:\n print(a-(k-(a+b))\n', 'a,b,c,k=map(int, input().split())\nif a+b-k>=0:\n print(min(a,k))\nelse:\n print(2*a-k+b)']
['Runtime Error', 'Accepted']
['s971650583', 's318608102']
[8912.0, 9164.0]
[19.0, 22.0]
[95, 91]
p02682
u726823037
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['def Ii():return int(sys.stdin.buffer.read())\ndef Mi():return map(int,sys.stdin.buffer.readline().split())\ndef Li():return list(map(int,sys.stdin.buffer.readline().split()))\n \na,b,c,k = Mi()\nif k <= a:\n ans = k\n exit(0)\nans = a\nk -= a\nif k > b:\n ans -= k-b\n \nprint(ans)', 'import sys\ndef Ii():return int(sys.stdin.buffer.read())\ndef Mi():return map(int,sys.stdin.buffer.readline().split())\ndef Li():return list(map(int,sys.stdin.buffer.readline().split()))\n \na,b,c,k = Mi()\nif k <= a:\n print(k)\n exit(0)\nans = a\nk -= a\nif k > b:\n ans -= k-b\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s460470601', 's511958200']
[9124.0, 9188.0]
[23.0, 26.0]
[272, 284]
p02682
u728095140
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int,input().split())\nans=0\nsum_AB = A+B\nif K>=A:\n ans += A\nelse:\n ans+=K\n\nprint(ans)\nif sum_AB<=K:\n ans-=K-A-B\n\n\nprint(ans)\n', 'A,B,C,K = map(int,input().split())\nans=0\nsum_AB = A+B\nif K>=A:\n ans += A\nelse:\n ans+=K\n\nif sum_AB<=K:\n ans-=K-A-B\n\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s855580668', 's300281404']
[9120.0, 9164.0]
[24.0, 23.0]
[147, 136]
p02682
u729008627
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\nS = max(A, K) - max(0, K-A-B)\nprint(S)', 'A, B, C, K = map(int, input().split())\nS = min(A, K) - max(0, K-A-B)\nprint(S)']
['Wrong Answer', 'Accepted']
['s143201714', 's484426965']
[9152.0, 9160.0]
[22.0, 24.0]
[77, 77]
p02682
u730414714
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int, input().split())\ncard_list = (([1]*A).extend([0]*B)).extend([-1]*C)\n \nprint(sum(card_list[0:K]))', 'A,B,C,K = map(int, input().split())\ncard_list = (([1]*A).extend([0]*B)).append([-1]*C)\n\nprint(sum(card_list[0:K]))', 'A,B,C,K = map(int, input().split())\nans = 0\nif K <= A:\n ans = K\nelse:\n if K > A and K <= A+B:\n ans = A\n else:\n ans = A-(K-A-B)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s097909868', 's271247425', 's955536552']
[3288720.0, 3288724.0, 9156.0]
[2297.0, 2293.0, 23.0]
[115, 114, 146]
p02682
u732832001
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nif a > k:\n a = k\n b = 0\n c = 0\nif a < k and a+b > k:\n c = 0\nif a+b < k:\n c = k - a - b\n \nsum_a = 1 * a\nsum_c = -1 * c\n \nprint(sum_a + sum_c)\n', 'a, b, c, k = map(int, input().split())\n\nif a > k:\n a = k\n b = 0\n c = 0\nif a < k and a+b > k:\n b = k - a\n c = 0\nif a+b < k:\n c = k - a - b\n\nli_card = []\n\nfor i in range(a):\n li_card.append(1)\nfor i in range(b):\n li_card.append(0)\nfor i in range(c):\n li_card.append(-1)\n\n\nprint(sum(li_card))', 'a, b, c, k = map(int, input().split())\n\nif a >= k:\n a = k\n b = 0\n c = 0\nif a < k and a+b >= k:\n c = 0\nif a+b < k:\n c = k - a - b\n \nsum_a = 1 * a\nsum_c = -1 * c\n \nprint(sum_a + sum_c)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s104678776', 's795624514', 's074912159']
[9180.0, 244492.0, 9128.0]
[22.0, 2213.0, 25.0]
[188, 298, 189]
p02682
u743420240
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['def main():\n a, b, c, k = map(int, input().split())\n if a + b >= k:\n print(max(a, k))\n else:\n x = k - a - b\n print(a - x)\n\n\nmain()', 'def main():\n a, b, c, k = map(int, input().split())\n if a + b >= k:\n print(min(a, k))\n else:\n x = k - a - b\n print(a - x)\n\n\nmain()']
['Wrong Answer', 'Accepted']
['s779462081', 's270749253']
[9156.0, 9144.0]
[23.0, 22.0]
[160, 160]
p02682
u744410959
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nif a >= k:\n print(k)\nelif a + b >= k:\n print(a)\nelse:\n print(a - (k - a - b)\n ', 'a, b, c, k = map(int, input().split())\n\nif a >= k:\n print(k)\nelif a + b >= k:\n print(a)\nelse:\n print(a - (k - a - b))\n \n']
['Runtime Error', 'Accepted']
['s007945191', 's454540171']
[9024.0, 9160.0]
[22.0, 21.0]
[124, 126]
p02682
u746627216
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
[', B, C, K = map(int, input().split())\n\nans = 0\nfor i in range(K):\n if A > 0:\n ans += 1\n A -= 1\n elif B > 0:\n B -= 1\n elif C > 0:\n ans -= 1\n C -= 1\n \n \nprint(ans)', 'A, B, C, K = map(int, input().split())\n\nans = 0\nif K <= A:\n ans = K\nelif K <= A + B:\n ans = A\nelse:\n ans = A - (K - A - B) \n \n#rest = K - A - B \nprint(ans)']
['Runtime Error', 'Accepted']
['s517084326', 's006954674']
[9008.0, 9148.0]
[19.0, 24.0]
[219, 171]
p02682
u750958070
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\nif K > A:\n K -= A\nelse:\n print(K)\n K = 0\nif K:\n K -= B\nelse:\n print(A)\nif K:\n print(A-K)\n', 'A, B, C, K = map(int, input().split())\nK -= A\nif K:\n K -= B\nelse:\n print(A)\nif K:\n print(A-K)\n', 'A, B, C, K = map(int, input().split())\nwhile K:\n if K > A:\n K -= A\n else:\n print(K)\n break\n if K:\n K -= B\n if K:\n print(A-K)\n break\n else:\n print(A)\n break\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s302893153', 's409411800', 's880068888']
[9164.0, 9100.0, 9172.0]
[19.0, 22.0, 23.0]
[146, 103, 227]
p02682
u754046530
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int,input().split())\n\nK -= A\nxa = min(K,A)\nK -= B\nxb = min(K,B)\nans = xa - K\nprint(ans)', 'A,B,C,K = map(int,input().split())\n\nxa = min(K,A)\nK -= xa\nxb = min(K,B)\nK -= xb\n\n\nans = xa - K\nprint(ans)']
['Wrong Answer', 'Accepted']
['s165663837', 's463484779']
[9168.0, 9192.0]
[22.0, 21.0]
[101, 105]
p02682
u755250447
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=(int(x) for x in input().split())\nif a+b > k:\n print(a)\nelse:\n print(a+(c-k))', 'a,b,c,h=(int(x) for x in input().split())\nnum = 0\ncount=h\nnum += a\ncount -= a\nif count > 0:\n count -= b\nif count >0:\n num -= count\nprint(count)', 'a,b,c,k=(int(x) for x in input().split())\nif a+b >= k:\n print(min(k,a))\nelse:\n print(a-k+a+b)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s723560625', 's991987888', 's730675219']
[9168.0, 9172.0, 9152.0]
[22.0, 24.0, 24.0]
[87, 145, 96]
p02682
u756279759
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = list(map(int, input().split( )))\n \n if(K < A):\n score = K\n elif(K >= A and K <= A+B):\n score = A\n else:\n score = A - (K - A - B)\n \n print(score)', 'A, B, C, K = list(map(int, input().split( )))\n \n if(K < A):\n score = K\n elif(K >= A and K <= A+B):\n score = A\n else:\n score = A - (K - A - B)\n \n print(score)', 'A, B, C, K = list(map(int, input().split( )))\n \nif(K < A):\n score = K\nelif(K >= A and K <= A+B):\n score = A\nelse:\n score = A - (K - A - B)\n \nprint(score)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s199529942', 's986855518', 's573551580']
[8828.0, 8880.0, 9168.0]
[25.0, 24.0, 22.0]
[188, 196, 175]
p02682
u757274384
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int, input().split())\n\nif k <= a:\n print(k)\nelif a < k <= a+b:\n print(a):\nelse:\n print(a - (k - (a+b)))', 'a,b,c,k = map(int, input().split())\nif k <= a:\n print(k)\nelif a <= k <= a+b:\n print(a)\nelif a+b <= k <= a+b+c:\n print(a - (k-(a+b)))']
['Runtime Error', 'Accepted']
['s038652141', 's096003984']
[8936.0, 9172.0]
[22.0, 24.0]
[120, 135]
p02682
u760961723
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int,input().split())\n \nif K <= (A+B):\n print(K)\nelif (A+B)<K and K<=(A+B+C):\n print(A-(K-(A+B)))\nelse:\n print(A-C)', 'A,B,C,K = map(int,input().split())\n \nif K <= A:\n print(K)\nelif K <= (A+B):\n print(A)\nelse:\n print(A-(K-(A+B)))']
['Wrong Answer', 'Accepted']
['s439623102', 's988103573']
[9124.0, 9176.0]
[23.0, 24.0]
[131, 113]
p02682
u761087606
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\nsum=0\nif(a>k):\n sum+=k\nelse:\n sum+=a\n k=k-a\n if(k==0):\n print(sum)\n if(b>k):\n print(sum)\n else:\n k = k-b\n if(k==0):\n print(sum)\n if(c>k):\n sum-=k\n print(sum)\n else:\n sum-=c\n print(sum)', 'a,b,c,k = map(int,input().split())\nsum=0\nif(k==0):\n print(sum)\n exit()\nif(a>=k):\n sum+=k\n print(sum)\n exit()\nelse:\n sum+=a\n k=k-a\n if(b>=k):\n print(sum)\n exit()\n else:\n k = k-b\n if(c>=k):\n sum-=k\n print(sum)\n else:\n sum-=c\n print(sum)\n']
['Wrong Answer', 'Accepted']
['s243788177', 's951735765']
[9136.0, 9200.0]
[22.0, 23.0]
[268, 279]
p02682
u763249708
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nif k > a:\n print(k)\n exit()\n\nk -= (a+b)\nif k <= 0:\n print(a)\n exit()\nelse:\n ans = a\n\nfor i in range(k):\n ans -= 1\nprint(ans)', 'a, b, c, k = map(int, input().split())\n\nif k < a:\n print(k)\n exit()\n\nk -= (a+b)\nif k <= 0:\n print(a)\n exit()\nelse:\n ans = a\n\nprint(ans - k)']
['Wrong Answer', 'Accepted']
['s450154946', 's943016769']
[9180.0, 9172.0]
[23.0, 21.0]
[182, 154]
p02682
u763628696
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\n\nif k < a:\n print(str(k))\nelif k < (a + b):\n print(str(a))\nelse:\n print(str(a - c)):\n ', 'a,b,c,k = map(int,input().split())\n \nif k < a:\n print(str(k))\nelif k < (a + b):\n print(str(a))\nelse:\n print(str(2*a + b - k))']
['Runtime Error', 'Accepted']
['s865215441', 's300068521']
[8900.0, 9148.0]
[22.0, 30.0]
[127, 128]
p02682
u764685829
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\nif(a+b >= k):\n print(k)\nelse:\n print(a - (k-a-b))', 'a, b, c, k = map(int, input().split())\nif(a >= k):\n print(k)\nelif(a+b>=k):\n print(a)\nelse:\n print(a - (k-a-b))']
['Wrong Answer', 'Accepted']
['s825544263', 's527873794']
[8980.0, 9172.0]
[21.0, 24.0]
[90, 113]
p02682
u769411997
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\nchk = k-a-b\nif chk > 0:\n ans = a -1*chk\nelse:\n ans = a', 'a, b, c, k = map(int, input().split())\nchk1 = k-a\nchk2 = k-a-b\nif chk1 <= 0:\n ans = k\n\nelse:\n if chk2 > 0:\n ans = a -1*chk2\n else:\n ans = a\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s382258107', 's836313656']
[9096.0, 9092.0]
[25.0, 21.0]
[99, 174]
p02682
u770076823
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nif k <= (a + b):\n print(k)\nelse:\n print(a - (k - (a + b)))', 'a, b, c, k = map(int, input().split())\n\nif k <= a:\n print(k)\nelif k <= (a + b):\n print(a)\nelse:\n print(a - (k - a - b))']
['Wrong Answer', 'Accepted']
['s227814931', 's191631029']
[9172.0, 9192.0]
[20.0, 22.0]
[104, 128]
p02682
u771804983
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K=map(int,input().split())\n\nif K<=A:\n ans=K\nelif k<=A+B:\n ans=A\nelse:\n ans=2*A-K\n\nprint(ans)', 'A,B,C,K=map(int,input().split())\n\nif K<A:\n ans=K\nelif A<=K and K<=A+B:\n ans=A\nelse:\n ans=2*A+B-K\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s316144729', 's910287572']
[9168.0, 9112.0]
[23.0, 23.0]
[107, 117]
p02682
u776134564
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=map(int,input().split())\nans=0\nif(a>=k):\n print(k)\nelif((a+b)>=k):\n print(k)\nelse:\n print(a-(k-a-b))', 'a,b,c,k=map(int,input().split())\nans=0\nif(a>=k):\n print(k)\nelif((a+b)>=k):\n print(a)\nelse:\n print(a-(k-a-b))']
['Wrong Answer', 'Accepted']
['s939844091', 's291912940']
[9024.0, 9188.0]
[23.0, 20.0]
[111, 111]
p02682
u777499281
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['abck = [int(n) for n in input().split()]\nif abck[0] + abck[1] >= abck[3]:\n print(abck[3])\nelse:\n print(abck[0] * 2 - abck[3] + abck[1])', 'abck = [int(n) for n in input().split()]\nif abck[0] >= abck[3]:\n print(abck[3])\nelif abck[0] + abck[1] >= abck[3]:\n print(abck[0])\nelse:\n print(abck[0] * 2 - abck[3] + abck[1])\n']
['Wrong Answer', 'Accepted']
['s794450990', 's859864648']
[9168.0, 9176.0]
[23.0, 24.0]
[141, 186]
p02682
u779599374
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(float, input().split())\n\nif (A+B)>=K:\n print(A)\nelse:\n print(A-(K-A-B))\n', 'A, B, C, K = map(float, input().split())\n\nif A>K:\n print(K)\nelif (A+B)>=K:\n print(A)\nelse:\n print(A-(K-A-B))\n', 'A, B, C, K = map(int, input().split())\n\nif A>K:\n print(K)\nelif (A+B)>=K:\n print(A)\nelse:\n print(A-(K-A-B))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s509761462', 's668220940', 's002548538']
[8980.0, 9036.0, 9096.0]
[23.0, 26.0, 23.0]
[95, 118, 116]
p02682
u785573018
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\nif k <= a+b:\n print(min(a, k)\nelse:\n print(2*a+b-k)', 'a, b, c, k = map(int, input().split())\nif k <= a+b:\n print(min(a, k))\nelse:\n print(2*a+b-k)']
['Runtime Error', 'Accepted']
['s858352040', 's448144348']
[8896.0, 9164.0]
[21.0, 22.0]
[96, 97]
p02682
u785728112
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\nif a<k:\n if b<k-a:\n print(a-(k-a-b))\n else:\n print(k) \nelse:\n print(k)', 'a,b,c,k = map(int,input().split())\nif a<k:\n if b<k-a:\n print(a-(k-a-b)) \n else:\n print(a) \nelse:\n print(k)\n ']
['Wrong Answer', 'Accepted']
['s294222244', 's517569694']
[9176.0, 9016.0]
[24.0, 22.0]
[119, 124]
p02682
u787797982
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\nmax = 0\nfor i in range(a, -1, -1):\n for j in range(b, -1, -1):\n for l in range(c+1):\n if i+j+l == k:\n print(i-l)', 'import sys\na, b, c, k = map(int, input().split())\nif a >= k:\n print(k)\n sys.exit()\nelse:\n if b >= k-a:\n print(a)\n sys.exit()\n else:\n print(a-(k-a-b))\n sys.exit()']
['Wrong Answer', 'Accepted']
['s847850343', 's971940369']
[9048.0, 9188.0]
[2206.0, 25.0]
[187, 201]
p02682
u789199177
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\na, b, c, k = map(int, input().split())\nj = k-(a+b)\nj = 0 if j < 0 else j\nprint(a-j if k > a else k)', 'a, b, c, k = map(int, input().split())\nif k > a:\n print(k)\nelif k <= a+b:\n print(a)\nelse:\n k -= a+b\n print(a+k)', 'a, b, c, k = map(int, input().split())\nj = k-(a+b)\nj = 0 if j < 0 else j\nprint(a-j if k > a else k)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s085369835', 's238858696', 's206391458']
[9176.0, 9168.0, 9164.0]
[18.0, 22.0, 22.0]
[138, 123, 99]
p02682
u793666115
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c , k = map(int, input().split())\n\nif k <= a+b:\n print(k)\nelse:\n print(2*a+b-k)', 'a, b, c , k = map(int, input().split())\n\nif k <= a:\n print(k)\nelif k<=a+b:\n print(a)\nelse:\n print(2*a+b-k)']
['Wrong Answer', 'Accepted']
['s357067270', 's862637080']
[9160.0, 9168.0]
[23.0, 23.0]
[91, 115]
p02682
u794066762
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
[" a,b,c,k= map(int,input().split(' '))\n if k<a:\n print(k)\n else:\n k-=a\n if k<b:\n print(a)\n else:\n k-=b\n print(a-k)", "a,b,c,k= map(int,input().split(' '))\nif k<=a:\n print(k)\nelse:\n if k<=(a+b):\n print(a)\n else:\n print(a+(a+b-k))"]
['Runtime Error', 'Accepted']
['s225634281', 's442861808']
[9004.0, 9108.0]
[24.0, 24.0]
[183, 133]
p02682
u795928154
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
["#B\nABCK = input().split(' ')\nA = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])\nK = int(ABCK[3])\nif K <= (A + B):\n print(K)\nelse:\n print(A + C * (K - A))", "#B\nABCK = input().split(' ')\nA = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])\nK = int(ABCK[3])\nif K <= (A + B):\n print(K)\nelse:\n print(A - (K - A - B))", "#B\nABCK = input().split(' ')\nA = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])\nK = int(ABCK[3])\nif K <= A:\n print(K)\nelif K <= (A + B):\n print(A)\nelse:\n print(A - (K - A - B))"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s531068514', 's793669224', 's892934610']
[9184.0, 9188.0, 9180.0]
[24.0, 22.0, 24.0]
[163, 163, 189]
p02682
u801049006
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\n\nif A+B >= K:\n print(K)\nelse:\n print(0)', 'A, B, C, K = map(int, input().split())\n\nans = 0\nans += min(K, A) * 1\nK -= A\n\nans += max(0, min(K, B)) * 0\nK -= B\n\nans += max(0, min(K, C)) * -1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s864349121', 's124862614']
[9160.0, 9196.0]
[22.0, 23.0]
[84, 155]
p02682
u802662134
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A = int(input())\nB = int(input())\nC = int(input())\nK = int(input())\n\nif K<=A:\n print(K)\nelif k<=A+B:\n print(A)\nelse:\n print(A-(C-(k-(A+B)))', 'A, B, C, K = map(int, input().split())\n\nif K<=A:\n print(str(K))\nelif k<=A+B:\n print(str(A))\nelse:\n print(str(A-(C-(k-(A+B))))\n', 'A, B, C, K = map(int, input().split())\n\nif K<=A:\n print(K)\nelif k<=A+B:\n print(A)\nelse:\n print(A-(C-(k-(A+B)))\n', 'A,B,C,K = map(int,input().split())\n \nif K <= A:\n print(str(K))\nelif K <= A + B:\n print(str(A))\nelse:\n print(str(A - (C - (A + B + C - K))))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s244841072', 's758369647', 's973108277', 's052080118']
[8940.0, 8980.0, 8980.0, 9172.0]
[22.0, 24.0, 24.0, 21.0]
[142, 129, 114, 148]
p02682
u804339040
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = input().split(None, 4)\nA = int(a)\nB = int(b)\nC = int(c)\nK = int(k)\nX = K - A - B\nif K <= A:\n print(K)\nelif A < K <= A + B:\n print(A)\nelse A + B < K:\n print(A - X)', 'a,b,c,k = input().split(None, 4)\nA = int(a)\nB = int(b)\nC = int(c)\nK = int(k)\nX = K - A - B\nif K <= A:\n print(K)\nelif A < K <= A + B:\n print(A)\nelse:\n print(A - X)\n']
['Runtime Error', 'Accepted']
['s805456713', 's587743011']
[9012.0, 9144.0]
[23.0, 25.0]
[181, 172]
p02682
u805552010
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\nif a <= k:\n print(k)\nelif a + b >= k:\n print(a)\nelse:\n print(a-(k-(a+b)))', 'a,b,c,k = map(int,input().split())\nxa = min(a,k)\nk -= xa\nxb = min(b,k)\nk -= xb\nxc = k\nans = xa -xc\nprint(ans)']
['Wrong Answer', 'Accepted']
['s707362736', 's617417060']
[9172.0, 9176.0]
[24.0, 22.0]
[117, 109]
p02682
u805852597
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['def main():\n a, b, c, k = map(int, input().split())\n if k <= a: \n return k\n if a < k <= a+b:\n return a\n if a+b < k <= a+b+c:\n return a + (k - a-b)*(-1)\n\nmain()', 'def main():\n a, b, c, k = map(int, input().split())\n if k <= a: \n return k\n if a < k <= a+b:\n return a\n if a+b < k <= a+b+c:\n return a + (a+b+c-k -1)*(-1)\n\nmain()', 'def main():\n a, b, c, k = map(int, input().split())\n if k <= a: \n return k\n if a < k <= a+b:\n return a\n if a+b < k <= a+b+c:\n return a + (k - a-b)*(-1)\n\nprint(main())']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s407417072', 's460270853', 's680427953']
[9164.0, 9164.0, 9116.0]
[21.0, 20.0, 22.0]
[192, 195, 199]
p02682
u806084713
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = list(map(int, input().split()))\n\nans = 0\n\nif k > a:\n if k > b:\n for i in range(a):\n ans += 1\n k = k - 1\n for i in range(b):\n ans += 0\n k = k - 1\n for i in range(k):\n ans += -1\n print(ans)\n elif k <= b:\n for i in range(k):\n ans += 0\n print(ans)\nelif k <= a:\n for i in range(k):\n ans += 1\n print(ans)\n \n \n\n', 'a, b, c, k = list(map(int, input().split()))\n\nans = 0\n\nif k > a:\n ans = a * 1\n k = k - a\n if k > b:\n ans += b * 0\n k = k - b\n ans += k * -1\n print(ans)\n elif k <= b:\n ans += k * 0\n print(ans)\nelif k <= a:\n ans = k * 1\n print(ans)\n \n \n\n']
['Wrong Answer', 'Accepted']
['s563015387', 's055421757']
[57908.0, 9192.0]
[2766.0, 22.0]
[388, 267]
p02682
u809043290
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
["import os\nimport random\nimport re\nimport sys\n\ndef solution(a,b,c,k):\n max=0\n while(k>0):\n while(a>0 and k>0):\n max+=1\n a-=1\n k-=1\n if(k<=0):\n return max\n break\n while(b>0 and k>0):\n b-=1\n k-=1\n if(k<=0):\n return max\n break\n while(c>0 and k>0):\n max-=1\n c-=1\n k-=1\n return max\n \n \nif __name__ == '__main__':\n fptr = sys.stdout\n a=int(input())\n b=int(input())\n c=int(input())\n k=int(input())\n result = solution(a,b,c,k)\n\n fptr.write(str(result) + '\\n')\n\n\nfptr.close()\n", 'import sys \na,b,c,k = map(int,input().split())\nmax=0\nif(a==k):\n print(a)\nelif(a>k):\n print(k)\nelse:\n if(a<k):\n max+=a\n k=k-a\n if(b>k):\n print(max)\n else:\n k=k-b\n if(k<=0):\n print(max)\n else:\n if(c>=k):\n max-=k\n print(max)\n elif(c<k):\n max-=c\n print(max)\n\n\n']
['Runtime Error', 'Accepted']
['s896565926', 's667619437']
[10304.0, 9160.0]
[30.0, 23.0]
[693, 406]
p02682
u812354010
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = int(input().split())\nif K<=A:\n print(K)\nelif A<K<=A+B:\n print(A)\nelse:\n print(A-(K-A-B))', 'A, B, C, K = map(int, input().split())\nif K<=A:\n print(K)\nelif A<K<=A+B:\n print(A)\nelse:\n print(A-(K-A-B))']
['Runtime Error', 'Accepted']
['s468331119', 's476606350']
[8912.0, 9060.0]
[22.0, 28.0]
[110, 115]
p02682
u812561224
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['# coding: utf-8\n# Your code here!\n\n\nnum_line = input().split()\n\n\nnum_one = int(num_line[0])\nnum_zero = int(num_line[1])\nnum_mini = int(num_line[2])\nnum_amount = int(num_line[3])\n\n\nif num_one >= num_amount:\n print(num_amount)\nelif num_one + num_zero >= num_amount:\n print(num_amount)\nelse:\n \n minus_count = num_amount - (num_one + num_zero)\n print(num_one - minus_count)', '# coding: utf-8\n# Your code here!\n\n\nnum_line = input().split()\n\n\nnum_one = int(num_line[0])\nnum_zero = int(num_line[1])\nnum_mini = int(num_line[2])\nnum_amount = int(num_line[3])\n\n\nif num_one >= num_amount:\n print(num_amount)\nelif num_one + num_zero >= num_amount:\n print(num_one)\nelse:\n \n minus_count = num_amount - (num_one + num_zero)\n print(num_one - minus_count)']
['Wrong Answer', 'Accepted']
['s089218917', 's797443472']
[9176.0, 9184.0]
[21.0, 23.0]
[539, 536]
p02682
u813123196
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['s = input().split()\n\nif s[3] == "0" :\n print(0)\n \nelif ( int(s[0]) >= int(s[3]) ) or ((int(s[3]) - int(s[0]) <= int(s[1]))) :\n print(s[3])\nelif int(s[3]) - int(s[0]) > int(s[1]) :\n print(int(s[0])- (int(s[3])-int(s[0])-int(s[1])))', 's = input().split()\n\nif s[3] == "0" :\n print(0)\n \nelif ( int(s[0]) >= int(s[3]) ) :\n print(s[3])\n\nelif ((int(s[3]) - int(s[0]) <= int(s[1]))):\n print(s[0])\nelif int(s[3]) - int(s[0]) > int(s[1]) :\n print(int(s[0])- (int(s[3])-int(s[0])-int(s[1])))']
['Wrong Answer', 'Accepted']
['s757075845', 's417195669']
[9240.0, 9216.0]
[24.0, 22.0]
[242, 262]
p02682
u813405587
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\nd = k - a\nk -= a\ne = k - b\nk -= b\nf = k - c\nn = 0 \nif d == 0:\n print(a)\nelif e == 0 and e < 0:\n print(a)\nelif f == 0:\n print(a + c)\nelif k < a:\n print(k)\nelse:\n print(a - e)\n\n \n', 'a,b,c,k = map(int,input().split())\ns = k\nd = k - a\nk -= a\ne = k - b\nk -= b\nf = k - c\nn = 0 \nif d == 0:\n print(a)\nelif s < a:\n print(s)\nelif e == 0 or e < 0:\n print(a)\nelif f == 0 :\n print(a - c)\nelse:\n print(a - e)\n\n \n']
['Wrong Answer', 'Accepted']
['s062667367', 's502341470']
[9192.0, 9152.0]
[23.0, 22.0]
[218, 224]
p02682
u814265211
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['N = int(input())\nA = list(map(int, input().split()))\n\nif 0 in A:\n print(0)\n exit()\n \nn = 1\nfor i in range(N):\n n *= A[i]\n if n > 10**18:\n print(-1)\n exit()\n\nprint(n)\n', 'A, B, C, K = map(int, input().split())\nif K <= A:\n print(K)\nelif K <= A + B:\n print(A)\nelse:\n print(A - (K - A - B))\n ']
['Runtime Error', 'Accepted']
['s005463592', 's579838484']
[9108.0, 9152.0]
[22.0, 26.0]
[201, 129]
p02682
u819407764
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nans = 0\n\nif a + b >= k:\n print(k)\nelse:\n ans = a - (k-a-b)\n print(ans)', 'a, b, c, k = map(int, input().split())\n\nans = 0\n\nif a >= k:\n print(k)\nelif a + b >= k:\n print(a)\nelse:\n ans = a - (k-a-b)\n print(ans)\n']
['Wrong Answer', 'Accepted']
['s884460359', 's776253535']
[9168.0, 9172.0]
[20.0, 22.0]
[119, 147]
p02682
u821251381
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K =map(int,input().split())\n\nprint(K if A+B >=K else A-(K-(A+B)))', 'A,B,C,K =map(int,input().split())\n\nif K<=A:\n print(K)\nelif A+B >=K:\n print(A)\nelse:\n print(A-(K-(A+B)))']
['Wrong Answer', 'Accepted']
['s681430996', 's449386280']
[9164.0, 9172.0]
[21.0, 20.0]
[71, 106]
p02682
u824279365
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A = int(input())\nB = int(input())\nC = int(input())\nK = int(input())\nremain_A = K-A\nif remain_A<=0:\n print(K)\nelse:\n remain_B = remain_A - B\n if remain_B <= 0:\n print(A)\n else:\n ans = (A*1) + (B*0) + (remain_B * (-1))\n print(ans)', 'A = int(input())\nB = int(input())\nC = int(input())\nK = int(input())\nif A > K:\n print(K)\nelif B > K:\n print(A)\nelse:\n ans = (A*1) + (B*0) + (K-(A+B))*(-1)\n print(ans)', 'A,B,C,K=(int(x) for x in input().split())\nremain_A = K-A\nif remain_A<=0:\n print(K)\nelse:\n remain_B = remain_A - B\n if remain_B <= 0:\n print(A)\n else:\n ans = (A*1) + (B*0) + (remain_B * (-1))\n print(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s085482575', 's505682060', 's763631605']
[9172.0, 9068.0, 9076.0]
[24.0, 25.0, 30.0]
[261, 177, 235]
p02682
u827261928
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K=map(int,input().split())\nfor i in range(C):\n for j in range(B):\n for k in range(A):\n if i+j+k==K:\n print(-1*i+k)\n exit()', 'A,B,C,K=map(int,input().split())\nif A>=K:\n print(K)\nelif A+B>=K:\n print(A)\nelse:\n print(A-(K-A-B))']
['Wrong Answer', 'Accepted']
['s932140729', 's459174785']
[9020.0, 9104.0]
[2206.0, 28.0]
[179, 107]
p02682
u830036378
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['if __name__ == "__main__":\n a = int(input())\n b = int(input())\n c = int(input())\n k = int(input())\n\n if (k <= a + b):\n print(a)\n else:\n print(a - k + a + b)\n', 'if __name__ == "__main__":\n A = int(input())\n B = int(input())\n C = int(input())\n K = int(input())\n \n if (K <= A + B):\n print(A)\n else:\n print(A - K + A + B)\n', 'if __name__ == "__main__":\n num = list(map(int, input().split()))\n\n if (num[3] == 0):\n print(0)\n elif (num[0] == 0 and num[1] == 0 and num[2] == 0):\n print(0)\n elif (num[3] <= num[0]):\n print(num[3])\n else:\n print(num[0] - num[3] + num[0] + num[1])\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s008440141', 's596374322', 's715599268']
[9060.0, 9024.0, 9176.0]
[25.0, 23.0, 21.0]
[189, 193, 292]
p02682
u830297276
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nans = 0\nif(k <= a):\n print(k)\nelif(k <= a + b):\n print(a)\nelse:\n ans = k - (a + b)\n print(a - ans)\n', 'a, b, c, k = map(int, input().split())\n\nans = 0\nif(k <= a):\n print(k)\nelif(k <= a + b):\n print(a)\nelse:\n ans = k - (a + b)\n print(a - ans)\n']
['Runtime Error', 'Accepted']
['s759593364', 's339299819']
[9032.0, 9164.0]
[24.0, 22.0]
[155, 151]
p02682
u831311378
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = [int(i) for i in input().split()]\nif k<=a:\n print(k)\nelse if k<=a+b and k>a:\n print(a)\nelse:\n print(a-(k-a-b))\n ', 'a,b,c,k = [int(i) for i in input().split()]\nif k<=a:\n print(k)\nelse if a<k<=a+b:\n print(a)\nelse:\n print(a-(k-a-b))\n ', 'a,b,c,k = [int(i) for i in input().split()]\nif k<=a:\n print(k)\nelif k<=a+b and k>a:\n print(a)\nelse:\n print(a-(k-a-b))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s735404136', 's904288142', 's999195100']
[9040.0, 9020.0, 9168.0]
[24.0, 25.0, 22.0]
[130, 124, 120]
p02682
u833242004
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['line = input().split(" ")\na, b, c, k = line[0], line[1], line[2], line[3]\n\nif a >= k:\n print(k)\n return \n\ntmp = k - a\nif b >= tmp:\n print(a)\n return\n\nprint(a - (k - a -b))', 'import sys\nline = list(map(lambda x: int(x), input().split(" ")))\na, b, c, k = line[0], line[1], line[2], line[3]\n \nif a >= k:\n print(k)\n sys.exit(0)\n \ntmp = k - a\nif b >= tmp:\n print(a)\n sys.exit(0)\n \nprint(a - (k - a -b))']
['Runtime Error', 'Accepted']
['s809448282', 's634341723']
[9108.0, 9064.0]
[19.0, 20.0]
[175, 227]
p02682
u834983620
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,d = map(int,input().split())\n\nans = 0\n\nif d == 0:\n ans = 0\nelif a >= d:\n ans = d\nelif (a + b) >= d:\n ans = d\nelif (a + b - c) <= 0:\n ans = 0\nelse:\n ans = a - c\n\nprint(ans)', 'a,b,c,d = map(int,input().split())\n \nans = 0\n \nif a >= d:\n ans = d\nelif (a + b) >= d:\n ans = d\nelif (a + b -c) >=0:\n ans = 0\nelse:\n ans = a - c\n \nprint(ans)', 'a,b,c,d = map(int,input().split())\n \nans = 0\n \nif a >= d:\n ans = d\nelif (a + b) >= d:\n ans = a\nelif (a + b + c) <= d:\n ans = a - c\nelse:\n ans = a - (d - (a+b))\n\nif ans >= 0:\n ans = 0\nprint(ans)', 'a,b,c,d = map(int,input().split())\n \nans = 0\n \nif a >= d:\n ans = d\nelif (a + b) >= d:\n ans = d\nelif (a + b + c) >= d and (a + b -c) >=0:\n ans = 0\nelse:\n ans = a - c\n \nprint(ans)', 'a,b,c,d = map(int,input().split())\n \nans = 0\n \nif a >= d:\n ans = d\nelif (a + b) >= d:\n ans = a\nelse:\n ans = a - (d - (a+b))\n \n \nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s143783410', 's319575611', 's373384956', 's620994152', 's966598778']
[9176.0, 9180.0, 9188.0, 9184.0, 9176.0]
[22.0, 25.0, 24.0, 21.0, 24.0]
[192, 168, 208, 189, 153]
p02682
u837340160
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\n\ncount = 0\nif K > A:\n count += A\n K -= A\n if K > B:\n K -= B\n if K > 0:\n count -= K\nelse:\n count += K\n', 'A, B, C, K = map(int, input().split())\n\ncount = 0\nif K > A:\n count += A\n K -= A\n if K > B:\n K -= B\n if K > 0:\n count -= K\nelse:\n count += K\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s035835024', 's303626683']
[9160.0, 9180.0]
[22.0, 25.0]
[177, 190]
p02682
u842555843
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\nif K <= A+B:\n print(K)\nelse:\n print(A - (K-A-B))', 'A, B, C, K = map(int, input().split())\nif K <= A:\n print(K)\nelif K <= A+B:\n print(A)\nelse:\n print(A - (K-A-B))']
['Wrong Answer', 'Accepted']
['s808517867', 's645368096']
[9164.0, 9144.0]
[22.0, 22.0]
[93, 119]
p02682
u844558673
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['i = input().split()\n\na = i[0]\nb = i[1]\nc = i[2]\nd = i[3]\n\nif int(d) <= int(a):\n print(int(d))\n elif int(d) - int(a) <= int(b):\n print(int(a))\nelse:\n print(int(a) - (int(d) - int(a) -int(b)))', 'i = input().split()\na = int(i[3])-int(i[0])\nb = int(i[3])-int(i[0])-int(i[1])\n\nif i[3] <= i[0]:\n print(i[3])\nelif a <= int(i[1]):\n print(a)\nelif b == int(i[2]):\n print(int(i[0]) - int(i[2]))\nelse:\n print(int(i[0])*2 + int(i[1]) - int(i[3]))', 'i = input().split()\n\na = i[0]\nb = i[1]\nc = i[2]\nd = i[3]\n\nif int(d) <= int(a):\n print(int(d))\nelif int(d) - int(a) <= int(b):\n print(int(a))\nelse:\n print(int(a) - (int(d) - int(a) -int(b)))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s081827103', 's428800626', 's960900723']
[9020.0, 9156.0, 8936.0]
[23.0, 22.0, 22.0]
[196, 244, 194]
p02682
u845152373
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nif k <= a + b:\n print(k)\nelse:\n print(a - (k - a - b))\n', 'a, b, c, k = map(int, input().split())\n\nif k <= a:\n print(k)\nelif k <= a + b:\n print(a)\nelse:\n print(a - (k - a - b))\n']
['Wrong Answer', 'Accepted']
['s669887387', 's316528268']
[9116.0, 9128.0]
[22.0, 20.0]
[97, 121]
p02682
u845468321
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['n = list(map(int,input().split()))\n\nsum = 0\nnum = 0\nnm = [1,0,-1]\nc = n[3]\ncu =0\n\n\nfor i in n:\n print(sum)\n if c == 0:\n break\n if i > c:\n sum+= nm[num]*c\n break\n if i <= c:\n sum += nm[num] * i\n c-=i\n num+=1\n\n\n\n\nprint(sum)\n', 'n = list(map(int,input().split()))\n\nsum = 0\nnum = 0\nnm = [1,0,-1]\nc = n[3]\ncu =0\n\n\nfor i in n:\n if c == 0:\n break\n if i > c:\n sum+= nm[num]*c\n break\n if i <= c:\n sum += nm[num] * i\n c-=i\n num+=1\n\n\n\n\nprint(sum)\n']
['Wrong Answer', 'Accepted']
['s047329999', 's052682324']
[9184.0, 9192.0]
[22.0, 22.0]
[276, 261]
p02682
u845650912
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int,input().split())\n\nif K <= A + B:\n print(K)\nif A + B < K <= A + B + C:\n print(2*A + B - K)', 'A, B, C, K = map(int,input().split())\n\nif k <= A:\n print(K)\nif A < K <= A + B:\n print(A)\nif A + B < K <= A + B + C:\n print(2*A + B - K)\n ', 'A, B, C, K = map(int,input().split())\n\nif K <= A:\n print(K)\nif A < K <= A + B:\n print(A)\nif A + B < K <= A + B + C:\n print(2*A + B - K)\n ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s769776454', 's970569325', 's267665540']
[9168.0, 9156.0, 9132.0]
[24.0, 25.0, 22.0]
[116, 149, 149]
p02682
u845847173
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, d = map(int, input().split())\nif a >= k:\n print(1 * k)\nelse:\n if b >= (k - a):\n print(1 * a + k * 0)\n else:\n if c >= (k - a - b):\n print(1 * a + 0 * b + (-1) * k)\n else:\n print(-1)\n', 'a, b, c, k = map(int, input().split())\nif a >= k:\n print(1 * k)\nelse:\n if b >= (k - a):\n print(1 * a + (k - a) * 0)\n else:\n if c >= (k - a - b):\n print(1 * a + 0 * b + (-1) * (k - a - b))\n else:\n print(-1)\n']
['Runtime Error', 'Accepted']
['s399410654', 's993230427']
[9020.0, 9188.0]
[23.0, 22.0]
[242, 258]
p02682
u846385882
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int,input().split())\n\n\nif a>=k:\n Result=k\nelif a+b>=k:\n Result=a\nelse:\n Result=2a-k+b\n\nprint(Result)', 'a,b,c,k = map(int,input().split())\n\nif a>=k:\n Result=k\nelif a+b>=k>a:\n Result=a\nelse:\n Result=2a-k+b\n\nprint(Result)', 'a,b,c,k = map(int,input().split())\n\n\nif a>=k:\n Result=k\nelif a+b>=k>a:\n Result=a\nelse:\n Result=2*a-k+b\n\nprint(Result)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s455586176', 's876394517', 's316435134']
[9024.0, 9024.0, 9100.0]
[21.0, 24.0, 23.0]
[123, 124, 127]
p02682
u847402720
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = (int(x) for x in input().split())\nanswer = 0\nanswer += min(a,k)\nk = k - min(a,k)\nk = k - min(b-k)\nanswer -= min(c,k)\nprint(answer)', 'a,b,c,k = (int(x) for x in input().split())\nanswer = 0\nanswer += min(a,k)\nk = k - min(a,k)\nk = k - min(b,k)\nanswer -= min(c,k)\nprint(answer)']
['Runtime Error', 'Accepted']
['s798428248', 's661872079']
[9168.0, 9140.0]
[25.0, 22.0]
[140, 140]
p02682
u849334482
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n\nans = 0\n\nans += min(a, k)\nk -= min(a,k)\n\nans += min(b, k) * 0\nk -= min(b,k)\n\nans += min(c,k) + -1\nk -= min(c,k)\n\nprint(ans)', 'a, b, c, k = map(int, input().split())\n\nans = 0\n\nans += min(a, k)\nk -= min(a,k)\n\nans += min(b, k) * 0\nk -= min(b,k)\n\nans += min(c,k) * -1\nk -= min(c,k)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s078908274', 's596083990']
[9088.0, 9196.0]
[21.0, 21.0]
[163, 163]
p02682
u849341325
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = list(map(int,input().split()))\n\nif K <= A:\n\tmax = K\nelif A < K and K <= A+B\n\tmax = A\nelse:\n\tmax = A-(K-(A+B))\n\t\nprint(max)', 'A, B, C, K = list(map(int,input().split()))\n\nif K <= A:\n\tmax = K\nelif A < K and K <= A+B:\n\tmax = A\nelse:\n\tmax = A-(K-(A+B))\n\t\nprint(max)']
['Runtime Error', 'Accepted']
['s186262352', 's881794252']
[8956.0, 9176.0]
[22.0, 22.0]
[135, 136]
p02682
u851082576
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = [int(i) for i in input().split()]\n\nif k <= a and k - a <= b:\n\tprint(k)\nelse\n\tprint(a - (k - a - b))', 'a, b, c, k = [int(i) for i in input().split()]\n\nif k <= a and k - a <= b:\n\tprint(k)\nelse:\n\tprint(a - (k - a - b))']
['Runtime Error', 'Accepted']
['s085413498', 's785547892']
[8960.0, 9096.0]
[21.0, 23.0]
[112, 113]
p02682
u852386636
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['total = 0\nif K < A:\n print(A)\nelse:\n total += A\n K = K - A\n if K < B:\n print(total)\n else:\n K = K - B\n if K < C:\n total -= K\n print(total)\n else:\n total -= C\n print(total)', 'A, B, C, K = map(int, input().split())\n\ntotal = 0\nif K <= A:\n print(K)\nelse:\n total += A\n K = K - A\n if K <= B:\n print(total)\n else:\n K = K - B\n if K <= C:\n total -= K\n print(total)\n else:\n total -= C\n print(total)']
['Runtime Error', 'Accepted']
['s245783468', 's648151872']
[9028.0, 9188.0]
[25.0, 25.0]
[258, 301]
p02682
u854685063
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['import sys\nimport math\ndef I():return int(sys.stdin.readline().replace("\\n",""))\ndef I2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef S():return str(sys.stdin.readline().replace("\\n",""))\ndef L():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":\n a,b,c,k = I2()\n l = k-a-b\n print(l)\n if k <= a:print(k)\n elif a+b >= k:print(a)\n elif l <= c:print(a-l)', 'import sys\nimport math\ndef I():return int(sys.stdin.readline().replace("\\n",""))\ndef I2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef S():return str(sys.stdin.readline().replace("\\n",""))\ndef L():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":\n a,b,c,k = I2()\n l = k-a-b\n #print(l)\n if k <= a:print(k)\n elif a+b >= k:print(a)\n elif l <= c:print(a-l)']
['Wrong Answer', 'Accepted']
['s660307987', 's105590583']
[9168.0, 9220.0]
[23.0, 22.0]
[594, 595]
p02682
u857133667
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['i = list(map(int,input().split()))\n\nif i[0] <= i[3]:\n\tsaidai=1*i[0]\nelif:\n\tsaidai=1*i[3]\nelse:\nif i[2] >= (i[3]-i[0]-i[1]):\n\tsaidai=saidai-1*(i[3]-i[0]-i[1])\n\nprint (saidai)\n\t', 'i = list(map(int,input().split()))\n\nif i [0] >= i[3]:\n\tsaidai=1*i[3]\nelse:\n\tsaidai=1*i[0]-1*(i[3]-i[0]-i[1])\nprint (saidai)\n\t']
['Runtime Error', 'Accepted']
['s510238837', 's726986107']
[8860.0, 9100.0]
[25.0, 24.0]
[175, 125]
p02682
u857555436
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\nscore = 0\n\nif K - (A + B) > 0:\n \n score = A - (K - (A + B))\nelse:\n \n score = max(K, A)\n\nprint(score)', 'A, B, C, K = map(int, input().split())\nscore = 0\n\nif K - (A + B) > 0:\n \n score = A - (K - (A + B))\nelse:\n \n score = min(K, A)\n\nprint(score)']
['Wrong Answer', 'Accepted']
['s231907559', 's693016164']
[9048.0, 9068.0]
[20.0, 22.0]
[183, 183]
p02682
u859072377
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['#python 3.7.1\n\na=int(input())\n\nb=int(input())\n\nc=int(input())\n\nd=int(input())\n\ncnt=0\n\nwhile(d!=0):\n\n \n\n if(a!=0 and d>0):\n\n d-=1\n\n a=a-1\n\n \n\n cnt=cnt+1\n\n \n\n elif b!=0 and d>0:\n\n d-=1\n\n b=b-1\n\n \n\n \n\n elif c!=0 and d>0:\n\n d-=1\n\n c=c-1\n\n \n\n cnt=cnt-1\n\n \n\nprint(cnt)\n\n ', '#python 3.7.1\n\na, b, c, d=map(int, input().split())\n\nk=d\n\nif(a-k>0):\n\n print(k)\n\nelse:\n\n k=d-a\n\n if(b-k>0):\n\n print(a)\n\n \n\n else:\n\n k=d-a-b\n\n print(a-k)\n\n \n\n \n\n \n\n \n\n \n\n']
['Runtime Error', 'Accepted']
['s429883550', 's316028665']
[9148.0, 9184.0]
[20.0, 22.0]
[312, 196]
p02682
u860886058
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = [int(x) for x in input().strip().split()]\nk = K\nres = 0\nif A > K:\n\tprint(K)\nelse:\n\tk -= A\n\tres += A\n if b > k:\n print(res)\n else:\n k -= b\n if k > 0:\n res -= k * -1\n print(res)\n ', 'a, b, c, k = [int(x) for x in input().split()]\nres = 0\ni = 0\nt = [a, b, c]\nj = [1, 0, -1]\nwhile k > 0:\n m = min(k, t[i])\n k -= m\n res += j[i] * m\n i += 1\nprint(res)']
['Runtime Error', 'Accepted']
['s819732594', 's419777987']
[8960.0, 9156.0]
[23.0, 24.0]
[240, 168]
p02682
u863433366
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n \nif a >= k:\n print(k)\nelif:\n a+b >= k\n print(a)\nelse:\n k -= a+b\n print(a-1*k)', 'a, b, c, k = map(int, input().split())\n \nif a >= k:\n print(k)\nelif a+b >= k:\n print(a)\nelse:\n k -= a+b\n print(a-1*k)']
['Runtime Error', 'Accepted']
['s025467053', 's662585211']
[9016.0, 9148.0]
[23.0, 22.0]
[126, 124]
p02682
u864085306
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['X = list(map(int,input().split()))\nA = X[0]\nB = X[1]\nC = X[2]\nK = X[3]\nscore=[1,0,-1]\nmax_score = 0\nnums = []\n\nif (K>=A):\n max_score += 1*A\nif (K-A<=B):\n max_score += 2*B\nif (K-A-B>0):\n max_score += (-1)*(K-A-B)\nprint(max_score)\n ', 'X = list(map(int,input().split()))\nA = X[0]\nB = X[1]\nC = X[2]\nK = X[3]\nscore=[1,0,-1]\nmax_score = 0\nnums = []\n\nif (K>=A):\n max_score += 1*A\nif (K>=A+B):\n max_score += 0*B\nif (K-A-B>0):\n max_score += (-1)*(K-A-B)\n\nif(A>K):\n max_score += 1*K\n \nprint(max_score)\n ']
['Wrong Answer', 'Accepted']
['s348876686', 's329456637']
[9196.0, 9108.0]
[21.0, 23.0]
[234, 266]
p02682
u865108308
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a = int(input())\nb,c = map(int, input().split())\nk = int(input())\nn = 0\n\nfor _ in range(k):\n if a > 0:\n n += 1\n elif b > 0:\n n += 0\n elif c > 0:\n n -= 1\n \nprint(n)', 'a, b, c, k = map(int, input().split())\nn = 0\n\nfor _ in range(k):\n if a > 0:\n n += 1\n elif b > 0:\n n += 0\n else:\n n -= 1\n \nprint(n)\n', 'a, b, c, k = map(int, input().split())\nn = 0\n\nfor _ in range(k):\n if a > 0:\n n += 1\n elif b > 0:\n n += 0\n elif c > 0:\n n -= 1\n \nprint(n)\n', 'a = int(input())\nb,c = map(int, input().split())\nk = int(input())\nn = 0\n\nfor s in range(k):\n if a > 0:\n n += 1\n elif b > 0:\n n += 0\n else:\n n -= 1\n \nprint(n)\n', 'a, b, c, k = map(int, input().split())\n\nif k <= a:\n print(k)\nelif a < k <= a+b:\n print(a)\nelif a+b < k <= a+b+c:\n print(2*a + b - k)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s023019577', 's298289718', 's385344038', 's465153525', 's579534838']
[9204.0, 9104.0, 8988.0, 9176.0, 9124.0]
[25.0, 2205.0, 2206.0, 24.0, 23.0]
[178, 146, 152, 173, 136]
p02682
u871867619
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = map(int, input().split())\n\nif A => K:\n print(K)\nelif A + B => K:\n print(A)\nelse:\n print(A+(K-C)*(-1))\n\n', 'A, B, C, K = map(int, input().split())\n\nif A >= K:\n print(K)\nelif A + B >= K:\n print(A)\nelse:\n print(A+(K-B-A)*(-1))\n']
['Runtime Error', 'Accepted']
['s892018928', 's039529490']
[8832.0, 9148.0]
[23.0, 24.0]
[125, 126]
p02682
u873762144
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = list(map(input(),split()))\nif a+b >= k:\n print(min(a,k))\nelse:\n print(a-(k-a-b))', 'a,b,c,k = list(map(int,input().split()))\nif a+b >= k:\n print(min(a,k))\nelse:\n print(a-(k-a-b))']
['Runtime Error', 'Accepted']
['s246464889', 's569692193']
[9036.0, 9088.0]
[21.0, 19.0]
[92, 96]
p02682
u879921371
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=map(int,input().split())\nprintmin((a-max(k-a-b,0)),k)', 'a,b,c,k=map(int,input().split())\nprint(min((a-max(k-a-b,0)),k)', 'a,b,c,k=map(int,input().split())\nprint(min((a-max(k-a-b,0)),k))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s356768960', 's668109241', 's047285477']
[9164.0, 9032.0, 9112.0]
[24.0, 22.0, 21.0]
[61, 62, 63]
p02682
u880128069
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['Copy\na,b,c,k = map(int,input().split())\n \nans = 0\n \nif k <= a:\n ans = a\n print(ans)\nelif a< k <= a+b:\n ans = a\n print(ans)\nelse:\n ans = a-(K-a-b)\n if ans < 0:\n ans = 0\n print(ans)', 'a,b,c,k = map(int,input().split())\n \nans = 0\n \nif 0< k <= a:\n ans = k\n print(ans)\nelif a+1 <= k <= a+b:\n ans = a\n print(ans)\nelse:\n ans = a-(k-a-b)\n print(ans)']
['Runtime Error', 'Accepted']
['s840190321', 's931040738']
[9056.0, 9188.0]
[23.0, 24.0]
[189, 165]
p02682
u880400515
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A, B, C, K = list(map(int, input()))\n\nif (A <= K):\n print(K)\nelif (A + B <= K):\n print(A)\nelse:\n print(A+(-1)*(K-A-B))', 'A, B, C, K = list(map(int, input().split()))\n\nif (A >= K):\n print(K * 1)\nelif (A + B >= K):\n print(A)\nelse:\n print(A+(-1)*(K-A-B))']
['Runtime Error', 'Accepted']
['s313281369', 's740635892']
[9048.0, 9172.0]
[28.0, 21.0]
[127, 139]
p02682
u882389182
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = map(int, input().split())\n\nans = 0\n\nif k <= a:\n ans = k\nelif a < k < a+b:\n ans = a\nelif k > a+b:\n ans = 2 * a - k + b\n \nprint(ans)\n \n', 'a,b,c,k = map(int, input().split())\n\nans = 0\n\nif k <= a:\n ans = k\nelif a < k <= a+b:\n ans = a\nelif k > a+b:\n ans = 2 * a - k + b\n \nprint(ans)\n \n']
['Wrong Answer', 'Accepted']
['s211583183', 's954041726']
[9124.0, 9092.0]
[30.0, 26.0]
[148, 149]
p02682
u882514852
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A,B,C,K = map(int,input().split())\n\nif K-A > 0:\n if K-A-B > 0:\n print(A-(K-A-B))\n else:\n print(K)\nelse:\n print(K)', 'A,B,C,K = map(int,input().split())\n\nif K-A > 0:\n if K-A-B > 0:\n print(A-(K-A-B))\n else:\n print(A)\nelse:\n print(K)']
['Wrong Answer', 'Accepted']
['s609872975', 's420414044']
[8840.0, 9168.0]
[29.0, 28.0]
[122, 122]
p02682
u883574098
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['import io, sys, atexit, os\nimport math as ma\nfrom sys import exit\nfrom decimal import Decimal as dec\nfrom itertools import permutations\nfrom itertools import combinations\n\n\ndef li():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef num():\n return map(int, sys.stdin.readline().split())\n\n\ndef nu():\n return int(input())\n\n\ndef find_gcd(x, y):\n while (y):\n x, y = y, x % y\n return x\n\n\ndef lcm(x, y):\n gg = find_gcd(x, y)\n return (x * y // gg)\n\n\nmm = 1000000007\n\ndef solve():\n t = 1\n for tt in range(t):\n a,b,c,d=num()\n if(a+b>=d):\n print(d)\n else:\n z=d-a-b\n print(a-z)\n\n \n\n\nif __name__ == "__main__":\n solve()\n', 'import io, sys, atexit, os\nimport math as ma\nfrom sys import exit\nfrom decimal import Decimal as dec\nfrom itertools import permutations\nfrom itertools import combinations\n\n\ndef li():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef num():\n return map(int, sys.stdin.readline().split())\n\n\ndef nu():\n return int(input())\n\n\ndef find_gcd(x, y):\n while (y):\n x, y = y, x % y\n return x\n\n\ndef lcm(x, y):\n gg = find_gcd(x, y)\n return (x * y // gg)\n\n\nmm = 1000000007\n\ndef solve():\n t = 1\n for tt in range(t):\n a,b,c,d=num()\n if(a+b>=d):\n print(min(a,d))\n else:\n z=d-a-b\n print(a-z)\n\n \n\n\nif __name__ == "__main__":\n solve()\n']
['Wrong Answer', 'Accepted']
['s128308437', 's290557272']
[9912.0, 9944.0]
[25.0, 25.0]
[724, 731]
p02682
u885717263
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k = list(map(int, input().split(" ")))\n\nd = k-a\nif d == 0:\n print(a)\nelif d < 0:\n print(k)\nelif d > 0:\n if b > d:\n print(a)\n else:\n print(d-c)\n ', 'a,b,c,k = list(map(int, input().split(" ")))\n\nd = k-a\nif d == 0:\n print(a)\nelif d < 0:\n print(k)\nelif d > 0:\n if b >= d:\n print(a)\n else:\n i = d-b\n print(a-i)\n ']
['Wrong Answer', 'Accepted']
['s454209391', 's577734595']
[9168.0, 9172.0]
[23.0, 22.0]
[161, 174]
p02682
u887080361
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k=map(int,input().split())\nif k < a:\n print(k)\nelif k <= a+b:\n print(a)\nelse:\n print(2a+b-k)', 'a,b,c,k=map(int,input().split())\nif k < a:\n print(k)\nelif k <= a+b:\n print(a)\nelse:\n print(2*a+b-k)']
['Runtime Error', 'Accepted']
['s493824573', 's441264600']
[8868.0, 9056.0]
[25.0, 31.0]
[107, 108]
p02682
u896741788
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a,b,c,k-map(inat,input().split())\nans=0\nans+=min(k,a)\nk-=min(k,a)\nk-=min(k,b)\nans-=min(k,c)\nprint(ans)', 'a,b,c,k=map(int,input().split())\nans=0\nans+=min(k,a)\nk-=min(k,a)\nk-=min(k,b)\nans-=min(k,c)\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s644621321', 's146213925']
[8980.0, 9160.0]
[24.0, 30.0]
[102, 102]
p02682
u897633035
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, k = map(int, input().split())\n \nif(k-a-b<=0):\n print(max(1*a+0*(k-a)))\nelse :\n print(max(1*a+0*b-1*(k-a-b)))', 'a, b, c, k = map(int, input().split())\n \nif(k-a<=0):\n print(k)\nelif(k-a-b<=0):\n print(1*a - 0*(k-a))\nelse :\n print(1*a+0*b-1*(k-a-b))']
['Runtime Error', 'Accepted']
['s862620778', 's097660654']
[9176.0, 9176.0]
[24.0, 23.0]
[126, 145]
p02682
u898631971
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['A , B , C , K = map(int,input().split())\n\ns = 0\n\nmn = min(A, K)\ns += mn \nK -= mn\nprint(K)\n\nmn = min(B, K)\nK -= mn\nprint(K)\n\nmn = min(C, K)\ns -=mn\nK -= mn\nprint(K)\n\nprint(s)', 'A , B , C , K = map(int,input().split())\n\ns = 0\n\nmn = min(A, K)\ns += mn \nK -= mn\n\nmn = min(B, K)\nK -= mn\n\nmn = min(C, K)\ns -=mn\nK -= mn\n\nprint(s)']
['Wrong Answer', 'Accepted']
['s579201706', 's783947403']
[9208.0, 9112.0]
[30.0, 32.0]
[172, 145]
p02682
u901466816
2,000
1,048,576
We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s. We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?
['a, b, c, d = map(int, input().split())\n\ns = 0\ns += min(a, d)\nif min(a, d) == d:\n print(s)\nelif min(a+b, d) == d\n print(a)\nelse:\n d -= a + b\n print(a-min(c, d))', 'a, b, c, d = map(int, input().split())\n\ns = 0\ns += min(a, d)\nif min(a, d) == d:\n print(s)\nelif min(a+b, d) == d:\n print(a)\nelse:\n d -= a + b\n print(a-min(c, d))']
['Runtime Error', 'Accepted']
['s191937222', 's411348901']
[9032.0, 9188.0]
[22.0, 22.0]
[163, 164]