TnT/CodeNet4Repair huggingface dataset:
Problem:
VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price.  Our store uses the following rules to calculate the after-tax prices.    * When the VAT rate is _x_ %, for an item with the before-tax price of _p_ yen, its after-tax price of the item is _p_  (100+ _x_ ) / 100 yen, fractions rounded off.    * The total after-tax price of multiple items paid at once is the sum of after-tax prices of the items.   The VAT rate is changed quite often. Our accountant has become aware that "different pairs of items that had the same total after-tax price may have different total after-tax prices after VAT rate changes." For example, when the VAT rate rises from 5% to 8%, a pair of items that had the total after-tax prices of 105 yen before can now have after-tax prices either of 107, 108, or 109 yen, as shown in the table below.  Before-tax prices of two items| After-tax price with 5% VAT| After-tax price with 8% VAT   ---|---|---   20, 80| 21 + 84 = 105| 21 + 86 = 107   2, 99| 2 + 103 = 105| 2 + 106 = 108   13, 88| 13 + 92 = 105| 14 + 95 = 109       Our accountant is examining effects of VAT-rate changes on after-tax prices. You are asked to write a program that calculates the possible maximum total after-tax price of two items with the new VAT rate, knowing their total after- tax price before the VAT rate change.

Incorrect submission (verdict: Wrong Answer):
def change(before_tax,after_tax,previous_price):
    #change z from taxrate x to taxrate y
    tmp_original_price = previous_price * 100 / (100 + before_tax)
    if tmp_original_price % 1 == 0:
        original_price = tmp_original_price
    else:
        original_price = tmp_original_price // 1 + 1
    return int(original_price * (100 + after_tax) // 100)


while True:
    x,y,s = [int(x) for x in input().split()]
    if x == 0:
        break
    else:
        ans = 0
        for i in range(1,int(s//2)+2):
            price1, price2 = i, s - i
            afterprice = change(x,y,price1) + change(x,y,price2)
            if afterprice > ans:
                ans = afterprice
            else:
                pass
        print(ans)



Fixed, accepted submission:
def change(before_tax,after_tax,previous_price):
    original_price = 0
    for i in range(1, previous_price+1):
        if i * (100 + before_tax) // 100 == previous_price:
            original_price = i
            break
        else:
            pass
    return original_price * (100 + after_tax) // 100

ans_list = []

while True:
    x,y,s = [int(x) for x in input().split()]
    if x == 0:
        break
    else:
        ans = 0
        for i in range(1,s):
            price1, price2 = i, s - i
            afterprice = change(x,y,price1) + change(x,y,price2)
            if afterprice > ans:
                ans = afterprice
            else:
                continue
        ans_list.append(ans)

for x in ans_list:
    print(x)
Problem:
Snuke loves working out. He is now exercising N times.  Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i.  Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.

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

result = 1

for i in range(1,n):
    result *= i
    result %= (10**9 + 7)

print(result)

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

result = 1

for i in range(1, n+1):
    result = (i * result) % (10 ** 9 + 7)

print(result)
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())
dx = tx - sx
dy = ty - sy

if dx == 0:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    dy = abs(dy)
    ans = d1 * dy
    ans += "R" + d2 * dy + "L"
    ans += "L" + d1 * dy + "R"
    ans += d1 + "RR" + d2 * (dy + 2) + "LL" + d1
    print(ans)
    
elif dy == 0:
    if dx > 0:
        d1 = "R"
        d2 = "L"
    else:
        d1 = "L"
        d2 = "R"
    dx = abs(dx)
    ans = d1 * dx
    ans += "U" + d2 * dx + "D"
    ans += "D" + d1 * dx + "U"
    ans += d1 + "UU" + d2 * (dx + 2) + "DD" + d1
    print(ans)

else:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    if dx > 0:
        d3 = "R"
        d4 = "L"
    else:
        d3 = "L"
        d4 = "R"
    dx = abs(dx)
    dy = abs(dy)
    ans = d1 * dy + d3 * dx
    ans += d4 * dx + d2 * dy
    ans += d4 + d1 * (dy + 1) + d3 * (dx + 1) + d2
    ans += d1 + d4 * (dx + 1) + d2 * (dy + 1) + d3
    print(ans)

Fixed, accepted submission:
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy

if dx == 0:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    dy = abs(dy)
    ans = d1 * dy
    ans += "R" + d2 * dy + "L"
    ans += "L" + d1 * dy + "R"
    ans += d1 + "RR" + d2 * (dy + 2) + "LL" + d1
    print(ans)
    
elif dy == 0:
    if dx > 0:
        d1 = "R"
        d2 = "L"
    else:
        d1 = "L"
        d2 = "R"
    dx = abs(dx)
    ans = d1 * dx
    ans += "U" + d2 * dx + "D"
    ans += "D" + d1 * dx + "U"
    ans += d1 + "UU" + d2 * (dx + 2) + "DD" + d1
    print(ans)

else:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    if dx > 0:
        d3 = "R"
        d4 = "L"
    else:
        d3 = "L"
        d4 = "R"
    dx = abs(dx)
    dy = abs(dy)
    ans = d1 * dy + d3 * dx
    ans += d2 * dy + d4 * dx
    ans += d4 + d1 * (dy + 1) + d3 * (dx + 1) + d2
    ans += d3 + d2 * (dy + 1) + d4 * (dx + 1) + d1
    print(ans)
Problem:
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Incorrect submission (verdict: Wrong Answer):
n, a, b = map(int, input().split())
for i in range(1,n):
    n1 = 0
    s = str(n)    
    array = list(map(int, s))
    s1 = sum(array)
    if a <= n1 <= b:
        n1 = n1+s1
print(n1)
        


Fixed, accepted submission:
n, a, b = map(int, input().split())
n1 = 0
for i in range(1,n+1):
    
    s = str(i)    
    array = list(map(int, s))
    s1 = sum(array)
    if a <= s1 <= b:
        n1 = n1+i
        
print(n1)
Problem:
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}.  Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.

Incorrect submission (verdict: Wrong Answer):
h,w = map(int, input().split())
n = list(input() for _ in range(h))

tb = '#'*(w+2)

for i in range(h):
    n[i] = '#'+n[i]+'#'
else:
    n.insert(0, tb)
    n.append(tb)

print(n[g] for g in range(h+2))

Fixed, accepted submission:
h,w = map(int, input().split())
n = list(input() for _ in range(h))

tb = '#'*(w+2)

for i in range(h):
    n[i] = '#'+n[i]+'#'
else:
    n.insert(0, tb)
    n.append(tb)

for g in range(h+2):
    print(n[g])
Problem:
You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words.

Incorrect submission (verdict: Wrong Answer):
a = input().split()
for s in a:
  print(chr(ord(s[0]) + ord("A") -ord("a")))

Fixed, accepted submission:
a = input().split()
for s in a:
  print(chr(ord(s[0]) + ord("A") -ord("a")), end="")
print()
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):
print(input()[::2])

