TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
l = list(input().split())

target_num = 1
for i in range(n):
  if target_num == int(l[i]):
    target_num += 1
    print('Good')
  else:
    target_num = target_num
    print('Bad')

if target_num == 1:
  print("-1")
else:
  print(n - target_num +1)


n = int(input())
l = list(input().split())

target_num = 1
for i in range(n):
  if target_num == int(l[i]):
    target_num += 1
  else:
    target_num = target_num

if target_num == 1:
  print("-1")
else:
  print(n - target_num +1)


Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
j = 0
d = 0
c0 = 0
l = sorted(list(set(a)))
for i in l:
    if i == j+1:
        j = i
        if i in a[c0:]:
            for 
            c = a[c0:].index(i)+(n-len(a[c0:]))
        else:break
        if c >= c0:
            d += 1
            c0 = c
        else:break
    else:break
print(n-d if d !=0 else -1)

from collections import deque
n = int(input())
a = list(map(int, input().split()))
a = deque(a)
d = 0
i = 1
for _ in range(n):
    b = a.popleft()
    if i == b:
        d +=1
        i += 1
        
print(n-d if d !=0 else -1)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
an = list(map(int, input().split()))
num = 1
listnum = len(an)
for a in an:
    if a == num:
        an.remove(a)
        num += 1
if listnum == len(an):
    print(-1)
else:
    print(len(an))

n = int(input())
an = list(map(int, input().split()))
num = 1
listnum = len(an)
count = 0
for a in an:
    if a == num:
        count += 1
        num += 1
notnum = len(an) - count
if listnum == notnum:
    print(-1)
else:
    print(notnum)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = I()
a = Intl()
cnt = 0
a = a[::-1]
now = a[0]
#print(now,a)
for i in range(1,n):
    if a[i] >= now:
        cnt += 1
    else if now-1 == a[i]:
        now = a[i]
    else:
        cnt += 1
print(cnt if now == 1 else -1)

import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = I()
a = Intl()
cnt = 0
if not 1 in a:
    print(-1)
    exit()
now = 1
for i in range(n):
    if now == a[i]:
        now += 1
    else:
        cnt += 1
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
a = map(int, input().split())

num = 0
for i in range(N):
  if a[i] == (num + 1):
    num += 1

if num == 0:
  print(-1)
else:
  print(N-num)

N = int(input())
a = [i for i in map(int, input().split())]
     
num = 0
for i in range(N):
  if a[i] == (num + 1):
    num += 1
    
if num == 0:
  print(-1)
else:
  print(N-num)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
# ABC148D - Brick Break

import bisect

n=int(input())
a=list(map(int,input().split()))

ans=0
for i in a:
    if ans+1==i:
        ans=i

print(ans)
if ans:
    print(n-ans)
else:
    print(-1)

# ABC148D - Brick Break

import bisect

n=int(input())
a=list(map(int,input().split()))

ans=0
for i in a:
    if ans+1==i:
        ans=i

#print(ans)
if ans:
    print(n-ans)
else:
    print(-1)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = list(map( int , input().split()))
k = 1
h = 0
if N == 1 and A[0] == 1:
    print(0)
elif A.count(1) == 0:
    print(-1)
else:
    for k in range(1,max(A)):
        if k in A[h:len(A)]:
            #print(A[h:len(A)].index(k),k,h)
            #print(A[h:len(A)])
            h += A[h:len(A)].index(k)
            k+=1
            #print(h)
        else:
            #print(k)
            break
    print(N+1-k)


N = int(input())
A = list(map( int , input().split()))
T = list()
if A.count(1) == 0:
    print(-1)
else:
    for i in range(len(A)):
        if A[i] == len(T)+1:
            T.append(A[i])
    print(N-len(T))

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

x = 1
aa = 0
for i in a:
    if i != x:
        print(i,x)
        aa += 1
    else:
        x += 1
print(aa)

n = int(input())
a = list(map(int, input().split()))

