peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())

count = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, N + 1):
    s = str(i)
    prefix = int(s[0])
    surfix = int(s[-1])
    if surfix != 0:
        count[prefix - 1][surfix - 1] += 1

ans = 0
for i in range(9):
    for j in range(9):
        ans += count[i][j] * count[j][i]

print(ans)
# Judge status: Accepted
a=list(input())
b=list(input())
c=0
d=0
for x in a:
  if x!=b[d]:
    c +=1
  d+=1

print(c)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
clear=0
bclear=0
for i in range(n):
  if (s[i]=="a"):
    if (clear<a+b):
      print("Yes")
      clear+=1
    else:
      print("No")
  elif (s[i]=="b"):
    if (clear<a+b and bclear<b):
      print("Yes")
      clear+=1
      bclear+=1
    else:
      print("No")
  else:
    print("No")
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.reverse()

if k>=len(h):
    print(0)

else:
    h = h[k:]
    print(sum(h))
# Judge status: Accepted
print(['ABC', 'ABD'][len(input())==4])
# Judge status: Wrong Answer
n,*a=open(0).read().split()
s=set()
for i in a:
  s^=set(i)
print(len(s))
# Judge status: Accepted
N,K = map( int ,input().split())
N_list = [0]*N
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        N_list[num_list[j]-1] +=1
print(N_list.count(0))
# Judge status: Accepted
def gcd(n,m):
  if n>m:
    return gcd(m,n);
  if n==0:
    return m;
  return gcd(m-n*(m//n),n)
 
def lcm(x, y):
    return (x * y) // gcd(x, y)
  
n=int(input())
a=list(map(int,input().split()))
s=1
for i in a:
  s=lcm(s,i)
ans=0
for i in a:
  ans+=s//i
print(ans % 1000000007)
# Judge status: Accepted
# 2020/02/01
# AtCoder Beginner Contest 072 - C

# Input
n = int(input())
a = list(map(int, input().split()))

cntlist = [0] * (10 ** 5 + 2)

# Count

for i in range(n):
    for j in range(-1, 2):
        wk_val = a[i] + j
        if wk_val < 0:
            wk_val = 10**5 + 1

        cntlist[wk_val] = cntlist[wk_val] + 1

ans = max(cntlist)

# Output
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))
i = 1
while  n > k + (k-1)*(i-1):
    i += 1

print(i)
# Judge status: Wrong Answer
c=str(input())
if c=="a"or"i"or"u"or"e"or"o":
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
n,q = map(int,input().split())
s = input()
cnt = [0]*(n+1)
p = s[0]
for i in range(1,n+1):
    if p == "A" and s[i-1] == "C":
            cnt[i] = cnt[i-1] +1
    else:
        cnt[i] = cnt[i-1]
    p = s[i-1]

for i in range(q):
    l,r = map(int,input().split())
    print(cnt[r] - cnt[l])
# Judge status: Accepted
n,k=map(int,input().split())
A=list(map(int,input().split()))

time=0
color=["white" for _ in range(n+1)]
D=[-1 for _ in range(n+1)]
C,s=[],A[0]
point=0
while 1:
    if color[s]=="white":
        color[s]="gray"
        C.append(s)
        D[s]=time
        time +=1
        s=A[s-1]
    else:
        point=D[s]
        break

loop=C[point:]
if k>len(C):
    k -=point+1
    print(loop[k%len(loop)])
else:print(C[k-1])
# Judge status: Accepted
N=input()
n=int(N)
head=N[0]
tmp=int(head*3)
if n>tmp:
  t=str(int(head)+1)
  print(t*3)
else:
  print(tmp)
# Judge status: Accepted
x = int(input())

a = -1000
b = -1000

for _ in range(2000):
    for _ in range(2000):
        if (a ** 5) - (b ** 5) == x:
            print('{0} {1}'.format(a,b))
            exit()
        b += 1
    b = -2000
    a += 1
# Judge status: Accepted
n,k = map(int,input().split())
now = list(map(int,input().split()))
#import heapq
for _ in range(k):
  last = now
  now = []
  imos = [0 for _ in range(n+1)]
  for i in range(n):
    l = max(0,i-last[i])
    r = min(n,i+last[i]+1)
    imos[l] += 1
    imos[r] -= 1
  now.append(imos[0])
  for i in range(1,n):
    now.append(now[-1]+imos[i])
  #print(now)
  if sum(now) == n**2:
    print(' '.join(map(str,now)))
    exit()
print(' '.join(map(str,now)))
# Judge status: Wrong Answer
from fractions import gcd
a,b = map(int,input().split())

c = gcd(a,b)
max_n = int(c**(1/2))+1
primes = [2]
cand = list(range(3,max_n+1, 2))
while(cand):
    next = []
    div = cand[0]
    primes.append(div)
    for i in range(1,len(cand)):
        tmp = cand[i]
        if(tmp%div != 0):
            next.append(tmp)
    cand = next[::]

nums = 1
for i in primes:
    if(c%i==0):
        nums += 1

print(nums)
# Judge status: Accepted
ABC=list(map(int,input().split()))

if len(set(ABC))==2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
print("Heisei" if input()<="2019/4/30" else "TBD")
# Judge status: Accepted
A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
  i = str(i)
  if i[0] == i[4] and i[1] == i[3]:
    cnt += 1
print(cnt)
# Judge status: Accepted
n,k = map(int,input().split())
A = list(map(int,input().split()))

if sum(A)-n <= k:
    print(1)
    exit()
elif k == 0:
    print(max(A))
    exit()
top = 10**9
bottom = 1
def ok(x):
    res = 0
    for a in A:
        res += (a-1)//x
    return res <= k
while top - bottom > 1:
    mid = (top + bottom)//2
    if ok(mid):
        top = mid
    else:
        bottom = mid
print(top)
# Judge status: Accepted
n = int(input())
ans = 10**n - 9**n - 9**n + 8**n
print(ans%(10**9 + 7))
# Judge status: Accepted
N=int(input())
S=input()
Wcum=[0]*(N+1)
Bcum=[0]*(N+1)
for i in range(N):
    Wcum[i+1]=Wcum[i]+(S[i]=='.')
    Bcum[i+1]=Bcum[i]+(S[i]=='#')
ans=N
for i in range(N+1):
    ans=min(ans,(i-Wcum[i])+(N-i-(Bcum[N]-Bcum[i])))
print(ans)
# Judge status: Accepted
line = input()
A,B,C = [int(n) for n in line.split()]
print(min(B//A,C))
# Judge status: Accepted
n = int(input())
lis = []
for i in range(n):
    a,b =map(int,input().split())
    lis.append([a-b,a+b])
lis.sort(key = lambda x:x[1])
ans = 0
now = -10 ** 10
for a,b in lis:
    if now <= a:
        ans += 1
        now = b
print(ans)
# Judge status: Accepted
D, T, S = map(int, input().split())

if D / S <= T:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
X = int(N ** 0.5)
print(X **2)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    print(int((A + B) / 2)if (A + B) % 2 == 0 else 'IMPOSSIBLE')


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int,input().split())

def kai(n):
    u = 1
    for i in range(1,n+1):
        u = (u*(i%(10**9+7)))%(10**9+7)
    return u
        
if abs(n-m)==1:
    print((kai(n)*kai(m))%(10**9+7))
elif n-m==0:
    print((kai(n)*kai(m)*2)%(10**9+7))
else:
    print(0)
# Judge status: Wrong Answer
x = int(input())
 
for val in range(x, x**100) :
	if x ==2 :
		print(x)
		break
	elif ((2** (val-1)) % val) == 1 :
		print (val)
		break
	else :
		continue
# Judge status: Accepted
N = int(input())
A,B = [0]*N,[0]*N
for i in range(N):
    A[i],B[i] = map(int,input().split())
A = sorted(A)
B = sorted(B)
if N%2 == 1:
    ans = B[int((N-1)/2)] - A[int((N-1)/2)] + 1
elif N%2 == 0:
    ans = B[int(N/2)] + B[int(N/2-1)] - A[int(N/2)] - A[int(N/2-1)] + 1
print(ans)
# Judge status: Accepted
w, h, x, y = map(int, input().split())

if x == w/2 and y == h/2:
  print(w*h/2, 1)
else:
  print(w*h/2, 0)
# Judge status: Accepted
s = input()
i = 0
start = 0
pre = ""
ans = 0
while i < len(s):
    if i < len(s) and s[start: i + 1] != pre:
        pre = s[start: i + 1]
        start = i + 1
        ans += 1
    i += 1
print(ans)
# Judge status: Accepted
from collections import deque

K = int(input())

q = deque()
for i in range(1,10):
    q.append(i)
ans=0
if K>=10:
    cnt = 9
    while len(q)>0:
        current = q.popleft()

        dn = [-1,0,1]
        for i in dn:
            if current%10+i<0 or current%10+i>9 or cnt>=K:
                continue
            q.append(current*10+current%10+i)
            cnt+=1
    else:
        ans=current

else:
    ans = K
    
print(ans)
# Judge status: Wrong Answer
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())

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

if (a+b)%2 != 0:
    print("INPOSSIBLE")