Fixed, accepted submission:
a,b=map(int,input().split())
x = max(a-b,0)
print (x)
Problem:
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.  You are given an integer N. Find the N-th Lucas number.  Here, the i-th Lucas number L_i is defined as follows:    * L_0=2   * L_1=1   * L_i=L_{i-1}+L_{i-2} (i≥2)

Incorrect submission (verdict: Wrong Answer):
n = int(input())
l = [2, 1]
if n == 1:
  print(2)
elif n == 2:
  print(1)
else:
  for i in range(n - 2):
    l.append(l[-1] + l[-2])
  print(l[-1])

Fixed, accepted submission:
n = int(input())
l = [2, 1]
if n == 1:
  print(1)
else:
  for i in range(n - 1):
    l.append(l[-1] + l[-2])
  print(l[-1])
Problem:
Snuke has N strings. The i-th string is s_i.  Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.

Incorrect submission (verdict: Wrong Answer):
import sys
input = sys.stdin.readline

S = [input() for _ in range(int(input()))]
AB = 0
end_A = 0
start_B = 0
sB_eA = 0

for s in S:
    AB += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        sB_eA += 1
    elif s[0] == 'B':
        start_B += 1
    elif s[-1] == 'A':
        end_A += 1
amari = abs(start_B-end_A)
print(AB+min(start_B,end_A)+min(amari,sB_eA))

Fixed, accepted submission:
S = [input() for _ in range(int(input()))]

end_A = 0
start_B = 0
sB_eA = 0
ans = 0

for s in S:
    ans += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        sB_eA += 1
    elif s[0] == 'B':
        start_B += 1
    elif s[-1] == 'A':
        end_A += 1

ans += min(start_B,end_A)

if start_B == 0 and end_A == 0:
    ans += max(0,sB_eA-1)
else:
    ans += sB_eA
print(ans)
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())
s=sorted([input() for i in range(n)])
s_1=''.join(s)
print('s_1')


Fixed, accepted submission:
n,l=map(int,input().split())
s=[input() for i in range(n)]

s=sorted(s)
print(*s,sep='')
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):

x = int(input("いくら持ってる？"))
a = int(input("ケーキは1個いくら？"))
b = int(input("ドーナッツは1個いくら？"))

#print(x,a,b)


x -= a


x = x%b

print(x)

Fixed, accepted submission:

x = int(input())
a = int(input())
b = int(input())

#print(x,a,b)


x -= a


x = x%b

print(x)
Problem:
There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation.  An adjacency-list representation consists of an array $Adj[|V|]$ of $|V|$ lists, one for each vertex in $V$. For each $u \in V$, the adjacency list $Adj[u]$ contains all vertices $v$ such that there is an edge $(u, v) \in E$. That is, $Adj[u]$ consists of all vertices adjacent to $u$ in $G$.  An adjacency-matrix representation consists of $|V| \times |V|$ matrix $A = a_{ij}$ such that $a_{ij} = 1$ if $(i, j) \in E$, $a_{ij} = 0$ otherwise.  Write a program which reads a directed graph $G$ represented by the adjacency list, and prints its adjacency-matrix representation. $G$ consists of $n\; (=|V|)$ vertices identified by their IDs $1, 2,.., n$ respectively.

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

g = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        g[a[0] - 1][a[j + 2] - 1] = 1
        g[a[j + 2] - 1][a[0] - 1] = 1

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


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

g = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        g[a[0] - 1][a[j + 2] - 1] = 1

for i in range(n):
    print(*g[i])
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

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

ball = [0] * N
ball[-1] = A[-1]

for i in range(N-2, -1, -1) :
    bit = A[i]
    for j in range(i, N) :
        bit ^= ball[i]
    ball[i] = bit

print(*ball)

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

ans = [0] * N
for i in range(N)[:: -1]:
    a = A[i]
    cnt = 0
    for j in range(i, N, (i + 1)):
        cnt += ans[j]
    if cnt % 2 != a % 2:
        ans[i] = 1

M = sum(ans)
print(M)
if M > 0:
    print(*[i for i, a in enumerate(ans, start=1) if a > 0])
Problem:
In this problem, we use the 24-hour clock.  Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying?

Incorrect submission (verdict: Wrong Answer):
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
	h-=1
	m = m2 - m1 + 60
else:
	m = m2 - m1
l = h*60 + m - k

Fixed, accepted submission:
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
	h-=1
	m = m2 - m1 + 60
else:
	m = m2 - m1
l = h*60 + m - k
print(l)
Problem:
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?

Incorrect submission (verdict: Wrong Answer):
num = list(input())
ans = 7
for i in range(2 ** len(num)):
    total = 0
    ans_num = []
    ans_op = []
    for j in range(len(num)):
        if((i >> j) & 1):
            ans_num.append(num[j])
            if(j >= 1):
                ans_op.append('+')
            total += int(num[j])
        else:
            ans_num.append(num[j])
            if (j >= 1):
                ans_op.append('-')
            total -= int(num[j])
    if(total == ans):
        print(ans_num[0]+ans_op[0]+ans_num[1]+ans_op[1]+ans_num[2]+ans_op[2]+ans_num[3]+'=7')
        break

Fixed, accepted submission:
n = input()
if n[0] == n[1] and n[1] == n[2]:
    print('Yes')
elif n[1] == n[2] and n[2] == n[3]:
    print('Yes')
else:
    print('No')
Problem:
There is a simple directed graph G with N vertices, numbered 1, 2, \ldots, N.  For each i and j (1 \leq i, j \leq N), you are given an integer a_{i, j} that represents whether there is a directed edge from Vertex i to j. If a_{i, j} = 1, there is a directed edge from Vertex i to j; if a_{i, j} = 0, there is not.  Find the number of different directed paths of length K in G, modulo 10^9 + 7. We will also count a path that traverses the same edge multiple times.

Incorrect submission (verdict: Wrong Answer):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect

#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10**9)
INF = float('inf')
MOD = 10**9 +7

def main():
  N, K = map(int, readline().split())
  A = np.array(read().split(), np.int64).reshape(N,N)
  
  def pow_array(a,k):
    ans = np.eye(N)
    while k:
      if k%2:
        ans = np.dot(ans%MOD, a%MOD)
      a = np.dot(a%MOD, a%MOD)
      k>>=1
    return ans%MOD
  
  anser = pow_array(A,K).astype('int64').sum()
  print(anser)
  
if __name__ == '__main__':
  main()

Fixed, accepted submission:
import sys
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    A = list(list(map(int, readline().split())) for _ in range(N))
    A = np.array(A)
    def dot(A, B):
        C = np.zeros((N, N), np.int64)
        for n in range(N):
            C[n] = (A[n, :][:, None] * B % MOD).sum(axis=0) % MOD
        return C

    def matrix_power(A, n):
        if n == 0:
            return np.eye(N, dtype=np.int64)
        X = matrix_power(A, n // 2)
        X = dot(X, X)
        return dot(A, X) if n & 1 else X

    ans = matrix_power(A,K)
    print(ans.sum() %MOD)


if __name__ == '__main__':
    main()
Problem:
In this problem, we only consider strings consisting of lowercase English letters.  Strings s and t are said to be **isomorphic** when the following conditions are satisfied:    * |s| = |t| holds.   * For every pair i, j, one of the following holds:     * s_i = s_j and t_i = t_j.     * s_i \neq s_j and t_i \neq t_j.  For example, `abcac` and `zyxzx` are isomorphic, while `abcac` and `ppppp` are not.  A string s is said to be in **normal form** when the following condition is satisfied:    * For every string t that is isomorphic to s, s \leq t holds. Here \leq denotes lexicographic comparison.  For example, `abcac` is in normal form, but `zyxzx` is not since it is isomorphic to `abcac`, which is lexicographically smaller than `zyxzx`.  You are given an integer N. Print all strings of length N that are in normal form, in lexicographically ascending order.

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


A='abcdefghijklmnopqrstuvwxyz'

def dfs(s,mx):
    if len(s)==n:
        print(s)
    else:
        for c in range(mx):
            if c==mx-1:
                dfs(s+A[c],mx+1)
            else:
                dfs(s+A[c],mx)



print(dfs('',1))

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


A='abcdefghijklmnopqrstuvwxyz'
P=['a']
X=[[] for _ in range(n)]
X[0].append('a')
for i in range(n-1):
    P.append(A[i+1])
    for j in range(len(X[i])):
        flag=False
        for k in range(len(P)):
            X[i+1].append(X[i][j]+P[k])
            if not P[k] in X[i][j]:
                flag=True
            if flag:
                break
Y=X[n-1]
for i in range(len(Y)):
    print(Y[i])
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):
N=list(map(int,input()))
print(9 in N)

Fixed, accepted submission:
print(["No","Yes"]["9"in input()])
Problem:
In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N.  There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i.  Cat Snuke is on Island 1 now, and wants to go to Island N. However, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.  Help him.

Incorrect submission (verdict: Wrong Answer):
n,m = map(int,input().split())
matrix = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    matrix[a].append(b)
    matrix[b].append(a)
for i in matrix[0]:
    for j in matrix[n-1]:
        if i == j:
            print('possible')
            exit()
print('impossible')

Fixed, accepted submission:
n,m = map(int,input().split())
Check1 = [False]*n
Check2 = [False]*n
for i in range(m):
    a,b = map(int,input().split())
    if a ==1:
        Check1[b-1] = True
    elif a == n:
        Check2[b-1] = True
    elif b == 1:
        Check1[a-1] = True
    elif b == n:
        Check2[a-1] = True
for i in range(n):
    if Check1[i] and Check2[i]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
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,_ = map(int,input().split())
l = sorted(input() for _ in range(n))
print(l)

Fixed, accepted submission:
n,_ = map(int,input().split())
print(''.join(sorted(input() for _ in range(n))))
Problem:
There is a hotel with the following accommodation fee:    * X yen (the currency of Japan) per night, for the first K nights   * Y yen per night, for the (K+1)-th and subsequent nights  Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee.

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

print(b * d + (a-b)*c)

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

if a < b:
  print(a * c)
else:
  print((a-b) * d + b * c)
Problem:
You are playing the following game with Joisino.    * Initially, you have a blank sheet of paper.   * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.   * Then, you are asked a question: How many numbers are written on the sheet now?  The numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?

Incorrect submission (verdict: Wrong Answer):
n=int(input())
a = [input() for _ in range(n)]
a.sort()
count = 0
i=0
while i<n-1:
  j=i+1
  ex=1
  while j<n:
    if a[j]==a[i]:
      ex=1-ex
      j+=1
    else:
      i=j+1
      count+=ex
      break
print(count+1)

Fixed, accepted submission:
from collections import Counter

n=int(input())
a = [input() for _ in range(n)]
c = Counter(a)
count = 0
for i in c.keys():
  count += c[i]%2
print(count)