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


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

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

if __name__ == '__main__':
    A = input()
    B = input()
    C = input()
    K = input()

    a = int(A)
    b = int(B)
    c = int(C)
    k = int(K)

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


if __name__ == '__main__':
    A = input()
    B = input()
    C = input()
    K = input()

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


if __name__ == '__main__':
    A =[]
    B = input()
    A = B.split()

    a = int(A[0])
    b = int(A[1])
    c = int(A[2])
    k = int(A[3])

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

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=input().split()
pl1=int(a[0])
pl0=int(a[1])
pl_1=int(a[2])
draw=int(a[3])

if(pl1+pl0>draw):
  print(pl1)
else:
  all_card=pl1+pl0+pl_1
  #print(all_card)
  draw_pl_1=all_card-draw
  
  print(pl1-draw_pl_1)


a=input().split()
pl1=int(a[0])
pl0=int(a[1])
pl_1=int(a[2])
draw=int(a[3])

if(pl1>=draw):
  print(draw)
elif(pl1+pl0>=draw):
  print(pl1)
else:
  #all_card=pl1+pl0+pl_1
  #print(all_card)
  draw_pl_1=draw-pl1-pl0
  
  print(pl1-draw_pl_1)

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):
x = sum(list(map(int, input().split(" "))))
print(x)

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

if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  k = K - A - B
  print(A - 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):
# -*- coding: utf-8 -*-

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

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


# -*- coding: utf-8 -*-

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

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


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

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:
    for a in range(A):
        if a == K:
            print(a)
elif A+B >= K:
    for b in range(B):
        if A+b == K:
            print(A)
else:
    for c in range(C):
        if A+B+c == K:
            print(A-c)

A,B,C,K = map(int,input().split())
for a in range(A):
    if a == K:
        print(a)
        exit()
for b in range(B):
    if a+b == K:
        print(a)
        exit()
for c in range(C):
    if a+b+c == K:
        print(a-c)
        exit()

A,B,C,K = map(int,input().split())
for c in range(C):
    for b in range(B):
        for a in range(A):
            if a + b + c == K:
                print(a-c)
                exit()

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

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:
  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(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())
ans = 0
l = [a,b,c]
while k>0:
    if k < a:
        ans=k
        break
    else:
        ans += a 
        k-=a  
        a-=a 
    if k > b:
        k-=b
        b-=b
    if k < c:
        ans += -k 
        k-=k
        break
    
print(ans)

a,b,c,k = map(int, input().split())
ans = 0
l = [a,b,c]
while k>0:
    if k < a:
        print(k)
        break
    else:
        ans += a 
        k-=a  
        a-=a 
    if k > b:
        k-=b
        b-=b
    if k < c:
        ans += -k 
        k-=k
    
print(ans)

a,b,c,k = map(int, input().split())
ans = 0
l = [a,b,c]
while k>0:
    if k < a:
        ans=k
        break
    else:
        ans += a 
        k-=a  
        a-=a 
    if k ==0:
        break    
    if k > b:
        k-=b
        b-=b
    else:
        k-=k
        b-=k    
    if k ==0:
        break    
    if k < c:
        ans += -k 
        k-=k
    else:
        ans += -c
        k -= c
    if k ==0:
        break 
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):
def main():
    A,B,C,K = map(int, input().split())
    score=0
    count=K
    i=0
    while count>0:
        if i==0:
            score=score+count
            count=count-A
            # print(score,"s",count)
        elif i ==1:
            count=count-B
            # print(score,"s",count)
        else:
            score=score-count
            count=count-C
            # print(score,"s",count)
        i=i+1
        
    print(score)
main()

def main():
    A,B,C,K = map(int, input().split())
    score=0
    count=K
    i=0
    while count>0:
        if i==0:
            if A<=K:
                score=score+A
            else:
                score=K
            
            count=count-A
            # print(score,"s",count)
        elif i ==1:
            count=count-B
            # print(score,"s",count)
        else:
            score=score-count
            count=count-C
            # print(score,"s",count)
        i=i+1
        
    print(score)
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())
s = 0
for in range(k):
  if a > 0:
    s += 1
    a -= 1
  elif b > 0:
    b += 0
  else:
    s += -1
print(s)

# coding: UTF-8
import sys

import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

a, b, c, k = readmi()
s = min(a, k)
k -= a
if k <= 0:
    print(s)
    exit()
k -= b
if k <= 0:
    print(s)
    exit()
s -= k
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 k == 0:
    print("0")
elif a < k:
    print(a-k)
elif a+b > k:
    print(a)
else:
    ab = a+b
    ans = a - (k-ab)
    print(ans)    

a,b,c,k = map(int,input().split())
aa=a
if k == 0:
    print(0)
elif a > k:
    print(k)
elif a+b >= k:
    print(a)
else:
    ab = a+b
    ans = aa-(k-ab)
    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):
def resolve():
    a,b,c,k=map(int,input().split())
    if a+b >=k:
        print(a)
    else:
        d=k-a-b
        print(a-d)
