Harryxun/stf_run huggingface dataset:
L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R) for i in range(L, R)])
    print(ans)


### FIXED CODE ###

L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R + 1) for i in range(L, R)])
    print(ans)
n=int(input())
    a=list(map(int,input().split()))
    t=[0]*n
    p=[]
    g=0
    for i in range(n-1,-1,-1):
        if sum(t[i::i+1])%2!=a[i]:
            t[i]=1
            p.append(i+1)
            g+=1
    print(g)
    print(*p[::-1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
t=[0]*n
p=[]
g=0
for i in range(n-1,-1,-1):
    if sum(t[i::i+1])%2!=a[i]:
        t[i]=1
        p.append(i+1)
        g+=1
print(g)
print(*p[::-1])
S = input()
T = input()
res = ''

for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        start = i
        end = i + j
        if S[i+j] == T[j]:
            flag = 1
        elif S[i+j] == '?':
            flag = 0
        else:
            start = 0
            end = 0
            flag = -1
            break
    if flag == 1:
        break
            
if flag == -1:
    print('UNRESTORABLE')
    
else:
    j = 0
    for i in range(len(S)):
        if start <= i <= end:
            res += T[j]
            j += 1

        elif S[i] == '?':
            res += 'a'

        else:
            res += S[i]

    print(res)

### FIXED CODE ###

S = input()
T = input()


    
if True:
    tmp = -1
    for i in range(len(S) - len(T) + 1):
        start = -1
        for j in range(len(T)):
            if S[i+j] == T[j] or S[i+j] == '?':
                start = i
            else:
                start = -1
                break
                
        
        if start != -1:
                tmp = i
    if tmp == -1:
        print('UNRESTORABLE')
    else:
        res = ''
        count = 0
        for i in range(len(S)):
            if tmp <= i < tmp + len(T):
                res += T[count]
                count += 1
            elif S[i] == '?':
                res += 'a'
            else:
                res += S[i]

        print(res)
r, g, b = map(int, input().split)
 
number = r * 100 + g * 10 + b
 
if number % 4 == 0:
  print("YES")
 
else:
  print("NO")

### FIXED CODE ###

r, g, b = map(int, input().split())
 
number = r * 100 + g * 10 + b
 
if number % 4 == 0:
  print("YES")
else:
  print("NO")
a,b,n=map(int,input().split())
maxs=0
if a>=b:
    if n>=b:
        maxs=a/b*(b-1)-(a%b*(b-1))%b/b
    else:
        maxs=a/b*n-(a%b*n)%b/b
else:
    if n>=b:
        maxs={a*(b-1)}//b
    else:
        maxs={a*n}//b
print(int(maxs))

### FIXED CODE ###

k=int(input())
a,b=map(int,input().split())
if a%k==0:
    print('OK')
else:
    
    if a//k*k+k<=b:
        print('OK')
    else:
        print('NG')
N = int(input())
Data = list(map(int,input().split()))
ans = True
for data in Data:
    if data % 2 == 0:
        if data % 3 == 0 or data % 5 == 0:
            pass
        else:
            ans = False
            break
if ans:
    print('APPROVED')
else:
    print('DENIED')


### FIXED CODE ###

a,b,c = map(int,input().split())
ans = False
if a == b and b != c:
    ans = True
if b == c and c != a:
    ans = True
if c == a and a != b:
    ans = True
if ans:
    print('Yes')
else:
    print('No')
from functools import lru_cache


def popcnt(x):
    return bin(x).count("1")


@lru_cache(maxsize=None)
def rec(n):
    if n == 0:
        return 0
    else:
        return rec(n % popcnt(n)) + 1


n = int(input())
arr = input()

cnt = popcnt(int(arr, 2))
init_big = int(arr, 2) % (cnt + 1)
if cnt == 1:
    init_small = 0
else:
    init_small = int(arr, 2) % (cnt - 1)

li = []
for i in range(n):
    if arr[i] == "0":
        li.append((init_big + (1 << (n - i - 1))) % (cnt + 1))
    else:
        li.append((init_small - (1 << (n - i - 1))) % (cnt - 1))


ans = []

for x in li:
    ans.append(rec(x) + 1)

for i in range(n):
    x = arr[:i] + str(1 ^ int(arr[i])) + arr[i + 1:]
    if int(x, 2) == 0:
        ans[i] = 0

print(*ans, sep="\n")

### FIXED CODE ###

from functools import lru_cache


def popcnt(x):
    return bin(x).count("1")


@lru_cache(maxsize=None)
def rec(n):
    if n == 0:
        return 0
    else:
        return rec(n % popcnt(n)) + 1


ret = [rec(x) for x in range(2 * 10**5 + 1)]


n = int(input())
arr = input()

ALL_ARR = int(arr, 2)

cnt = popcnt(int(arr, 2))
init_big = ALL_ARR % (cnt + 1)
if cnt == 1:
    init_small = 0
else:
    init_small = ALL_ARR % (cnt - 1)


li = [0] * n
for i in range(n):
    if arr[i] == "0":
        li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)
    elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:
        li[i] = "flg"
    else:
        li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)


