Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

### FIXED CODE ###

X=int(input())
for i in range(-150,150):
  for j in range(-150,150):
    if i**5-j**5==X:
      A=i
      B=j
print(*[A,B])
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(int(lcm(a, b)))

### FIXED CODE ###

def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))
from sys import stdin

s = stdin.readline().rstrip()

ans = "Yes"
for i in range(0, len(s), 2):
    if s[i] + s[i+1] != "hi":
        ans = "No"

print(ans)


### FIXED CODE ###

from sys import stdin

s = stdin.readline().rstrip()

ans = "Yes"
if len(s)%2 != 0:
    ans = "No"
else:
    for i in range(0, len(s), 2):
        if s[i] + s[i+1] != "hi":
            ans = "No"
print(ans)
from collections import deque

n,m = map(int,input().split())

G=[[] for i in range(n)]

for i in range(m):
    a,b=input().split()
    G[int(a)-1]+=[int(b)-1]
    G[int(b)-1]+=[int(a)-1]

#print(G)

dist=[-1 for i in range(n)]
# que=deque([0])
# dist[0]=0

count=0
def bfs(G):
    global count
    #print(que)
    if not que:
        return
    v = que.popleft()

    for nv in G[v]:
        if dist[nv] != -1:
            continue
        dist[nv]=dist[v]+1
        que.append(nv)
    count+=1
    
    bfs(G)

ans=0
for i in range(n):
    count=0
    if dist[i] != -1:
        continue
    else:
        que=deque([i])
        dist[i]=0
        bfs(G)
        if ans < count:
            ans=count

print(ans)


### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10 ** 9)


n,m = map(int,input().split())

G=[[] for i in range(n)]

for i in range(m):
    a,b=input().split()
    G[int(a)-1]+=[int(b)-1]
    G[int(b)-1]+=[int(a)-1]

#print(G)

dist=[-1 for i in range(n)]
# que=deque([0])
# dist[0]=0

count=0
def bfs(G):
    global count
    #print(que)
    if not que:
        return
    v = que.popleft()

    for nv in G[v]:
        if dist[nv] != -1:
            continue
        dist[nv]=dist[v]+1
        que.append(nv)
    count+=1
    
    bfs(G)

ans=0
for i in range(n):
    count=0
    if dist[i] != -1:
        continue
    else:
        que=deque([i])
        dist[i]=0
        bfs(G)
        if ans < count:
            ans=count

print(ans)
n = int(input())
a = []

for i in range(n):
    a.append(int(input()))

count = 0

while(True):
    odd = False
    for i in range(n):
        if((a[i] % 2) != 0):
            odd = True
    if(odd):
        break
    for i in range(n):
        a[i] /= 2 
    count += 1


print(count)


### FIXED CODE ###

s = input()
c = 0
if(s[0] == "1"):
    c += 1


if(s[1] == "1"):
    c += 1


if(s[2] == "1"):
    c += 1

print(c)
c == 0
While True:
    x = int(input())
    if x == 0:
        break;
   
    c += 1
    print('Case',str(c) + ':',x)

### FIXED CODE ###

count = 1                                                                   
while True:
    x = input().strip()
    if x == '0':
        break
    print('Case %s: %s' % (count,x))
    count = count + 1
from functools import cmp_to_key
def cmp(x, y):
  if x[0] < y[0]:
    return -1
  elif x[0] > y[0]:
    return 1
  else:
    return int(y[1]) - int(x[1])
n = int(input())
d = [input().split() for _ in range(n)]
for i in range(n):
  d[i].append(i + 1)
d.sort(key = cmp_to_key(cmp))
for i in range(n):
print(d[i][2])


### FIXED CODE ###

from functools import cmp_to_key
def cmp(x, y):
  if x[0] < y[0]:
    return -1
  elif x[0] > y[0]:
    return 1
  else:
    return int(y[1]) - int(x[1])
n = int(input())
d = [input().split() for _ in range(n)]
for i in range(n):
  d[i].append(i + 1)
