Harryxun/stf_run huggingface dataset:
import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"
MAX_A = 100

def main():
    N = int(input())
    A = list(map(int, input().split()))
    c = [0] * MAX_A
    for a in A:
        c[a] += 1
    pairwse = True
    for i in range(2, MAX_A):
        cnt = 0
        for j in range(i, MAX_A, i):
            cnt += c[j]
        if cnt > 1: pairwse = False
    if pairwse:
        return PAIRWISE
    
    allgcd = A[0]
    for a in A:
        allgcd = math.gcd(allgcd, a)
    if allgcd == 1: return SETWISE
    return NOTCOM

print(main())


### FIXED CODE ###

import math
NOTCOM = "not coprime"
SETWISE = "setwise coprime"
PAIRWISE = "pairwise coprime"

def calc_prime(N):
    prime, i = set(), 1
    while i * i <= N:
        if N % i == 0:
            yield i
            if i != N//i: yield N//i
        i += 1

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A = list(set(A))
    cnt2 = 0
    cnt3 = 0
    allgcd = A[0]
    for a in A:
        allgcd = math.gcd(allgcd, a)
        if a % 2 == 0:
            cnt2 += 1
        if a % 3 == 0:
            cnt3 += 1
    if allgcd != 1:
        return NOTCOM
    
    if cnt2 >= 2 or cnt3 >= 2:
        return SETWISE

    allprime = set()
    for a in A:
        for t in calc_prime(a):
            if t in allprime and t != 1:
                return SETWISE
            allprime.add(t)
    return PAIRWISE

print(main())
from collections import defaultdict
import sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(W)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: W)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(H+1)
T[1] = 2
for i in range(1,H):
    if not B[i+1]:
        T[i+1] = min(W,T[i] + 1)
        continue
    ctr = T[i]
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr+1, W)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[W]))
print(T)

### FIXED CODE ###

from collections import defaultdict
import sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(H)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: H+1)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(W+1)
T[1] = 2
for i in range(1,W):
    if not B[i+1]:
        T[i+1] = T[i] + 1
        continue
    ctr = T[i]
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr+1, H+1)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[H]))
import bisect
n=int(input())
p=[0]*(n+2)
c=1
for i in input().split():
    p[int(i)]=c
    c+=1

q=[0,n+1]

for i in range(1,n+1):
    l=bisect.bisect(q,a)
    r=l+1
    print()

print(p)


### FIXED CODE ###

s=input()
q=[]
cnt=0
for i in s:
    if i=='S':
        q.append('S')
    else:  # t
        if q:
            q.pop()
            cnt+=2
print(len(s)-cnt)
n=int(input())
a=[-1,-1]+list(map(int,input().split()))
cnt=[0]*(n+1)
for i in range(2,n+1):
    cnt[a(i)]+=1
    
for i in range(1,n+1):
    print(cnt[i])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cnt=[0]*n
for i in range(0,n-1):
    cnt[a[i]-1]+=1
for i in range(0,n):
    print(cnt[i])
n = int(input())
if n % 615 == 0:
	print(1)
else:
	if n%100 == 0 or n%101==0 or n%102 == 0 or n%103==0 or n%104==0 or n%105==0:
		print(1)
	elif n% 209 == 0 n%206==0 or n%207==0 or n%208==0 or n%201 ==0 or n%202 == 0 or n%203==0 or n%204 == 0 or n%205 == 0:
		print(1)
	elif n%303 == 0 or n% n%304 ==0 or n%305 == 0 or n%306 == 0 or n%307==0 or n%308==0 or n%309==0 or n%310 == 0 or n%311==0 or n%312==0:
		print(1)
	elif n%406==0 or n%407==0 or n%408==0 or n%409==0 or n%410==0 or n%411==0 or n%412==0 or n%413==0 or n%414==0:
		print(1)
	elif n%510==0 or n%511==0 or n%512==0 or n%513==0 or n%514==0 or n%515==0:
		print(1)
	else:
		print(0)

### FIXED CODE ###

coin = [100, 101, 102, 103, 104, 105]
X = int(input())
dp = [0]*(X+5)
dp[0]=1
for i in coin:
	for j in range(X+5):
		if i<=j:
			if dp[j-i]:
				dp[j]=1
print(1) if dp[X] else print(0)
n = int(input())

