Harryxun/stf_run huggingface dataset:
while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
            
            
    except EOFError:
        break

### FIXED CODE ###

while True:
    try:
        Map = []
        Base = []
        End = []
        for i in range(8):
            Map.append(list(map(str,input())))
        for i in range(8):
            if Base == []:
                
                for j in range(8):
                    if Map[i][j] == '1':
                        Base = [j,i]
                        break
            else:
                break
        for i in range(7,-1,-1):
            if End == []:
                for j in range(7,-1,-1):
                    if Map[i][j] == '1':
                        End = [j,i]
                        break
            else:
                break
        Yoko = End[0] - Base[0]
        Tate = End[1] - Base[1]
        if Tate == 1 and Yoko == 1:
            print("A")
        elif Yoko == 0 and Tate == 3:
            print("B")
        elif Tate == 0 and Yoko == 3:
            print("C")
        elif Yoko == -1 and Tate == 2:
            print("D")
        elif Yoko == 2 and Tate == 1:
            print("E")
        elif Yoko == 1 and Tate == 2:
            print("F")
        elif Tate == 1 and Yoko == 0:
            print("G")
        kara = input()
            
    except EOFError:
        break
from collections import deque
 
N, *AB = map(int, open(0).read().split())
B = AB[1::2]
 
E = [[] for _ in range(N)]
for a, b in zip(*[iter(AB)] * 2):
    E[a-1].append(b-1)

Q = deque([0])
C = [0] * (N)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += c == C[v]
        C[u] = c
        Q.append(u)

print(max(C)+1)
for b in B:
    print(C[b]+1)

### FIXED CODE ###

from collections import deque
 
N, *AB = map(int, open(0).read().split())
B = AB[1::2]
 
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
    E[a].append(b)

Q = deque([1])
C = [0] * (N + 1)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += 1 + (c + 1 == C[v])
        C[u] = c
        Q.append(u)

print(max(C))
for b in B:
    print(C[b])
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
  for c in '753':
  ret += dfs(s + c)
  return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく

### FIXED CODE ###

N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
  for c in '753':
    ret += dfs(s + c)
  return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく
if (int(input()) ==0:
    print(1)
else:
    print(0)

### FIXED CODE ###

if (int(input())) == 0:
    print(1)
else:
    print(0)
a = input()
b = input()
c = input()

l = []
m = []
n = []
t = a.pop()
k = 'a'
while len(l) >0 and len(m) > 0 and len(n) > 0:
    k = t
    if t == 'a':
        t = a.pop()
    elif t == 'b':
        t = b.pop()
    elif t == 'c':
        t = c.pop()
print(k)

### FIXED CODE ###

s={i:list(input()) for i in "abc"}
x="a"
while s[x]:
    x=s[x].pop(0)
print(x.upper())
def main():
    MOD = 10**9 + 7
    N = int(input())
    C = [int(input()) for _ in range(N)]
    # |---|
    # 1-2-1-2-2
    #   |---|
    latest_indices = [-1] * N
    next_indices = [-1] * N
    for cur_index, c in enumerate(C):
        latest_index = latest_indices[c]
        if latest_index >= 0:
            next_indices[latest_index] = cur_index
        latest_indices[c] = cur_index
    dp = [0] * N
    dp[0] = 1
    for cur_index in range(N - 1):
        next_index = next_indices[cur_index]
        if next_index >= 0 and next_index > cur_index + 1:
            dp[next_index] += dp[cur_index]
            dp[next_index] %= MOD
        dp[cur_index + 1] += dp[cur_index]
        dp[cur_index + 1] %= MOD
    print(dp[N - 1])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    MOD = 10**9 + 7
    N = int(input())
    C = [int(input()) - 1 for _ in range(N)]
    if N == 1:
        print(1)
        return
    # |---|
    # 1-2-1-2-2
    #   |---|
    latest_indices = [-1] * (2 * (10**5))
    next_indices = [-1] * N
    for cur_index, c in enumerate(C):
        latest_index = latest_indices[c]
        if latest_index >= 0:
            next_indices[latest_index] = cur_index
        latest_indices[c] = cur_index
    dp = [0] * N
    dp[0] = 1
    for cur_index in range(N - 1):
        next_index = next_indices[cur_index]
        if next_index > cur_index + 1:
            dp[next_index] += dp[cur_index]
            dp[next_index] %= MOD
        dp[cur_index + 1] += dp[cur_index]
        dp[cur_index + 1] %= MOD
    print(dp[N - 1])


if __name__ == '__main__':
    main()
from collections import defaultdict
from bisect import bisect_left
N, M = map(int, input().split())
A = []
B = defaultdict(list)
 
for i in range(M):
    p, y = map(int, input().split())
    A.append([p, y])
    B[p].append(y)
 
for key in B.keys():
    B[key].sort()

print(A,B)
for a in A:
    print(a[0],a[1],B[a[0]],bisect_left(B[a[0]],a[1]))
for a in A:
    print("%06d%06d" % (a[0], bisect_left(B[a[0]], a[1])+1))

### FIXED CODE ###

from collections import defaultdict
from bisect import bisect_left
N, M = map(int, input().split())
A = []
B = defaultdict(list)
 
for i in range(M):
    p, y = map(int, input().split())
    A.append([p, y])
    B[p].append(y)
 
for key in B.keys():
    B[key].sort()

# print(A,B)
# for a in A:
#     print(a[0],a[1],B[a[0]],bisect_left(B[a[0]],a[1]))
for a in A:
    print("%06d%06d" % (a[0], bisect_left(B[a[0]], a[1])+1))
N,M=map(int,input().split())
H=list(map(int,input().split()))
a,ans=[],[]
for _ in range(M):
    a.append(list(map(int,input().split())))
for i in range(M):
    if H[(a[i][0])-1]>H[(a[i][1])-1]:
        ans.add(a[i][0])
    elif H[(a[i][0])-1]<H[(a[i][1])-1]:
        ans.append(a[i][1])
print(len(ans))

### FIXED CODE ###

N,M=map(int,input().split())
H=list(map(int,input().split()))
t=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        t[b-1]=0
    elif H[a-1]<H[b-1]:
        t[a-1]=0
    else:
        t[a-1],t[b-1]=0,0
print(sum(t))
import math
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
ans = l[0]
for i in l:
    y = math.gcd(ans,i)
    ans = y
print(ans)

### FIXED CODE ###

import functools
def gcd( a, b ):
    while b != 0:
        a, b = b,a%b
    return a
n,x=map(int,input().split())
l = [abs(int(i) - x) for i in input().split()]
print(functools.reduce(gcd,l))
x,a,b=map(int,input().split())
ad=abs(x-a)
bd=abs(x-b)

if ad > bd:
    print("A")
elif ad < bd
    print("B")

### FIXED CODE ###

x,a,b=map(int,input().split())
ad=abs(x-a)
bd=abs(x-b)

if ad > bd:
    print("B")
elif ad < bd:
    print("A")
a = input().split()
n, k, s = a
k = int(k)
print(s.replace(s[k-1], s[k-1].lower()))

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
s = input()
if k == 1:
    print(s[0].lower() + s[1:])
else:
    print(s[0:k-1] + s[k-1].lower() + s[k:])
# -*- coding: utf-8 -*-
#ARC082C
import copy
import sys
import math

n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

hoge.sort()
hoge.append(-1)
a=0
b=0
c=1
maxhoge=0
for i in range(0,n):
	if(hoge[i]!=hoge[i+1]):
		if(i!=n-1):
			if(hoge[i+1]-hoge[i]==1):
				a=b
				b=c
				c=1
			elif(hoge[i+1]-hoge[i]==2):
				a=c
				b=0
				c=1
			else:
				a,b=0
				c=1
	else:
		c+=1
#	print("i:{} | {} {} {}".format(i,a,b,c))

	maxhoge=max(maxhoge,a+b+c)



#print(hoge)
print(maxhoge)



### FIXED CODE ###

# -*- coding: utf-8 -*-
#ARC082C
import copy
import sys
import math

n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

hoge.sort()
hoge.append(-1)
a=0
b=0
c=1
maxhoge=0
for i in range(0,n):
	if(hoge[i]!=hoge[i+1]):
		if(i!=n-1):
			if(hoge[i+1]-hoge[i]==1):
				a=b
				b=c
				c=1
			elif(hoge[i+1]-hoge[i]==2):
				a=c
				b=0
				c=1
			else:
				a=0
				b=0
				c=1
	else:
		c+=1
#	print("i:{} | {} {} {}".format(i,a,b,c))

	maxhoge=max(maxhoge,a+b+c)



#print(hoge)
print(maxhoge)
import math
a, b, k = [int(i) for i in input().split()]

gcd = math.gcd(a, b)
list_gcd = list()

for i in range(1, int(gcd/2) + 1):
    if gcd % i == 0:
        list_gcd.append(i)

list_gcd.append(gcd)
print(list_gcd[-k])


### FIXED CODE ###

a, b, k = [int(i) for i in input().split()]

x = max(a, b)
y = min(a, b)
gcd = 0
if x % y == 0:
    gcd = y
else:
    while x % y != 0:
        z = x % y
        x = y
        y = z
    else:
        gcd = z

list_gcd = list()

for i in range(1, int(gcd/2) + 1):
    if gcd % i == 0:
        list_gcd.append(i)

list_gcd.append(gcd)
print(list_gcd[-k])
def main():
    n,w = map(int, input().split())
    weight = []
    value = []
    for i in range(n):
        wi, vi = map(int, input().split())
        weight.append(wi)
        value.append(vi)
    
    def chmax(a, b):
        if a < b:
            a = b
        return a
    
    dp = [[0 for i in range(110)] for j in range(100100)]

    for i in range(n):
        for sum_w in range(w + 1):
            if sum_w - weight[i] >= 0:
                dp[i + 1][sum_w] = chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i])

            dp[i + 1][sum_w] = chmax(dp[i + 1][sum_w], dp[i][sum_w])

    print(dp[n][w])

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n,w = map(int, input().split())
    weight = []
    value = []
    for i in range(n):
        wi, vi = map(int, input().split())
        weight.append(wi)
        value.append(vi)
    
    def chmax(a, b):
        if a < b:
            a = b
        return a
    
    dp = [[0 for i in range(100100)] for j in range(110)]

    for i in range(n):
        for sum_w in range(w + 1):
            if sum_w - weight[i] >= 0:
                dp[i + 1][sum_w] = chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i])

            dp[i + 1][sum_w] = chmax(dp[i + 1][sum_w], dp[i][sum_w])
    
    print(dp[n][w])

if __name__ == "__main__":
    main()
N = input()
A = input()

print (N * N - A)

### FIXED CODE ###

N = int(input())
A = int(input())

print(N*N-A)
a,b,c,d = map(int, input().split())
#b>= x>= a and d>=x>=c

if (b<c )or (a < d):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x = int(input())
print("ACL" * x)
import numpy as np
n, m = map(int,input().split())
L = list(map(int,input().split()))
a = np.array(L)
y_count = m
while y_count > 0:
    memo = np.argmax(a)
    a[memo] //= 2
    y_count -= 1
print(np.sum(a))


### FIXED CODE ###

a,b = map(int,input().split())
li = [-int(x) for x in input().split()]
import heapq
heapq.heapify(li)
for i in range(b):
    c = heapq.heappop(li)
    heapq.heappush(li,c/2)
li = [int(x) for x in li]
print(-sum(li))
a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')


### FIXED CODE ###

import sys

a,b = [int(x) for x in sys.stdin.readline().split()]

if a+b <= 9:
	print(a+b)
else:
	print('error')
print("YNeos"[s:=input()==s[::-1]]::2)

### FIXED CODE ###

print("YNeos"[(s:=input())!=s[::-1]::2])
from sys import setrecursionlimit

def find(parent, i):
  t = parent[i]
  if t < 0:
    return i
  t = find(parent, t)
  parent[i] = t
  return t

def unite(parent, i, j):
  i = find(parent, i)
  j = find(parent, j)
  if i == j:
    return
  parent[j] += parent[i]
  parent[i] = j

setrecursionlimit(10**6)

N, M = map(int, input().split())
AB = [[int(c) - 1 for c in input().split()] for _ in range(M)]

parent = [-1]*N
inconvenience = N*(N-1) // 2
result = []
for a, b in AB[::-1]:
  result.append(inconvenience)
  pa, pb = find(parent, a), find(parent, b)
  if pa != pb:
    inconvenience -= parent[pa] * parent[pb]
  unite(parent, a, b)

for i in range(N,-1,-1):
  print(result[i])

### FIXED CODE ###

from sys import setrecursionlimit

def find(parent, i):
  t = parent[i]
  if t < 0:
    return i
  t = find(parent, t)
  parent[i] = t
  return t

def unite(parent, i, j):
  i = find(parent, i)
  j = find(parent, j)
  if i == j:
    return
  parent[j] += parent[i]
  parent[i] = j

setrecursionlimit(10**6)

N, M = map(int, input().split())
AB = [[int(c) - 1 for c in input().split()] for _ in range(M)]

parent = [-1]*N
inconvenience = N*(N-1) // 2
result = []
for a, b in AB[::-1]:
  result.append(inconvenience)
  pa, pb = find(parent, a), find(parent, b)
  if pa != pb:
    inconvenience -= parent[pa] * parent[pb]
  unite(parent, a, b)

for i in range(len(result)-1,-1,-1):
  print(result[i])
from sys import stdin
import collections
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]

n,m = ip()
# d = collections.defaultdict(list)
d = {}
seen = set()
for i in range(m):
    x,y = ip()
    if (x,y) in seen or (y,x) in seen:
        continue
    # d[x].append(y)
    # d[y].append(x)
    if x not in d:
        d[x] = [y]
    else:
        d[x].append(y)
    if y not in d:
        d[y] = [x]
    else:
        d[y].append(x)
    seen.add((x,y))
    seen.add((y,x))

def dfs(k, i, d, visited):
    k += 1
    visited.add(i)
    if i not in d: return visited, k
    for j in d[i]:
        if j not in visited:
            visited, k = dfs(k, j, d, visited)
    return visited, k

visited = set()
ans = 0
for i in range(1, n+1):
    if i in visited: continue
    visited, k = dfs(0, i, d, visited)
    # print(f'{visited=} | {k=} | {ans=}')
    ans = max(ans, k)
print(ans)




### FIXED CODE ###

from sys import stdin
import collections
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]

# 4 6
# 1 2
# 1 3
# 1 4
# 2 3
# 2 4
# 3 4

def find(d,x):
    root = x
    while root != d[root]:
        root = d[root]

    while x != root:
        nxt = d[x]
        d[x] = root
        x = nxt
    return d,root


def merge(d,s,x,y):
    d,x = find(d,x)
    d,y = find(d,y)
    if x == y: return d,s
    if s[x] > s[y]:
        s[x] += s[y]
        d[y] = d[x]
    else:
        s[y] += s[x]
        d[x] = d[y]
    return d,s


n,m = ip()
d = {i+1: i+1 for i in range(n)}
s = {i+1: 1 for i in range(n)}
seen = set()
for _ in range(m):
    # print(d,s)
    x,y = ip()
    if (x,y) in seen or (y,x) in seen: continue
    seen.add((x,y))
    seen.add((y,x))
    d,s = merge(d,s,x,y)
ans = 0
for i in s:
    ans = max(ans, s[i])
print(ans)
K = int(input())
S = input()
if S(len) < K:
    print(S)
else:
    print(S[:K] + '...')

### FIXED CODE ###