d.sort(key = cmp_to_key(cmp))
for i in range(n):
  print(d[i][2])
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    print(int(N/2))
else:
    print(int(N//2) + 1 )
X = input()
A = input()

if X < A:
　print('0')
else:
　print('10')


### FIXED CODE ###

X, A = map(int, input().split())
 
if X < A:
 print(0)
else:
 print(10)
N = int(input())
sum = 0.0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u = 'BTC':
        x *= 380000.0
    sum += x
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0.0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u == 'BTC':
        x *= 380000.0
    sum += x
print(sum)
n,m=map(int,input().split())
ans=["a"]*n
for i in range(0,m):
  s,c=map(int,input().split())
  if ans[s-1]=="a" or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    break
else:
  if i==0 and ans[0]=="a":
    ans[0]=0
  elif ans[0]=="a":
    ans[0]=1
  for i in range(0,n):
    if ans[i]=="a":
      ans[i]=0
  if ans[0]==0:
    print(-1)
  else:
    if n==3:
      ans=int(ans[0])*100+int(ans[1])*10+int(ans[2])
    elif n==2:
      ans=int(ans[0])*10+int(ans[1])
    else:
      ans=int(ans[0])
    print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
ans=["a"]*n
for i in range(0,m):
  s,c=map(int,input().split())
  if ans[s-1]=="a" or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    break
else:
  if n==1 and ans[0]=="a":
    ans[0]=0
  elif ans[0]=="a":
    ans[0]=1
  for i in range(0,n):
    if ans[i]=="a":
      ans[i]=0
  if i>=2 and ans[0]==0:
    print(-1)
  else:
    if n==3:
      ans=int(ans[0])*100+int(ans[1])*10+int(ans[2])
    elif n==2:
      ans=int(ans[0])*10+int(ans[1])
    else:
      ans=int(ans[0])
    print(ans)
n=int(input())
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(2,n+2)-sum(g(i) for i in range(1,n+1))))

### FIXED CODE ###

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
n=int(input())
print(sum(num_divisors_table(n-1)))
S=int(input())
W=int(input())
if S<=W:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")
import os
import sys
  
for line in sys.stdin.readlines():
    S = map(int, line.strip().split())
 
    h, m, s = 0, 0, 0
 
    h = S/3600
 
    S1 = S-h*3600
 
    if S1:
        m = S1/60
    elif S1 == 0:
        m = 0
 
    if m:
        s = S1-m*60
    elif m == 0:
        s = S1
 
    print "%d:%d:%d" % (h, m, s)

### FIXED CODE ###

S =input()
h = int(int(S / 60) / 60)
m = int(S/60) % 60
s = S % (60*60) % 60
print "%d:%d:%d" % (h, m, s)
l,r=map(int,raw_input().split())
if l<2019 and r<2019:
  print(((l%2019)*(r%2019))%2019)
else:
  if (r-l)>=2019:
    print('0')
  else:
  	print(((l%2019)*((l+1)%2019))%2019)

### FIXED CODE ###

n,a,b=map(int,raw_input().split())
print(min(n*a,b))
import math


def f(x):
    return math.factorial(x)


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
cnt = 0
cnt += int(f(n) / (2 * f(n - 2)))
if m > 1:
    cnt += int(f(m) / (2 * f(m - 2)))
print(int(cnt))


### FIXED CODE ###

n, m = map(int, input().split())
print((n*(n-1))//2+(m*(m-1))//2)
n = input()

m = list(n.copy)

#print(m)
if len(set(m)) == len(m):
  print("yes")
else:
  print("no")
  

### FIXED CODE ###

n = input()

m = list(n)

#print(m)
if len(set(m)) == len(m):
  print("yes")
else:
  print("no")
import math

N, K = [int(n) for n in input().split()]
print(0 if K==1 or N==0 else math.gcd(N, K))


### FIXED CODE ###

N, K = [int(n) for n in input().split()]
print(min(N%K, K-(N%K)))
from collections import deque

H, W = map(int, input().split())          
graph = [list(input()) for _ in range(H)]

dy = [0, 1, 0, -1]
dx = [-1, 0, 1, 0]

ans = 0
for si in range(H):
    for sj in range(W):
        if graph[si][sj] == "#": continue
        que = deque()
        que.append([si, sj])

        dist = [[-1 for _ in range(W)] for _ in range(H)]
        dist[si][sj] = 0
        
        while que:
            y, x = que.popleft()

            for dir in range(4):
                ny = y + dy[dir]
                nx = x + dx[dir]
                if ny < 0 or ny >= H or nx < 0 or nx >= W: continue
                elif graph[ny][nx] == "#":continue

                elif dist[ny][nx] != -1: continue

                elif graph[ny][nx] == ".":
                    dist[ny][nx] = dist[y][x] + 1
                    que.append([ny, nx])

    for i in range(H):
        for j in range(W):
            if dist[i][j] == -1: continue
            ans = max(ans, dist[i][j])

print(ans)


### FIXED CODE ###

# ABC 151 C Maze Master
from collections import deque

H, W = map(int, input().split())          
graph = [list(input()) for _ in range(H)]

dy = [0, 1, 0, -1]
dx = [-1, 0, 1, 0]

ans = 0
for si in range(H):
    for sj in range(W):
        if graph[si][sj] == "#": continue
        que = deque()
        que.append([si, sj])

        dist = [[-1 for _ in range(W)] for _ in range(H)]
        dist[si][sj] = 0
        
        while que:
            y, x = que.popleft()

            for dir in range(4):
                ny = y + dy[dir]
                nx = x + dx[dir]
                if ny < 0 or ny >= H or nx < 0 or nx >= W: continue
                if graph[ny][nx] == "#": continue
                if dist[ny][nx] != -1: continue

                if graph[ny][nx] == ".":
                    dist[ny][nx] = dist[y][x] + 1
                    que.append([ny, nx])

        for i in range(H):
            for j in range(W):
                if dist[i][j] == -1: continue
                ans = max(ans, dist[i][j])

print(ans)
import numpy as np
import sys
import pandas as pd

N = input() # 入力回数をNとして受け取る
n = N.split(" ")
col = int(n[1])
rows = int(n[0])
s = [input() for i in range(rows)] # 複数行の数値の入力を取得
arr_1d = np.array(s)
arr_2 = []
for el in arr_1d:
    chars = [char for char in el ]
    arr_2.append(chars)

arr_2 = np.array(arr_2)
df = pd.DataFrame(arr_2.reshape(rows,col))
df2 = df.replace(["."], np.nan)
df2=df2.dropna(how='all').dropna(how='all', axis=1)
df2=df2.fillna(".")
# print(df2.values)
for a in df2.values:
    print(''.join(a))

### FIXED CODE ###

h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()
 
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True
 
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()
n=int(input())
dat=list(map(int, input().split()))

for e in dat:
       e = bin(e)[2:]
       e = list(e).reverse()

re = []

for e in dat:
      try:
          w=e.index('1')
          re.append(w)
      except IndexError:
          re.append(0)

print(min(re))
         
       

print(1)

### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
n,m=map(int,input().split())
line=list(map(int,input().split()))
if n >= m:
  print(0)
line.sort()
stock=0
distance=[]
for i in line:
  stock=i
  distance.append(i-stock)
distance.pop(0)
for i in range(n-1):
  distance.pop(distance.index(max(distance)))
ans=0
for i in distance:
  ans+= i
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
line=list(map(int,input().split()))
if n >= m:
  print(0)
else:
  line.sort()
  stock=0
  distance=[]
  for i in line:
    distance.append(i-stock)
    stock=i
  distance.pop(0)
  distance.sort()
  ans=0
  for i in range(m-n):
    ans+= distance[i]
  print(ans)
n, y = map(int, input().split())

noguchi = 1000
higuchi = 5000
yukichi = 10000

ans = '-1 -1 -1'
for i in range(n+1):
    for j in range(n+1-i):
        k = n - (i+j)
        yen = noguchi * i + higuchi * j + yukichi * k
        if yen == y:
            ans = f'{k} {j} {i}'
            break

print(ans)


### FIXED CODE ###

n, y = map(int, input().split())

i, j, k = -1, -1, -1

for a in range(n + 1):
    for b in range(n+1-a):
        sum = (10000*a) + (5000*b) + (1000 * (n-(a+b))) if n-(a+b) >= 0 else None
        if sum == y:
            i, j, k = a, b, n-(a+b)
            break


print(i, j, k)
import sys
sys.setrecursionlimit(100000000)

"""
方針
1. つながってるやつ全員candにぶちこむ
2. 各iについて所属candからblock[i]を差し引く
"""
n,m,k=map(int,input().split())
group = list()
path = dict()
block = [set() for i in range(n+1)]
for _ in range(m):
  a,b = map(int,input().split())
  if a in path:
    path[a].add(b)
  else:
    path[a] = {b}
  if b in path:
    path[b].add(a)
  else:
    path[b] = {a}
for _ in range(k):
  c,d = map(int,input().split())
  block[c].add(d)
  block[d].add(c)

group = list()
memo = [-1]*(n+1)

def rec(g, i):
  res = set()
  memo[i] = g
  #print('call', g, i)
  for p in path[i]:
    if memo[p] < 0:
      res |= rec(g, p)
      memo[p] = g
  #print(g,i,path[i], res)
  if len(res) > 0:
    return res | {i}
  else:
    return {i}
  
for i in range(1,n+1):
  if memo[i] < 0:
    group.append(rec(len(group), i))

ans = list()
for i in range(1,n+1):
  candi = group[memo[i]] - path[i] - block[i] - {i}
  ans.append(len(candi))
#print(*group)
#print(*[[i,b] for i,b in enumerate(block) if len(b) > 0])
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return {i for i in range(self.n) if self.find(i) == root}

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m,k=map(int,input().split())
block = [0]*n
uf = UnionFind(n)
for _ in range(m):
  a,b=map(int,input().split())
  block[a-1] += 1
  block[b-1] += 1
  uf.union(a-1,b-1)

uf.find(0)
for _ in range(k):
  c,d=map(int,input().split())
  if uf.same(c-1,d-1):
    block[c-1] += 1
    block[d-1] += 1

ans = [uf.size(i) - block[i] - 1 for i in range(n)]
print(*ans)
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    a = list(map(int, input().split(" ")))
    a = list(set(a))

    # for j in a:
    #     if j % 2 != 0:
    #         print("0")

    # a = [i/2 for i in a]
    l = lcm_list(a)

    i = l / 2

    for j in a:
        if i // (j // 2) % 2 == 0:
            print(0)
            exit()

    if m < i:
        print("0")
    else:
        print(int(((m - i) // (l)) + 1))

### FIXED CODE ###

from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(10 ** 7)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    a = list(map(int, input().split(" ")))
    a = list(set(a))

    # for j in a:
    #     if j % 2 != 0:
    #         print("0")

    # a = [i/2 for i in a]
    l = lcm_list(a)

    # if l == 0:
    #     print(0)
    #     exit()

    if (2 * m) < l:
        print("0")
        exit()

    i = l / 2

    for j in a:
        if i // (j // 2) % 2 == 0:
            print(0)
            exit()

    # if m < i:
    #     print("0")
    else:
        # print("1")
        print(int(((m - i) // l) + 1))
        # print(int((m // i + 1) // 2))
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        if n == 0:
            break
        ms = []
        for _ in range(n):
            m,l = LI()
            a = [LI() for _ in range(m)]
            b = []
            for s,e in a:
                f = 0
                for i in range(s,e):
                    f |= 2**(i-6)
                b.append(f)
            ms.append((l,b))

        d = collections.defaultdict(int)
        d[0] = 0
        for l,b in ms:
            g = collections.defaultdict(int)
            for k,v in d.items():
                for f in b:
                    if f&k > 0:
                        continue
                    if g[f|k] < v + l:
                        g[f|k] = v + l
            for k,v in g.items():
                if d[k] < v:
                    d[k] = v
        rr.append(max(d.values()))

    return '\n'.join(map(str, rr))


print(main())




### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        if n == 0:
            break
        ms = []
        for _ in range(n):
            m,l = LI()
            a = [LI() for _ in range(m)]
            b = 0
            for s,e in a:
                for i in range(s,e):
                    b |= 2**(i-6)
            ms.append((l,b))

        d = collections.defaultdict(int)
        d[0] = 0
        for l,b in ms:
            for k,v in list(d.items()):
                if b&k > 0:
                    continue
                if d[b|k] < v + l:
                    d[b|k] = v + l
        rr.append(max(d.values()))

    return '\n'.join(map(str, rr))


print(main())
a, b, c = input().split()
if b = '+':
  print(int(int(a) + int(c)))
else:
  print(int(int(a) - int(c)))

### FIXED CODE ###

a, b, c = input().split()
if b == '+':
  print(int(int(a) + int(c)))
else:
  print(int(int(a) - int(c)))
import sys
input = sys.stdin.readline
 
def main():
    N, M = map(int, input().split())
 
    ac_check = [False] * N
    p_counts = [0] * N
 
    for i in range(M):
        p, s = input().strip().split()
        p = int(p) - 1
        if s == "AC":
            if not ac_check[p]:
                ac_check[p] = True
        else:
            if not ac_check[p]:# まだ正解していないならペナルティ追加
                p_counts[p] += 1
 
    ac_count = 0
    p_count = 0
    for i in range(N):
        if ac_check[i]:# 正解している問題のみ考慮
            ac_count += 1
            p_count += p_counts[i]
    print(ac_count, p_count)
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

print(chr(ord(input())+1))
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)



### FIXED CODE ###

A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())
n,m=map(int,input().split())
lst=[0]*m

for i in range(m):
    a,b=map(int,input().split())
    lst[a-1]+=1
    lst[b-1]+=1

for i in lst:
    print(i)

### FIXED CODE ###

n,m=map(int,input().split())
lst=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    lst[a-1]+=1
    lst[b-1]+=1

for i in lst:
    print(i)
n = int(input)
s,t = map(str,input().split())

for i in range(n):
    print(s[i]+t[i],end="")

### FIXED CODE ###

n = int(input())
s,t = map(str,input().split())

for i in range(n):
    print(s[i]+t[i],end="")
def main():
    n = int(input().rstrip())
    sqrt_n = int(sqrt(n))

    total = 0
    for number in range(1,sqrt_n + 1):
        if n % number > 0:
            continue
        remain = n - number
        x, y = divmod(remain, number)
        #print(x, y, remain, number)
        if y == 0 and x > number:
            #print("○",number)
            total += x
        #elif y == 0:
        #    print("×",number)

    print(total)

if __name__ == "__main__":
  main()


### FIXED CODE ###

from math import sqrt
def main():
    n = int(input().rstrip())
    sqrt_n = int(sqrt(n))

    total = 0
    for number in range(1,sqrt_n + 1):
        if n % number > 0:
            continue
        remain = n - number
        x, y = divmod(remain, number)
        #print(x, y, remain, number)
        if y == 0 and x > number:
            #print("○",number)
            total += x
        #elif y == 0:
        #    print("×",number)

    print(total)

if __name__ == "__main__":
  main()
import numpy as np
import math


s=" "+input()
for i in range(len(s)):
    if(s[i]==" "):
        print(char((ord)s[i+1]-(ord)'a'+(ord)'A'),end="")
print()

### FIXED CODE ###



import numpy as np
import math


s=" "+input()
for i in range(len(s)):
    if(s[i]==" "):
        print(chr(ord(s[i+1])-32),end="")
print()
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
mod = sum(XY[0])%2
for x, y in XY:
    if mod != (x+y)%2:
        print(-1)
        exit()

m = 33-mod
print(m)
D = [2**i for i in range(31, -1, -1)]
if mod:
    D.append(1)

print(" ".join(map(str, D)))
for x, y in XY:
    w = " "
    for d in D:
        if x-y >= 0 and x+y >= 0:
            w += "R"
            x -= d
        elif x-y < 0 and x+y >= 0:
            w += "U"
            y -= d
        elif x-y >= 0 and x+y < 0:
            w += "D"
            y += d
        else:
            w += "L"
            x += d
    print(w)



### FIXED CODE ###

s = input()
s = s.replace("1","2")

s = s.replace("9","1")

s = s.replace("2","9")

print(s)
N = input()
    S = input()
    count = 0
    if int(N) >= 3 and int(N) <= 50:
      for i in range(1, int(N)-1):
        if S[i-1] + S[i] + S[i+1] == "ABC":
          count += 1
    print(count)

### FIXED CODE ###

n = int(input())
s = str(input())
print(s.count("ABC"))
a,p=int(input())
print((3*a+p)//2)

### FIXED CODE ###

a,p=map(int,input().split())
print((3*a+p)//2)