Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
class BinaryIndexedTree:  # 0-index !!!
    """
    init(n):     要素数nを与えて0で初期化
    add(i, x):   i番目の値にxを追加 O(logN)
    sum(i):      区間[0,i)の和を返す O(logN)
    query(l, r): 区間[l,r)の和を返す O(logN)
    """

    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)  # 内部的には1-indexで扱う

    def add(self, i, x):  # 0-index
        i += 1  # 内部的には1-indexで扱う
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def set(self, i, x):
        now = self.query(i, i + 1)
        self.add(i, -now + x)

    def sum(self, i):  # 0-index  sum of [0,i)
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def query(self, l, r):  # 0-index  sum of [l,r)
        return self.sum(r) - self.sum(l)

# ---------------------- #

n, q = (int(x) for x in input().split())
queries = [tuple(int(x) for x in input().split()) for _ in range(q)]
ans = (n - 2)**2
t1 = [n] * (n + 1)
t2 = [n] * (n + 1)
h, w = n, n
for t, x in queries:
    if t == 1:
        tmp = t1[x]
        ans -= tmp - 2
        if x < w:
            w = x
            for i in range(h + 1):
                t2[i] = w
    else:
        tmp = t2[x]
        ans -= tmp - 2
        if x < h:
            h = x
            for i in range(w + 1):
                t1[i] = h
print(ans)


Fixed submission:
n, q = (int(x) for x in input().split())
queries = [tuple(int(x) for x in input().split()) for _ in range(q)]
ans = (n - 2)**2
t1 = [n] * (n + 1)
t2 = [n] * (n + 1)
h, w = n, n
for t, x in queries:
    if t == 1:
        if x < w:
            tmp = h
            for i in range(x, w+1):
                t1[i] = h
            w = x
        else:
            tmp = t1[x]
        ans -= tmp - 2
    else:
        if x < h:
            tmp = w
            for i in range(x, h+1):
                t2[i] = w
            h = x
        else:
            tmp = t2[x]
        ans -= tmp - 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, q = (int(x) for x in input().split())
queries = [tuple(int(x) for x in input().split()) for _ in range(q)]
ans = (n - 2)**2
t1 = [n] * (n + 1)
t2 = [n] * (n + 1)
h, w = n, n
for t, x in queries:
    if t == 1:
        tmp = t1[x]
        ans -= tmp - 2
        w = min(w, x)
        for i in range(h + 1):
            t2[i] = w
    else:
        tmp = t2[x]
        ans -= tmp - 2
        h = min(h, x)
        for i in range(w + 1):
            t1[i] = h
print(ans)


Fixed submission:
n, q = (int(x) for x in input().split())
queries = [tuple(int(x) for x in input().split()) for _ in range(q)]
ans = (n - 2)**2
t1 = [n] * (n + 1)
t2 = [n] * (n + 1)
h, w = n, n
for t, x in queries:
    if t == 1:
        if x < w:
            tmp = h
            for i in range(x, w+1):
                t1[i] = h
            w = x
        else:
            tmp = t1[x]
        ans -= tmp - 2
    else:
        if x < h:
            tmp = w
            for i in range(x, h+1):
                t2[i] = w
            h = x
        else:
            tmp = t2[x]
        ans -= tmp - 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

h, w, m = (int(x) for x in input().split())
H = [0] * h
W = [0] * w
HW = []
for _ in range(m):
    h_, w_ = (int(x) - 1 for x in input().split())
    HW.append((h_, w_))
    H[h_] += 1
    W[w_] += 1
hmax = max(H)
wmax = max(W)
hindex = []
windex = []
ans = hmax + wmax - 1

HW.sort(key=itemgetter(0, 1))
for y in range(h):
    if H[y] == hmax:
        hindex.append(y)
for x in range(w):
    if W[x] == wmax:
        windex.append(x)

HW_set = set(HW)
for y in hindex:
    for x in windex:
        if not (y, x) in HW_set:
            ans = hmax + wmax

