TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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?

Submission attempts (in order):
A,B,C,K = input().split()
a = int(A)
b = int(B)
k = int(K)

B_number = 0
C_number = 0

A_number = min(a,k)
k1 = k - a
if k1 > 0:
    B_number = min(b,k1)
    k2 = k1 - b
    if k2 > 0:
    C_number = min(c,k2)

print(A_number-C_number)

A,B,C,K = input().split()
a = int(A)
b = int(B)
c = int(C)
k = int(K)

B_number = 0
C_number = 0

A_number = min(a,k)
k1 = k - a
if k1 > 0:
    B_number = min(b,k1)
    k2 = k1 - b
    if k2 > 0:
        C_number = min(c,k2)

print(A_number-C_number)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
card = list(map(int, input().split()))
a = list()
b = list()
c = list()
list = list()
result = 0

for i in range(card[0]):
  a.append(1)
for i in range(card[1]):
  b.append(0)
for i in range(card[2]):
  c.append(-1)

for i in a:
  list.append(i)
for i in b:
  list.append(i)
for i in c:
  list.append(i)
print(list)

for i in range(card[3]):
  result += list[i]
print(result)

card = list(map(int, input().split()))
list = list()
result = 0

if card[3] <= card[0]:
  result = card[3]
elif card[0] < card[3] and card[3] <= card[1]:
  result = card[0]
else:
  result = card[0] - (card[3] - (card[0] + card[1]))

print(result)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K=input().split()
res=0
if int(K) < int(A):
  		res=1*int(A)
elif int(K)-int(A)-int(B)>0:
      	res-=1*(int(K)-int(A)-int(B))     

print(res)

A,B,C,K=input().split()
res=0
cnt=0
if int(K)-int(A)<=0:
  		res=1*int(K)
else:
  		res=1*int(A)
cnt=int(K)-int(A)-int(B)
if cnt>0:
        res-=1*cnt
print(res)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
#-*-coding:utf-8-*-
a,b,c,k = map(int, input().split())
sum = 0

if a > k:
  sum = a 
elif (a + b) < k:
  sum = a 
else:
  sum = a + b - (k - a - b)
  
print(sum)

#-*-coding:utf-8-*-
A, B, C, K = map(int, input().split())
sum = 0
if K >= A+B:
  sum = A - (K-A-B)
else:
  sum = K
    
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = map(int, input().split());

if a > k:
  print(k)
  break;
else:
  num = a; 
  
  if k >= a + b:
  num -= k - (a + b);
  print(num)

a, b, c, k = map(int, input().split());

if a > k:
  print(k)
  break;
else:
  num = a; 
  
  if k >= a + b:
  num -= k - (a + b);

print(num)
  
  


a, b, c, k = map(int, input().split());

if a > k:
  print(k)
else:
  num = a; 
  
  if k >= a + b:
      num -= k - (a + b);
  print(num)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

print(A-1*(K-A-B) if K >A+B else A)

A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(A-(K-A-B))
else :
  print(A)

A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K or A + B >=K:
  print(A)
else :
  print(A-1*(K-A-B))

A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(2*A-K+B)
else :
  print(A)

A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K :
  print(1*A)
elif A + B >=K :
  print(1*A + 0*B)
else :
  print(1*A + 0*B -1*(K-A-B))

A,B,C,K = map(int,input().split())
print(A-1*(K-A-B) if K >A+B else K)

A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int,input().split())
l = [1]*a + [0]*b + [-1]*c
print(sum(l[:k])

a,b,c,k = map(int,input().split())
print(min([a,k])-max([0,k-a-b]))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):

if k<a:
  print(k)
elif a<=k and k<=a+b:
  print(a)
elif a+b<k and k<a+b+c:
  print(a-(k-a-b))
else:
  print(a-c)

a,b,c,k = map(int,input().split())

if k<a:
  print(k)
elif a<=k and k<=a+b:
  print(a)
elif a+b<k and k<a+b+c:
  print(a-(k-a-b))
else:
  print(a-c)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
#!/usr/bin/env python3


def main() -> None:
    A, B, C, K = rmi()
    sum_ = 0
    if A > K:
        sum_ += A
        K -= A
    else:
        sum_ += K
        K = 0
    if B > K:
        K -= B
    if 0 < K:
        sum -= K
    w(sum_)


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10 ** 9)
    main()


