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())
ans = 0

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

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

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




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

ka = min(a,k)
k -= ka
kb = min(b,k)
k -= kb
kc = min(c,k)
k -= kc

ans = ka - kc
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())
ans=0
if(a>=k):
  ans+=k
  #print(k)
elif(a<k):
  ans+=a
  if(k-a<=b):
    #print(ans)
  elif (k-a>b):
    ans+=b
    ans-=k-a-b
    #print(ans)
print(ans)

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

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

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

Verdicts: Runtime Error

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

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

def calc(a,b,c,k):
    if k<=a+b:
        return k
    else:
        return a-(k-a-b)
print(calc(a,b,c,k))

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

print(A+B-max(0, K-A-B))

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

print(min(A, K)-max(0, 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 < K and A + B >= K:
  print(K)
else:
  print(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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

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

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

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

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

    

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

print (A, B, C, K)

sum = 0

if K - A >= 0:
  K -= A
  sum += A
else:
  print(sum)
  exit

if K - B >= 0:
  K -= B
  sum += 0
else:
  sum += 0
  print(sum)
  exit

if K - C >= 0:
  K -= C
  sum += -C
else:
  sum += -1 * K

print (sum)

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

print (A, B, C, K)

sum = 0
for _ in range(K):

  if A - 1 >= 0:
    A -= 1
    sum += 1
    continue

  if B - 1 >= 0:
    B -= 1
    sum += 0
    continue

  if C - 1 >= 0:
    C -= 1
    sum += -1

print (sum)

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

count = 0

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

if K > 0:
  print (A-(K))

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

count = 0

count = min(A, K)
max = count
K -= count

count = min(B, K)
K -= count

max += K * (-1)
print (max)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

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

if a+b >= k:
  result = a
else:
  result = a-c

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

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

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

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

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):
if oneCard >= getCardNum: print(oneCard)
elif oneCard + zeroCard >= getCardNum: print(oneCard)
else: print(oneCard - (getCardNum - oneCard - zeroCard))

oneCard, zeroCard, miniusOneCard, getCardNum = map(int, input().split())

if oneCard >= getCardNum: print(getCardNum)
elif oneCard + zeroCard >= getCardNum: print(oneCard)
else: print(oneCard - (getCardNum - oneCard - zeroCard))

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:
    a = A
else:
    print(K)
    exit()
if A == 0 and C == 0:
    print(0)
    exit()

if A == 0 and B == 0:
    print(-1*K)
    exit()

if K - (A+B) >= C:
    c = -1*C
else:
    if K - (A+B)  <= 0:
        c = -1*C
    else:
        c = -1*(K - (A+B))

print(a+c)



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

if K >= A:
    a = A
else:
    print(K)
    exit()
if A == 0 and C == 0:
    print(0)
    exit()

if A == 0 and B == 0:
    print(-1*K)
    exit()

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

print(a+c)

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
#-*- utf-8 -*-

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

sum_mux = 0

least_A, least_B, least_C = A, B, C
least_K = K

while 0 !=  least_K:
    print(least_K)
    if 0 != least_A:
        if least_K >= least_A:
            sum_mux += least_A
            least_K -= least_A
            least_A = 0
        else :
            sum_mux += least_K
            least_A -= least_K
            least_K = 0
    elif 0 != least_B:
        if least_K >= least_B:
            sum_mux += 0
            least_K -= least_B
            least_B = 0
        else :
            sum_mux += 0
            least_B -=least_K
            least_K = 0
    else:
        if least_K >= least_C:
            sum_mux -= least_C
            least_K -= least_C
            least_C = 0
        else :
            sum_mux -= least_K
            least_C -=least_K
            least_K = 0

print(sum_mux)

#-*- utf-8 -*-

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

sum_mux = 0

least_A, least_B, least_C = A, B, C
least_K = K

while 0 !=  least_K:
    print(least_K)
    if 0 != least_A:
        if least_K >= least_A:
            sum_mux += least_A
            least_K -= least_A
            least_A = 0
        else :
            sum_mux += least_K
            least_A -= least_K
            least_K = 0
    elif 0 != least_B:
        if least_K >= least_B:
            sum_mux += 0
            least_K -= least_B
            least_B = 0
        else :
            sum_mux += 0
            least_B -=least_K
            least_K = 0
    else:
        if least_K >= least_C:
            sum_mux -= least_C
            least_K -= least_C
            least_C = 0
        else :
            sum_mux -= least_K
            least_C -=least_K
            least_K = 0

print(sum_mux)

#-*- utf-8 -*-

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

sum_mux = 0

least_A, least_B, least_C = A, B, C
least_K = K

while 0 !=  least_K:
    if 0 != least_A:
        if least_K >= least_A:
            sum_mux += least_A
            least_K -= least_A
            least_A = 0
        else :
            sum_mux += least_K
            least_A -= least_K
            least_K = 0
    elif 0 != least_B:
        if least_K >= least_B:
            sum_mux += 0
            least_K -= least_B
            least_B = 0
        else :
            sum_mux += 0
            least_B -=least_K
            least_K = 0
    else:
        if least_K >= least_C:
            sum_mux -= least_C
            least_K -= least_C
            least_C = 0
        else :
            sum_mux -= least_K
            least_C -=least_K
            least_K = 0

print(sum_mux, flush=True)

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

min(A, K) + min(0, (A + B) - K )

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


def max_num():
    a, b, c, k = 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-(k-a-b))

max_num()


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

ans = 0
while K:
  if A:
    ans += 1
    A -= 1
  elif B:
    B -= 1
  else:
    ans -= 1

print(str(ans))

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

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

Verdicts: Time Limit Exceeded

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(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):
one = int(input())
zero = int(input())
ng_one = int(input())
card = int(input())

card_list = []
for i in range(one):
    card_list.append(1)
for i in range(zero):
    card_list.append(0)
for i in range(ng_one):
    card_list.append(-1)

print(sum(card_list[:card]))

one,zero,ng_one,card = map(int, input().split())

if card < one:
    print(card)
elif card <= one+zero:
    print(one)
else:
    print(one - (card - one - zero))

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 = list(map(int,input().split()))
A = a[0]
B = a[1]
C = a[2]
K = a[3]
if A > k :
    print(A)
elif (A + B) > K:
    print(A)
else:
    print(A-(K-A-B))

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

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

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

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):
2 1 1 3

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

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

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

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

print(a, k)
s = 0
b = [1, 0, -1]
for i, j in enumerate(a):
    n = min(j, k)
    k -= n
    s = s + b[i]*n
print(s)


*a, k = map(int, input().split())

print(a, k)
s = 0
b = [1, 0, -1]
for i, j in enumerate(a):
    n = min(j, k)
    k -= n
    s = s + b[i]*n
    if k<=0:
        break
print(s)


*a, k = map(int, input().split())

s = 0
b = [1, 0, -1]
for i, j in enumerate(a):
    n = min(j, k)
    k -= n
    s = s + b[i]*n
    if k<=0:
        break
print(s)


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

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

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

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

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

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

ans=0

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

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

ans=0

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

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
a = list(map(int, input().split())) 
max = 0
for x in range(0,a[0]):
  if x <= a[3]:
    for y in range(0,a[1]):
      if x + y <= a[3]:
        for z in range(0,a[2]):
          if x + y + z == a[3]:
            if max <= x -z:
              max = x-z
              
print(max)

one, zero, dif_one,num = map(int,input().split())
if num <= one:
  print(num)
elif num <= one + zero:
  print(one)
else:
  print(one-(num-one-zero))
  

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:
    vis = [1]*a
elif a+b > k:
    vis=[1]*a+[0]*b
else:
    vis=[1]*a+[0]*b+[-1]*c
    
s = 0

sum(vis[0:k])
    
print(s)

a,b,c,k=map(int,input().split())
vis=[1]*a + [0]*b + [-1]*c
s = 0

sum(vis[0:k])
    
print(s)

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

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):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B,C,K = MI()

def result(K):
   if K <= 0:
    print(sum)
    exit()

sum = 0
sum += K

K -= A

result(K)

K -= B
result(K)

sum -= K

result(K)

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B,C,K = MI()

def result(K):
   if K <= 0:
    print(sum)
    exit()

sum = 0

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

K -= B
result(K)

sum -= K

print(sum)

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

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


a, b, c, k = map(int, input().split())
print(min(k, a) - max(0,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):
N = input()
n =[int(x) for x in N]
A = n[0]
B = n[1]
C = n[2]
K = n[3]
if A>=K:
    print(K)
elif K <= A+B:
    print(A)
else:
    print(2*A+B-K)

N = input()
n =[int(x) for x in N.split()]
A = n[0]
B = n[1]
C = n[2]
K = n[3]
if A>=K:
    print(K)
elif 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):
a,b,c,k=map(int, input().split())
ans =0
if a>=k:
	ans+=k
else:
	ans+=a
if =k-a-b>=1:
	ans+=-(k-a-b)
print(ans)


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

"""
print(a)
print(b)
print(c)
print(k)
"""
if a >= k:
    print(a)

elif (a + b) >= k:
    print(a)

else:
    print(a-c)


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


"""
print(a)
print(b)
print(c)
print(k)
"""
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
if A>=K:
  ans=K
elif A<K and K<=A+B:
  ans=A
else :
  ans=A-(K-A-B)
print(ans)

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

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

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

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

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

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

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

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if(k <= a) cout << k << endl;
  else if(k <= a + b) cout << a << endl;
  else cout << a - (k - a - b) << endl;
  return 0;
}


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

a, b, b, k = map(int, input().split())
p = min(a, k)
s = p
k -= p
 
q = min(b, k)
k -= q
s -= k

r = min(c, k)
k -= r
s -= k
print(s)

a, b, c, k = map(int, input().split())
p = min(a, k)
s = p
k -= p
 
q = min(b, k)
k -= q
s -= k
 
r = min(c, k)
k -= r
s -= k
print(s)

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

score = 0
if A >= K:
    K -=A
    score += A
else:
    score = K
    print(score)
    exit()

if B >= K:
    K -=B
else:
    print(score)
    exit()

if C >= K:
    K -=B
    score -= C
else:
    score -= K
    print(score)
    exit()
print(score)

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

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



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

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



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

print(max(A, K))

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

score = 0
if A < K:
    K -=A
    score += A
else:
    score = K
    print(score)
    exit()

if B < K:
    K -=B
else:
    print(score)
    exit()

if C < K:
    K -=C
    score -= C
else:
    score -= K
    print(score)
    exit()
print(score)

Verdicts: Wrong Answer

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):
2000000000 0 0 200000000

a,b,c,k=map(int,input())
max_value=0
if k=<a+b:
  max_value=a
elif a+b<k=<a+b+c:
  max_value=a-k+a+b
print(max_value)

list=list(map(int,input().split()))
a=list[0]
b=list[1]
c=list[2]
k=list[3]
if k=<a+b:
  max_value=a
else:
  max_value=a-k+a+b
print(max_value)


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


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


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

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

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


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

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

print(count)

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

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

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())
ans = 0
if a > 0:
    ans = min(a, k)
    k = k - min(a, k)
if k > 0:
    k = k - b
if k > 0:
    ans = ans - k

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

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
a,b,c,k = map(int, input().split())
n = 0
ans = 0
for i in range(3):
  if i == 0: 
    n+=a
    ans += a
  elif i == 2:
    n += b
  else:
    n += 1
    ans -= 1
  if n >= k: break
print(ans)

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

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

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
S = list(map(int,input().split()))

if S[0] + S[1] + S[2] >= 2 * 10 ** 9:
    print('Error')
elif S[0] >= S[3]:
    print(S[3])
elif S[3] > S[0] and S[3] < S[0] + S[1]:
    print(S[0])
elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]:
    print(-1 * (S[3] - S[0] - S[1]) + S[0])
else:
    print('Error')
    

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

if S[0] + S[1] + S[2] >= 2 * 10 ** 9:
    print('Error')
elif S[0] >= S[3]:
    print(S[3])
elif S[3] > S[0] and S[3] < S[0] + S[1]:
    print(S[0])
elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]:
    print(-1 * (S[3] - S[0] - S[1]) + S[0])
else:
    print('Error')

A = int(input())
B = int(input())
C = int(input())
K = int(input())
if A + B + C >= 2 * 10 ** 9:
    print('Error')
elif A >= K:
    print(K)
elif K > A and K < A + B:
    print(A)
elif K > A + B and K <= A + B + C:
    print(-1 * (K - A - B) + A)
else:
    print('Error')

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

if S[0] + S[1] + S[2] > 2 * 10 ** 9:
    print('Error')
elif S[0] >= S[3]:
    print(S[3])
elif S[3] > S[0] and S[3] <= S[0] + S[1]:
    print(S[0])
elif S[3] > S[0] + S[1] and S[3] <= S[0] + S[1] + S[2]:
    print(-1 * (S[3] - S[0] - S[1]) + S[0])
else:
    print('Error')

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

if A > K:
  print(K)
  
temp = K - A

if temp >= B:
  print(A)
  
temp = temp - B

print(A - C)
  

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

if A >= K:
  print(K)
  exit()
  
temp = K - A

if B >= temp:
  print(A)
  exit()
  
temp = temp - B

print(A - temp)
  


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())
print(A,B,C,K)
res = 0
if A>=K:
  res= 1*A
else:
  for b in range(K-A,B+1):
    c = K-A-b
    if c >= 0:
      ans = 1*A + 0*b + (-1)*c
      res = max(res,ans)
    else:
      break
print(res)

A,B,C,K = map(int,input().split())
res = 0
if A>=K:
  res= 1*A
else:
  for c in range(K-A,C+1):
    b = K - A - c
    ans = 1*A + 0*b + (-1)*c
    res = max(res,ans)
print(res)

A,B,C,K = map(int,input().split())
res = 0
if A>=K:
  res= 1*A
else:
  for c in range(K-A,C+1):
    b = K-A-c
    ans = 1*A + 0*b + (-1)*c
    res = max(res,ans)
print(res)

A,B,C,K = map(int,input().split())
print(A,B,C,K)
res = 0
for i in range(A+1):
  for j in range(B+1):
    ans = 1*i + 0*j + (-1)*(K-i-j)
    res = max(res,ans)
print(res)

A,B,C,K = map(int,input().split())
print(A,B,C,K)
res = 0
if A>=K:
  res= 1*A
else:
  for b in range(K-A,B+1):
    c = K-A-b
    ans = 1*A + 0*b + (-1)*c
    res = max(res,ans)
print(res)

A,B,C,K = map(int,input().split())
xa = min(K,A)
xb = min(K-xa,B)
xc = K-xa-xb
ans = 1*xa + 0*xb + (-1)*xc
print(ans)

Verdicts: Wrong Answer

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

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

Verdicts: Runtime Error

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
a,b,c,k = int(input())
total = a*1 + b*0 - c*1
print(int(total))

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


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

def test(a,b,c,k):
	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(" ")))
print(test(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):
n=list(map(int,input().split()))
s=0
k=n[3]
a=n[0]
d=k-a
if k-a>0:
    s=a-k+a
if k-a<=0:
    s=k
print(s)


n=list(map(int,input().split()))
s=0
k=n[3]
a=n[0]
b=n[1]
d=k-a

if k-a<=0:
    s=k
if k-a>0:
    if k-a-b<=0:
        s=a;
    else:
        s=a-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())
print(A,B,C,K)
ANS = 0

ANS += min([A,K])
K -= A
if K<1:
    print(ANS)
    exit()
K -= B
if K<1:
    print(ANS)
    exit()
ANS -= min([C,K])
print(ANS)

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

ANS += min([A,K])
K -= A
K -= B

if K<1:
    print(ANS)
    exit()
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 =map(int, input().split())
if k <= a:
    print (a)
elif k > a:
    if k <= (a + b):
        print(a) 
    elif k > (a + b):
        print(a - (k - (a + b))

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

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

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 = int(input())
B = int(input())
C = int(input())
K = int(input())
#the number of A,B,C for given K
if K-A<0: 
    NA = K
    NB = 0
    NC = 0
else: 
    NA = A
    if (K-A)-B<0: 
        NB = K-A
        NC = 0
    else: 
        NB = B
        NC = K-A-B


sum = NA *1 + NB *0 + NC *(-1)


print(sum)

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: 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(a)
nelse:
    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: 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())
out = min(A, K) - max(K-A-B, 0)

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

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

a,b,c,k=map(int,input().split())
ct=k
result = 0
if a>0:
  if ct>a:
    result=1*a
  elif a>=ct:
    result=1*ct
  ct=k-a
if ct>0 and b>0:
  ct=ct-b
if ct>0 and c>0:
  result=result+(-1*ct)
print(result)

Verdicts: Wrong Answer

Accepted
Problem: We have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.  We will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?

Submission attempts (in order):
a,b,c,k = map(int,input())
if k<a:
    print(k)
elif 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+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):
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)

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

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

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

if(k<=a):
  print(a*k)
else:
  sum=a*k
  t=k-a
  if(t<=b):
    print(sum)
  else:
    
    t2=t-c
    print(sum-c*t2)


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

if(k<=a):
  print(a*k)
else:
  sum=a*k
  t=k-a
  if(t<=b):
    print(sum+b*t)
  else:
    sum+=b*t
    t2=t-c
    print(sum+c*t2)








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

if(k<=a):
  print(a*k)
else:
  sum=k
  t=k-a
  if(t<=b):
    print(sum)
  else:
    
    
    t2=t-c
    print(sum-t2)


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

if(k<=a):
  print(a*len(k))
else:
  sum=a*len(k)
  t=k-a
  if(t<=b):
    print(sum+b*len(t))
  else:
    sum+=b*len(t)
    t2=t-c
    print(sum+c*len(t2))

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted