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

S = A+B+C
result = 0

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

print(result)


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

S = A+B+C
result = 0

if ( K > (A+B) ):
    result = A*(1) + (K-(A+B))*(-1)
elif ( (A+B) >= K >= A):
    result = A*(1)
elif ( A > K ):
    result = K*(1)

print(result)


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,d=map(int,input().split())
if a+b >= d:
  print(d)
else:
  print(2*a+b-d)

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

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

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):
a,b,c,k = map(int,input().split())

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


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

if k<=a:
  print(k)
elif a< k <= a+b:
  print(a)
elif a+b < k <= a+b+c:
  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):
# input
A, B, C, K = map(int, input().split())


result_score = 0
for score, i in [(1, A), (0, B), (-1, C)]:
        if K <= 0:
               continue 
        
        if K >= i:
            result_score =- score * i
            K -= i
        else:
            result_score =- score * K
            K = 0

print(result_score)

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


result_score = 0
for score, i in [(1, A), (0, B), (-1, C)]:
        if K <= 0:
               continue

        if K >= i:
            result_score += score * i
            K -= i
        else:
            result_score += score * K
            K = 0

print(result_score)

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():
  s = input()
  t = input()
  a = len(s)

  if len(s) > 10 or len(s) < 1:
    print('no')
  else:
    if t[0:a] != s:
      print('no')
    else:
      if len(t) == len(s) + 1:
        print('yes')

main()

s = input()
t = input()
a = len(s)

if len(s) > 10 or len(s) < 1:
  print('no')
else:
  if t[0:a] != s:
    print('no')
  else:
    if len(t) == len(s) + 1:
      print('yes')

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

if a >= k:
  print(k)
else:
  if a + b >= k:
    print(a)
  else:
    print(2 * a + b - 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):
a,b,c,k = map(int,input().split())
 
if k <= a:
  print(a)
elif a < k and k <= a+b:
  print(a)
elif a+b < k and k <= a+b+c
  print(a-k+a+b)

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

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

a,b,c,k = map(int,input().split())
 
if k <= a:
  print(k)
elif a < k and k <= a+b:
  print(a)
else:
  print(a-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 = int(input().split(' '))
out = 0
if A>K:
  print(K)
else:
  out += A
  K -= A
  if B > K:
    print(out)
  else:
    K -= B
    out -= K
    print(out)

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

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(k - 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):
a, b, c, k = list(map(input().split()))
if k < a:
    return k
elif k < a+b:
    return a
else:
    return a - (k-a-b)

a, b, c, k = list(map(int, input().split()))
if k < a:
    print(k)
elif 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().spliit())
if K <= A :
    print(K)

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

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


A, B, C, K = map(int, input().spliit())
if K <= A :
    return K

elif K <= A + B:
    return A

else:
    return A - (K - (A + B))


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: 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):
if K < A:
  print(A)
elif A <= K and B >= (K-A):
  print(A)
else:
  print(A - (K-A-B))

A,B,C,K =list(map(int,input().split()))
if K < A:
  print(K)
elif A <= K and B >= (K-A):
  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()) 

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)
elif A + B >= K:
    print(K)
else:
    print(max(0, 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

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())
s = 0
if  a + b >= k:
    s = a
else:
    s = a - c 
print(s)

a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
if 0 < a and 0 < k:
    s += a
    k -= a
elif 0 < b and 0 < k:
    k -= b
elif 0 < c and 0 < k:
    s -= c
    k -= c
print(s)

a = int(input())
b = int(input())
c = int(input())
k = int(input())
s = 0
while(0 < a and 0 < k):
    s += 1
    k -= 1
    a -= 1
while(0 < b and 0 < k):
    k -= 1
    b -= 1
while(0 < c and 0 < k):
    s -= 1
    k -= 1
    c -= 1
print(s)

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

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())
if k<=a+b:
  print(a)
elif k<=a+b+c:
  print(2a-k+b)
else:
  print(a-c)

a,b,c,k=map(int,input().split())
if k<=a:
  print(k)
elif k<=a+b:
  print(a)
else: 
  print(2*a-k+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())
if k <= a:
    print(k)
elif k <= a+b:
    print(0)
else:
    print(2*a-k+b)

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

a,b,c,k=map(int,input().split())
if k <= a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2*a-k+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):
def solve(A, B, C, K):
    num = K

    if K <= A:
        return 1 * A

    num -= A
    ans = 1 * A

    if num <= B:
        return ans

    num -= B

    if num < 0:
        return ans

    return ans - num


