Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
S=list(map(int,input().split()))
q=int(input())
T=list(map(int,input().split()))



def search(s,T):
    left = 0 ; right = len(T)-1
    while left <= right:
        mid = (left + right)//2
        if T[mid]==s: return True
        elif T[mid]>s: right = mid
        else: left = mid+1

count = 0
for s in S:
    if search(s,T): count+=1


print(count)

Fixed submission:

n=int(input())
s=map(int,input().split())
q=int(input())
t=map(int,input().split())

ans=len(set(s)&set(t))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
R = [0]*n

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

maximum_profit = -10**9
for i in range(1, n):
    profit = max(R[i:n]) - min(R[0:i])
    maximum_profit = profit if profit > maximum_profit else maximum_profit

print(maximum_profit)

Fixed submission:
n = int(input())
maximum_profit = -10**9

r0 = int(input())
r_min = r0
for i in range(1, n):
    r1 = int(input())
    r_min = min(r0, r_min)
    maximum_profit = max(maximum_profit, r1 - r_min)
    r0 = r1
print(maximum_profit)
Buggy python submission (verdict: Runtime Error):
import sys
print(sys.argv[0]**3)

Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
    a, b = int(line.split())
    if(a <= b)
        print(a,b)
    else
        print(b,a)

Fixed submission:

while True:
    a, b = input().split()
    a = int(a)
    b = int(b)

    if (a == 0) & (b == 0):
        break
    if a <= b:
        print(a, b)
    else:
        print(b, a)
Buggy python submission (verdict: Runtime Error):
r, c = input().split()
r = int(r)
c = int(c)

a = [0]*c

for i in range(r):
    a[i] = list(map(int, input().split()))
    a[i].append(sum(a[i]))
    print(*a[i])

b = list(zip(*a))
print(*[sum(b[i]) for i in range(len(b))])

Fixed submission:
r, c = input().split()
r = int(r)
c = int(c)

a = [0]*r

for i in range(r):
    a[i] = list(map(int, input().split()))
    a[i].append(sum(a[i]))
    print(*a[i])
print(*list(map(sum, zip(*a))))
Buggy python submission (verdict: Runtime Error):
import sys
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    sys.stdout.write("{0} : {1}\n".format(i, text.count(i)))

Fixed submission:
text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))

Buggy python submission (verdict: Runtime Error):
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    sys.stdout.write("{0} : {1}\n".format(i, text.count(i)))

Fixed submission:
text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))

Buggy python submission (verdict: Runtime Error):
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    print("{0} : {1}\n".format(i, text.count(i)))

Fixed submission:
text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))

Buggy python submission (verdict: Runtime Error):
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    print("{0} : {1}".format(i, text.count(i)))

Fixed submission:
text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))

Buggy python submission (verdict: Runtime Error):
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))

Fixed submission:
text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))
Buggy python submission (verdict: Runtime Error):
s1 = input()
s2 = input()

if s2 in s1+s1:
    print("Yes")
else
    print("No")

Fixed submission:
s1 = input()
s2 = input()

if s2 in s1+s1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
R = [(int(input()), i) for i in range(int(input()))]
print(max([max(y-x for y, j in R[i+1:]) for x, i in R[:-1]]))

Fixed submission:
R = [int(input()) for i in range(int(input()))]
maxp = R[1] - R[0]
minv = R[0]
for r in R[1:]:
    maxp = max(maxp, r-minv)
    minv = min(minv, r)
print(maxp)
Buggy python submission (verdict: Runtime Error):
x, y = [int(i) for i in input().split()]

if x < y:
    a = x
    x = y
    y = a

for i in range(int(x%y/2)):
    if (x%y)% (i+1) == 0 and y%(i+1) == 0:
        kouyakusu = i+1

print(kouyakusu)

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

if x < y:
    a = x
    x = y
    y = a

def kouyakusu(x,y):
    yakusu = x % y
    if yakusu == 0:
        print(y)
        return y
    else:
        kouyakusu(y,yakusu)

max_kouyakusu = kouyakusu(x,y)

Buggy python submission (verdict: Time Limit Exceeded):
x, y = [int(i) for i in input().split()]

if x < y:
    a = x
    x = y
    y = a
if x == y :
    kouyakusu = x

for i in range(int(x%y/2)):
    if (x%y)% (i+1) == 0 and y%(i+1) == 0:
        kouyakusu = i+1

print(kouyakusu)

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

if x < y:
    a = x
    x = y
    y = a

def kouyakusu(x,y):
    yakusu = x % y
    if yakusu == 0:
        print(y)
        return y
    else:
        kouyakusu(y,yakusu)

max_kouyakusu = kouyakusu(x,y)

