Harryxun/stf_run huggingface dataset:
from collections import deque
H, W = map(int, input().split())
maze = [[0 for i in range(W)]for j in range(H)]
ans = -1
for i in range(H):
    S = input()
    for j in range(W):
        maze[i][j] = S[j]
        if maze[i][j] == '.':
            ans += 1

q = deque()
q.append([0, 0])
maze[0][0] = 0
while len(q) != 0:
    x, y = q.popleft()
    for i in range(4):
        nx, ny = x + [0, 1, 0, -1][i], y + [1, 0, -1, 0][i]
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        elif maze[ny][nx] == '#':
            continue
        elif maze[ny][nx] == '.':
            maze[ny][nx] = maze[y][x] + 1
            q.append([nx, ny])
print(ans - maze[H-1][W-1])



### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
maze = [[0 for i in range(W)]for j in range(H)]
ans = -1
for i in range(H):
    S = input()
    for j in range(W):
        maze[i][j] = S[j]
        if maze[i][j] == '.':
            ans += 1

q = deque()
q.append([0, 0])
maze[0][0] = 0
while len(q) != 0:
    x, y = q.popleft()
    for i in range(4):
        nx, ny = x + [0, 1, 0, -1][i], y + [1, 0, -1, 0][i]
        if nx < 0 or ny < 0 or nx >= W or ny >= H:
            continue
        elif maze[ny][nx] == '#':
            continue
        elif maze[ny][nx] == '.':
            maze[ny][nx] = maze[y][x] + 1
            q.append([nx, ny])
if maze[H-1][W-1] == '.':
    print(-1)
else:
    print(ans - maze[H-1][W-1])
s = input()

a = 0
for i in range(4):
  a += 1 if s[i:i+1] == "+" else a -= 1
print(a)


### FIXED CODE ###

s = input()
a = 0
for i in range(4):
  a = a + 1 if s[i:i+1] == '+' else a - 1

print(a)
A, B, K = (int(i) for i in input().split())
list = []
for i in range(101):
  if i != 0:
    if i % A == 0 and i % B == 0:
      list.append(i)
print(list[len(list)-K])


### FIXED CODE ###

A, B, K = (int(i) for i in input().split())
list = []
 
for i in range(101):
  if i != 0:
    if A % i == 0 and B % i == 0:
      list.append(i)
print(list[len(list)-K])
k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%n==0:
    print("OK")
    f=1
if f==0:
  print("NG")

### FIXED CODE ###

k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%k==0:
    f=1
if f==1:
  print("OK")
else:
  print("NG")
S = input()
T = input()
ns = len(S)
U = str[:ns]
if T == U:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

S = input()
T = input()
ns = len(S)
U = T[:ns]
if S == U:
  print("Yes")
else:
  print("No")
from collections import Counter 
n=int(input())
a=sorted(list(map(int,input().split())))
b=[]
c=[]
for i in list(Counter(a).values()):
  b.append(i)
for i in list(Counter(a).keys()):
  c.append(i)
ans=c.pop()*((b[-1])-1)
m=a[-1]
f=len(b)
for _ in range(f-2,-1,-1):
  if b[-1]>b[i]:
    b[-1]-=b[i]
    b.pop(i)
    c.pop(i)    
    ans+=b[i]*m
  else:
    ans+=m*b[-1]
    b[i]-=b[-1]
    m=c.pop()
    ans+=m*b[i]
    b.pop()
print(ans)

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))[::-1]
ans=0
for i in range(1,n):
  ans+=a[i//2]
print(ans)
score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x <= score[i]):
      print(x,score[i])
      i += 1

print(ranks[i])

### FIXED CODE ###

score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x < score[i]):
      i += 1

print(ranks[i])
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))
import math

N, K = mi()
A = li()

if K == 0:
    print(max(A))
    exit()

left = 0
right = max(A)

def count(num):
    cnt = 0
    for i in range(N):
        cnt += math.ceil(A[i] // num)
    
    return cnt


while True:
    mid = (left + right) // 2
    tmp = count(mid)
    if tmp == K:
        break
    elif tmp > K:
        if left == mid:
            mid += 1
            break
        left = mid
    else:
        right = mid

#print(mid)
if mid == 0:
    print(mid)
    exit()
right = mid

while True:
    #print(left, right)
    tmp = count(mid)
    #print(tmp, count(mid-1))
    if tmp == K and tmp != count(mid-1):
        #print(tmp, count(mid-1))
        print(mid)
        break
    if tmp == K:
        right = mid
    else:
        left = mid
    mid = (left + right) // 2

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #list(accumulate(A))
import math

N, K = mi()
A = li()

if K == 0:
    print(max(A))
    exit()

left = 0
right = max(A)

def count(num):
    cnt = 0
    for i in range(N):
        cnt += math.ceil(A[i] / num) - 1
    return cnt

while True:
    mid = (left + right) // 2
    if mid == 0:
        print(1)
        exit()
    tmp = count(mid)
    if right - left <= 1:
        mid = right
        break
    elif tmp > K:
        left = mid
    else:
        right = mid

right = mid

while True:
    tmp = count(mid)
    if right - left <= 1:
        print(right)
        break
    elif tmp == K:
        right = mid
    else:
        left = mid
    mid = (left + right) // 2
    if mid == 0:
        print(1)
        break
N = int(input())
divisors = []
for i in range(1,int(N**0.5)+1):
    #print(i)
    if N%i == 0:
        divisors.append(i)
        divisors.append(N//i)
divisors.remove(1)
#print(divisors)
ds = set(divisors)
ans = 0
for div in ds:

    if N//(div-1) == N%(div-1):
        ans += div-1
print(ans)

### FIXED CODE ###

N = int(input())
divisors = []
for i in range(1,int(N**0.5)+1):
    #print(i)
    if N%i == 0:
        divisors.append(i)
        divisors.append(N//i)
divisors.remove(1)
ds = set(divisors)
ans = 0
for div in ds:
    if div == 1:
        continue

    if N//(div-1) == N%(div-1):
        ans += div-1
print(ans)
S = input()
Q = int(input())

# print(S, Q)

queries = []
for i in range(Q):
    query = input()
    queries.append(query)

from collections import deque
slist = deque()
slist.append(S)
isReversed = False
for query in queries:
    if query == "1":
        isReversed = not isReversed
    else:
        t, f, c = query.split()
        if f=="1"
            if isReversed:
                slist.append(c)
            else:
                slist.appendleft(c)
        else:
            if isReversed:
                slist.appendleft(c)
            else:
                slist.append(c)
if isReversed:
    slist.reverse()

print("".join(slist))


### FIXED CODE ###

S = input()
Q = int(input())

queries = []
for i in range(Q):
    query = input()
    queries.append(query)

from collections import deque
slist = deque(list(S))
even = True
for query in queries:
    if query == "1":
        even = not even
    else:
        t, f, c = query.split()
        if f == '1':
            if even:
                slist.appendleft(c)
            else:
                slist.append(c)
        else:
            if even:
                slist.append(c)
            else:
                slist.appendleft(c)
if not even:
    slist.reverse()

print(''.join(slist))
import math
r = int(input())
area = r ** 2 * math.pi
circum = 2 * r * math.pi
print("{:f} {:f}".format(area, circum))

### FIXED CODE ###

import math
r = float(input())
area = r * r * math.pi
circum = 2 * r * math.pi
print("{:f} {:f}".format(area, circum))
h,w = map(int,input().split())
a = ["." for i in range(w+2)]
dot_map = [a]
for _ in range(h):
    l = list(input())
    l.insert(0, ".")
    l.append(".")
    dot_map.append(l)
dot_map.append(a)

for i in range(1, h+1):
    for j in range(1,w+1):
        if dot_map[i][j] == ".":
            counter = 0
            if dot_map[i-1][j-1] == "#":
                counter += 1
            if dot_map[i-1][j] == "#":
                counter += 1
            if dot_map[i-1][j+1] == "#":
                counter += 1
            if dot_map[i][j-1] == "#":
                counter += 1
            if dot_map[i][j+1] == "#":
                counter += 1
            if dot_map[i+1][j-1] == "#":
                counter += 1
            if dot_map[i+1][j] == "#":
                counter += 1
            if dot_map[i+1][j+1] == "#":
                counter += 1
            dot_map[i][j] = counter

for i in range(1, h+1):
    ans = dot_map[i]
    print("".join(ans[1:w+1]))

### FIXED CODE ###

h,w = map(int,input().split())
a = ["." for i in range(w+2)]
dot_map = [a]
for _ in range(h):
    l = list(input())
    l.insert(0, ".")
    l.append(".")
    dot_map.append(l)
dot_map.append(a)

for i in range(1, h+1):
    for j in range(1,w+1):
        if dot_map[i][j] == ".":
            counter = 0
            if dot_map[i-1][j-1] == "#":
                counter += 1
            if dot_map[i-1][j] == "#":
                counter += 1
            if dot_map[i-1][j+1] == "#":
                counter += 1
            if dot_map[i][j-1] == "#":
                counter += 1
            if dot_map[i][j+1] == "#":
                counter += 1
            if dot_map[i+1][j-1] == "#":
                counter += 1
            if dot_map[i+1][j] == "#":
                counter += 1
            if dot_map[i+1][j+1] == "#":
                counter += 1
            dot_map[i][j] = str(counter)

for i in range(1, h+1):
    ans = dot_map[i]
    print("".join(ans[1:w+1]))
l = [int(input()) for i in range(5)]
time = 0
for v in l:
  if v %10 == 0:
    time += v
    l.remove(v)
if l != []:
  m = min(list(map(lambda x:x%10,l)))
  find_min = False
  for v in l:
    if v %10 == m and not find_min:
      time += v
    else:
      time += calc_time(v)
print(time)

def calc_time(t):
  return (int(t/10)+1 )*10



### FIXED CODE ###

l = [int(input()) for i in range(5)]
rest = []
time = 0
for v in l:
  if v %10 == 0:
    time += v
  else:
    time += int(v/10)*10
    rest.append(v%10)
#print(rest)
if rest != []:
  time += ((len(rest)-1)*10)
  time += min(rest)
print(time)
n = int(input())
for i in range(n):
  t,x,y = map(int,input().split())
  if (x + y) > t :
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

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


A = a*b % 2

if A==0:
    print("Even")

else:
    print("Odd")
N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
  arr[listA[0]].sort()
for i in range(M):
  num = Y[i]
  for k in range(M):
    if arr[P[i]][k] == Y[i]:
      break
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))
print(arr)


### FIXED CODE ###

N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5+1)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
for i in range(N+1):
  arr[i].sort()