#!/usr/bin/env python3


def main() -> None:
    A, B, C, K = rmi()
    sum_ = 0
    if A < K:
        sum_ += A
        K -= A
    else:
        sum_ += K
        K = 0
    if B < K:
        K -= B
    else:
        K = 0
    if 0 < K:
        sum_ -= K
    w(sum_)


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10 ** 9)
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K = input().split()
if A > K:
  print(K)
elif A+B > K:
  print(A)
else:
  print(2*A + B - K)

A,B,C,K = input().split()
if A >= K:
  print(K)
elif A+B >= K:
  print(A)
else:
  print(A + A + B - K)

A,B,C,K = input().split()
if int(A) >= int(K):
  print(K)
elif int(A)+int(B) >= int(K):
  print(A)
else:
  print(int(A) + int(A) + int(B) - int(K))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
import sys
import math
a,b,c,k=map(int,input().split())
if a<=k:
    print(k)
elif a>=k:
    print(a)
    sys.exit()
elif a+b>=k:
    print(a)
    sys.exit()
else:
    if c>k-(a+b):
        s=k-(a+b)
        print(a+(s*(-1)))
        sys.exit()
    else:
        print(a+(c*(-1)))


import sys
import math
a,b,c,k=map(int,input().split())
if a>k:
    print(k)
elif a+b>=k or a>=k:
    print(a)
elif c>(k-(a+b)):
    s=k-(a+b)
    print(a-1*s)
else:
    print(a-c)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
sum = 0
if K>0:
    if A>0:
        if A>K:
            sum = sum + K
        else:
            sum = sum + A
    K = K - A
if K > 0:
    if B>0:
        K = K - B
if K > 0:
    if C>0:
        sum = sum + K * (-1)
print(sum)

a, b, c, k = map(int, input().split())
ans = 0
if k <= a:
    print(k)
else:
    k -= a
    ans += a
    if k <= b:
        print(ans)
    else:
        k -= b
        ans += -1 * k
        print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int, input().split())
if a>=k:
  print(k)
elif a+b>=k:
  print(k)
else:
  l = k-a-b
  print(a - (c*l))

a,b,c,k = map(int, input().split())
if a>=k:
  print(k)
elif a+b>=k:
  print(a)
else:
  l = k-a-b
  print(a - l)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A, B, C, K = map(int,input().split())

if K <= A:
    print(A)
elif K <= A+B:
    print(A)
else:
    print(2A+B-K)


A, B, C, K = map(int,input().split())

if K <= A:
    print(K)
elif K<=A+B:
    print(A)
else:
    print(A+(K-(A+B))*(-1))


Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
A, B, C, K = list(map(int, input().split()))

if( A + B >= K ):
    if(A >= K):
        print(A)
    else:
        print(K)
else:
    print(+1*A -1*(K-(A+B)))


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

if( A + B >= K ):
    if(A >= K):
        print(K)
    else:
        print(A)
else:
    print(+1*A -1*(K-(A+B)))


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
from sys import stdin

A, B, C, K = map(int, stdin.readline().rstrip().split())
res = int(0)

def f(p, n, k, res):
    if k - n > 0:
        return k - n, p * (k - n) + res
    else:
        return 0, p * k + res


nokori, res = f(1, A, K, res)
nokori, res = f(0, B, K, res)
nokori, res = f(-1, C, K, res)
print(res)

from sys import stdin

A, B, C, K = map(int, stdin.readline().rstrip().split())
res = int(0)

def f(p, n, k, res):
    if (k - n) >= 0:
        return k - n, p * (k - n) + res
    else:
        return 0, p * k + res


K, res = f(1, A, K, res)
K, res = f(0, B, K, res)
_, res = f(-1, C, K, res)
print(res)

from sys import stdin

A, B, C, K = map(int, stdin.readline().rstrip().split())
res = int(0)

def f(p, n, k, res):
    if (k - n) > 0:
        return k - n, p * (k - n) + res
    else:
        return 0, p * k + res


K, res = f(1, A, K, res)
K, res = f(0, B, K, res)
_, res = f(-1, C, K, res)
print(res)

from sys import stdin