A, B, C, K = map(int, input().split())
print(solve1(A, B, C, 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)))


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

nokori = K - A - B

wa = 0
wa += A

if nokori == 0:
    a    
elif C >= nokori:
    wa -= nokori
else:
    wa -= C

print(wa)

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

nokori = K - A - B

wa = 0
while True:
    if A >= K:
        wa += K
        break
    else:
        wa += A
    if C >= nokori:
        wa -= nokori
        break
    else:
        wa -= C
        break

print(wa)

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 = int(input())
b = int(input())
c = int(input())
k = int(input())

count = 0

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

#B
i = input()
a = int(i.split()[0])
b = int(i.split()[1])
c = int(i.split()[2])
k = int(i.split()[3])

count = 0

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

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())
total = 0
if A <= K:
    total = A
    if B <= K - A:
        total = total - (K-A)
print(total)


A,B,C,K = map(int, input().split())
total = 0
if A <= K:
    total = A
    if B <= K - A:
        total = total - (K-A)
print(total)


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

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

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

Verdicts: Wrong Answer

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())
count=0
while K>0:
  if A>0:
    count+=A
    A=0
    K-=A
  elif B>0:
    K-=B
    B=0
  else:
    count-=K
    K=0
    C=0
print(count)    

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


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):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))

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):
s = input()
A B C K = s.split(" ")

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

s = input()
A, B, C, K = [int(v) for v in s.split(" ")]

if K <= A:
  print(K)
elif K <= A + B:
  print(A)
elif K <= A + B + C:
  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())
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: 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().strip().split())
K=K-A
if K>0:
  Sum=A
  K=K-B
  if K>0:
    if K>C:
      print(Sum-C)
   	else:
      print(Sum-K)
  else:
     print(Sum)
else:
      print(K)

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

A,B,C,K=map(int,input().strip().split())
if K-A>0:
  K=K-A
  Sum=A
  K=K-B
  if K>0:
    if K>C:
      print(Sum-C)
    else:
      print(Sum-K)
    #if K>C:
  else:
    print(Sum)
else:
	print(K)

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

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

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

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):
abck=list(input().split())
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

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

abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(k)
elif a<k:
    if 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())
step1 = K-A
step2 = step1 - B
step3 = step2 - C
if step1 <= 0:
    print(K)
elif step2 <= 0:
    print(K)
else:
    print(A-step2)


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


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()))
sum1 = 0
while(k>0):
    if(k>=a and a!=0):
        k = k-a
        a = 0
        sum1+=a
    elif(k<a):
        a = a - k
        sum1 = k
    elif(k>=b and b!=0):
        b=0
        k = k-b
    elif(k<b):
        b = b - k
        sum1=k
    elif(k>=c and c!=0):
        k = k-c
        sum1 = sum1 - c
        c=0
    elif(k<c):
        c  = c-k
        sum1 = k
print(sum1)

a,b,c,k = map(int,input().split())
sum1 = 0
while(k>0):
    if(k>=a and a!=0):
        k = k-a
        sum1+=a
        a=0
    elif(k<a):
        a = a - k
        sum1 += k
        k = k-k
    
    elif(k>=b and b!=0):
        k = k-b
        b=0
    elif(k<b):
        b = b - k
        k = k-k
    
    elif(k>=c and c!=0):
        k = k-c
        sum1 = sum1 - c
        c=0
    elif(k<c):
        c  = c-k
        sum1 = sum1 - k
        k = k-k

print(sum1)


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):
ABCK = input()
key = ['A', 'B', 'C', 'K']
ABCK = [int(i) for i in list(ABCK.split())]
ABCK = {k: v for k, v in zip(key, ABCK)}
sum = 0
print(ABCK)

if ABCK['A'] > ABCK['K']:
  sum = ABCK['K']
else:
  if ABCK['A'] + ABCK['B'] >= ABCK['K']:
    sum = ABCK['A']
  else:
    K = ABCK['K'] - (ABCK['A'] + ABCK['B'])
    if ABCK['A'] - K < 0:
      sum = 0
    else:
      sum = ABCK['A'] - K
print(sum)

ABCK = input()
key = ['A', 'B', 'C', 'K']
ABCK = [int(i) for i in list(ABCK.split())]
ABCK = {k: v for k, v in zip(key, ABCK)}
sum = 0
print(ABCK)

if ABCK['A'] > ABCK['K']:
  sum = ABCK['K']