ans = []

for x in li:
    if x == "flg":
        ans.append(0)
    else:
        ans.append(ret[x] + 1)

print(*ans, sep="\n")
import itertools

L,R = map(int,input().split())
N_List = list(range(L,R+1))
N = len(N_List)
if N >= 2019:
    ans = 0
else:
    F = N_List[0] % 2019
    L = N_List[-1] % 2019
    if F < L:
        ans = 2019
        Amari_List = list(range(F,L+1))
        for v1,v2 in itertools.combinations(Amari_List, 2):
            ca = v1*v2 % 2019 
            if  ca < ans:
                ans = ca
    else:
        ans = 0

print(ans)





### FIXED CODE ###

import itertools

L,R = map(int,input().split())
if R - L + 1 >= 2019:
    ans = 0
else:
    LL = L % 2019
    RR = R % 2019
    if LL < RR:
        Amari_List = list(range(LL,RR+1))
        ans = 2019
        for v1,v2 in itertools.combinations(Amari_List, 2):
            ca = (v1*v2) % 2019 
            if  ca < ans:
                ans = ca
    else:
        ans = 0

print(ans)
S = input()
d = {"SUN":6,
     "TUE":5,
     "WED":4,
     "THU":3,
     "FRI":2,
     "SAT":1}
print(d[S])

### FIXED CODE ###

S = input()
d = {"SUN":7,
     "MON":6,
     "TUE":5,
     "WED":4,
     "THU":3,
     "FRI":2,
     "SAT":1}
print(d[S])
a = int(input())
b = int(input())
if a == 1 and b == 2:
    print(3)
elif a == 2 and b ==3:
    print(1)
else:
    pritn(2)
    

### FIXED CODE ###

s,t = input().split()
print(t+s)
i = list(map(int,input().split()))
a = i[0]*i[1]
b = 2*(i[0]+i[1])
print("{0} {1}".format(a.b))


### FIXED CODE ###

i = list(map(int,input().split()))
a = i[0]*i[1]
b = 2*(i[0]+i[1])
print("{0} {1}".format(a,b))
import sys
sys.setrecursionlimit(1000000) 

n = int(input())
li1 = list(range(n))
print(sum(li1))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000) 

n = int(input())
print(n*(n-1)//2)
N = int(input())
T = [int(input()) for i in range(N)]
P = list(set(T))

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

def lcm(a,b) :
    return a*b//gcd(a,b)

for i in range(len(P)-1) :
    if i == 0 :
        ans = lcm(P[i],P[i+1])
    else :
        p = lcm(P[i],P[i+1])
        if p > ans :
            ans = p
print(ans)


### FIXED CODE ###

N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)
if N == 1 :
    ans = T[0]
else :
    for i in range(len(T)) :
        if i == 0 :
            ans = lcm(T[i],T[i+1])
        else :
            ans = lcm(T[i],ans)
print(ans)
S = input()
T = input()

offset = len(S) - len(T)

ans = []
for d in range(offset + 1):
    A = ''
    Td = '?' * d + T
    for i in range(len(S)):
        if i < len(Td) and S[i] != Td[i] and '?' not in [S[i], Td[i]]:
            break
        else:
            c = S[i] if Td[i] == '?' else Td[i]
            A += c
    else:        
        ans.append(A.replace('?', 'a'))

if len(ans):
    ans.sort()
    print(ans[0])
else:
    print('UNRESTORABLE')


### FIXED CODE ###

import re


S_ = input()
T = input()

S_ = S_[::-1]
T = T[::-1]

t = ''
for c in T:
    t += '[?' + c + ']'
regex = re.compile(t)

S, cnt = regex.subn(T, S_, count=1)
if cnt:
    S = S.replace('?', 'a')
    print(S[::-1])