Buggy python submission (verdict: Time Limit Exceeded):
x, y = [int(i) for i in input().split()]

if x < y:
    a = x
    x = y
    y = a
if x == y :
    kouyakusu = x

for i in range(int(x%y/2)):
    if (x%y)% (i+1) == 0 and y%(i+1) == 0:
        kouyakusu = i+1

print(kouyakusu)

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

if x < y:
    a = x
    x = y
    y = a

def kouyakusu(x,y):
    yakusu = x % y
    if yakusu == 0:
        print(y)
        return y
    else:
        kouyakusu(y,yakusu)

max_kouyakusu = kouyakusu(x,y)

Buggy python submission (verdict: Time Limit Exceeded):
x, y = [int(i) for i in input().split()]

if x < y:
    a = x
    x = y
    y = a
if x == y :
    kouyakusu = x

i = 0
while i < int(x%y):
    if (x%y)% (((x%y))-i) == 0 and y%(((x%y))-i) == 0:
        kouyakusu = int((x%y) - i)
        break
    i = i + 1

print(kouyakusu)

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

if x < y:
    a = x
    x = y
    y = a

def kouyakusu(x,y):
    yakusu = x % y
    if yakusu == 0:
        print(y)
        return y
    else:
        kouyakusu(y,yakusu)

max_kouyakusu = kouyakusu(x,y)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = 0
for i in range(n):
    x = int(input())
    counter = 0
    for j in range(x):
        if x % (j+1) == 0:
            counter = counter + 1
    if counter == 2:
        c = c + 1

print(c)

Fixed submission:
n = int(input())
c = 0

def devisor(n):
    if n == 2:
        return 1
    else:
        if n < 2 or n % 2 == 0:
            return 0
        elif pow(2,n-1,n) == 1:
            return 1
        else: return 0

for i in range(n):
    x = int(input())
    c += devisor(x)

print(c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = 0

def devisor(n):
    if n == 2:
        return 1
    else:
        if n < 2 or n % 2 == 0:
            return 0
        elif pow(2,n-1,n) == 1:
            return 1

for i in range(n):
    x = int(input())
    c += devisor(x)

print(c)

Fixed submission:
n = int(input())
c = 0

def devisor(n):
    if n == 2:
        return 1
    else:
        if n < 2 or n % 2 == 0:
            return 0
        elif pow(2,n-1,n) == 1:
            return 1
        else: return 0

for i in range(n):
    x = int(input())
    c += devisor(x)

print(c)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print(a,b)
square=int(a)*int(b)
length=int(a)*2+int(b)*2
print(square,length)

Fixed submission:
InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print(a,b)
square=int(a)*int(b)
length=int(a)*2+int(b)*2
print(square,length)

Fixed submission:
InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
square=int(a)*int(b)
length=int(a)*2+int(b)*2
print(square,length)

Fixed submission:
InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
square=int(a)*int(b)
length=int(a)*2+int(b)*2
print(square),
print(length)

Fixed submission:
InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
square=int(a)*int(b)
length=int(a)*2+int(b)*2
#print(square),
#print(length)
print(square,length)

Fixed submission:
InputNum = input().split()
tate = int(InputNum[0])
yoko = int(InputNum[1])
square = tate * yoko
length = 2* (tate + yoko)
print(square,length)
Buggy python submission (verdict: Runtime Error):
inputlist = int(input().split())

a = inputlist[0]
b = inputlist[1]

if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')

Fixed submission:
a, b = [int(i) for i in input().split()]
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')
Buggy python submission (verdict: Runtime Error):
i = 1
while i > 0:
    x = input()
    print("Case",i,end="")
    print(":",x)
    if x == 0:
        break

Fixed submission:
i = 1
while True:
    x = input()
    if x == "0":
        break
    print("Case",i,end="")
    print(":",x)
    i +=1
Buggy python submission (verdict: Runtime Error):
import math

r = int(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.5f}'.format(S),'{0:.5f}'.format(L))

Fixed submission:
import math

r = float(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.6f}'.format(S),'{0:.6f}'.format(L))

Buggy python submission (verdict: Runtime Error):
import math

r = int(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.6f}'.format(S),'{0:.6f}'.format(L))

Fixed submission:
import math

r = float(input())
S = r * r * math.pi
L = 2 * r * math.pi

print('{0:.6f}'.format(S),'{0:.6f}'.format(L))
Buggy python submission (verdict: Runtime Error):
while True:
    x = list(input())
    if x == "0":
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)

Fixed submission:
while True:
    x = list(input())
    if x[0] == "0":
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)
    #print(x)

Buggy python submission (verdict: Runtime Error):
while True:
    x = list(input())
    if x == 0:
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)

Fixed submission:
while True:
    x = list(input())
    if x[0] == "0":
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)
    #print(x)
