Harryxun/stf_run huggingface dataset:
n,m =map(int, input().split())  #複数数値入力
x=list(map(int, input().split()))  #リスト入力

x.sort()
x_d = list()

if m == 1:
    print(0)
else:
    for i in range(m-1):
        x_d.append(x[i+1] - x[i])   
    
    for i in range(n-1):
        x_d.remove(max(x_d))
#         print(x_d)
    
    sumd = sum(x_d)  
    print(sumd)

### FIXED CODE ###

import numpy as np
n,m =map(int, input().split())  #複数数値入力
x=list(map(int, input().split()))  #リスト入力

x.sort()
x_d = list()

if n > m:
    print(0)
else:
    if m == 1:
        print(0)
    else:
#         for i in range(m-1):
#             x_d.append(x[i+1] - x[i])   
        x_d = list(np.diff(x))

#         for i in range(n-1):
            
#             x_d.remove(max(x_d))
            
        x_d.sort(reverse=True)
#         sumd = sum(x_d)  
        sumd = sum(x_d[n-1:])
        print(sumd)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A <= B
    print("YES" if A + V * T >= B + W * T else "NO")
else:
    print("YES" if A - V * T >= B - W * T else "NO")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A <= B:
    print("YES" if A + V * T >= B + W * T else "NO")
else:
    print("YES" if A - V * T <= B - W * T else "NO")
s = input()
l = len(s)
K = int(input())
def com(x,y):
    child = 1
    mother = 1
    for i in range(y):
        child = child * (x-i)
        mother = mother * (i+1)
    if x == 1 and y >=2:
        return 0
    else:    
        return int(child / mother)
tasumae = (9**K)*com(l-1,K) #与えられた数字よりも一桁少ない999999999・・・までの個数
li = list(s)
doko = []
if l < K:
    print(0)
    exit()
if K == 1:
    print(tasumae+int(li[0]))
    exit()
for i in range(1,l):
    if li[i] != "0":
        doko.append(i)
if K == 2:
    if not doko:
        print(tasumae)
        exit()
    ans = int(li[doko[0]]) + 9*(l-1-doko[0]) + tasumae + (int(li[0])-1)*com(l-1,1)*9
    print(ans)
    exit()
if len(doko) == 0:
    print(tasumae)
    exit()
ans = (int(li[0])-1)*com(l-1,2)*(9**2) + (int(li[doko[0]])-1) * 9 * (l-1-doko[0]) + int(li[doko[1]]) + 9*(l-1-doko[1]) + com(l-1-doko[0],2)*(9**2) + tasumae
print(ans)

### FIXED CODE ###

s = input()
l = len(s)
K = int(input())
def com(x,y):
    child = 1
    mother = 1
    for i in range(y):
        child = child * (x-i)
        mother = mother * (i+1)
    if x == 1 and y >=2:
        return 0
    else:    
        return int(child / mother)
tasumae = (9**K)*com(l-1,K) #与えられた数字よりも一桁少ない999999999・・・までの個数
li = list(s)
doko = []
if l < K:
    print(0)
    exit()
if K == 1:
    print(tasumae+int(li[0]))
    exit()
for i in range(1,l):
    if li[i] != "0":
        doko.append(i)
if K == 2:
    if not doko:
        print(tasumae)
        exit()
    ans = int(li[doko[0]]) + 9*(l-1-doko[0]) + tasumae + (int(li[0])-1)*com(l-1,1)*9
    print(ans)
    exit()
if len(doko) == 0:
    print(tasumae)
    exit()
if len(doko) == 1:
    ans = (int(li[0])-1)*com(l-1,2)*(9**2) + (int(li[doko[0]])-1) * 9 * (l-1-doko[0]) + com(l-1-doko[0],2)*(9**2) + tasumae
    print(ans)
    exit()
ans = (int(li[0])-1)*com(l-1,2)*(9**2) + (int(li[doko[0]])-1) * 9 * (l-1-doko[0]) + int(li[doko[1]]) + 9*(l-1-doko[1]) + com(l-1-doko[0],2)*(9**2) + tasumae
print(ans)
import numpy as np

H, W, M = map(int, input().split())
bomb = np.zeros((H, W))
for _ in range(M):
    h, w = map(int, input().split())
    h -=1
    w -=1
    bomb[h, w] = 1

col_sum = np.sum(bomb, axis=0)
row_sum = np.sum(bomb, axis=1)

col_max = col_sum.max()
row_max = row_sum.max()

max_col_indexs = np.where(col_sum == col_max)[0]
max_row_index = np.argmax(row_sum)

ans = col_sum.max() + row_sum.max() - 1
for col in max_col_indexs:
    if bomb[max_row_index, col] == 0:
        ans = ans = col_sum.max() + row_sum.max()
        break

print(int(ans))

### FIXED CODE ###

import numpy as np
def main():
    H, W, M = map(int, input().split())
    row = np.zeros(W)
    col = np.zeros(H)
    memo = []
    for _ in range(M):
        h, w = map(int, input().split())
        h -=1
        w -=1
        row[w] += 1
        col[h] += 1
        memo.append((h, w))

    col_max = col.max()
    row_max = row.max()

    max_col_indexs = np.where(col == col_max)[0]
    max_row_indexs = np.where(row == row_max)[0]

    ans = col_max + row_max -1
    memo = set(memo)
    for c in max_col_indexs:
        for r in max_row_indexs:
            if (c, r) not in memo:
                ans = ans = col_max + row_max
                print(int(ans))
                exit()

    print(int(ans))

if __name__ == "__main__":
    main()
N,W=map(int,input().split())
a,v=map(int,input().split())
w0=[v]
w1=[]
w2=[]
w3=[]
for i in range(N-1):
    w,v=map(int,input().split())
    if w-a==0:
        w0.append(v)
    elif w-a==1:
        w1.append(v)
    elif w-a==2:
        w2.append(v)
    else:
        w3.appned(v)
w0=sorted(w0,reverse=True)
w1=sorted(w1,reverse=True)
w2=sorted(w2,reverse=True)
w3=sorted(w3,reverse=True)
ans=0
for i in range(max(len(w0)+1,1)):
    for j in range(max(len(w1)+1,1)):
        for k in range(max(len(w2)+1,1)):
            for l in range(max(len(w3)+1,1)):
                if a*i+(a+1)*j+(a+2)*k+(a+3)*l<=W:
                    lst=w0[:i]+w1[:j]+w2[:k]+w3[:l]
                    ans=max(sum(lst),ans)
print(ans)

### FIXED CODE ###

N,W=map(int,input().split())
w1,v=map(int,input().split())
if w1>W:
    print(0)
    exit()
lst=[[-1]*(3*N-2) for _ in range(N)]
lst[0][0]=v
for i in range(N-1):
    w,v=map(int,input().split())
    for j in range(N-1,-1,-1):
        for k in range(3*N-2):
            if lst[j][k]!=-1:
                if (j+1)*w1+k+w<=W:
                    lst[j+1][k+w-w1]=max(lst[j][k]+v,lst[j+1][k+w-w1])
    lst[0][w-w1]=max(v,lst[0][w-w1])

lst=[i for j in lst for i in j]
print(max(lst))
import sys
import math
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)

h,w=map(int,input().split())
miti=[]
for i in range(h):
    miti.append(input())
    
dist=[[-1 for i in range(w)] for j in range(h)]
dist[0][0]=0
queue=deque([])
def bfs(x,y):
    for i,j in [[x+1,y],[x,y+1],[x-1,y],[x,y-1]]:
        if i<0 or h<=i or j<0 or w<=j :continue
        if dist[i][j] != -1:continue
        if miti[i][j]=="#":continue
        dist[i][j]=dist[x][y]+1
        queue.append([i,j])
    while queue:
        t,r=queue.popleft()
        bfs(t,r)

for i in range(h):
  for j in range(w):
    if miti[i][j]==".":
      s=i;t=j
      break
  break
bfs(s,t)
dis0=0
ty=[0,0]
for i in range(h):
    for j in range(w):
        if dis0<dist[i][j]:
            dis0=dist[i][j]
            ty=[i,j]
i,j=ty
dist=[[-1 for i in range(w)] for j in range(h)]
dist[i][j]=0
queue=deque([])
bfs(i,j)

ans=0


for i in range(h):
    for j in range(w):
        if ans<dist[i][j]:
            ans=dist[i][j]

print(ans)

### FIXED CODE ###

import sys
import math
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)

h,w=map(int,input().split())
miti=[]
for i in range(h):
    miti.append(input())
    

def bfs(x,y):
    for i,j in [[x+1,y],[x,y+1],[x-1,y],[x,y-1]]:
        if i<0 or h<=i or j<0 or w<=j :continue
        if dist[i][j] != -1:continue
        if miti[i][j]=="#":continue
        dist[i][j]=dist[x][y]+1
        queue.append([i,j])
    while queue:
        t,r=queue.popleft()
        bfs(t,r)
