Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

s=input()
N=int(input())
#s="atcoderandatcodeer"
#N=5
D={}

if(len(s)<=10):
    for i in range(1,len(s)+1):
        for j in range(len(s)):
            if D.get(s[j:j+i],None) == None:
                D[s[j:j+i]]=1
    D=sorted(D)
    print(D[N-1])
    exit()
else:
    t=sorted(s)
    i=0
    k=0
    for c in t:
        if(c!=k):
            i=0
            if(len(D)>=5):
                break
        k=c
        while(i<len(s)):
            if(s[i]==c):
                break
            i+=1
        j=i+1
        while(j<=len(s)):
            D[s[i:j]]=1
            j+=1
        i+=1
    
    D=sorted(D)
    print(D[N-1])
    exit()





### FIXED CODE ###

s=input()
N=int(input())
#s="atcoderandatcodeera"
#N=5
D={}

if(len(s)<=1):
    for i in range(1,len(s)+1):
        for j in range(len(s)):
            if D.get(s[j:j+i],None) == None:
                D[s[j:j+i]]=1
    D=sorted(D)
    print(D[N-1])
    exit()
else:
    t=sorted(s)
    i=0
    k=0
    for c in t:
        if(c!=k):
            i=0
            if(len(D)>=5):
                break
        k=c
        while(i<len(s)):
            if(s[i]==c):
                break
            i+=1
        j=i+1
        while(j<=min(len(s),i+5)):
            D[s[i:j]]=1
            j+=1
        i+=1
    
    D=sorted(D)
    print(D[N-1])
    exit()
### BUGGY CODE ###

r,g,b,n=map(int,input().split())
ans=0
for i in range(3001):
    for j in range(3001):
        if b==0:
            if n==r*i+g*j:
                ans+=1
        else:    
            if (n-r*i-g*j)%b==0:
                ans+=1
print(ans)
                

### FIXED CODE ###

r,g,b,n=map(int,input().split())
ans=0
for i in range(3001):
    for j in range(3001):   
        if (n-r*i-g*j)>=0 and (n-r*i-g*j)%b==0:
                ans+=1
print(ans)
### BUGGY CODE ###

import sys
from operator import itemgetter
input = sys.stdin.readline

N = int(input())
A, B = [], []

for i in range(N):
    a, b = map(int, input().split())
    A.append([a, i])
    B.append([b, i])
A.sort(reverse=True, key=itemgetter(1))
B.sort(reverse=True, key=itemgetter(1))

ate = []
apoint, apos = 0, 0
bpoint, bpos = 0, 0
for i in range(N):
    if i % 2 == 0:
        while A[apos][1] in ate:
            apos += 1
        apoint += A[apos][0]
        ate.append(A[apos][1])
        apos += 1
    else:
        while B[bpos][1] in ate:
            bpos += 1
        bpoint += B[bpos][0]
        ate.append(B[bpos][1])
        bpos += 1
print(apoint - bpoint)


### FIXED CODE ###

N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a + b)
    B.append(b)

A.sort(reverse=True)
print(sum([ab for i, ab in enumerate(A) if i % 2 == 0]) - sum(B))
### BUGGY CODE ###

h, w = map(int, input().split())
lsa = [list(map(int, input().split())) for i in range(h)]
lsb = [list(map(int, input().split())) for i in range(h)]
ls = [[abs(lsa[i][j] - lsb[i][j]) for j in range(w)] for i in range(h)]


dp = [[set() for _ in range(w)] for _ in range(h)]

dp[0][0].add(ls[0][0])

for i in range(h):
    for j in range(w):

        lsap = set()  
        if j != 0:  
            for k in dp[i][j-1]:
                lsap.add(k+ls[i][j])
                lsap.add(abs(k-ls[i][j]))

        if i != 0:
            for k in dp[i-1][j]:
                lsap.add(k+ls[i][j])
                lsap.add(abs(k-ls[i][j]))
        
        if lsap:
            dp[i][j] = lsap

print(min(dp[h-1][w-1]))
            

### FIXED CODE ###

h, w = map(int, input().split())
lsa = [list(map(int, input().split())) for i in range(h)]
lsb = [list(map(int, input().split())) for i in range(h)]
ls = [[abs(lsa[i][j] - lsb[i][j]) for j in range(w)] for i in range(h)]
bias = 80*80*80

dp = [[0 for _ in range(w)] for _ in range(h)]

dp[0][0] = 1 << ls[0][0]+bias

for i in range(h):
    for j in range(w):

        if j != 0:  
            dp[i][j] |= dp[i][j-1] << ls[i][j]
            dp[i][j] |= dp[i][j-1] >> ls[i][j]

        if i != 0:
            dp[i][j] |= dp[i-1][j] << ls[i][j]
            dp[i][j] |= dp[i-1][j] >> ls[i][j]

ans = dp[h-1][w-1] >> bias
idx = 0
while(1):
    if 1 << idx & ans:
        break
    idx += 1
print(idx)
### BUGGY CODE ###

def myAnswer(N:int,S:list) -> int:
   counter = 0
   dic = {}
   for s in S:
      if(s in dic.keys()):
         dic[s]+=1
      else:
         dic[s] = 0
   for value in dic.values():
      counter += (value * (value + 1)) // 2
   return counter

def modelAnswer():
   return
def main():
   N = int(input())
   S = ["".join(sorted(list(input()))) for _ in range(N)]
   print(myAnswer(N,S))
if __name__ == '__main__':
   main()

### FIXED CODE ###

N=int(input())
s=[]
cnt=dict()


for _ in range(N):
    tmp=list(input())
    sotmp=sorted(tmp)
    stmp=''.join(sotmp)
    s.append(stmp)

ss=sorted(s)

for word in ss:
    if((word in cnt.keys())==False):
        cnt[word]=0
    else:
        cnt[word]+=1


total=0
for value in cnt.values():
    total+=(1+value)*value//2

print(total)
### BUGGY CODE ###

def main():
    S=input()
    MOD=10**9+7
    dp=[0]*13
    dp[0]=1
    r=1
    for i in range(len(S)):
        new_dp=[0]*13
        s=S[-1-i]
        if s=="?":
            for j in range(10):
                rem=(j*r)%13
                for k in range(13):
                    new_dp[(k+rem)%13]+=dp[k]
        else:
            rem=(int(s)*r)%13
            for k in range(13):
                new_dp[(k+rem)%13]+=dp[k]
        for l in range(13):
            new_dp[l]%=MOD
        dp=new_dp
        r=(r*10)%13
    print(dp[5])
if __name__=="__main__":
    main()

### FIXED CODE ###

S=input()
MOD=10**9+7
dp=[0]*13
dp[0]=1
r=1
for i in range(len(S)):
    new_dp=[0]*13
    s=S[-1-i]
    if s=="?":
        for j in range(10):
            rem=(j*r)%13
            for k in range(13):
                new_dp[(k+rem)%13]+=dp[k]
    else:
        rem=(int(s)*r)%13
        for k in range(13):
            new_dp[(k+rem)%13]+=dp[k]
    for l in range(13):
        new_dp[l]%=MOD
    dp=new_dp
    r=(r*10)%13
print(dp[5])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)

n, m, *a = map(int, open(0).read().split())
dp = [0] * (n + 1)
ok = [True] * (n + 1)

for i in a:
    ok[i] = False


def count(n):
    if n < 2:
        return 1
    if dp[n] != 0:
        return dp[n]
    dp[n] = (count(n - 1) * ok[n - 1] + count(n - 2) * ok[n - 2]) % (10**9 + 7)
    return dp[n]


print(count(n))


### FIXED CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)


memo = [0]*(10**5+1)
def count(n):
    if n < 2:
        return 1
    if memo[n] != 0:
        return memo[n]
    memo[n] = count(n-1) + count(n-2)
    return memo[n]


n, m, *a = map(int, open(0).read().split())
if sum(a[i + 1] == a[i] + 1 for i in range(m - 1)) > 0:
    print(0)
    exit()

a.append(n + 1)
c = -1
ans = 1
for i in a:
    ans = ans * count(i - c - 2) % (10**9 + 7)
    c = i
print(ans)
### BUGGY CODE ###

import bisect
n, q = (int(i) for i in input().split())
s = input()
l,r = [],[]
for i in range(q):
    tmp = [int(i) for i in input().split()]
    l.append(tmp[0]-1)
    r.append(tmp[1]-1)
# AC_index = []
# while 'AC' in s:
#     index = s.index('AC')
#     AC_index.append(index + len(AC_index) * 2)
#     if index < (len(s) - 1):
#         s = s[:index] + s[index + 2:]
#     else:
#         s = s[:index]

# for i in range(q):
#     left_index = bisect.bisect_left(AC_index, l[i])
#     right_index = bisect.bisect_right(AC_index, r[i])
#     if AC_index[right_index - 1] == r[i]:
#         right_index -= 1
        
#     print(right_index-left_index)
for i in range(q):
    tmp = s[l[i]:r[i] + 1]
    tmp = tmp.replace('AC', '00')
    print(tmp.count('0')//2)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
L,R = [], []
for i in range(Q):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

AC = [0] * N

for i in range(1,N):
    if S[i - 1] == 'A' and S[i] == 'C':
        AC[i] = AC[i - 1] + 1
    else:
        AC[i] = AC[i - 1]

for l, r in zip(L, R):
    print(AC[r-1]-AC[l-1])
### BUGGY CODE ###

n = int(input())
sl = list(input() for _ in range(n))

sl_s = sorted(list(set(sl)))

# if len(sl_s) == 1:
#     print(sl[0])
# else:
#     ans = []
#     count = 1
#     for s in sl_s:
#         if sl.count(s) == count and ans.count(s) == 0:
#             ans.append(s)
#         elif sl.count(s) > count and ans.count(s) == 0:
#             ans.clear()
#             ans.append(s)
#             count = sl.count(s)
#     print('\n'.join(ans))


dict = {}
for s in sl:
    if s in dict:
        dict[s] += 1
    else:
        dict[s] = 1

ans_ = [k for k, v in dict.items() if v == max(dict.values())]
ans = '\n'.join(sorted(ans_))
print(ans)


### FIXED CODE ###

from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

ans.sort()
print('\n'.join(ans))
### BUGGY CODE ###

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

N = int(input())
n = [int(input()) for i in range(N)]

def Is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
    return True

count = 0
for j in n:
    if Is_prime(j):
        count += 1

print (count)

### FIXED CODE ###

N = int(input())
n = [int(input()) for i in range(N)]

def Is_prime(n):
    if n == 2:
        return True
    if n == 1:
        return False
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
        i += 2
    return True

count = 0
for j in n:
    if Is_prime(j):
        count += 1

print (count)
### BUGGY CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

m = []

for i in range(M):
    x, y, z = map(int, input().split())
    if min(a) + min(b) <= z or max(a) + max(b) >= z:
        m.append([x, y, z])

m.sort(key = lambda x: x[2], reverse=True)


for j in m:
    if a[m[0][0]-1] + b[m[0][1]-1] - m[0][2] >= 0 and a[m[0][0]-1] + b[m[0][1]-1] - m[0][2] < min(a) + min(b):
        print(a[m[0][0]-1] + b[m[0][1]-1] - m[0][2])
        exit()

print(min(a) + min(b))

### FIXED CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

m = []
am = min(a)
bm = min(b)

for i in range(M):
    x, y, z = map(int, input().split())

    m.append(a[x-1] + b[y-1] - z )



if am + bm > min(m):
    print(min(m))
else:
    print(am + bm)
### BUGGY CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_b

N,K = [int(x) for x in input().split()]
h = list(map(int,input().split()))

dp = [0] * (N)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
tmp_dp = []
for i in range(2,N):
    for k in range(1,K+1):
        if k > i:
            break
        tmp_dp.append(dp[i-k] + abs(h[i]-h[i-k]))
#        print(dp[i-k], abs(h[i]-h[i-k]),tmp_dp)
#    print("tmp_dp",i,tmp_dp)
    dp[i] = min(tmp_dp)
    tmp_dp = []
print(dp[-1])

### FIXED CODE ###

# https://atcoder.jp/contests/dp/tasks/dp_b

def main():
    N, K = map(int, input().split())
    h = [int(x) for x in input().split()]

    dp = [0] * (N)
    dp[0] = 0

    # 参考：https://atcoder.jp/contests/dp/submissions/10181844
    for i in range(1, N):
        tmp = [dp[k] + abs(h[i] - h[k]) for k in range(max(0, i - K), i)]
        dp[i] = min(tmp)
    print(dp[-1])


if __name__ == '__main__':
    main()
### BUGGY CODE ###

# https://atcoder.jp/contests/abc123
# -*- coding: utf-8 -*-

n=int(input())
v = [int(input()) for i in range(5)]
city = [ n, 0, 0, 0, 0, 0]

counter = 0
while city[5] is not n:
    counter += 1

    for i in range(5)[::-1]:
        if city[i] >= v[i]:
            city[i+1] += v[i]
            city[i] -= v[i]
        else:
            city[i+1] += city[i]
            city[i] = 0

print(counter)

### FIXED CODE ###

# https://atcoder.jp/contests/abc123
# -*- coding: utf-8 -*-

n=int(input())
v = [int(input()) for i in range(5)]

minimum = min(v)
if n % minimum is 0:
    print((n // minimum)+4)
else:
    print((n // minimum)+5)
### BUGGY CODE ###

import numpy as np

N, M = [int(x) for x in input().split(' ')]

price = [int(x) for x in input().split(' ')]
  
for m in range(M):
  index = np.argmax(price)
  price[index] = price[index]/2.

price = [int(x) for x in price]
print(sum(price))

### FIXED CODE ###

from heapq import heappush, heappop
import numpy as np

N, M = [int(x) for x in input().split()]

price = [int(x) for x in input().split()] 
hq_price = []
for p in price:
  heappush(hq_price, -p)

for m in range(M):
  max_tmp = heappop(hq_price)
  heappush(hq_price, max_tmp/2.)

price = [int(-x) for x in hq_price]
print(sum(price))
### BUGGY CODE ###

S = input()
N = len(S)
count = 0
for i in range(N):
    for j in range(i,N):
        if int(S[i:j+1]) % 2019 == 0:
            count = count + 1
        else:
            continue
print(count)

### FIXED CODE ###

S = input()[::-1]
N = len(S)
l = [0]*2019
l[0] = 1
n = 0
d = 1

for i in range(N):
    n += int(S[i]) * d
    r = n % 2019
    l[r] += 1
    d = 10*d % 2019
    
out = 0    
for m in l:
    out += (m*(m-1))//2 
print(out)
### BUGGY CODE ###

K, S = map(int, input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
          if x+y+z == S:
            count += 1
print(count)

### FIXED CODE ###

K, S = map(int, input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        z = S - (x+y)
        if (z <= K) & (z >= 0):
            count += 1
print(count)
### BUGGY CODE ###

"""
A = 3, B = 4
[青青青][赤赤赤赤][青青青][赤赤赤]...

N = 8
[青青青赤赤赤赤青]

return 青 = 4
"""

def count_balls():
    # 入力
    N, A, B = map(int, input().split())
    # 例外
    if A+B == 0:
        return 0
    # N以下の[青*A][赤*B]の組み合わせの個数
    i = 1
    while True:
        if N >= (A+B) * i:
            i += 1
        else:
            break
    # N - ([青*A]+[赤*B])*i
    remainder = N - (A+B) * (i-1)
    if remainder <= A:
        return A * (i-1) + remainder
    else:
        return A * (i-1) + A

result = count_balls()
print(result)

### FIXED CODE ###

"""
A = 3, B = 4
[青青青][赤赤赤赤][青青青][赤赤赤]...

N = 8
[青青青赤赤赤赤青]

return 青 = 4
"""

def count_balls():
    # 入力
    N, A, B = map(int, input().split())
    # [青青青赤赤赤赤]の個数と余り
    comb_count = N // (A + B)
    remainder = N % (A + B)
    # 集計
    if remainder <= A:
        return A * comb_count + remainder
    else:
        return A * comb_count + A

result = count_balls()
print(result)
### BUGGY CODE ###

import bisect

n = int(input())
ans_head=[-1]
for i in range(n):
  a=int(input())
  if min(ans_head)>=a:
    ans_head=[a]+ans_head
  else:
    insert_index = bisect.bisect_left(ans_head,a)
    ans_head[insert_index-1]=a

  #print(ans_head)
print(len(ans_head))


### FIXED CODE ###

import bisect
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
Ans=[A[-1]]
for i in reversed(range(n-1)):
  a=A[i]
  if a>=Ans[-1]:
    Ans.append(a)
  else:

    Ans[bisect.bisect_right(Ans,a)]=a

print(len(Ans))
### BUGGY CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

count = 0
for i in range(N):
    b_idx = bisect.bisect_right(B, A[i])
    for j in range(b_idx, N):
        c_idx = bisect.bisect_right(C, B[j])
        count += N - c_idx

print(count)

### FIXED CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()
BtoC = [0 for i in range(N+1)]
for i in range(N-1, -1, -1):
    c_idx = bisect.bisect_right(C, B[i])
    BtoC[i] = BtoC[i+1] + (N - c_idx)
count = 0
for i in range(N):
    b_idx = bisect.bisect_right(B, A[i])
    count += BtoC[b_idx]


print(count)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
calc = 0
for i in range(n):
    for j in range(i+1, n):
        calc += (a[i] * a[j]) % 1000000007
calc %= 1000000007
print(calc)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
calc = 0
for i in range(n):
    sum_a -= a[i]
    calc += ((sum_a % 1000000007) * a[i]) % 1000000007
calc %= 1000000007
print(calc)
### BUGGY CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
for i in range(1, n):
    while True:
        if a[i] + a[i-1] > x:
            a[i] -= 1
            cnt += 1
        else:
            break
print(cnt)


### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
for i in range(1, n):
    while True:
        if a[i] + a[i-1] > x:
            if a[i] != 0:
                t = min((a[i] + a[i-1] - x), a[i])
                a[i] -= t
                cnt += t
            else:
                t = min((a[i] + a[i-1] - x), a[i-1])
                a[i-1] -= t
                cnt += t
        else:
            break
print(cnt)
### BUGGY CODE ###

import itertools
import math
n = int(input())

for i in range(n):
    cnt = 0
    for x,y,z in itertools.product(range(1,int(math.sqrt(n))),repeat=3):
        if x**2 + y**2 + z**2 + x*y + y*z + z*x == i+1:
            cnt += 1
    print(cnt)


### FIXED CODE ###

n = int(input())
ans = [0] * n

for x in range(1,int(n**0.5)):
    for y in range(1,int(n**0.5)):
        for z in range(1,int(n**0.5)):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a <= n:
                ans[a-1] += 1
[print(x) for x in ans]
### BUGGY CODE ###

from collections import deque
n = int(input())
Ps = list(map(int, input().split()))

def hw(p):
    h,w = divmod(p,n)
    return h,w

def toP(h,w):
    return h * n + w

fs = [[0]*n for i in range(n)]
## フロアフィールドを作る
for i in range(n):
    x = min(i,n-1-i)
    for j in range(n):
        y = min(j,n-1-j)
        fs[i][j] = min(x,y)

ans = 0
mvs = [(1,0),(-1,0),(0,1),(0,-1)]
# occupied = [[1]*n for i in range(n)]
occupied = [1] * (n**2)
for p in Ps:
    p -= 1
    h,w = hw(p) 
    ans += fs[h][w]
    occupied[p] = 0
    q = deque([])
    q.append(p)
    while len(q) > 0: #pを起点にBFS
        p_ = q.popleft()
        h, w = hw(p_)
        dist = fs[h][w]
        for dh,dw in mvs:
            if 0<=h+dh<n and 0<=w+dw<n:
                # ある位置h,wが
                # occupiedなら、隣接マス+1で到達
                # vacantなら、隣接マス+0で到達
                if dist+occupied[p_] < fs[h+dh][w+dw]:
                    q.append(toP(h+dh,w+dw))
                    fs[h+dh][w+dw] = dist + occupied[p_]                
print(ans)
    
    

### FIXED CODE ###

from collections import deque
n = int(input())
Ps = list(map(int, input().split()))
Ps = [p-1 for p in Ps]
fs = [0] * (n**2)

## フロアフィールドを作る
for x in range(n**2):
    i,j = divmod(x,n)
    x = min(i,n-1-i)
    y = min(j,n-1-j)
    fs[i*n+j] = min(x,y)

ans = 0
mvs = [1, -1, n, -n]
occupied = [1] * (n**2)
for p in Ps:
    ans += fs[p]
    occupied[p] = 0
    q = deque([])
    q.append(p)
    while len(q) > 0: #pを起点にBFS
        p_ = q.popleft()
        dist = fs[p_]
        for mv in mvs:
            if 0 <= p_+mv < n**2:
                p_next = p_ + mv
                # ある位置h,wが
                # occupiedなら、隣接マス+1で到達
                # vacantなら、隣接マス+0で到達
                if dist+occupied[p_] < fs[p_next]:
                    q.append(p_next)
                    fs[p_next] = dist + occupied[p_]

print(ans)
### BUGGY CODE ###

import math
def sieve_of_erastosthenes(num):
    input_list = [0 if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else 1 for i in range(num)]
    input_list[0] = input_list[1] = 0
    input_list[2] = input_list[3] = input_list[5] = 1
    sqrt = math.sqrt(num)
    for serial in range(3, num, 2):
        if serial >= sqrt:
            return input_list
        for s in range(serial ** 2, num, serial): 
            input_list[s] = 0

q = int(input())
l_list = []
r_list = []
for i in range(q):
    l, r = map(int, input().split())
    l_list.append(l)
    r_list.append(r)
minval = min(l_list)
maxval = max(r_list)
sieve = sieve_of_erastosthenes(maxval+1)
def is_prime(x):
    # print(x)
    return sieve[x]
def is_like2017(x):
    return is_prime(x) * is_prime(int((x+1)/2))
like2017 = list(range(maxval+1))
for i in like2017:
    like2017[i] = is_like2017(i)
for l, r in zip(l_list, r_list):
    print(sum(like2017[l:r+1]))


### FIXED CODE ###

import math
def sieve_of_erastosthenes(num):
    input_list = [0 if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else 1 for i in range(num)]
    input_list[0] = input_list[1] = 0
    input_list[2] = input_list[3] = input_list[5] = 1
    sqrt = math.sqrt(num)
    for serial in range(3, num, 2):
        if serial >= sqrt:
            return input_list
        for s in range(serial ** 2, num, serial): 
            input_list[s] = 0
q = int(input())
l_list = []
r_list = []
for i in range(q):
    l, r = map(int, input().split())
    l_list.append(l)
    r_list.append(r)
minval = min(l_list)
maxval = max(r_list)
sieve = sieve_of_erastosthenes(maxval+1)
def is_prime(x):
    return sieve[x]
def is_like2017(x):
    return is_prime(x) * is_prime(int((x+1)/2))
like2017 = list(range(maxval+1))
for i in like2017:
    like2017[i] = is_like2017(i)

integral = like2017
for i in range(1, len(integral)):
    integral[i] = integral[i] + integral[i-1]
for l, r in zip(l_list, r_list):
    print(integral[r] - integral[l-1])
### BUGGY CODE ###

def main():
    A,B,K = map(int,input().split())
    for i in range(0,K):
        if A > 0:
           A = A - 1
        elif B > 0:
            B = B - 1
    print(A,B)
 
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    A,B,K = map(int,input().split())
    if A+B < K:
        print(0,0)
    else:
        if A < K:
            print(0, A+B-K)
        else:
            print(A-K, B)
 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

"""
参考：https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
・ミニマックス法
・メモ化再帰
・先手と後手にそれぞれのメモを作る
"""

import sys
from collections import defaultdict

# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10 ** 9)
 
N, Z, W = map(int, input().split())
aN = list(map(int, input().split()))

# 先手番用メモ[残り山札数][相手のスコア] = このルートでのmax
# 後手番用メモ[残り山札数][相手のスコア] = このルートでのmin
memo1 = [defaultdict(int) for _ in range(N+1)]
memo2 = [defaultdict(int) for _ in range(N+1)]

def dfs(turn, rest, x, y):
    if rest == 0:
        return abs(x - y)
    # 先手番
    if turn % 2 == 0:
        # 既に見た局面ならメモの内容を返す
        if memo1[rest][y]: 
            return memo1[rest][y]
        mx = -1
        for i in range(N-rest, N):
            x = aN[i]
            idx = i+1
            mx = max(dfs(turn+1, N-idx, x, y), mx)
        # ここより深い所を探し終わったので結果をメモする
        memo1[rest][y] = mx
        return mx
    # 後手番
    else:
        if memo2[rest][x]: 
            return memo2[rest][x]
        mn = float('inf')
        for i in range(N-rest, N):
            y = aN[i]
            idx = i+1
            mn = min(dfs(turn+1, N-idx, x, y), mn)
        memo2[rest][x] = mn
        return mn

print(dfs(0, N, Z, W))


### FIXED CODE ###

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

"""
参考：https://kimiyuki.net/writeup/algo/atcoder/arc-085-d/
・ミニマックス法
・メモ化再帰
・先手と後手にそれぞれのメモを作る
"""

import sys
from collections import defaultdict

# 再帰呼び出しの回数制限(デフォルト1000)
sys.setrecursionlimit(10 ** 9)
 
N, Z, W = map(int, input().split())
aN = list(map(int, input().split()))

# 先手番用メモ[残り山札数][相手のスコア] = このルートでのmax
# 後手番用メモ[残り山札数][相手のスコア] = このルートでのmin
memo1 = [defaultdict(int) for _ in range(N+1)]
memo2 = [defaultdict(int) for _ in range(N+1)]

def dfs(turn, rest, x, y):
    if rest == 0:
        return abs(x - y)
    # 先手番
    if turn % 2 == 0:
        # 既に見た局面ならメモの内容を返す
        if memo1[rest][y]: 
            return memo1[rest][y]
        mx = -1
        for i in range(N-rest, N):
            x = aN[i]
            idx = i+1
            mx = max(dfs(turn+1, N-idx, x, y), mx)
        # ここより深い所を探し終わったので結果をメモする
        memo1[rest][y] = mx
        return mx
    # 後手番
    else:
        if memo2[rest][x]: 
            return memo2[rest][x]
        mn = float('inf')
        for i in range(N-rest, N):
            y = aN[i]
            idx = i+1
            mn = min(dfs(turn+1, N-idx, x, y), mn)
        memo2[rest][x] = mn
        return mn

print(dfs(0, N, Z, W))