TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

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

can_view = [1]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] > H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)

print(len(can_view))

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

can_view = [1]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] > H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)

print(len(can_view))

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

can_view = [1]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] > H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)

print(len(can_view))

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

can_view = [1]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] > H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)

print(len(can_view))



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

can_view = [0]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)
print(len(can_view))



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

can_view = [0]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)
print(len(can_view))



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

can_view = [0]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)
print(len(can_view))



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

can_view = [0]

for i in range(N):
    if i == 0:
        continue
    
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    
    if count == i:
        can_view.append(i)
print(len(can_view))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
a = int(input())
l = list(map(int, input().split()))
for i in range(a):
  if l[i] >= max(l[0:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
for i in range(a):
  if l[i] >= max(l[0:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
for i in range(a):
  if l[i] >= max(l[0:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
for i in range(a):
  if l[i] >= max(l[0:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, a):
  if l[i] >= max(l[:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, a):
  if l[i] >= max(l[:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, a):
  if l[i] >= max(l[:i]):
    c +=1
print(c)

a = int(input())
l = list(map(int, input().split()))
c = 1
for i in range(1, a):
  if l[i] >= max(l[:i]):
    c +=1
print(c)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if max>=high[i]:
        ans += 1
        max = high[i]

print(ans)

n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max<=high[i]:
        ans += 1
        max = high[i]

print(ans)


n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max<=high[i]:
        ans += 1
        max = high[i]

print(ans)


n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max<=high[i]:
        ans += 1
        max = high[i]

print(ans)


n = int(input())
high = [int(i) for i in input().split()]
ans = 0
max = 0
for i in range(n):
    if max<=high[i]:
        ans += 1
        max = high[i]

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:5
        hotel+=1


print(hotel)

N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:5
        hotel+=1


print(hotel)

N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:5
        hotel+=1


print(hotel)

N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:5
        hotel+=1


print(hotel)

N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:
        hotel+=1


print(hotel)


N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:
        hotel+=1


print(hotel)


N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:
        hotel+=1


print(hotel)


N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:
        hotel+=1


print(hotel)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
n = int(input())
h = list(map(int, input().split()))
cnt = n 
h.reverse()
for i in h:
    for j in h:
    	if h[j]>h[i]:
    		h.remove(h[i])
    		cnt = cnt-1
    	else:
    		h.remove(h[i])
else:
    print(cnt)

n = int(input())
h = list(map(int, input().split()))
cnt = n 
h.reverse()
for i in h:
    for j in h:
    	if h[j]>h[i]:
    		h.remove(h[i])
    		cnt = cnt-1
    	else:
    		h.remove(h[i])
else:
    print(cnt)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
cnt = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
cnt = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
cnt = n 
h.reverse()
for i in h:
    for j in h:
    	if h[j]>h[i]:
    		h.remove(h[i])
    		cnt = cnt-1
    	else:
    		h.remove(h[i])
else:
    print(cnt)

n = int(input())
h = list(map(int, input().split()))
cnt = n 
h.reverse()
for i in h:
    for j in h:
    	if h[j]>h[i]:
    		h.remove(h[i])
    		cnt = cnt-1
    	else:
    		h.remove(h[i])
else:
    print(cnt)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
cnt = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
cnt = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
ans = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
ans = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
ans = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
ans = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

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

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(intput())
H = list(map(int, input().split()))

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(intput())
H = list(map(int, input().split()))

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(intput())
H = list(map(int, input().split()))

pre = 0
ans = 0

for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    ans += 1
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h <= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h <= b:
    b = h
    a += 1
print(a)


h_list = list([int(input())])
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)

h_list = list([int(input())])
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)

h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h <= b:
    b = h
    a += 1
print(a)


h_list = map(int, input().split())
a = 0
b = 0
for h in h_list:
  if h <= b:
    b = h
    a += 1
print(a)


h_list = list([int(input())])
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)

h_list = list([int(input())])
a = 0
b = 0
for h in h_list:
  if h >= b:
    b = h
    a += 1
print(a)

n = int(input())
h = map(int, input().split())
a = 0
b = 0
for i in h:
  if b <= i:
    b = i
    a += 1
print(a)

n = int(input())
h = map(int, input().split())
a = 0
b = 0
for i in h:
  if b <= i:
    b = i
    a += 1
print(a)

n = int(input())
h = map(int, input().split())
a = 0
b = 0
for i in h:
  if b <= i:
    b = i
    a += 1
print(a)

n = int(input())
h = map(int, input().split())
a = 0
b = 0
for i in h:
  if b <= i:
    b = i
    a += 1
print(a)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

Submission attempts (in order):
N = input().split()
print(N)
h = 1
for i in range(1,len(N)):
    for j in range(i):
        if (N[i] < N[j]):
            break
        if j == i-1:
            h += 1
print(h)

N = input().split()
print(N)
h = 1
for i in range(1,len(N)):
    for j in range(i):
        if (N[i] < N[j]):
            break
        if j == i-1:
            h += 1
print(h)

N = input().split()
print(N)
h = 1
for i in range(1,len(N)):
    for j in range(i):
        if (N[i] < N[j]):
            break
        if j == i-1:
            h += 1
print(h)

N = input().split()
print(N)
h = 1
for i in range(1,len(N)):
    for j in range(i):
        if (N[i] < N[j]):
            break
        if j == i-1:
            h += 1
print(h)

N = int(input())
mounts =list(map(int, input().split()))
#print(mounts)

counter = 1
comp = []
comp.append(mounts[0])

for mount in mounts[1:]:
    Flag = False
    #print("count{} mount{}".format(counter, mount))
    for c in comp:
        if c > mount:
            Flag = True
            break
    if not Flag:
        counter += 1
    comp.append(mount)
    #print(counter)

print(counter)

N = int(input())
mounts =list(map(int, input().split()))
#print(mounts)

counter = 1
comp = []
comp.append(mounts[0])

for mount in mounts[1:]:
    Flag = False
    #print("count{} mount{}".format(counter, mount))
    for c in comp:
        if c > mount:
            Flag = True
            break
    if not Flag:
        counter += 1
    comp.append(mount)
    #print(counter)

print(counter)

N = int(input())
mounts =list(map(int, input().split()))
#print(mounts)

counter = 1
comp = []
comp.append(mounts[0])

for mount in mounts[1:]:
    Flag = False
    #print("count{} mount{}".format(counter, mount))
    for c in comp:
        if c > mount:
            Flag = True
            break
    if not Flag:
        counter += 1
    comp.append(mount)
    #print(counter)

print(counter)

N = int(input())
mounts =list(map(int, input().split()))
#print(mounts)

counter = 1
comp = []
comp.append(mounts[0])

for mount in mounts[1:]:
    Flag = False
    #print("count{} mount{}".format(counter, mount))
    for c in comp:
        if c > mount:
            Flag = True
            break
    if not Flag:
        counter += 1
    comp.append(mount)
    #print(counter)

print(counter)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted

Accepted

Accepted

Accepted
Problem: There are N mountains ranging from east to west, and an ocean to the west.  At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.  The height of the i-th mountain from the west is H_i.  You can certainly see the ocean from the inn at the top of the westmost mountain.  For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.  From how many of these N inns can you see the ocean?

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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    print(max)
    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    print(max)
    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    print(max)
    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    print(max)
    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    if max <= h[i+1]:
        count += 1

print(count)


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

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    if max <= h[i+1]:
        count += 1

print(count)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted

Accepted

Accepted

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

BW=s[::2]
WB=s[1::2]

x=BW.count("0") + WB.count("1")
y=BW.count("0") + WB.count("1")

print(min(x,y))

s=input()

BW=s[::2]
WB=s[1::2]

x=BW.count("0") + WB.count("1")
y=BW.count("1") + WB.count("0")

print(min(x,y))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

A1 = '0'
A2 = '1'
for i in range(1, N):
  if i // 2 == 1:
    A1 = A1 + '0'
    A2 = A2 + '1'
  else:
    A1 = A1 + '1'
    A2 = A2 + '0'
S = int(S, 2)
A1 = int(A1, 2)
A2 = int(A2, 2)
n1 = S ^ A1
n2 = S ^ A2
print(min(n1, n2))

S = input()
N = len(S)

A1 = '0'
A2 = '1'
for i in range(1, N):
  if i % 2 == 0:
    A1 = A1 + '0'
    A2 = A2 + '1'
  else:
    A1 = A1 + '1'
    A2 = A2 + '0'
S = int(S, 2)
A1 = int(A1, 2)
A2 = int(A2, 2)
n1 = bin(S ^ A1).count('1')
n2 = bin(S ^ A2).count('1')
print(min(n1, n2))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
c2,c3 = 0,0
def ret(a,b,c):
  global c2,c3
  if a == b:
    if c == 2:
      c2 += 1
    else:
      c3 += 1
    if b == "0":
      return "1"
    else:
      return "0"
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
  print(S2,c2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0],3)
  S3[j] = ret(S3[j-1],k,3)
  print(S3,c3)
print(c2 if c2 <= c3 else c3)

def ret(a,b,c):
  global c2,c3
  if a == b:
    if b == "0":
      return "1"
   	else:
      return "0"
    if c == 2:
      c2 += 1
    else:
      c3 += 1
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
c2,c3 = 0,0
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0])
  S3[j] = ret(S3[j-1],k,3)
print(c2 if c2 >= c3 else c3)

c2,c3 = 0,0
def ret(a,b,c):
  global c2,c3
  if a == b:
    if c == 2:
      c2 += 1
    else:
      c3 += 1
    if b == "0":
      return "1"
    else:
      return "0"
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0],3)
  S3[j] = ret(S3[j-1],k,3)
print(c2 if c2 <= c3 else c3)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
#coding:utf-8

S = input()

N = len(S)
ans = 0
SR = []
if S[0] == '0':
	for i in range(int(N/2)):
		SR.append('0')
		SR.append('1')
else:
	for i in range(int(N/2)):
		SR.append('1')
		SR.append('0')

for i in range(N):
	if S[i] != SR[i]:
		ans += 1
		
print(ans)
			


#coding:utf-8

S = input()
N = len(S)
ans = 0
SR = []
if S[0] == '0':
	for i in range(N):
		SR.append('0')
		SR.append('1')
else:
	for i in range(N):
		SR.append('1')
		SR.append('0')

for i in range(N):
	if S[i] != SR[i]:
		ans += 1
		
print(ans)

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
        	f = '1' if i == '0' else '0'
        f = i
    print(r)

s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
        	f = '1' if i == '0' else '0'
    	else:
        	f = i
    print(r)


s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
            f = '1' if i == '0' else '0'
        else:
        	f = i
    print(r)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
n = str(input())
n_arr = list(str(n))
arr = list(map(int, n_arr))
print(arr)
zero = []
one = []
for i in range(len(arr)):
    if i % 2 == 0:
        zero.append(0)
        one.append(1)
    else:
        zero.append(1)
        one.append(0)
zero_diff = 0
one_diff = 0
for i in range(len(arr)):
    if arr[i] != zero[i]:
        zero_diff += 1
for i in range(len(arr)):
    if arr[i] != one[i]:
        one_diff += 1
print(min([one_diff,zero_diff]))

n = str(input())
n_arr = list(str(n))
arr = list(map(int, n_arr))
zero = []
one = []
for i in range(len(arr)):
    if i % 2 == 0:
        zero.append(0)
        one.append(1)
    else:
        zero.append(1)
        one.append(0)
zero_diff = 0
one_diff = 0
for i in range(len(arr)):
    if arr[i] != zero[i]:
        zero_diff += 1
for i in range(len(arr)):
    if arr[i] != one[i]:
        one_diff += 1
print(min([one_diff,zero_diff]))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = [int(i) for i in list(input())]
count = 0

for i in range(1,len(s)-1):
    a = s[i-1:i+2]
    if a[-1] == a[0] == a[1]:
        s[i] = 1
print(s)


s = input()
count_odd = 0
for i in range(len(s)): 
    if s[i] != str(i % 2):
        count_odd += 1
count_even = 0
for i in range(len(s)):
    if s[i] == str(i % 2):
        count_even += 1

print(min(count_odd, count_even))


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    s = list(input_string[0][:])
    c = 0
    for i in range(len(s))[1:]:
        print(i)
        if s[i] == s[i-1]:
            if s[i] == "1":
                s[i] = "0"
            else:
                s[i] = "1"
            c += 1
    return c



def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    s = list(input_string[0][:])
    c_1 = 0
    for i in range(len(s))[1:]:
        if s[i] == s[i-1]:
            if s[i] == "1":
                s[i] = "0"
            else:
                s[i] = "1"
            c_1 += 1
    c_2 = 0
    for i in range(len(s))[::-1][1:]:
        if s[i] == s[i+1]:
            if s[i] == "1":
                s[i] = "0"
            else:
                s[i] = "1"
            c_2 += 1
    return c_2 if c_2 > c_1 else c_1



def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
print(min(min_1, min_2))

s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
min_1 = 0

for i in range(len(s)):
    if s[i] != s1[i]:
        min_1 += 1
        
min_2 = 0
for i in range(len(s)):
    if s[i] != s2[i]:
        min_2 += 1
print(min(min_1, min_2))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=input()
n=len(s)
for i in range(n-1):
    if s[i]=="0" and i%2==0:
        ans+=1
    elif s[i]=="1" and i%2==1:
        ans+=1
ans1=0
for i in range(n-1):
    if s[i]=="1" and i%2==0:
        ans1+=1
    elif s[i]=="0" and i%2==1:
        ans1+=1

print(min(ans,ans1))A

s=input()
n=len(s)
ans=0
for i in range(n):
    if s[i]=="0" and i%2==0:
        ans+=1
    elif s[i]=="1" and i%2==1:
        ans+=1
ans1=0
for i in range(n):
    if s[i]=="1" and i%2==0:
        ans1+=1
    elif s[i]=="0" and i%2==1:
        ans1+=1

print(min(ans,ans1))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=list(input())
count1=0
count2=0
for i in range(len(s)):
  if s[i]==s[i+1]:
    count1=count1+1
for i in range(1,len(s)):
  if s[i]==s[i+1]:
    count2=count2+1
if count1>=count2:
  print(count1)
else:
  print(count2)

s=list(input())
count1=0
count2=0
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    count1=count1+1
for i in range(1,len(s)-1):
  if s[i]==s[i+1]:
    count2=count2+1
if count1>=count2:
  print(count1)
else:
  print(count2)

s=list(input())
count1=0
count2=0
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    count1=count1+1
    if s[i+1]=='0':
      s[i+1]='1'
    else:
      s[i+1]='0'
for i in range(1,len(s)-1):
  if s[i]==s[i+1]:
    count2=count2+1
    count1=count1+1
    if s[i+1]=='0':
      s[i+1]='1'
    else:
      s[i+1]='0'
if count1>=count2:
  print(count1)
else:
  print(count2)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input().rstrip()
s = list(S)
print(s)
N = len(S)
c = 0
if N == 1:
  print(0)
else:
  for i in range(1,N)
  	if S[i-1] == '0' and S[i] == '0':
      S[i] = 1
      c +=1
    elif S[i-1] == '1' and S[i] == '1':
      S[i] = 0
      c +=1
print(c)

S = input().rstrip()
s = list(S)
N = len(S)
c = 0
v = [None] * N
v[0] = s[0]
if N == 1:
  print(c)
else:
  for i in range(1,N):
    
    if s[i]=='0' and v[i-1] =='0':
      v[i] = '1'
      c +=1
    elif s[i] =='1' and v[i-1] == '1':
      v[i] = '0'
      c +=1
    elif s[i] =='1' and v[i-1] == '0':
      v[i] = '1'
    elif s[i] =='0' and v[i-1] == '1':
      v[i] = '0'
    

  print(c)

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input().strip()
ansB = 0
ansW = 0
for i,c in emumerate(S):
  if (i % 2 == 0):
    if (c == '0'):
      ansW += 1
  else:
   	if (c == '1'):
      ansB += 1

ans = min(ansW, ansB)
print(ans)

S = input().strip()
ansB = 0
ansW = 0
for i,c in enumerate(S):
	if (i % 2 == 0):
		if (c == '0'):
			ansW += 1
		else:
			ansB += 1
	else:
		if (c == '1'):
			ansW += 1
		else:
			ansB += 1
ans = min(ansW, ansB)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

l = len(S)
c1 = 0 
c2 = 0

for i in range(l):
  if i%2 ==0:
    if S[i] == 0:
      c1 += 1
    else:
      c2 += 1
  else:
    if S[i] == 0:
      c2 += 1
    else:
      c1 += 1
    
print(min(c1,c2))

S = list(map(int, input().split()))

l = len(S)
c1 = 0 
c2 = 0

for i in range(l):
  if i%2 ==0:
    if S[i] == 0:
      c1 += 1
  else:
    if S[i] == 0:
      c2 += 1
    
print(min(c1,c2))






  


S = list(input())

l = len(S)
c1 = 0 
c2 = 0

for i in range(l):
  if i%2 ==0:
    if S[i] == "0":
      c1 += 1
    else:
      c2 += 1
  else:
    if S[i] == "0":
      c2 += 1
    else:
      c1 += 1
    
print(min(c1,c2))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

a = "10" * (n // 2) + ("1" if n % 2 == 0 or n == 1 else "")
b = "01" * (n // 2) + ("0" if n % 2 == 0 or n == 1 else "")

sum_a = 0
for i in range(n):
    if s[i] != a[i]: sum_a += 1

sum_b = 0
for i in range(n):
    if s[i] != b[i]: sum_b += 1

print(min(sum_a, sum_b))

s = input()
n = len(s)

a = "10" * (n // 2) + ("1" if n % 2 == 1 else "")
b = "01" * (n // 2) + ("0" if n % 2 == 1 else "")

sum_a = 0
for i in range(n):
    if s[i] != a[i]: sum_a += 1

sum_b = 0
for i in range(n):
    if s[i] != b[i]: sum_b += 1

print(min(sum_a, sum_b))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S =input()
l=len(S)
N=int(S,2)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if (N & 0b10**i)!=0:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if (N & 0b10**i)!=0:
    	bpopcount+=1
    else:
      	apopcount+=1
print(apopcount,bpopcount)
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount) 

S =input()
l=len(S)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if int(S[i])==1:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if int(S[i])==1:
    	bpopcount+=1
    else:
      	apopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount) 

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
cnt_st0 = 0
cnt_st1 = 0
in_str = str(input())
for i, m in enumerate(in_str):
  if i % 2 == 0:
    if m == '0':
      cnt_st1 += 1
    else:
      cnt_st0 += 1
  else:
    if m == '0':
      cnt_st0 += 1
    else:
      cnt_st1 += 1
      
print(min(cnt_st0, cnt_St1))

cnt_st0 = 0
cnt_st1 = 0
in_str = str(input())
for i, m in enumerate(in_str):
  if i % 2 == 0:
    if str(m) == '0':
      cnt_st1 += 1
    else:
      cnt_st0 += 1
  else:
    if str(m) == '0':
      cnt_st0 += 1
    else:
      cnt_st1 += 1
print(min(cnt_st0, cnt_st1))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=input()
sento1 = 0
sento0 = 0
for i in range(len(s)):

  if i % 2 == 0:
    
    if s[i] == '1':
      sento1 += 1
      
    elif s[i] == '0':
      sento0 += 1
      
  else:
    if s[i] == '0':
      sento1 += 1
    elif s[i] == '1'
      sento0 += 1
      
print(min(sento1,sento0))

s=input()
sento1 = 0
sento0 = 0
for i in range(len(s)):

  if i % 2 == 0:
    
    if s[i] == '1':
      sento1 += 1
      
    elif s[i] == '0':
      sento0 += 1
      
  else:
    if s[i] == '0':
      sento1 += 1
    elif s[i] == '1':
      sento0 += 1
      
print(min(sento1,sento0))


Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
S = input()
lis = []
for t in range(len(S)):
    lis.append(S[t])
evencount0 = 0
unevencount0 = 0
evencount1 = 0
unevencount1 = 0
if len(S)%2 == 0:
    for t in range(int(len(S)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int(len(S)/2) - evencount0
    for t in range(int(len(S)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int(len(S)/2) - unevencount0

else:
    for t in range(int((len(S) - 1)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int(len(S)/2) - evencount0        

    for t in range(int((len(S)+1)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int(len(S)/2) - unevencount0

elist = [evencount0 , evencount1 , unevencount0 , unevencount1 ]
if evencount1 + unevencount0 > evencount0 + unevencount1:
    k = evencount0 + unevencount1
else:
    k = evencount1 + unevencount0
print(k)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
S = input()
lis = []
for t in range(len(S)):
    lis.append(S[t])
evencount0 = 0
unevencount0 = 0
evencount1 = 0
unevencount1 = 0
if len(S)%2 == 0:
    for t in range(int(len(S)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int(len(S)/2) - evencount0
    for t in range(int(len(S)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int(len(S)/2) - unevencount0

else:
    for t in range(int((len(S) - 1)/2)):
        if S[2*t + 1] == "0":
            evencount0 += 1
    evencount1 = int((len(S) - 1)/2) - evencount0        

    for t in range(int((len(S)+1)/2)):
        if S[2*t] == "0":
            unevencount0 += 1
    unevencount1 = int((len(S)+1)/2) - unevencount0

elist = [evencount0 , evencount1 , unevencount0 , unevencount1 ]
if evencount1 + unevencount0 > evencount0 + unevencount1:
    k = evencount0 + unevencount1
else:
    k =evencount1 + unevencount0
print(k)

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = list(map(int,input()))
print(s)
n = len(s)
count1 = 0
count2 = 0
if n == 1:
    print(0) 
else:
    for i in range(n):
        if i % 2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 !=0 and s[i] != 1:
            count1 += 1
    for i in range(n):
        if i % 2 == 0 and s[i] != 1:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

s = list(map(int,input()))
n = len(s)
count1 = 0
count2 = 0
if n == 1:
    print(0) 
else:
    for i in range(n):
        if i%2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 != 0 and s[i] != 1:
            count1 += 1
    for i in range(n):
        if i%2 == 0 and s[i] != 1:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

res_10 = 0
res_01 = 0

for i in range(N):
    if i % 2 == 0:
        if S[i] == "0":
            res_10 += 1
        else:
            res_01 += 1
    else:
        if S[i] == "1":
            res_10 += 1
        else:
            res_01 += 1
print(min(res_10, res_01))

S = list(input())
 
res_10 = 0
res_01 = 0
 
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "0":
            res_10 += 1
        else:
            res_01 += 1
    else:
        if S[i] == "1":
            res_10 += 1
        else:
            res_01 += 1
print(min(res_10, res_01))

Verdicts: Runtime Error

Accepted