x = 1
for i in a:
    if i == x:
        print(i,x)
        x += 1

print(n-(x-1))

n = int(input())
a = list(map(int, input().split()))

x = 1
for i in a:
    if i == x:
        print(i,x)
        x += 1
if x == 1:
    print(-1)
else:
    print(n-(x-1))

n = int(input())
a = list(map(int, input().split()))

x = 1
b = 0
for i in a:
    if i != x:
        b += 1
    elif i == x:
        x += 1

if x == n:
    print(-1)
else:
    print(b)

n = int(input())
a = list(map(int, input().split()))

x = 1
b = 0
for i in a:
    if i != x:
        b += 1
    elif i == x:
        x += 1

if b == n:
    print(-1)
else:
    print(b)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ans = 0
tmp = 1

for i in range(n):
  if a[i] == tmp:
    tmp += 1
  else:
    ans += 1

if ans = 0:
  print(-1)
else:
  print(ans)

n = int(input())
a = list(map(int, input().split()))
ans = 0
tmp = 1

for i in range(n):
  if a[i] == tmp:
    tmp += 1
  else:
    ans += 1

if ans != 0 and tmp ==1:
  print(-1)
else:
  print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
a = int(input())
n = list(map(int.input().split()))
b = 0
c = 0
flag = 0
for i in n:
    if not int(i) == b+1:
        c +=1
    else:
        b += 1
        flag = 1
if flag == 0:
    c = -1
print(c)

a = int(input())
n = input().split()
b = 0
c = 0
flag = 0
for i in n:
    if not int(i) == b+1:
        c +=1
    else:
        b += 1
        flag = 1
if flag == 0:
    c = -1
print(c)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))

num = 1
ans = 0

if i in range(n):
  if num == a[i]:
    num += 1

if num == 1:
  ans = -1
else:
  ans = n - num + 1

print(ans)

n = int(input())
a = list(map(int,input().split()))
count = -1
num = 0
l = 0

for i in range(n):
  num = i + 1
  for s in range(l,n):
    print(l)
    print(s)
    if num == a[s]:
      l = s + 1
      print('break')
      if count == -1:
        count = 0
      break
    else:
      print('count')
      count = count + 1

print(count)

n = int(input())
a = list(map(int,input().split()))
 
num = 1
ans = 0
 
for i in range(n):
  if num == a[i]:
    num += 1
 
if num == 1:
  ans = -1
else:
  ans = n - num + 1
 
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
num = 1
 
if 1 not in a :
    print(-1)
else :
    for i in range(1, n):
        if num in a :
            a = a[a.index(i):]
            num += 1
    print(num - 1)



n = int(input())
a = list(map(int,input().split()))
num = 1
 
if 1 not in a :
    print(-1)
else :
    for i in range(1, n):
        if num in a :
            a = a[a.index(i):]
            num += 1
    print(num - 1)



n = int(input())
a = list(map(int,input().split()))
num = 1
 
for i in range(n):
    if num == a[i] :
        num += 1

if num == 1 :
    print(-1)
else :
    print(n - num + 1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))

i = 1
j = 0

if not 1 in set(a):
    print(-1)

while i in a[j:]:
    j = a[j:].index(i) + j
    print(i, j)
    i += 1
    if j >= N:
        break

N = int(input())
a = list(map(int, input().split()))

i = 1
# j = 0

if 1 in set(a):
    # while j < N and i in set(a[j:]):
    
    #     # print(i, j)
    
    for a_i in a:
        if a_i == i:
            i += 1
    print(N - i + 1)
else:
    print(-1)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):

N = int(input())
a = list(map(int, input().split(" ")))

t = 1
for x in a:
    if x == t:
        t += 1
t -= 1

if t == 0:
    print(-1)
else:
    print(M-t)




N = int(input())
a = list(map(int, input().split(" ")))

t = 1
for x in a:
    if x == t:
        t += 1
t -= 1

if t == 0:
    print(-1)