A, B, C, K = map(int, stdin.readline().rstrip().split())
res = int(0)

def f(p, n, k, res):
    if (k - n) >= 0:
        return k - n, p * n + res
    else:
        return 0, p * k + res


K, res = f(1, A, K, res)
K, res = f(0, B, K, res)
_, res = f(-1, C, K, res)
print(res)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = map(int, input().split())
result = 0
t = min(a,k)
result += 1
k -= 1
t = min(b,k)
k -= 0
t = min(c,k)
result -= 1
print(result)

A, B, C, K = map(int, input().split())
if A >= K:
  print(K)
else if A+B >= K:
  print(A)
else:
  print(A-(K-A-B))

A,B,C,K=map(int, input().split())
if A >= K:
  print(K)
else if A+B >= K:
  print(A)
else:
  print(A-(K-A-B))

A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
else if A+B >= K:
  print(A)
else:
  print(A-(K-A-B))

A, B, C, K = map(int, input().split())

result = 0
t = min(A, K)
result += t
K -= t
t = min(B, K)
K -= t
t = min(C, K)
result -= t
print(result)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
text_list = input().split()
n = 0
for i in range(str(text_list[3])):
  if i >= int(text_list[0]):
    n += 1
  elif i >= int(text_list[0]) + int(text_list[1]):
    pass
  elif i >= int(test_list[0]) + int(text_list[1]) + int(text_list[2]):
    n -= 1
    
print(n)


text_list = input().split()
n = 0
count = 0
a = int(text_list[0])
b = a + int(text_list[1])
c = b + int(text_list[2])
max = int(text_list[3])

if max < b:
    n = a
else:
    n = a - c

print(n)

text_list = input().split()
n = 0
a = int(text_list[0])
b = a + int(text_list[1])
c = b + int(text_list[2])
for i in range(int(text_list[3])):
    if i < int(text_list[0]) + int(text_list[1]):
        continue
    elif i < int(text_list[0]):
        n += 1
    elif i < int(text_list[0]) + int(text_list[1]) + int(text_list[2]):
        n -= 1

print(n)

text_list = input().split()
n = 0
a = int(text_list[0])
b = int(text_list[0]) + int(text_list[1])
c = int(text_list[0]) + int(text_list[1]) + int(text_list[2])
for i in range(int(text_list[3])):
    if i a:
        n += 1
    elif i b:
        continue
    elif i c:
        n -= 1

print(n)

a, b, c, d = map(int, input().split())
if d <= a:
  print(d)
elif d <= a + b:
  print(a)
else:
  print(a-(d-(a+b)))

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
import sys
a,b,c,k = map(int,input().split())
sumcheck = 0
count = 0
for i in range(0,a):
    sumcheck += 1
    count += 1
    if count >= k:
        sys.exit()
for i in range(0, b):
    count += 1
    if count >= k:
        sys.exit()
for i in range(0, c):
    sumcheck -= 1
    count += 1
    if count >= k:
        sys.exit()

print(sumcheck)

a,b,c,k=map(int,input().split())

if k <= a:
  print(k)
elif k <= (a+b):
  print(a)
else:
  print(a-(k-a-b))

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
abcx = input().split(" ")
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
x = int(abcd[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2*a + b - x)

abcx = input().split(" ")
a = int(abcx[0])
b = int(abcx[1])
x = int(abcx[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2 * a + b - x)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int,input().split())
if k <= a:
  print(k)
  else:
    if k>a and k <= a+b:
      print(a)
      else:
        print(k-a)

a,b,c,k = map(int,input().split())
if k <= a:
  print(k)
else:
  if k>a and k <= a+b:
    print(a)
  else:
    print(a-(k-a-b))


Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K = map(int,input().split())
import sys

ans = 0

ans = A
K = K - A

if K < 0:
  ans = ans + K
  print(ans)
  sys.exit(0)

if K > 0:
  K = K - B

print(K)
if K > 0:
  ans = ans - K

print(ans)

A,B,C,K = map(int,input().split())
import sys

ans = 0

ans = A
K = K - A

if K < 0:
  ans = ans + K
  print(ans)
  sys.exit(0)

if K > 0:
  K = K - B

if K > 0:
  ans = ans - K

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
#!/usr/bin/env python3


def main():
    a, b, c, k = map(int, input().split())

    ans = a
    num = a + b

    if k >= a:
        print(k)
    elif num < k:
        ans -= k - num
        print(ans)


if __name__ == "__main__":
    main()


#!/usr/bin/env python3


def main():
    a, b, c, k = map(int, input().split())

    ans = a
    num = a + b

    if k <= a:
        print(int(k))
        return
    elif num < k:
        ans -= k - num
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(k)
else:
  
  print(a-(k-(a+b)))


#Solver:Rute
a,b,c,k = map(int,input().split())
if 0<=k<=a:
  print(k)
elif a<k<=a+b:
  print(a)
else:
  print(a-(k-(a+b)))

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
def main():
    a,b,c,k = map(int,input().split())

    if k <= a:
        print(k)
        exit

    if k - a <= b:
        print(a)
        exit 

    print(a - (k - a - b))

if __name__ == "__main__":
    main()

def main():
    a,b,c,k = map(int,input().split())

    if k <= a or k - a <= b:
        print(k)
        exit
    
    print(a - (k - a - b))

if __name__ == "__main__":
    main()

def main():
    a,b,c,k = map(int,input().split())

    if k <= a:
        print(k)
        exit()

    if k - a <= b:
        print(a)
        exit ()

    print(a - (k - a - b))

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K=map(int,input().split())
print(A,B,C,K)
if A+B>=K:
    print(A)
elif C>=B:
    print(0)
else:
    print(A-C)

A,B,C,K=map(int,input().split())
print(A,B,C,K)
if A+B>=K:
    print(A)
else:
    print(A-C)

A,B,C,K=map(int,input().split())
if A>=K:
    print(K)
elif A+B>=K:
    print(A)
else:
    print(A-(K-(A+B)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = list(map(int, input().split()))

ans = 0

while(k > 0):
  {
    if (a != 0)
      a-=1
      ans+=1
      k-=1
    if (a == 0 & b > 0){
      b-=1
      k-=1
    }
    if (a == 0 & b == 0 & c > 0) {
      c-=1
      ans-=1
      k-=1
    }
  }
print(ans)

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

ans = 0

while(k > 0):
  {
    if (a > 0)
      a-=1
      ans+=1
      k-=1
    if (a == 0 & b > 0){
      b-=1
      k-=1
    }
    if (a == 0 & b == 0 & c > 0) {
      c-=1
      ans-=1
      k-=1
    }
  }
print(ans)

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

ans = 0

while(k > 0):
  {
    if (a > 0)
      a-=1
      ans+=1
      k-=1
    elif (a == 0 & b > 0){
      b-=1
      k-=1
    }
    else (a == 0 & b == 0 & c > 0) {
      c-=1
      ans-=1
      k-=1
    }
  }
print(ans)

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

ans = 0

if a >= k:
  print(k)
elif a+b >=k:
  print(a)
else:
  print(a-(k-a-b))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = map(int,input().split())
ans = 0

if k <= a:
    ans = k
elif k <= (a+b):
    ans = a
else:
    ans = (a-(k-(a+b)))



a, b, c, k = map(int,input().split())
ans = 0

if k <= a:
    ans = k
elif k <= (a+b):
    ans = a
else:
    ans = (a-(k-(a+b)))

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k=map(int,input().split())
if a<=k:
  print(k)
elif a+b<=k:
  print(a)
else:
  print(a-(k-a-b))

a,b,c,k=map(int,input().split())
if a>=k:
  print(k)
elif a+b>=k:
  print(a)
else:
  print(a-(k-a-b))



Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
read = input().split()
print(read)
x = int(read[3]) - int(read[0]) - int(read[1])
if x <= 0:
    print(int(read[0]))
else:
    print(int(read[0]) - x)

read = input().split()
x = int(read[3]) - int(read[0]) - int(read[1])
if int(read[3]) < int(read[0]):
    print(int(read[3]))
elif x <= 0:
    print(int(read[0]))
else:
    print(int(read[0]) - x)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
#B
A,B,C,K = map(int,input().split())

if A > K:
	print(A)
else:
	if B > K - A:
		print(A)
	else:
		if C > K - A - B:
			print(A - C)
		else:
			print(A - (K - A - B))




##A
#S = input()
#T = input()


#B
A,B,C,K = map(int,input().split())

if A >= K:
	print(K)
else:
	if B >= K - A:
		print(A)
	else:
		print(A - (K - A - B))




##A
#S = input()
#T = input()


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):

def resolve():
    a, b,c,k = map(int, input().split())

    ans = 0
    used = min(k,a)
    ans += used * 1
    k -= used
    used = min(k, b)
    k -= used
    ans += k*(-1)
    print(ans)

if __name__ == "__main__":
    unittest.main()


def resolve():
    a, b,c,k = map(int, input().split())

    ans = 0
    used = min(k,a)
    ans += used * 1
    k -= used
    used = min(k, b)
    k -= used
    ans += k*(-1)
    print(ans)


if __name__ == "__main__":
    resolve()

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = input().split()

a = int(a)
b = int(b)
c = int(c)
k = int(k)

if a >= k:
    sum = k
elif a + b >= k:
    sum = k
else:
    sum = a - c
    
print(sum)


a, b, c, k = input().split()

if a >= k:
    sum = k
elif a + b >= k:
    sum = k
else:
    sum = a - c
    
print(sum)

a, b, c, k = input().split()

a = int(a)
b = int(b)
c = int(c)
k = int(k)

if a >= k:
    sum = k
elif a + b >= k:
    sum = a
else:
    sum = a - (k - a - b)
    
print(sum)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
t=int(input().split())
l=[1,0,-1]
k=t[3]
s=0
i=0
while(k!=0):
  if(k>t[i]):
    s+=l[i]*t[i]
    k-=t[i]
  else:
    s+=l[i]*k
    k=0
  i+=1
print(s)

t=list(map(int,input().split()))
l=[1,0,-1]
k=t[3]
s=0
i=0
while(k!=0):
  if(k>t[i]):
    s+=l[i]*t[i]
    k-=t[i]
  else:
    s+=l[i]*k
    k=0
  i+=1
print(s)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int,input().split())
if a<=k:
  print(k)
elif a+b<=k:
  print(a)
else:
  print(a-(k-a-b))

a,b,c,k = map(int,input().split())
if a>=k:
  print(k)
elif a+b>=k:
  print(a)
else:
  print(a-(k-a-b))

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
def solve():
    A = int(input())
    B = int(input())
    C = int(input())
    K = int(input())
    if A >= K >= 1:
        print('{}'.format(K))
    elif A+B >= K > A:
        print('{}'.format(A))
    elif A+B+C >= K > A+B:
        result = 2*A + B - K
        print('{}'.format(result))


    return

def solve():
    A, B, C, K = map(int, input().split())
    if A >= K >= 1:
        print('{}'.format(K))
    elif A + B >= K > A:
        print('{}'.format(A))
    elif A + B + C >= K > A + B:
        result = 2 * A + B - K
        print('{}'.format(result))

        return


if __name__ == "__main__":
    solve()

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A = int(input('A = '))
B = int(input('B = '))
C = int(input('C = '))
K = int(input('Selected number = '))

if A+B >= K:
    print(A)
else:
    print(A-(K-A-B))

#ABC167
A,B,C,K=map(int,input().split())

if A > K:
    print(K)
elif  A+B >= K:
    print(A)
else:
    print(A-(K-A-B))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int,input().split())

ans = 0
if k > a:
    ans = ans + a
    k = k - a
else:
    ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
    ans = ans - c
else:
    ans = ans - k
print(ans)

print(ans)


a,b,c,k = map(int,input().split())

ans = 0
if k > a:
	ans = ans + a
    k = k - a
else:
	ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
	ans = ans - c
else:
	ans = ans - k
print(ans)

print(ans)


a,b,c,k = map(int,input().split())

ans = 0
if k > a:
    ans = ans + a
    k = k - a
else:
    ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
    ans = ans - c
else:
    ans = ans - k
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):

ABCK = input().split()

A= int(ABCK[0].strip())
B= int(ABCK[1].strip())
C= int(ABCK[2].strip())
K= int(ABCK[3].strip())


if(A+B>=K):
    Sum = K
else:
    N_C = K - (A+B)
    Sum = A - N_C
print(Sum)


import sys


def estimate(A, B, C, K):
    N_A = A
    if(N_A >=K):
        N_A = K
        N_B = 0
        N_C = 0
        return N_A
    N_B = B
    if(N_A+N_B >= K):
        return N_A
    N_C = K- (N_A+N_B)
    return N_A-N_C



if(__name__ == "__main__"):
    ABCK = input().split()

    A= int(ABCK[0].strip())
    B= int(ABCK[1].strip())
    C= int(ABCK[2].strip())
    K= int(ABCK[3].strip())

    
    value = estimate(A, B, C, K)
    print(value)


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A, B, C, K = map(int, input().split())
if (A>=K):
  print(K)
else if (A+B>=K):
  print(A)
else:
  print(A-(K-A-B))

A, B, C, K = map(int, input().split())
print(min(A, K) - max(0, K-A-B))

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
def main(a, b, c, k):
    total = 0
    counts = 0
    while counts == k:
        counts += 1
        if a > 0:
            total += 1
            a -= 1
        elif b > 0:
            b -= 1
        else:
            total -= 1
            c -= 1
    return total


if __name__ == '__main__':
    a, b, c, k = tuple(map(int, input().split(' ')))
    print(main(a, b, c, k))


A, B, C, K = map(int, input().split(' '))
s = 0
s += min(A, K)
K -= A
K -= B
if K > 0:
    s -= min(C, K)

print(s)


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K = map(int,input().split())

xa = min(A,K)
K1 = K -xa
if K1 == 0:
  print(K)
else:
	xb = min(B,K1)
	K2 = K1 -xb
	if K2 == 0:
  		print(K)
	else:
   		print(A-K2)

A,B,C,K = map(int,input().split())

xa = min(A,K)
K1 = K -xa
if K1 == 0:
  print(K)
else:
	xb = min(B,K1)
	K2 = K1 -xb
	if K2 == 0:
  		print(A)
	else:
   		print(A-K2)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = map(int, input().split())
if k <= a:
  print(k)
elif a < k and k - a <= b:
  print(k)
else:
  print(k-c)

a, b, c, k = map(int, input().split())
if k <= a:
  print(k)
elif a < k and k - a <= b:
  print(k)
elif a == 0 and b ==0:
  print(-k)
elif k == 0:
  print(0)
else:
  print(k-c)

A, B, C, K = map(int, input().split())
if K <= A:
    print(K)
elif K <= A+B:
    print(A)
else:
    print(A-(K-A-B))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
, B, C, K = map(int, input().split())
print(min(K, A)-max(0, K-A-B))

, B, C, K = map(int, input().split())
print(max(K, A)+min(0, K-A-B))

A, B, C, K = map(int, input().split())
print(min(K, A)-max(0, K-A-B))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int,input().split())
max_point = 0
if k - a >= 0:
    max_point += a
if k - a - c >= 0:
    max_point -= c
print(max_point)

a,b,c,k = map(int,input().split())
max_point = 0
if k - a  >= 0:
    max_point += a
else :
    max_point = k
if k - a - b  > 0:
    max_point += (a+b)-k
else :
    max_point = max_point      
print(max_point)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A, B, C, K = map(int, input().split())

if A<=K:
    print(K)
elif (K<=A)&(A+B<=K):
    print(A)
else:
    print(A-(K-B-A))

A, B, C, K = map(int, input().split())

if K<=A:
    print(K)
elif (A<=K)&(K<=A+B):
    print(A)
else:
    print(A-(K-B-A))

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A, B, C, K = map(int, input().split())  

if A + B >= K:
    print(K)
    exit()
else:
    print(A - (1 * (K - (A + B))))

a, b, c, k = map(int, input().split())

if k >= a + b + c:
    print(a - c)
    exit()
elif k <= a:
    print(k)
elif k <= a + b:
    print(a)
    exit()
else:
    print(a - (k - a - b))
    exit()

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = list(map(int, input().split()))
if k<=b:
  print(k)
elif b<k<=b+a:
  print(b)
else:
  print(2*b-k+a)

a, b, c, k = list(map(int, input().split()))
if k<=a:
  print(k)
elif a<k<=b+a:
  print(a)
else:
  print(2*a-k+b)


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A,B,C,K = map(int,input().split())

if A>=K:
    print(K)