for i in range(M):
  #二部探索
  left = 0
  right = len(arr[P[i]])-1
  while left <= right:
    mid = (left+right)//2
    if arr[P[i]][mid] == Y[i]:
      k = mid
      break
    elif arr[P[i]][mid] > Y[i]:
      right = mid-1
    else:
      left = mid+1
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))
a=[int(input()) for i in range(5)]
minn=0
for i in a:
  minn=min(minn,int(i[-1]))
  summ+=(int(i)+9)//10
print(summ+minn)

### FIXED CODE ###

a=[int(input()) for i in range(5)]
minn,summ=10,0
for i in a:
  minn=min(minn,(i-1)%10)
  summ+=(i+9)//10
print(summ*10+minn-9)
import math
n = int(input())
a = list(map(int,input().split()))

a.sort()
#print(a)
flag = 0
if a[0] == a[1]:
    ans = 0
else:
    ans = 1
if a[0] == 1:
    print(ans)
    exit(0)

if 2 in a:
    flag = 1
    
dict = {a[0]:1}

for i in range(1,n):
    #print(str(i) + ":")
    for j in range(1,round(math.sqrt(a[i]))+1):
        if flag == 1 and a[i] % 2 == 0:
            break 
        if a[i] % j == 0:
            #print(j)
            if j in dict.keys():
                break
            if a[i] // j in dict.keys():
                break
        if j == round(math.sqrt(a[i])):
            ans += 1
            #print("ans:" + str(ans))
    dict[a[i]] = 1
    
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
largest = max(a)
b = [True] * (largest+1)
dict = {}
ans = 0
for num in a:
    if num in dict.keys():
        b[num] = False
    else:
        dict[num] = 1
        y = num * 2
        while(y <= largest):
            b[y] = False
            y += num