K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K] + '...')
from sys import stdin
N,A,B = [int(x) for x in stdin.readline().rstrip().split()]
if (B - A) % 2 == 0:
    print(min((B-A)//2),N-A,B-1)
else:
    print(min(N-A,B-1))

### FIXED CODE ###

from sys import stdin
N,A,B = [int(x) for x in stdin.readline().rstrip().split()]
if (B - A) % 2 == 0:
    print((B-A)//2)
else:
    ans1 = 0
    a1 = A
    b1 = B
    ans1 += (a1-1)
    b1 -= (a1-1)
    a1 = 1
    
    if b1 % 2 == 0:
        b1 -= 1
        ans1 += 1
    ans1 += ((b1 -1)//2)
    
    ans2 = 0
    a2 = A
    b2 = B
    ans2 += (N-B)
    a2 += (N-B)
    b2 += (N-B)
    if (a2 % 2) != (b2 % 2):
        a2 += 1
        ans2 += 1
    ans2 += ((b2 - a2)//2)
    print(min(ans1,ans2,B-1,N-A))
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ns = [[] for _ in range(n)]
for i in range(n-1):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].append(v)
    ns[v].append(u)

M = 10**9+7
def sub(u, p):
    v1 = 1 # 白
    v2 = 1 # 黒
    for v in ns[u]:
        if v==p:
            continue
        w1, w2 = sub(v, u)
        v1 *= (w1+w2)
        v2 *= w1
        v1 %= M
        v2 %= M
    return v1, v2
sub(0, -1)
print((d1[0]+d2[0])%M)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ns = [[] for _ in range(n)]
for i in range(n-1):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].append(v)
    ns[v].append(u)

d1 = [None]*n
d2 = [None]*n
M = 10**9+7
def sub(u, p):
    if d1[u] is not None:
        return d1[u], d2[u]
    v1 = 1 # 白
    v2 = 1 # 黒
    for v in ns[u]:
        if v==p:
            continue
        w1, w2 = sub(v, u)
        v1 *= (w1+w2)
        v2 *= w1
        v1 %= M
        v2 %= M
    d1[u] = v1
    d2[u] = v2
    return v1, v2
sub(0, -1)
print((d1[0]+d2[0])%M)
import numpy as np

W, H, N = map(int, input().split())

area = np.ones((W, H))

for _ in range(N):
    x, y, a = map(int, input().split())

    if a == 1:
        area[:x, :] = 0
    elif a == 2:
        area[x:, :] = 0
    elif a == 3:
        area[:, :y] = 0
    elif a == 4:
        area[:, y:] = 0

print(int(np.sum(area)))


### FIXED CODE ###

import numpy as np

W, H, N = map(int, input().split())

area = np.ones((W, H))

for _ in range(N):
    x, y, a = map(int, input().split())

    if a == 1:
        area[:x, :] = 0
    elif a == 2:
        area[x:, :] = 0
    elif a == 3:
        area[:, :y] = 0
    elif a == 4:
        area[:, y:] = 0

print(int(np.sum(area)))
eps = 1.0e-14
if math.sqrt(a) + math.sqrt(b) + eps < math.sqrt(c):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c = map(int,input().split())
#if math.sqrt(a)+math.sqrt(b) < math.sqrt(c):
if c-a-b> 0 and (c-a-b)**2 > 4*a*b:
    print("Yes")
else:
    print("No")
N = int(input())
a = list(map(int,input().split()))

s = sum(a)
i = 0
b = 0
for i in range(N):
  if b<s/2:
    b += a[i]
  else:
    b = b-a[i-1]
    c = a[i-1]
    break
h = s-b-c
if h>b:
  print(abs(b+c)-h)
elif b>h:
  print(abs(h+c)-h)
else:
  print(0)

### FIXED CODE ###

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

if N == 2:
  print(abs(a[0]-a[1]))
else:
  s = sum(a)
  i = 0
  b = 0
  for i in range(N):
    if b<s/2:
      b += a[i]
    else:
      b = b-a[i-1]
      c = a[i-1]
      break
  h = s-b-c
  if h>b:
    print(b+c-h)
  elif b>h:
    print(h+c-b)
  else:
    if N%2==0:
      print(0)
    else:
      print(c)
a,b=[int(input().split())]
if a!=2 and b!=2:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

a,b=map(int,input().split())
if a!=2 and b!=2:
	print("Yes")
else:
	print("No")
r, c = map(int, input().strip().split())
maze = [[0] * (c + 2)] + [[0] + [0 if c == "#" else 2001 for c in input().strip()] + [0] for _ in range(r)] + [[0] * (c + 2)]
queue = [(i, j) for j in range(1, r + 1) for i in range(1, c + 1) if maze[i][j] == 0]

def BFS_maze(maze, queue):
    depth = 0
    nextqueue = []

    while queue:
        depth += 1
        for pos in queue:
            posr, posc = pos
            for r, c in zip([1, -1, 0, 0], [0, 0, 1, -1]):
                nextr = posr + r
                nextc = posc + c
                terrein = maze[nextr][nextc]
                if terrein > depth:
                    maze[nextr][nextc] = depth
                    nextqueue.append((nextr, nextc))
        queue = nextqueue[:]
        nextqueue.clear()

BFS_maze(maze, queue)
print(max(inner for outer in maze for inner in outer))


### FIXED CODE ###

from collections import deque
from copy import copy

row, column = map(int, input().split())
map_ = [[c == "#" for c in input().strip()] for _ in range(row)]

queue = deque([(i, j) for j in range(column) for i in range(row) if map_[i][j]])

def bfs(maze, queue):
    depth = 0
    while True:
        depth += 1
        nextqueue = deque()
        while queue:
            posr, posc = queue.popleft()
            for dr, dc in zip([1, -1, 0, 0], [0, 0, 1, -1]):
                nextr = posr + dr
                nextc = posc + dc
                if 0 <= nextr < row and 0 <= nextc < column and not maze[nextr][nextc]:
                    maze[nextr][nextc] = True
                    nextqueue.append((nextr, nextc))
        if nextqueue:
            queue = copy(nextqueue)
        else:
            return depth - 1

print(bfs(map_, queue))
import fractions
a,b,c,d=map(int,input().split())
x1=b//c-(a-1)//c #ｃの割れるやつ
x2=b//d-(a-1)//d　#ｄの割れるやつ
sks=c * d // fractions.gcd(c,d)#最小公倍数　普通ならmathメソッドにある
x3=b//sks-(a-1)//sks#ｃ＊ｄの割れるやつ
ans=b-a+1-(x1+x2-x3)
print (ans)


### FIXED CODE ###

import fractions
a,b,c,d=map(int,input().split())
x1=b//c-(a-1)//c #ｃの割れるやつ
x2=b//d-(a-1)//d #ｄの割れるやつ
sks=c * d // fractions.gcd(c,d)#最小公倍数　普通ならmathメソッドにある
x3=b//sks-(a-1)//sks#ｃ＊ｄの割れるやつ
ans=b-a+1-(x1+x2-x3)
print (ans)
N = int(input())
h = list(map(int, input().split()))
INF = 10**8
dp = [INF] * N

def chmin(a, b):
    if a >= b:
        return b
    else:
        return a

def DFS(i):
    if dp[i] < INF:
        return dp[i]
    
    if (i == 0):
        dp[i] = 0
        return 0
    
    res = INF
    res = chmin(INF, DFS(i-1) + abs(h[i] - h[i-1]))
    
    if i > 1:
        res = chmin(res, DFS(i-2) + abs(h[i] - h[i-2]))
        
    dp[i] = res
    return res
print(DFS(N-1))

### FIXED CODE ###

import math

N = int(input())
h = list(map(int, input().split()))
dp = [float('INF')] * N

def chmin(a, b):
    if a >= b:
        return b
    else:
        return a

#初期値
dp[0] = 0

#Loop
for i in range(1, N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])
N = int(input())
B = list(map(int, input().split()))

# a1 a2 a3 a4 a5
# b1 b2 b3 b4

# b1 b2 b3 b4 b4

A = (B + [B[-1]]).copy()
for i in range(0, N - 1):
    a1 = A[i]
    a2 = A[i + 1]
    if (a1 < a2 and a1 == B[i]):
        A[i + 1] = a1
A[-1] = B[-1]

print(sum(A))


### FIXED CODE ###

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

B = B + [B[-1]]
B = B[::-1]
A = []
for i in range(0, N - 1):
    A.append(min(B[i], B[i + 1]))
A.append(B[-1])

print(sum(A))
import math

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [math.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))

### FIXED CODE ###

import fractions

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [fractions.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))
a,b,k = map(int,input.split())
for i in range(k):
    if a >= 1:
        a -= 1
    elif a < 1 and b >=1:
        b -= 1
print(a,b,end=" ")

### FIXED CODE ###

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