TnT/CodeNet4Repair huggingface dataset:
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)

            
        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in ans:
        if i == "AC":
            print("AC x", i)
        elif i == "WA" :
            print("WA x", i)
        elif i == "TLE":
            print("TLE x", i)
        else:
            print("RE x", i)


if __name__ == "__main__":
    main()

Fixed, accepted submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)


        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in range(len(ans)):
        if i == 0:
            print("AC x", ans[i])
        elif i == 1 :
            print("WA x", ans[i])
        elif i == 2:
            print("TLE x", ans[i])
        else:
            print("RE x", ans[i])


if __name__ == "__main__":
    main()
Problem:
We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square.  Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors. Here, it is not always necessary to use all three colors.  Find the number of such ways to paint the dominoes, modulo 1000000007.  The arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:    * Each domino is represented by a different English letter (lowercase or uppercase).   * The j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.

Incorrect submission (verdict: Wrong Answer):
MOD  = 1000000007

N = int(input())
S1 = input()
S2 = input()

if S1[0] == S2[0]:
  	ans, idx = 3, 1
else:
  	ans, idx = 6, 2

while idx < N:
    print(S1[idx])
    if S1[idx] == S2[idx]:
        if S1[idx-1] == S2[idx-1]:
            ans *= 2
        idx += 1
    else:
        if S1[idx-1] == S2[idx-1]:
            ans *= 2
        else:
            ans *= 3
        idx += 2
    ans %= MOD
print(ans)

Fixed, accepted submission:
MOD  = 1000000007

N = int(input())
S1 = input()
S2 = input()

if S1[0] == S2[0]:
  	ans, idx = 3, 1
else:
  	ans, idx = 6, 2

while idx < N:
    if S1[idx] == S2[idx]:
        if S1[idx-1] == S2[idx-1]:
            ans *= 2
        idx += 1
    else:
        if S1[idx-1] == S2[idx-1]:
            ans *= 2
        else:
            ans *= 3
        idx += 2
    ans %= MOD
print(ans)
Problem:
Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X.

Incorrect submission (verdict: Wrong Answer):
X=int(input())

for a in range(-125,125):
    for b in range(-125,125):
        i = a**5-b**5
        if i == X:
            print(a,b)
            break

Fixed, accepted submission:
X=int(input())

ans=''
for a in range(-125,125):
    for b in range(-125,125):
        i = a**5-b**5
        if i == X:
            ans=[a,b]
print(' '.join(map(str,ans)))
Problem:
Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode:                 BubbleSort(A) 1 for i = 0 to A.length-1 2     for j = A.length-1 downto i+1 3         if A[j] < A[j-1] 4             swap A[j] and A[j-1]   Note that, indices for array elements are based on 0-origin.  Your program should also print the number of swap operations defined in line 4 of the pseudocode.

Incorrect submission (verdict: Wrong Answer):
def bubble(l):
	N = len(l)
	flag = 1

	while flag:
		flag = 0
		for j in range(N - 1, 1 - 1, -1):
			if l[j] < l[j - 1]:
				l[j], l[j - 1] = l[j - 1], l[j]
				flag = 1

	return l


if __name__ == '__main__':
	n = int(input())
	l = input().split()

	for i in range(n):
		l[i] = int(l[i])

	l = bubble(l)
	count = 0
	leng = len(l)
	for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)



Fixed, accepted submission:
def bubble(l):
	count = 0
	N = len(l)
	flag = 1

	while flag:
		flag = 0
		for j in range(N - 1, 1 - 1, -1):
			if l[j] < l[j - 1]:
				l[j], l[j - 1] = l[j - 1], l[j]
				flag = 1
				count += 1

	return l, count


if __name__ == '__main__':
	n = int(input())
	l = input().split()

	for i in range(n):
		l[i] = int(l[i])

	l, c = bubble(l)
	count = 0
	leng = len(l)
	for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c)
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
a, b, c = [int(i) for i in input().split()]

if a > b:
    if b > c:
        print(a, b, c)
    else:
        print(a, c, b)
        
elif b > a:
    if a > c:
        print(b, a, c)
    else:
        print(b, c, a)
        
elif c > b:
    if b > a:
        print(c, b, a)
    else:
        print(c, a, b)

Fixed, accepted submission:
input = [int(i) for i in input().split()]

input.sort()
print(input[0], input[1], input[2])
Problem:
Write a program which reads two integers x and y, and prints them in ascending order.

Incorrect submission (verdict: Time Limit Exceeded):
x,y = map(int, input().split())

