TnT/CodeNet4Repair huggingface dataset:
Problem:
You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:    * Choose two among A, B and C, then increase both by 1.   * Choose one among A, B and C, then increase it by 2.  It can be proved that we can always make A, B and C all equal by repeatedly performing these operations.

Incorrect submission (verdict: Wrong Answer):
A, B, C = map(int,input().split())
ABC = sorted([A,B,C])
counter = 0
for i in range(ABC[1],ABC[2]):
    ABC[0] += 1
    ABC[1] += 1
    counter += 1
while(ABC[0]+2<=ABC[1]):
    ABC[0] += 2
    counter += 1
if ABC[0]!=ABC[1]:
    ABC[1] += 1
    ABC[2] += 1
    counter += 1
    ABC[0] += 2
    counter += 1
ABC,counter

Fixed, accepted submission:
A, B, C = map(int,input().split())
ABC = sorted([A,B,C])
counter = 0
for i in range(ABC[1],ABC[2]):
    ABC[0] += 1
    ABC[1] += 1
    counter += 1
while(ABC[0]+2<=ABC[1]):
    ABC[0] += 2
    counter += 1
if ABC[0]!=ABC[1]:
    ABC[1] += 1
    ABC[2] += 1
    counter += 1
    ABC[0] += 2
    counter += 1
print(counter)
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):
def check(s):
    if len(s)%2 !=0:
        return False
    i=int(len(s)/2)
    s1=s[:i]
    s2=s[i:]
    print(s1+" "+s2)
    return s1==s2

s = input()
while True:
    s = s[:len(s)-1]
    if check(s):
        print(len(s))
        break


Fixed, accepted submission:
def check(s):
    if len(s)%2 !=0:
        return False
    i=int(len(s)/2)
    s1=s[:i]
    s2=s[i:]
    return s1==s2

s = input()
while True:
    s = s[:len(s)-1]
    if check(s):
        print(len(s))
        break
Problem:
温泉好きのたけしさんは、次の長期休暇を利用してとある温泉地への旅行を計画しています。移動は長距離バスを乗り継ぎ、なるべくお金をかけずに目的地へたどり着きたいと思っています。貯金があるとはいえ、資金に心許ないたけしさんは、おじいさんに相談することにしました。計画を聞いて感心したおじいさんは、たけしさんに特別な切符を渡しました。  その切符は、長距離バスの連続した2区間を1回だけ無料で乗れるというものでした。使いようによってはかなりの移動費削減が見込めますが、より大きな効果を発揮させるためにはしっかりした計画を練る必要があります。  出発地と目的地、及び中継地点が合わせて n 個、2つの地点を結ぶ路線が m 個与えられます。各地点にはそれぞれ 1 から n までの数字が割り振られています。出発地は 1、目的地は n です。路線の情報は、その路線が結ぶ2つの地点 a と b、及びその料金 c で表されます。特別な切符の効力により、任意の地点から、一度だけ連続した2つの路線を料金0で通過することができます。ただし、途中で目的地を通過しても、目的地にたどり着いたことにはなりません。  出発地、目的地、及び中継地点の総数 n と路線の数 m、各路線の情報を入力とし、料金の最小値を出力するプログラムを作成してください。ただし、必ず出発地から目的地へと到達する経路が存在するものとします。

Incorrect submission (verdict: Wrong Answer):
while 1:
    n,m = list(map(int,input().split()))
    if n == 0:break
    costs = {x:[] for x in range(1,n+1)}
    min_cost = [[-1 for x in range(3)] for y in range(n+1)]
    for i in range(m):
        a,b,c = list(map(int,input().split()))
        costs[a].append((b,c))
        costs[b].append((a,c))

    spam = [(0,1,2)] #(cost,num,free tickets count)
    while len(spam) > 0:
        mc = min(spam)
        spam.remove(mc)
        if min_cost[mc[1]][mc[2]] >= 0:
            continue

        min_cost[mc[1]][mc[2]] = mc[0]

        
        for cv in costs[mc[1]]:
            
            if mc[2] == 2:
                spam.append((mc[0] + cv[1],cv[0],2))
            
            if mc[2] > 0:
                spam.append((mc[0],cv[0],mc[2]-1))

    print(min(min_cost[n]))

Fixed, accepted submission:
MAX_V = 999999999999999999999
while 1:
    n,m = list(map(int,input().split()))
    if n == 0:break
    costs = {x:[] for x in range(1,n+1)}
    passed = [[False for x in range(2)] for y in range(n+1)]
    result = [MAX_V,MAX_V]
    for i in range(m):
        a,b,c = list(map(int,input().split()))
        costs[a].append((b,c))
        costs[b].append((a,c))

    spam = [(0,1,2)] #(cost,num,free tickets count)
    while len(spam) > 0:
        mc = min(spam)
        spam.remove(mc)

        tic_i = 0 if mc[2] == 2 else 1

        if mc[2] != 1 and passed[mc[1]][tic_i] :
            continue

        if mc[2] != 1:
            passed[mc[1]][tic_i] = True
            if n == mc[1]:
                result[tic_i] = mc[0]

        if max(result) < MAX_V:break

        
        for cv in costs[mc[1]]:
            
            if mc[2] != 1:
                spam.append((mc[0] + cv[1],cv[0],mc[2]))
            
            if mc[2] > 0:
                spam.append((mc[0],cv[0],mc[2]-1))

    print(min(result))
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
list =[]
i=0
index=1

while(index != 0):
    index=int(input())
    list.append(index)
    i +=1

for i in range(0,i):
    print("Case",i+1,":",list[i])


Fixed, accepted submission:
list =[]
i=0
index=1

while(index != 0):
    index=int(input())
    list.append(index)
    i +=1

for i in range(0,i):
    if list[i] == 0:
        break
    print("Case",i+1,end='')
    print(":",list[i])
Problem:
Joisino the magical girl has decided to turn every single digit that exists on this world into 1.  Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).  She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).  You are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:    * If A_{i,j}≠-1, the square contains a digit A_{i,j}.   * If A_{i,j}=-1, the square does not contain a digit.  Find the minimum total amount of MP required to turn every digit on this wall into 1 in the end.

Incorrect submission (verdict: Wrong Answer):
from heapq import heappop, heappush
H, W = map(int,input().split())
min_cost = [float("inf")] * 10
min_cost[1] = 0
costs = [list(map(int,input().split())) for _ in range(10)]
que = [(0, 1)]
while que:
    cost, v = heappop(que)
    if cost != min_cost[v]:
        continue
    for to in range(10):
        if min_cost[to] > cost + costs[v][to]:
            min_cost[to] = cost + costs[v][to]
            heappush(que, (min_cost[to], to))
ans = 0
for i in range(H):
    for ch in list(map(int,input().split())):
        if ch != -1:
            ans += min_cost[ch]
print(ans)

Fixed, accepted submission:
from heapq import heappop, heappush
H, W = map(int,input().split())
min_cost = [float("inf")] * 10
min_cost[1] = 0
costs = [list(map(int,input().split())) for _ in range(10)]
que = [(0, 1)]
while que:
    cost, v = heappop(que)
    if cost != min_cost[v]:
        continue
    for to in range(10):
        if min_cost[to] > cost + costs[to][v]:
            min_cost[to] = cost + costs[to][v]
            heappush(que, (min_cost[to], to))
ans = 0
for i in range(H):
    for ch in list(map(int,input().split())):
        if ch != -1:
            ans += min_cost[ch]
print(ans)
Problem:
Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.  

Incorrect submission (verdict: Wrong Answer):
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
x, y = input().split()
L = [A, B, C]
for i in L:
  if x in i and y in i:
    print("Yes")
else:
  print("No")

Fixed, accepted submission:
A = set([1,3,5,7,8,10,12])
B = set([4,6,9,11])
L = set([int(i) for i in input().split()])
if len(A&L) == 2 or len(B&L) == 2:
  print("Yes")
else:
  print("No")
Problem:
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.  Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.  Print `Left` if the balance scale tips to the left; print `Balanced` if it balances; print `Right` if it tips to the right.

Incorrect submission (verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
if a+b>c+b:
    print("Left")
elif a+b<c+b:
    print("Right")
else :
    print("Balanced")


Fixed, accepted submission:
a,b,c,d = map(int,input().split())
if a+b>c+d:
    print("Left")
elif a+b<c+d:
    print("Right")
else :
    print("Balanced")
Problem:
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Incorrect submission (verdict: Wrong Answer):
x = int(input())
m = 1
b = 2
while b*b <= x:
  p = 2
  while b**p <= x:
    m = max(m, b**p)
    p += 1
  b += 1
  

Fixed, accepted submission:
x = int(input())
m = 1
b = 2
while b*b <= x:
  p = 2
  while b**p <= x:
    m = max(m, b**p)
    p += 1
  b += 1
print(m)
Problem:
It is September 9 in Japan now.  You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?

Incorrect submission (verdict: Wrong Answer):
print("YNeos"['9'in input()::2])

Fixed, accepted submission:
print(['No','Yes']['9'in input()])
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):
N = int(input())
n = list(map(str, input().split()))
a= 0
b=0
c=0
d=0
for i in n:
    if i == "AC":
        a = a+1
    elif i=="WA":
        b = b+1
    elif i=="TLE":
        c = c+1
    elif i== "RE":
        d = d+1
print("AC x", a)
print("WA x", b)
print("TLE x", c)
print("RE x", d)

Fixed, accepted submission:
N = int(input())
n = list(input() for i in range(N))
a= 0
b=0
c=0
d=0
for i in n:
    if i == "AC":
        a = a+1
    elif i=="WA":
        b = b+1
    elif i=="TLE":
        c = c+1
    elif i== "RE":
        d = d+1
print("AC x", a)
print("WA x", b)
print("TLE x", c)
print("RE x", d)
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
h = int(input())

area = (a+b)*h/2

print(area)


Fixed, accepted submission:
a = int(input())
b = int(input())
h = int(input())

area = (a+b)*h/2

print('{:.0f}'.format(area))
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
nums = [int(i) for i in input().split()]
nums_sort = sorted(nums)

Fixed, accepted submission:
nums = [int(i) for i in input().split()]
nums_sort = sorted(nums)
nums_str = map(str, nums_sort)
print (' '.join(nums_str))
Problem:
Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.

Incorrect submission (verdict: Wrong Answer):
input_data = int(input())
hour=input_data/3600
input_data%=3600
min = input_data/60
input_data%=60

answer = str(hour)+":"+str(min)+":"+str(input_data)
print(answer)

Fixed, accepted submission:
input_data = int(input())
hour=int(input_data/3600)
input_data=int(input_data%3600)
min = int(input_data/60)
input_data=int(input_data%60)

answer = str(hour)+":"+str(min)+":"+str(input_data)
print(answer)
Problem:
We have N cards. A number a_i is written on the i-th card.   Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.   The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[:1:2])
print(alice - bob)


Fixed, accepted submission:
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[1::2])
print(alice - bob)
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):
def insertionSort(A,N):
    for i in range(N):
        v = A [i]
        j = i-1
        while j>=0 and A[j] > v:
            A[j+1] = A[j]
            j = j -1
        A[j+1] = v
        print(A)

A = [5,2,4,6,1,3]
insertionSort(A,6)


Fixed, accepted submission:
def insertionSort(A,N):
    for i in range(N):
        v = A [i]
        j = i-1
        while j>=0 and A[j] > v:
            A[j+1] = A[j]
            j = j -1
        A[j+1] = v
        print(' '.join(map(str, A)))

N = input()
N = int(N)
A = input()
A = list(map(int, A.split()))
insertionSort(A,N)
Problem:
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second.  He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally.

Incorrect submission (verdict: Wrong Answer):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = ''
if(a < b):
  pa = a + v * t
  pb = b + w * t
  if(pb <= pa):
    ans = 'Yes'
  else:
    ans = 'No'
else:
  pa = a - v * t
  pb = b - w * t
  if(pa <= pb):
    ans = 'Yes'
  else:
    ans = 'No'
print(ans)




Fixed, accepted submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
ans = ''
if(a < b):
  pa = a + v * t
  pb = b + w * t
  if(pb <= pa):
    ans = 'YES'
  else:
    ans = 'NO'
else:
  pa = a - v * t
  pb = b - w * t
  if(pa <= pb):
    ans = 'YES'
  else:
    ans = 'NO'
print(ans)
Problem:
We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:    * Question 1: Are you subscribing to Newspaper X?   * Question 2: Are you subscribing to Newspaper Y?  As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2.  What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?  Write a program to answer this question.

Incorrect submission (verdict: Wrong Answer):
n , x , y = map(int , input().split())

min = n - x - y

if x > y : print (str(x) + " " + str(min))
else : print(str(y) + " " + str(min))

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

min = x + y - n
if min < 0 : min = 0

if x < y : print (str(x) + " " + str(min))
else : print(str(y) + " " + str(min))
Problem:
Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.  Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.  Among the colorings satisfying the condition above, construct one that uses the minimum number of colors.

Incorrect submission (verdict: Wrong Answer):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
edge=[[] for i in range(n+1)]
par=[0]*(n+1)
par[1]=-1
col=[0]*(n-1)
for i in range(n-1):
    a,b=mp()
    edge[a].append([a,b,i])
    edge[b].append([b,a,i])

print(edge)

que=deque([edge[1]])
while len(que):
    k=1
    q=que.popleft()
    for x,y,i in q:
        if col[i]==0:
            if k==par[x]:
                k+=1
            col[i]=k
            par[y]=k
            k+=1
            que.append(edge[y])
print(max(col))
for i in range(n-1):
    print(col[i])

Fixed, accepted submission:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
edge=[[] for i in range(n+1)]
par=[0]*(n+1)
par[1]=-1
col=[0]*(n-1)
for i in range(n-1):
    a,b=mp()
    edge[a].append([a,b,i])
    edge[b].append([b,a,i])


que=deque([edge[1]])
while len(que):
    k=1
    q=que.popleft()
    for x,y,i in q:
        if col[i]==0:
            if k==par[x]:
                k+=1
            col[i]=k
            par[y]=k
            k+=1
            que.append(edge[y])
print(max(col))
for i in range(n-1):
    print(col[i])
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

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

d = a + b + c

if d == 17:
  print('yes')
else:
  print('no')

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

d = a + b + c

if d == 17:
  print('YES')
else:
  print('NO')
Problem:
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?

Incorrect submission (verdict: Wrong Answer):
a, b, x = map(int, input().split())
if a == 0:
    b += x
print(b // x - a // x)


Fixed, accepted submission:
a, b, x = map(int, input().split())
if a == 0:
    print(b // x + 1)
else:
    a -= 1
    print(b // x - a // x)
Problem:
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.   Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.   Here, both the x\- and y-coordinates before and after each movement must be integers.   He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).   Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).   Under this condition, find a shortest path for him.

Incorrect submission (verdict: Wrong Answer):
sx,sy,tx,ty=map(int,input().split())
print('R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)+'U'*(ty-sy)+'LD'+'D'*(ty-sy)+'R'*(tx-sx)+'RURU'+'U'*(ty-sy)+'L'*(tx-sx)+'LD')

Fixed, accepted submission:
sx,sy,tx,ty=map(int,input().split())
print('U'*(ty-sy)+'R'*(tx-sx)+'D'*(ty-sy)+'L'*(tx-sx)+'LU'+'U'*(ty-sy)+'R'*(tx-sx)+'RDRD'+'D'*(ty-sy)+'L'*(tx-sx)+'LU')
Problem:
AtCoDeer has three cards, one red, one green and one blue.   An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.   We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.   Is this integer a multiple of 4?

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

if r * 100 + b * 10 + b % 4 == 0:
    print("YES")
else:
    print("NO")


Fixed, accepted submission:
r, g, b = map(int, input().split())

if (r * 100 + g * 10 + b) % 4 == 0:
    print("YES")
else:
    print("NO")
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
x, a, b = map(int, input().split())
A = abs(x-a)
B = abs(x-b)
if A>B:
  print("A")
else:
  print("B")

Fixed, accepted submission:
x, a, b = map(int, input().split())
A = abs(x-a)
B = abs(x-b)
if A>B:
  print("B")
else:
  print("A")
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())
ans=N%1000
print(ans)

Fixed, accepted submission:
N=int(input())
if N%1000==0:
  print(0)
else:
  print(1000*(N//1000+1)-N)
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
num = list(map(int,input().split()))
count = 0
while count < 2:
        for i in range(2):
                j = 0
                if num[i] > num[i+1]:
                        j = num[i]
                        num[i] = num[i+1]
                        num[i+1] = j
                else:
                        continue
        count += 1
print(num)

Fixed, accepted submission:
num = list(map(int,input().split()))
count = 0
while count < 2:
        for i in range(2):
                j = 0
                if num[i] > num[i+1]:
                        j = num[i]
                        num[i] = num[i+1]
                        num[i+1] = j
                else:
                        continue
        count += 1
out = ''
for i in num:
        out += str(i) + ' '
print(out[:-1])
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):
N = int(input())
S = [input() for _ in range(N)]
ls = ["AC","WA","TLE","RE"]
for i in range(4):
  print("{} × {}".format(ls[i],S.count(ls[i])))

Fixed, accepted submission:
N = int(input())
S = [input() for _ in range(N)]
ls = ["AC","WA","TLE","RE"]
for i in range(4):
  print("{} x {}".format(ls[i],S.count(ls[i])))