for num in a:
    if b[num] == True:
        ans += 1
print(ans)
import math

n = int(input())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if is_prime(n):
    print(1)
else:
    count = 0
    nums = []
    while n != 1:
        for i in range(2, 10*12):
            v, m = divmod(n, i)
            if m == 0:
                if i in nums:
                    continue

                nums.append(i)
                n = v
                count += 1
            else:
                pass

    print(count)

### FIXED CODE ###

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

print(a*b)
n = int(input())
lis = list(map(int,input().split()))
le = 0
ri = sum(lis)
ans = sum(lis)
cou = 0
for i in range(1,101):
  while lis[cou] == i:
    ri += lis[cou]
    le -= lis[cou]
    cou += 1
  ans = min(ans,abs(le-ri))
print(ans)


### FIXED CODE ###

n = int(input())
lis = list(map(int,input().split()))
ans = 10 ** 9
le = 0
ri = sum(lis)
ans = sum(lis)
for num in lis:
  le += num
  ri -= num
  ans = min(ans,abs(ri-le))
print(ans)
n = int(input())
w = [input() for i in range(n)]

def is_shiritori():
  if len(set(w)) != n:
    return 'No'
  for i in range(n-1):
    if w[n][-1] != w[n+1][0]:
      return 'No'
  return 'Yes'
print(is_shiritori())

### FIXED CODE ###

n = int(input())
w = [input() for i in range(n)]

def is_shiritori():
  if len(set(w)) != n:
    return 'No'
  for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
      return 'No'
  return 'Yes'

print(is_shiritori())
# import numpy as np
class UnionFind:
    def __init__(self, n):
        # self.parent = np.array([-1] * n)
        # self.size = np.array([1] * n)
        self.parent = [-1] * n
        self.size = [1] * n
    def find(self, x):
        if self.parent[x] == -1:
            return x
        else:
            a = self.find(self.parent[x])
            self.parent[x] = a
            return a
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            self.parent[x] = y
            self.size[y] += self.size[x]
    def get_size(self, x):
        return self.size[self.find(x)]
    def printout(self):
        print(self.parent)
        print(self.size)

N, M, K = map(int, input().split())
uf = UnionFind(N)

ab = [[int(i)-1 for i in input().split()] for j in range(M)]
cd = [[int(i)-1 for i in input().split()] for j in range(K)]

for a, b in ab:
    uf.union(a, b)

# ans =[uf.get_size(i)-1 for i in range(N)]

# for a, b in ab:
#     ans[a] -= 1
#     ans[b] -= 1

# for c, d in cd:
#     if uf.find(c) == uf.find(d):
#         ans[c] -= 1
#         ans[d] -= 1

# print(*ans)

### FIXED CODE ###

import sys #追加
sys.setrecursionlimit(500*500) #追加

class UnionFind:
    def __init__(self, n):
        self.parent = [-1] * n
        self.size = [1] * n
    def find(self, x):
        if self.parent[x] == -1:
            return x
        else:
            a = self.find(self.parent[x])
            self.parent[x] = a
            return a
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            self.parent[x] = y
            self.size[y] += self.size[x]
    def get_size(self, x):
        return self.size[self.find(x)]
    def printout(self):
        print(self.parent)
        print(self.size)

N, M, K = map(int, input().split())
uf = UnionFind(N)

ab = [[int(i)-1 for i in input().split()] for j in range(M)]
cd = [[int(i)-1 for i in input().split()] for j in range(K)]

for a, b in ab:
    uf.union(a, b) #RE

ans =[uf.get_size(i)-1 for i in range(N)]

for a, b in ab:
    ans[a] -= 1
    ans[b] -= 1

for c, d in cd:
    if uf.find(c) == uf.find(d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans)
N, X = map(int,input().split())
powder_list = [int(input()) for i in range(n)]
min_powder = min(powder_list)
ans = N
X -= sum(powder_list)
num = X//min_powder
print(ans + num )

### FIXED CODE ###

N, X = map(int, input().split())
m = [int(input()) for i in range(N)]
 
print(N + (X-sum(m))//min(m))
x=list(map(int, input()))
age=x[0]
cost=x[1]
if age<=5:
  print('0')
elif age>=6 and age<=12:
  print(a/2)
else:
  print(a)

### FIXED CODE ###

n,k=tuple(map(int,input().split()))
if n >= 13:
  print(k)
elif 6 <= n <= 12:
  print(k//2)
elif n <= 5:
  print(0)
N = int(input())
L = list(map(int, input().split()))
L.sort()
from itertools import combinations
from numba import njit


@njit
def solve():
    ans = 0
    for a, b, c in combinations(L, r=3):
        ans += a + b > c
    return ans


print(solve())


### FIXED CODE ###

# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
L = read_ints()
L.sort()
# import numpy as np
# L = np.array(L)
from bisect import bisect_left

cnt = 0
for i in range(N):
    a = L[i]
    for j in range(i+1, N):
        b = L[j]
        # ここで二分探索するか
        cnt += bisect_left(L, a+b) - (j+1)
        # L_tmp = L[j+1:]
        # cnt += np.sum(L_tmp < b+a)

print(cnt)
s = list(str(input()))
k = int(input())

zisyo = []
for i in range(len(s)):
    count = 0
    st = s[i]
    zisyo.append(st)
    while count <= n:
        count = count + 1
        try:
            st = st + s[i + count]
            zisyo.append(st)
        except:
            pass
    
zisyosort = list(sorted(list(set(zisyo))))
print(zisyosort[k-1])
        

### FIXED CODE ###


s = str(input())
k = int(input())
kouho = [s]

for i in range(len(s)):
    for plus in range(k+1):
        st = s[i:i + plus]
        kouho.append(st)
so = list(sorted(set(kouho)))
if '' in so:
    so.remove('')
    
print(so[k-1])
ソースコード 

Copy
Copy
S = input()
T = input()
count = 0
if S == T:
  print(0)
else:
  for i in range(len(S)):
    if S[i]!=T[i]:
      count += 1
  print(count)

### FIXED CODE ###

S = input()
T = input()
count = 0
for i in range(len(S)):
  if S[i]!=T[i]:
    count += 1
print(count)
s=input()
p=input()
q=s+p
q=int(q)
l=q**(1/2.0)
m=int(l)
if(l==m):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

# Q.B
import math
a,b = map(int,input().split(" "))
num = int(str(a)+str(b))
sq = math.sqrt(num)
isq = int(sq)
if isq*isq==num:
    print("Yes")
else:
    print("No")
a,b,c,d = map(int,input().split())
a -= 1
from math import gcd
g = c*d//gcd(c,d)
cc = b//c-a//c
dc = b//d-a//d 
gc = b//g-a//b
print(b-a-cc-dc+gc)

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
e = c*d//fractions.gcd(c,d)
cnt = b-a+1
c_cnt = b//c-(a-1)//c
d_cnt = b//d-(a-1)//d
e_cnt = b//e-(a-1)//e
print(cnt-c_cnt-d_cnt+e_cnt)
a = input()
print (int(a+a^2+a^3))

### FIXED CODE ###

a = int(input())
print (int(a+a**2+a**3))
N,M = map(int,input().split)

x = int( N*(N-1)/2 + M*(M-1)/2 )

print(x)

### FIXED CODE ###

N,M = map(int,input().split())

x = int( N*(N-1)/2 + M*(M-1)/2 )

print(x)
input = str(input())
input.split('/')

if input[1] != '10':
  input[1].replace('0', '')
input = int(input)

if (input[0] > 2019) or ( (input[0] == 2019) and (input[1] > 4) ):
  print("TBD")
else:
  print("Heisei")

### FIXED CODE ###

s = input()
m = int(s[5:7])
if m <= 4:
  print("Heisei")
else:
  print("TBD")
A11, A12, A13=list1(map(int,input().split()))
A21, A22, A23=list2(map(int,input().split()))
A31, A32, A33=list3(map(int,input().split()))
N=int(input())
b=[input() for i in range(N)]
if A11 and A12 and A13 in b:
    print('Yes')
elif A21 and A22 and A23 in b:
    print('Yes')
elif A31 and A32 and A33 in b:
    print('Yes')
elif A11 and A21 and A31 in b:
    print('Yes')
elif A12 and A22 and A32 in b:
    print('Yes')
elif A13 and A23 and A33 in b:
    print('Yes')
elif A11 and A22 and A33 in b:
    print('Yes')
elif A13 and A22 and A31 in b:
    print('Yes')
else:
  print('No')

### FIXED CODE ###

A11, A12, A13=list(map(int,input().split()))
A21, A22, A23=list(map(int,input().split()))
A31, A32, A33=list(map(int,input().split()))
N=int(input())
b=[int(input()) for i in range(N)]
if A11 in b and A12 in b and A13 in b:
    print('Yes')
elif A21 in b and A22 in b and A23 in b:
    print('Yes')
elif A31 in b and A32 in b and A33 in b:
    print('Yes')
elif A11 in b and A21 in b and A31 in b:
    print('Yes')
elif A12 in b and A22 in b and A32 in b:
    print('Yes')
elif A13 in b and A23 in b and A33 in b:
    print('Yes')
elif A11 in b and A22 in b and A33 in b:
    print('Yes')
elif A13 in b and A22 in b and A31 in b:
    print('Yes')
else:
    print('No')
a = int(input())
b = int(input())

s = str(a*b)

p = str(2*a+2*b)

print(s+" "+p)


### FIXED CODE ###

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

s = a*b

p = 2*a+2*b

print(s,p)
printt('ARC' if input()=='ABC' else 'ABC')

### FIXED CODE ###

s=input()
print('ABC' if s=='ARC' else 'ARC')
def index_bin(l, x):
    n = len(l)
    b = 0
    e = n
    while(b != e):
        if x > l[(b+e)//2]:
            b = (b+e)//2 + 1
        else:
            e = (b+e)//2
    return b


N, M = map(int, input().split())

P = []
Y = []
PY = [[] for _ in range(M)]


for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    PY[p-1].append(y)

for i in range(M):
    PY[i+1].sort()

for i in range(M):
    x = index_bin(PY[P[i]-1], Y[i]) + 1
    print("%06d%06d" % (P[i], x))


### FIXED CODE ###

# coding: utf-8
# N : 県の数, M: 市の数
import bisect

N, M = map(int, input().split())
ps, ys = [], []

v = [ [] for _ in range(N+1) ]

for i in range(M):
    p, y = map(int, input().split())
    ps += [p]; ys += [y];
    v[p].append(y)

for i in range(N):
    v[i+1].sort()


for i in range(M):
    print("{:06d}".format(ps[i]), end="")
    print("{:06d}".format(bisect.bisect_left(v[ps[i]], ys[i])+1))