else:
    if A+B>=K:
        print(K)
    else:
        print(A-(K-A-B))

A,B,C,K = map(int,input().split())

if A>=K:
    print(K)
else:
    if A+B>=K:
        print(K)
    else:
        print(A-(K-A-B))

A,B,C,K = map(int,input().split())

if A>=K:
    print(K)
else:
    if A+B>=K:
        print(A)
    else:
        print(A-(K-A-B))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a, b, c, k = map(int,input().split())
if (k <= a):
  print(k)
elif (k <= a + b):
  print(k)
else:
  x = a + b + c - k
  y = c - x
  ans = a - y
  print(ans)

a, b, c, k = map(int,input().split())
if (k <= a):
  print(k)
elif (k <= a + b):
  print(k)
else:
  x = a + b + c - k
  y = c - x
  ans = a - y

a, b, c, k = map(int,input().split())
if (k <= a):
  print(k)
elif (k <= a + b):
  print(a)
else:
  x = a + b + c - k
  y = c - x
  ans = a - y
  print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a = int(input())
b = int(input())
c = int(input())
k = int(input())
if a + b >= k:
    print(a)
else :
    print(a-(k-a-b))

a,b,c,k = map(int,input().split())
if a < k:
    print(k)
elif a+b <= k:
    print(a)
else :
    print(a-(k-a-b))

a,b,c,k = map(int,input().split())
if a < k:
    print(k)
else if a+b <= k:
    print(a)
else :
    print(a-(k-a-b))

a, b, c, k = map(int, input().split())
ans = 0
if k < a:
    ans = k
elif k <= a+b:
    ans = a
else:
    ans = a - (k-a-b)
print(ans)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):

def main():
    A, B, C, K = list(map(int, input().split()))

    if K <= A+B:
        print(K)
    else:
        d = K - A - B
        print(A - d)


if __name__ == '__main__':
    main()



def main():
    A, B, C, K = list(map(int, input().split()))

    if K <= A:
        print(K)
    elif K <= A+B:
        print(A)
    else:
        d = K - A - B
        print(A - d)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k=map(int, input().split())

ans = a
k = k - a

if k > 0:
    k = k - b

if k > 0 and k < c:
    ans = ans - k
else:
    ans = ans - c

print(ans)

a,b,c,k=map(int, input().split())

tmp = k
k = k - a
if k > 0:
    ans = a
else:
    ans = tmp

if k > 0:
    k = k - b

if k > 0:
    ans = ans - k

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
S=input()
T=input()


if len(S)+1==len(T):
    for i in range(len(S)): 
        if S[i]==T[i]:
            a='ok'
            continue
        else:
            a='no'
            break
else:
    print('no')

if a=='ok':
    print('Yes')
else:
    print('No')

a=1
b=0
c=-1
A,B,C,K=input().split()
A=int(A)
B=int(B)
C=int(C)
K=int(K)
test=0
if K>=A:
    a=a*A
    test=test+a
    K=K-A
elif K<=A:
    a=a*K
    test=test+a
    c=0
if K>=B:
    b=b*B
    test=test+b
    K=K-B
elif K<=B: 
    b=b*K
    test=test+b
    c=0
    
if K>=C:
    c=c*C
    test=test+c
    K=K-C
elif K<=C:
    c=c*K
    test=test+c
    
    
print(test)

Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
arr = list(input().split())
A=int(arr[0])
B=int(arr[1])
C=int(arr[2])
K=int(arr[3])


sum=0


if K > A :
	sum+=A
else:
	sum+=K
K-=A

if K > 0:
	if K > B :
		sum+=B
	else:
		sum+=K

	K-=B
	

	if K > 0:
		sum-=K
		

print(sum)



arr = list(input().split())
A=int(arr[0])
B=int(arr[1])
C=int(arr[2])
K=int(arr[3])


sum=0


if K > A :
	sum+=A
else:
	sum+=K
K-=A

if K > 0:

	K-=B
	

	if K > 0:
		sum-=K
		

print(sum)



Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
S = input().split(' ')
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K-A <= B:
  print(K)
else:
  print(K-C)

S = input().split()
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K-A <= B:
  print(K)
else:
  print(K-C)

S = list(map(int,input().split()))
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K-A <= B:
  print(K)
else:
  print(K-C)

S = list(map(int,input().split()))
A = S[0]
B = S[1]
C = S[2]
K = S[3]

if K <= A:
  print(K)
elif K <= A+B:
  print(A)
else:
  print(A-(K-A-B))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = map(int, input().split())

res = 0
if k < a:
     res = a
elif k < a+b:
     res = a
else:
     res = a-c

print(res)

a,b,c,k = map(int, input().split())

res = 0
if k < a:
     res = a
elif k < a+b:
     res = a
else:
     res = a-(k-b-c)

print(res)

a, b, c, k = map(int, input().split())
res = 0
if k <= a :
  res = k
  print(res)
else:
  if b >= k-a:
    res = a
    print(res)
  elif b < k-a:
    res = a - (k-b-a)
    print(res)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
ls = list(map(int, input().split()))
check = 0
for i, j in zip(ls[:-1], [1, 0 -1]):
    check+=i
    nokori = ls[-1] - check
    if check =< ls[-1]:
        sum_max += i*j
    else:
        sum_max += nokori*j
        break

print(sum_max)


ls = list(map(int, input().split()))
nokori = ls[-1]
nokori_ = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori > 0:
        sum_max += i*j
    elif nokori == 0:
        sum_max += i*j
        break
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)


Verdicts: Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k =map(int,input().split())

if a>=k or (a+b) >=k:    
    print(k)
    
else:
    print(-(k-a)+a)


a,b,c,k =map(int,input().split())

z=0

if a !=0 and k >0 :
    z +=1*k
    k -=a

if b!= 0 and k>0 :
    k-=b

if k>0 and c !=0 :

    z = z -k
    
print(z)


a,b,c,k =map(int,input().split())

z=0

if a !=0 and k >0 and a >= k:
    z +=1*k
    k -=a

if b!= 0 and k>0 and b >= k:
    k-=b

if k>0 and c !=0 and c >= k:

    z = z -k
    
print(z)

a,b,c,k = map(int,input().split())

if a>=k:
    print(k)
    
elif a <= k<= a+b:
    print(a)
    
else:
    print(a-(k-a-b))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
a,b,c,k = list(map(int,input().split()))
ans = 0
if a>=k:
    ans=k
else:
    ans+=a
    k-=a
    if b>=k:
        print(ans)
    else:
        k-=b
        ans-=k
print(ans)

a,b,c,k = list(map(int,input().split()))
ans = 0
if a>=k:
    ans=k
else:
    ans+=a
    k-=a
    if b<k:
        k-=b
        ans-=k
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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?

Submission attempts (in order):
A = input()
B = input()
C = input()
K = input()
if A+B+C <= K:
    print(A-C)

elif A+B <= K:
    print(A)

elif A <= K:
    print(K)

if A+B+C <= K:
    print(A-C)

elif A+B <= K:
    print(A)

elif A <= K:
    print(K)

if A+B+C <= K:
    print(A-C)

elif A+B <= K:
    print(A)

elif A <= K:
    print(K)

A, B, C, K =map(input().split())
if A <= K:
    print(K)
    
elif A+B <= K:
    print(A)
    
elif A+B+C <= K:
    print(A-C)

A,B,C,K = map(int,input().split())
sum = 0;
if A <= K:
	sum += A;
	K -= A
else:
	sum += K;
	K -= K
if B <= K:
	K -= B
else:
	K -= K
if C <= K:
	sum -= C
	K -= C
else:
	sum -= K
	K -= K
print(sum)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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?

Submission attempts (in order):
# S = input()
# N = int(input())
# A, B = map(int, input().split(' '))
# A = list(map(int, input().split(' ')))

A, B, C, K = map(int, input().split(' '))
result = 0

if A < K:
  result += A
  K -= A
else:
  result = A
  
if B < K:
  K -= B

if C < K:
  result -= C
  K -= C
else:
  result -= K

print(result)

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

A, B, C, K = map(int, input().split(' '))
result = 0

if A < K:
  result += A
  K -= A
else:
  result = K
  K -= A

if K > 0:
  if B < K:
    K -= B
  else:
    K -= B

if K > 0:
  if C < K:
    result -= C
    K -= C
  else:
    result -= K

print(result)


Verdicts: Wrong Answer

Accepted