if 104 >= n:
    print(0)
else:
    ans = 0
    for i in range(105,201):
        cnt=0
        for j in range(1,i+1):
            if i%j == 0:
                cnt+=1
            
        if cnt == 8:
            ans +=1

print(ans)
            

### FIXED CODE ###

n = int(input())

ans = 0
for i in range(1,n+1):
    if i%2 == 0:
        continue
    cnt=0
    for j in range(1,i+1):
        if i%j == 0:
            cnt+=1
        
    if cnt == 8:
        ans+=1

print(ans)
N=int(input())
ans =1
A = list(map(int,input().split()))
for i in A
      
       ans *=A
if ans <=10**18:
        print(ans)
else:
        print(-1)
 

### FIXED CODE ###

N=int(input())
ans =1
A = list(map(int,input().split()))
for i in A:
        if i == 0:

               print(0)
               exit()
for i in A:
      
       ans *=i
       if ans >10**18:
               print(-1)
               exit()
print(ans)
N = int(input())
hlist = list(map(int, input().split()))

dp = [float('inf')] * N
def f(i, n):
  if dp[i] < float('inf'):
    return dp[i]
  if i==0:
    return n
  if i==1:
    return n + abs(hlist[1]-hlist[0])
  dp[i-1] = min(dp[i-1], f(i-1, n+abs(hlist[i]-hlist[i-1])))
  dp[i-2] = min(dp[i-2], f(i-2, n+abs(hlist[i]-hlist[i-2])))
  return min(dp[i-1], dp[i-2])
print(f(N-1, 0))


### FIXED CODE ###

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

dp = [-1 for _ in range(N)]
dp[0] = 0
for n in range(N-2):
  cost = dp[n] + abs(hlist[n]-hlist[n+1])
  dp[n+1] = min(dp[n+1], cost) if dp[n+1] != -1 else cost
  cost = dp[n] + abs(hlist[n]-hlist[n+2])
  dp[n+2] = min(dp[n+2], cost) if dp[n+2] != -1 else cost
cost = dp[-2] + abs(hlist[-2]-hlist[-1])
dp[-1] = min(dp[-1], cost) if dp[-1] != -1 else cost
print(dp[-1])
A, B = int(input())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)

### FIXED CODE ###

A, B = map(int, input().split())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)
import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(10000000000000)


def factorial(n):
    w = 10**9 + 7
    table = [1]*(n+1)
    for i in range(1, n+1):
        table[i] = table[i-1]*i % w
    return table


def modinv(a, m):
    b = m
    u = 1
    v = 0

    while b > 0:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


def moddiv(x, y, m=10**9+7):
    y_inv = modinv(y, m)
    return x * y_inv % m


def perm(N1, N2):
    table = factorial(N1+N2)
    s = table[N1+N2]
    a = table[N1]
    b = table[N2]
    return moddiv(moddiv(s, a), b)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))

    x, y = map(int, input().split())
    diff = abs(x-y)

    if diff == 0:
        if x % 3 != 0:
            print(0)
            return
        cnt = x // 3
        ret = perm(cnt, cnt)
    else:
        if (min(x, y)-diff) % 3 != 0:
            print(0)
            return
        cnt = (min(x, y) - diff) // 3
        ret = perm(cnt, cnt+diff)

    print(ret)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(1000000)


def factorial(n):
    w = 10**9 + 7
    table = [1]*(n+1)
    for i in range(1, n+1):
        table[i] = table[i-1]*i % w
    return table


def modinv(a, m):
    b = m
    u = 1
    v = 0

    while b > 0:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


def moddiv(x, y, m=10**9+7):
    y_inv = modinv(y, m)
    return x * y_inv % m


def perm(N1, N2):
    table = factorial(N1+N2)
    s = table[N1+N2]
    a = table[N1]
    b = table[N2]
    return moddiv(moddiv(s, a), b)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))

    x, y = map(int, input().split())
    diff = abs(x-y)

    if diff == 0:
        if x % 3 != 0:
            print(0)
            return
        cnt = x // 3
        ret = perm(cnt, cnt)
    else:
        if (min(x, y)-diff) % 3 != 0 or min(x, y) - diff < 0:
            print(0)
            return
        cnt = (min(x, y) - diff) // 3
        ret = perm(cnt, cnt+diff)

    print(ret)


if __name__ == "__main__":
    main()