else:
    print('UNRESTORABLE')
n,m=map(int,input().split())
ans=list(range(1,n+1))
for i in range(m):
    a,b=map(int,input().split())
    if a-1 in ans:
        ans=ans[ans.index(a-1):]
    if b+1 in ans:
        ans=ans[:ans.index(b)]
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
mn=0
mx=10**6
for i in range(m):
    a,b=map(int,input().split())
    mn=max(mn,a)
    mx=min(mx,b)
if mn>mx:
    print(0)
else:
    print(mx-mn+1)
class SegTree:
    X_unit = 0
    X_f = max

    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (N + N)

    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x
        for i in range(self.N - 1, 0, -1):
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def fold(self, L, R):
        L += self.N
        R += self.N
        vL = self.X_unit
        vR = self.X_unit
        while L < R:
            if L & 1:
                vL = self.X_f(vL, self.X[L])
                L += 1
            if R & 1:
                R -= 1
                vR = self.X_f(self.X[R], vR)
            L >>= 1
            R >>= 1
        return self.X_f(vL, vR)

n,k = map(int,input().split())
seg = SegTree(400000)
a = [0]*n
seg.build(a)
for i in range(n):
    a = int(input())
    seg.set_val(a,seg.fold(a-k,a+k+1) + 1)

print(seg.fold(0,400000))

### FIXED CODE ###



class SegTree:
    X_unit = 0
    X_f = max

    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (N + N)

    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x
        for i in range(self.N - 1, 0, -1):
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])

    def fold(self, L, R):
        L += self.N
        R += self.N
        vL = self.X_unit
        vR = self.X_unit
        while L < R:
            if L & 1:
                vL = self.X_f(vL, self.X[L])
                L += 1
            if R & 1:
                R -= 1
                vR = self.X_f(self.X[R], vR)
            L >>= 1
            R >>= 1
        return self.X_f(vL, vR)

n,k = map(int,input().split())
seg = SegTree(300001)
# a = [0]*n
# seg.build(a)
for i in range(n):
    a = int(input())
    seg.set_val(a,seg.fold(max(0,a-k),min(300001,a+k+1)) + 1)

print(seg.fold(0,300001))
n = int(input())
A = list(map(int,input().split()))
b = list(map(abs,a))
c = [a for a in A if a < 0]

if len(c) % 2 == 0:
    print(sum(b))
else:
    print(sum(b)-min(b)*2)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(abs, A))
C = [a for a in A if a < 0]
if len(C) % 2 == 0:
    print((sum(B)))
else:
    print((sum(B) - min(B)*2))
x, y = map(int, input().split())
x = a*b
y = (a+b)*2

print(x, y)


### FIXED CODE ###

a, b = map(int, input().split())
x = a*b
y = (a+b)*2

print(x, y)
import math

data = input().split()
a = int(data[0])
b = data[1]
c = int(data[2])

ans = []
while True:
	if b == '+':
		ans += a+c
	elif b == '-':
		ans += a-c
	elif b == '*':
		ans += a*c
	elif b == '/':
		ans += math.floor(a/c)
	elif b == '?':
		break
	else:
		break

for output in ans:
	print(output)


### FIXED CODE ###

import math

ans = []
while True:
	data = input().split()
	a = int(data[0])
	b = data[1]
	c = int(data[2])

	if b == '+':
		ans += [a+c]
	elif b == '-':
		ans += [a-c]
	elif b == '*':
		ans += [a*c]
	elif b == '/':
		ans += [math.floor(a/c)]
	elif b == '?':
		break
	else:
		break

for output in ans:
	print(output)
a,b = map(int,input().split())
s = input()
if s[a] == "-":
    s.remove(s[a])
    if "-" in s:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

a,b = map(int,input().split())
s = list(input())
if s[a] == "-":
    s.remove(s[a])

    ls = "0123456789"
    c = 0
    for i in s:
        if i in ls:
            c += 1

    if c == a+b:
        print("Yes")
    else:
        print("No")
else:
    print("No")
for i in range(1):
print(input()[::-1])

### FIXED CODE ###

a = 1
while a:
    print(input()[::-1])
    a = 0
H, W = map(int, input().split())

inpt =[]
for h in H:
    i = str(input())

string = 'No'