reslove()

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

    if a>k:
        print(k)
    elif a + b >= k:
        print(a)
    elif a+b<k:
        d=k-a-b
        print(a-d)
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):
#import collections
# c = collections.Counter()
#import itertools as it
#import math
#import numpy as np
#import sys 
#sys.exit()
 
#s = input()
#t = input()
#k = int(input())
a,b,c,k = map(int, input().split())
'''
#  = list(map(int, input().split()))
'''

'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''
 
#-------------------------------#
#len(t)==len(s)+1
print(a,b,c,k)
if a+b>=k:
    print(a+b)
else:
    print(a+b-a+b-k)

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

'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''
 
#-------------------------------#
#len(t)==len(s)+1
#print(a,b,c,k)
if a>=k:
    print(k)
elif a+b>=k:
    print(a)
elif a+b+c>=k:
    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= int(input().split())

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

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

if a>=k:
    print(k)
elif a+b>=k:
    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 = [int(x) for x in input().split()]

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

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

ab = a+b
abc = a+b+c
print(a,b,c,k)
if k <= a:
  print(k)
elif k<= ab:
  print(a)
else:
  print(a-(k-ab))

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

ab = a+b
abc = a+b+c
print(a,b,c,k)
if k <= ab:
  print(k)
else:
  print(a-(k-ab))

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

ab = a+b
abc = a+b+c

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


a, b, c, k = [int(x) for x in input().split()]
 
if k <= a:
  print(k)
elif a < k and k<= a+b:
  print(a)
else:
  print(a-(k-a-b))

Verdicts: Wrong Answer

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())
m = min(k,a)
if m == k :
    n = 0
    l = 0
n = min(k-a,b)
if n == k=a :
    l = 0
l = min(k-a-b,c)
print(1*m+0*n+(-1)*l)

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

    if k <= b :
        print(k)
    else :
        n = min(k,b)
        k -= b
        l = k
        print(1*m+(-1)*l)

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

    if k <= b :
        print(a)
    else :
        n = min(k,b)
        k -= b
        l = k
        print(1*m+(-1)*l)

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

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

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,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(2*A+B-K)
  

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(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):
def a():
    s = input()
    t = input()
    if s == t[0:-1]:
        print('Yes')
    else:
        print('No')


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






b()

def a():
    s = input()
    t = input()
    if s == t[0:-1]:
        print('Yes')
    else:
        print('No')



def b():
    a, b, c, k = map(int, input().split())
    xa = min(k, a)
    k1 = k - xa
    xb = min(k1, b)
    k2 = k1 - xb
    print(xa - k2)
    

    print(sum)






b()

def a():
    s = input()
    t = input()
    if s == t[0:-1]:
        print('Yes')
    else:
        print('No')



def b():
    a, b, c, k = map(int, input().split())
    xa = min(k, a)
    k1 = k - xa
    xb = min(k1, b)
    k2 = k1 - xb
    print(xa - k2)






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

a,b,c,k = map(int, input().split())
sum = 0
if a >= k:
    sum += 1*k
    print(sum)
elif a < k :
    sum += 1*a
    k = k - a
    if b >= k:
        print(sum)
    else :
        k = k - b
        sum += (-1)*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):
!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, K: int):
    ans=0
    sub=K
    if A>K:
        ans+=1*K
        sub-=K
    else:
        ans+=1*A
        sub-=A
    if sub!=0:
        if B>sub:
            sub=0
        else:
            sub-=B
    if sub!=0:
        ans-=sub
    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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


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 actual(A, B, C, K):
    print('\n')

    if K <= A:  
        return A

    score = 0

    if K > A:
        score += A
        K -= A

    if K <= B:
        return score

    if K > B:
        K -= B

    
    
    score -= K

    return score

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

print(actual(A, B, C, K))

def actual(a, b, c, k):
    x_a = min(a, k)

    k -= x_a

    x_b = min(b, k)
    k -= x_b

    x_c = k  # min(c, k)

    score = x_a - x_c

    return score
                
A, B, C, K = [int(x) for x in input().split()]

print(actual(A, B, C, 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):
li = list(map(int, input().split()))
a, b, c, k = li[0], li[1], li[2], li[3]

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


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

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

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

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

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

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

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

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

x = k - a
if x <= 0:
    print(k)
else:
    y = x - b
    if y <= 0:
        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):
from sys import stdin
A, B, C, K = [int(_) for _ in stdin.readline().rstrip().split()]
L = [1]*A+[0]*B+[-1]*C
print(L[:K])

from sys import stdin
A, B, C, K = [int(_) for _ in stdin.readline().rstrip().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

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

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


a,b,c,k=map(int, input().split())
if a+b-k>=0:
    print(min(a,k))
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):
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  ans = k
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
print(ans)

import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  print(k)
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
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())
ans=0
sum_AB = A+B
if K>=A:
    ans += A
else:
    ans+=K

print(ans)
if sum_AB<=K:
    ans-=K-A-B


print(ans)


A,B,C,K = map(int,input().split())
ans=0
sum_AB = A+B
if K>=A:
    ans += A
