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

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np
from numpy.fft import rfft, irfft
MOD = 10 ** 9 + 7
K = [int(x) for x in input().rstrip()]
L = len(K)
D = int(input())

fft_len = 1
while fft_len < 2*D:
    fft_len *= 2

def fft_convolve(A,B):
    return np.round(irfft(rfft(A,fft_len) * rfft(B,fft_len))).astype(np.int64) % MOD

def convolve(A,B):
    M = 1 << 16
    mask = M - 1
    A1,A2 = A>>16, A&mask
    B1,B2 = B>>16, B&mask
    X,Y,Z = [fft_convolve(P,Q) for P,Q in [[A1,B1],[A1-A2,B1-B2],[A2,B2]]]
    X = (X << 32) + ((X-Y+Z) << 16) + Z
    X[:D] += X[D:D+D]
    return X[:D] % MOD

# d桁以下、自由に使った場合の余りごとの個数。0を含めて数えておく
ones = [np.zeros(D,dtype=np.int64)]
for x in range(10):
    arr = ones[-1].copy()
    arr[x%D] += 1
    ones.append(arr)
full = []
dp = np.zeros(D, dtype=np.int64)
dp[0] = 1
full.append(dp)
for d in range(1,L):
    dp = convolve(dp,ones[10])
    full.append(dp)

dist = np.zeros(D+D, dtype=np.int64)

cumsum = 0
for i,x in enumerate(K):
    arr = convolve(ones[x], full[L-i-1])
    dist[cumsum:cumsum+D] += arr
    cumsum += x
    cumsum %= D
dist[cumsum] += 1 # 全部そのまま使う

answer = dist[::D].sum() - 1 # 0除外
answer %= MOD
print(answer)



### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np
from numpy.fft import rfft, irfft
MOD = 10 ** 9 + 7
K = [int(x) for x in input().rstrip()]
L = len(K)
D = int(input())

def convolve_ones(x,arr):
    # 0,1,...,x-1
    after = np.zeros(D+x,dtype=np.int64)
    for i in range(x):
        after[i:i+D] += arr
    for i in range(D,D+x):
        after[i%D]+= after[i]
    return after[:D] % MOD

# d桁以下、自由に使った場合の余りごとの個数。0を含めて数えておく
full = [np.zeros(D, dtype=np.int64)]
full[0][0] = 1
for d in range(1,L):
    full.append(convolve_ones(10,full[-1]))

dist = np.zeros(D+D, dtype=np.int64)

cumsum = 0
for i,x in enumerate(K):
    arr = convolve_ones(x, full[L-i-1])
    dist[cumsum:cumsum+D] += arr
    cumsum += x
    cumsum %= D
dist[cumsum] += 1 # 全部そのまま使う

answer = dist[::D].sum() - 1 # 0除外
answer %= MOD
print(answer)
### BUGGY CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))

    dp = [[0] * (N + 1) for _ in range(N + 1)]
    for i in range(1, N + 1):
        if (N - i) % 2 == 0:
            for l in range(N + 1 - i):
                r = l + i
                t0 = dp[l + 1][r] + a[l]
                t1 = dp[l][r - 1] + a[r - 1]
                if t0 > t1:
                    dp[l][r] = t0
                else:
                    dp[l][r] = t1
        else:
            for l in range(N + 1 - i):
                r = l + i
                t0 = dp[l + 1][r] - a[l]
                t1 = dp[l][r - 1] - a[r - 1]
                if t0 < t1:
                    dp[l][r] = t0
                else:
                    dp[l][r] = t1
    print(dp[0][N])
main()


### FIXED CODE ###

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

dp = [[0] * (N + 1) for _ in range(N + 1)]
for l in range(1, N + 1):
  for i in range(N + 1 - l):
    j = i + l
    if (N - l) % 2 == 0:
      dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])
    else:
      dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])
print(dp[0][N])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    ans = 2019
    for i in range(L, R):
        for k in range(i + 1, R + 1):
            ans = min(ans, (i * k) % 2019)
            if ans == 0:
                break
    print(ans)



if __name__ == '__main__':
    L, R = map(int, input().rstrip().split())
    print_ans(L, R)