else:
  if ABCK['A'] + ABCK['B'] >= ABCK['K']:
    sum = ABCK['A']
  else:
    if ABCK['A'] - ABCK['C'] < 0:
      sum = 0
    else:
      sum = ABCK['A'] - ABCK['C']
print(sum)

a, b, c, k = [int(i) for i in 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

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(max(a, k))
else:
    print(a - (k - a - b))

a, b, c, k = map(int, input().split())
if a + b >= k:
    print(min(a, k))
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):
A, B, C, K = map(int, input().split())

a = 0
for i in range(1,A+1):
    a = a + 1

if (A + B) < K:
    for i in range(0,K-A-B):
        a = a - 1

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

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

sum = 0

sum += 1 * a[0]
a[3] -= a[0]
a[3] -= a[1]

if a[2] >= a[3]:
    sum += -1 * a[0]

print(sum)

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

sum = 0

if a[0] >= a[3]:
    sum += -1 * a[3]
else:
    sum += -1 * a[0]

a[3] -= a[0]
a[3] -= a[1]

if a[3] > 0:
    if a[2] > a[3]:
        sum += -1 * a[3]
    else:
        sum += -1 * a[2]

print(sum)

a = input().split

sum = 0

sum += 1 * a[0]
a[3] -= a[0]
a[3] -= a[1]

if a[2] < a[3]:
    sum -= 1 * a[0]

print(sum)

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

sum = 0

if a[0] >= a[3]:
    sum += -1 * a[3]
else:
    sum += -1 * a[0]

a[3] -= a[0]
a[3] -= a[1]

if a[2] >= a[3]:
    sum += -1 * a[3]
else:
    sum += -1 * a[2]

print(sum)

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

sum = 0

for i in range(3):
    if a[3] <= 0:
        break
    if a[i] >= a[3]:
        sum += (1 - i) * a[3]
    else:
        sum += (1 - i) * a[i]
    a[3] -= a[i]
        
print(sum)

Verdicts: Wrong Answer

Wrong Answer

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=int(input().split())
if A>=K:
  print(K)
elif (A+B)>=K:
  print(A)
else:
  print(A-(K-A))
  

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

if A >= K:
    print(K)
elif A + B >= K:
    print(K)
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):
a,b,c,k=map(int,input().split())
ans
if(a>=k):
    ans=k
else:
    if((a+b)>=k):
        ans=a
    else:
        x=k-a-b
        ans=a-x
print(ans)

a,b,c,k=map(int,input().split())
print(a)
s=[]
ans=0
for i in range (a):
    s.append(1)
for i in range (b):
    s.append(0)
for i in range (c):
    s.append(-1)
for i in range (k):
    ans+=s[i]
print(ans)

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

Verdicts: 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 = input()
B = input()
C = input()
K = input()

result = 0

for i in K:
    if A != 0:
        result = result - 1;
        A = A - 1;
    elif A == 0 and B != 0:
        
        B = B - 1;
    elif A == 0 and B == 0:
        result = result - 1;
        C = C - 1;
    else:
        break

print(result)


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

result = 0

for i in k:
    if a != 0:
        result = result + 1
        a = a - 1
    elif a == 0 and b != 0:
        
        b = b - 1
    elif a == 0 and b == 0 and c != 0:
        result = result - 1
        c = c  - 1
    else:
        break

print(result)


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

if a >= k:
    print(k)
    exit()
if b >= k-a:
    print(a)
    exit()
if c >= k-a-b:
    print(a-(k-a-b))
    exit()

print(a-c)


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):
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    A, B, C, K = [int(x) for x in input().strip().split()]
    if K <= A + B:
        print(min(K, A))
    else:
        print(A - (K - A - B)))
    
if __name__ == '__main__':
    main()

def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    A, B, C, K = [int(x) for x in input().strip().split()]
    if K <= A + B:
        print(min(K, A))
    else:
        print(A - (K - A - B))
    
if __name__ == '__main__':
    main()

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())
abc = []
for i in range(a):
    abc.append(1)

for j in range(b):
    abc.append(0)

for l in range(c):
    abc.append(-1)

print(sum(abc[0:l]))

a, b, c, k = map(int, input().split())
abc = []
for i in range(a):
    abc.append(1)
for j in range(b):
    abc.append(0)
for k in range(c):
    abc.append(-1)

print(sum(abc[0:k]))

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

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,b,c,k = map(int,input().split())
z=k-min(k,a)
if z>0:
    z=k-min(k,b)
print(a-z)


z=0
a,b,c,k = map(int,input().split())
z=k-a
print(a+z*-1)





 
a,b,c,k = map(int,input().split())
z=k-min(k,a)
z=k-min(k,b)
print(a-z)


a,b,c,k = map(int,input().split())
ax=min(a,k)
k=k-ax
bx=min(b,k)
k=k-bx
cx=k
print(ax-cx)

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):
import sys
input = sys.stdin.readline


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

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

import sys
input = sys.stdin.readline


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

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

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 = (int(x) for x in input().split())

max  = 0

if(a > k):
  max += k
  k = 0
else:
  max += a
  k -= a 
  
if(not k == 0)and(b > k):
  k = 0
else:
  k -= b
  
if(not k == 0)and(c > k):
  max -= k
else:
  max -= c

print(max)
  

a,b,c,k = (int(x) for x in input().split())

max  = 0

if(a > k):
  max += k
  k = 0
else:
  max += a
  k -= a 
  
if(k != 0)and(b > k):
  k = 0
elif k != 0:
  k -= b
  
if(c > k):
  max -= k
elif k != 0:
  max -= c

print(max)
  

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 < 0):
    if(A + B - K < 0):
        print(2 * A - K + B))
    else:
        print(A)
else:
    print(K)

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

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

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)
elif k> a and k=< a+b 
  print(a)
else :
  print(2*a + b - k)


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


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

A, B, C, K = map(int, input().split(" "))
data = [1 for _ in range(A)] + [0 for _ in range(B)] + [-1 for _ in range(C)]

sums = [sum(conb) for conb in itertools.combinations_with_replacement(data, K)]
print(max(sums))


import itertools

A, B, C, K = map(int, input().split(" "))
data = [1 for _ in range(A)] + [0 for _ in range(B)] + [-1 for _ in range(C)]

conbs = list(itertools.combinations_with_replacement(data, K))
sums = [sum(conb) for conb in conbs]
print(max(sums))


A, B, C, K = map(int, input().split(" "))
if K-A <= 0:
    print(K)
else:
    if K - (A + B) <= 0:
        print(A)
    elif K == A+B+C:
        print(A-C)
    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 A>=K:
  print(A)
elif A+B>=K:
  print(K)
else:
  print(2*A+B-K)

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

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 = int(input())
if a > k:
	print(sum(([1] * a)[:k]))
else:
	print(sum([1] * a))

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

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

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

Verdicts: Runtime Error

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 = [int(e) for e in input().split()]

import numpy as np

all = np.zeros(k)
all[:a] +=1
all[a+b:] -=1

print(sum(all))

a, b, c, k = [int(e) for e in input().split()]

count=0

if k <= a:
    count +=k
elif k <= a+b:
    count +=a
else:
    count = 2*a + b - k

print(count)

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())
if k<=a:
    print(k)
elif k<=a+b:
    print(a)
else:
    print(a-(k-a-b))

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: 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=min(a,k)
t=min(a,k)
k=k-t
ans+=min(b,k)
k-=min(b,k)
ans+=min(c,k)
print(ans)
    

a,b,c,k=map(int,input().split())
ans=min(a,k)
k-=min(a,k)
k-=min(b,k)
ans-=min(c,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,b,c,k=[int(i) for i in input().split()]
print(k if k<= a else a if k <=a+b else 2a+b-k)

a,b,c,k=[int(i) for i in input().split()]
print(k if k<=a else a if k <=a+b else 2*a+b-k)

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(a)
elif k - a > b:
    print(-1 * ((k - a) - b) + a)


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

if k <= a:
    print(k)
elif k - a > b:
    print(-1 * ((k - a) - b) + a)
else:
    print(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>=k:
    d=k
elif a<k and a+b>=k:
    d=k
elif a+b<k:
    d=a-(k-a-b)

print(d)


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

if a>=k:
    d=k
elif a<k and a+b>=k:
    d=a
elif a+b<k:
    d=a-(k-a-b)

print(d)


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

s=-1*K*C

lc=[]
lc_=[]
for i in range(min(K,A+1):
  for j in range(min(K-i+1,B+1)):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    # print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


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

s=-1*K*C

lc=[]
lc_=[]
for i in range(K+1):
  for j in range(K-i+1):
    lc.append([i,j,K-i-j])

#print(lc)

for i in range(len(lc)):
  if lc[i][0]<=A and lc[i][1]<=B and lc[i][2]<=C:
    print(lc[i])
    s=max(s, lc[i][0]-lc[i][2])

print(s)


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

if A+B<K:
  print(A-(K-A-B))
else:
  print(min(A, K))

Verdicts: 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 = int(input())
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

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

A = map(int(input()))
B = map(int(input()))
C = map(int(input()))
K = map(int(input()))
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

A = int(input())
B = int(input())
C = int(input())
K = int(input())
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

import math
if K <= A:
  print(K)
if A < K <= A + B:
  print(A)
if A + B < K <= A + B + C:
  print(A * 2 + B - K)

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

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

int(input())
if K <= A + B:
  print(K)
else:
  print(A * 2 + B - K)

import math
A, B, C, K = list(map(int, input().split()))
if K <= A:
  print(K)
if A < K <= A + B:
  print(A)
if A + B < K <= A + B + C:
  print(A * 2 + B - K)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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):
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
ifa + b < k:
    d = 2*a + b - k
    print(d)

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

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: print(A-(K-(B+A)))

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

if A>=K:print(K)
elif A+B>=K: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)
else:
    print(A-(K-A-B))


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

ans = 0
if A >= K:
    print(K)
    exit()
else:
    ans += A
    K -= A
    if B >= K:
        print(ans)
        exit()
    else:
        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, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(K)
else:
    print(A + C*-1*(K-A-B))

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

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

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):
a, b, c, k=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)
ans=0

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
   k=0

while b>0 and k>0:
  b+=-1
  k+=-1

while c>0 and k>0:
  ans+=-1
  c+=-1
  k+=-1
  
print(ans)

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

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

if b>0 and k>0 and b<=k:
  k=k-b
elif b>0 and k>0 and b>k:
  k=0
  
if c>0 and k>0 and c<=k:
  k=k-c
  ans=ans-c
elif c>0 and c>0 and c>k:
  ans=ans-k
  k=0

  
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())
s = min(c, k)
k -= s
if k == 0:
	print(s)
else:
	d = min(k, b)
	k -= d:
	if k == 0:
		print(s)
	else:
		f = min(k, a)
		s -= f
		print(s)

c, b, a, k = map(int, input().split())
s = min(c, k)
k -= s
if k == 0:
	print(s)
else:
	d = min(k, b)
	k -= d
	if k == 0:
		print(s)
	else:
		f = min(k, a)
		s -= f
		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())
ans = 0

if A<=K:
  ans+=A*1
else:
  ans+=K*1

K=max(K-A+B,0)
  
ans+=K*(-1)

print(ans)

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

if K<A:
  ans+=K
  print(ans)
  exit()
else:
  ans+=A
  K-=A
  
if K<B:
  print(ans)
  exit()
else:
  K-=B
  
if K<C:
  ans+=K*(-1)
  print(ans)
else:
  ans+=C*(-1)
  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 = list(map(int, input().split()))
s = 0

if k >= a:
    s = a
if (k - a - b) >= 0:
    s -= k - a - b

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

if k >= a:
    s = a
else:
    s = k
if (k - a - b) >= 0:
    s -= k - a - b

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

if K - A - B <= 0:
    print((1 * A) - (1 * C))

elif K - A >= 0 and K - A - B < 0:
    print((1 * A))

elif K - A >= 0:
    print(1 * K)


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

if K - A - B <= 0:
    print((1 * A) - (1 * C))

elif K - A <= 0:
    print((1 * A))


elif K - A >= 0:
    print(1 * K)









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

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

else K - A - B <= 0:
    print(1 * A)



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

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

elif K - A - B <= 0:
    print(1 * A)





Verdicts: 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):
A,B,C,K = map(int,input().split())

count = 0

if K >= A:
    count = K
else:
    for i in range(K):
        if A > 0:
            count += 1
            A -= 1
        elif B > 0:
            B -= 1
        else:
            count -=1
            C -= 1

print(count)

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

count = 0

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

print(count)

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 ):
    max = k

elif( a+b <= k ):
    max = a - ( k - a - b )

else:
    sys.exit(1)


print(max)


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


if a >= k :
    max = k

elif a+b >= k :
    max = a

elif( a+b <= k ):
    max = a - ( k - a - b )


print(max)

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())
sum = 0
if k  >= a + b + c:
  print(a + b + c)
if a + b + c > k >= b + a:
  k = k - (a + b)
  print(a - k)
if b + a > k >= a:
  print(a)
if a > k:
  print(k)
   

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


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()
A=int(A)
B=int(B)
C=int(C)
K=int(K)

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

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

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

Verdicts: Wrong Answer

Accepted