else:
    ans+=K

if sum_AB<=K:
    ans-=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())
S = max(A, K) - max(0, K-A-B)
print(S)

A, B, C, K = map(int, input().split())
S = min(A, K) - max(0, 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())
card_list = (([1]*A).extend([0]*B)).extend([-1]*C)
 
print(sum(card_list[0:K]))

A,B,C,K = map(int, input().split())
card_list = (([1]*A).extend([0]*B)).append([-1]*C)

print(sum(card_list[0:K]))

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

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 a > k:
  a = k
  b = 0
  c = 0
if a < k and a+b > k:
  c = 0
if a+b < k:
  c = k - a - b
  
sum_a = 1 * a
sum_c = -1 * c
  
print(sum_a + sum_c)


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

if a > k:
  a = k
  b = 0
  c = 0
if a < k and a+b > k:
  b = k - a
  c = 0
if a+b < k:
  c = k - a - b

li_card = []

for i in range(a):
  li_card.append(1)
for i in range(b):
  li_card.append(0)
for i in range(c):
  li_card.append(-1)


print(sum(li_card))

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

if a >= k:
  a = k
  b = 0
  c = 0
if a < k and a+b >= k:
  c = 0
if a+b < k:
  c = k - a - b
  
sum_a = 1 * a
sum_c = -1 * c
  
print(sum_a + sum_c)

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 main():
    a, b, c, k = map(int, input().split())
    if a + b >= k:
        print(max(a, k))
    else:
        x = k - a - b
        print(a - x)


main()

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


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

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

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

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


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


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


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

K -= A
xa = min(K,A)
K -= B
xb = min(K,B)
ans = xa - K
print(ans)

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

xa = min(K,A)
K -= xa
xb = min(K,B)
K -= xb


ans = xa - 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(x) for x in input().split())
if a+b > k:
  print(a)
else:
  print(a+(c-k))

a,b,c,h=(int(x) for x in input().split())
num = 0
count=h
num += a
count -= a
if count > 0:
  count -= b
if count >0:
  num -= count
print(count)

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

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

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

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

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

k -= (a+b)
if k <= 0:
    print(a)
    exit()
else:
    ans = a

for i in range(k):
    ans -= 1
print(ans)

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

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

k -= (a+b)
if k <= 0:
    print(a)
    exit()
else:
    ans = a

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

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

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

a, b, c, k = map(int, input().split())
chk1 = k-a
chk2 = k-a-b
if chk1 <= 0:
    ans = k

else:
    if chk2 > 0:
        ans = a -1*chk2
    else:
        ans = a

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 + b):
    print(k)
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: 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:
    ans=K
elif k<=A+B:
    ans=A
else:
    ans=2*A-K

print(ans)

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

if K<A:
    ans=K
elif A<=K and K<=A+B:
    ans=A
else:
    ans=2*A+B-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())
ans=0
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())
ans=0
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):
abck = [int(n) for n in input().split()]
if abck[0] + abck[1] >= abck[3]:
    print(abck[3])
else:
    print(abck[0] * 2 - abck[3] + abck[1])

abck = [int(n) for n in input().split()]
if abck[0] >= abck[3]:
    print(abck[3])
elif abck[0] + abck[1] >= abck[3]:
    print(abck[0])
else:
    print(abck[0] * 2 - abck[3] + abck[1])


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(float, input().split())

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


A, B, C, K = map(float, 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

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(min(a, k)
else:
    print(2*a+b-k)

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

a,b,c,k = map(int,input().split())
if a<k:
  if b<k-a:
      print(a-(k-a-b))  
  else:
    print(a)    
else:
  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 = map(int, input().split())
max = 0
for i in range(a, -1, -1):
    for j in range(b, -1, -1):
        for l in range(c+1):
            if i+j+l == k:
                print(i-l)

import sys
a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
    sys.exit()
else:
    if b >= k-a:
        print(a)
        sys.exit()
    else:
        print(a-(k-a-b))
        sys.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 = map(int, input().split())
a, b, c, k = map(int, input().split())
j = k-(a+b)
j = 0 if j < 0 else j
print(a-j if k > a else k)

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

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

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

a,b,c,k= map(int,input().split(' '))
if k<=a:
    print(k)
else:
    if k<=(a+b):
        print(a)
    else:
        print(a+(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):
#B
ABCK = input().split(' ')
A = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])
K = int(ABCK[3])
if K <= (A + B):
    print(K)
else:
    print(A + C * (K - A))

#B
ABCK = input().split(' ')
A = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])
K = int(ABCK[3])
if K <= (A + B):
    print(K)
else:
    print(A - (K - A - B))

#B
ABCK = input().split(' ')
A = int(ABCK[0]) ; B = int(ABCK[1]) ; C = int(ABCK[2])
K = int(ABCK[3])
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):
A, B, C, K = map(int, input().split())

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

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

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

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

ans += max(0, min(K, 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 = int(input())
B = int(input())
C = int(input())
K = int(input())

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

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

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


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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted