Harryxun/stf_run huggingface dataset:
from collections import defaultdict
N, M = map(int, input().split())  # ちょうどN桁, M個のクエリ
correspondence = defaultdict(set)
for _ in range(M):
    s, c = map(int, input().split())
    correspondence[s].add(c)
# print(correspondence)
for k, v in correspondence.items():  # 要素が複数あったら-1を出力
    if len(v) > 1:
        print(-1)
        exit()

ans = ""
for i in range(1, N+1):
    if i in correspondence.keys():  # 指定があるならばそれにする
        ans += str(list(correspondence[i])[0])
    else:
        ans += "0"  # ないならば0にする
if ans[0] == "0":
    ans = list(ans)
    ans[0] = "1"
    ans = "".join(ans)

if N == 1:
    print(list(correspondence[1])[0])
    exit()

if 1 in correspondence.keys() and list(correspondence[1])[0] == 0:  # 1桁目が0に指定されているなら終わり
    print(-1)
else:
    print(ans)

# for i in range(1, 1000):
#     i = str(i)
#     flag = True
#     tmp = True
#     for k in correspondence.keys():
#         if k > len(i):
#             tmp = False
#             break
#         if i[k-1] != str(list(correspondence[i])[0]):
#             flag = False
#     if flag and tmp:
#         print(i)
#         exit()
# print(-1)


### FIXED CODE ###

from collections import defaultdict
N, M = map(int, input().split())  # ちょうどN桁, M個のクエリ
correspondence = defaultdict(set)
for _ in range(M):
    s, c = map(int, input().split())
    correspondence[s].add(c)
# print(correspondence)
if M == 0:
    if N == 1:
        print(0)
        exit()
    print("1"+"0"*(N-1))
    exit()
for k, v in correspondence.items():  # 要素が複数あったら-1を出力
    if len(v) > 1:
        print(-1)
        exit()
ans = ""
for i in range(1, N+1):
    if i in correspondence.keys():  # 指定があるならばそれにする
        ans += str(list(correspondence[i])[0])
    else:
        ans += "0"  # ないならば0にする
if ans[0] == "0":
    ans = list(ans)
    ans[0] = "1"
    ans = "".join(ans)

if N == 1 and 1 in correspondence.keys():
    print(list(correspondence[1])[0])
    exit()

if 1 in correspondence.keys() and list(correspondence[1])[0] == 0:  # 1桁目が0に指定されているなら終わり
    print(-1)
else:
    print(ans)
def dfs(i, j):
    visited[i][j] = True
    res_b = 0
    res_w = 0
    if N[i][j]:
        res_b += 1
    else:
        res_w += 1
    for di, dj in d:
        if i + di < 0 or i + di >= H or j + dj < 0 or j + dj >= W:
            continue
        if N[i][j] == N[i+di][j+dj]:
            continue
        if visited[i+di][j+dj]:
            continue
        tmp_b, tmp_w = dfs(i + di, j + dj)
        res_b += tmp_b
        res_w += tmp_w
    return res_b, res_w

H, W = map(int, input().split())
N = [[False] * W for _ in range(H)]
for i in range(H):
    s = input()
    for j in range(W):
        N[i][j] = (s[j] == "#")

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = [[False] * W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if not N[i][j]:
            continue
        if visited[i][j]:
            continue
        b, w = dfs(i, j)
        ans += (b * w)

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

def dfs(i, j):
    visited[i][j] = True
    res_b = 0
    res_w = 0
    if N[i][j]:
        res_b += 1
    else:
        res_w += 1
    for di, dj in d:
        if i + di < 0 or i + di >= H or j + dj < 0 or j + dj >= W:
            continue
        if N[i][j] == N[i+di][j+dj]:
            continue
        if visited[i+di][j+dj]:
            continue
        tmp_b, tmp_w = dfs(i + di, j + dj)
        res_b += tmp_b
        res_w += tmp_w
    return res_b, res_w

H, W = map(int, input().split())
N = [[False] * W for _ in range(H)]
for i in range(H):
    s = input()
    for j in range(W):
        N[i][j] = (s[j] == "#")

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = [[False] * W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if not N[i][j]:
            continue
        if visited[i][j]:
            continue
        b, w = dfs(i, j)
        ans += (b * w)

print(ans)
N, R = map(int, input().split())
if N >= 10:
  I == R
  print(I)
else:
  I = R+100*(10-N)
  print(I)

### FIXED CODE ###

N, R = map(int, input().split())
if N >= 10:
  I = R
  print(I)
else:
  I = R+100*(10-N)
  print(I)
n=int(input())
a=(n-1)*n/2
print(int(a))


### FIXED CODE ###

s=input()
t=input()
cnt=0
for i in range(3):
  if s[i]==t[i]:
    cnt+=1
print(cnt)
n,x = list(map(int,input().split()))
data = [int(s) for s in input().split()]
dis = [None] * (n-1)
#distanceの生成
for i in range(n-1):
    dis[i] = abs(data[i+1] - data[i])
if n == 1:
    print(abs(data[0]-x))
    exit()
dis.sort()
#distanceのGCD
ans = 0
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

for i in range(n-2):
    dis[i+1] = gcd(dis[i+1],dis[i])
    
print(dis[i+1])

### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
n,x = list(map(int,input().split()))
data = [int(s) for s in input().split()]
dis = [None] * (n-1)
#distanceの生成
for i in range(n-1):
    dis[i] = abs(data[i+1] - data[i])
if n == 1:
    print(abs(x-data[0]))
    exit()

dis.sort()
if n == 2:
    temp = min(abs(x-data[0]),abs(x-data[1]))
    print(gcd(temp,dis[0]))
    exit()
#distanceのGCD



for i in range(n-2):#n-2→n == 2 の時を考慮
    dis[i+1] = gcd(dis[i+1],dis[i])
    
print(dis[i+1])
N=int(input())
A=list(map(int,input().split()))

dict={}
dict[max(A)+1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
        if a+1 not in dict.keys():
            dict[a+1]=0

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0


### FIXED CODE ###

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

dict={}

for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
dict[N]=0

for i in range(1,N+1):
    if i in dict.keys():
        print(dict[i])
    else:
        print(0)
N, Q = map(int, input().split())

class Node():
    def __init__(self):
        self.children = []
        self.count = 0



def add_count(G, v):
    for child in G[v].children:
        G[child].count += G[v].count
        add_count(G, child)


def main():
    G = [Node() for _ in range(N)]
    for _ in range(N-1):
        p, c = map(int, input().split())
        G[p-1].children.append(c-1)

    for _ in range(Q):
        p, x = map(int, input().split())
        G[p-1].count += x

    add_count(G, 0)

    counts = [node.count for node in G]
    print(*counts)

main()

### FIXED CODE ###

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

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x
    
q = [(1,0)]
while q:
    x,parent = q.pop()
    value[x] += value[parent]
    for y in graph[x]:
        if y == parent:
            continue
        q.append((y,x))

answer = ' '.join(map(str,value[1:]))
print(answer)
import numpy as np
N, Q=map(int,input().split())
S=input()
L =[list(map(int,input().split()))for i in range(Q)]
c = [0]*(N)  #ACのチェック
s = [0]*(N)  #ACの累積和
ans = [0]*Q 

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    c[i+1] = 1
s = np.cumsum(c)
for i in range(Q):
  ans[i] = s[L[i][1]-1]-s[L[i][0]-1]

for i in ans:
  print(i)

### FIXED CODE ###

import numpy as np
N, Q=map(int,input().split())
S=input()
L =[list(map(int,input().split()))for i in range(Q)]
c = [0]*(N)  #ACのチェック
s = [0]*(N)  #ACの累積和
ans = [0]*Q 

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    c[i+1] = 1
s = np.cumsum(c)
for i in range(Q):
  ans[i] = s[L[i][1]-1]-s[L[i][0]-1]

for i in ans:
  print(i)
import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


### FIXED CODE ###

import numpy as np
import sys

n = int(input())

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

a_sum = sum(a)
# x[i]はi番目のダムに溜まった水の半分
x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

for wa in x:
    print(wa*2, end=' ')
N, K = map(int, input().split())
S = input()

tmp_count = 1
count_list = []
for i in range(N-1):
    if S[i] == "0" and S[i+1] == "0":
        tmp_count += 1
    elif S[i] == "1" and S[i+1] == "1":
        tmp_count += 1
    elif S[i] == "0" and S[i+1] == "1":
        count_list.append(tmp_count)
        tmp_count = 1
    elif  S[i] == "1" and S[i+1] == "0":
        count_list.append(tmp_count)
        tmp_count = 1
count_list.append(tmp_count)

count_sakadati = 0
tmp_list = []
if S[0] == "0":
    for i in range(K):
        tmp_max = 0
        tmp_max_num = 1
        for j in range(0, len(count_list)-1, 2):
            if j == 0:
                tmp_max = count_list[j] + count_list[j+1]
                tmp_max_num = j
            else:
                count_list[j- 1] + count_list[j] + count_list[j+1] > tmp_max
                tmp_max = count_list[j- 1] + count_list[j] + count_list[j+1]
                tmp_max_num = j
        if tmp_max_num == 0:
            del count_list[0]
            del count_list[1]
            count_list.insert(0, tmp_max)
        else:
            del count_list[tmp_max_num-1]
            del count_list[tmp_max_num-1]
            del count_list[tmp_max_num-1]
            count_list.insert(tmp_max_num-1, tmp_max)
else:
    for i in range(K):
        tmp_max = 0
        tmp_max_num = 1
        for j in range(1, len(count_list)-1, 2):
            if count_list[j- 1] + count_list[j] + count_list[j+1] > tmp_max:
                tmp_max = count_list[j- 1] + count_list[j] + count_list[j+1]
                tmp_max_num = j
        del count_list[tmp_max_num-1]
        del count_list[tmp_max_num-1]
        del count_list[tmp_max_num-1]
        count_list.insert(tmp_max_num-1, tmp_max)
            
print(max(count_list))

### FIXED CODE ###

N, K = map(int, input().split())
S = input()

bl = []
if S[0] == "0":
    bl.append(0)
bl.append(0)
for i in range(1, N):
    if S[i-1] != S[i]:
        bl.append(i)
bl.append(N)
bl.append(N)

nbl = len(bl)
m = [bl[i+2 * K+1] - bl[i] 
     for i in range(nbl - 2*K-1) if i%2 == 0]
if len(m) == 0:
    print(N)
else:
    print(max(m))
s = list(int(input()))
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print('Bad')
else:
  print('Good')

### FIXED CODE ###

s = list(input())
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print('Bad')
else:
  print('Good')
n = int(input())
x = input()
k = x.count("1")
cnt = 0
s = int(x, 2)
if k != 1:
	k1 = s % (k-1)
k2 = s % (k+1)
while s != 0:
	targ = bin(s).count("1")
	s = s % targ
	cnt += 1

def ev(n):
	cnt = 0
	while n != 0:
		m = bin(n).count("1")
		n = n % m
		cnt += 1
	return cnt

for i in range(n):
	if x[i] == "0":
		targ = k+1
		print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
	else:
		targ = k-1
		print(ev((k1-pow(2, n-i-1, targ)) % targ)+1)

### FIXED CODE ###

n = int(input())
x = input()
k = x.count("1")
cnt = 0
s = int(x, 2)
if k >= 2:
	k1 = s % (k-1)
k2 = s % (k+1)
while s != 0:
	targ = bin(s).count("1")
	s = s % targ
	cnt += 1

def ev(n):
	cnt = 0
	while n != 0:
		m = bin(n).count("1")
		n = n % m
		cnt += 1
	return cnt

if k != 1:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(ev((k1-pow(2, n-i-1, targ)) % targ)+1)
else:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(0)
#!/usr/bin/env python3
import sys

def main():
    
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    t=sum(a)
    a.sort()
    a.reverse()
    print(a[m])
    
    if a[m-1]>=t/(4*m):
        print("Yes")
    else:
        print("No")

main()



### FIXED CODE ###

#!/usr/bin/env python3
import sys

def main():
    
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    t=sum(a)
    a.sort()
    a.reverse()
    
    if a[m-1]>=t/(4*m):
        print("Yes")
    else:
        print("No")

main()
a,b,c,d = map(int,input().split())
l = list(range(b))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)



### FIXED CODE ###

A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)
date=input()
#if date[0:4]=="2017":
date="2018"+[4:]
print(date)

### FIXED CODE ###

date=input()
#if date[0:4]=="2017":
date="2018"+date[4:]
print(date)
import numpy as np

N, Q = map(int, input().split())
S = input()
ac_array = np.zeros(N)
ans = []

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        ac_array[i] += 1
#         ac_array[i+1] += 1
# print(ac_array)
t = []
t.append(0)
for j in range(N):
    t.append(ac_array[:j+1].sum())
#     print(ac_array[:j+1])
# q_list = np.zeros([Q, 2])
# print(ac_array, t)
for q in range(Q):
    q_l, q_r = map(int, input().split())
    ans.append(t[q_r-1]-t[max(q_l-1, 0)])
    
#     q_list[q, 0], q_list[q, 1] = map(int, input().split())
#     ans.append(ac_array[int(q_list[q, 0]-1):int(q_list[q,1]-1)].sum())   

for a in range(Q):
    print(int(ans[a]))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])
n=int(input())
s=input()
b=s.count("#")
w=s.count(".")
cnt=0
ind=n-s[::-1].index(".")
p=s[:ind].count("#")
print(min(b,w,p))


### FIXED CODE ###

n=int(input())
s=input()
b=s.count("#")
w=s.count(".")
M=n
noww=0
for i in range(n-1):
    if s[i]==".":
        noww+=1
        if s[i+1]=="#":
            M=min(M,(i-noww+1)+w-noww)

print(min(b,w,M))
f = open("C:/Users/naoki/Desktop/Atcoder/input.txt")

H, W, M = map(int, f.readline().split())
hws = [list(map(lambda x :int(x)-1, f.readline().split())) for _ in range(M)]

booms = [set() for _ in range(H)]

yoko = [0 for _ in range(W)]
tate = [0 for _ in range(H)]

for hw in hws:
    tate[hw[0]] += 1
    yoko[hw[1]] += 1
    booms[hw[0]].add(hw[1])
    
max_tate = max(tate)
max_yoko = max(yoko)


tate_candidates = []
yoko_candidates = []

for i in range(H):
    if tate[i] == max_tate:
        tate_candidates.append(i)
        
for i in range(W):
    if yoko[i] == max_yoko:
        yoko_candidates.append(i)

exist = 0
for tate_candidate in tate_candidates:
    for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break

print(max_tate + max_yoko + (exist-1))

### FIXED CODE ###

H, W, M = map(int, input().split())
hws = [list(map(lambda x :int(x)-1, input().split())) for _ in range(M)]

booms = [set() for _ in range(H)]

yoko = [0 for _ in range(W)]
tate = [0 for _ in range(H)]

for hw in hws:
    tate[hw[0]] += 1
    yoko[hw[1]] += 1
    booms[hw[0]].add(hw[1])
    
max_tate = max(tate)
max_yoko = max(yoko)


tate_candidates = []
yoko_candidates = []

for i in range(H):
    if tate[i] == max_tate:
        tate_candidates.append(i)
        
for i in range(W):
    if yoko[i] == max_yoko:
        yoko_candidates.append(i)

exist = 0
for tate_candidate in tate_candidates:
    for yoko_candidate in yoko_candidates:
        if yoko_candidate not in booms[tate_candidate]:
            exist = 1
            break
    else:
        continue
    break
print(max_tate + max_yoko + (exist-1))
import math
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for i in range(N):
    c_=c*A[i]//math.gcd(c,A[i])
    a=a*c_/c+c_/A[i]
    c=c_
print(int(a%w))

### FIXED CODE ###

import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c=c*A_//fractions.gcd(c,A_)
for A_ in A:
    a+=c//A_
print(int(a%w))
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N,M = inputMap()
    ab = []
    for i in range(N):
        a,b = inputMap()
        if a > M:
            continue
        ab.append((a,b))
        
    ab = sorted(ab, key=lambda x:(x[0],-x[1]))
    pq = []
    heapify(pq)
    
    ans = 0
    for i in range(1,M+1):
        ind = []
        for j,val in enumerate(ab):
            a,b = val
            if a > i:
                break
            if i == a:
                heappush(pq, -b)
                ind.append(j)
                
        if len(pq) > 0:
            tmp = heappop(pq) * (-1)
            ans += tmp
            
        for k in ind:
            ab.pop(k)
    
    print(ans)
    
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N,M = inputMap()
    ab = []
    heapify(ab)
    for i in range(N):
        a,b = inputMap()
        if a > M:
            continue
        heappush(ab, (a,b))
    
    ans = 0
    pq = []
    heapify(pq)
    for i in range(1,M+1):
        while True:
            if len(ab) == 0 or ab[0][0] != i:
                break
            a,b = heappop(ab)
            heappush(pq, -b)
            
        if len(pq) > 0:
            ans = ans + (heappop(pq) * (-1))
        
    
    print(ans)
    
if __name__ == "__main__":
	main()
import fractions
import numpy as np
n,x=map(int,input().split())
li=np.array(input().split(),dtype=np.int64)

li=abs(li-x)

if len(li)==1:
    print(li[0])
else:
    mini=fractions.gcd(li[0],li[1])
    for i in range(2,n):
        gc=math.gcd(mini,li[i])
        mini=gc
    print(mini)
    

### FIXED CODE ###

import fractions
import numpy as np
n,x=map(int,input().split())
li=np.array(input().split(),dtype=np.int64)

li=abs(li-x)

if n==1:
    print(li[0])
else:
    ans=0
    for i in li:
        ans=fractions.gcd(ans,i)
    print(ans)
while True
  a,op,b = raw_input().split
  a,b = map(int,[a,b])

  if op == "+";
     print a+b
  if op == "-";
     print a-b
  if op == "*";
     print a*b
  if op == "/";
     print a/b

### FIXED CODE ###

while True:
  a,op,b = raw_input().split()
  a,b = map(int,[a,b])

  if op == "?":
     break

  if op == "+":
     print (a+b)
  elif op == "-":
     print (a-b)
  elif op == "*":
     print (a*b)
  elif op == "/":
     print (a/b)
n,m,x=map(int,input().split())
for i in range(m):
    a=map(int,input().split())
    count1=0
    count2=0
    for b in a:
        if b<x:
            count1+=1
        else:
            count2+=1
print(min(count1,count2))
        


### FIXED CODE ###

n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))
import math

n, X = map(int, input().split())
x = list(map(int, input().split()))

if n == 1:
    print(abs(X-x[0]))
    exit()

x.append(X)

x.sort()

xx=[]

for i in range(1,n):
    xx.append(x[i]-x[i-1])

xgcd = math.gcd(xx[0],xx[1])

for i in range(2,n-1):
    xgcd=math.gcd(xgcd,xx[i])
print(xgcd)

### FIXED CODE ###

import fractions

n, X = map(int, input().split())
x = list(map(int, input().split()))

xx = []

for i in range(n):
    xx.append(abs(x[i]-X))

if n == 1:
    print(xx[0])
else:
    xg = xx[0]
    for i in range(1,n):
        xg = fractions.gcd(xg,xx[i])
    print(xg)
N = int(input())
nlist = [int(i) for i in input().split()]
a = 0
b = 0
for i in range(N):
    if N % 2 == 1:
        a += nlist[i]
    else:
        b += nlist[i]
print(a-b)


### FIXED CODE ###

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

a = N % 500
if a <= A:
    print("Yes")
else:
    print("No")
a, b=map(int,imput().split())
if a<b:
  print("a < b")
elif a>b:
  print("a > b")
elif a==b:
  print("a == b")
else:
  pass

### FIXED CODE ###

a, b=map(int,input().split())
if a<b:
 print("a < b")
elif a>b:
 print("a > b")
elif a==b:
 print("a == b")
else:
 pass
input()
b = [int(i) for i in input().split()]

if 0 not in b:
  last = 1
  for i in b:
      last*=i
      if last > 10**18:
      	last = -1
        break
else:
  last = 0
    
print(last)

### FIXED CODE ###

a=[int(i) for i in input().split()]
print(a[0] * a[1])
n, k = map(int, input().split())
h = list(map(int, input().split()))
if h == 0:
  print(sum(h))
elif h >= n:
  print(0)
else:
  h.sort()
  print(sum(h[:n-k]))


### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
if k == 0:
  print(sum(h))
elif k >= n:
  print(0)
else:
  h.sort()
  print(sum(h[:n-k]))
import numpy as np
from numba import njit
from bisect import *
n, m = map(int, input().split())
A, B, C = zip(*(map(int, input().split()) for _ in range(n)))
D, E, F = zip(*(map(int, input().split()) for _ in range(m)))
X = sorted(set(C + E + F))
Y = sorted(set(A + B + D))
H = len(Y)-1
W = len(X)-1
def TX(i):
    return bisect(X, i)-1
def TY(i):
    return bisect(Y, i)-1
U = np.ones((H+1, W))
for d, e, f in zip(D, E, F):
    d, e, f = TY(d), TX(e), TX(f)
    U[d, e:f] = False
L = np.ones((H, W+1))
for a ,b, c in zip(A, B, C):
    a, b, c = TY(a), TY(b), TX(c)
    L[a:b, c] = False
S = np.outer(np.diff(Y), np.diff(X)) 
@njit
def f(i,j):
    s = [(i,j)]
    v = set()
    r = 0
    while s:
        i, j = s.pop()
        if (i,j) in v:
            continue
        v.add((i,j))
        if not (0<=i<H and 0<=j<W):
            print('INF')
            break
        r += S[i][j]
        if U[i][j]:
            s.append((i-1,j))
        if U[i+1][j]:
            s.append((i+1,j))
        if L[i][j]:
            s.append((i,j-1))
        if L[i][j+1]:
            s.append((i,j+1))
    else:
        print(r)
f()

### FIXED CODE ###

import numpy as np
from numba import njit
from bisect import *
n, m = map(int, input().split())
A, B, C = zip(*(map(int, input().split()) for _ in range(n)))
D, E, F = zip(*(map(int, input().split()) for _ in range(m)))
X = sorted(set(C))
Y = sorted(set(D))
H = len(Y)-1
W = len(X)-1
def TX(i):
    return bisect(X, i)-1
def TY(i):
    return bisect(Y, i)-1
U = np.ones((H+1, W))
for d, e, f in zip(D, E, F):
    #d, e, f = TY(d), TX(e), TX(f)
    d = TY(d)
    e = bisect_left(X, e)
    f = bisect_right(X, f)-1
    U[d, e:f] = False
L = np.ones((H, W+1))
for a ,b, c in zip(A, B, C):
    #a, b, c = TY(a), TY(b), TX(c)
    c = TX(c)
    a = bisect_left(Y, a)
    b = bisect_right(Y, b)-1
    L[a:b, c] = False
S = np.outer(np.diff(Y), np.diff(X))
@njit
def dfs(i, j):
    s = [(i,j)]
    v = np.zeros((H,W))
    r = 0
    while s:
        i, j = s.pop()
        if not (0<=i<H and 0<=j<W):
            return -1
        if v[i,j]:
            continue
        v[i,j] = True
        r += S[i,j]
        if U[i,j]:
            s.append((i-1,j))
        if U[i+1,j]:
            s.append((i+1,j))
        if L[i,j]:
            s.append((i,j-1))
        if L[i,j+1]:
            s.append((i,j+1))
    return r
r = dfs(TY(0), TX(0))
print('INF' if r<0 else r)