peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]
ans = -1
for i in range(10**(n-1), 10**n):
    isAns = True
    for s, c in sc:
        isAns *= i//(10**(n-s)) % 10 == c
    if isAns:
        ans = i
        break
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    tmp = x ** 2 + y ** 2
    if m ** 2 >= tmp: ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
if n%2 == 0 :
  print(1/2)
else :
  print((n+1)/2/n)
# Judge status: Wrong Answer
s = list('ABC')
n = 3
k = 1
if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'
print (s)
# Judge status: Wrong Answer
N,M = [int(i) for i in input().rstrip().split()]
n = 1 if N > 1 else 0
C = [list(range(n,10))] + [list(range(10)) for i in range(N-1)]

for m in range(M):
    s,c = [int(i) for i in input().rstrip().split()]
    s -= 1
    if c in C[s]:
        C[s] = [c]
    else:
        print(-1)
        exit()
    print(C)
C = [str(min(c)) for c in C]
print("".join(C))
# Judge status: Accepted
A, B, C = map(int, input().split())

if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
    print(0)
else:
    print(A * B * C // max(A, B, C))
# Judge status: Accepted
import sys
N = int(input())
A = list(map(int, input().split()))

if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
    sys.exit()

capacity = [1 - A[0]]
for i in range(N):
    capacity += [2 * (capacity[-1] - A[i])]


corr_flag = 1
if A[-1] > capacity[-1]:
    corr_flag = 0
curr = A[-1]
ans = A[-1]
for i in range(N-1, -1, -1):
    curr = min(capacity[i], A[i] + curr)
    ans += curr
if corr_flag:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

current_money = 1000
for i in range(N-1):
    stock = 0
    if A[i] < A[i+1]:
        stock = current_money // A[i]
    current_money += (A[i+1] - A[i]) * stock

print(current_money)
# Judge status: Wrong Answer
S = input()
s = reversed(S)

T = ''

for i in s:
    T += i
    if T in ['maerd', 'remaerd', 'esare', 'resare']:
       T = ''
    if len(T) >= 6:
        print('NO')
        break
if len(T) == 0:
    print('YES')
# Judge status: Wrong Answer

def Same_Integers(abc):

    ans = 0
    abc.sort()
    count = abc[2]*3 - abc[0] - abc[1] - abc[2]

    if count % 2 == 0:
        ans = count / 2
    else:
        ans = (count + 3) // 2

    return ans

def main():
    abc = list(map(int , input().split()))
    print(Same_Integers(abc))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

B = []
for i in range(M-1):
  B.append(abs(A[i+1]-A[i]))
B.sort()
#print(A)
#print(B)   

if N >=M:
  ans = 0
if N == 1:
  ans = sum(B)
else:
  ans = sum(B[:-(N-1)])
print(ans)
           
#dp[i][j]: i個目までにj
# Judge status: Accepted
def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
    

div = 10**9+7
n,a,b = map(int,input().split())

cn = pow(2,n,div)-1
ca = combinations(n,a,div)
cb = combinations(n,b,div)

print((cn-ca-cb)%div)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
x = -(-a // d)
y = -(-c // b)
if x == y:
    print('Yes')
if x < y:
    print('No')
if x > y:
    print('Yes')
# Judge status: Wrong Answer
s = input()
s1 = sorted(s)
s2 = input()


ans = 0
ans2 = 0



for i in s2:
    if s == s2:
        break
    if s1[0] <= i:
        ans = ans + 1
        for k in range(0,len(s1)):
            if s1[k] <= i:
                ans2 = ans2 + 1
    
if ans != 0 and ans2 != 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B = map(int,input().split())
if (A+B)%3==0 or A%3==0 or B%3==0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
import math
n, x, y = map(int,input().split())
dif = y-x
ans = [0]*(n-1)

for i in range(1,n):
    for j in range(i+1,n+1):
        dist = abs(x-i)+abs(y-j)+1
        ans[min(dist,(j-i))-1] += 1

for i in ans:
    print(i)
# Judge status: Wrong Answer


n = int(input())
n-=1
ans = (n//11)*2
if(n%11<=4):
    ans+=1
else:
    ans+=2

print(ans)
# Judge status: Accepted
S = input()
ans = S.replace("hi", "")

if ans == "":
        print("Yes")
else:
        print("No")
# Judge status: Accepted
def main():
    n = int(input())
    l = len(str(n))
    v = int(str(n)[0]) + 9 * (l - 1)
    if str(n)[1:] == '9' * (l - 1):
        print(v)
    else:
        print(v-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
H = int(input())
W = int(input())
N = int(input())

if N%max(H, W)==0:
    print(N//max(H, W))
else:
    print(N//max(H, W) + 1)
# Judge status: Wrong Answer
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/14
# Filename: main 
# Author: acto_mini

def main():
    A, B, C = map(int, input().split())

    if A % 2 != C % 2:
        print("NO")
        exit()

    for i in range(1, B*A+1):
        if (i * A) % B == C:
            print("YES")
            break
    else:
        print("NO")

    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a=int(input())
print('Yes' if a=='5' or a=='3' or a=='7' else 'No')
# Judge status: Accepted
n=int(input())
v = [int(_) for _ in input().split()]
v.sort()
for i in range(n - 1):
    v[i+1] = (v[i] + v[i + 1]) / 2
print(v[-1])
# Judge status: Wrong Answer
N = int(input())
A1 =list(map(int, input().split()))
A2 =list(map(int, input().split()))

candy = []

def sum_A1(x):
  cnt = 0
  for i in range(x):
    cnt += A1[i]
  return cnt

def sum_A2(x):
  cnt = 0
  for i in range(x-1,N):
    cnt += A2[i]
  return cnt

for i in range(N):
  candy.append(sum_A1(i) + sum_A2(i))
  
print(candy)
# Judge status: Accepted
a, b = map(int, input().split())
if a > b:
    print(a-1)
else:
    print(a)
# Judge status: Wrong Answer
#105_B
N=int(input())
flg=False
for i in range(0,N//7+1):
    x=N
    x=x-7*i
    if N%4==0:
        flg=True
        break
print('Yes' if flg else 'No')
# Judge status: Accepted
S=list(input())

S.sort()

if S[0]==S[1] and S[1]!=S[2] and S[2]==S[3]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
n=int(input())
print(int(math.sqrt(n))**2)
# Judge status: Wrong Answer
S = [input()]

# 問題文の通りに実装する
n = len(S)
for i in range(n):
  S[i] = 'x'

ans = ''
for i in range(n):
  ans += S[i]
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x,y = map(int,input().split())
cnt = 0
while True:
    a = x*2**cnt
    if a>y:
        break
    cnt+=1
print(cnt)
# Judge status: Accepted
def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N,M=map(int,input().split())
divisors=make_divisors(M)
ans=0
for d in divisors:
    if N*d<=M:
        ans=d
    else:
        break
print(ans)
# Judge status: Wrong Answer
import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()

n = math.floor(N/2)
j = True

for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#a,b=map(int,input().split())
n=int(input())
#s=input()
if n<15:
  print(n*800)
else:
  print(n*800-(n//15)*200)
# Judge status: Accepted

def actual(N):
    max_count = 0
    max_number = 1

    for i in range(1, N + 1):
        num = i
        count = 0

        while num % 2 == 0:
            num = num // 2
            count += 1

        if count >= max_count:
            max_number = i
            max_count = count

    return max_number

  
N = int(input())

print(actual(N))
# Judge status: Accepted
N = int(input())

back = 0

x = 800 * N
y = N // 15 * 200

back = x - y
print(back)
# Judge status: Wrong Answer
n, m = map(int, input().split())
C = {}
ans = 0
for _ in range(n):
    a, b = map(int, input().split())
    C[a] = b

for k, v in sorted(C.items()):
    if m > v:
        ans += k*v
        m -= v
    else:
        ans += k*m
        print(ans)
        exit()
# Judge status: Accepted
n = int(input())-2
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = A[0]
for i in range(n//2):
    ans += 2*A[i+1]
if n%2 != 0:
    ans += A[n//2+1]
print(ans)
# Judge status: Wrong Answer
A,B,K = map(int , input().split())
if A > K:
    A = A - K
else:
    B = B + A - K
    A = 0

print(str(A) + ' ' + str(B))
# Judge status: Accepted
n = int(input())
if n%111==0: print(n)
else: print(n+111-(n%111))
# Judge status: Accepted
A,B = map(int,input().split())
if A>=13:
    print(B)
elif A>=6:
    print(B//2)
else:
    print(0)
# Judge status: Wrong Answer
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
l = a.index(1)
r = n - l - 1
if n == k:
    print(1)
else:
    print(math.ceil(l / (k - 1)) + math.ceil(r / (k - 1)))
# Judge status: Wrong Answer
if int(input())<999:
    print('ABC')
else:
    print('ABD')
# Judge status: Accepted
a, b = map(int, input().split())
print(str(min(a, b)) * max(a, b))
# Judge status: Accepted
n = int(input())
a = int(input())

m = n % 500
if m <= a:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np

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

As = np.array([["." for n in range(N)] for nn in range(N)])
for n in range(N):
  As[n,:] = np.array(list(input()))
  
Bs = np.array([["." for n in range(M)] for nn in range(M)])
for m in range(M):
  Bs[m,:] = np.array(list(input()))
  
ok = False
for i in range(N-M):
  for j in range(N-M):
    if (As[i:i+M,j:j+M] == Bs).all():
      ok = True
      break
if ok:
  print("Yes")
else:
  print("No")
# Judge status: Accepted


from collections import Counter
N = int(input())
D = list(map(int, input().split()))

if D[0] != 0:
    print(0)
    exit()

MOD = 998244353

c = Counter(D)
if c[0] != 1:
    print(0)
    exit()

key = list(c.keys())
key.sort()

ans = 1
for k in key:
    if k >= 1:
        if k-1 not in c:
            print(0)
            exit()
        else:
            ans *= c[k-1] ** c[k]
            ans %= MOD

print(ans)
# Judge status: Wrong Answer
X = int(input())

go = [i**5 for i in range(1000)]


def foo():
    for i in range(1000):
        for j in range(i, 1000):
            if go[i] - go[j] == X:
                return i, j
        for j in range(1000):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


A, B = foo()
print(A, B)
# Judge status: Accepted
# B - Tax Rate
from math import ceil, floor


def main():
    N = int(input())
    x = ceil(N / 1.08)
    is_possible = floor(x * 1.08) == N
    print(x if is_possible else ":(")


if __name__ == "__main__":
    main()
# Judge status: Accepted
def addRoute(i, c):
  t = ''
  for _ in range(i):
    t += c
  return t

pos=list(map(int, input().split()))
ud = pos[3] - pos[1]
rl = pos[2] - pos[0]
s = ''

s += addRoute(ud, 'U')
s += addRoute(rl, 'R')
s += addRoute(ud, 'D')
s += addRoute(rl, 'L')
s += 'L'
s += addRoute(ud+1, 'U')
s += addRoute(rl+1, 'R')
s += 'DR'
s += addRoute(ud+1, 'D')
s += addRoute(rl+1, 'L')
s += 'U'
print(s)
# Judge status: Accepted
A, B, C = [int(i) for i in input().split()]
t, a, s = [A, B, C]
ans = 0


while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    if A == B == C:
        ans = -1
        break
    t = B / 2 + C / 2
    a = A / 2 + C / 2
    s = A / 2 + B / 2
    A = t
    B = a
    C = s
    ans += 1

print(ans)
# Judge status: Accepted
s = input()
char = [0, 0, 0]
for i in range(len(s)):
    if s[i] == "a":
        char[0] += 1
    elif s[i] == "b":
        char[1] += 1
    else:
        char[2] += 1
char.sort()
char[2] -= char[0]
char[1] -= char[0]
char[0] = 0
if char[1]<=1 and char[2]<=1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s=input()
if (('W' in s)+('E' in s))%2:
	print('No')
elif (('N' in s)+('S' in s))%2:
	print('No')
else:
	print('Yes')
# Judge status: Wrong Answer
data = input().split()

a,b,c = int(data[0]), int(data[1]), int(data[2])

for i in range (a, a + c):
    if (i < a + c or i > b - c):
        print(i)

for i in range (max(a + c + 1, b - c + 1), b + 1):
    if (i < a + c or i > b - c):
        print(i)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i > 0 and a[i] == a[i-1]+1:
        print(i)
        print(a[i], a[i-1]+1)
        ans += c[a[i-1]-1]
ans += sum(b)
print(ans)
# Judge status: Wrong Answer
data = input().split()

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

if a + b + c == 21:
  print("win")
else:
  print("bust")
# Judge status: Accepted
import math
n,x,t = map(int, input().split())
ans = math.ceil(n/x) * t
print(ans)
# Judge status: Accepted
abc = list(map(int, input().split()))
abc.sort()
print(abc[2] * 10 + abc[0] + abc[1])
# Judge status: Accepted
A, B = map(int, input().split())
S = input()
try:
    int(S[:A]+S[A+1:])
    try:
        int(S)
        print("No")
    except:
        print("Yes")
except:
    print("No")
# Judge status: Accepted
K, X = map(int, input().split())
if 500*K >= X:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,a,b = map(int,input().split())
print((b-a)*(n-2)+1 if (b-a)*(n-2)+1 >= 0 else 0)
# Judge status: Wrong Answer
N=list(input())
ans=0
for i in range(len(N)):
    if i==len(N)-1:
        if len(N)%2==1:
            s=""
            for num in N:
                s=s+num
            s=int(s)-10**i
            if len(N)>=2:
                s+=1
            ans+=s
    else:
        if i%2==0:
            ans+=10**(i+1)-10**i
print(ans)
# Judge status: Accepted
S = input()
if S[5] == "1":
  print("TBD")
elif int(S[6]) > 4:
  print("TBD")
else:
  print("Heisei")
# Judge status: Accepted
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
t=1
for _ in range(60):
  n = sum(x%2 for x in A)
  A = [x//2 for x in A]
  res += n*(N-n)*t
  t = t*2
  res = res%(7+10**9)
  if all(x==0 for x in A):
    break
print(res)
# Judge status: Accepted
w,h,n = map(int, input().split())
wl=0
hb=0
for i in range(n):
    x,y,a = map(int, input().split())
    if a==1:
        if x>wl:
            wl=x
    if a==2:
        if x<w:
            w=x
    if a==3:
        if y>hb:
            hb=y
    if a==4:
        if y<h:
            h=y
if h>=hb and w>=wl:
    ans=(h-hb)*(w-wl)
else:
    ans=0
print(ans)
# Judge status: Wrong Answer
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

v = A[1:] - A[:-1]
# print(v)

cnt = 0
i = 0
while i < len(v) - 1:
    # print('i', i)
    if v[i] * v[i + 1] < 0:
        cnt += 1
        i += 1
    i += 1
ans = cnt + 1
print(ans)

# 単調非減少 : v[i + 1] - v[i] >= 0
# 単調非増加 : v[i + 1] - v[i] <= 0
# 折り返し点 : v[i] * v[i + 1] < 0 and v[i + 1] * v[i + 2] < 0
# Judge status: Wrong Answer
S=input()
if S[-1:]=="s":
    print("S"+"es")
else:
    print("S"+"s")
# Judge status: Accepted
a,b,k = map(int,input().split())
for i in range(k):
  if a+i <= b:
    print(a+i)
for i in range(k)[::-1]:
  if a+k <= b-i:
    print(b-i)
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int, input().split())

A=60*H2+M1 - K

print(A-60*H1-M1)
# Judge status: Wrong Answer
N = int(input())
CC = [0] * (N-1)
SS = [0] * (N-1)
FF = [0] * (N-1)

for i in range(N-1):
    C, S, F = map(int,input().split())
    CC[i] = C
    FF[i] = F
    SS[i] = S

for i in range(N-1):
    T = 0
    Max = 0
    for k in range(i,N-1):
        Max = max(T, SS[k])
        U = Max % FF[k]
        T = Max - U + FF[k] + CC[k]
        #print(i,k,T)
    print(T)
print(0)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort(), b.sort()
tmp = sum(b) - sum(a)
if tmp < 0:
    print('No')
    exit()

total = 0
for i in range(N):
    if a[i] <= b[i]:
        total += b[i] - a[i]
if tmp == total:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,k = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
if n==2:
    print(A[0]+A[1]-k)
    exit()
for i in range(1, n):
    if A[i]+A[i-1]<=k:
        continue
    ans += (A[i]+A[i-1])-k
    A[i] = k-A[i-1]
print(ans)
# Judge status: Wrong Answer
char = input()
if char in "a" and "b" and "c":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
C = input()
nw = C.count('W')
nr = N - nw

if nw == N or nr == N:
    print(0)
else:
    a = C[:nr]
    b = C[nr:]
    nw = a.count('W')
    nr = b.count('R')
    n = min(nw, nr)
    m = max(nw, nr) - n
    print(n + m)
# Judge status: Accepted
k = 0
A,B,C = map(int,input().split( ))
K = int(input())
while  (B <= A) and (k < K):
    B *= 2
    k += 1
while (C <= B) and (k < K):
    C *= 2
    k += 1
if A < B < C:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
if __name__ == '__main__':
	a,b,c = map(int, input().split())
	l = [b,c]
	if a in l:
		if b == c:
			print('No')
		else:
			print('Yes')
	else:
		if b == c:
			print('Yes')
		else:
			print('No')
# Judge status: Accepted
N = [int(_) for _ in list(input())]
a, b = 0, 1
for n in N:
    a, b = min(a+n, b+10-n), min(a+(n+1), b+10-(n+1))
print(a)
# Judge status: Accepted
N,M = map(int,input().split())

x = [False for i in range(N+1)]
y = [False for i in range(N+1)]

for i in range(M):
    a,b = map(int,input().split())
    a,b = min(a,b), max(a,b)
    if a == 1:
        x[b] = True
    if b == N:
        y[a] = True

ans = 'IMPOSSIBLE'
for i in range(N+1):
    if x[i] and y[i]:
        ans = 'POSSIBLE'
print(ans)
# Judge status: Accepted
from itertools import permutations

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

cnt_p = 1
for case in permutations(range(1, n+1)):
    if p == list(case):
        p_n = cnt_p
    cnt_p += 1

cnt_q = 1
for case in permutations(range(1, n+1)):
    if q == list(case):
        q_n = cnt_q
    cnt_q += 1
print(abs(p_n - q_n))
# Judge status: Accepted
N = int(input())
left = 0
right = 10 ** 7 + 1
while right - left > 1:
    mid = (left + right) // 2
    if mid * (mid + 1) // 2 < N:
        left = mid
    else:
        right = mid
ans = {i for i in range(1, right + 1)}
rem = N - right
except_n = right * (right - 1) // 2 - N + right
ans -= {except_n}
[print(i) for i in ans]
# Judge status: Accepted
import sys

x = input().split()

for i in range(len(x)):
    if x[i] == '0':
        print(i + 1)
        break
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

C = [None] * N
C[0] = B[0]
C[-1] = B[-1]

for i in range(1, N - 1):
    C[i] = min(B[i - 1], B[i])

print(sum(C))
# Judge status: Wrong Answer
S,T =input().split()
print("T"+"S")
# Judge status: Accepted
def maxvolume( s ): 
  
    # finding length 
    length = (s / 3) 
      
    s -= length 
      
    # finding breadth 
    breadth = s / 2
      
    # finding height 
    height = s - breadth 
      
    return (length * breadth * height) 
l=int(input())
print(maxvolume(l))
# Judge status: Wrong Answer

n=int(input())

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)

min=9999999
#b= n-a
for a in range(0,n):
    b=n-a
    sum_a=digitSum(a)
    sum_b=digitSum(b)
    sum_ab=int(sum_a)+int(sum_b)
   
    if sum_ab < min:
        min=sum_ab

print(min)
# Judge status: Wrong Answer
n = int(input())

now = [0, 0]
time = 0

for i in range(n):
    array = list(map(int, input().split()))
    dist = abs(now[0] - array[1]) + abs(now[1] - array[2])
    time_diff = array[0] - time
    if time_diff < dist:
        print('No')
        exit()
    else:
        if dist%2 == time_diff%2:
            continue
        else:
            print('No')
            exit()
        time = array[0]

print('Yes')
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    if A <= B:
        r = (B+ W*T) - (A + V*T)
        if r <= 0:
            print("YES")
        else:
            print("NO")
    else:
        r =   (B- W*T)-(A - V*T)
        if r >= 0:
            print("YES")
        else:
            print("NO")

if __name__ == '__main__':
    main()
# Judge status: Accepted
s = str(input())
if s[-1]=='s':
  print(s+'es')
else:
  print(s+'s')
# Judge status: Accepted
#ABC159A
import sys
n, m = map(int, sys.stdin.readline().split())
#print(n, m)

print(n*(n-1)//2 + m*(m-1)//2) #偶偶or 奇奇
# Judge status: Accepted
n, m = map(int, input().split())
s = [0]*m
c = [0]*m
for i in range(m):
    s[i], c[i] = map(int, input().split())

ans = -1

for num in range(0, 1000):
    num_car = str(num)

    con1 = len(num_car) == n

    con2 = True
    for i in range(m):
        if con1 and num_car[s[i] - 1] != str(c[i]):
            con2 = False

    if con1 and con2:
        ans = num
        break

print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    s = [0 for i in range(10**5+1)]
    sa = sum(a)
    for i in a:
        s[i] += 1
    q = int(input())
    for _ in range(q):
        b, c = map(int, input().split())
        s[c] += s[b]
        sa += (c-b)*s[b]
        s[b] = 0
        print(sa)

main()
# Judge status: Accepted
result = [1,2,3]
first_input = int(input())
second_input = int(input())
result.remove(first_input)
result.remove(second_input)
print(result[0])
# Judge status: Accepted
def main():
    N, K = map(int, input().split())
    S = input()
    S = 'R' + S + 'L'
    a = S[0]
    b = S[1]
    s = 0
    for c in S[2:]:
        if c == 'R' and b == 'R':
            s += 1
        if b == 'L' and a == 'L':
            s += 1
        a = b
        b = c
    print(min(N-1, s + 2 * K))
main()
# Judge status: Accepted
n = int(input())
b_list = list(map(int, input().split()))
q = int(input())
a_list=[0]*100000
for i in b_list :
  a_list[i-1]+=1
count=sum(b_list)
for i in range(q):

  b, c = map(int, input().split())
  count+=(c-b)*a_list[b-1]
  print(count)

  a_list[c - 1] +=a_list[b-1]
  a_list[b - 1] = 0
# Judge status: Accepted
# -*- coding: utf-8 -*-
from collections import defaultdict
from scipy.special import comb

n = int(input())
d = defaultdict(int)
for _ in range(n):
    d[''.join(sorted((list(input()))))] += 1

print(sum([comb(i, 2, exact=True) for i in d.values()]))
# Judge status: Wrong Answer
N = int(input())
S = list(input())
al = [chr(ord("a") + i ) for i in range(26)]
cntAl = [ S.count(chr(ord("a") + i )) for i in range(26)]
ans = 1
for a in cntAl:
    if a != 0:ans *= (a+1)
print(ans-1)
# Judge status: Accepted
a, b, c = map(int, input().split())
 
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    print(0)    
    exit() 
    
if a == b == c:
    print(-1)
    exit()
    
cnt = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0): 
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    cnt += 1
 
print(cnt)
# Judge status: Accepted
N,K = map(int,(input().split()))
D = list(map(int,(input().split())))
for i in range(N,100000):
    for j in D:
        if str(j) in str(i):
            break
    else:
        print(i)
        break
# Judge status: Wrong Answer
n = int(input())
k = 0
for i in range(1, 10):
  for j in range(i, 10):
    seki = i * j
    if n == seki:
      print("Yes")
      k += 82
    else:
      k += -1
if k < -1:
  print("No")
# Judge status: Accepted
a = list(map(int,input().split()))
cna = cnb = 0
a.sort()
x = a[2]-a[1]
y = a[1]-a[0]
if a[0]*a[1]*a[2]%2 != 0:
    print(0)
    exit()
while True:
    if x%2 == 0 and x != 0:
        cna += 1
        x //= 2
    else:
        break
while True:
    if y%2 == 0 and y != 0:
        cnb += 1
        y //= 2
    else:
        break
if cna == 0 and cnb == 0:
    print(-1)
else:
    print(min(cna,cnb))
# Judge status: Accepted
c = input()

if c in "aeiou":
    print("vowel")
else:
    print("consonant")