else:
    print(N-t)



Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
A = input()
count = 0
split = [int(i) for i in A.split(" ")]

for i in range(N):
    if split[i] == 1:
        count +=1
        break
if count != 0:
    for i in range(N):
        i -= count
        if i + 1 != split[i]:
            del split[i]
            count += 1
    print(count)
else:
    print(-1)

N = int(input())
A = list(map(int,input().split()))
count = 0
num = 1

for i in range(N):
    if A[i] == num:
        num += 1
    else:
        count += 1

if count == N:
    print(-1)
else:
    print(count)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))
c = []
i=1
for k in range(N): 
    if a[k]==i:
        i += 1
    else:
        c.append(a[k])
if len(c)>= len(a):
    print(-1)
else:
    print(len(a)-len(c))

N = int(input())
a = list(map(int, input().split()))
c = []
i=1
for k in range(N): 
    if a[k]==i:
        i += 1
    else:
        c.append(a[k])
if len(c)>= len(a):
    print(-1)
else:
    if len(a)==1 and a[0]==1:
        print(0)
    else:
        print(len(a)-len(c))

N = int(input())
a = list(map(int, input().split()))
c = []
i=1
for k in range(N): 
    if a[k]==i:
        i += 1
    else:
        c.append(a[k])
if len(c)>=len(a):
    print(-1)
else:
    print(len(c))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N=int(input())
a = list(map(int,input().split()))

j=1
ans=0
tmp=0
for i in range(0,N):
  if a[i]==j:
    ans += i-tmp
    tmp = i+1
    j += 1
print(i,j,ans,tmp)

if ans==0 and tmp==N:
  print(ans)
elif ans==0 and j==1:
  print(-1)
elif N>tmp:
  print(ans+(N-tmp))
else:
  print(ans)

N=int(input())
a = list(map(int,input().split()))

j=1
ans=0
tmp=0
for i in range(0,N):
  if a[i]==j:
    ans += i-tmp
    tmp = i+1
    j += 1
#print(i,j,ans,tmp)

if ans==0 and tmp==N:
  print(ans)
elif ans==0 and j==1:
  print(-1)
elif N>tmp:
  print(ans+(N-tmp))
else:
  print(ans)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n=int(input())
a=[0]*n
def int1(x):
  return int(x)-1
a[:]=map(int1,input().split())
#print(a)
import numpy as np
l=np.argsort(a)
#print(l)
del a[0:l[0]]
r=0
z=0
m=len(a)
j0=0
for ii in range(max(a)):
  for jj in np.arange(j0,m):
    if a[jj]==ii:
      j0=jj+1
      r+=1
      break
    #print(a,r)
  if jj==m-1:
    #print(a)
    if r==0:
      print(-1)
    else:
      print(n-r)
    exit()
print(n-r)

n=int(input())
a=[0]*n
def int1(x):
  return int(x)-1
a[:]=map(int1,input().split())

r=0
#j0=0
#import numpy as np
ii=0
for jj in range(n):
  if a[jj]==ii:
    r+=1
    ii+=1
if r==0:
  print(-1)
  exit()

print(n-r)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n  = int(input())
xs = [int(x) for x in input().split()]
x  = -1

for i in range(1, n + 1):
	if i <= xs[i - 1]:
		x = i - xs[i - 1]

print(x)


n  = int(input())
xs = [int(x) for x in input().split()]
c  = 0
y  = 1

for x in xs:
	if x == y:
		y += 1
	else:
		c += 1

print(-1 if c == n else c)


Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
l = (map(int,input().split()))
num = len(l)
l_first = min(l)
l_min = min(l)
x = l.index(l_min)

for _ in range(N):
    l = l[x:]
    if l_min+1 in l:
        l_min +=1
        x = l.index(l_min)
    else:
        break

if l_first == l_min:
    print(-1)
else:
    print(num-(l_min-l_first+1))

N = int(input())
l = list(map(int,input().split()))
a = 1
for i in l:
    if a == i:
        a += 1
