Harryxun/stf_run huggingface dataset:
n = int(input())
x = input()
value = [0, 1]
for i in range(2, 2 * (10 ** 5) + 1):
    ans = 1
    i = i % bin(i).count('1')
    value.append(ans + value[i])

for i in range(n):
    t = x[:i] + ('0' if x[i] == '1' else '1') + x[i + 1:]
    ans = 1
    t = (int(t, 2) % (t.count('1')))
    print(ans + value[t])

### FIXED CODE ###

n = int(input())
x = input()
count_1 = x.count('1')
value = [0, 0]
x_int = int(x, 2)
value[0] = x_int % (count_1 - 1) if count_1 > 1 else 0
value[1] = x_int % (count_1 + 1)
for i in range(n):
    if x[i] == '0':
        tmp = (pow(2, n - i - 1, count_1 + 1) + value[1]) % (count_1 + 1)
    else:
        if count_1 == 1:
            print(0)
            continue
        tmp = (-pow(2, n - i - 1, count_1 - 1) + value[0]) % (count_1 - 1)
    ans = 1
    while tmp > 0:
        tmp = tmp % (bin(tmp).count('1'))
        ans += 1
    print(ans)
a,b,c,k = map(int,input().split())

ans = 0
if k > a:
	ans = ans + a
    k = k - a
else:
	ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
	ans = ans - c
else:
	ans = ans - k
print(ans)

print(ans)


### FIXED CODE ###

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

ans = 0
if k > a:
    ans = ans + a
    k = k - a
else:
    ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
    ans = ans - c
else:
    ans = ans - k
print(ans)
a,b = map(int, input().split())
ans=a*b
if:a>=10 or b >=10:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

a,b = map(int, input().split())
ans=a*b
if a>=10 or b >=10:
    print(-1)
else:
    print(ans)
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0
for i in range(N):
  x += A[i]
  d[x] = d.get(x, 0) + 1
print(N - len(d) + d[0])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0
for i in range(N):
  x += A[i]
  d[x] = d.get(x, 0) + 1
ans = d.get(0, 0)
for x in d.values():
  ans += x * (x-1) // 2
print(ans)
N = int(input())
for i in range(1,10):
  for j in range(1,10):
    if i * j == N:
      print("Yes")
print("No")

### FIXED CODE ###

a,b=map(int,input().split())
if a > 9 or b > 9:
  print(-1)
else:
  print(a*b)
def INT():
    return int(input())

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

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

N = INT()
A = LI()
ans = 1000
purchase = 0

for i in range(1, N):
    tmp = ans
    
    if A[i] > A[i - 1]:
        for j in range(10);
            if tmp - A[i - 1] < 0:
                break
            tmp -= A[i - 1]
            purchase += 1
        ans = max(ans, tmp + A[i] * purchase)
        purchase = 0

print(ans)

### FIXED CODE ###

def INT():
    return int(input())

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

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

N = INT()
A = LI()
ans = 1000

for i in range(1, N):
    tmp = ans
    if A[i] > A[i - 1]:
        purchase = tmp // A[i - 1]
        ans = max(ans, tmp + (A[i] - A[i - 1]) * purchase)
        
print(ans)
s=input()
a=[]
for i in s:
	if i == 'B':
		a.pop()
	else:
		a.append(i)
print(''.join(a))

### FIXED CODE ###

s=input()
a=[]
for i in s:
	if i == 'B':
		if a:
			a.pop()
		else:
			pass
	else:
		a.append(i)
print(''.join(a))
cnt = 0
base = 0
MOD = 2019
# inv = pow(10,-1,MOD)

for d in input():
    base *= 10
    base += int(d)
    tmp = base
    while tmp:
        if tmp % MOD == 0:
            cnt += 1
        tmp //= 10
print(ans)

### FIXED CODE ###

s = input().rstrip()
tmp = 0
pw = 1
from collections import Counter
c = Counter()
c[0] += 1

for d in s[::-1]:
    tmp += int(d) * pw
    tmp %= 2019
    pw *= 10
    pw %= 2019
    c[tmp] += 1

print(sum([v*(v-1)//2 for v in c.values() if v > 1]))
from sys import stdin
A,B,C,K=list(map(int,(stdin.readline().strip().split())))
maxx=0
K-=A
maxx=max(maxx,A)
if K<=0:
    print(maxx)
    exit()
K-=B
aa=B*0
maxx=max(maxx,maxx+aa)
if K<=0:
    print(maxx)
    exit()
K-=C
aa=C*-1
maxx=max(max,maxx+aa)
if K<=0:
    print(maxx)
    exit()

### FIXED CODE ###

from sys import stdin
A,B,C,K=list(map(int,(stdin.readline().strip().split())))
if A>=K:
    print(K)
    exit()
if A+B>=K:
    print(A)
    exit()
K=K-(A+B)
print(A+(K*-1))
exit()
from collections import deque, Counter

N = int(input())

A = [
  int(j) - i  for i, j in enumerate(input().split())
]
cnt_A = Counter(A)

ans = 0
d = deque(A)
for i in range(N):
  a = d.popleft()
  #c = d.count(-a - 2 * i)
  c = cnt_A[-a - 2 * i]
  ans += c
print(ans)

### FIXED CODE ###

X = int(input())

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)
      #else:
      #  divisors.append([i, i])
  return divisors


def solve(a, b, c):
  D = (b**2 - 4*a*c) ** (1/2)
  x_1 = (-b + D) / (2 * a)
  x_2 = (-b - D) / (2 * a)
  return x_1, x_2

for pattern in make_divisors(X):
  diff = pattern
  A = 5
  B = 5 * (diff ** 2)
  C = diff ** 4 - X//diff
  sekiss = solve(A, B, C)
  for sekis in sekiss:
    if sekis == int(sekis):
      #print(int(sekis), diff)
      kouhos = solve(1, -diff, -int(sekis))
      if kouhos[0].imag == 0.0:
        print(int(kouhos[0]), int(kouhos[0] - diff))
      break
N,Q = map(int, input().split())
S = input()
SUM = [0] * (N + 1)
L = [0]*Q
R = [0]*Q


for i in range(N):
    if S[i] == "A" and S[i+1] == "C":
        SUM[i+1] = SUM[i] + 1
    else:
        SUM[i+1] = SUM[i]
print(SUM)
for i in range(Q):
    L[i], R[i] = list(map(int, input().split()))
    #indexを0からにする
    print(SUM[R[i]-1] - SUM[L[i]-1])

### FIXED CODE ###

N,Q = map(int, input().split())
S = input()
SUM = [0] * (N + 1)
L = [0]*Q
R = [0]*Q


for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        SUM[i+1] = SUM[i] + 1
    else:
        SUM[i+1] = SUM[i]

for i in range(Q):
    L[i], R[i] = list(map(int, input().split()))
    #indexを0からにする
    print(SUM[R[i]-1] - SUM[L[i]-1])
n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
for i in range(n):
    if e[i][0] == 1 and e[i][1] == 0:
        print(-1)
        exit()
ans = map(str, ans)
print("".join(ans))

### FIXED CODE ###

n, m = map(int, input().split())
ans = [0] * n
e = []
for i in range(m):
    si, ci = map(int, input().split())
    e += [[si, ci]]
    for j in range(len(e)):
        if e[j][0] == si and e[j][1] != ci:
            print(-1)
            exit()
    if si == 1 and ci == 0 and n != 1:
        print(-1)
        exit()
    ans[si - 1] = ci
if len(ans) == 1 and ans[0] == 0:
    print(0)
    exit()
elif len(ans) != 1 and ans[0] == 0:
    ans[0] = 1
ans = map(str, ans)
print("".join(ans))
n=int(input())
r1=2
r2=1

if n == 1:
    print(r2)
else :
    for i in range(n-1):
        r3 = r1+r2
        r1 = r2
        r2 = r3
print(r3)

### FIXED CODE ###

n=int(input())
r1=2
r2=1

if n == 1:
    print(1)
else :
    for i in range(n-1):
        r3 = r1+r2
        r1 = r2
        r2 = r3
    print(r3)
n = int(input())
t = list(map(int, input().split()))
if max(t) * 2 < sum(t):
	print("Yes")
else:
	print("No")

### FIXED CODE ###

tx = list(map(int, input().split()))
print(tx[0] / tx[1])
H,W=map(int,input().split())
s = [['.' for i in range(H+2)] for j in range(W+2)]
f=0
for i in range(H):
 s[i+1] = ['.'] + list(input()) + ['.']
for i in range(H+2):
 if f == 0:
  for j in range(W+2):
   if s[i][j] == '#':
    if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
     f = 1
     print('No')
     break
if f == 0:
 print('Yes')

### FIXED CODE ###

H,W=map(int,input().split())
s = [['.' for i in range(W+2)] for j in range(H+2)]
f=0
for i in range(H):
 s[i+1] = ['.'] + list(input()) + ['.']
for i in range(H+2):
 if f == 0:
  for j in range(W+2):
   if s[i][j] == '#':
    if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
     f = 1
     print('No')
     break
if f == 0:
 print('Yes')
# D - Handstand

# 逆立ちしている人が連続する区間のインデックスを保存する
# 指示1回あたり2つの区間を繋ぐことができる
# 連続したK+1個の区間を順に選んで繋ぎ、最も逆立ち区間が長くなる場合を探す。端から繋ぐ場合は例外処理

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

if len(set(S)) == 1 or K >= N//2 + 1:
    print(N)
    exit()

handstand_range_idx = []
range_start_idx = 0
for idx in range(1,N):
    if (S[idx-1] == "1" and S[idx] == "0"):
        range_end_idx = idx - 1
        handstand_range_idx.append([range_start_idx, range_end_idx])
    elif idx == N-1 and S[idx] == "1":
        range_end_idx = idx
        handstand_range_idx.append([range_start_idx, range_end_idx])
    elif S[idx-1] == "0" and S[idx] == "1":
        range_start_idx = idx

ans = max(handstand_range_idx[K-1][1]+1, (N-1) - handstand_range_idx[-K][0] + 1)

for first_link_range_idx in range(len(handstand_range_idx)):
    try:
        ans = max(ans, handstand_range_idx[first_link_range_idx + K][1] - handstand_range_idx[first_link_range_idx][0] + 1)
    except IndexError:
        pass

print(ans)

### FIXED CODE ###

# D - Handstand

# 逆立ちしている人が連続する区間のインデックスを保存する
# 指示1回あたり2つの区間を繋ぐことができる
# 連続したK+1個の区間を順に選んで繋ぎ、最も逆立ち区間が長くなる場合を探す。端から繋ぐ場合は例外処理

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

if len(set(S)) == 1:
    print(N)
    exit()

handstand_range_idx = []
range_start_idx = 0
for idx in range(1,N):
    if (S[idx-1] == "1" and S[idx] == "0"):
        range_end_idx = idx - 1
        handstand_range_idx.append([range_start_idx, range_end_idx])
    elif idx == N-1 and S[idx] == "1":
        range_end_idx = idx
        handstand_range_idx.append([range_start_idx, range_end_idx])
    elif S[idx-1] == "0" and S[idx] == "1":
        range_start_idx = idx

ans = 0
try:
    ans = max(handstand_range_idx[K-1][1]+1, (N-1) - handstand_range_idx[-K][0] + 1)
except IndexError: # 逆立ち区間の数が操作回数よりも少ない場合
    print(N)
    exit()

for first_link_range_idx in range(len(handstand_range_idx)):
    try:
        ans = max(ans, handstand_range_idx[first_link_range_idx + K][1] - handstand_range_idx[first_link_range_idx][0] + 1)
    except IndexError:
        pass

print(ans)
#AGC-040
S = input()
A = [0] * (len(S) + 1)

def check_left(n, S):
    count = 0
    for i in reversed(range(0, n)):
        if S[i] == "<":
            count += 1
        else:
            break
    return count

def check_right(n, S):
    count = 0
    for i in range(n, len(S)):
        if S[i] == ">":
            count += 1
        else:
            break
    return count

A[0] = max(check_left(0, S), check_right(0, S))

for i in range(1, len(S)+1):
    if A[i-1] != 0:
        if S[i-1] == "<":
            A[i] = A[i-1] + 1
        else:
            if S[i] == "<":
                A[i] = 0
            else:
                A[i] = max(check_left(i, S), check_right(i, S))
    else:
        A[i] = max(check_left(i, S), check_right(i, S))

print(sum(A))

### FIXED CODE ###

S = input()
N = len(S) + 1
 
A = [0] * N
 
if S[0] == '<':
    A[0] = 0

if S[-1] == '>':
    A[-1] = 0

for i in range(1, N-1):
    if S[i-1] == '>' and S[i] == '<':
        A[i] = 0

for i in range(N-1):
    if S[i] == '<':
        A[i+1] = A[i] + 1

for i in range(N-1)[::-1]:
    if S[i] == '>':
        A[i] = max(A[i], A[i+1] + 1)

print(sum(A))
N , M = map(int , input().split(" "))
#N = 100000
#M = 100000
solve_problem = [0] * N 
wa = [0] * N
ans = 0

for i in range(0,M):
    ps = input().split(" ")
    if ps[1] == "AC":
        if solve_problem[ int(ps[0]) -1] == 0:
            solve_problem[int(ps[0]) -1] = 1
            ans += 1
    elif ps[1] == "WA":
        if solve_problem[ int(ps[0])-1] == 0:
            wa[int(ps[0]) -1 ] += 1



print(ans,sum(wa[i] for i in range(0,N) if solve_problem[1] == 1))



### FIXED CODE ###

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

solve_problem = [0] * N 
wa = [0] * N
ans = 0

for i in range(0,M):
    ps = input().split(" ")
    if ps[1] == "AC":
        if solve_problem[ int(ps[0]) -1] == 0:
            solve_problem[int(ps[0]) -1] = 1
            ans += 1
    elif ps[1] == "WA":
        if solve_problem[ int(ps[0])-1] == 0:
            wa[int(ps[0]) -1 ] += 1

print(ans,sum(wa[i] for i in range(0,N) if solve_problem[i] == 1))
import sys
N = int(input())
fact = factorization(N)
if fact[0][0] == 1:
    print(0)
    sys.exit()
ans = 0
for f, num in fact:
    for i in range(1, num+1):
        if num < i:
            break
        num -= i
        ans += 1
print(ans)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    import sys
    N = int(input())
    fact = factorization(N)
    if fact[0][0] == 1:
        print(0)
        sys.exit()
    ans = 0
    for f, num in fact:
        for i in range(1, num+1):
            if num < i:
                break
            num -= i
            ans += 1
    print(ans)
main()
H,W,M = [int(x) for x in input().split()]
hw = []
hNum = [0]*10
wNum = [0]*10

for i in range(M):
    h,w = [int(x) for x in input().split()]
    hw.append([h,w])
    hNum[h]+=1
    wNum[w]+=1
hmax = -1
hMaxList = []
wmax = -1
wMaxList = []
for i in range(10):
    if(hmax <= hNum[i]):
        if(hmax == hNum[i]):
            hMaxList.append(i)
        else:
            hMaxList = [i]
        hmax = hNum[i]

    if(wmax <= wNum[i]):
        if(wmax == wNum[i]):
            wMaxList.append(i)
        else:
            wMaxList = [i]
        wmax = wNum[i]

ans = wmax + hmax
# print(ans)
# for i in range(10):
#     if([i,i] in hw and i in hMaxList and i in wMaxList):
#         ans -= 1
# if(len(hw) < 10 and (hmax ==  1 or  wmax ==  1 )):
#     ans += 1
print(ans)


### FIXED CODE ###

H,W,M = [int(x) for x in input().split()]
hw = []
hNum = [0]*H
wNum = [0]*W

for i in range(M):
    h,w = [int(x) for x in input().split()]
    hw.append([h,w])
    hNum[h-1]+=1
    wNum[w-1]+=1

hmax = max(hNum)
hMaxList = []
wmax = max(wNum)
wMaxList = []

for i in range(H):
    if(hmax == hNum[i]):
        hMaxList.append(i)
for i in range(W):
    if(wmax == wNum[i]):
        wMaxList.append(i)

ans = wmax + hmax
count = 0
for i in hw:
    if(hNum[i[0]-1] == hmax and wNum[i[1]-1] == wmax):
        count += 1
if(hNum.count(hmax) * wNum.count(wmax) == count):
    ans -= 1
print(ans)
a = int(input())
p = list(map(int,input().split()))
count = 0
 for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

### FIXED CODE ###

a = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)
#include<bits/stdc++.h>

using namespace std;

long long n, a, b;

int main(){
	cin >> n >> a >> b;
	cout << a*n/(a+b)+min(a, n%(a+b)) << endl;
}

### FIXED CODE ###

N, A, B = map(int, input().split())
print(N//(A+B)*A+min(A, N%(A+B)))
from math import gcd
n, x = map(int,input().split())
p = list(map(lambda s: abs(s-x), list(map(int,input().split()))))
g = p[0]
for i in p:
    g = gcd(g, i)
print(g)


### FIXED CODE ###

from fractions import gcd
n, x = map(int,input().split())
p = list(map(lambda s: abs(s-x), list(map(int,input().split()))))
g = p[0]
for i in p:
    g = gcd(g, i)
print(g)
def dfs_v(u):
  color[u] = 1
  t++
  d[u] += t
  for v in range(n):
    if M[u][v] == 0 and color[v] == 0:
      dfs_v(v)
  color[u] = 2
  t++
  f[u] += t

def dfs():
  color = [0 for i in range(n)]
  t = 0
  for u in range(n):
    dfs_v(u)
  for u in range(n):
    print "%d %d %d" %(u+1, d[u], f[u])

n = input()

d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]

for i in range(n):
  u, k = map(int, raw_input().split())
  for j in range(k):
   v = input()
   M[u-1][v-1] = 1

dfs()
    

### FIXED CODE ###

n = int(raw_input())
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
col = [0 for i in range(n)]
t = [0]
 
def DFS_visit(u):
    col[u] = 1
    t[0] += 1
    d[u] = t[0]
    for v in range(n):
        if M[u][v] == 1 and col[v] == 0:
            DFS_visit(v)
    col[u] = 2
    t[0] += 1
    f[u] = t[0]
 
def DFS():
    for u in range(n):
        if col[u] == 0:
            DFS_visit(u)
    for u in range(n):
        print'{0} {1} {2}'.format(u+1, d[u], f[u])
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
a=int(input())
b=int(input())

print(a+int(b/2))

### FIXED CODE ###

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

print(a+int(b/2))
n, m, s = [int(i) for i in input().split()]

e = []
for _ in range(m):
    u, v, a, b = [int(i) for i in input().split()]
    u -= 1
    v -= 1
    e.append([u, v, a, b])

co = [[int(i) for i in input().split()] for _ in range(n)]

dp = [[10 ** 18] * 6000 for _ in range(n)]
dp[0][s] = 0
for i in range(6000):
    if i + co[0][0] < 6000:
        dp[0][i + co[0][0]] = min(dp[0][i + co[0][0]], dp[0][i] + co[0][1])

for _ in range(n):
    for u, v, a, b in e:
        for j in range(a, 6000):
            dp[v][j - a] = min(dp[v][j - a], dp[u][j] + b)
        for i in range(6000):
            if i + co[v][0] < 6000:
                dp[v][i + co[v][0]] = min(dp[v][i + co[v][0]], dp[v][i] + co[v][1])

        for j in range(a, 6000):
            dp[u][j - a] = min(dp[u][j - a], dp[v][j] + b)
        for i in range(6000):
            if i + co[u][0] < 6000:
                dp[u][i + co[u][0]] = min(dp[u]
                                          [i + co[u][0]], dp[u][i] + co[u][1])

for i in range(1, n):
    print(min(dp[i]))

### FIXED CODE ###

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

e = []
for _ in range(m):
    u, v, a, b = [int(i) for i in input().split()]
    u -= 1
    v -= 1
    e.append([u, v, a, b])

co = [[int(i) for i in input().split()] for _ in range(n)]

dp = [[10 ** 18] * 6000 for _ in range(n)]
dp[0][min(5999,s)] = 0
for i in range(6000):
    if i + co[0][0] < 6000:
        dp[0][i + co[0][0]] = min(dp[0][i + co[0][0]], dp[0][i] + co[0][1])

for _ in range(n):
    for u, v, a, b in e:
        for j in range(a, 6000):
            dp[v][j - a] = min(dp[v][j - a], dp[u][j] + b)
        for i in range(6000):
            if i + co[v][0] < 6000:
                dp[v][i + co[v][0]] = min(dp[v][i + co[v][0]], dp[v][i] + co[v][1])

        for j in range(a, 6000):
            dp[u][j - a] = min(dp[u][j - a], dp[v][j] + b)
        for i in range(6000):
            if i + co[u][0] < 6000:
                dp[u][i + co[u][0]] = min(dp[u]
                                          [i + co[u][0]], dp[u][i] + co[u][1])

for i in range(1, n):
    print(min(dp[i]))
X, A = map( int, input().split() )
if X < A :
   print( 0 )
else
    print( 10 )

### FIXED CODE ###

X, A = map( int, input().split() )
if X < A :
   print( 0 )
else :
    print( 10 )
size, jumps = map(int, input().split())
array =  list(map(int, input().split()))
dp = [0]* size
dp[1]=  dp[0] + abs(array[1] - array[0]) 
for i in range(1,size):
	for j in range(jumps):	
		if i+j < n :
			dp[i] = min(dp[j],abs(array[i] - array[j]))
print(dp[-1])
		


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


def main():
    size, jumps = map(int, input().split())
    array = list(map(int, input().split()))
    dp = [999999999] * size
    dp[0]= 0
    dp[1] = abs(array[0]- array[1])
    for i in range(2,size):
        dp[i] = min(abs(array[i] - array[j]) + dp[j] for j in range(max(0, i - jumps), i))
    print(dp[size-1])

if __name__ == "__main__":
    main()
#!/usr/bin/env python3

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

d={}
for i in range(m):
    a,b=map(int,input().split())
    if a in d:
        d[a]=d[a]+1
    else:
        d[a]=1

    if b in d:
        d[b]=d[b]+1
    else:
        d[b]=1

for i in range(n):
    print(d[i+1])


### FIXED CODE ###

#!/usr/bin/env python3

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

d={}
for i in range(m):
    a,b=map(int,input().split())
    if a in d:
        d[a]=d[a]+1
    else:
        d[a]=1

    if b in d:
        d[b]=d[b]+1
    else:
        d[b]=1

for i in range(n):
    if i+1 in d:
        print(d[i+1])
    else:
        print(0)
#include <iostream>
#include <string>
int main(){
	std::string s,x="";
	while(std::cin>>s)x+=s;
	s="";
	int a=0,i=0;
	for (;i<(int)x.size();i++)
		if (isdigit(x[i])) s+=x[i];
		else
			if (!s.empty()){
				a+=atoi(s.c_str());
				s="";
			}
	std::cout<<a<<"\n";
}

### FIXED CODE ###

import sys,re
s="".join([s for s in sys.stdin])
p=re.compile('\d+')
x=p.findall(s)
print sum(map(int,x))
a = int(input())

cnt = 0

for i in range(1,10):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for j in range(100,1000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()

for k in range(10000,100000):
	cnt += 1
	if i < a :
		print (cnt)
		exit()



### FIXED CODE ###

nums = input().split()

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

nokori = a - b

s = c-nokori


if s < 0 :
	s = 0

print (s)
n,m = map(int,input().split())
a = list(map(int,input().split()))

d1 = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
d2 = {2:[1],3:[7],4:[4],5:[5,3,2],6:[9,6],7:[8]}

# dp[i]:i本のマッチを使用した場合の最大桁数
dp = [-float('inf') for _ in range(n+1)]
dp[0] = 0
for i in range(1,n+1):
  for ai in a:
    if i-d1[ai] >= 0:
      dp[i] = max(dp[i-d1[ai]]+1,dp[i])

a.sort(reverse = True)
ans = ''
r = n
k = dp[n]
while(r > 0):
  for ai in a:
    if dp[r-d1[ai]] == k-1:
      ans += str(ai)
      r -= d1[ai]
      k -= 1
      break

print(ans)


### FIXED CODE ###

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

d1 = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
d2 = {2:[1],3:[7],4:[4],5:[5,3,2],6:[9,6],7:[8]}

# dp[i]:i本のマッチを使用した場合の最大桁数
dp = [-float('inf') for _ in range(n+1)]
dp[0] = 0
for i in range(1,n+1):
  for ai in a:
    if i-d1[ai] >= 0:
      dp[i] = max(dp[i-d1[ai]]+1,dp[i])

a.sort(reverse = True)
ans = ''
r = n
k = dp[n]
while(r > 0):
  for ai in a:
    if r-d1[ai] >= 0 and dp[r-d1[ai]] == k-1:
      ans += str(ai)
      r -= d1[ai]
      k -= 1
      break

print(ans)
while True:
    r, a = raw_input().split()
    if r == a == 0: break
    h = 0
    _r = []
    _a = []
    for i in range(4):
        if a[i] == r[i]:
            h += 1
        else:
            _r.append(r[i])
            _a.append(a[i])
    else:
        print h, len(set(_r)&set(_a))

### FIXED CODE ###

while True:
    r, a = raw_input().split()
    if r == a == '0': break
    h = 0
    _r = []
    _a = []
    for i in range(4):
        if a[i] == r[i]:
            h += 1
        else:
            _r.append(r[i])
            _a.append(a[i])
    else:
        print h, len(set(_r)&set(_a))
a,b = map(int, raw_input().split())
print((a*b,(a+b)*2)

### FIXED CODE ###

a,b = map(int, raw_input().split())
print a*b,(a+b)*2
if str(input())='SUN':
	print(7)
elif str(input())='MON':
  print(6)
elif str(input())='TUE':
  print(5)
elif str(input())='WED':
  print(4)
elif str(input())='THU':
  print(3)
elif str(input())='FRI':
  print(2)
elif str(input())='SAT':
  print(1)


### FIXED CODE ###

s=input()
if s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
elif s=='SAT':
  print(1)
else:
  print(7)
n,m = map(int, input().strip().split(" "))

homework = list(n,m)

day = n - sum(homework)

if day >= 0:
  
  print(day)
  
else:
  
  print(-1)

### FIXED CODE ###

n,m = map(int, input().strip().split(" "))
 
homework = list(map(int, input().strip().split(" ")))
 
day = n - sum(homework)
 
if day >= 0:
    print(day)
else:
    print(-1)