while True:

    if x == 0 and y == 0 : break

    list = [x, y]
    print(list.sort())
       


Fixed, accepted submission:
while True:
    x,y = map(int, input().split())

    if x == 0 and y == 0:
        break

    elif x <= y:
        print(str(x) + " " + str(y))
    else:
        print(str(y) + " " + str(x))
Problem:
There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roads.  Determine if we can visit all the towns by traversing each of the roads exactly once.

Incorrect submission (verdict: Wrong Answer):
p = [0,0,0,0]
for i in range(3):
    ai, bi = map(int, input().split())
    p[ai-1] += 1
    p[bi-1] += 1

if 3 in p:
    print('YES')
else:
    print('NO')


Fixed, accepted submission:
p = [0,0,0,0]
for i in range(3):
    ai, bi = map(int, input().split())
    p[ai-1] += 1
    p[bi-1] += 1

if 3 in p:
    print('NO')
else:
    print('YES')
Problem:
You are given three integers A, B and C.  Determine if there exists an equilateral triangle whose sides have lengths A, B and C.

Incorrect submission (verdict: Wrong Answer):
l = []
l= list(map(int,input().split()))
ls = sorted(l)
a = ls[0]
b = ls[1]
c = ls[2]

if a + b <= c:
	print("Yes")
else:
  	print("No")

Fixed, accepted submission:
l = []
l= list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]

if a == b and a == c:
	print("Yes")
else:
  	print("No")
Problem:
There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.  Extend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())

in1 = []
for idx1 in range(h):
    in1.append(input())

for item1 in in1:
    print(item1)

Fixed, accepted submission:
#a = '2 2'
#b = ['*.', '.*']

h, w = map(int, input().split())
#h, w = map(int, a.split())

in1 = []
for idx1 in range(h):
    in1.append(input())
#    in1.append(b[idx1])

for item1 in in1:
    print(item1)
    print(item1)
Problem:
Write a program which calculates the area and circumference of a circle for given radius r.

Incorrect submission (verdict: Wrong Answer):
from math import pi
r= float(input())
area=r*r*pi
cir =(r+r)* pi
print(f'{(area):.6f}{(cir):.6f}')


Fixed, accepted submission:
from math import pi
r= float(input())
area=r*r*pi
cir =(r+r)* pi
print(f'{(area):.6f} {(cir):.6f}')
Problem:
"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.  Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Incorrect submission (verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())

if A+B <= C*2:
    min_cost = A*X + B*Y
    
else:
    if X <= Y:
        if B >= C*2:
            min_cost = C*2*X+C*2*(Y-X)
        else:
            min_cost = C*2*X+B*(Y-X)
            
    else:
        if A >= C*2:
            min_cost = C*2*Y+C*2*(X-Y)
        else:
            min_cost = C*2*Y+A*(Y-X)

print(min_cost)
         

Fixed, accepted submission:
a,b,c,x,y = map(int, input().split())
ans1 = c * 2 * min(x,y) + a * (x-min(x,y)) + b * (y-min(x,y))
ans2 = a*x + b*y
ans3 = c * 2 * max(x,y)
print(min(ans1,ans2,ans3))
Problem:
Compute A \times B, truncate its fractional part, and print the result as an integer.

Incorrect submission (verdict: Wrong Answer):
A,B = map(float,input().split())
print(round(A * B))

Fixed, accepted submission:
import math
A,B = map(float,input().split())
A = int(A)
B = int(B * 1000)

print(math.floor((A*B)//1000))
Problem:
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not.  You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input.

Incorrect submission (verdict: Wrong Answer):
s=input()
l=len(s)
ans=0
for i in range(2,l,2):
    tmp=s[:-i]
    if tmp[:int((l-i)/2)]==tmp[int((l-i)/2):]:
        ans=l-i
        break
    print(tmp)
    print(tmp[:int((l-i)/2)])
    print(tmp[int((l-i)/2):])
print(ans)

Fixed, accepted submission:
s=input()
l=len(s)
ans=0
for i in range(2,l,2):
    tmp=s[:-i]
    if tmp[:int((l-i)/2)]==tmp[int((l-i)/2):]:
        ans=l-i
        break
print(ans)
Problem:
We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer.  Snuke's objective is to permute the element in a so that the following condition is satisfied:    * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.  Determine whether Snuke can achieve his objective.

Incorrect submission (verdict: Wrong Answer):
# import numpy as np
import math
N = int(input())
a = list(map(int, input().split()))

two_count = 0
four_count = 0
for i in a:
    if i >= 4 and i % 4 == 0:
        four_count += 1
    elif i >= 2 and i % 2 == 0:
        two_count += 1

check = len(a) - two_count
if two_count > 0:
    ans = "YES" if math.ceil(check/2) <= four_count else "NO"
else:
    if check == 2:
        ans = "YES" if 1 <= four_count else "NO"
    else:
        ans = "YES" if check - 2 <= four_count else "NO"
print(ans)

Fixed, accepted submission:
# import numpy as np
import math
N = int(input())
a = list(map(int, input().split()))

two_count = 0
four_count = 0
for i in a:
    if i >= 4 and i % 4 == 0:
        four_count += 1
    elif i >= 2 and i % 2 == 0:
        two_count += 1

if two_count <= 1:
    if len(a) == 2:
        print("Yes" if four_count >= 1 else "No")
    else:
        print("Yes" if four_count >= len(a)//2 else "No")
else:
    check = len(a) - two_count
    if check == 0:
        print("Yes")
    elif check <= 2:
        print("Yes" if four_count >= 1 else "No")
    else:
        print("Yes" if four_count >= math.ceil(check/2) else "No")
Problem:
Write a program which calculates the cube of a given integer x.

Incorrect submission (verdict: Wrong Answer):
x = int(input())

print(x^3)

Fixed, accepted submission:
x = input()
x = int(x)
print(x**3)
Problem:
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.

Incorrect submission (verdict: Wrong Answer):
a, b = map(int, input().split())

print((a+b)//2 + 1)


Fixed, accepted submission:
import math
a, b = map(int, input().split())

print(math.ceil((a+b)/2))
Problem:
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately.  He has very high awareness of safety, and decides to buy two bells, one for each hand.  The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the minimum total price of two different bells.

Incorrect submission (verdict: Wrong Answer):
(a, b, c) = map(int, input().split())

ans = a+b+c - min(a,b,c)
print(ans)

Fixed, accepted submission:
(a, b, c) = map(int, input().split())

ans = a+b+c - max(a,b,c)
print(ans)
Problem:
Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers.  You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of pairs of a word and a page number is less than or equal to 100. A word never appear in a page more than once.  The words should be printed in alphabetical order and the page numbers should be printed in ascending order.

Incorrect submission (verdict: Wrong Answer):
import sys
a={}
for i in sys.stdin:
	b,c=i.split()
	a.setdefault(b, []).append(c)
	if c=='18':break
for a,b in sorted(a.items(), key=lambda x: x[0]):
    print(a)
    print(*b)

Fixed, accepted submission:
import sys
a={}
for i in sys.stdin:
	b,c=i.split()
	a.setdefault(b, []).append(c)
for a,b in sorted(a.items(), key=lambda x: x[0]):
    print(a)
    print(*sorted(map(int,b)))
Problem:
Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.  She will concatenate all of the strings in some order, to produce a long string.  Among all strings that she can produce in this way, find the lexicographically smallest one.  Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds:    * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i.   * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.

Incorrect submission (verdict: Wrong Answer):
n,l = map(int,input().split())
list = []

for i in range(n):
    word = input()
    list.append(word)

list_connect = "".join(list)


print(list_connect)

Fixed, accepted submission:
n,l = map(int,input().split())

word_list = []

for i in range(n):
    word_list.append(input())

answer = ''.join(sorted(word_list))
print(answer)
Problem:
You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
S=input()
m=0
for i in range(1,n):
    x=S[:i]
    y=S[i:]
    x1=list(x)
    x2=set(x1)
    y1=list(y)
    y2=set(y1)
    y1=list(y2)
    for i in x2:
        m=max(y1.count(i),m)
    x=""
    y=""
    x1=[]
    x2=[]
    y1=[]
    y2=[]
print(m)

Fixed, accepted submission:
n=int(input())
S=input()
count1=0
m=0
for i in range(1,n):
    x=S[:i]
    y=S[i:]
    x1=list(x)
    x2=set(x1)
    for i in x2:
        if y.count(i)>=1:
            count1+=1
    m=max(count1,m)
    count1=0
    x=""
    y=""
    x1=[]
    x2=[]
print(m)
Problem:
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.  They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card.  Let the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively. They would like to minimize |x-y|. Find the minimum possible value of |x-y|.

Incorrect submission (verdict: Wrong Answer):
from sys import stdin
from itertools import accumulate

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

lin = list(accumulate(li))
su = sum(li)
mi = 10**10
for i in range(n):
    mi = min(mi,abs(su-li[i]*2))
print(mi)

Fixed, accepted submission:
n = int(input())
li = list(map(int,input().split()))

from itertools import accumulate

lin = list(accumulate(li))
mi = 10**18
S = sum(li)

for i in range(n-1):
    ara = lin[i]
    sunu = S-ara
    mi = min(mi,abs(ara-sunu))

print(mi)
Problem:
We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.  How many grams of sand will the upper bulb contains after t seconds?

Incorrect submission (verdict: Wrong Answer):
x, t = map(int, input().split())
print(min(x-t, 0))

Fixed, accepted submission:
x, t = map(int, input().split())
print(max(x-t, 0))
Problem:
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:                 for i = 1 to A.length-1     key = A[i]     /* insert A[i] into the sorted sequence A[0,...,j-1] */     j = i - 1     while j >= 0 and A[j] > key         A[j+1] = A[j]         j--     A[j+1] = key   Note that, indices for array elements are based on 0-origin.  To illustrate the algorithms, your program should trace intermediate result for each step.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
L = [int(x) for x in input().split()]


for i in range(1, N):
    v = L[i]
    j = i - 1
    while j >= 0 and L[j] > v:
        L[j + 1] = L[j]
        j -= 1
    L[j + 1] = v
    print(' '.join(map(str, L)))


Fixed, accepted submission:
N = int(input())
L = [int(x) for x in input().split()]

print(' '.join(map(str, L)))

for i in range(1, N):
    v = L[i]
    j = i - 1
    while j >= 0 and L[j] > v:
        L[j + 1] = L[j]
        j -= 1
    L[j + 1] = v
    print(' '.join(map(str, L)))
Problem:
Two students of AtCoder Kindergarten are fighting over candy packs.  There are three candy packs, each of which contains a, b, and c candies, respectively.  Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.  Note that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.

Incorrect submission (verdict: Wrong Answer):
a = list(map(int, input().split()))
a.sort(key=int, reverse=True)
if a[0] == a[1] + a[2]:
    print("YES")
else:
    print("NO")


Fixed, accepted submission:
a = list(map(int, input().split()))
a.sort(key=int, reverse=True)
if a[0] == a[1] + a[2]:
    print("Yes")
else:
    print("No")
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
otsuri=N%1000
print(otsuri)

Fixed, accepted submission:
N=int(input())
k=N%1000
if k==0:
  t=0
else:
  t=1000-k
print(t)
Problem:
You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive). You cannot assign the same integer to multiple playing fields. The competition consists of N rounds, each of which proceeds as follows:    * For each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.   * Then, each player adds 1 to its integer. If it becomes N+1, change it to 1.  You want to ensure that no player fights the same opponent more than once during the N rounds. Print an assignment of integers to the playing fields satisfying this condition. It can be proved that such an assignment always exists under the constraints given.

Incorrect submission (verdict: Wrong Answer):
N,M = map(int,input().split())


# 
# (0,M),(1,M+2), ... (M//2, 2M)
# (M//2+1, M+1), ...

half = M+1
cnt = 0
i = 0
j = half
while j < N and cnt < M:
    print(i+1, j+1)
    i += 1
    j += 2
    cnt += 1

j = half+1
while j < N and cnt < M:
    print(i+1, j+1)
    i += 1
    j += 2
    cnt += 1

Fixed, accepted submission:
N,M = map(int,input().split())



cnt = 0
i = 0
j = M
while i+1 < j and cnt < M:
    print(i+1, j)
    i += 1
    j -= 1
    cnt += 1

i = M
j = 2*M+1
while i+1 < j and cnt < M:
    print(i+1, j)
    i += 1
    j -= 1
    cnt += 1
Problem:
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.

Incorrect submission (verdict: Wrong Answer):
a = input()
if sorted(a) == "abc":
  print("Yes")
else:
  print("No")


Fixed, accepted submission:
a = input()
b = sorted(a)
if b[0] == "a" and b[1] == "b" and b[2] == "c":
  print("Yes")
else:
  print("No")
Problem:
There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city?

Incorrect submission (verdict: Wrong Answer):
n,m = map(int,input().split())
l = []
for _ in range(m):
  a,b = map(int,input().split())
  l.append(a)
for i in range(1,n+1):
  print(l.count(i))

Fixed, accepted submission:
n,m = map(int,input().split())
l = []
for _ in range(m):
  a,b = map(int,input().split())
  l.append(a)
  l.append(b)
for i in range(1,n+1):
  print(l.count(i))