ans=0
for i in range(h):
    for j in range(w):
        if miti[i][j]=="#":continue
        dist=[[-1 for i in range(w)] for j in range(h)]
        dist[i][j]=0
        queue=deque([])
        bfs(i,j)
        
        
        for s in range(h):
            for t in range(w):
                ans=max(ans,dist[s][t])
print(ans)
#import sys
#sys.setrecursionlimit(10000000)

def findSumOfDigits(n):
    sum = 0
    while n > 0.1:
        sum = sum + (n % 10)
        #print(n % 10)
        n = n - (n % 10)
        n = n / 10
    return sum

# 整数の入力
n = input()
n = int(n)

a = input()
a = int(a)

b = input()
b = int(b)

ans = 0

for i in range(1,n+1):
    #print(i)
    test = findSumOfDigits(i)
    if a <= test <= b:
        ans = ans + i

print(ans)


### FIXED CODE ###


# スペース区切りの整数の入力
a, b, c, d = map(int, input().split())

if a+b > c+d:
    print('Left')
elif a+b < c+d:
    print('Right')
else:
    print('Balanced')
s=input()
word=list(s)
temp=[]
score=[]
for i in range(len(word)):
  if word[i]!='A' and word[i]!='C' and word[i]!='G' and word[i]!='T':
    temp.append(i+1)
if word[0]=='A' or word[0]=='C' or word[0]=='G' or word[0]=='T':
  temp.insert(0,0)
if word[-1]=='A' or word[-1]=='C' or word[-1]=='G' or word[-1]=='T':
  temp.append(len(word)+1)
print(temp)
for i in range(len(temp)-1):
  if temp[i]==0 or temp[i+1]==len(word)+1:
    score.append(temp[i+1]-temp[i]-1)
  else:
    score.append(temp[i+1]-temp[i]-1)
print(max(score))

### FIXED CODE ###

S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
print(ans)
N,M=map(int,input().split())
unionfindTree = [i for i in range(N)]
size = [1 for _ in range(N)]
inconvenience = N*(N-1)//2
answers = [inconvenience] #M bridges destroyed
#answers[i] should be inconvenience after M-i bridges destroyed.

def root(x):
    p = unionfindTree[x]
    if x==p:
        return(p)
    else:
        r = root(p)
        unionfindTree[x] = r
        return(r)

def getsize(x):
    r = root(x)
    return(size[r])

def union(x,y):
    rx = root(x)
    ry = root(y)
    convenience = 0
    if rx != ry:
        unionfindTree[ry] = rx
        sx = size[rx]
        sy = size[ry]
        convenience = sx * sy
        size[rx] = sx+sy
    return(convenience)

revBridges = []
for _ in range(M):
    a,b = map(int,input().split())
    revBridges.append((a-1,b-1))
revBridges.reverse()

for (a,b) in revBridges:
    c = union(a,b)
    inconvenience -= c
    answers.append(inconvenience)
for i in range(M):
    print(answers[M-1-i])

### FIXED CODE ###

N,M = map(int,input().split())
edges = []
for _ in range(M):
    a,b = map(int,input().split())
    edges.append((a-1,b-1))
edges.reverse()
parents = list(range(N))
size = [1 for _ in range(N)]
rank = [0 for _ in range(N)]

def root(x):
    px = parents[x]
    if px == x:
        return(x)
    else:
        r = root(px)
        parents[x] = r
        return(r)

def same(x,y):
    return(root(x) == root(y))

def union(x,y):
    rx = root(x)
    ry = root(y)
    if rx == ry:
        return(0)
    if rank[ry] > rank[rx]:
        parents[rx] = ry
        size[ry] += size[rx]
    else:
        parents[ry] = rx
        size[rx] += size[ry]
        if rank[rx] == rank[ry]:
            rank[rx] += 1
    return(1)

inconvinience = N*(N-1)//2
answers=[inconvinience]

for edge in edges:
    x,y = edge
    rx = root(x)
    ry = root(y)
    sx = size[rx]
    sy = size[ry]
    res = union(rx,ry)
    if res == 1:
        inconvinience -= sx*sy
    answers.append(inconvinience)

answers.reverse()

for answer in answers[1:]:
    print(answer)
(a,b)=[int(x) for x input().split()]
print(a*b)

### FIXED CODE ###