for h in range(H):
    for w in range(W):
        if h == H-1 or w == W-1:
            continue
        if inpt[h][w] == '#':
            if inpt[h+1][w] == '#' or inpt[h][w+1] == '#':
                 string = 'Yes'
                 
print(string)

### FIXED CODE ###

a, b = map(int, input().split())
takahashi = 0
 
for x in range(1, a):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(1, b+1):
    if x == a:
        takahashi += 1
print(takahashi)
N = int(input())
arr = map(int, input().split())
count = 0

for i in range(0, N + 1, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)


### FIXED CODE ###

N = int(input())
arr = tuple(map(int, input().split()))
count = 0

for i in range(0, N, 2):
    if arr[i] % 2 != 0:
        count += 1
        
print(count)
input()
a = input().split()
a.reverse()
print(" "join(a))

### FIXED CODE ###

input()
a = input().split()
a.reverse()
print(" ".join(a))
N,K=map(int,input().split())
a=input().split()

for i in range (N):
  for j in range (N-1):
    if a[j]>a[j+1]:
      g=a[j]
      a[j]=a[j+1]
      a[j+1]=g
    
count=1
size=0
b=[]
for p in range (N-1):
  if a[p]==a[p+1]:
    count+=1
  else:
    b.append(count)
    count=1
    size+=1

for q in range (size):
  for r in range (size-1):
    if b[r]<b[r+1]:
      g=b[r]
      b[r]=b[r+1]
      b[r+1]=g

s=0
for u in range (K):
  s+=b[u]

print(N-s)

### FIXED CODE ###

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

list.sort(a)#小さい順に並び替える
    
count=1#各数字が何回出てくるか
size=0#何種類の数字が出てくるか
b=[]#各数字が何回出てきたかを入れる箱
for p in range (N-1):
  if a[p]==a[p+1]:
    count+=1
  else:
    b.append(count)
    count=1
    size+=1

b.append(count)
size+=1
  
list.sort(b,reverse=True)#大きい順に並び替える

s=0
if K<size:
  for u in range (K):
    s+=b[u]#大きい方からK個分の個数の合計
else:
  s=N#出てくる数の個数が少なければ変える必要はない
print(N-s)
import sys

def gcd(x, y, *val):
    val = [x, y] + list(val)
    val.sort(reverse=True)

    if len(val) == 2:
        mod = val[0] % val[1]
        if mod == 0:
            return val[1]
        elif mod == 1:
            return 1
        else:
            return gcd(val[1], mod)
    else:
        length = len(val)
        if length % 2 == 1:
            val.append(val[-1])

        return gcd(*[gcd(val[i], val[i + 1]) for i in range(0, length, 2)])
        

def main():
    sinputl = sys.stdin.readline

    num = int(sinputl().strip())
    input = [int(x) for x in sinputl().split()]

    gcd_max = 1
    input_mem = []

    if num == 2:
        print(max(input))
        return

    for i in range(num):
        mem = input.pop(num - 1 - i)
        gcd_max = max(gcd_max, gcd(*input, *input_mem))
        input_mem.append(mem)

    print(gcd_max)



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def gcd(x, y, *val):
    val = sorted([x, y], reverse=True) + list(val)
    count = len(val)

    if count == 2:
        if val[1] == 0:
            return val[0]

        mod = val[0] % val[1]
        if mod == 0:
            return val[1]
        elif mod == 1:
            return 1
        else:
            return gcd(val[1], mod)
    else:
        if count % 2 == 1:
            val.append(val[-1])

        return gcd(*[gcd(val[i], val[i + 1]) for i in range(0, count, 2)])
        

def main():
    sinputl = sys.stdin.readline

    num = int(sinputl().strip())
    input = [int(x) for x in sinputl().split()]

    gcd_max = 1
    input_mem = []

    if num == 2:
        print(max(input))
        return

    gcd_left = [0]
    gcd_right = [0]

    for i in range(num - 1):
        gcd_left.append(gcd(input[i], gcd_left[i]))
        gcd_right.append(gcd(input[-1 - i], gcd_right[i]))

    gcd_right.reverse()
    gcd_list = []

    for i in range(num):
        gcd_list.append(gcd(gcd_left[i], gcd_right[i]))

    print(max(gcd_list))



if __name__ == "__main__":
    main()
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sum(b)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    s+=c[a[i]]
print(s)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sum(b)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    s+=c[a[i]-1]
print(s)
from heapq import*
n,m=map(int,input().split())
p=sorted(map(int,input().split()))
heapify(p)
q=sorted([list(map(int,input().split()))for i in range(m)],key=lambda x:x[1],reverse=1)

for s,t in q:
    for i in range(s):
        tmp=heappop(p)
        if t>tmp:
            heappush(p,t)
        else:
            heappush(p,tmp)
            print(sum(p))
            exit()
print(sum(p))
#    print(p,q)

### FIXED CODE ###

a,b=map(int,input().split())
if a>12:
    print(b)
elif 6<=a<=12:
    print(b//2)
else:
    print(0)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        if m < w:
            if s[i][m] == '#':
                a[i][m] = num
                m += 1
            for j in range(m, w):
                if s[i][j] == '#':
                    num += 1
                a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][j] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][j] == 0:
                m -= 1
        a[i][:] = a[m][:]
for i in range(h):
    print(*a[i][:])

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        if m < w:
            if s[i][m] == '#':
                a[i][m] = num
                m += 1
            if m < w:
                for j in range(m, w):
                    if s[i][j] == '#':
                        num += 1
                    a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][0] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][0] == 0:
                m -= 1
        a[i][:] = a[m][:]
for i in range(h):
    print(*a[i][:])
from collections import deque

n = int(input())
a = list(map(int,input().split()))
d = deque(a)

tmp = []
cnt = 0
while d:
  v = d.popleft()
  tmp.append(v)
  if len(tmp)<=2:
    pass
  else:
    if not ( tmp[-1] >= tmp[-2] >= tmp[-3] or tmp[-1] <= tmp[-2] <= tmp[-3]):
      tmp = [tmp[-1]]
      cnt += 1
  
  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)

### FIXED CODE ###

from collections import deque
 
n = int(input())
a = list(map(int,input().split()))
d = deque(a)
 
tmp = []
cnt = 0
while d:
  v = d.popleft()
  if len(tmp)<=1:
    pass
  else:
    if not (v >= tmp[-1] >= tmp[-2] >= tmp[0] or v <= tmp[-1] <= tmp[-2] <= tmp[0]):
      tmp = []
      cnt += 1
  tmp.append(v)
#  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)
somelists=[]

for i in range(m):
    a,b=map(int,input().split())
    somelists.append([i,a,b])

somelists.sort(key=lambda x:(x[1],x[2]))

prefs=1
numbers=0

for x in somelists:
    
    if x[1]==prefs:
        numbers+=1
        
        x.append(numbers)
    if x[1]!=prefs:
        prefs=x[1]
        numbers=1
        x.append(numbers)

somelists.sort(key=lambda x:x[0])
for _ in range(m):
    print(str(somelists[_][1]).zfill(6)+str(somelists[_][3]).zfill(6))


### FIXED CODE ###

n,m=map(int,input().split())
somelists=[]

for i in range(m):
    a,b=map(int,input().split())
    somelists.append([i,a,b])

somelists.sort(key=lambda x:(x[1],x[2]))

prefs=1
numbers=0

for x in somelists:
    
    if x[1]==prefs:
        numbers+=1
        
        x.append(numbers)
    if x[1]!=prefs:
        prefs=x[1]
        numbers=1
        x.append(numbers)

somelists.sort(key=lambda x:x[0])
for _ in range(m):
    print(str(somelists[_][1]).zfill(6)+str(somelists[_][3]).zfill(6))
X,Y,Z = map(int, input().split(" "))

A = int(Z)
B = int(X)
C = int(Y)

print(f"{A} {B} {C}")

### FIXED CODE ###

X,Y,Z = map(int, input().split(" "))

A = int(Z)
B = int(X)
C = int(Y)

print(str(A) + " " + str(B) + " " + str(C))
N = intinput()
tmp = N
divs = 0

while tmp:
    divs += tmp % 10
    tmp = int(tmp/10)

if N % divs == 0:
    print('Yes')
else:
    print('No')
    


### FIXED CODE ###

#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
tmp = N
divs = 0

while tmp:
    divs += tmp % 10
    tmp = int(tmp/10)

if N % divs == 0:
    print('Yes')
else:
    print('No')
import math

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

gcb=math.gcd(A,B)

print(int(A*B/gcb))

### FIXED CODE ###

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

def gcd(a,b):
    num=[a,b]
    GCD=0
    for i in range(1,min(num)+1):
        if a%i==0 and b%i==0:
            GCD=i
    return GCD
            
print(int(A*B/gcd(A,B)))