Harryxun/stf_run huggingface dataset:
def mulallnumber(numbers): #Function to multiply all numbers in list
   x=1
   for i in numbers:
      x*=i
      return x

A=list() #Creates a list

N=int(input("Enter the size of the list ::")) #size of list

print("Enter the element of list ::")
for i in range(int(N)):
   k=int(input(""))
   A.append(k) #append number in list

if mulallnumber(A)<1000000000000000000:
    print(mulallnumber(A))
else:
    print('-1') #will print '-1' if it exceeds 10^18


### FIXED CODE ###

# we collect the input A1 upto An.
# limit cannot exceed 10**18
# if N = 0 then ans = 0
# in N is in range then compute ans * A[n]
# else if  ans is greater than limit then display 1
# finally if length equal 1 then display -1
N = int(input())
ans = 1
limit = 10 ** 18
length = 0

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

A0 = set(A)
if 0 in A0:
    ans = 0
else:
    pass

for n in range(N):
    ans = ans * A[n]
    if ans == 0:
        break
    elif ans > limit:
        length = 1
        break
    else:
        pass

if length == 1:
    print(-1)
else:
    print(ans)
from collections import deque

dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]
H, W = list(map(int, input().split()))
field = [input() for _ in range(H)]
def bfs():
  dist = [[float('inf')] * W for _ in range(W)]
  que = deque()
  que.append((0, 0))
  dist[0][0] = 0
  while len(que) > 0:
    y, x = que.popleft()
    if y == H - 1 and x == W - 1:
      break
    for dx, dy in dd:
      ny, nx = y + dy, x + dx
      if 0<=nx<W and 0<=ny<H and field[ny][nx]=='.' and dist[ny][nx]==float('inf'):
        dist[ny][nx] = dist[y][x] + 1
        que.append((ny, nx))
  return dist[H - 1][W - 1]
    
count = sum([f.count('#') for f in field])
need = bfs()
      
if need == float('inf'):
  print(-1)
else:
  print(H * W - count - need - 1)

### FIXED CODE ###

from collections import deque

R,C = list(map(int,input().split()))
Sx,Sy = 0,0
Gx,Gy = R-1,C-1
Mize = [input() for _ in range(R)]
dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]

def bfs():
    d = [[float('inf')] * C for i in range(R)]
    q = deque([])
    d[Sx][Sy] = 0
    q.append((Sx,Sy))
    while(len(q) != 0):
        x,y = q.popleft()
        if x == Gx and y == Gy:
            break
        for dx,dy in dd:
            
            if -1<x+dx<R and -1<y+dy<C and Mize[x+dx][y+dy]=='.' and d[x+dx][y+dy] == float('inf'):
                q.append([x+dx,y+dy])
                d[x+dx][y+dy] = d[x][y] + 1
    return d[Gx][Gy]

white = sum([m.count('#') for m in Mize])
need = bfs()
if need == float('inf'):
    print(-1)
else:
    print(R*C-white-need-1)
N = int(input())
A = list(map(int,input().split()))

two = [0]*N
four = [0]*N 
for x in list(set(A)):
  num = A.count(x)
  if(num >= 4):
    four[x] = x
  elif(num != 1):
    two[x] = x
two.sort()
four.sort()
print(max(four[-1]**2, two[-1]*two[-2]))


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
d = {}
for a in A:
  if(a in d):
    d[a] += 1
  else:
    d[a] = 1
x, y = 0, 0
for k, v in d.items():
  if(v >= 2 and k > y):
    if(k >= x):
      if(v >= 4):
        y = k
      else:
        y = x
      x = k
    else:
      y = k
print(x * y)
import sys
import math
from collections import Counter

mod = 1000000007
 
N = int(sys.stdin.readline().strip())
fishes = []
zero = 0
zero_l = 0
zero_r = 0
rest = N
for _ in range(N):
    a, b = map(int, sys.stdin.readline().strip().split())
    # 角度だけが重要なので座標圧縮して良い
    if a == 0 and b == 0:
        # fishes.append((0, 0))
        zero += 1
        rest -= 1
    elif a == 0:
        # fishes.append((0, 1))
        zero_l += 1
    elif b == 0:
        # fishes.append((1, 0))
        zero_r += 1
    else:
        gcd = math.gcd(a, b)
        fishes.append((a // gcd, b // gcd))

# print(fishes)

# (a, b)ごとにカウント
counter = Counter(fishes)
# print(counter)

calculated = set()
ans = 1
# 組み合わせを計算
for ((a, b), count) in counter.items():
    # if a == 0 or b == 0:
    #     continue
    # 計算済みの場合
    if (a, b) in calculated:
        continue

    # 仲が悪いイワシの数
    bad_count = 0
    # 90度異なるものがダメ
    for (a_k, b_k) in ((-1, 1), (1, -1)):
        bad_pair = (b * a_k, a * b_k)
        if bad_pair in counter:
            bad_count += counter[bad_pair]
            calculated.add(bad_pair)

    # 仲が悪いイワシがいない場合
    if bad_count == 0:
        ans *= 2**count
        ans %= mod
    else:
        # 仲が良いものだけの組み合わせ
        good = 2**count
        
        # 仲が悪いものだけの組み合わせ
        bad = 2**bad_count

        # 全て選ばない場合は許容しないので1を引いておく
        ans *= good + bad - 1
        ans %= mod

    rest -= count + bad_count

if (1,0) not in counter:
    counter[(1,0)] = 0
if (0,1) not in counter:
    counter[(0,1)] = 0
if (0,0) not in counter:
    counter[(0,0)] = 0
ans *= 2**counter[(1, 0)] + 2**counter[(0, 1)] - 1
ans %= mod
rest -= zero_r + zero_l

# 仲が悪いものが存在しないイワシの組み合わせ
ans *= pow(2, rest, mod)

# 全部選ばないものは駄目
ans += zero - 1
ans %= mod


print(ans)

### FIXED CODE ###

import sys
import math
from math import gcd

mod = 1000000007
 
N = int(sys.stdin.readline().strip())
zero = 0
mp = {}
for _ in range(N):
    a, b = map(int, sys.stdin.readline().strip().split())

    if a == 0 and b == 0:
        zero += 1
        continue
 
    g = gcd(a, b)
    a = a // g
    b = b // g
 
    if b < 0:
        a = -a
        b = -b
    if b == 0 and a < 0:
        a = -a
    if a <= 0:
        a, b = b, -a
        if (a, b) in mp:
            mp[(a, b)][0] += 1
        else:
            mp[(a, b)] = [1, 0]
    else:
        if (a, b) in mp:
            mp[(a, b)][1] += 1
        else:
            mp[(a, b)] = [0, 1]
 
ans = 1
for key in mp:
    s, t = mp[key]
    ans *= pow(2, s, mod) + pow(2, t, mod) - 1
    ans %= mod
print((zero - 1 + ans) % mod)
n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c
    flag = "##" not in s[b: d] and "##" not in s[a: c]
else:
    flag = "..." in s[b: d]

print("Yes" if flag else "No")

### FIXED CODE ###

n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    flag = "##" not in s[b: d] and "##" not in s[a: c]
else:
    flag = "..." in s[b - 2: d + 1]

print("Yes" if flag else "No")
import math
a, b, c, d =map(int, input().split())
lcm = (c//math.gcd(c, d))*d
cnt = (b-a+1)
c_cnt = (b//c) - ((a-1)//c)
d_cnt = (b//d) - ((a-1)//d)
lcm_cnt = (b//lcm) - ((a-1)//lcm)
print(cnt + lcm_cnt - c_cnt - d_cnt)

### FIXED CODE ###

import fractions
a, b, c, d =map(int, input().split())
lcm = (c//fractions.gcd(c, d))*d
cnt = (b-a+1)
c_cnt = (b//c) - ((a-1)//c)
d_cnt = (b//d) - ((a-1)//d)
lcm_cnt = (b//lcm) - ((a-1)//lcm)
print(cnt + lcm_cnt - c_cnt - d_cnt)
import numpy as np
N,M,C=map(int,input().split())
B=[i for i in map(int,input().split())]
A=[]
for i in range(N):
    A1=[i for i in map(int,input().split())]
    A+=[A1]

B=np.array(B)
A=np.array(A)
count=0
for i in range(N):
    if B@A[i].T+C>0:
        count+=1
print(count)

### FIXED CODE ###

N,M,C=map(int,input().split())
B=[i for i in map(int,input().split())]
A=[]
for i in range(N):
    A1=[i for i in map(int,input().split())]
    A+=[A1]


count=0
for i in range(N):
    dot=0
    for j in range(M):
        dot+=B[j]*A[i][j]
    dot+=C
    if dot>0:
        count+=1
print(count)
n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))

START = 1
# 訪れたタイミング
town_with_i = {START: 0}
# 現在地
current = START
# 既に訪れたことある街(巡回の判定に使う)
known_towns = set([START])
i = 0
for _ in range(k):
    i += 1
    # 現在地
    current = a_list[current - 1]

    # 既に来たことがあるということは巡回している
    if current in known_towns:
        break

    # メモ
    town_with_i[current] = i
    known_towns.add(current)

# 巡回までのステップ数
first_step = town_with_i[current]
# 1周するのに必要なステップ数
r = i - town_with_i[current]

# print(town_with_i)
# print(current)
# print(i)
# print(r)

loop_num = (k - first_step) % r

for i in range(loop_num):
    current = a_list[current - 1]

print(current)


### FIXED CODE ###

n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))

START = 1
# 訪れたタイミング
town_with_i = {START: 0}
# 現在地
current = START
# 既に訪れたことある街(巡回の判定に使う)
known_towns = set([START])
i = 0
for _ in range(k):
    i += 1
    # 現在地
    current = a_list[current - 1]

    # 既に来たことがあるということは巡回している
    if current in known_towns:
        break

    # メモ
    town_with_i[current] = i
    known_towns.add(current)

# 巡回までのステップ数
first_step = town_with_i[current]
# 1周するのに必要なステップ数
r = i - town_with_i[current]

# print(town_with_i)
# print(current)
# print(i)
# print(r)

loop_num = (k - first_step) % r if r > 0 else (k - first_step)

for i in range(loop_num):
    current = a_list[current - 1]

print(current)
N, *L,  = [list(map(int, s.split())) for s in open(0)]
A = L[0]
p
cnt = 0
for i in range(len(A) - 2):
    ma = max(A[i], A[i+1], A[i+2])
    mi = min(A[i], A[i+1], A[i+2])
    if A[i+1] not in [ma, mi]:
        cnt += 1
print(cnt)

### FIXED CODE ###

N, *L,  = [list(map(int, s.split())) for s in open(0)]
A = L[0]

cnt = 0
for i in range(len(A) - 2):
    ma = max(A[i], A[i+1], A[i+2])
    mi = min(A[i], A[i+1], A[i+2])
    if A[i+1] not in [ma, mi]:
        cnt += 1
print(cnt)
A = int(input())
print(%d:%d:%d %(A/3600,":",(A%3600)/60,":",A%60))


### FIXED CODE ###

A = int(input())
print("%d:%d:%d"%(A/3600,(A%3600)/60,A%60))
S = input()
N = len(S)
cnt = 0
for i in range(N):
    for j in range(i+1, N+1):
        #print(i, j)
        num = int(S[i: j])
        if num % 2019 == 0:
            #print(i, j)
            cnt += 1
print(cnt)

### FIXED CODE ###

S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
import sys


primes = [2]

def solv(num):
    if num < primes[-1]:
        p1 = filter(lambda x: x < num, primes)[-1]
    else:
        for p in prime_list(num * 2):
            primes.append(p)
            if num < p:
                p2 = p
                break
            else:
                if p < num:
                    p1 = p
    return (p1, p2)


def prime_list(n):
    limit = int(n ** 0.5) + 1
    lis = range(1, n + 1, 2)
    lis[0] = 2
    while True:
        if len(lis) == 0:
            break
        p = lis.pop(0)
        yield p
        if p <= limit:
            lis = [x for x in lis if x % p != 0]



for line in sys.stdin:
    number = int(line)
    p1, p2 = solv(number)
    print ' '.join(map(str, [p1, p2]))

### FIXED CODE ###


import sys


primes = [2]

def solv(num):
    p1 = 0
    p2 = 0
    if num < primes[-1]:
        p1 = filter(lambda x: x < num, primes)[-1]
        lis = filter(lambda x: num < x, primes)
        if lis:
            p2 = lis[0]
    else:
        for p in prime_list(num * 2):
            primes.append(p)
            if num < p:
                p2 = p
                break
            else:
                if p < num:
                    p1 = p
    return (p1, p2)


def prime_list(n):
    limit = int(n ** 0.5) + 1
    lis = range(1, n + 1, 2)
    lis[0] = 2
    while True:
        if len(lis) == 0:
            break
        p = lis.pop(0)
        yield p
        if p <= limit:
            lis = [x for x in lis if x % p != 0]



for line in sys.stdin:
    number = int(line)
    p1, p2 = solv(number)
    print ' '.join(map(str, [p1, p2]))
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
from itertools import permutations
t = [[float('inf') for i in range(M)] for j in range(M)]

g = {}
for i in range(M):
    a,b,c = map(int, input().split())
    t[a-1][b-1] = c
    t[b-1][a-1] = c
    v = g.get(a,[])
    v.append((b,c))
    g[a] = v
    v = g.get(b,[])
    v.append((a,c))
    g[b] = v

for i in range(M):
    for j in range(M):
        for k in range(M):
            if t[i][j] > t[j][k] + t[k][j]:
                t[i][j] = t[j][k] + t[k][j]

def c(l):
    last = len(l) - 1
    ret = 0
    for i,j in enumerate(l):
        if i == last:
            return ret
        ret += t[j-1][l[i+1]-1]

print(min([c(i) for i in permutations(r)]))

### FIXED CODE ###

N,M,R = map(int,input().split())
r = list(map(int,input().split()))
from itertools import permutations
from scipy.sparse.csgraph import dijkstra
t = [[float('inf') for i in range(N)] for j in range(N)]

for i in range(M):
    a,b,c = map(int, input().split())
    t[a-1][b-1] = t[b-1][a-1] = c
t=dijkstra(t).astype(int)
def c(l):
    ret = 0
    for i in range(R-1):
        ret += t[l[i]-1][l[i+1]-1]
    return ret

print(min([c(i) for i in permutations(r)]))
def cal_cnt(num):
  cnt = 0
  for bit in format(num, 'b'):
    if bit == '1':
      cnt += 1

  return cnt


def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1) if base_cnt > 1 else 0

  memo = tuple(map(cal_cnt, range(n)))

  dp = [None] * n
  dp[0] = 0

  def f(num, cnt):
    if num < n and dp[num] is not None:
      return dp[num]

    nxt = num % cnt
    res = 1 + f(nxt, memo[nxt])
    if num < n:
      dp[num] = res

    return res


  for i in range(n - 1, -1, -1):
    num = None

    if src[n - i - 1] == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    else:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod

    print(1 + f(num, memo[num]))


main()


### FIXED CODE ###


def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1) if base_cnt > 1 else 0

  for i, s in enumerate(src):
    i = n - 1 - i
    num = None

    if s == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    elif base_cnt > 1:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod
    else:
      print(0)
      continue

    print(1 + f(num))


main()
from collections import Counter
n = int(input())
s0 = list(input())
s1 = list(input())
match = list((Counter(s0) & Counter(s1)).elements())
for i in range(n-2):
    s = list(input())
    match = list((Counter(match) & Counter(s)).elements())
match.sort()
print("".join(match))

### FIXED CODE ###

from collections import Counter
n = int(input())
if n == 1:
    s0 = list(input())
    s0.sort()
    print("".join(s0))
else:
    s0 = list(input())
    s1 = list(input())
    match = list((Counter(s0) & Counter(s1)).elements())
    for i in range(n-2):
        s = list(input())
        match = list((Counter(match) & Counter(s)).elements())
    match.sort()
    print("".join(match))
A,B = map(int,input().split())

if 13 <= A:
    print(B)
elif 6 <= A:
    print(int(B/2))
else :
    print(0

### FIXED CODE ###

A,B = map(int,input().split())
 
if 13 <= A:
    print(B)
elif 6 <= A:
    print(int(B/2))
else :
    print(0)
from collections import deque

h,w=map(int,input().split())
a=[input() for i in range(h)]
lis=[[-1 for i in range(w)] for j in range(h)]
q=deque()


for i in range(w):
  for j in range(h):
    if a[i][j]=="#":
      q.append((i,j))
      lis[i][j]=0


while q:
  cur=q.popleft()

  if 0<=cur[0]+1<=h-1 and 0<=cur[1]<=w-1:
    if lis[cur[0]+1][cur[1]]==-1:
      lis[cur[0]+1][cur[1]]=lis[cur[0]][cur[1]]+1
      q.append((cur[0]+1,cur[1]))
  
  if 0<=cur[0]-1<=h-1 and 0<=cur[1]<=w-1:
    if lis[cur[0]-1][cur[1]]==-1:
      lis[cur[0]-1][cur[1]]=lis[cur[0]][cur[1]]+1
      q.append((cur[0]-1,cur[1]))

  
  if 0<=cur[0]<=h-1 and 0<=cur[1]+1<=w-1:
    if lis[cur[0]][cur[1]+1]==-1:
      lis[cur[0]][cur[1]+1]=lis[cur[0]][cur[1]]+1
      q.append((cur[0],cur[1]+1))
      
  if 0<=cur[0]<=h-1 and 0<=cur[1]-1<=w-1:
    if lis[cur[0]][cur[1]-1]==-1:
      lis[cur[0]][cur[1]-1]=lis[cur[0]][cur[1]]+1
      q.append((cur[0],cur[1]-1))      
  
print(max(max(l) for l in lis))



### FIXED CODE ###

from collections import deque

h,w=map(int,input().split())
a=[input() for i in range(h)]
lis=[[-1 for i in range(w)] for j in range(h)]
q=deque()


for i in range(h):
  for j in range(w):
    if a[i][j]=="#":
      q.append((i,j))
      lis[i][j]=0


while q:
  cur=q.popleft()
  i,j=cur[0],cur[1]

  if 0<=i+1<=h-1 and 0<=j<=w-1:
    if lis[i+1][j]==-1:
      lis[i+1][j]=lis[i][j]+1
      q.append((i+1,j))
  
  if 0<=i-1<=h-1 and 0<=j<=w-1:
    if lis[i-1][j]==-1:
      lis[i-1][j]=lis[i][j]+1
      q.append((i-1,j))

  
  if 0<=i<=h-1 and 0<=j+1<=w-1:
    if lis[i][j+1]==-1:
      lis[i][j+1]=lis[i][j]+1
      q.append((i,j+1))
      
  if 0<=i<=h-1 and 0<=cur[1]-1<=w-1:
    if lis[i][j-1]==-1:
      lis[i][j-1]=lis[i][j]+1
      q.append((i,j-1))      
  
print(max(max(l) for l in lis))
N,L = map(int, input().strip().splip(' '))
print(''.join(sorted([input().strip() for _ in range(N)])))

### FIXED CODE ###

N,L = map(int, input().strip().split(' '))
print(''.join(sorted([input().strip() for _ in range(N)])))
N, K = map(int, input().split())
A = list(map(int, input().split()))
v = []
now = 0
for i in range(K):
  p = A[now]
  now = p-1
  if p in v:
    j = v.index(p)
    df = i-j
    Kn = (K-i-1) % df
    p = v[j+Kn]
    break
  else:
    v.append(p)
print(p)

### FIXED CODE ###

s = input()
t = input()

if len(s)+1 == len(t) and s == t[:len(s)]:
  print("Yes")
else:
  print("No")
a = input().split()
x=a[0]
y=a[1]
z=a[2]
if x=y:
    if x=z:
        print("no")
    else:
        print("yes")
else:
    if x=z:
        print("yes")
    else:
        if y=z:
            print("yes")
        else:
            print("no")
            
            

### FIXED CODE ###

a = input().split()
x=a[0]
y=a[1]
z=a[2]
if x==y:
    if x==z:
        print("No")
    else:
        print("Yes")
else:
    if x==z:
        print("Yes")
    else:
        if y==z:
            print("Yes")
        else:
            print("No")
s = input()
ans = []
for i in range(len(s) - 2):
    ans.append(abs(s[i:i+3]) - 753)
print(min(ans))

### FIXED CODE ###

s = str(input())
ans = 1000
for i in range(len(s)-2):
    x = int(s[i:i+3])
    ans = min(ans, abs(x-753))
print(ans)
s=input()
l=len(s)
N=int(input())
for scope in range(1,1+l):
  for first in range(1+l-scope):
    if not s[fist:first+scope] in li:
      li.append(s[first:first+scope])
print(li[-N])

### FIXED CODE ###

str=input()
K=int(input())
s=set()
for scope in range(1,K+1):
    for f in range(len(str)-scope+1):
        s.add(str[f:f+scope])
print(sorted([x for x in s])[K-1])
n = int(input())
ans = float("-INF")
f = [[0 for i in range(10)] for i in range(n)]
p = [[0 for i in range(10)] for i in range(n)]
for i in range(n):
  ft = list(map(int, input().split()))
  for j in range(10):
    f[i][j] = ft[j]
for i in range(n):
  pt = list(map(int, input().split()))
  for j in range(10):
    p[i][j] = pt[j]

for i in range(1, 2**10):
  t = 0
  for j in range(n):
    c = 0
    for k in range(10):
      if i>>k&1 and f[j][k]:
        c += 1
    t += p[j][c]
  ans = max(ans, t)
print(ans)

### FIXED CODE ###

n = int(input())
ans = float("-INF")
f = [[0 for i in range(10)] for i in range(n)]
p = [[0 for i in range(11)] for i in range(n)]
for i in range(n):
  ft = list(map(int, input().split()))
  for j in range(10):
    f[i][j] = ft[j]
for i in range(n):
  pt = list(map(int, input().split()))
  for j in range(11):
    p[i][j] = pt[j]

for i in range(1, 2**10):
  t = 0
  for j in range(n):
    c = 0
    for k in range(10):
      if i>>k&1 and f[j][k]:
        c += 1
    t += p[j][c]
  ans = max(ans, t)
print(ans)
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
cd = [list(map(int,input().split())) for _ in range(n)]

ab.sort()
cd.sort()

abf = [0]*n
cdf = [0]*n
que = [[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if ab[j][0] < cd[i][0] and ab[j][1] < cd[i][1] and \
        abf[j] == 0 and cdf[i] == 0:
      que[i].append(j)

qn = []
for i in range(n):
  qn.append([i,len(que[i])])
qn.sort()
print(qn)
while len(qn) > 0:
  for i in range(len(qn)):
    for idx in que[qn[i][0]]:
      print(idx)
      if abf[idx] == 0:
        abf[idx] = 1
        qn.pop(i)
  
print(sum(abf))


### FIXED CODE ###

n = int(input())
AB = [list(map(int,input().split())) for _ in range(n)]
CD = [list(map(int,input().split())) for _ in range(n)]

que = [[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if AB[i][0] < CD[j][0] and AB[i][1] < CD[j][1]:
      que[j].append(i)

def dfs(i,v):
  
  for a in que[i]:
    if a in v:
      continue
    v.add(a)
    if ab[a] == -1 or dfs(ab[a], v):
      ab[a] = i
      return True
  return False
      
v = [set() for _ in range(n)]   
ab = [-1]*n

print(sum(dfs(i, set()) for i in range(n)))
b=int(input())

if input()==A:
  print('T')
elif input()==T:
  print('A')
elif input()==C:
  print('G')
else:
  print('C')

### FIXED CODE ###

n=input()
if n=='A':
    print('T')
elif n=='G':
    print('C')
elif n=='T':
    print('A')
else:
    print('G')
while 1:
H , W = map(int, raw_input().split())

if H == W == 0:
  break

for i in range(H):
  for j in range(W):
    print "#",
  print ""
    

### FIXED CODE ###

while 1:
  h, w = map(int, raw_input().split())
  if h == 0 and w == 0:
    break
  for i in range(h):
    print "#" * w
  print""
n = int(input())

for i in range(n):
    x = input()
    y = input()
    ans = int(x) + int(y)
    if len(x) > 80 or len(y) > 80 or len(str(ans)) > 80:
        print("overflow")
    else:
        print(ans)

### FIXED CODE ###

n = int(input())

for i in range(n):
    x = input()
    y = input()
    ans = int(x) + int(y)
    if len(x) > 80 or len(y) > 80 or len(str(ans)) > 80:
        print("overflow")
    else:
        print(ans)
import math

N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)
if K == 0:
    print(sum(H))
elif K >= N:
    print(0)
else:
    [H.pop(i) for i in range(K)]
    print(sum(H))


### FIXED CODE ###

import math

N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()
if K == 0:
    print(sum(H))
elif K >= N:
    print(0)
else:
    H = H[:-K]
    print(sum(H))
a,b,c = sorted(map(int,input().split()))

if a+b =c:
    print("Yes")
else:
    print("No")



### FIXED CODE ###


can = list(map(int,input().split()))

#list 並び替え→最初と最後足して == 真ん中　ならばYES!!!

can.sort()

if can[0]+can[1] == can[2]:
    print("Yes")
else:
    print("No")
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a = ni()
b = ni()

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b = na()

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
import sys

sys.setrecursionlimit(1000000)
n, k = map(int, input().split())
mod = 10**9+7

nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print((cmb((n - k + 1), i) * cmb(k - 1, i - 1)) % mod)


### FIXED CODE ###

import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7

def cmb_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    if n -k +1 >=i:
        print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))
    else:
        print(0)
x = int(input())
t = int(input())

print(max(x-t, 0))

### FIXED CODE ###

x,t = map(int, input().split())
print(max(x-t, 0))
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i]) == H[i]):
        cnt += 1

print(cnt)

### FIXED CODE ###

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)
nums = input().split(" ")
A = int(nums[0])
B = int(nums[1])
K = int(nums[2])

for i in tqdm(range(0,K)):
  if A >= 1:
    A -= 1
  elif B >= 1:
    B -= 1

print(A, end=" ")
print(B)

### FIXED CODE ###

nums = input().split(" ")
A = int(nums[0])
B = int(nums[1])
K = int(nums[2])

"""
ここで、まずはAとKの比較を行って、Aの方が大きければその場で試行は終了
し、Kの方が大きければ、A=0となり、その差|A-K|は残りのBから引くものになる。
"""
if A >= K:
  A -= K
  print(A, end=" ")
  print(B)
else:
  K -= A
  A = 0
  B -= K
  if B < 0:
    B = 0
  print(A, end=" ")
  print(B)