a,b,c,d = map(int,input().split())
import math
lcm = int(c*d/math.gcd(c,d))
a_1 = a-1
panish = (int(b/c)+int(b/d)-int(b/lcm))-((int(a_1/c)+int(a_1/d))-int(a_1/lcm))
print(b-a_1-panish)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a,b,c,d = map(int,input().split())
import math
lcm = c*d//gcd(c,d)
a_1 = a-1
panish = ((b//c)+(b//d)-(b//lcm))-(((a_1//c)+(a_1//d))-(a_1//lcm))
print(b-a_1-panish)
N , K = (int(i) for i in input().split())

h = [0] * N
for i in range(N):
    h[i] = int(input())

h.sort()

min = 1000000000

for i in range(N - K + 1):
    if min > h[i + K - 1] - h[i]:
        min = h[i + K - 1] - h[i]

print(min)


### FIXED CODE ###

D = int(input())

if D == 22:
    print("Christmas Eve Eve Eve")
if D == 23:
    print("Christmas Eve Eve")
if D == 24:
    print("Christmas Eve")
if D == 25:
    print("Christmas")
import heapq

N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]

L=[]
for i in range(M+1):
    L.append([])

for i in range(N):
    if AB[i][0]<=M:
        L[AB[i][0]].append(AB[i][1])

for i in range(N):
    if len(L[i])!=0:
        L[i].sort(reverse=True)
        break

LL=[]
money=0

for i in range(1,M+1):
    LL+=[-k for k in L[i]]
    if len(LL)==0:
        continue
    money+=heapq.heappop(LL)

print(-money)


### FIXED CODE ###

import heapq

N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
L=[[] for i in range(M+1)]

for i in range(N):
    if AB[i][0]<=M:
        L[AB[i][0]].append(-AB[i][1])

LL=[]
money=0

for i in range(1,M+1):
    for j in L[i]:
        heapq.heappush(LL,j)
    if len(LL)==0:
        continue
    money+=heapq.heappop(LL)

print(-money)
#!/usr/bin/env python3

def main():
    import sys
    def I(): return int(sys.stdin.readline())
    def LI(): return list(map(int,sys.stdin.readline().split()))

    n = I()
    V = []
    W = []
    m = min(n, 1 << 10)
    maxL = 10**5
    dp = [[0]*(maxL + 1)]
    
    for i in range(1, n+1):
        v, w = LI()
        half = i >> 1
        dp_ = dp[half][:]
        if i <= m:
            for j in range(maxL+1):
                if j < w:
                    dp_[j] = dp[half][j]
                else:
                    dp_[j] = max(dp[half][j], dp[half][j - w] + v)
            dp.append(dp_)
        else:
            V.append(v)
            W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        tmp = v
        v_ = []
        w_ = []
        while tmp > m:
            v_.append(V[tmp-1])
            w_.append(W[tmp-1])
            tmp >>= 1
            cnt += 1
        ret = dp[tmp][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_tmp[b] = w_tmp[b - lsb] + w_[l-1]
            if w_tmp[b] <= L:
                v_tmp[b] = v_tmp[b - lsb] + v_[l-1]
                ret = max(ret, v_tmp[b] + dp[tmp][L - w_tmp[b]])
        print(ret)
    return

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    import sys
    def I(): return int(sys.stdin.readline())
    def LI(): return list(map(int,sys.stdin.readline().split()))

    n = I()
    V = []
    W = []

    maxL = 10**5
    m = min(n, 1 << 10)
    dp = [[0]*(maxL + 1)]
    
    for i in range(n):
        v, w = LI()
        if i <= m:
            d_ = dp[(i+1)>>1][:]
            for j in range(w, maxL+1)[::-1]:
                d_[j] = max(d_[j], d_[j - w] + v)
            dp.append(d_)
        V.append(v)
        W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        v_ = []
        w_ = []
        while v > m:
            v_.append(V[v-1])
            w_.append(W[v-1])
            v >>= 1
            cnt += 1
        ret = dp[v][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_t = w_tmp[b - lsb] + w_[l-1]
            w_tmp[b] = w_t
            if w_t <= L:
                v_t = v_tmp[b - lsb] + v_[l-1]
                v_tmp[b] = v_t
                ret = max(ret, v_t + dp[v][L - w_t])
        print(ret)
    return

if __name__ == "__main__":
    main()
import sys

n, k = map(int, raw_input().split())
ans = k # first                                                                                                 
if n = 1 and k = 1:
    print ans
    sys.exit()
for i in range(n-1):
    ans *= k-1
print ans


### FIXED CODE ###

import sys

n, k = map(int, raw_input().split())
ans = k # first                                                                                                 
if n == 1 and k == 1:
    print ans
    sys.exit()
for i in range(n-1):
    ans *= k-1
print ans
n = int(input())
word = [input() for i in range(n)]

num = int(n / 2)
if word[:num] == word[num:] :
 print("Yes")
else :
 print("No")


### FIXED CODE ###

n = int(input())
word = str(input())

num = int(n / 2)
if word[:num] == word[num:] :
	print("Yes")
else :
	print("No")
from collections import deque
MOD = pow(10,9)+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
P = []; M = []; Z = []
for i in range(N):
  if A[i] >0:
    P.append(A[i])
  elif A[i] <0:
    M.append(A[i])
  else:
    Z.append(0)
P.sort(reverse=True)
M.sort(reverse=True)
ans = 1
if K == 1:
  print(P[0]%MOD)
  exit()
if len(Z) > N-K:
  print(0)
  exit()
if len(M) == 0: #全て正の場合:
  for i in range(K):
    ans = ans*P[i]%MOD
  print(ans)
  exit()
if len(P) == 0: #全て負の場合
  for i in range(K):
    ans = ans*M[i]%MOD
  print(ans)
  exit()
L = [[],[]]
M.sort()
P = deque(P); M = deque(M)
pm = [0,0] #正負の数を保存
pnow = 0; mnow = 0
#print(P,M)

for i in range(K):
  if not P:
    temp = M.popleft()
    pm[1] +=1
    L[1].append(temp)
  elif not M:
    temp = P.popleft()
    pm[0] +=1
    L[0].append(temp)
  elif P and M:
    if P[0] >= abs(M[0]):
      temp = P.popleft()
      pm[0] += 1
      L[0].append(temp)
    else:
      temp = M.popleft()
      pm[1] += 1
      L[1].append(temp)
#一個ずらす
#print(L)

if pm[1]%2 == 1:
  if not P and not M:
    pass
  elif not M: #もう負の数が残っていない
    L[1].pop()
    L[0].append(P[0])
  elif not P: #もう正の数が残っていない
    L[0].pop()
    L[1].append(M[0])
  elif M and P:
    if L[0][-1]*P[0] >= L[1][-1]*M[0]:
      L[1].pop()
      L[0].append(P[0])
    else:
      L[0].pop()
      L[1].append(M[0])
#print(L)    
for num in range(2):
  for s in L[num]:
    ans = ans*s%MOD
print(ans)


### FIXED CODE ###

from collections import deque
MOD = pow(10,9)+7
N,K = map(int,input().split())
A = list(map(int,input().split()))
P = []; M = []; Z = []
for i in range(N):
  if A[i] >0:
    P.append(A[i])
  elif A[i] <0:
    M.append(A[i])
  else:
    Z.append(0)
P.sort(reverse=True)
M.sort(reverse=True)
ans = 1
if K == 1:
  print(P[0]%MOD)
  exit()
if len(Z) > N-K:
  print(0)
  exit()
if len(M) == 0: #全て正の場合。0があれば0
  for i in range(K):
    ans = ans*P[i]%MOD
  print(ans)
  exit()
if len(P) == 0: #全て負の場合
  if K%2 == 1 and len(Z) > 0:
    print(0)
    exit()
  if K%2 == 1:
    for i in range(K):
      ans = ans*M[i]%MOD
  else:
    M.sort()
    for i in range(K):
      ans = ans*M[i]%MOD
  print(ans)
  exit()

L = [[],[]]
M.sort()
P = deque(P); M = deque(M)
pm = [0,0] #正負の数を保存
pnow = 0; mnow = 0
#print(P,M)

for i in range(K):
  if not P:
    temp = M.popleft()
    pm[1] +=1
    L[1].append(temp)
  elif not M:
    temp = P.popleft()
    pm[0] +=1
    L[0].append(temp)
  elif P and M:
    if P[0] >= abs(M[0]):
      temp = P.popleft()
      pm[0] += 1
      L[0].append(temp)
    else:
      temp = M.popleft()
      pm[1] += 1
      L[1].append(temp)
#一個ずらす
#print(L)
#print(M,P,L)
if pm[1]%2 == 1:
  if not P and not M:
    pass
  elif not M: #もう負の数が残っていない
    L[1].pop()
    L[0].append(P[0])
  elif not P: #もう正の数が残っていない
    L[0].pop()
    L[1].append(M[0])
  elif M and P:
    if L[0] and L[1]:
      if L[0][-1]*P[0] >= L[1][-1]*M[0]:
        L[1].pop()
        L[0].append(P[0])
      else:
        L[0].pop()
        L[1].append(M[0])
    elif not L[0]:
      L[1].pop()
      L[0].append(P[0])
    elif not L[1]:
      L[0].pop()
      L[1].append(M[0])
#print(L)    
for num in range(2):
  for s in L[num]:
    ans = ans*s%MOD
print(ans)
import math
A,B = map(int,input().split())
lcm = A * B // math.gcd(A,B)
print(lcm)


### FIXED CODE ###

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

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

lcm = A * B // gcd(A,B)
print(lcm)
import math
a, b = input().split()
a = int(a)
b = round(float(b),2)
 
print(int(a*b,2))

### FIXED CODE ###

import math
a, b = input().split()
a = int(a)
b = int(round(float(b),3)*1000)

print((a*b)//1000)
for i in range(N - 1):
  if H[i] > H[i + 1] and H[i] - 1 <= H[i + 1]:
    H[i] = H[i] - 1
  elif H[i] > H[i + 1] or H[i] < max:
    ans = "No"
  max = H[i + 1]
if sorted(H) != H:
  ans = "No"
print(ans)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
for i in range(0, N - 1):
  diff = H[i + 1] - H[i]
  if diff >= 1:
    H[i + 1] -= 1
  elif diff < 0:
    ans = "No"
print(ans)
sente=input()
n=len(sente)
nt=int((n-1)/2)
nb=int((n+3)/2)
#print(nt,nb)
#print(sente[nb:n])
if sente == sente[::-1]:
    if sente[0:nt] == sente[0:nt][::-1]:
        #print(sente[0:nt])
       
        if sente[nb-1:n]==sente[nb-1:n][::-1]:
            #print(sente[nb-1:n])

            print('Yes')
    else:
        print('No')
        else:
            print('No')
else:
    print('No')

### FIXED CODE ###

sente=input()
n=len(sente)
nt=int((n-1)/2)
nb=int((n+3)/2)
#print(nt,nb)
#print(sente[nb:n])
if sente == sente[::-1]:
    if sente[0:nt] == sente[0:nt][::-1]:
        #print(sente[0:nt])
       
        if sente[nb-1:n]==sente[nb-1:n][::-1]:
            #print(sente[nb-1:n])

            print('Yes')
        else:
            print('No')
            
    else:
        print('No')
        
else:
    print('No')
A, B = map(int,input().split())

Amin = A/0.08
if Amin != int(Amin):
  Amin = int(Amin)+1

Bmin = B/0.1
if Bmin != int(Bmin):
  Bmin = int(Bmin)+1

rangea = set(range(Amin,int((A+1)/0.08),1))
rangeb = set(range(Bmin,int((B+1)/0.10),1))

intersection = rangea & rangeb

if len(intersection)==0:
  print(-1)
else:
  print(min(intersection))

### FIXED CODE ###

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

Amin = A/0.08
if Amin != int(Amin):
  Amin = int(Amin)+1
else:
  Amin = int(Amin)

Bmin = B/0.1
if Bmin != int(Bmin):
  Bmin = int(Bmin)+1
else:
  Bmin = int(Bmin)

rangea = set(range(Amin,int((A+1)/0.08),1))
rangeb = set(range(Bmin,int((B+1)/0.10),1))

intersection = rangea & rangeb

if len(intersection)==0:
  print(-1)
else:
  print(min(intersection))
def c_id():
    from collections import defaultdict
    N, M = map(int, input().split())
    City = [[s] + [int(i) for i in input().split()] for s in range(M)]

    # 同じ県に属する市を誕生年の早い順に並べ、順序付けする
    city_dict = defaultdict(list)
    for k, p, y in City:
        city_dict[p].append([k, p, y])
    for p in city_dict.keys():
        city_dict[p].sort(key=lambda x: x[2])
        for i in range(len(city_dict[p])):
            city_dict[p][i][2] = i + 1

    # 変換は終わった。通し番号順に並べる
    ans = sorted([e for v in city_dict.values() for e in v])
    return '\n'.join([f'{p:06d}{num:06d}' for _, p, num in ans])  # 通し番号は不要

print(c_id())

### FIXED CODE ###

def c_id(N, M, City):
    City = sorted(City, key=lambda x: (x[0], x[1]))
    # print(City)
    a, b = City[0][0], 0
    for j, (p, y, k) in enumerate(City):
        if p == a:
            # print('a', j, p, y, k)
            b += 1
            City[j] = [p, b, k]
        else:
            # print('b', j, p, y, k)
            a = p
            b = 1
            City[j] = [p, b, k]
    city = sorted(City, key=lambda x: x[2])
    # print(city)

    ans_tmp = []
    for p, q, k in city:
        ans_tmp.append('{0:06d}{1:06d}'.format(p, q))
    ans = '\n'.join(ans_tmp)
    return ans

N, M = [int(i) for i in input().split()]
City = [[int(i) for i in input().split()] + [k] for j, k in enumerate(range(M), 1)]
print(c_id(N, M, City))
import sys
input=sys.stdin.readline
import numpy as np
 
def main():
    numbers=[]
    a,b,k = map(int,input().rstrip().split())
    numbers=np.arange(a,b+1)
    #A=set(numbers[:k])
    #B=set(numbers[-k:])
    #answer = A|B
    
    #for i in sorted(answer):
    #    print("{}".format(i))
 
 
if __name__=="__main__":
    main()

### FIXED CODE ###

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

lim_1 = min(a + k, b)
lim_2 = max(b - k + 1, a)
ans = set(list(range(a, lim_1)) + list(range(lim_2, b + 1)))

for n in ans:
    print(n)
N = int(input())
A = [int(i) for i in input().rstrip().split()]
B = [int(i) for i in input().rstrip().split()]
if N >2:
    C = [int(i) for i in input().rstrip().split()]

point = 0
node = -1
for i in range(N):
    point += B[A[i]-1]
    if A[i] - node == 1:
        point += C[i-2]
    node = A[i]

print(point)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

#print(N,A,B,C)
point = 0
for i in range(N):
  point += B[A[i]-1]
#print(point)
  
for i in range(N-1):
  if (A[i+1] - A[i]) == 1:
    #print(i)
    point+=C[A[i]-1]
print(point)
def main():
    L, R = list(map(int, input().split()))
    ans = 2018
    end = min(R+1, L+2019))
    for i in range(L, end-1):
        for j in range(i+1, end):
            print(ans, (i*j)%2019)
            ans = min(ans, (i*j)%2019)
    print(ans)

main()


### FIXED CODE ###

def main():
    L, R = list(map(int, input().split()))
    ans = 2018
    end = min(R+1, L+2019)
    for i in range(L, end-1):
        for j in range(i+1, end):
            ans = min(ans, (i*j)%2019)
    print(ans)

main()
from collections import Counter
N = int(input())
S = list(map(int,input().split()))
T = []
for i in range(N):
    T.append((i,S[i]))
U = sorted(T,key=lambda x:x[1], reverse=True)

Ans = [0]*N
c,v = 0,10**10

for i in range(N-1):
    c+=1
    v = min(v,U[i][0])
    if U[i][1]==U[i+1][1]:
        continue
    else:
        Ans[v] += (U[i][1] - U[i+1][1])*c
else:
    Ans[0] += U[i+1][1]

for i in range(N):
    print(Ans[i])

### FIXED CODE ###

from collections import Counter
N = int(input())
S = list(map(int,input().split()))
T = []
for i in range(N):
    T.append((i,S[i]))
U = sorted(T,key=lambda x:x[1], reverse=True)

Ans = [0]*N
c,v = 0,10**10

for i in range(N-1):
    c+=1
    v = min(v,U[i][0])
    if U[i][1]==U[i+1][1]:
        continue
    else:
        Ans[v] += (U[i][1] - U[i+1][1])*c
else:
    Ans[0] = 0
    Ans[0] = sum(S) - sum(Ans)

for i in range(N):
    print(Ans[i])