(a,b)=[int(x) for x in input().split()]
print(a*b)
num = int(input())
dic = [input() for i in range(num)]

sdic = []
ans = 0
for i in range(num):
    dic[i] = "".join(sorted(dic[i]))
for i in range(num):
    now = dic[0]
    cnt = dic.count(now)
    ans += int((cnt * (cnt - 1)) / 2)
    for now in dic:
        dic.remove(now)
print(ans)

### FIXED CODE ###

num = int(input())
li = [input() for i in range(num)]

dic = {}
ans = 0
for i in range(num):
    now = "".join(sorted(li[i]))
    if now in dic:
        dic[now] += 1
    else:
        dic[now] = 1
for i in dic:
    n = dic[i]
    ans += int((n*(n-1))/2)

print(ans)
def solve():
    n = int(input())
    A = list(map(int, input().split()))
    for i in range(n // 2, 1, -1):
        cnt = 0
        for j in range(n // i, 1, -1):
            if A[i] != (len([1 for k in range(i, n + 1, j) if A[k] == 1]) & 1):
                A[i] = 1 - A[i]
                cnt += 1
        if cnt > 1:
            print(-1)
            return
    if A[0] != (sum(A) & 1):
        A[0] = 1 - A[0]
    print(sum(A))
    print(*list(A[i] for i in range(n) if A[i]))
solve()


### FIXED CODE ###

def solve():
    n = int(input())
    A = [0] + list(map(int, input().split()))
    for i in range(n // 2, 0, -1):
        t = len([1 for k in range(i, n + 1, i) if A[k] == 1]) & 1
        if A[i] != t:
            A[i] = 1 - A[i]
    print(sum(A))
    print(*list(i for i in range(1, n + 1) if A[i]))
solve()
n = int(input())
h = map(int, input().split())
total = 1
max_value = h[0]
for i in range(1, n):
    if max_value <= h[i]:
        total += 1
    max_value = max(max_value, h[i])
print(total)


### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
total = 1
max_value = h[0]
for i in range(1, n):
    if max_value <= h[i]:
        total += 1
    max_value = max(max_value, h[i])
print(total)
N = int(input())
sum = 0
for i in range[1,N+1]:
  if len(i) % 2 == 1:
    sum += 1
print(sum)

### FIXED CODE ###

A,B,C =  map(int,input().split())
print(max(0,B+C-A))
a = int(input())
print(a.count(1))

### FIXED CODE ###

a = input()
print(a.count("1"))
import collections
n = int(input())
v = list(map(int,input().split()))
a = v[0::2]
suma = len(a)
b = v[1::2]
sumb = len(b)
a = collections.Counter(a)
a = a.most_common()
b = collections.Counter(b)
b = b.most_common()

if a[0][0] != b[0][0]:
        ans = suma-a[0][1] + sumb-b[0][1]
        print(ans)
else:  
        ans1 = suma-a[1][1] + sumb-b[0][1]
        ans2 = suma-a[0][1] + sumb-b[1][1]
        print(min(ans1,ans2))

### FIXED CODE ###

import collections
n = int(input())
v = list(map(int,input().split()))
a = v[0::2]
b = v[1::2]
a = collections.Counter(a)
a = a.most_common()
b = collections.Counter(b)
b = b.most_common()
c = n//2
if a[0][0] != b[0][0]:
    ans = c-a[0][1] + c-b[0][1]
    print(ans)
else: 
    if len(a) == 1:
        tmpa = 0
    else:
        tmpa = a[1][1]
    if len(b) == 1:
        tmpb = 0
    else:
        tmpb = b[1][1]
    ans1 = c-tmpa + c-b[0][1]
    ans2 = c-a[0][1] + c-tmpb
    print(min(ans1,ans2))
n = input()
l = map(int, raw_input().split())
max = l[0]
min = l[0]
s = l[0]
for i in range[1:n]:
 if max < l[i]:
  max = l[i]
 if min > l[i]:
  min = l[i]
 s += s + l[i]
print min, max, s

### FIXED CODE ###

n = input()
l = map(int, raw_input().split())
max = l[0]
min = l[0]
s = 0
for i in range(n):
 if max < l[i]:
  max = l[i]
 if min > l[i]:
  min = l[i]
 s = s + l[i]
print min, max, s
alues = set_values()
max_value = min(values) - max(values)
for i in range(1, int(input())):
	for j in range(0, i-1):
		print(i, j, len(values))
		if max_value < (values[i] - values[j]):
			max_value = (values[i] - values[j])
print(max_value)


### FIXED CODE ###

def set_values():
	values = []
	for i in range(num):
		values.append(int(input()))
	return values

num = int(input())
values = set_values()
max_value = values[1] - values[0]
min_value = values[0]

for i in range(1, num):
	max_value = max(max_value, (values[i] - min_value))
	min_value = min(min_value, values[i])

print(max_value)
while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    player = [i+1 for i in range(m)]
    j = 0
    for i in range(1, n+1):
        s = input()
        if i % 3 == 0 and i % 5 == 0 and s != 'FizzBuzz':
            del player[j]
        elif i % 3 == 0 and s != 'Fizz':
            del player[j]
        elif i % 5 == 0 and s != 'Buzz':
            del player[j]
        if len(player) == 1:
            break
        if len(player)-1 == j or len(player) == j:
            j = 0
        else:
            j += 1
    print(*player)

### FIXED CODE ###

hoge = ["FizzBuzz" if i % 15 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = list(range(1, m+1))
    game = [input() for _ in range(n)]
    idx = 0
    for i in range(n):
        if game[i] != hoge[i+1]:
            del man[idx]
            if len(man) == 1:
                break
        else:
            idx += 1
        idx %= len(man)
    print(*man)
from collections import deque

import numpy as np
import sys
#input = sys.stdin.readline

sys.setrecursionlimit(5000)

def bfs(point, field, target, H, W):
    visited = [[-1 for _ in range(W+2)] for _ in range(H+2)]
    visited[point[0]][point[1]] = 1
    que = deque()
    que.append(point)

    while True:
        v = que.popleft()
        depth = visited[v[0]][v[1]]
        for a in [(v[0]-1, v[1]), (v[0]+1, v[1]), (v[0], v[1]-1), (v[0], v[1]+1)]:
            if field[a[0]][a[1]] == 0 and visited[a[0]][a[1]] == -1:
                visited[a[0]][a[1]] = 1 + depth
                if a == target:
                    return visited[a[0]][a[1]]
                else:
                    que.append(a)
        if len(que) == 0:
            return 0

def main()
    H, W = list(map(int, input().split()))
    target = (H, W)
    field = [[-1] * (W+2)]
    number_of_whites = 0
    for _ in range(H):
        s = input()
        number_of_whites += s.count('.')
        field.append([-1] + [0 if c=='.' else -1 for c in s] + [-1])
    field += [[-1] * (W+2)]

    shortest_path = bfs((1, 1), field, target, H, W)
    if shortest_path > 0:
        print(number_of_whites - shortest_path)
    else:
        print(-1)
        
if __name__ == '__main__':
    main()

### FIXED CODE ###

H, W = list(map(int, input().split()))
M = [[-1]*(W+2)]
ans = 0
for _ in range(H):
    s = input()
    ans += s.count('.')
    M.append([-1]+[0 if c=='.' else -1 for c in s]+[-1])
M += [[-1]*(W+2)]

queue = [(1,1)]
M[1][1] = 1
dr = [(+1,0),(-1,0),(0,+1),(0,-1)]
turn = 1
while len(queue)>0:
    turn += 1
    queue_new = []
    for qx, qy in queue:
        for dx, dy in dr:
            x, y = qx+dx, qy+dy
            if M[y][x]==0:
                M[y][x] = turn
                queue_new.append((x,y))
    queue = queue_new

print(ans-M[H][W] if M[H][W]>0 else -1)
import sys
import itertools

input = sys.stdin.readline

def main():
    l, r = [int(i) for i in input().split()] 

    mod_min = 2019

    for i, j in itertools.combinations(range(l, r+1), 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
            
    print(mod_min)

# main関数呼び出し
if __name__ == "__main__":
    main() 

### FIXED CODE ###

import sys
import itertools

input = sys.stdin.readline

def func(l, r):
    mod_min = float('inf')

    for i in range(l, r):
        for j in range(i+1, r+1):
            mod = (i*j % 2019)

            if mod == 0:
                print(mod)
                exit()     

            elif mod < mod_min:
                mod_min = mod

    print(mod_min)

def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()
n = int(input())

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

cost = {n-1:0}

def calc(k):
    if k not in cost:
        if k == n-2:
            cost[k] = abs(hs[k+1]-hs[k])
        else:
            cost[k] = min(abs(hs[k+1] - hs[k]) + calc(k+1), abs(hs[k+2] - hs[k]) + calc(k+2))
    return cost[k]

print(calc(0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n = int(input())

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

cost = {n-1:0, n-2:abs(hs[n-1]-hs[n-2])}

def calc(k):
    if k not in cost:
        cost[k] = min(abs(hs[k+1] - hs[k]) + calc(k+1), abs(hs[k+2] - hs[k]) + calc(k+2))
    return cost[k]

print(calc(0))
l, n = map(int, input().split())
s = sorted([str(input()) for _ in range(n)])
print("".join(s))

### FIXED CODE ###

N, _ = [int(x) for x in input().split()]
S = sorted([input() for _ in range(N)])
print(''.join(S))
L,R = map(int,input().split())
if R-L >= 2019:
    print(a)
else:
    ans = []
    for i in range(L,R):
        ans.append(i*j*2019)
    print(min(ans))

    

### FIXED CODE ###

l,r = map(int,input().split())
m = r-l

if m >= 2019:
  print(0)
else:
  cnt = []
  for i in range(l,r):
    for j in range(l+1,r+1):
      cnt.append(i*j%2019)
  print(min(cnt))
import numpy as np

h, w = map(int, input().split())
m = np.array([list(input()) for _ in range(h)])

black_loc = []
for i in range(h):
    for j in range(w):
        if m[i][j] == "#":
            black_loc.append((i, j))

ans = 0
for i in range(h):
    for j in range(w):
        if m[i][j] == ".":
            tmp = 1000000000
            for (b_h, b_w) in black_loc:
                tmp = min(tmp, abs(i - b_h) + abs(j - b_w))
            ans = max(ans, tmp)

print(ans)


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
m = [list(input()) for _ in range(h)]

flag = [[True] * w for _ in range(h)]

q = deque()

for i in range(h):
    for j in range(w):
        if m[i][j] == "#":
            q.appendleft((i, j, 0))
            flag[i][j] = False

ans = 0
while q:
    (i, j, n) = q.pop()
    ans = n
    for dx, dy in zip([1,0, -1, 0], [0, 1, 0, -1]):
        ni = i + dx
        nj = j + dy
        if (0 <= ni < h and 0 <= nj < w and flag[ni][nj]):
            flag[ni][nj] = False
            q.appendleft((ni, nj, n + 1))

print(ans)
n1 = int(input())
for i in range(1, 10):
  if n1 % i == 0 and n1 / i < 10:
    print("Yes")
    sys.exit()
print("No")

### FIXED CODE ###

import sys
n1 = int(input())
for i in range(1, 10):
  if n1 % i == 0 and n1 / i < 10:
    print("Yes")
    sys.exit()
print("No")
n, k = map(int,input().split())
h = list(map(int,input().split()))
c = 0

for i in len(h):
  if h[i] >= K:
    c += 1
  
print(c)

### FIXED CODE ###

n, k = map(int,input().split())
h = list(map(int,input().split()))
c = 0
 
for i in range(n):
  if h[i] >= k:
    c += 1
  
print(c)
import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(str, input().split()))
A = np.array(A)
number = np.zeros(N, dtype = int)
for i in range(N):
  number[i] = A.count(str(i + 1)
total = 0
for k in range(N):
  tmp = number[k]
  total += tmp * (tmp-1) // 2
for j in range(N):
  print(total - number[A[j]-1] + 1)


### FIXED CODE ###

import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int, input().split()))
number = np.zeros(N, dtype = int)
total = 0

dic = {}
a = sorted(A)
now_key = a[0]
value = 1
dic[now_key] = 1
for i in range(1,N):
  if a[i] == now_key:
    value += 1
  else:
    dic[now_key] = value
    if value >= 2:
      total += value * (value-1) // 2
    now_key = a[i]
    value = 1
dic[now_key] = value
if value >= 2:
  total += value * (value-1)//2
for j in A:
  print(total - dic[j] + 1)
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print("-1")
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s = w[0]
        c = w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ans = [str(i) if i != -1 else str(0) for i in str(ans)]
    anss = ''
    for s in ans:
        anss = anss + s
    print(int(anss))

solution()


### FIXED CODE ###

def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print(10**(n-1))
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s, c = w[0], w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ansb = [str(i) if i != -1 else str(0) for i in ans]
    if (ansb[0] == '0') and (len(ansb) > 1):
        ansb[0] = '1'
    anss = ''
    for s in ansb:
        anss = anss + s
    print(anss)

solution()
a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper)
     

### FIXED CODE ###

a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper())