TnT/CodeNet4Repair huggingface dataset:
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
x = list(map(int,input()))
for i in range(2**3):
  ans = x[0]
  list = []
  for j in range(3):
    if (i >> j) & 1:
      ans += x[j+1]
      list.append("+")
    else:
      ans -= x[j+1]
      list.append("-")
  if ans == 7:
    print(x[0],list[0],x[1],list[1],x[2],list[2],x[3])
    exit()

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




for i in range(2**3):
  ans = int(X[0])
  list = []
  for j in range(3):
    if (i>>j & 1) == 1:
      ans += int(X[j+1])
      list.append("+")
    else:
      ans -= int(X[j+1])
      list.append("-")
  if ans == 7:
    break

ans = X[0]
for i in range(3):
  ans += list[i]
  ans += X[i+1]
print(ans+"=7")
Problem:
You are parking at a parking lot. You can choose from the following two fee plans:    * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.   * Plan 2: The fee will be B yen, regardless of the duration.  Find the minimum fee when you park for N hours.

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

Fixed, accepted submission:
n,a,b = map(int, input().split())
print(min(n*a,b))
Problem:
    祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。  祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう？」と答えました。  左の皿に載せる品物の重さを与えるので、天秤で与えられた重みの品物と釣合わせるときに、右の皿に載せる分銅を軽い順に出力するプログラムを作成して下さい。ただし、量るべき品物の重さは、すべての分銅の重さの合計 (=1023g) 以下とします。

Incorrect submission (verdict: Wrong Answer):
w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
w.reverse()

def weight(x):
    res = []
    for i in range(len(w)):
        if w[i] <= x:
           res.append(i)
           x = x-w[i]
    return res

x = int(input())
res = weight(x)
res.reverse()
print(w[res[0]],end = '')
for i in range(1,len(res)):
    print(' ',w[res[i]],sep = '',end = '')
print('')

Fixed, accepted submission:
w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
w.reverse()
def weight(x):
    res = []
    for i in range(len(w)):
        if w[i] <= x:
           res.append(i)
           x = x-w[i]
    return res
while True:
    try:
        x = int(input())
        res = weight(x)
        res.reverse()
        print(w[res[0]],end = '')
        for i in range(1,len(res)):
            print(' ',w[res[i]],sep = '',end = '')
        print('')
    except EOFError:
        break
Problem:
Snuke has N sticks. The length of the i-th stick is l_i.  Snuke is making a snake toy by joining K of the sticks together.  The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy.

Incorrect submission (verdict: Wrong Answer):
N,K = map(int,input().split(' '))
L = sorted(map(int,input().split(' ')))
print(L[:-K])

Fixed, accepted submission:
N,K = map(int,input().split(' '))
L = sorted(map(int,input().split(' ')))
print(sum(L[N-K:]))
Problem:
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b.  Determine whether the arrangement of the poles is beautiful.

Incorrect submission (verdict: Wrong Answer):
a,b,c=map(int,input().split());print('YNEOS'[b-a!=c-a::2])

Fixed, accepted submission:
a,b,c=map(int,input().split())
print('YNEOS'[a+c!=b+b::2])
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))

Fixed, accepted submission:
a,b = map(int,input().split())
print(-(-(a+b)//2))
Problem:
Write a program which solve a simultaneous equation:      ax + by = c   dx + ey = f      The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.

Incorrect submission (verdict: Wrong Answer):
print("hello")


Fixed, accepted submission:
while True:
    try:
        a, b, c, d, e, f = map(int, input().split())
    except:
        break
    y = (c*d-f*a) / (b*d-e*a)
    x = (c - b*y) / a
    print("{:.3f} {:.3f}".format(x, y))
Problem:
You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.  Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .

Incorrect submission (verdict: Wrong Answer):
print(input())


Fixed, accepted submission:

n = int(input())

r_list = [int(input()) for i in range(n)]
score = -2000000000000000000000
minv = r_list[0]

for r in r_list[1:]:
    score = max(score, r - minv) 
    minv = min(minv, r)        
print(score)
Problem:
AtCoder Mart sells 1000000 of each of the six items below:    * Riceballs, priced at 100 yen (the currency of Japan) each   * Sandwiches, priced at 101 yen each   * Cookies, priced at 102 yen each   * Cakes, priced at 103 yen each   * Candies, priced at 104 yen each   * Computers, priced at 105 yen each  Takahashi wants to buy some of them that cost exactly X yen in total. Determine whether this is possible.   (Ignore consumption tax.)

Incorrect submission (verdict: Wrong Answer):
X = int(input())
if 0 <= X%100 <= 5*(X//100):
    print("Yes")
else:
    print("No")


Fixed, accepted submission:
X = int(input())
if 0 <= X%100 <= 5*(X//100):
    print(1)
else:
    print(0)
Problem:
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.

Incorrect submission (verdict: Wrong Answer):
import sys
a,b=map(str,input().split())
s=int(a+b)
print(s)
for i in range(1100):
    if s==i**2:
        print("Yes")
        sys.exit()
print("No")

Fixed, accepted submission:
import sys
a,b=map(str,input().split())
s=int(a+b)
#print(s)
for i in range(1100):
    if s==i**2:
        print("Yes")
        sys.exit()
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):
def is_haiku(s):
    nums = s.split()
    counts = {x: nums.count(x) for x in nums}
    try:
        if counts['5'] == 2 and counts['7'] == 1:
            print("YES")
    finally:
        print("NO")

if __name__ == "__main__":
    is_haiku(input())

Fixed, accepted submission:
def is_haiku(s):
    nums = s.split()
    counts = {x: nums.count(x) for x in nums}
    try:
        if counts['5'] == 2 and counts['7'] == 1:
            print("YES")
        else:
            print("NO")
    except:
        print("NO")

if __name__ == "__main__":
    is_haiku(input())
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 = list(map(int,input().split()))

A.sort(reverse=True)
print(A)
print((sum(A[::2])) - sum(A[1::2]))

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

a.sort(reverse=True)
alice = 0
bob = 0
for i in range(n):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]

print(alice-bob)
Problem:
A group of people played a game. All players had distinct scores, which are positive integers.  Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.  Find the maximum possible number of players in the game.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
AB=[tuple(map(int, input().split()))for _ in range(N)]
a, b = max(AB, key=lambda ab:ab[1])
print(a+b)

Fixed, accepted submission:
N=int(input())
print(sum(max(tuple(map(int, input().split()))for _ in range(N))))
Problem:
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.

Incorrect submission (verdict: Wrong Answer):
def even(a, b):
    if a*b % 2 == 0:
        print('Even')
    else:
        print('Odd')


Fixed, accepted submission:
a, b = map(int, input().split())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')
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):
if sorted(input()) == 'abc':print('Yes')
else:print('No')

Fixed, accepted submission:
a=sorted(input())
abc='abc'
count=0
for i in range(3):
  if a[i]==abc[i]:
    count+=1
if count == 3:print('Yes')
else:print('No')
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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    sp = list(input().strip())
    for i, c in enumerate(sp):
        print(c.upper() if i == 0 or sp[i-1] == ' ' else c, end="")
    print()

main()


Fixed, accepted submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    sp = list(input().strip())
    s = ''
    for i, c in enumerate(sp):
        if i == 0 or sp[i-1] == ' ':
            s += c.upper()
    print(s)

main()
Problem:
When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.  You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.  Find B_i for each i = 1, 2, ..., N.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
if n==4:
  exit()
l=list(map(int,input().split()))
sl=l[:]
sl.sort()
a=sl[n//2-1]
b=sl[n//2]
for i in l:
  if i<=a:
    print(b)
  else:
    print(a)

Fixed, accepted submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

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

def main():
  n=I()
  l=LI()

  _l=sorted(l)

  if n%2==0:
    a=_l[n//2-1]
    b=_l[n//2]

    for x in l:
      if x<=a:
        print(b)
      else:
        print(a)

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())

result = 1
bt=0
bx=0
by= 0

for i in range(N):
	t, x, y = map(int, input().split())
	distance = abs(x-bx) + abs(y-by)
	dur = t - bt

	if dur - distance > 0 and (dur - distance) %2 == 0:
		(bt,bx,by) = (t,x,y)
		continue
	else:
		result = 0
		break

if result:
	print("Yes")
else:
	print("No")



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

result = 1
bt=0
bx=0
by= 0

for i in range(N):
	t, x, y = map(int, input().split())
	distance = abs(x-bx) + abs(y-by)
	dur = t - bt

	if dur - distance >= 0 and (dur - distance) %2 == 0:
		(bt,bx,by) = (t,x,y)
		continue
	else:
		result = 0
		break

if result:
	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())
ans = N % 1000
print(ans)

Fixed, accepted submission:
N = int(input())
ans = N % 1000
if ans == 0:
  print(0)
else:
  print(1000-ans)
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
def main():
	s = input()
	ans = ''
	ans = solve(s[0], s[1:])
	print(ans)

def solve(left, right):
	if len(right) == 0:
		if eval(left) == 7:
			print(left)
			exit()
	else:
		solve(left + '-' + right[0], right[1:])
		solve(left + '+' + right[0], right[1:])

if __name__ == '__main__':
	main()

Fixed, accepted submission:
import sys
def solve(l, r):
	if r == "":
		if eval(l) == 7:
			print(l + "=7")
			sys.exit()
	else:
		solve(l + "+" + r[0], r[1:])
		solve(l + "-" + r[0], r[1:])

s = input()
solve(s[0], s[1:])
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):
N=int(input())
number=list(map(int,input().split()))
SUM=sum(number)
number_sum=[0]*N

for i in range(N):
  number_sum[i]=sum(number[0:i])*2-SUM

print(abs(max(number_sum)))

Fixed, accepted submission:
N=int(input())
number=list(map(int,input().split()))
Sum=sum(number)
number_sum=[0]*N
number_sum[0]=number[0]
result=[0]*(N-1)
for i in range(1,N):
  number_sum[i]=number_sum[i-1]+number[i]
result[0]=abs(number_sum[0]*2-Sum)
for i in range(1,N-1):
  result[i]=abs(((number_sum[i])*2-Sum))

print(min(result))
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
A, B, X = map(int, input().split())
print('Yes' if A <= X  and X - A <= B else 'No')

Fixed, accepted submission:
A, B, X = map(int, input().split())
print('YES' if A <= X  and X - A <= B else 'NO')
Problem:
There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.  Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.    * A Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.   * An overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.  A string S is assigned indicating attributes of all participants. If the i-th character of string S is `a`, this means the participant ranked i-th in the Qualification contests is a Japanese student; `b` means the participant ranked i-th is an overseas student; and `c` means the participant ranked i-th is neither of these.  Write a program that outputs for all the participants in descending rank either `Yes` if they passed the Qualification contests or `No` if they did not pass.

Incorrect submission (verdict: Wrong Answer):
from sys import stdin
from math import ceil, floor
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
s = list(stdin.readline().rstrip())
c = a + b
d = 0
e = 0
for i in range(n):
    if d < c and s[i] == "a":
        print("YES")
        d += 1
    elif d < c and e < b and s[i] == "b":
        print("YES")
        d += 1
        e += 1
    else:
        print("NO")

Fixed, accepted submission:
from sys import stdin
from math import ceil, floor
n,a,b=[int(x) for x in stdin.readline().rstrip().split()]
s=list(stdin.readline().rstrip())
c=a+b
d=e=m=0
for i in range(n):
    if d<c and s[i]=="a":
        print("Yes")
        d+=1
    elif d<c and e<b and s[i]=="b":
        print("Yes")
        d+=1
        e+=1
    else:
        print("No")
    if d>=c:
        m=i+1
        break
if m != 0:
    for i in range(n-m):
        print("No")
Problem:
In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi:    * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.  Find the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.

Incorrect submission (verdict: Wrong Answer):
A, B, K = map(int, input().split(' '))

for i in range(K):
  if i % 2 == 0:
    a = b = 0
    if A % 2 == 1:
      A -= 1
    a = A // 2
    A -= a
    B += a

  else:
    if B % 2 == 1:
      B -= 1
    b = B // 2
    B -= b
    A += b

print(A, B)
print(A, B)

Fixed, accepted submission:
A, B, K = map(int, input().split(' '))

for i in range(K):
  if i % 2 == 0:
    a = b = 0
    if A % 2 == 1:
      A -= 1
    a = A // 2
    A -= a
    B += a

  else:
    if B % 2 == 1:
      B -= 1
    b = B // 2
    B -= b
    A += b

print(A, B)
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):
# -*- coding: utf-8 -*-

t = [int(i) for i in input().split()]
t.sort()

if(t[2] == t[1] + t[0] ):
    print("YES")
else:
    print("NO")


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

t = [int(i) for i in input().split()]
t.sort()

if(t[2] == t[1] + t[0] ):
    print("Yes")
else:
    print("No")
Problem:
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Incorrect submission (verdict: Wrong Answer):
m=int(input())
print(m+24)

Fixed, accepted submission:
m=int(input())
print((24-m)+24)
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 collections
a = input()
N = int(a)
S = [input() for i in range(N)]

c = collections.Counter(S)

print('AC × %d' % c['AC'])
print('WA × %d' % c['WA'])
print('TLE × %d' % c['TLE'])
print('RE × %d' % c['RE'])

Fixed, accepted submission:
import collections
a = input()
N = int(a)
S = [input() for i in range(N)]

c = collections.Counter(S)

print('AC x %d' % c['AC'])
print('WA x %d' % c['WA'])
print('TLE x %d' % c['TLE'])
print('RE x %d' % c['RE'])
Problem:
AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.  Since he is forgetful, he might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him.

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

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

if a==b==c:
  print(1)
elif a==b or b==c or a==c:
  print(2)
else:
  print(3)
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: Time Limit Exceeded):
x,y = map(int,input().split())
list = [input() for i in range(x)]
left = 0
right = x-1
for i in range(x):
    right = x-1
    while left < right:
        if list[right]<list[right-1]:
            escape = list[right]
            list[right] = list[right-1]
            list[right-1] = escape
        right-1
    left += 1
answer = ""
for lis in list:
    answer += lis
print(answer)


Fixed, accepted submission:
num,long = map(int,input().split())
lines = [input() for i in range(num)]
lines.sort()
answer = ""
for line in lines:
    answer += line
print(answer)
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):
import sys
i = 1
for line in sys.stdin:
    print("case %d: %d" % (i, int(line)))
    i += 1

Fixed, accepted submission:
x = int(input())
i = 1
while x != 0:
    print("Case %d: %d" % (i, x))
    i += 1
    x = int(input())
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):
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
 for j in range(n-1,i,-1):
  if a[j-1]>a[j]:a[j-1],a[j]=a[j],a[j-1];c+=1
print(*a)
print(c)


Fixed, accepted submission:
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
 m=a.index(min(a[i:]),i)
 a[i],a[m]=a[m],a[i];c+=i!=m
print(*a)
print(c)