Buggy python submission (verdict: Runtime Error):
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print("".join(lis))

        
if __name__ == "__main__":
    leng=int(input())
    lis=map(int,input().split())
    insertionSort(lis,leng)

Fixed submission:
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print(*lis)

        
if __name__ == "__main__":
    lengg=int(input())
    liss=list(map(int, input().split()))
    insertionSort(liss,lengg)

Buggy python submission (verdict: Runtime Error):
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print("".join(lis))

        
if __name__ == "__main__":
    leng=int(input())
    lis=map(int,input().split())
    insertionSort(lis,leng)

Fixed submission:
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print(*lis)

        
if __name__ == "__main__":
    lengg=int(input())
    liss=list(map(int, input().split()))
    insertionSort(liss,lengg)

Buggy python submission (verdict: Runtime Error):
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print("".join(lis))

        
if __name__ == "__main__":
    lengg=int(input())
    liss=map(int,input().split())
    insertionSort(liss,lengg)

Fixed submission:
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print(*lis)

        
if __name__ == "__main__":
    lengg=int(input())
    liss=list(map(int, input().split()))
    insertionSort(liss,lengg)

Buggy python submission (verdict: Runtime Error):
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print("".join(lis))

        
if __name__ == "__main__":
    lengg=int(input())
    liss=list(map(int,input().split()))
    insertionSort(liss,lengg)

Fixed submission:
def insertionSort(lis,leng):
    for i in range(leng):
        v = lis[i]
        j = i - 1
        while j >= 0 and lis[j] > v:
            lis[j+1] = lis[j]
            j = j-1
        lis[j+1]=v
        print(*lis)

        
if __name__ == "__main__":
    lengg=int(input())
    liss=list(map(int, input().split()))
    insertionSort(liss,lengg)
Buggy python submission (verdict: Runtime Error):
print(x**3)

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
x**3

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
print(x**3)

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
x**3

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
x*x*x

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
if __name__="__main__":
 print(x**3)

Fixed submission:
x=int(input())
print(x**3)
Buggy python submission (verdict: Runtime Error):
a=(input())
b=float(input())
print(a*b,2*(a+b))

Fixed submission:
a,b=list(map(int,input().split()))
print(str(a*b) + " " + str(2*a+2*b))

Buggy python submission (verdict: Runtime Error):
a=(input())
b=float(input())
print(a*b 2*(a+b))

Fixed submission:
a,b=list(map(int,input().split()))
print(str(a*b) + " " + str(2*a+2*b))

Buggy python submission (verdict: Runtime Error):
a=(input())
b=float(input())
print(a*b)
print(2*(a+b))

Fixed submission:
a,b=list(map(int,input().split()))
print(str(a*b) + " " + str(2*a+2*b))
Buggy python submission (verdict: Runtime Error):
lis=[]
while True:
  if input()=="0":
    break
  else:
    lis.append(input())

for i in range(len(lis)):
  print("Case %i: %i" % (i,lis[i]))

Fixed submission:
lis=[]
while True:
  d=input()
  if d=="0":
    break
  else:
    lis.append(int(d))

for i in range(len(lis)):
  print("Case %i: %i" % (i+1,lis[i]))
Buggy python submission (verdict: Runtime Error):
n,m,l = map(int,raw_input().split())
a = [map(int,raw_input().split()) for _ in range(n)]
b = [map(int,raw_input().split()) for _ in range(m)]
c = [[0 for i in range(n)] for j in range(l)]

for i in range(n):
    for j in range(l):
        s = 0
        for k in range(m):
            s += a[i][k] * b[k][j]
        c[i][j] = s

for i in range(n):
    print ' '.join(map(str,c[i]))

Fixed submission:
n,m,l = map(int,raw_input().split())
a = [map(int,raw_input().split()) for _ in range(n)]
b = [map(int,raw_input().split()) for _ in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    for j in range(l):
        s = 0
        for k in range(m):
            s += a[i][k] * b[k][j]
        c[i][j] = s

for i in range(n):
    print ' '.join(map(str,c[i]))
Buggy python submission (verdict: Runtime Error):
a = raw_input()
d = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    d[i] = 0
for i in a:
    d[i] += 1
for i in "abcdefghijklmnopqrstuvwxyz":
    print i,':',d[i]

Fixed submission:
import sys

a = []
for line in sys.stdin:
    a.append(str(line))
a = ''.join(a).lower()

d = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    d[i] = 0
for i in a:
    if i in "abcdefghijklmnopqrstuvwxyz":
        d[i] += 1
for i in "abcdefghijklmnopqrstuvwxyz":
    print i,':',d[i]
Buggy python submission (verdict: Runtime Error):
a = raw_input().lower()
s = 0
while True:
    b = raw_input().lower()
    if b == 'END_OF_TEXT':
        break
    s += b.count(a)
print s

Fixed submission:
a = raw_input().lower()
s = 0
while True:
    b = raw_input()
    if b == 'END_OF_TEXT':
        break
    b = b.split()
    b = map(str.lower,b)
    s += b.count(a)
print s
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

R = []

for i in range(0,n):
    R.insert(i,int(input()))

MAX = R[1] - R[0]
for r in range(2,n):
    if(MAX < R[r] - min(R[:r])):
        MAX = R[r] - min(R[:r])
print(MAX)

Fixed submission:
n = int(input())

R = []

for i in range(0,n):
    R.insert(i, int(input()))

maxV = -2000000000  # ????°??????????????????????????¨????????????????
minV = R[0]

for r in range(1, n):
    maxV = max(maxV, R[r] - minV)
    minV = min(minV, R[r])

print(maxV)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

R = []

for i in range(0,n):
    R.insert(i,int(input()))

MAX = R[1] - R[0]
for r in range(2,n):
    o = R[r] - min(R[:r])
    if(MAX < o):
        MAX = o
print(MAX)

Fixed submission:
n = int(input())

R = []

for i in range(0,n):
    R.insert(i, int(input()))

maxV = -2000000000  # ????°??????????????????????????¨????????????????
minV = R[0]

for r in range(1, n):
    maxV = max(maxV, R[r] - minV)
    minV = min(minV, R[r])

print(maxV)
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = (int(n) for n in input().split())

flag = 1
num_c  = 0
while(flag):
    flag = 0
    for j in range(1, N):
        if A[j] < A[j-1]:
            v = A[j]
            A[j] = A[j-1]
            A[j-1] = v
            num_c += 1
            flag = 1
print((" ").join((str(a) for a in A)))
print(num_c)

Fixed submission:
N = int(input())

A = [int(n) for n in input().split()]

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

print((" ").join((str(a) for a in A)))
print(num_c)
Buggy python submission (verdict: Runtime Error):
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
    minj = i
    for j in (i, N):
        if A[j] < A[minj]:
            minj = j
    A[i], A[minj] = A[minj], A[j]
    num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Fixed submission:
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if(i != minj):
        A[i], A[minj] = A[minj], A[i]
        num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
    minj = i
    for j in (i, N):
        if A[j] < A[minj]:
            minj = j
    A[i], A[minj] = A[minj], A[j]
    num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Fixed submission:
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if(i != minj):
        A[i], A[minj] = A[minj], A[i]
        num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
    minj = i
    for j in (i, N):
        if A[j] < A[minj]:
            minj = j
    A[i], A[minj] = A[minj], A[i]
    num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)

Fixed submission:
N = int(input())

A = [int(x) for x in input().split()]
num_c = 0
for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if(i != minj):
        A[i], A[minj] = A[minj], A[i]
        num_c += 1

print((" ").join(str(x) for x in A))
print(num_c)
Buggy python submission (verdict: Runtime Error):
N = int(input())

C = input().split()

B = C[:]
S = C[:]

# bubble sort
flag = 1
while(flag):
    flag = 0
    for x in (1, N):
        if C[x][1:] < C[x-1][1:]:
            C[x], C[x-1] = C[x-1], C[x]
            flag = 1

# sectionSot
for x in range(0,N):
    minj = x
    for j in (x,n):
        if S[j][1:] < S[minj][1:]:
            minj = j
    if minj != x:
        S[x], S[j] = S[j], S[x]

for i in range(1, N):
    v = C[i]
    j = i - 1
    while(j >=0 and C[j] > v):
        C[j+1] = C[j]
        j -= 1
    C[j+1] = v

if(C == B):
    print(" ".join(b for b in B))
    print("Stable")
else:
    print(" ".join(b for b in B))
    print("Not stable")


if(C == S):
    print(" ".join(b for b in S))
    print("Stable")
else:
    print(" ".join(b for b in S))
    print("Not stable")

Fixed submission:
N = int(input())

C = input().split()

B = C[:]
S = C[:]

# bubble sort
flag = 1
while(flag):
    flag = 0
    for x in range(1, N):
        if B[x][1:] < B[x-1][1:]:
            B[x], B[x-1] = B[x-1], B[x]
            flag = 1

# sectionSot
for x in range(0,N):
    minj = x
    for j in range(x,N):
        if S[j][1:] < S[minj][1:]:
            minj = j
    if minj != x:
        S[x], S[minj] = S[minj], S[x]



print(" ".join(b for b in B))
print("Stable")


if(B == S):
    print(" ".join(b for b in S))
    print("Stable")
else:
    print(" ".join(b for b in S))
    print("Not stable")