Harryxun/stf_run huggingface dataset:
S = input()

if S[0] == "A":
    A = True
else:
    A = False

small = "abcdefghijklmnopqrstuvwxyz"
countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
if countC == 1:
    C = True
else:
    C = False

s = True
for i in range(1,len(S)):
    if i != place:
        if S[i] not in small:
            s = False



if (A and C and s):
    print("AC")
else:
    print("WA")

### FIXED CODE ###

S = input()

if S[0] == "A":
    A = True
else:
    A = False

countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
        
if countC == 1:
    C = True
else:
    C = False
    


'''
if C:
    for i in range(1,place):
        lower = S[i].islower()
        if lower == False:
            B = False
    for i in range(place+1,len(S)):
        lower = S[i].islower()
        if (lower):
            B = False
'''

B = False

new = ""
if C:
    for i in range(1,place):
        new = new + S[i]
    for i in range(place+1,len(S)):
        new = new + S[i]

    if new.islower():
        B = True
    else:
        B = False

            
if (A and B and C):
    print("AC")
else:
    print("WA")
x,m=int(input()),100
for d in range(4000):m+=m//100
 if x<=m:print(d+1);exit()


### FIXED CODE ###

def LI():return list(map(int,input().split()))

# for i in range(10):
#     print(i&1^0)

x=int(input())
m=100
for i in range(5000):
    m=int(m*1.01)
    if m>=x:
        print(i+1)
        exit()
input(); d_list = list(map(int, input().split()))
sum=0
for i, x in enumerate(d_list):
  for y in d_list[i+1:]:
    sum+=x*y
print("%d" % sum)

### FIXED CODE ###

A,B = map(int, input().split())
print("%d" % (A-2*B if A >= 2*B else 0))
p = sorted([map(int, input().split())])
print(p[0] + p[1])



### FIXED CODE ###

p = sorted(list(map(int, input().split())))
print(p[0] + p[1])
S = input()
s = S%60
m1 = (S-s)/60
m = m1%60
h = (m1-m)/60
print "%s:%s:%s"(h,m,s)

### FIXED CODE ###

S = input()
s = S%60
m = ((S-s)/60)%60
h = (((S-s)/60)-m)/60
print "%s:%s:%s"%(h,m,s)
import math

if __name__ == '__main__':
    N = int(input())
    print(N*N(math.pi)


### FIXED CODE ###

if __name__ == '__main__':
    N = int(input())
    import math
    print(2*N*(math.pi))
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*1
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))

### FIXED CODE ###

n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))
X, N = map(int, input().split())
ans = X
if N>0:
  P = list(map(int, input().split()))
  P.sort()
  if X in P:
    ans = 0
    x = P.index(X)
    i = 0
    a = x
    b = x
    while ans == 0:
      if X-i != P[a]:
        ans = X-i
      elif X+i != P[b]:
        ans = X+i
        a -= 1
      else:
        a -= 1
        b += 1
        i += 1
print(ans)
      
        
    

### FIXED CODE ###

X, N = map(int, input().split())
ans = X
if N>0:
  P = list(map(int, input().split()))
  P.sort()
  if X in P:
    ans = 0
    x = P.index(X)
    i = 1
    a = x-1
    b = x+1
    m = min(P[N-1]-X, X-P[0])
    for i in range(1,m+2):
      if a < 0:
        a = 0
      if b > N-1:
        b = N-1
      if X-i != P[a]:
        ans = X-i
        break
      elif X+i != P[b]:
        ans = X+i
        break
      else:
        a -= 1
        b += 1
print(ans)
a, b, c, k = map(int, input().split())
if k <= a+b:
    print(min(a, k)
else:
    print(2*a+b-k)

### FIXED CODE ###

a, b, c, k = map(int, input().split())
if k <= a+b:
    print(min(a, k))
else:
    print(2*a+b-k)
6
-679 -2409 -3258 3095 -3291 -4462

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
    total += abs(p-a)
    p = a
total += abs(p)

print(total - abs(A[0]) - abs(A[0]-A[1]) + abs(A[1]))
for n in range(1,N-1):
    print(total - abs(A[n-1]-A[n]) - abs(A[n]-A[n+1]) + abs(A[n-1]-A[n+1]))
print(total - abs(A[N-2]-A[N-1]) - abs(A[N-1]) + abs(A[N-2]))
a=int(input())
s=input()
if a>=3200:
	print(s)
else:
print("red")

### FIXED CODE ###

a=int(input())
s=input()
if a>=3200:
	print(s)
else:
    print("red")
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if (max(a,b,c,d,e) - min(a,b,c,d,e,f) <= 15):
	print('Yay!')
else:
	print(':(')

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
 
if (max(a,b,c,d,e) - min(a,b,c,d,e) <= k):
	print('Yay!')
else:
	print(':(')
from collections import deque
n = int(input())
listx = [int(input()) for i in range(n)]
listx.sort()
listx = deque(listx)
listy = deque([])
ans=0

x=listx.popleft()
listy.appendleft(x)
x=listx.pop()
listy.append(x)
ans+=int(listy[1])-int(listy[0])

while len(listx)>=1:
    abs1=abs(listx[0]-listy[-1])
    abs2=abs(listx[-1]-listy[0])

    if abs1 < abs2:
        x=listx.pop()
        listy.appendleft(x)
        ans+=abs2

    else:
        x=listx.popleft()
        listy.append(x)
        ans+=abs1
        
    if listy[0] > listy[-1]:
        listy.reverse()

print(ans)


### FIXED CODE ###

s = input()
if len(s) ==2:
  print(s)
else:
  print(s[2]+s[1]+s[0])
n,k = (int(x) for x in input().split())
h = list(map(int, input().split()))

h.sort()
print(h[0])
i=0
while h[i]<k:
  i+=1

print(n-i)

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
 
cnt = 0
for i in range(len(h)):
    if h[i] >= K:
        cnt += 1 
print(cnt)
a, b, c = list(input())

if a == b == c:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

a,b = map(int,input().split(" "))
c= a*b%2

if c==0:
    print('Even')
else:
    print("Odd")
import sys
import numpy as np

import os
path = os.getcwd()
path = os.path.join(path,"input.txt")
sys.stdin = open(path)

input = sys.stdin.readline
N,W  = map(int,input().split())
dp = np.zeros((N+1,W+1))
w,v = [],[]
for _ in range(N):
    w_,v_ = map(int,input().split())
    w.append(w_)
    v.append(v_)

for row in range(N):
    for col in range(1,W+1):
        if w[row] <= col:
            dp[row+1,col] = max(v[row]+dp[row,col-w[row]],dp[row,col])
        else:
            dp[row+1,col] = dp[row,col]

ans = int(max(dp[N]))
print(ans)

### FIXED CODE ###

import sys
import numpy as np


input = sys.stdin.readline
N,W  = map(int,input().split())
dp = np.zeros((N+1,W+1),dtype=int)
w,v = [],[]
for _ in range(N):
    w_,v_ = map(int,input().split())
    w.append(w_)
    v.append(v_)

for row in range(N):
    dp[row+1,:w[row]] = dp[row,:w[row]]
    dp[row+1,w[row]:] = np.maximum(dp[row,w[row]:],v[row]+dp[row,:-w[row]])
print(dp[N,-1])
n=int(input())
a=list(map(int,input().split()))

hat = [0,0,0]

mod = 10**9 + 7
ans=1

def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

for i in range(n):
    arr=my_index_multi(hat,a[i])

    ans = ans*len(arr)%mod

    hat[arr[0]]+=1

print(ans)



### FIXED CODE ###

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

hat = [0,0,0]

mod = 10**9 + 7

ans=1

for i in range(n):
    tmp=0
    index=0
    for j,k in enumerate(hat):
        if k==a[i]:
            tmp+=1
            index=j

    ans = (ans*tmp)%mod

    hat[index]+=1

print(ans)
n,m = map(int, input().split())
Li = [[] for y in range(m)]
Li2 = []
a = 0
for x in range(n):
    Li[x] += list(map(int, input().split()))
for x in range(m):
    Li2.append(int(input()))
for x in range(n):
    for y in range(m):
        a += Li[x][y]*Li2[y]
    print(a)
    a = 0






### FIXED CODE ###

n,m = map(int, input().split())
Li = [[] for y in range(n)]
Li2 = []
a = 0
for x in range(n):
    Li[x] += list(map(int, input().split()))
for x in range(m):
    Li2.append(int(input()))
for x in range(n):
    for y in range(m):
        a += Li[x][y]*Li2[y]
    print(a)
    a = 0
n,m=map(int,input().split())
a=[[] for i in range(m)]
for i in range(m):
  a[i].append(i+1)
  
for i in range(m):
  a[-1-i].append(i+1+m)
a[-1]=n
for x in a:
  print(x[0],x[1])


### FIXED CODE ###

from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n, m = map(int, input().split())
    ans = []
    for i in range(1, (m+1)//2+1):
        ans.append([i, m+2-i])

    for i in range(1, (m+1)//2+1):
        if len(ans) == m:
            break
        ans.append([m+1+i, 2*m+2-i])

    for x in ans:
        print(x[0], x[1])

main()
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

A_dp = [0] * (N + 1)
B_dp = [0] * (M + 1)

for i in range(1,N+1):
  if i == 1:
    A_dp[i] += A[i-1]
    continue
  A_dp[i] += A_dp[i-1] + A[i-1]
  
for j in range(1,M+1):
  if j == 1:
    B_dp[j] += B[j-1]
    continue
  B_dp[j] += B_dp[j-1] + B[j-1]
  
a = N
b = 0

minute = A_dp[a] + B_dp[b]
if K > minute:
  while K >= A_dp[a] + B_dp[b]:
    b += 1
else:
  while K < A_dp[a] + B_dp[b]:
    a -= 1
  
cnt = a + b
for k in range(a,-1,-1):
  while A_dp[k] + B_dp[b] < K:
    if b == M - 1:
      break
    b += 1
  b -= 1
  if cnt < k + b:
    cnt = k + b
    
print(cnt)

### FIXED CODE ###

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

A_dp = [0] * (N + 1)
B_dp = [0] * (M + 1)

for i in range(1,N+1):
  if i == 1:
    A_dp[i] += A[i-1]
    continue
  A_dp[i] += A_dp[i-1] + A[i-1]
  
for j in range(1,M+1):
  if j == 1:
    B_dp[j] += B[j-1]
    continue
  B_dp[j] += B_dp[j-1] + B[j-1]
  
cnt = 0
j = M

for i in range(N+1):
  if A_dp[i] > K:
    continue
  while A_dp[i] + B_dp[j] > K:
    j -= 1
  cnt = max(cnt, i+j)
  
print(cnt)
def main():
    """
    0? <= h, w <= 100
        grid
    1 <= A, B <= 500

    2つの白く塗られたマス c1,c2が連結であるとは、
        マスc1からマスc2へ、
        上下左右に隣り合うマスへの移動を繰り返して、
        白く塗られたマスだけを通って移動できること

    白く塗られたマスの集合 S が連結成分であるとは、
        S のどの2 つのマスも連結である
        S に含まれないどの白く塗られたマスと、Sに含まれるどのマスも連結ではない
    """
    A, B = map(int, input().split())

    f(A, B)


def editorial(A, B):
    """
    市松模様が浮かんでた
    白い海、黒い海をつくり
    白に黒の島を浮かべ、黒に白の島を浮かべるイメージらしい
    これに至る発想の流れの解説がない…発想力
        100*100だったので,最小領域で考えず最大領域を作ることはしたかった
        1マスは連結だった…
    """
    wh = "."
    bl = "#"
    
    grid = [
        list(wh * 50 + bl * 50)
        for _ in range(100)
    ]
    update(A, grid, wh, shift=50)
    update(B, grid, bl, shift=0)

    print(100, 100)
    for line in grid:
        print(*line, sep="")


def update(n, grid, mark, shift):
    rest = n - 1
    for i in range(1, 50, 2):
        for j in range(1+shift, shift+50, 2):
            if rest <= 0:
                return
            grid[i][j] = mark
            rest -= 1


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    """
    0? <= h, w <= 100
        grid
    1 <= A, B <= 500

    2つの白く塗られたマス c1,c2が連結であるとは、
        マスc1からマスc2へ、
        上下左右に隣り合うマスへの移動を繰り返して、
        白く塗られたマスだけを通って移動できること

    白く塗られたマスの集合 S が連結成分であるとは、
        S のどの2 つのマスも連結である
        S に含まれないどの白く塗られたマスと、Sに含まれるどのマスも連結ではない
    """
    A, B = map(int, input().split())

    f(A, B)


def f(A, B):
    """
    解説pdfがないので、Twitter/動画を参考
    市松模様が浮かんでた
    白い海、黒い海をつくり
    白に黒の島を浮かべ、黒に白の島を浮かべるイメージらしい
    これに至る発想の流れの解説がない…発想力
        100*100だったので,最小領域で考えず最大領域を作ることはしたかった
        1マスは連結だった…
    """
    wh = "."
    bl = "#"

    grid = [
        list(wh * 50 + bl * 50)
        for _ in range(100)
    ]
    update(A, grid, wh, shift=50)
    update(B, grid, bl, shift=0)

    print(100, 100)
    for line in grid:
        print(*line, sep="")


def update(n, grid, mark, shift):
    rest = n - 1
    for i in range(0, 100, 2):
        for j in range(1+shift, shift+49, 2):
            if rest <= 0:
                return
            grid[i][j] = mark
            rest -= 1


if __name__ == '__main__':
    main()
line = input().split()
x = line[1]
ans = 0;

a = input().split().sort()

for i in len(a):
  if a[i] > x:
    print ans
    break
  else:
    x-=a[i]
    ans++
    continue
print ans

### FIXED CODE ###

line = input().split()
N = int(line[0])
x = int(line[1])
ans = 0

a = input().split()
a = [int(i) for i in a]
a.sort()

for i in range(N):
    if a[i] > x:
        print(ans)
        break
    else:
        x -= a[i]
        if i != (N - 1):
            ans += 1
        else:
            if x == 0:
                ans += 1
            print(ans)
x, y = map(int, input().split())

c = 0

while x >= 0 :
    if c * 2 + x * 4 == y :
        break 
    c += 1
    x -= 1
else :
    print(No)

print(Yes)

### FIXED CODE ###

x, y = map(int, input().split())

c = 0

while x >= 0:
    if c * 2 + x * 4 == y:
        break
    c += 1
    x += -1
else:
    print("No")
    exit()

print("Yes")
n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))

### FIXED CODE ###

n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))
x,y = map(int,input().split())
ax = abs(x)
ay = abs(y)
if x > y and 0 < y:
    x = -x
    a = y - x + 1
    if  ay > ax and x >= 0:
        a = ay - x + 

elif x > y and 0 >= y:
    if ay > ax and x >= 0:
        a = ay - x + 1
    elif ay > ax and x < 0:
        a = ay + x + 2
    else:
        a = 1
elif y > x and x < 0:
    if ay > ax:
        a = ay - ax + 1
else:
    a = y-x
print(a)

### FIXED CODE ###

x,y = map(int,input().split())
ax = abs(x)
ay = abs(y)
if ax == ay and x != y:
    a = 1
elif x > y and 0 < y:
    a = ax - ay + 2
elif x > y and y == 0:
    a = ax - ay + 1
elif x > y and 0 > y:
    if ay > ax and x >= 0:
        a = ay - ax + 1
    elif ay > ax and x < 0:
        a = ay - ax + 2
    elif ax > ay:
        a = ax - ay + 1
elif y > x and x < 0 and ay > ax:
    a = ay - ax + 1
elif y > x and x < 0 and y > 0 and ax > ay:
    a = ax - ay + 1
else:
    a = y-x
print(a)
n=int(input())
X=[]
Y=[]
#A=[]
for i in range(n):
  A=int(input())
  #x=[]
  #y=[]
  #for j in range(A[i]):
    #x,y=[int(s) for s in input().split()]
  #X.append(x)
  #Y.append(y)
  
c=0
#for i in range(n):
 # l=[1]*n
  #for j in range(i, n-i):
   # if l[j]==0:continue
    #for k in range(A[j]):
   # 　　l[X[j][k]] *= Y[j][k]
#if c<l.count(1):
 # c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
def main():
    a,b,c=map(int,input().split(' '))
    print(sum([a,b,c])-,max(a,b,c))

main()


### FIXED CODE ###

def main():
    a,b,c=map(int,input().split(' '))
    print(sum([a,b,c])-max(a,b,c))

main()
N,M=map(int,input().split())
count=0
A=[[] for i in range(3)]
for i in range(M):
    s,c=map(int,input().split())
    if s==1 and c==0:
        count+=1
    else:
        A[s-1].append(c)
B=[]
for i in range(N-1,-1,-1):
    if len(A[i])>=1:
        B.append(A[i][0])
        for j in range(1,len(A[i])):
            if A[i][j]!=A[i][0]:
                count+=1
    else:
        B.append(0)
if count>0:
    print(-1)
elif N==1:
    print(B[0])
elif N==2:
    print(B[2]*(10**(N-1))+B[1]*(10**(N-2)))
else:
    print(B[2]*(10**(N-1))+B[1]*(10**(N-2))+B[0])

### FIXED CODE ###

N,M=map(int,input().split())
count=0
A=[[] for i in range(3)]
for i in range(M):
    s,c=map(int,input().split())
    if s==1 and c==0 and N>=2:
        count+=1
    else:
        A[s-1].append(c)
B=[]
for i in range(N):
    if len(A[i])>=1:
        B.append(A[i][0])
        for j in range(1,len(A[i])):
            if A[i][j]!=A[i][0]:
                count+=1
    elif N>=2:
        B.append(max(1-i,0))
    else:
        B.append(0)
if count>0:
    print(-1)
elif N==3:
    print(B[0]*(10**2)+B[1]*(10**1)+B[2])
elif N==2:
    print(B[0]*(10**1)+B[1])
else:
    print(B[0])
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=list(input())
answer=counter(S)
print(answer)

### FIXED CODE ###

from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)
s=input()
p=0
for i in s:
  if i=='o':
  	p++ 

print(p)

### FIXED CODE ###

s=input()
p=0
#print(s)
for i in s:
  if i=='o':
  	p+=1 

    
print(100*int(p)+700)
"""
oxo

900

ooo

1000

xxx

700
"""
xyzk_, a_, b_, c_ = [input() for _ in range(4)]

x, y, z, k = [int(w) for w in xyzk_.split()]
a_nums = [int(n) for n in a_.split()]
b_nums = [int(n) for n in b_.split()]
c_nums = [int(n) for n in c_.split()]

a_nums.sort(reverse=True)
b_nums.sort(reverse=True)
c_nums.sort(reverse=True)

p, q, r = 0, 0, 0
now = a_nums[p] + b_nums[q] + c_nums[r]

while (p+1) * (q+1) * (r+1) < k:
    if a_nums[p+1] >= max(b_nums[q+1], c_nums[r+1]):
        p += 1
    elif b_nums[q + 1] >= c_nums[r + 1]:
        q += 1
    else:
        r += 1

a_nums = a_nums[:p]
b_nums = b_nums[:q]
c_nums = c_nums[:r]


sums = []
for a in a_nums:
    for b in b_nums:
        for c in c_nums:
            sums.append(a + b + c)

sums.sort(reverse=True)
for n in sums[:k]:
    print(n)


### FIXED CODE ###

xyzk_, *nums_ = [input() for _ in range(4)]

*le, k = [int(w) for w in xyzk_.split()]
abc = [sorted((int(n) for n in w.split()), reverse=True) for w in nums_]

p = [0, 0, 0]
pool = [0, sum(abc[i][p[0]] for i in range(3))]
for _ in range(k):
    max_pool = max(pool)
    max_t = 0
    for i in range(3):
        if p[i] + 1 == le[i]:
            continue
        t = abc[i][p[i] + 1] + abc[(i + 1) % 3][0] + abc[(i + 2) % 3][0]
        if t > max_t:
            max_t = t
            max_3 = i
    if max_pool < max_t:
        p[max_3] = min(p[max_3] + 1, le[max_3] - 1)
        j, k = (max_3 + 1) % 3, (max_3 + 2) % 3
        for n1 in abc[j][:p[j] + 1]:
            for n2 in abc[k][:p[k] + 1]:
                pool.append(n1 + n2 + abc[max_3][p[max_3]])
    print(pool.pop(pool.index(max(pool))))
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))


### FIXED CODE ###

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))
k_t = input().split()
k = int(k_t[0])
t = int(k_t [1])
t_amount = input().split(' ')
 
while True:
    if t == 1:
        max = k
        break
    max = 0
    for i in range(t-1):
        if t_amount[i+1] >= t_amount [i]:
            max = t_amount[i+1]
        elif max == 0:
            max = t_amount[0]
    t_amount.remove(max)
 
    max2 = 0
    for i in range(t-2):
        if t_amount[i+1] >= t_amount [i]:
            max2 = t_amount[i+1]
        elif max2 == 0 :
            max2 = t_amount[0]
    t_amount.remove(max2)
    if max2 == "0":
        break
    else:
        max = int(max) -1
        max2 = int(max2) -1
        t_amount.append(str(max))
        t_amount.append(str(max2))
 
if max == "0":
    print(0)
else:
    print(int(max)-1)

### FIXED CODE ###

line = input()
if "C" in line and "F" in line:
    if line.index("C") < line.index("F"):
        print('Yes')
    elif line.index("C") > line.index("F"):        
        line1 = line[line.index("C"):]
        
        if "F" in line1:
            print('Yes')
        else:
            print('No')
    else:
        print('No')    
else:
    print('No')
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
l=0
r=n
while l!=r:
    i=(l+r)//2
    ta = a[i]
    na = a[:i]+a[i+1:]
    dp = [False for _ in range(k+1)]
    dp[0]=True
    for j in range(n-1):
        for m in range(k,0,-1):
            if m-na[j]>=0:
                dp[m]=dp[m] or dp[m-na[j]]
    flag = False
    for j in range(k-ta,k):
        if dp[j]:
            flag = True
            break
    if flag:
        r=i
    else:
        l=i+1
print(l)



### FIXED CODE ###

import bisect
def main():
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    a.sort()
    l=0
    r=n
    d = {}
    if sum(a)<k:
        print(n)
    else:
        while l!=r:
            i=(l+r)//2
            ta = a[i]
            if ta in d.keys():
                flag = d[ta]
            elif ta>=k:flag=True
            else:
                flag = False
                na = a[:i]+a[i+1:]
                dp = [False for _ in range(k+1)]
                dp[0]=True
                for j in range(n-1):
                    for m in range(k,0,-1):
                        if m-na[j]>=0:
                            dp[m]=dp[m] or dp[m-na[j]]
                        if m != k and m>=k-ta and dp[m]:
                            flag = True
                            break
                    if flag:break
                d[ta] = flag
            
            if flag:
                r=i
            else:
                l=i+1
        print(l)

main()
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

same = 0
for i in range(1, n + 1):
	if A[i] == i:
		same += 1

k = k % (n - same)

pos = 1
for i in range(1, k + 1):
	pos = A[pos]

print(pos)

### FIXED CODE ###

n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

pos = [1]

for i in range(2 * n):
	nxt = A[pos[-1]]
	pos.append(nxt)

if k < n + 1:
	print(pos[k])
	exit()

loop_end = n
loop_start = n - 1

while pos[loop_start] != pos[loop_end]:
	loop_start -= 1

period = loop_end - loop_start
k = k % period

while k < n:
	k += period

print(pos[k])
h,w = [int(x) for x in stdin.readline().rstrip().split()]
import math
def bishop(h,w):
    if h == 1:
        ans = 1
    else:
        ans = int(w/2)*h + (w%2)*math.ceil(h/2)
    return ans

### FIXED CODE ###

from sys import stdin
import math

h,w = [int(x) for x in stdin.readline().rstrip().split()]
if (h==1)|(w==1):
    ans = 1
else:
    ans = int(w/2)*h + (w%2)*math.ceil(h/2)
print(ans)
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
for x in range(h):
    for y in range(w):
        if(s[x][y] == '#'):
            up = s[max(0, x-1)][y]
            down = s[min(x+1, h-1)][y]
            right = s[x][max(0, y-1)]
            left = s[x][max(y+1, w-1)]
            if(up == '.' and down == '.' and right == '.' and left == '.'):
                print("No")
                exit()
print("Yes")


### FIXED CODE ###

h, w = map(int, input().split())
s = [input() for i in range(h)]
up = down = right = left = '.'
for x in range(h):
    for y in range(w):
        if(list(s[x])[y] == '#'):
            if(y != w-1):
                right = list(s[x])[y+1]
            if(x != h-1):
                down = list(s[x+1])[y]
            if(x != 0):
                up = list(s[x-1])[y]
            if(y != 0):
                left = list(s[x])[y-1]
            if(up != '#' and down != '#' and right != '#' and left != '#'):
                print("No")
                exit()
            up = down = right = left = '.'
print("Yes")