else:
    print((a+b)//2)
# Judge status: Accepted
n,m = map(int,input().split())
n += 1
p = [1]*n
r = [0]*n
r[1] = 1
for i in range(m):
    x,y = map(int,input().split())
    if r[x]:
        r[y] = 1
        if p[x] == 1:
            r[x] = 0
    p[x] -= 1
    p[y] += 1
    
print(sum(r))
# Judge status: Wrong Answer
n = input()
l = input().split()
print(1)
# Judge status: Accepted
import math
N = int(input())
CSF = []
for _ in range(N-1):
    c, s, f = map(int, input().split())
    CSF.append((c, s, f))

ans = []
for i in range(N):
    T = 0
    for j in range(i, N-1):
        T = max(CSF[j][1], math.ceil(T/CSF[j][2])*CSF[j][2])
        T += CSF[j][0]
    ans.append(T)


print(*ans, sep='\n')
# Judge status: Wrong Answer
num_list = list(map(int, input().split()))
k = int(input())

tmp_lists = []
for i in range(3):
    ans_lists = num_list.copy()
    ans_lists[i] = num_list[i]*(k*2)
    tmp_lists.append(ans_lists)

max = 0

for list in tmp_lists:
    sum = 0
    for k in list:
        sum += k
    if max < sum:
        max = sum

print(sum)
# Judge status: Accepted

s=input()
if s=='Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
# Judge status: Accepted
x=int(input())

for a in range(120):
    for b in range(-120,120):
        if x==a**5-b**5:
            print(a,b)
            exit()
# Judge status: Wrong Answer
n = int(input())
lis = []
for _ in range(n):
  x, l= list(input().split(" "))
  p_d = int(x) + int(l)
  m_d = int(x) - int(l)
  lis.append([m_d, p_d])

lis.sort()
a = -10 ** 10
x = 0

for b in range(n):
  if lis[b][0] >= a:
    x += 1
    a = lis[b][1]

print(lis)
# Judge status: Accepted
from collections import Counter
count = list(map(int, input().split()))
count = Counter(count)
print(len(count))
# Judge status: Accepted

N = int(input())
dp = [[0 for _ in range(10)] for _ in range(10)]

def pair(n):
  num = str(n)
  p = int(num[0])
  s = n % 10
  return (p, s)


for i in range(1, N+1):
  pre, suf = pair(i)
  dp[pre][suf] += 1

ans = 0
for i in range(1, N+1):
  suf, pre = pair(i)
  ans += dp[pre][suf]

print(ans)
# Judge status: Wrong Answer
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import heapq

def main():
    numbers=[]
    n = int(input())
    [numbers.append(int(input().rstrip())) for _ in range(n)]
    heapq.heapify(numbers)

    for i in numbers:
        if i == max(numbers):
            print(min(heapq.nlargest(2,numbers)))
        else:
            print(max(heapq.nlargest(1,numbers)))
    

if __name__=="__main__":
    main()
# Judge status: Accepted
n=int(input())
word_list=[]
last_word='aaaa'
for i in range(n):
    w=input()
    if 0<i and (w in word_list or last_word[len(last_word)-1]!=w[0:1]):
        print('No')
        exit()
    word_list.append(w)
    last_word=w
print('Yes')
# Judge status: Accepted
x=range(1,int(input())+1)
y=[t for t in x if t%2==0]
z=[t for t in x if t%2==1]
print(len(y)*len(z))
# Judge status: Accepted
n = int(input())
P = list(map(int, input().split(' ')))

count = 0
minimum = 2 * 10 ** 5 + 1
for p in P:
    if p < minimum:
        count += 1
        minimum = p
print(count)
# Judge status: Accepted
r, g, b = map(int,input().split())
print('YES') if (2*g + b) % 4 == 0 else print('NO')
# Judge status: Wrong Answer
s = input()
t = input()

n = len(s)
a = [-1]*26
flg = True

for i in range(n):
    snum = ord(s[i]) - 97
    tnum = ord(t[i]) - 97
    if a[snum] == -1:
        a[snum] = tnum
        if a[tnum] == -1:
            a[tnum] = snum
        elif a[tnum] != snum:
            flg = False
            break
    elif a[snum] != tnum:
        flg = False
        break
    
print('Yes') if flg else print('No')
# Judge status: Accepted
import re

s = input()

m = re.match(r"^(dream|dreamer|erase|eraser)+$", s)

print("NO" if m is None else "YES")
# Judge status: Accepted
# coding: utf-8
import math

(n, m) = [int(i) for i in input().rstrip().split(" ")]

ans = 0
divList = []
for i in range(1, int(math.sqrt(m)) + 1):
    if m % i == 0:
        j = m / i
        divList.append(i)
        divList.append(j)
divList = sorted(divList)
for i in divList:
    if i < n:
        continue
    ans = m / i
    break

print(int(ans))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
zr = 0
for i in range(n-1):
  # a[i] <0かつa[i+1]>0 でabs(a[i])>=abs(a[i+1])
  if (a[i] <= 0 and a[i+1]>=0 and abs(a[i]) >= abs(a[i+1])) or (a[i]<=0 and a[i+1]<=0):
    a[i] *=-1
    a[i+1] *=-1
  #print(*a)
print(sum(a))
# Judge status: Wrong Answer
import numpy as np
from scipy.spatial.distance import minkowski

n, m = map(int, input().split())
a = np.array([list(map(int, input().split())) for i in range(n)])
for i in range(m):
    b = np.array(list(map(int,input().split())))
    c = np.array([minkowski(i, b , 1) for i in a], dtype=np.int64)
    ans = np.argmin(c) + 1
    print(ans)
# Judge status: Accepted
n = int(input())
plist = list(map(int, input().split()))
nlist = sorted(plist)

ng_cnt = 0
for p, n in zip(plist, nlist):
    if p != n:
        ng_cnt += 1
if ng_cnt >2:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
A,B=map(int,input().split())
if A<=8 and B<=8:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
# 116a

def atc_116a(input_value: str) -> int:
    tri_length = [int(ai) for ai in input_value.split(" ")]
    tri_length.sort()
    return int((tri_length[0] * tri_length[1] / 2))

input_value = input()
print(atc_116a(input_value))
# Judge status: Accepted
n,m = map(int,input().split())
ab = [[-1] for i in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    if ab[a-1][-1] == -1:
        ab[a-1][-1] = b-1
    else:
        ab[a-1].append(b-1)
flg = False
for i, mid in enumerate(ab[0]):
    if n-1 in ab[mid]:
        flg = True
        break

if flg :print('POSSIBLE')
else:print('IMPOSSIBLE')
# Judge status: Accepted
import math
n=int(input())
x=math.ceil(n*100/108)
if n==math.floor(x*1.08):
	print(x)
else:
	print(':(')
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())

if h>w:
	nBig = h
else:
    nBig = w
    
    
    
print(n,nBig)
ans = int(n/nBig)+1

print(ans)
# Judge status: Accepted
n, d = map(int, input().split())
num_list = []
cnt = 0

#2次元リスト作成
for i in range(n):
    num_list.append(list(map(int, input().split())))

#j<kのもとでループ
for j in range(n):
    for k in range(j + 1, n):
        c = 0
        for l in range(d):
            c += (num_list[j][l] - num_list[k][l]) ** 2
    
        if (int(c**0.5))**2 == c :
            cnt += 1
        
print(cnt)
# Judge status: Accepted
x,a,b=map(int,input().split())
print("delicious" if b<=a else "dangerous" if b>x+a else "safe")
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
B = [0]*(n+1)
m = 0
for i in range(n,0,-1):
    cnt = 0
    for j in range(i,n,i):
        cnt += B[j]
    if cnt%2==A[i-1]:
        continue
    else:
        B[i] =1
        m += 1
print(m)
for i in range(len(B)):
    if B[i]==1:
        print(i)
# Judge status: Accepted
import sys
from collections import Counter

n, *a = map(int, sys.stdin.read().split())

def main():
    res = 0
    for v in Counter(a).values():
        res += v & 1
    print(res)

if __name__ ==  '__main__':
    main()
# Judge status: Wrong Answer
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

x0, x1 = 0, 10**9
while x0 + 1  < x1:
  x = (x0+x1)//2
  suma=0
  for i in a:
    suma += (i//x)
    
  if suma > k:
    x0 = x
  else:
    x1 = x
print(x1)
# Judge status: Wrong Answer
X = int(input())

if 360 % X == 0:
    ans = 360 // X
else:
    if X > 90:
        ans = 360 // (180 - X)
    else:
        ans = 360
print(ans)
# Judge status: Accepted
import numpy as np

n,W = map(int,input().split())
w,v = [0] * n, [0] * n
for i in range(n):
    w[i] , v[i] = map(int,input().split())
 

dp = np.zeros((W + 1), dtype=np.uint64)

for _w, _v in zip(w, v):
	np.maximum(dp[_w:], dp[:-_w] + _v, out=dp[_w:])
print(dp[-1])
# Judge status: Accepted
S=list(str(input()))
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
s=input()
score=0

for i in range(0,int(len(s)/2+1)):
  if s[i]!=s[len(s)-1-i]:
    score+=1

print(score)
# Judge status: Accepted
mod = 998244353
n = int(input())
d = list(map(int, input().split()))

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

max_d = max(d)
cnt = [0] * (max_d + 1)

for num in d:
    cnt[num] += 1

if cnt[0] > 1:
    print(0)
    exit(0)

ans = 1

for i in range(1, len(cnt)):
    ans *= pow(cnt[i - 1], cnt[i], mod)
    ans %= mod

print(ans)
# Judge status: Accepted
L, R = map(int, input().split())
MOD = 2019
INF = 10**5
ans = INF


if 2019 <= R-L:
    print(0)
else:
    x = L % MOD
    y = R % MOD
    if x < y:
        for i in range(x, y):
            for j in range(i+1, y+1):
                ans = min(ans, (i*j) % MOD)
        else:
            print(ans)
    else:
        print(0)
# Judge status: Accepted
s=input()

if s =="ABC":
    print('ARC')
else:
    print("ABC")
# Judge status: Wrong Answer
import math

N = int(input())
didnot = False
def waru2(n, didnot):
  c = 0
  while True:
    if n == 1:
      break
    n = int(math.ceil(n/2))
    if n != 1 and n % 2 != 0:
      didnot = True
    c += 1
  return (c, didnot)

a, didnot = waru2(N, didnot)
c = 0
for i in range(a):
  c += 2**i

if didnot:
  print(c)
else:
  print(c+N)
# Judge status: Accepted
from math import factorial

n,a,b = map(int,input().split())
MOD = 10**9 + 7
xa = 1
xb = 1

k1 = pow(2,n,MOD)
A = pow(factorial(a),MOD-2,MOD)
B = pow(factorial(b),MOD-2,MOD) 

for i in range(a):
  xa = xa*(n-i)%MOD
for j in range(b):
  xb = xb*(n-j)%MOD

ans = (k1 - (A*xa) - (B*xb) - 1)%MOD 

print(ans)
# Judge status: Wrong Answer
import numpy as np
N=int(input())
 
A=list(map(int, input().split()))

A=np.array(A)

ans=np.prod(A)

if ans>10**18:
    print(-1)
    
else:
  print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
sum=0
mod=10**9+7
for i in range(n):
    sum+=a[i]
sum=sum**2
for i in range(n):
    sum-=a[i]**2
sum=(sum//2)%mod
print(sum)
# Judge status: Wrong Answer
A = int(input())
B = list(map(int,input().split()))
now = B[0]
for i in range(A-1):
    if now < B[i+1]-1:
        print("No")
        exit()
    if now < B[i+1]:
        now = B[i+1]
print("Yes")
# Judge status: Wrong Answer
n, m, c, d = map(int, input().split())
if (n - m) < (c -d) or (n - m) == 0:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
x = input()

if x in [7, 5, 3]:
	print('YES') 
else:
	print('NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mini = 10**6
ans = 0
for i in range(n):
  if a[i] < mini:
    mini = a[i]
    ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()
S_s = set(S)
print(S_s)

if len(S)==len(S_s):
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
n=int(input())
s=[0]*26
for i in range(n):
    for j in list(input()):
        s[ord(j)-97]+=1
ans=[]
for i in range(26):
    if n<=s[i]:
        for j in range(s[i]//n):
            ans.append(chr(i+97))
ans.sort()
print('' if len(ans)<n else ''.join(ans[:n]))
# Judge status: Wrong Answer
H, W, N = map(int, open(0).read().split())
ans = 0

while N >= 0:
  if H < W:
    N -= W
    ans += 1
  elif W < H:
    N -= H
    ans += 1
print(ans)
# Judge status: Accepted
A,B,N = map(int,input().split())


if N<B:
    num = N
    answer= int(A*num/B)-A*int(num/B)
else:
    num = B-1
    answer = int(A*num/B)-A*int(num/B)
print(answer)
# Judge status: Wrong Answer
S = input()
if S is "Sunny":
    A = "Cloudy"
elif S is "Cloudy":
    A = "Rainy"
else:
    A = "Sunny"
print(A)
# Judge status: Accepted
S = list(input())
ans = []
for s in S:
    if s == '0':
        ans.append('0')
    elif s == '1':
        ans.append('1')
    elif len(ans) > 0:
        ans.pop()
    else:
        continue
print(''.join(ans))
# Judge status: Accepted
sum_input = sum(map(int, input().split()))

if sum_input >= 22:
  print('bust')
else:
  print('win')
# Judge status: Wrong Answer
a=int(input())
b=int(input())
h=int(input())

S=(a+b)*h/2
print(S)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
ans = [0]
cnt = 0
for i in range(n-1):
  if l[i] >= l[i+1]:
    cnt += 1
  else:
    if cnt > 0:
      ans.append(cnt)
    cnt = 0

ans.append(cnt)
print(max(ans))
# Judge status: Accepted
import numpy as np

def factorization(N):
    a = []
    for i in range(1,int(np.sqrt(N))+1):
        if N%i == 0:
            a.append(i)
    for j in range(len(a)):
        a.append(N//a[j])
    a.sort(reverse=True)
    return a

N,M = map(int,input().split())
f = factorization(M)
for i in f:
    if i <= M/N:
        print(i)
        exit()
# Judge status: Accepted
N = int(input())
fn = [0]*N

for x in range(1,100):
  for y in range(1,100):
    for z in range(1,100):
      n=x**2+y**2+z**2+x*y+y*z+z*x
      if n<=N:
        fn[n-1]+=1

print(*fn,sep="\n")
# Judge status: Accepted
from collections import defaultdict
dic = defaultdict(int)
MOD = 998244353
N = int(input())
A = list(map(int,input().split()))
MAX = max(A)
store = [0 for _ in range(MAX+1)]

for x in A:
  store[x] += 1

if A[0] != 0 or store[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(MAX):
  ans = ans*pow(store[i],store[i+1],MOD)
print(ans%MOD)
# Judge status: Accepted
n, m = map(int, input().split())

s1 = 1
f1 = n // 2
s2 = f1 + 1
f2 = n
if (f1 - s1) % 2 == (f2 - s2) % 2:
    f2 -= 1
ans = []
while f1 > s1:
    ans.append(f"{s1} {f1}")
    s1 += 1
    f1 -= 1

while f2 > s2:
    ans.append(f"{s2} {f2}")
    s2 += 1
    f2 -= 1

print("\n".join(ans[:m]))
# Judge status: Wrong Answer
n = int(input())
A = [int(input()) for i in range(n)]
m = 10**9
c = 0
for a in A:
    if a <= m:
        c += 1
print(c)
# Judge status: Accepted
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = []
for _ in range(5):
    a.append(ni())
k = ni()

print("Yay!" if a[-1] - a[0] <= k else ":(")
# Judge status: Accepted
n,k=map(int,input().split())

if (n-1)%(k-1)==0:
    print((n-1)//(k-1))
else:
    print(((n-1)//(k-1))+1)
# Judge status: Accepted
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = input()
    ans = 0
    tmp = 0
    acgt = ['A', 'C', 'G', 'T']
    for s in S:
        if s in acgt:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = input()

ans = 0
for n in N:
    ans += int(n)%9

print('Yes' if ans % 9 == 0 else 'No')
# Judge status: Accepted
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())

from collections import OrderedDict

ans = OrderedDict()
cur = N
i = 1

while cur != 0:
    tmp = cur - i
    if tmp in ans.keys():
        pass
    else:
        ans[i] = True
        cur = tmp
    i+= 1

for a in ans:
    print(a)
# Judge status: Wrong Answer
N=int(input())
C = input()
print(C.count('WR'))
# Judge status: Accepted
inf = 10**15
mod = 10**9+7
n,T = map(int, input().split())
minc = inf
for i in range(n):
    c,t = map(int, input().split())
    if t <= T:
        minc = min(minc, c)
if minc == inf:
    print('TLE')
else:
    print(minc)
# Judge status: Accepted
N = int(input())
a = [int(x) for x in input().split()]
ans = 10**9*N
front = 0
back = sum(a)
for i in range(N-1):
    front += a[i]
    back -= a[i]
    ans = min(ans, abs(front-back))
print(ans)
# Judge status: Wrong Answer
from collections import Counter


def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    ABs = [b for a in ABs for b in a]
    anss = Counter(ABs)
    anss = sorted(anss.items(), key=lambda x: x[0])
    for ans in anss:
        print(ans[1])


if __name__ == "__main__":
    main()