print(ans)


Fixed submission:
from operator import itemgetter

h, w, m = (int(x) for x in input().split())
H = [0] * h
W = [0] * w
HW = []
for _ in range(m):
    h_, w_ = (int(x) - 1 for x in input().split())
    HW.append((h_, w_))
    H[h_] += 1
    W[w_] += 1
hmax = max(H)
wmax = max(W)
hindex = set()
windex = set()

HW.sort(key=itemgetter(0, 1))
for y in range(h):
    if H[y] == hmax:
        hindex.add(y)
for x in range(w):
    if W[x] == wmax:
        windex.add(x)

count = 0
for h, w in HW:
    if h in hindex and w in windex:
        count += 1

if count == len(hindex)*len(windex):
    ans = hmax + wmax - 1
else:
    ans = hmax + wmax

print(ans)

Buggy python submission (verdict: Runtime Error):
h, w, m = (int(x) for x in input().split())
S = [[0] * w for _ in range(h)]
H = [0] * h
W = [0] * w
for _ in range(m):
    h_, w_ = (int(x) - 1 for x in input().split())
    S[h_][w_] = 1
    H[h_] += 1
    W[w_] += 1

hmax = max(H)
wmax = max(W)
ans = hmax + wmax - 1
for y in range(h):
    if H[y] != hmax:
        continue
    for x in range(w):
        if W[x] != wmax:
            continue
        if S[y][x] == 0:
            ans = hmax + wmax

print(ans)

Fixed submission:
from operator import itemgetter

h, w, m = (int(x) for x in input().split())
H = [0] * h
W = [0] * w
HW = []
for _ in range(m):
    h_, w_ = (int(x) - 1 for x in input().split())
    HW.append((h_, w_))
    H[h_] += 1
    W[w_] += 1
hmax = max(H)
wmax = max(W)
hindex = set()
windex = set()

HW.sort(key=itemgetter(0, 1))
for y in range(h):
    if H[y] == hmax:
        hindex.add(y)
for x in range(w):
    if W[x] == wmax:
        windex.add(x)

count = 0
for h, w in HW:
    if h in hindex and w in windex:
        count += 1

if count == len(hindex)*len(windex):
    ans = hmax + wmax - 1
else:
    ans = hmax + wmax

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
L = list(int(x) for x in input().split())
if n <= 2:
    print(0)
    exit()
ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement, groupby
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
import sys  # def input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(10**6)

n = int(input())
L = list(int(x) for x in input().split())
if n <= 2:
    print(0)
    exit()
ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
L = list(int(x) for x in input().split())
if n <= 2:
    print(0)
    exit()
ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement, groupby
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
import sys  # def input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(10**6)

n = int(input())
L = list(int(x) for x in input().split())
if n <= 2:
    print(0)
    exit()
ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = (int(x) for x in input().split())
P = list(int(x) - 1 for x in input().split())
C = list(int(x) for x in input().split())

ans = -1e18
for si in range(n):
    S = [C[si]]
    x = P[si]
    while x != si:
        S.append(S[-1] + C[x])
        x = P[x]
    m = len(S)
    if k <= m:
        tmp = max(S[:k])
    else:
        loop = k // m
        r = k % m
        tmp = max(S[-1] * loop + max(S[:r]), S[-1] * (loop - 1) + max(S), max(S))
    ans = max(ans, tmp)
print(ans)

Fixed submission:
n, k = (int(x) for x in input().split())
P = list(int(x) - 1 for x in input().split())
C = list(int(x) for x in input().split())

ans = -1e18
for si in range(n):
    S = [C[si]]
    x = P[si]
    while x != si:
        S.append(S[-1] + C[x])
        x = P[x]
    m = len(S)
    if k <= m:
        tmp = max(S[:k])
    else:
        loop = k // m
        r = k % m
        tmp = max(S[-1] * (loop - 1) + max(S), max(S))
        if r != 0:
            tmp = max(tmp, S[-1] * loop + max(S[:r]))
    ans = max(ans, tmp)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce  # @lru_cache(None)
from operator import mul

n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())

point = reduce(mul, A[:k])
for i in range(n-k):
    tmp = point
    point //= A[i]
    point *= A[k+i]
    if tmp >= point:
        print("No")
    else:
        print("Yes")

Fixed submission:
n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())

for i in range(n - k):
    if A[i] >= A[k + i]:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
def popcount(n):
    return bin(n).count("1")

n = int(input())
x = input()
px = x.count("1")
a = px + 1
b = px - 1
tmpa = 0
tmpb = 0

A = [False] * n
for i in range(n):
    if x[i] == "1":
        tmpa += pow(2, n - i - 1, a)
        tmpa %= a
        tmpb += pow(2, n - i - 1, b)
        tmpb %= b

for i in range(1, n + 1):
    count = 1
    if x[i - 1] == "1":  # x[i] == "1" -> "0"
        y = tmpb - pow(2, n - i, b)
        y %= b
    else:  # x[i] == "0" -> "1"
        y = tmpa + pow(2, n - i, a)
        y %= a
    while y:
        y %= popcount(y)
        count += 1
    print(count)


Fixed submission:
def popcount(n):
    return bin(n).count("1")

n = int(input())
x = input()
px = x.count("1")
a = px + 1
b = px - 1
tmpa = 0
tmpb = 0

if b == 0:
    for i in range(n):
        if x[i] == "1":
            tmpa += pow(2, n - i - 1, a)
            tmpa %= a

    for i in range(1, n + 1):
        count = 1
        if x[i - 1] == "1":  # x[i] == "1" -> "0"
            print(0)
            continue

        else:  # x[i] == "0" -> "1"
            y = tmpa + pow(2, n - i, a)
            y %= a
        while y:
            y %= popcount(y)
            count += 1
        print(count)

else:
    for i in range(n):
        if x[i] == "1":
            tmpa += pow(2, n - i - 1, a)
            tmpa %= a
            tmpb += pow(2, n - i - 1, b)
            tmpb %= b

    for i in range(1, n + 1):
        count = 1
        if x[i - 1] == "1":  # x[i] == "1" -> "0"
            y = tmpb - pow(2, n - i, b)
            y %= b
        else:  # x[i] == "0" -> "1"
            y = tmpa + pow(2, n - i, a)
            y %= a
        while y:
            y %= popcount(y)
            count += 1
        print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
# ----------------------------------------------------------- #

n = int(input())
A = list(int(x) for x in input().split())
A.sort()
ans = 0
while A:
    tmp = A[0]
    if len(A) > 1:
        if tmp not in A[1:]:
            ans += 1
        A = [a for a in A[1:] if a % tmp != 0]
    else:
        ans += 1
        break
print(ans)


Fixed submission:
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
# ----------------------------------------------------------- #

n = int(input())
A = list(int(x) for x in input().split())
A.sort()
counter = Counter(A)
ans = 0
cache = set()
for a in A:
    if a in cache:
        continue
    tmp = a
    while tmp <= 10**6:
        cache.add(tmp)
        tmp += a
    if counter[a] == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
# ----------------------------------------------------------- #

n = int(input())
A = list(int(x) for x in input().split())
A.sort()
ans = 0
while A:
    tmp = A[0]
    if len(A) > 1:
        if tmp not in A[1:]:
            ans += 1
        A = [a for a in A[1:] if a % tmp != 0]
    else:
        ans += 1
        break
print(ans)

Fixed submission:
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
# ----------------------------------------------------------- #

n = int(input())
A = list(int(x) for x in input().split())
A.sort()
counter = Counter(A)
ans = 0
cache = set()
for a in A:
    if a in cache:
        continue
    tmp = a
    while tmp <= 10**6:
        cache.add(tmp)
        tmp += a
    if counter[a] == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return (int(x) for x in input().split())
def LI(): return list(Is())
def TI(): return tuple(Is())
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(S())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

t = S()
l = len(t)
ans = ""
for s in t:
    if s == '?':
        ans += 'D'
    else:
        ans += s
print(ans)


Fixed submission:
t = input()
l = len(t)
ans = ""
for s in t:
    if s == '?':
        ans += 'D'
    else:
        ans += s
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
P = list(int(x) - 1 for x in input().split())
A = [0] * (n**2)
remain = [1] * (n**2)

for i in range(n**2):
    A[i] = min(i % n, n - (i % n) - 1, i // n, n - (i // n) - 1)

ans = 0
for i in range(n**2):
    ans += A[P[i]]
    remain[P[i]] = 0
    que = deque([P[i]])
    visited = [False] * (n**2)
    while que:
        k = que.popleft()
        visited[k] = True
        if k % n != 0:  # left
            nk = k - 1
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if n - (k % n) - 1 != 0:  # right
            nk = k + 1
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if k // n != 0:  # up
            nk = k - n
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)
        if n - (k // n) - 1 != 0:  # down
            nk = k + n
            if not visited[nk]:
                A[nk] = min(A[nk], A[k] + remain[k])
                que.append(nk)

print(ans)


Fixed submission:
from collections import deque

n = int(input())
P = list(int(x) - 1 for x in input().split())
A = [0] * (n**2)
remain = [1] * (n**2)

for i in range(n**2):
    A[i] = min(i % n, n - (i % n) - 1, i // n, n - (i // n) - 1)

ans = 0
for i in range(n**2):
    ans += A[P[i]]
    remain[P[i]] = 0
    que = deque([P[i]])
    while que:
        k = que.popleft()
        if k % n != 0:  # left
            nk = k - 1
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if n - (k % n) - 1 != 0:  # right
            nk = k + 1
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if k // n != 0:  # up
            nk = k - n
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)
        if n - (k // n) - 1 != 0:  # down
            nk = k + n
            if A[nk] > A[k] + remain[k]:
                A[nk] = A[k] + remain[k]
                que.append(nk)

print(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b, c = (int(x) for x in input().split())
d = {"A": a, "B": b, "C": c}
S = [input() for _ in range(n)]
ANS = []

for i, s in enumerate(S):
    if d[s[0]] == 0 and d[s[1]] == 0:
        print("No")
        exit()
    else:
        if d[s[0]] > d[s[1]] or (d[s[0]] == d[s[1]] == 1 and i < n and s[1] in S[i + 1]):
            d[s[1]] += 1
            d[s[0]] -= 1
            ANS.append(s[1])
        else:
            d[s[0]] += 1
            d[s[1]] -= 1
            ANS.append(s[0])
print("Yes")
for ans in ANS:
    print(ans)


Fixed submission:
n, a, b, c = (int(x) for x in input().split())
d = {"A": a, "B": b, "C": c}
S = [input() for _ in range(n)]
ANS = []

for i, s in enumerate(S):
    if d[s[0]] == 0 and d[s[1]] == 0:
        print("No")
        exit()
    else:
        if d[s[0]] > d[s[1]] or (d[s[0]] == d[s[1]] == 1 and i < n - 1 and s[1] in S[i + 1]):
            d[s[1]] += 1
            d[s[0]] -= 1
            ANS.append(s[1])
        else:
            d[s[0]] += 1
            d[s[1]] -= 1
            ANS.append(s[0])
print("Yes")
for ans in ANS:
    print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s, t = Ss()
print(t+s)

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s, t = Ss()
print(t+s)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

a, b, k = Is()
if a > k:
    print("{} {}".format(a-k, b))
elif a + b > k:
    print(("0 {}".format(b-k+a)))
else:
    print("0 0")

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

a, b, k = Is()
if a > k:
    print("{} {}".format(a-k, b))
elif a + b > k:
    print(("0 {}".format(b-k+a)))
else:
    print("0 0")