if a == 1:
    print(-1)
else:
    print(N-a+1)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
from sys import stdin


n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]

rslt = []
for i in range(1,n):
    cntr = 0
    ex = 0
    for s in arr:
        s = int(s)
        if ex != 0:
            ex = s
        if s != ex +1:
            cntr += 1
        ex = s
    rslt.append(cntr)


print(rslt)
print(min(rslt))





from sys import stdin


n = int(stdin.readline().rstrip())
arr = [int(x) for x in stdin.readline().rstrip().split()]

rslt = []

ex = 0
cntr = 1
bb = 0

for a,j in enumerate(arr):
    if j == cntr:
        cntr += 1
    else:
        bb += 1


if bb == n:
    print(-1)
else:
    print(bb)



Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
a = list(map(int,input().split()))
k = 0
for i in range(N):
  if a[i] = k + 1 :
    k += 1
if k == 0:
  print(-1)
else:
  print(N-k)

N = int(input())
a = list(map(int,input().split()))
k = 0
for i in range(N):
  if a[i] == k + 1 :
    k += 1
if k == 0:
  print(-1)
else:
  print(N-k)


Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):

from sys import stdin

n = int(stdin.readline().rstrip())
L = stdin.readline().rstrip()

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)



from sys import stdin

n = int(stdin.readline().rstrip())
L = list(map(int,input().split()))

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)


Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = input()
renga = list(map(int, input().split(" ")))

ni = 1
remains = 0

for r in renga:
    if ni == r:
        ni += 1
        remains += 1
if ni == 1:
    print(-1)
else:
    print(renga - remains)

n = input()
renga = list(map(int, input().split(" ")))

ni = 1
remains = 0

for r in renga:
    if ni == r:
        ni += 1
        remains += 1
if ni == 1:
    print(-1)
else:
    print(len(renga) - remains)


Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
from sys import stdin
import fractions

N = stdin.readline().rstrip().split()
A = [int(x) for x in stdin.readline().rstrip().split()]
# print(N)
# print(A)
nex = 1
ans = 0

for i in range(N):
    if A[i] == nex:
        nex += 1
    else:
        ans += 1

print(-1) if N == ans else print(ans)


from sys import stdin
import fractions

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
# print(N)
# print(A)
nex = 1
ans = 0

for i in range(N):
    if A[i] == nex:
        nex += 1
    else:
        ans += 1

print(-1) if N == ans else print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
n = input()    
m = n.split()
p = [int(i) for i in m]
j = 1
for i in range(N):
    if p[i] == j:
        j = j+1
if j = 1:
    print("-1")
else:
    print(N - j + 1)

N = int(input())
n = input()    
m = n.split()
p = [int(i) for i in m]
j = 1
for i in range(N):
    if p[i] == j:
        j = j+1
if j == 1:
    print("-1")
else:
    print(N - j + 1)

Verdicts: Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n = int(input())
tmp = input().split(" ")
x = list()
for i in tmp:
  x.append(int(i))
c = 0
for i in x:
  if c==(i+1):
    c+=1
print(n-c)

n = int(input())
tmp = input().split(" ")
x = list()
for i in tmp:
  x.append(int(i))
c=0
for i in x:
  if i==(c+1):
    c+=1
br = n-c

if c==0:
  print("-1")
else:
  print(br)


Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))
K = 0
p = 0
bricks = [[] for i in range(N)] 

for i in range(N):
  bricks[a[i] - 1].append(i)
print(bricks)

for i in range(N):
  if len(bricks[i]) == 0:
    break
  elif bricks[i][-1] < p:
    break
  else:
    for j in bricks[i]:
      if j >= p:
        p = j
        K += 1
        break
if K == 0:
  print(-1)
else:
  print(N - K)

N = int(input())
a = list(map(int, input().split()))
K = 0
p = 0
bricks = [[] for i in range(N)] 

for i in range(N):
  bricks[a[i] - 1].append(i)

for i in range(N):
  if len(bricks[i]) == 0:
    break
  elif bricks[i][-1] < p:
    break
  else:
    for j in bricks[i]:
      if j >= p:
        p = j
        K += 1
        break
if K == 0:
  print(-1)
else:
  print(N - K)

Verdicts: Wrong Answer

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
n=int(input())
for i in range(0,n):
    a[i]=int(input())
f=0
g=1
for i in range(0,n):
    if a[i]!=g:
      f++
    else:
      g++
    #printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)



n=int(input())
A=list(map(int,input().split()))
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
      f++
    else:
      g++
    #printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)
 

n=int(input())
A=list(map(int,input().split()))
#print(A)
f=0
g=1
for i in range(0,n):
    if A[i]!=g:
        f+=1
    else:
        g+=1
#printf("%d %d\n",f,g)
if g!=1:
    print(f)
else:
    print(-1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N bricks arranged in a row from left to right.  The i-th brick from the left (1 \leq i \leq N) has an integer a_i written on it.  Among them, you can break at most N-1 bricks of your choice.  Let us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \leq i \leq K), the i-th of those brick from the left has the integer i written on it.  Find the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print `-1` instead.

Submission attempts (in order):
N=int(input())
A=[int(x) for x in input().split()]
l=[0]
c=0

if 1 not in A:
    print(-1)
    exit()


for i in range(N-1):
    if A[i] in l:
        continue
    if l[c]+1 != A[i]:
        continue
    for j in range(i+1,N):
        if A[i]>A[j]:
            if A[j] not in l:
                continue
        else:
            if A[i] in l:
                continue
            else:
                l.append(A[i])
                c+=1
if l[-1]+1 == A[-1]:
    l.append(A[-1])

print(N+1-len(l),l)


N=int(input())
A=[int(input()) for i in range(N)]
l=[]
count=0

if 1 not in A:
    print(-1)
    exit()
for i in range(N-1):
    for j in range(i+1,N):
        if A[i]>=A[j]:
            count+=1
            print(A[i],A[j])
            break

print(count)


N=int(input())
A=[int(x) for x in input().split()]
ne=1
c=0

if 1 not in A:
    print(-1)
    exit()


for i in range(N-1):
    if A[i]==ne:
        c+=1
        ne+=1
if A[-1]==ne:
    c+=1
print(N-c)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = input()
mojisu = len(S)
hug = 0
for i in range(mojisu // 2):
    if S[i] != S[mojisu - (i+1)]:
        hug = hug + 1
    print(hug)

S = input()
mojisu = len(S)
hug = 0
for i in range(mojisu // 2):
    if S[i] != S[mojisu - (i+1)]:
        hug = hug + 1
print(hug)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = list(input())
l = len(s)

s1 = s[:int(l/2)]
s2 = s[-int(l/2):]
s2.reverse()

print(s1)
print(s2)
dif = 0
for i in range(int(l/2)):
  print(i)
  if s1[i] != s2[i]:
    dif += 1

print(dif)

s = list(input())
l = len(s)

s1 = s[:int(l/2)]
s2 = s[-int(l/2):]
s2.reverse()

dif = 0
for i in range(int(l/2)):
  if s1[i] != s2[i]:
    dif += 1

print(dif)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = list(input())
cou = 0
for i in range(len(S)//2):
	if S[i] != S[-i]:
		cou += 1
print(cou)

S = list(input())
cou = 0
for i in range(len(S)//2):
	if S[i] != S[-i-1]:
		cou += 1
print(cou)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = input()
print(S)
print(S[2])

count = 0
for i in range(int(len(S)/2)):
    if S[i] != S[len(S)-i-1]:
        count += 1

print(count)

S = input()

count = 0
for i in range(int(len(S)/2)):
    if S[i] != S[len(S)-i-1]:
        count += 1

print(count)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = input()

half = int(len(S) / 2)
S1 = S[:half]
S2 = S[::-1][:half]

count = 0
for s1, s2 in zip(S1, S2):
    if s1 != s2: count += 1

print(count)
key = 'b'
print({'a': 1, 'b': 2}.get(key))


S = input()

half = int(len(S) / 2)
S1 = S[:half]
S2 = S[::-1][:half]

count = 0
for s1, s2 in zip(S1, S2):
    if s1 != s2: count += 1

print(count)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = input()
a = len(S)//2 + 1
A = S[:a-1]
reS=S[::-1]
B = reS[:a-1]
ans = 0
for i in range(a):
    if A[i] != B[i]:
        ans += 1
print(ans)        

s = input()
r = s[::-1]
count = 0

for i in range(int(len(s))):
    if (s[i] != r[i]):
        count += 1

print(count//2)


Verdicts: Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = list(input())
n = len(s)-1
count = 0
if s != s[::-1]:
  for i in range(0,n//2):
    if s[i] != s[n-i]:
      count += 1
print(count)


s = list(input())
n = len(s)-1
count = 0
if s != s[::-1]:
  for i in range(n):
    if s[i] != s[n-i]:
      count += 1
print(count)


s = list(input())
n = len(s)-1
count = 0
if s != s[::-1]:
  for i in range(0,(n+1)//2):
    if s[i] != s[n-i]:
      count += 1
print(count)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = input()
rs = reversed(s)

acc = sum([c == rc for c, rc in zip(s, rs)])

print(acc // 2)

S = input()
rS = reversed(S)

print(sum([s != rs for s, rs in zip(S, rS)]) // 2)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = input()

ans = 0
for i in range(len(s)):
  if s[i] != s[-i-1]:
    ans += 1

print(ans)

s = input()

ans = 0
for i in range(len(s)//2):
  if s[i] != s[-i-1]:
    ans += 1

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
import math
s=input()
n=math.floor(len(s)/2)
print(n)
count=0
for i in range(n):
    if s[i]!=s[-i-1]:
        count+=1

print(count)

import math
s=input()
n=math.floor(len(s)/2)
count=0
for i in range(n):
    if s[i]!=s[-i-1]:
        count+=1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):

s = input()
n = len(s)
nn = -(-n/2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)


s = input()
n = len(s)
nn = -(-n//2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
import sys
S=input()
Skai=list(S)
Skai.reverse()
S=list(S)
num=len(S)
i=0
Slist =[]
Skailist =[]
for j in range (num):
	if S[j]!=Skai[j]:
		i+=1
		Skailist.append(Skai[j])
		Slist.append(S[j])
		Skailist.reverse()
		if Slist==Skailist:
			print(len(Skailist))
			sys.exit()
print(i)
                


S=input()
Skai=list(S)
Skai.reverse()
S=list(S)
num=len(S)
i=0
for j in range (num):
    if S[j]!=Skai[j]:
            i+=1
print(i)

import sys
S=input()
Skai=list(S)
Skai.reverse()
S=list(S)
num=len(S)
i=0
Slist =[]
Skailist =[]
for j in range (num):
	if S[j]!=Skai[j]:
		i+=1
		Skailist.append(Skai[j])
		Slist.append(S[j])
		if Slist==Skailist:
			print(len(Skailist))
			sys.exit()			
print(int(i/2))
                


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = input()
result = 0
reverseString = s[::-1]
for i in range(len(s)):
    if s[i] != reverseString[i]:
        result += 1
print(result / 2)


s = input()
result = 0
reverseString = s[::-1]
print(reverseString)
for i in range(len(s)):
    if s[i] != reverseString[i]:
        result += 1
print(result / 2)


s = input()
result = 0
reverseString = s[::-1]
for i in range(len(s)):
    if s[i] != reverseString[i]:
        result += 1
print(int(result / 2))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S=input()
cnt=0
for i in range(S//2):
  if S[i]!=S[-i]:
    cnt+=1
print(cnt)

S=input()
cnt=0
for i in range(len(S)//2-1):
  if S[i]!=S[-1*i]:
    cnt+=1
print(cnt)

S=input()
cnt=0
for i in range(len(S)//2):
  if S[i]!=S[-i-1]:
    cnt+=1
print(cnt)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S = input()
if S.islower():
	S1 = S[:int(len(S)/2)]
    S2 = S[int(len(S)/2):]
    count = 0
    for i,x in enumerate(S1):
        if x != S2[(i+1)*-1]:
            count += 1
    print(count)

S = input()
if S.islower():
  S1 = S[:int(len(S)/2)]
  S2 = S[int(len(S)/2):]
  count = 0
  for i,x in enumerate(S1):
    if x != S2[(i+1)*-1]:
      count += 1
  print(count)

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):

a = list(input())
b = len(a)
c = int(b/2)
result = []
if b%2 == 0:
    A = a[:c]
    B = a[c:]
    BB = B[::-1]
    for v in range(c):
        if A[v] != BB[v]:
            result.append(v)
        else:
            x.append(v)
        
else:
    C = a[:c]
    D = a[c+1:]
    DD = D[::-1]
    for v in range(c):
        if C[v] != DD[v]:
            result.append(v)
        else:
            x.append(v)
print(len(result))

a = list(input())
b = len(a)
c = int(b/2)
x = []
result = []
if b%2 == 0:
    A = a[:c]
    B = a[c:]
    BB = B[::-1]
    for v in range(c):
        if A[v] != BB[v]:
            result.append(v)
        else:
            x.append(v)
        
else:
    C = a[:c]
    D = a[c+1:]
    DD = D[::-1]
    for v in range(c):
        if C[v] != DD[v]:
            result.append(v)
        else:
            x.append(v)
print(len(result))

Verdicts: Runtime Error

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = input()
leng = len(s)
count = 0
for i in range(int((leng-1)/2)):
    if s[i] != s[leng-i-1]:
        count += 1
print(count)

s = input()
leng = len(s)
count = 0
if leng %2!=0:
    for i in range(int((leng-1)/2)):
        if s[i] != s[leng-i-1]:
            count += 1
else:
    for i in range(int(leng/2)):
        if s[i] != s[leng-i-1]:
            count += 1
    
print(count)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    s1=s[::-1]
    cnt=0
    for i in range(len(s)):
        if s[i]!=s1[i]:
            cnt+=1
    print(cnt//2)
resolve

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    cnt=0
    for i in range(len(s)//2):
        if s[i]!=s[-1-i]:
            cnt+=1
    print(cnt)
resolve

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    cnt=0
    for i in range(len(s)//2):
        if s[i]!=s[-1-i]:
            cnt+=1
    print(cnt)
resolve()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s=input()
ans=0

for i in range(len(s)//2):
    if s[i]==(s[len(s)-i-1]):
        ans+=1
print(ans)

s=input()
ans=0

for i in range(len(s)//2):
    if s[i]!=(s[len(s)-i-1]):
        ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
s = input();print([1 for i in range(len(s)//2) if s[i]!=s[-i-1]])

S = input()
N = len(S)
 
ans = 0
for i in range(N // 2):
  if S[i] != S[-i]:
    ans += 1
print(ans)

s = input();print(sum(1 for i in range(len(s)//2) if s[i]!=s[-i-1]))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.  Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Submission attempts (in order):
S=input()
n=0
if len(S)%2==0:
    for i in range (0,int(len(S))/2):
        if S[i]!=S[-i-1]:
            n+=1
else:
    for i in range (0,int(((len(S))+1)/2)):
        if S[i]!=S[-i-1]:
            n+=1
print(n)

S=input()
n=0
if len(S)%2==0:
    for i in range (0,int((len(S))/2)):
        if S[i]!=S[-i-1]:
            n+=1
else:
    for i in range (0,int(((len(S))+1)/2)):
        if S[i]!=S[-i-1]:
            n+=1
print(n)

Verdicts: Runtime Error

Accepted