TnT/CodeNet4Repair huggingface dataset:
Problem:
Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i.  The N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.  When each player, except the first one to arrive, arrives at the place, the player gets **comfort** equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.  What is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(a)
d=[a[0]]
ans=0
for i in range(1,n):
  tmp=max(d)
  ans=ans+tmp
  d.remove(tmp)
  d.append(a[i])
  d.append(a[i])
print(ans)


Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for i in range(1,n):
  ans=ans+a[i//2]
print(ans)
Problem:
This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters.  Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way.  You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtained from the string s by deleting some characters.

Incorrect submission (verdict: Wrong Answer):
def main():
    s = input()
    a = s.index('C')
    if a and 'F' in s[a+1:]:
        print('Yes')
    else:
        print('No')

main()


Fixed, accepted submission:
def main():
    s = input()
    if 'C' in s and 'F' in s[s.index('C')+1:]:
        print('Yes')
    else:
        print('No')

main()
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

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

pt,px,py = 0,0,0

bl = True
for t,x,y in TXY:
  dt = abs(t-pt)
  dx = abs(x-px)
  dy = abs(y-py)
  px = x
  py = y
  pt = t
  if dt > dx+dy:
    bl = False
    break
  if (dt-(dx+dy))&1:
    bl = False
    break

print('Yes' if bl else 'No')

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

pt,px,py = 0,0,0

bl = True
for t,x,y in TXY:
  dt = abs(t-pt)
  dx = abs(x-px)
  dy = abs(y-py)
  px = x
  py = y
  pt = t
  if dt < dx+dy:
    bl = False
    break
  if (dt-(dx+dy))&1:
    bl = False
    break

print('Yes' if bl else 'No')
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):
x = list(map(int, input().split()))
sorted(x)
if x[0] + x[1] == x[2]:
    print("YES")
else:
    print("NO")


Fixed, accepted submission:
x = list(map(int, input().split()))
x.sort()
if x[0] + x[1] == x[2]:
    print("Yes")
else:
    print("No")
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()
n = len(s)
if n%2:
  s = s[:-1]
  n -= 1
for i in range(n//2):
  n = len(s)
  if s[:n//2] == s[n//2:]:
    print(n)
    break
  s = s[:-2]
    
  

Fixed, accepted submission:
s = input()[:-1]
n = len(s)
if n%2:
  s = s[:-1]
  n -= 1
for i in range(n//2):
  n = len(s)
  if s[:n//2] == s[n//2:]:
    #print(s[:n//2], s[n//2:])
    print(n)
    break
  s = s[:-2]
Problem:
You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called _health_ , and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.  Fortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:    * Select an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.  At least how many explosions do you need to cause in order to vanish all the monsters?

Incorrect submission (verdict: Wrong Answer):
# -*- coding:utf-8 -*-

line = input().split(' ')
N = int(line[0])
A = int(line[1])
B = int(line[2])
hn = sorted([int(input()) for i in range(N)])
# print(hn)
mini = min(hn)
syo = int(mini / A)
if syo == 0:
    syo = 1

hn_s = [i / syo for i in hn]
i = 0
# print(hn_s)
while True:
    hn_s = [i - B for i in hn_s]
    hn_s[-1] -= A - B
    if all([True if i <= 0 else False for i in hn_s]):
        break
    sorted(hn_s)
    i += 1
i -= 1
i *= syo
print(i)


Fixed, accepted submission:
# -*- coding:utf-8 -*-
import math

N, A, B = map(int, input().split(' '))
hn = [int(input()) for i in range(N)]

maxT = max(hn) // B + 1
minT = 0

def enough(T):
    count = sum([math.ceil((h - B*T) / (A-B)) if (h - B*T) >= 0 else 0 for h in hn])
    return True if count <= T else False

while True:
    med = (maxT + minT) // 2
    if enough(med):
        maxT = med
    else:
        minT = med
    if maxT - minT <= 1:
        break
print(maxT)
Problem:
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.  Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

Incorrect submission (verdict: Wrong Answer):
n=int(input())
list=[input() for i in range(n)]

a = []

for i in range(n):
    a.append(list.count(i))
print(len(a))


Fixed, accepted submission:
n=int(input())
list=[int(input()) for i in range(n)]
print(len(set(list)))
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())

if N>=10000:
    print(N-10000)
elif N>=9000:
    print(N-9000)
elif N>=8000:
    print(N-8000)
elif N>=7000:
    print(N-7000)
elif N>=6000:
    print(N-6000)
elif N>=5000:
    print(N-5000)
elif N>=4000:
    print(N-4000)
elif N>=3000:
    print(N-3000)
elif N>=2000:
    print(N-2000)
elif N>=1000:
    print(N-1000)
else:
    print(N)

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

if N==10000:
    print(0)
elif N>9000:
    print(10000-N)
elif N>8000:
    print(9000-N)
elif N>7000:
    print(8000-N)
elif N>6000:
    print(7000-N)
elif N>5000:
    print(6000-N)
elif N>4000:
    print(5000-N)
elif N>3000:
    print(4000-N)
elif N>2000:
    print(3000-N)
elif N>1000:
    print(2000-N)
else:
    print(1000-N)
Problem:
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.

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

money = [10000, 5000, 1000]
x = [0, 0, 0]
for i in range(3):
    while True:
        if y - money[i] >= 0:
            y -= money[i]
            x[i] += 1
        else:
            break
if y == 0:
    print(' '.join(map(str, x)))
else:
    print('-1 -1 -1')


Fixed, accepted submission:
n, y = map(int, input().split())
res = [-1, -1, -1]
for a in range(n + 1):
    for b in range(n - a + 1):
        if 10000 * a + 5000 * b + 1000 * (n - a - b) == y:
            res[0] = a
            res[1] = b
            res[2] = n - a - b
print(' '.join(map(str, res)))
Problem:
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:    * 1 \leq x,y,z   * x^2 + y^2 + z^2 + xy + yz + zx = n  Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Incorrect submission (verdict: Wrong Answer):
N = int(input())
res=[0] * 10000
for x in range(1,42):
    for y in range(x,42):
        for z in range(y,42):
            k=x*x+y*y+z*z+x*y+y*z+z*x
            if k>10000: continue
            if x==y and y==z:
                res[k]+=1
            elif x!=y and y!=z and z!=x:
                res[k]+=6
            else:
                res[k]+=3
for i in range(N):
    print(res[i])


Fixed, accepted submission:
N = int(input())
res=[0 for _ in range(10050)]
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            k=x*x+y*y+z*z+x*y+y*z+z*x
            if k<10050:
                res[k]+=1
for i in range(N):
    print(res[i+1])
Problem:
We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.  Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.  Find the inversion number of B, modulo 10^9 + 7.  Here the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \leq i < j \leq K \times N - 1) such that B_i > B_j.

Incorrect submission (verdict: Wrong Answer):
n,k=map(int, input().split())
a=list(map(int, input().split()))
ans=0
x=0
y=0
for i in range(n):
    for j in range(n):
        if a[i]>a[j] and i>j:
            x+=1
        if a[i]>a[j] and i<j:
            y+=1
    print(x,y)
ans+=(x*(k-1)*k//2+y*k*(k+1)//2)%(10**9+7)
print(ans)

Fixed, accepted submission:
n,k=map(int, input().split())
a=list(map(int, input().split()))
ans=0
x=0
y=0
for i in range(n):
    for j in range(n):
        if a[i]>a[j] and i>j:
            x+=1
        if a[i]>a[j] and i<j:
            y+=1
ans+=(x*(k-1)*k//2+y*k*(k+1)//2)%(10**9+7)
print(ans)
Problem:
In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops.  Note that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto.  Write a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements.                 void call(int n){   int i = 1;  CHECK_NUM:   int x = i;   if ( x % 3 == 0 ){     cout << " " << i;     goto END_CHECK_NUM;   }  INCLUDE3:   if ( x % 10 == 3 ){     cout << " " << i;     goto END_CHECK_NUM;   }   x /= 10;   if ( x ) goto INCLUDE3;  END_CHECK_NUM:   if ( ++i <= n ) goto CHECK_NUM;    cout << endl; }

Incorrect submission (verdict: Wrong Answer):
num = int(input())
for i in range(0,num+1):
    if i % 3 == 0 or '3' in str(i):
        print('{}'.format(i))
       

Fixed, accepted submission:
num = int(input())
for i in range(1,num+1):
    if i % 3 == 0 or '3' in str(i):
        print(' {}'.format(i),end="")
print();
Problem:
Today is August 24, one of the five Product Days in a year.  A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):    * d_1 \geq 2   * d_{10} \geq 2   * d_1 \times d_{10} = m  Takahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.  In Takahashi Calendar, how many Product Days does a year have?

Incorrect submission (verdict: Wrong Answer):
m,d=map(int,input().split())
if d<22:
  print(0)
else:
  ans=0
  for M in range(m+1)[1:]:
    for D in range(d+1)[23:]:
      q=D%10
      r=(D-q)//10
      if r>=2 and q>=2 and M==q*r:
        ans += 1
  print(ans)

Fixed, accepted submission:
m,d=map(int,input().split())
if d<22:
  print(0)
else:
  ans=0
  for M in range(m+1)[1:]:
    for D in range(d+1)[22:]:
      q=D%10
      r=(D-q)//10
      if r>=2 and q>=2 and M==q*r:
        ans += 1
  print(ans)
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, b, h = [int(input()) for i in range(3)]
print((a+b)*h/2)

Fixed, accepted submission:
a, b, h = [int(input()) for i in range(3)]
print(int((a+b)*h/2))
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
trv = []
for i in range(n):
    t,x,n = map(int,input().split())
    a = [t,x,n]
    trv.append(a)

flag = 1
for i in range(1,len(trv)):
    time = trv[i][0]-trv[i-1][0]
    dist = abs(trv[i][1]-trv[i-1][1]) + abs(trv[i][2]-trv[i-1][2])
    if time <= dist:
        flag = 0
        break
    elif time >= dist and (time-dist) % 2 == 0:
        None
    else:
        flag = 0
        break
        
if flag == 0:
    print('NO')
else:
    print('YES')

Fixed, accepted submission:
n = int(input())
trv = [[0,0,0]]
for i in range(n):
    t,x,y = map(int,input().split())
    a = [t,x,y]
    trv.append(a)

flag = 1

for i in range(1,len(trv)):
    time = trv[i][0]-trv[i-1][0]
    dist = abs(trv[i][1]-trv[i-1][1]) + abs(trv[i][2]-trv[i-1][2])
    if time < dist:
        flag = 0
    elif time >= dist and (time-dist) % 2 == 0:
        None
    else:
        flag = 0
        break
        
if flag == 0:
    print('No')
else:
    print('Yes')
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
while True:
	a, op, b = input().split()
	a = int(a)
	b = int(b)
	if op == "+": print(a + b)
	elif op == "-": print(a - b)
	elif op == "*": print(a * b)
	elif op == "/": print(a / b)
	else: break

Fixed, accepted submission:
while True:
	x, op, y = input().split()
	x, y = map(int, (x, y))
	if op == '?':
		break
	print(x + y if op == '+' else x - y if op == '-' else x * y if op == '*' else int(x / y))
Problem:
You went shopping to buy cakes and donuts with X yen (the currency of Japan).  First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop.  How much do you have left after shopping?

Incorrect submission (verdict: Wrong Answer):
inf = [int(input()) for i in range(3)]
a = inf[0]-inf[1]
b = a/inf[2]
ans = a-b *inf[2]
print(ans)

Fixed, accepted submission:
inf = [int(input()) for i in range(3)]
a = inf[0]-inf[1]
b = int(a/inf[2])
ans = a-b *inf[2]
print(ans)
Problem:
You start with the number 0 and you want to reach the number N.  You can change the number, paying a certain amount of coins, with the following operations:    * Multiply the number by 2, paying A coins.   * Multiply the number by 3, paying B coins.   * Multiply the number by 5, paying C coins.   * Increase or decrease the number by 1, paying D coins.  You can perform these operations in arbitrary order and an arbitrary number of times.  What is the minimum number of coins you need to reach N?  **You have to solve T testcases.**

Incorrect submission (verdict: Wrong Answer):
t = int(input())
n, a, b, c, d = list(), list(), list(), list(), list()
for i in range(t):
    x = list(map(int, input().split()))
    n.append(x[0])
    a.append(x[1])
    b.append(x[2])
    c.append(x[3])
    d.append(x[4])

for i in range(t):
    print(a[i] * n[i])
    


Fixed, accepted submission:
#import sys


times = int(input())
x = []
for t in range(times):
    x.append(list(map(int, input().split())))


def f(n):
    if n == 0:
        return 0
    if n == 1:
        return d
    if n in dic:
        return dic[n]

    if n%2 == 0:
        n2 = f(n // 2) + a
    elif n%2 == 1:
        n2 = min(f((n-1) // 2) + d, f((n+1) // 2) + d) + a

    if n%3 == 0:
        n3 = f(n // 3) + b
    elif n%3 == 1:
        n3 = min(f((n-1) // 3) + d, f((n+2) // 3) + 2*d) + b
    elif n%3 == 2:
        n3 = min(f((n-2) // 3) + 2*d, f((n+1) // 3) + d) + b

    if n%5 == 0:
        n5 = f(n // 5) + c
    elif n%5 == 1:
        n5 = min(f((n-1) // 5) + d, f((n+4) // 5) + 4*d) + c
    elif n%5 == 2:
        n5 = min(f((n-2) // 5) + 2*d, f((n+3) // 5) + 3*d) + c
    elif n%5 == 3:
        n5 = min(f((n-3) // 5) + 3*d, f((n+2) // 5) + 2*d) + c
    elif n%5 == 4:
        n5 = min(f((n-4) // 5) + 4*d, f((n+1) // 5) + d) + c

    Y = min(n2, n3, n5, n*d)
    dic[n] = Y
    return Y


for t in range(times):
    n, a, b, c, d = x[t][0], x[t][1], x[t][2], x[t][3], x[t][4]
    dic = {}
    print(f(n))
Problem:
Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:                 SelectionSort(A) 1 for i = 0 to A.length-1 2     mini = i 3     for j = i to A.length-1 4         if A[j] < A[mini] 5             mini = j 6     swap A[i] and A[mini]   Note that, indices for array elements are based on 0-origin.  Your program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.

Incorrect submission (verdict: Wrong Answer):
def selection_sort(A, N):
    sw = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        A[i], A[minj] = A[minj], A[i]
        sw += 1
    return sw


def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    sw = selection_sort(A, N)
    
    print(' '.join(map(str, A)))
    print(sw)
    
    
if __name__ == '__main__':
    main()

Fixed, accepted submission:
def selection_sort(A, N):
    sw = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            sw += 1
            A[i], A[minj] = A[minj], A[i]
    return sw


def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    sw = selection_sort(A, N)
    
    print(' '.join(map(str, A)))
    print(sw)
    
    
if __name__ == '__main__':
    main()
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())
C = 0
D = 0
E = 0
F = 0
S = ""

for i in range(N):
    S = input()
    if S == 'AC':
        C += 1
    elif S == 'WA':
        D += 1
    elif S == 'TLE':
        E += 1
    elif S == 'RE':
        F += 1
print("AC × " + str(C), "WA × " + str(D),  "TLE × " + str(E),  "RE × " + str(F), sep='\n')


Fixed, accepted submission:
N = int(input())
C = 0
D = 0
E = 0
F = 0
S = ''

for i in range(N):
    S = input()
    if S == 'AC':
        C += 1
    elif S == 'WA':
        D += 1
    elif S == 'TLE':
        E += 1
    elif S == 'RE':
        F += 1
print('AC x '+ str(C), 'WA x ' + str(D),  'TLE x ' + str(E),  'RE x ' + str(F), sep='\n')
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
a, op, b = input().split()
while op != '?':
    a, b = int(a), int(b)
    if op == '+': a += b
    if op == '-': a -= b
    if op == '*': a *= b
    if op == '/': a /= b
    print(a)
    a, op, b = input().split()


Fixed, accepted submission:
a, op, b = input().split()
while op != '?':
    a, b = int(a), int(b)
    if op == '+': a += b
    if op == '-': a -= b
    if op == '*': a *= b
    if op == '/': a = int(a / b)
    print(a)
    a, op, b = input().split()
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 = sorted(map(int, input().split()))
print(a == [5, 5, 7])

Fixed, accepted submission:
a = sorted(map(int, input().split()))
if a == [5, 5, 7]:
  print("YES")
else:
  print("NO")
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())
if a == 5 and b == 7 and c == 5:
  print('YES')
else:
  print('NO')

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

if a.count(5) == 2 and a.count(7) == 1:
  print('YES')
else:
  print('NO')
Problem:
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball.  He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.  Find the minimum number of balls that Takahashi needs to rewrite the integers on them.

Incorrect submission (verdict: Wrong Answer):
from collections import Counter
N, K = map(int, input().split())
A = Counter(input().split())
print(A)

print(sum(sorted(A.values(), reverse=True)[K:]))

Fixed, accepted submission:
from collections import Counter
N, K = map(int, input().split())
A = Counter(input().split())

print(sum(sorted(A.values(), reverse=True)[K:]))