peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N=int(input())

if N >= 0:
  n = N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 1 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])
  
else:
  n = -N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 0 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])
# Judge status: Accepted
S = input()

if ('W' not in S and 'E' not in S or 'W' in S and 'E' in S) and\
    ('N' not in S and 'S' not in S or 'N' in S and 'S' in S):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()
# Judge status: Accepted
A, B, K = map(int, input().split())
if A >= K:
    print(str(A - K) + ' ' + str(B))
else:
    print(str(0) + ' ' + str(max((B - (K - A)), 0)))
# Judge status: Accepted
N=int(input())
if N%2==0:
  print(N//2)
else:
  print(N//2+1)
# Judge status: Accepted
a,b = map(int,input().split())
if a < b:
    print(str(a)*b)
else:
    print(str(b)*a)
# Judge status: Accepted
line = input()
num_a, num_b = [int(n) for n in line.split()]
is_it_possible = "Yay!"
if num_a > 8 or num_b > 8:
    is_it_possible = ":("
print(is_it_possible)
# Judge status: Accepted
import math
A, B, X = map(int, input().split())
h = X / (A*A)
r = 0
deg = 0
if (2 * X) - (B * A * A) > 0:
  r = math.atan(2 * (B-h) / A)
elif (2 * X) - (B * A * A) == 0:
  r = math.atan(B / A)
else:
  h = (2 * X) / (A * B)
  r = math.atan(B / h)
deg = math.degrees(r)
print(deg)
# Judge status: Accepted
n,x,*a=map(int,open(0).read().split());t=r=0
for i in a:t=min(i,x-t);r+=i-t
print(r)
# Judge status: Accepted
def is_word(i):
  # T文字の長さを切り取り
  sub_S = S[i:i+len(T)]
  for s, t in zip(sub_S, T):
    if s == "?":
      continue
    if s != t:
      return False
  return True

S = input()
rep_S = S.replace("?", "a")
T = input()

word_L = []
for i in range(len(S)-len(T)+1):
  if is_word(i):
    s = rep_S[:i] + T + rep_S[i+len(T):]
    word_L.append(s)

ans = "UNRESTORABLE"
if word_L:
  ans = sorted(word_L)[0]
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
if a==1 and b!=1:
  print("Alice")
elif a!=1 and b==1:
  print("Bob")
elif a==1 and b==1:
  print("Draw")
elif a>b:
  print("Alice")
elif a<b:
  print("Bob")
else:
  print("Draw")
# Judge status: Accepted
K = int(input())

numO = K//2
numE = (K+1)//2

print(numO*numE)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    
    ans = sum(b)
    for i in range(n-1):
        if a[i] + 1 == a[i+1]:
            ans += c[a[i] - 1]
    print(ans)

main()
# Judge status: Wrong Answer
A,B,N = map(int, input().split())
if B > N:
    res = (A*N//B)-A*(N//B)
else:
    N = N - N%B - 1
    res = (A*N//B)-A*(N//B)
print(res)
# Judge status: Accepted
s=input()
for i in range(len(s)):
    for j in range(i, len(s)+1):
        if s[:i]+s[j:]=='keyence':
            print('YES')
            exit()
print('NO')
# Judge status: Wrong Answer
S = input()

if S[2] == S[3] and S[4] == S[4]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)

def binary(l,i):
  r=N-1
  while l<=r:
    m=(l+r)//2
    if A[m]==i:
      return A[m]
    elif A[m]>i:
      r=m-1
    else:
      l=m+1
  x=abs(A[m]-i)
  for j in range(max(0,m-2),min(m+3,N)):
    if x >= abs(A[j]-i):
      res = A[j]
      x=abs(A[j]-i)
  return res


print(A[0],binary(1,A[0]/2))
# Judge status: Accepted
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')
# Judge status: Accepted
N, Q = map(int, input().split())
S = input().rstrip()
cnt = 0
tmp = 0
res = [0]*N
for i, s in enumerate(S):
    if s == "A":
        tmp = 1
    elif s=="C" and tmp == 1:
        tmp = 0
        cnt += 1
    else:
        tmp = 0
    res[i] = cnt
for _ in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    print(res[r] - res[l])
# Judge status: Accepted
import math

a, b = map(int, input().split())
print((a*b)//math.gcd(a, b))
# Judge status: Accepted
import itertools

n, m, q = map(int, input().split())

alist = [list(map(int,input().split())) for i in range(q)]

comb = list(set(itertools.combinations_with_replacement(range(1, m + 1), n)))

# print(comb)

res = 0

for c in comb:
    tmp_score = 0
    for a in alist:
        if c[a[1]-1] - c[a[0]-1] == a[2]:
            tmp_score += a[3]
    res = max(res, tmp_score)

print(res)
# Judge status: Wrong Answer
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print(int(K*X+max((N-K),0)*Y))
# Judge status: Accepted
n = int(input())
ans = {i*j for i in range(1,10) for j in range(1,10)}
if n in ans:print("Yes")
else:print("No")
# Judge status: Wrong Answer
import collections
n = int(input())
s = list(input() for _ in range(n))

sl = []
s1 = set(list(s[0]))
for i in range(1, n-1):
    tmp = set(list(s[i]))
    sl = s1 & tmp
sl = list(sl)
sl.sort()

d = [51] * len(sl)
for i in range(len(sl)):
    for j in s:
        d[i] = min(j.count(sl[i]), d[i])

ans = str()
for i, a in enumerate(sl):
    ans += a * d[i]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split());print(a-1 if a>b else a)
# Judge status: Accepted
N = int(input())
ans = float('inf')
for i in range(1, N):
    j = N-i
    i_str = str(i)
    j_str = str(j)
    i_sum, j_sum = 0, 0
    for p in range(len(i_str)):
        i_sum += int(i_str[p])
    for q in range(len(j_str)):
        j_sum += int(j_str[q])
    ans = min(ans, i_sum+j_sum)

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

lb = [0] * (N+1)
for i, c in enumerate(S, 1):
    lb[i] = lb[i-1] + (1 if c=='#' else 0)

ans = N + 100
bl = lb[-1]
for i in range(N+1):
    j = i+1
    left = lb[i]
    right = N - i - (bl - lb[i])
    ans = min(ans, left+right)
print(ans)
# Judge status: Accepted
A = map(int, input().split())
print('win' if sum(A)<22 else 'bust')
# Judge status: Accepted
S = input()
H = len(S)//2
 
if S[:H] == S[-H:] == S[-H:][::-1]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = input()
ans = 0
for i in n:
    ans += int(i)
if ans % 9 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))
cnt = 0
is_continue = False
for i in range(N):
    if (i + 1) == P[i]:
        cnt += 1
        if is_continue:
            cnt -= 1
            is_continue = False
        else:
            is_continue = True
    else:
        is_continue = False
print(cnt)
# Judge status: Accepted
x,y = map(int,input().split())
ch = max(abs(x),abs(y)) - min(abs(x),abs(y))
if x <= 0 and y == 0 or x == y or x == 0 and y > 0:
    print(ch)
elif x*y <= 0:
    print(ch+1)
elif x*y >= 0 and x >= y:
    print(ch+2)
else:
    print(ch)
# Judge status: Accepted
S = input()
N = len(S)
a = [0]*(N+1)
b = ['']*(N+1)
s = ''
for i in range(1, N+1):
    s += S[i-1]
    b[i] = s
    if s != b[i-1]:
        a[i] = a[i-1]+1
        s = ''
    else:
        a[i] = a[i-1]
print(a[N])
# Judge status: Wrong Answer
n,h=map(int,input().split())
A,B=[0]*n,[0]*n
for i in range(n):
  A[i],B[i]=map(int,input().split())
A_max=max(A)
B.sort(reverse=True)
ans=0
for i in B:
  if i > A_max:
    h-=i
    ans+=1
  else:break
if h<0:
  h=0
q = h / A_max
p = q % 1
ans += int(q)
if p>0:
  print(ans+1)
else:
  print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
A, B, C = sorted([A, B, C])

if (A + B + C) % 2 == (C * 3) % 2:
    ans = (C - A + C - B) // 2
else:
    ans = (C + 1 - A + C - B) // 2 + 1
print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
ab = [list(map(int, readline().split())) for _ in range(n)]
cd = [list(map(int, readline().split())) for _ in range(m)]

for i in ab:
    l = []
    for j in cd:
        distance = abs(i[0]-j[0])+abs(i[1]-j[1])
        l.append(distance)
    print(l.index(min(l)) + 1)
# Judge status: Accepted
from bisect import bisect_left

N, M = map(int, input().split())
d = dict()
A = list(map(int, input().split()))
for i in range(N):
	d[A[i]] = d.get(A[i], 0) + 1
for i in range(M):
	B, C = map(int, input().split())
	d[C] = d.get(C, 0) + B

ans = 0
keys = sorted(list(d.keys()), reverse = True)
for k in keys:
	kosuu = min(N, d.get(k))
	ans += k * kosuu
	N -= kosuu
	if N == 0:
		break
print(ans)
# Judge status: Accepted
N=int(input())
s=input()

rcnt=s.count("R")
gcnt=s.count("G")
bcnt=s.count("B")
sum=rcnt*gcnt*bcnt#条件1を満たす組み合わせの数

for i in range(N):
    for d in range(N):
        j=i+d
        k=j+d
        if k>=N:
            break
        if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:#等間隔の組み合わせを除く
            sum-=1
print(sum)
# Judge status: Accepted
import math
A,B = map(int,input().split())
Anum=[]
Bnum=[]

for i in range(2,int(math.sqrt(A)+1)):
    while A % i ==0:
        A //= i
        if i not in Anum:
            Anum.append(i)
if A!=1:
    Anum.append(A)


for i in range(2,int(math.sqrt(B)+1)):
    while B % i ==0:
        B //= i
        if i not in Bnum:
            Bnum.append(i)
if B!=1:
    Bnum.append(B)

ABnum=set(Anum) & set(Bnum)
print(len(ABnum)+1)
# Judge status: Wrong Answer
s = input()
if s == "2019/04/30":
  print("Heisei")
else:
  print("TBD")
# Judge status: Accepted
x=int(input())
a=100
ans=0
while a<x:
    a*=101/100
    a=int(a)
    ans+=1
print(ans)
# Judge status: Wrong Answer
x = int(input())

num_500 = int(x / 500)

amari = x - num_500

num_5 = int(amari / 5)

print(1000 * num_500 + 5 * num_5)
# Judge status: Accepted
def solve(s):
    for dirs in ('NS', 'SN', 'EW', 'WE'):
        d, o = dirs[0], dirs[1]
        if d in s and o not in s:
            return False
    return True


s = input()
print('Yes' if solve(s) else 'No')
# Judge status: Wrong Answer
A, B, C, X, Y = map(int, input().split())
ans = 0
for i in range(X):
  for j in range(Y):
    for k in range(X+Y, 2):
      if i+k/2==X and j+k/2==Y:
        ans = min(ans, A*i+B*j+C*k)
print(ans)
# Judge status: Accepted
s = set()
for _ in range(int(input())):
				a = input()
				s.add(a)
print(len(s))
# Judge status: Wrong Answer
n = int(input())
n3 = n/3
n5 = n/5
n15 = n/15
def sum(k):
    return k*(k+1)/2
ans = sum(n)+15*sum(n15)-3*sum(n3)-5*sum(n5)
print(int(ans))
# Judge status: Accepted
H = int(input())
res = 0
cnt = 1
while H > 0:
    H = H // 2
    if res == 0:
        res = 1
    else:
        cnt *= 2
        res += cnt
print(res)
# Judge status: Wrong Answer
def solve(x, ls):
    y = 0
    m = x
    for i in range(1, 102):
        if i in ls:
            continue
        if abs(x - i) < m:
            y = i
            m = abs(x - i)
    return y


def main(istr, ostr):
    x, n = list(map(int, istr.readline().strip().split()))
    ls = list(map(int, istr.readline().strip().split()))
    result = solve(x, ls)
    print(result, file=ostr)
# Judge status: Wrong Answer

def main():
  n = int(input())
  ans = ""
  dics = []
  
  az = "abcdefghijklmnopqrstuwvxyz"

  for i in range(n):
    dic = {}
    s = input()
    for c in az:
      dic[c] = s.count(c)
    dics.append(dic)

  for c in az:
    can_use = True
    m = 50

    for dic in dics:
      if dic[c] == 0:
        can_use = False
        break

      m = min(m, dic[c])

    if(can_use):
      ans += c * m

  print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
import math
H=int(input())
a=H
ans=1
while a>1:
  a=math.floor(a/2)
  ans+=1
Ans=2**(ans)
print(Ans-1)
# Judge status: Accepted
n, m = map(int, input().split())

#nC2
#mC2

ans = 0
if n >= 2:
    ans += n*(n-1)//2
if m >= 2:
    ans += m*(m-1)//2

print(ans)
# Judge status: Wrong Answer
o = input()
e = input()

for s, t in zip(o, e):
  print(s, t, sep='', end='')
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if A % B == C - 1:
  print("NO")
else:
  print("YES")
# Judge status: Wrong Answer
hoge = 10 ** 9 + 7
def test():
	n, m = map(int, input().split())
	if abs(n-m) > 1:
		print(0)
		exit()
	i_n = n
	i_m = m
	np = 1
	mp = 1
	while True:
		np = np * i_n
		mp = mp * i_m
		i_n -= 1
		i_m -= 1
		if i_n < 1:
			i_n = 1
		if i_m < 1:
			i_m = 1
		if i_n == 1 and i_m == 1:
			break
	s = 1
	r = (mp % hoge) * (np % hoge) * (s % hoge)
	print(r)

if __name__ == '__main__':
    test()
# Judge status: Accepted
S=list(input())
K=int(input())
N=len(S)

for i in range(N):
    if S[i]=="a":
        continue
    sa=ord("z")-ord(S[i])+1
    if sa<=K:
        K-=sa
        S[i]="a"

if K!=0:
    K%=26
    S[i]=chr(ord(S[i])+K)

print("".join(S))
# Judge status: Accepted
x = int(input())

tmp1 = x//11
tmp2 = x%11

ans = 2*tmp1
if tmp2 > 6:
    ans += 2
elif tmp2 > 0:
    ans += 1

print(ans)
# Judge status: Wrong Answer
n=int(input())
ans=''
while n>0:
  ans+=chr(ord('a')+n%26-1)
  n=n//26
print(ans[::-1])
# Judge status: Accepted
def main():
    N=int(input())
    A=sorted([int(_) for _ in input().split()])[::-1]
    ans = A[0]
    if N==2:
        print(ans)
    else:
        for i in range(1, N//2):
            ans += A[i]*2
        if N%2:
            ans += A[N//2]
        print(ans)
main()
# Judge status: Accepted
import collections
n=int(input())
l=[input() for i in range(n)]
c=collections.Counter(l)
print(len(c))
# Judge status: Accepted
N = int(input())
a,b,c = [],[],[]
for n in range(N):
  a_,b_,c_ = map(int, input().split())
  a.append(a_)
  b.append(b_)
  c.append(c_)
do_a = [a[0]] #do a in n-th day
do_b = [b[0]] #same
do_c = [c[0]]

for day in range(1,N):
  do_a.append(a[day] + max(do_b[day-1], do_c[day-1]))
  do_b.append(b[day] + max(do_a[day-1], do_c[day-1]))
  do_c.append(c[day] + max(do_a[day-1], do_b[day-1]))
print(max(do_a[N-1],do_b[N-1], do_c[N-1]))
# Judge status: Accepted
N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

def ans091(N:int, s:list, M:int, t:list):
    test_count=0
    own=list(set(s))
    for i in range(len(own)):
        if test_count<=s.count(own[i])-t.count(own[i]):
            test_count=s.count(own[i])-t.count(own[i])
    if test_count>0:
        return test_count
    else:
        return 0
print(ans091(N,s,M,t))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
ai = []
for i in range(N):
    ai.append(A[i] - (i + 1))
# print(ai)
ai.sort()

# Nの偶奇に依らず、中央値はこのように表せることが知られている
med = ai[N // 2]

ans = 0
for i in range(N):
    tmp = abs(ai[i] - med)
    ans += tmp
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
d=[1]*(n+1)
for i in range(m):
  d[a[i]]=0
for i in range(2,n+1):
  if d[i]!=0:
    d[i]=d[i-1]+d[i-2]
print(d[n]%(10**9+7))
# Judge status: Accepted
S=input()

if all(a!="L" for a in S[::2]) and all(a!="R" for a in S[1::2]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
s = []
for _ in range(n):
    i = int(input())
    s.append(i)
s.sort()
ans = sum(s)
if ans % 10 == 0:
    for i in s:
        if i % 10 != 0:
            ans -= i
            print(ans)
            break
    else:
        print(0)
else:
    print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
t = [0 for i in range(N)]

for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] += t[i]
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
# Judge status: Accepted
import sys
input = sys.stdin.readline
n,k,q=map(int,input().split())
point=[0]*n
for a in range(q):
    a=int(input())
    point[a-1]+=1
#print(point)
for i in point:
    if i>q-k:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
x=list(map(int,input().split()))
if x[0]==x[1]:
  print(sum(x))
else:
  print(sum(list(range(min(x),max(x)+1))[-2:]))
# Judge status: Accepted
abc = list(map(int, input().split()))
ans = len(set(abc))
print(ans)
# Judge status: Accepted
n = int(input())
a = 'No'
for i in range(100):
    for j in range(100):
        if n == 4*i + 7*j :
            a = 'Yes'

print(a)
# Judge status: Accepted
l = sorted(list(map(int, input().split())), reverse = True)
print(l[0] * 10 + l[1] + l[2])
# Judge status: Accepted
N = int(input())
s = input()
length = len(s)
tmp = 0
ans = 0
for i in range(length):
    if s[i] == 'I':
       tmp += 1
       if tmp > ans:
           ans = tmp

    else:
        tmp -= 1

print(ans)
# Judge status: Wrong Answer
num_children, num_snacks = list(map(int, input().split(' ')))
children = list(map(int, input().split(' ')))
children.sort()
print(children)

count = 0
for i in range(num_children+1):
  if num_snacks >= sum(children[:i+1]):
    count += 1
  else:
    break
print(count)
# Judge status: Accepted
a=int(input())
l=list(map(int,input().split()))
t=[]
b=[]
for x in range(1,a+1):
    t.append(x)
for x in range(a):
    b.append( l[x]==t[x])
if b.count(True)==a:print("YES")
elif b.count(False)!=2:print("NO")
else:
    fi=b.index(False)
    li=b.index(False,fi+1)
    tmp=l[fi]
    l[fi]=l[li]
    l[li]=tmp
    b.clear()
    for x in range(a):
        b.append( l[x]==t[x])
    if b.count(True)==a:print("YES")
    else:print("NO")
# Judge status: Wrong Answer
s = [input()]
for i in s:
  s = i
S = "".join(s)
print(S)
# Judge status: Wrong Answer
n, w = map(int ,input().split())
items = []
for i in range(n):
    array = list(map(int, input().split()))
    items.append(array)

dp = [[0 for _ in range(w+1)] for _ in range(n+1)]

for i in range(1, n+1):
    weight = items[i-1][0]
    for j in range(weight, w+1):
        dp[i][j] = max((dp[i - 1][j - weight] + items[i - 1][1]), dp[i - 1][j])

print(dp[-1][-1])
# Judge status: Wrong Answer
import sys


def _sum_ob_divisors(n):
    def f(n, x):
        y = n // x
        return y * (y + 1) * x / 2
    return sum(f(n, i) for i in range(1, n + 1))


def sum_ob_divisors(f):
    n = int(f.read())

    return _sum_ob_divisors(n)


def main():
    ans = sum_ob_divisors(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s=input().strip()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
print("YES" if s else "NO")
# Judge status: Accepted
s = input()
if 'E' in s:
    if 'W' not in s:
        print('No')
        exit()
if 'E' not in s:
    if 'W' in s:
        print('No')
        exit()
if 'N' not in s:
    if 'S' in s:
        print('No')
        exit()
if 'N' in s:
    if 'S' not in s:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
N, Y = map(int, input().split())

# 合計値
y = 0

# 正解組み合わせがあった場合
exist_answer = False

for i in range(N + 1):
    for j in range((N + 1) - i):
        k = N - (i + j)
        y = i * 10000 + j * 5000 + k * 1000
        if y == Y:
            exist_answer = True
            print(i, j, k)

if exist_answer is False:
    print(-1, -1, -1)
# Judge status: Accepted
n=int(input())
if n%2:
    print(0)
    exit()
ans=0
n//=2
while n>0:
    ans+=n//5
    n//=5
print(ans)
# Judge status: Accepted
N=int(input())
A_s =list(map(int,input().split()))

from statistics import mean
c_n =mean(A_s)
c_n = round(c_n)
cost = 0
for i in range(N):
    cost+=(A_s[i]-c_n)**2
print(cost)
# Judge status: Accepted
n,k = map(int, input().split())
y = []
while n>=1:
    y.append(n%k)
    n = int(n/k)
y.reverse()
print(len(y))
# Judge status: Accepted
#!/usr/bin/env python3

N, M = map(int, input().split())
B = {}
for i in range(1, N+1):
    B[i] = []

for i in range(M):
    a, b = map(int, input().split())
    if b == N or a == 1:
        B[a].append(b)
for sima in B[1]:
    if N in B[sima]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Judge status: Accepted
A,B,K=map(int, input().split())
b=0
res=0
if A<=K:
    B=max(b,B-(K-A))
    A=0
else:
    A=A-K
print(A,B)
# Judge status: Wrong Answer
# coding: utf-8

N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
for i in range(N):
    s = list(set(list(input())))
    L.append(s)
for i in range(N):
    L[i].sort()
L.sort()

ans = 0
cnt = 1
for i in range(N-1):
    if L[i]==L[i+1]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
if cnt > 1:
    ans += cnt*(cnt-1)//2
print(ans)
# Judge status: Accepted
s = input()
b = s[:7]
e = s[-7:]
flg = 0
for i in range(7):
  if b[:i] + e[i:] == "keyence":
    flg = 1
if flg:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
s = input()
if s[len(s)-1] != s:
    print(s + "s")
else:
    print(s + "es")
# Judge status: Wrong Answer
s=input()
if 'hi' in s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,x = map(int,input().split())
print("YES" if a <= x <= a+b else "NO")
# Judge status: Accepted
N,K=map(int,input().split())
A=[0]*N
for i in range(N):
    A[i]=int(input())

A=sorted(A)
t=10**9
for i in range(N-K+1):
    t=min(t,abs(A[K-1+i]-A[i]))
print(t)
# Judge status: Wrong Answer
import bisect
N, K = map(int, input().split())
x = list(map(int, input().split()))
id = bisect.bisect_left(x, 0)
ID = bisect.bisect_right(x, 0)
ans = 10**10
if id >= K:
    ans = min(ans, x[id-K])
if id + K - 1 < N:
    ans = min(ans, x[id+K-1])


for i in range(max(0, id - K + 1), ID):
    if i+K-1 < N:
        ans = min(ans, -x[i]*2 + x[i+K-1], -x[i]+x[i+K-1]*2)

print(ans)
# Judge status: Wrong Answer
k = int(input())
mod = 0
for i in range(1, k):
    mod = ((mod * 10) + 7) % 7
    if mod == 0:
        print(i)
        exit()
print(-1)
# Judge status: Wrong Answer
import fractions
N=int(input())
a = list(map(int, input().split()))
gcd = a[0]
for i in range(1, N):
    gcd = gcd * a[i] // fractions.gcd(gcd, a[i])

b= []
for i in range(N):
    b.append(gcd //a[i])
ans=0

if N%2==0:
    for i in range(0,N,2):
	    ans = (b[i]+b[i-1])%1000000007
else:
    b.append(0)
    for i in range(0,N,2):
	    ans = (b[i]+b[i-1])%1000000007


print(ans)
# Judge status: Accepted
N = int(input())
l = input().split()

cnt = 0
current = int(l[0])
for i in range(1, N):
    now = int(l[i])
    if now >= current:
        current = now
    if now < current:
        cnt += current - now

print(cnt)
# Judge status: Accepted
h,n=map(int,input().split())
lis=[list(map(int,input().split())) for i in range(n)]

dp=[float('inf') for i in range(h+10**4+1)]
dp[0]=0

for i in range(1,h+10**4+1):
    for j in range(n):
        if i>=lis[j][0]:
            dp[i]=min(dp[i],dp[i-lis[j][0]]+lis[j][1])
        else:
            dp[i]=dp[i]
print(min(dp[h:]))
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
i=0
ans =0
while i<n-1:
    if p[i]==i+1:
        ans += 1
        i+=1
    i += 1
print(ans)
# Judge status: Accepted
S = int(input())

x1 = 10 ** 9
y1 = 1

x2 = 10 ** 9 - S % (10 ** 9)
y2 = S // (10 ** 9) + 1

if S == 10 ** 18:
    x1, y1 = 10 ** 9, 0
    x2, y2 = 0, 10 ** 9

print('0 0 {0} {1} {2} {3}'.format(x1, y1, x2, y2))
# Judge status: Accepted



n, m = map(int, input().split())


c = int(n*(n-1) / 2 + m*(m-1) / 2)

print(c)
# Judge status: Accepted
k = int(input())
s = input()
if len(s) <= k:
    print(s)
else:
    str_k = ''
    for i in range(k):
        str_k = str_k + s[i]
    print(str_k + '...')
# Judge status: Wrong Answer
h,n = map(int,input().split())
lis = list(input().split())

attack = 0
for i in range(len(lis)):
    attack = attack + int(lis[i])

if attack >= h:
    print('Yes')
else:
    print('')
# Judge status: Accepted
from statistics import median

n = int(input())
abl = [list(map(int,input().split())) for nesya in range(n)]
al = []
bl = []
for ab in abl:
  al.append(ab[0])
  bl.append(ab[1])
if n%2 == 1:
  print(median(bl)-median(al)+1)
else:
  print(int(median(bl)*2-median(al)*2+1))
# Judge status: Accepted
s = input()
m = 1000
for i in range(len(s)):
    x = int(s[i:i+3])
    if m > abs(753-x):
        m = abs(753-x)
print(m)