### FIXED CODE ###

import sys
input = sys.stdin.readline
def print_ans(L, R):
    """Test Case
    >>> print_ans(2020, 2040)
    2
    >>> print_ans(4, 5)
    20
    """
    tmp = R - L
    if tmp > 2019:
        print("0")
    else:
        L = L % 2019
        R = L + tmp
        ans = 2019
        flg = False
        for i in range(L, R):
            for k in range(i + 1, R + 1):
                ans = min(ans, (i * k) % 2019)
                if ans == 0:
                    flg = True
                    break
            if flg :
                break
        print(ans)



if __name__ == '__main__':
    L, R = map(int, input().rstrip().split())
    print_ans(L, R)
### BUGGY CODE ###

n=int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pri_fact=prime_factorize(n)

def prod(x):
    kotae=1
    for i in x:
        kotae*=i
    return kotae

ans=10**120
import itertools

for r in range(len(pri_fact)):
# (1,2,3),(1,2,4),---,(7,8,9)
    for seq in itertools.combinations(range(len(pri_fact)),r):
        a=[1]
        b=[1]
        for i in range(len(pri_fact)):
            if i in seq:
                a.append(pri_fact[i])
            else:
                b.append(pri_fact[i])
        ans=min(prod(a)+prod(b)-2,ans)
print(ans)

### FIXED CODE ###

n=int(input())

ans=10**12
d=2
while d<=n**(1/2):
    if n%d==0:
        ans=min(ans,d+n//d-2)
    d+=1
if ans==10**12:
    print(n-1)
    exit()
print(ans)
### BUGGY CODE ###

N = int(input())
lis = list(map(int,input().split()))
cnt = 0
for i in range(1,N+1):
        tmp_lis = lis[0:i]
        tmp_lis.sort()
        if lis[i-1] == tmp_lis[0]:
                cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
lis = list(map(int,input().split()))
cnt = 1
small = lis[0]
for i in range(2,N+1):
        if lis[i-1] <= small:
                cnt += 1
                small = lis[i-1]
print(cnt)
### BUGGY CODE ###

N, A, B = [int(i) for i in input().strip().split()]
res = 0
cnt = 0
AorB = "A"
while True:
  if AorB == "A":
    if cnt + A < N:
      res += A
      cnt += A
      AorB = "B"
    else:
      res += (N - cnt)
      break
  else:
    cnt += B
    AorB = "A"
    if cnt >= N:
      break

print(res)


### FIXED CODE ###

N, A, B = [int(i) for i in input().strip().split()]
q, r = divmod(N, A+B)
if r <= A:
  print(A*q + r)
else:
  print(A*q + A)
### BUGGY CODE ###

def mpw(n,m):
    ret=1
    while m>0:
        if m&1:
            ret*=n
            ret%=M
        n*=n
        n%=M;
        m>>=1
    return ret;

L,A,B,M=map(int,input().split())
ans=0
d=0
for k in range(18,0,-1):
    l=max((10**(k-1)-A+B-1)//B,0)
    r=min((10**k-A-1)//B,L-1)
    if l<=r:
        ans+=mpw(10,d)*((B*10**k*(10**((r-l)*k)-1)//(10**k-1)+(A+B*l)*10**((r-l+1)*k))-(A+B*r))//(10**k-1)
        ans%=M
        d+=(r-l+1)*k
#    print(k,l,r)
print(ans)


### FIXED CODE ###

def mpw(n,m):
    ret=1
    while m>0:
        if m&1:
            ret*=n
            ret%=M
        n*=n
        n%=M;
        m>>=1
    return ret;
def pw(n,m):
    ret=1
    while m>0:
        if m&1:
            ret*=n
        n*=n
        m>>=1
    return ret;
def delta(i,j):
    if i==j:
        return 1
    return 0
def mtxmpw(A,m):
    ret=[[delta(i,j) for i in range(len(A))] for j in range(len(A))]
    while m>0:
        if m&1:
            ret=mul(ret,A)
        A=mul(A,A)
        m>>=1
    return ret
def mul(A,B):
    ret=[[0 for i in range(len(B[0]))] for j in range(len(A))]
    for i in range(len(A)):
        for j in range(len(B[0])):
            for k in range(len(B)):
                ret[i][j]+=A[i][k]*B[k][j]
                ret[i][j]%=M
    return ret

L,A,B,M=map(int,input().split())
ans=0
d=0
for k in range(18,0,-1):
    l=max((pw(10,(k-1))-A+B-1)//B,0)
    r=min((pw(10,k)-A-1)//B,L-1)
    if l<=r:
        MT=[[1,mpw(10,k),0],[0,mpw(10,k),(M-B*mpw(10,k)%M)%M],[0,0,mpw(10,k)]]
        v=[[(A+B*r)%M],[(A+B*(r-1)%M+M)%M],[1]]
        u=mul(mtxmpw(MT,r-l),v)
        ans+=mpw(10,d)*u[0][0]%M;
        ans%=M;
        d+=(r-l+1)*k
print(ans)
### BUGGY CODE ###

(n, k), p, c = [[*map(int, i.split())] for i in open(0)]
visit = [0] * n
visit[0] = 1
loop = [0] * n
count = a = 0
while True:
    a = p[a] - 1
    if visit[a]:
        if loop[a]:
            break
        count += c[a]
        loop[a] = 1
    visit[a] = 1

ln = sum(loop)


def solve(x, t):
    ans = c[p[x] - 1]
    l = True
    sub = 0
    while True:
        if loop[x] and l:
            if count > 0 and t > ln:
                sub += (t // ln - 1) * count
                t -= (t//ln-1)*ln
            l = False
        if t < 1:
            ans = max(sub, ans)
            return ans
        x = p[x] - 1
        sub += c[x]
        t -= 1
        ans = max(sub, ans)


print(max(solve(i, k) for i in range(n)))


### FIXED CODE ###

(n, k), p, c = [[*map(int, i.split())] for i in open(0)]

def solve(x, t):
    visit = [0] * n
    visit[x] = 1
    loop = [0] * n
    count = 0
    ans = c[p[x] - 1]
    l = True
    sub = 0
    while True:
        x = p[x] - 1
        if l:
            if visit[x]:
                if loop[x]:
                    ln = sum(loop)
                    if t > l:
                        sub += (t//ln -1)*count*(count>0)
                        t %= ln
                        t += ln
                    l = False
                count += c[x]
                loop[x] = 1
            visit[x] = 1
        sub += c[x]
        t -= 1
        ans = max(sub, ans)
        if t < 1:
            return ans


print(max(solve(i, k) for i in range(n)))
### BUGGY CODE ###

n = int(input())
s = [str(input()) for i in range(n)]
ss = [sorted(i) for i in s]
ans = 0 
for i in range(n):
    for j in range(i+1,n):
        b = 0
        for k in range(10):
            if ss[i][k] != ss[j][k]:
                b = 1
                break
        if b == 0:
            ans += 1
                
print(ans)

### FIXED CODE ###

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

ss = [''.join(sorted(i)) for i in s]
ans = 0
key_dict = {}

for i in ss:
    if i in key_dict:
        key_dict[i] += 1
    else:
        key_dict[i] = 1

a = key_dict.values()
al = [i * (i-1) / 2 if i > 1 else 0 for i in a]

ans = int(sum(al))
print(ans)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

a = LIST()

for i in range(1, N):
	if abs(a[0]//2-a[i]//2) % gcd(a[0], a[i]) != 0:
		print(0)
		sys.exit()
tmp = 1
for x in a:
	tmp = x*tmp//gcd(x, tmp)
tmp = tmp//2
print((M-tmp)//(tmp*2)+1)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

a = LIST()

a = [x//2 for x in a]
if a[0] % 2 == 0:  # 偶数の時
	for x in a:
		if x % 2 == 1:
			print(0)
			sys.exit(0)
	for x in a:
		if a[0] != x and abs(a[0]-x)%gcd(2*a[0], 2*x) != 0:
			print(0)
			sys.exit()

	tmp = 1
	for x in a:
		tmp = x*tmp//gcd(x, tmp)
	print((M-tmp)//(tmp*2)+1)


else:
	for x in a:
		if x % 2 == 0:
			print(0)
			sys.exit(0)
	tmp = 1
	for x in a:  # 奇数の時
		tmp = x*tmp//gcd(x, tmp)
	print((M-tmp)//(tmp*2)+1)
### BUGGY CODE ###

import math
s = list(input())
s = list(map(int, s))
s_ori = s.copy()
s_len = len(s)

s_new=[]
for _ in range(200000):
    count=0
    s_len = len(s)
    if s_len ==1:
        #print('a')
        break
    for i in range(1,s_len):
        if count %2==1:
            count +=1
            if i +1==s_len:
                s_new.append(s[-1])
            continue
        if s[i] is not s[i-1]:
            count +=1
        else:
            s_new.append(s[i-1])
            if i +1==s_len:
                s_new.append(s[-1])
    #print(s_new)
    if s==s_new:
        s = s_new
        break
    s = s_new
    s_new=[]
    
#print(s_ori)    
#print(s)
print(math.floor((len(s_ori)-len(s))/2)*2)
            

### FIXED CODE ###

import math
from collections import Counter
s = list(input())
s = list(map(int, s))
dict_s = Counter(s)
#print(dict_s)
print((min(dict_s[0], dict_s[1]))*2)
### BUGGY CODE ###

ans=0
N,M=[int(i) for i in input().split()]
A=input().split()
for i in range(N):
    a=0
    for j in A[i:N+1]:
        a+=int(j)%M
        if a%M==0:
            ans+=1
print(ans)



### FIXED CODE ###

N,M = [int(i) for i in input().split()]
A = [int(j) for j in input().split()]
B = [0,A[0]]
for i in range(1,len(A)):
    B+=[A[i]+B[i]]
C = {}
X = 0
for j in B:
    if str(j%M) in C:
        X+=C[str(j%M)]
        C[str(j%M)]+=1
    else:
        C.update({str(j%M):1})
print(X)
### BUGGY CODE ###

import sys

x = int(input())

total = 0

for a in range(0,100):
    for b in range(0,100):
        for c in range(0,100):
            for d in range(0,100):
                for e in range(0,100):
                    for f in range(0,100):
                        total = 100*a + 101*b + 102*c + 103*d + 104*e +105*f
                        if x == total:
                            print(1)
                            sys.exit()

print(0)



### FIXED CODE ###

x = int(input())

# 商品の合計がi個の場合の可能なxの範囲
# i=1   100-105
# i=2   200-210
# i=3   300-315
# i=4   400-420
# i=5   500-525
# i=6   600-630
# i=7   700-735
# i=8   800-840
# i=9   900-945
# ...
# i=19 1900-1995
# i=20以降は常に1

i = x // 100

if 100*i <= x <= 105*i:
  print(1)
else:
  print(0)
### BUGGY CODE ###

N = int(input())
*H, = map(int, input().split())
*A, = map(int, input().split())

N0 = 2**(N).bit_length()
INF = 2**31-1
data = [-INF]*(2*N0)
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])
def query(l, r):
    L = l + N0; R = r + N0
    yield -INF
    while L < R:
        if R & 1:
            R -= 1
            yield data[R-1]

        if L & 1:
            yield data[L-1]
            L += 1
        L >>= 1; R >>= 1

*I, = range(N)
I.sort(key=lambda x: (H[x], x))
def solve():
    update(0, 0)
    yield 0
    for i in I:
        v = max(query(0, i+1)) + A[i]
        yield v
        update(i+1, v)
print(max(solve()))

### FIXED CODE ###

N = int(input())
*H, = map(int, input().split())
*A, = map(int, input().split())

N0 = 2**(N).bit_length()
INF = 2**31-1
data = [-INF]*(2*N0)
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])
def query(l, r):
    L = l + N0; R = r + N0
    s = -INF
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R-1])

        if L & 1:
            s = max(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

*I, = range(N)
I.sort(key=lambda x: (H[x], x))
ans = 0
update(0, 0)
for i in I:
    v = query(0, i+1) + A[i]
    ans = max(ans, v)
    update(i+1, v)
print(ans)
### BUGGY CODE ###

import sys

import numpy as np

readline = sys.stdin.buffer.readline


def main():
    N = int(readline())
    A = [0] + list(map(int, readline().split()))
    A = np.array(A)
    C = np.zeros(N + 1, dtype=np.int32)

    for i in range(N):
        j = N - i
        cnt = np.sum(C[A % j == 0])

        if cnt % 2 == 0:
            if A[j] == 0:
                C[j] = 0
            else:
                C[j] = 1
        else:
            if A[i] == 0:
                C[j] = 1
            else:
                C[j] = 0

    ans = np.sum(C)
    print(ans)
    if ans != 0:
        for i, c in enumerate(C):
            if c == 1:
                print(i)


main()


### FIXED CODE ###

import sys

import numpy as np

readline = sys.stdin.buffer.readline


def main():
    N = int(readline())
    A = [0] + list(map(int, readline().split()))
    A = np.array(A)
    C = np.zeros(N + 1, dtype=np.int32)

    if A[-1] == 1:
        C[-1] == 1

    for j in range(N, 0, -1):
        cnt = np.count_nonzero(C[j::j])
        C[j] = (cnt % 2) ^ A[j]

    ans = np.sum(C)
    print(ans)
    if ans != 0:
        B = np.arange(N + 1)
        li = B[C == 1]
        print(*li, sep='\n')


main()
### BUGGY CODE ###

R,G,B,N = map(int,input().split())

ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)

### FIXED CODE ###

R,G,B,N = map(int,input().split())

ans = 0
for r in range(N+1):
    for g in range(N+1):
        tmp = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

A,B=map(int,input().split())
for x in range(max(A,B),A*B+1):
    if x%A==0 and x%B==0:
        print(x)
        exit()

### FIXED CODE ###

A,B=map(int,input().split())
for x in range(max(A,B),A*B+1,max(A,B)):
    if x%A==0:
        if x%B==0:
            print(x)
            exit()
### BUGGY CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[25]:


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


# In[26]:


for x in range(A,B+1):
    if x < A+K or x > B-K:
        print(x)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[41]:


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


# In[42]:


ans = []
for x in range(A, min(A+K,B+1)):
    ans.append(x)
for x in range(max(A,B-K+1), B+1):
    ans.append(x)
for x in sorted(list(set(ans))):
    print(x)


# In[ ]:
### BUGGY CODE ###

import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True)
F.sort()

l = -1
r = A[0] * F[-1]
while l+1 < r:
    c = (l + r) // 2
    practice = 0
    for i in range(N):
        practice += max(math.ceil(A[i] - c / F[i]), 0)
    if practice <= K:
        r = c
    else:
        l = c
print(r)

### FIXED CODE ###

import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True)
F.sort()

l = -1
r = A[0] * F[-1]
while l+1 < r:
    c = (l + r) // 2
    practice = 0
    for i in range(N):
        practice += max(math.ceil(A[i] - c / F[i]), 0)
    if practice <= K:
        r = c
    else:
        l = c
print(r)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import heapq
from operator import itemgetter
from bisect import bisect_right
N, Q = map(int, input().split())
Stop = []
for i in range(N):
    S, T, X = map(int, input().split())
    Stop.append([S - X, X, 0, i])
    Stop.append([T - X, X, 1, i])
Stop.sort(key=itemgetter(0))
q = []
notClosed = [False]*N
A = [(-1, -1)]
for time, pos, lr, idx in Stop:
    if lr==0:
        heapq.heappush(q, (pos, time, idx))
    else:
        notClosed[idx] = True
        while len(q)>0 and notClosed[q[0][2]]:
            aaa = heapq.heappop(q)[2]

    if len(q):
        A.append((time, q[0][0]))
    else:
        A.append((time, -1))
assert len(q)==0
A0 = list(map(itemgetter(0), A))
for _ in range(Q):
    D = int(input())
    idx = bisect_right(A0, D)

    print(A[idx-1][1])



### FIXED CODE ###

import sys
input = sys.stdin.readline
import heapq
from operator import itemgetter
from bisect import bisect_right
N, Q = map(int, input().split())
Stop = []
for i in range(N):
    S, T, X = map(int, input().split())
    Stop.append([S - X, X, 0, i])
    Stop.append([T - X, X, 1, i])
Stop.sort(key=itemgetter(0))
q = []
notClosed = [False]*N
A = [(-1, -1)]
for time, pos, lr, idx in Stop:
    if lr==0:
        heapq.heappush(q, (pos, idx))
    else:
        notClosed[idx] = True
        while len(q)>0 and notClosed[q[0][1]]:
            aaa = heapq.heappop(q)[1]

    if len(q):
        A.append((time, q[0][0]))
    else:
        A.append((time, -1))
A0 = list(map(itemgetter(0), A))
for _ in range(Q):
    D = int(input())
    idx = bisect_right(A0, D)

    print(A[idx-1][1])
### BUGGY CODE ###

x = input()
a = int(x.split()[0])
b = int(x.split()[1])
k = int(x.split()[2])

for i in range(k):
  if a > 0:
    a = a - 1
  elif b > 0:
    b = b - 1

print(str(a) + ' ' + str(b))

### FIXED CODE ###

x = input()
a = int(x.split()[0])
b = int(x.split()[1])
k = int(x.split()[2])
a_result = ''
b_result = ''

if k >= a:
  a_result = '0'
  k = k -a
else:
  a_result = str(a - k)
  k = 0

if k >= b:
  b_result = '0'
else:
  b_result = str(b - k)
  
print(a_result + ' ' + b_result)
### BUGGY CODE ###

R, G, B, N = [int(n) for n in input().split()]

count = 0
for r in range(N//R + 1):
    for g in range((N-r*R)//G + 1):
        if (N - (R * r + G * g)) % B == 0:
            b = (N - (R * r + G * g)) / B
            if  0 <= b <=  N//B:
                count += 1

print(count)

### FIXED CODE ###

R, G, B, N = [int(n) for n in input().split()]

count = 0
for r in range(N//R + 1):
    for g in range((N-r*R)//G + 1):
        b_ = N - (R * r + G * g) 
        if b_ % B == 0:
                count += 1

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

import math
import collections
import numpy as np

def combinations_count(n, r):
    if n <= 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

c = collections.Counter(A)
ans = 0
for k, v in c.items():
    if v > 1:
        ans = ans + combinations_count(v, 2)

for i in range(N):
    hoge = c[A[i]] - 1
    print(ans + combinations_count(hoge, 2) - combinations_count(hoge+1, 2))

### FIXED CODE ###

import math
import collections
import numpy as np

def combinations_count(n, r):
    if n <= 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

c = collections.Counter(A)
ans = 0
for v in c.values():
    if v > 1:
        ans += v*(v-1)//2

for i in range(N):
    v = c[A[i]]
    print(ans + (v-1)*(v-2)//2 - v*(v-1)//2)
### BUGGY CODE ###


def resolve():
    # 達成スコアを決める
    # 修行回数がK以下を達成できるスコアを二分探索
    def check(X):
        cnt = 0
        for i in range(N):
            a = X // F[i]
            if a < A[i]:  # 修行をしてスコアを最小化する
                cnt += A[i] - a
        return cnt <= K

    N, K = map(int, input().split())
    A = sorted(map(int, input().split()))
    F = sorted(map(int, input().split()), reverse=True)

    ok = 10 ** 12 # 最大スコア a: 10**6 * x:10**6
    ng = -1
    while ok - ng > 1:
        X = (ok + ng) // 2
        if check(X):
            ok = X
        else:
            ng = X

    print(ok)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###


def resolve():
    # 達成スコアを決める
    # 修行回数がK以下を達成できるスコアを二分探索
    def check(X):
        cnt = 0
        for i in range(N):
            a = X // F[i]
            if a < A[i]:  # 修行をしてスコアを最小化する
                cnt += A[i] - a
        return cnt <= K

    N, K = map(int, input().split())
    A = sorted(map(int, input().split()))
    F = sorted(map(int, input().split()), reverse=True)

    ok = 10 ** 12 # 最大スコア a: 10**6 * x:10**6
    ng = -1
    while ok - ng > 1:
        X = (ok + ng) // 2
        if check(X):
            ok = X
        else:
            ng = X

    print(ok)


if __name__ == "__main__":
    resolve()