TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
s = map(int, input().split())
c = 0

for i in range(1, N):
	if s[i] == s[i - 1]:
		c += 1
	else:
		pass
print(c)


N = int(input())
s = list(map(int, input().split()))
c = 0

for i in range(1, N):
	if s[i] == s[i - 1]:
		c += 1
	else:
		pass
print(c)


N = int(input())
s = map(int, input().split())
c = 0

for i in range(1, N):
	if s[i] == s[i - 1]:
		c += 1
	else:
print(c)


N = int(input())
a = [s for s in map(int, input().split())]
a.append(-1)
c = 0
result = 0
for i in range(1, N + 1):
	if a[i] == a[i - 1]:
		c += 1
	else:
		if c == 0:
			continue
		else:
			c += 1
			if c % 2 == 1:
				result += (c - 1) / 2
				c = 0
			else:
				result += c / 2
				c = 0
print(int(result))


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
i = 1
while i<n:
    print(i)
    if a[i]==a[i-1]:
        cnt += 1
        i += 1
    i += 1
print(cnt)

n = int(input())
a = list(map(int,input().split()))
cnt = 0
i = 1
while i<n:
    if a[i]==a[i-1]:
        cnt += 1
        i += 1
    i += 1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
a=int(input())
N=[0 for i in range(a)]
b=input()
for i in range(a):
  N[i]=int(b.aplit())

2ans=0
2ans2=0
for i in range(a-1):
  if N[i]==N[i+1]:
    2ans2+=1
  else :
    if 2ans2%2==1 :
      2ans2+=1
    ans+=2ans2/2
    2ans2=0
return 2ans

a=int(input())
N=[0 for i in range(a)]
b=input()
#print(b)
N=b.split()
for i in range(a):
  N[i]=int(N[i])

#print(N)
  
a2ans=0
a2ans2=0
for i in range(a-1):
  if N[i]==N[i+1]:
    a2ans2+=1
    #print(a2ans2)
  else :
    if a2ans2%2==1 :
      a2ans2+=1
    
    a2ans+=a2ans2/2
    a2ans2=0


if a2ans2%2==1 :
  a2ans2+=1
#print(a2ans2)
a2ans+=a2ans2/2
a2ans2=0



print(int(a2ans))

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
lis = list(map(int,input().split()))
l = []
i = 0
x = 0
while(True):
  if i == N-1:
    x += 1
    l.append(x)
    break
  if lis[i] != lis[i+1]:
    x += 1
    l.append(x)
    x = 0
  else:
    x += 1
s = 0
for i in lis:
  s += (i//1)
print(s)

N = int(input())
lis = list(map(int,input().split()))
l = []
i = 0
x = 0
while(True):
  if i == N-1:
    x += 1
    l.append(x)
    break
  if lis[i] != lis[i+1]:
    x += 1
    l.append(x)
    x = 0
  else:
    x += 1
s = 0
for i in lis:
  s += (i//2)
print(s)

N = int(input())
lis = list(map(int,input().split()))
l = []
i = 0
x = 0
while(True):
  if i == N-1:
    x += 1
    l.append(x)
    break
  if lis[i] != lis[i+1]:
    x += 1
    l.append(x)
    x = 0
  else:
    x += 1
  i += 1
s = 0
for i in l:
  s += (i//2)
print(s)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

n = int(input())
a = list(map(int, input().split()))
total = 1
total2 = 0
a.append(0)
for i in range(0, n):
    if a[i]==a[i+1]:
        total += 1
    else:
        total2 += total//2
        total = 1
print(total2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
# n = int(input())

n = 14
colors = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 1, 2, 3, 4]
ans = []
i = 0
cnt = 0
while True:
    if i == n-1:
        cnt += 1
        ans.append(cnt)
        break
    if colors[i] != colors[i+1]:
        cnt += 1
        ans.append(cnt)
        cnt = 0
    else:
        cnt += 1
    i += 1


ans = list(map(lambda x: x //2, ans))
print(sum(ans))


n = int(input())
colors = list(map(int, input().split()))
# n = 14

ans = []
i = 0
cnt = 0
while True:
    if i == n-1:
        cnt += 1
        ans.append(cnt)
        break
    if colors[i] != colors[i+1]:
        cnt += 1
        ans.append(cnt)
        cnt = 0
    else:
        cnt += 1
    i += 1


ans = list(map(lambda x: x //2, ans))
print(sum(ans))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n=int(input())
s=list(map(int,input().split()))
ans=0
cnt=1
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans+=cnt//2
        cnt=1
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

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

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


n=int(input())
a=list(map(int,input().split()))
l=[ int(i) for i in range(10000)]
b=set(a)
for j in b:
  l.remove(j)
cnt=0
for i in range(1,n):
  if a[i-1]==a[i]:
    a[i]=l.pop()
    cnt+=1
print(cnt)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
from itertools import*
print(sum(len(j)//2 for _, j in groupby(open(0).read().split()[1:])))

from itertools import*;input();print(sum(len(list(j))//2for _,j in groupby(input().split())))

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

prev = -1
seq = 1
ans = 0
for a in A:
    if a == prev:
        seq += 1
    else:
        prev = a
        ans += seq//2
        seq = 1
print(ans)


# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

prev = -1
seq = 1
ans = 0
for a in A:
    if a == prev:
        seq += 1
    else:
        prev = a
        ans += seq//2
        seq = 1
ans += seq//2
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
if n == 1:
  print(0)
else:
  before = a[0]
  cnt = 0
  ans = 0
  for i in range(1, n):
    if a[i] == before:
      cnt += 1
    else:
      ans += (cnt + 1) // 2
      cnt = 0
    before = a[i]
  print(ans)

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


Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)

N = int(input())
a = list(map(int, input().split()))
now = ''
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)


N = int(input())
a = list(map(int, input().split()))
count = 0
now = 0
ans = 0
for i in range(N):
  if a[i] == now:
    count += 1
  else:
    ans += count//2
    count = 1
    now = a[i]

ans += count//2
print(ans)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))+[0]
c=a[0]
t=0
s=0
for i in range(n+1):
  if(c!=a[i]):
    c=a[i]
    s+=t//2
    t=1
    print(i,s)
  else:
    t+=1
print(s)


n=int(input())
a=list(map(int,input().split()))
c=a[0]
t=0
s=0
for i in range(n):
  if(c!=a[i]):
    c=a[i]
    s+=t//2
    t=1
  else:
    t+=1
print(s)

n=int(input())
a=list(map(int,input().split()))+[0]
c=a[0]
t=0
s=0
for i in range(n+1):
  if(c!=a[i]):
    c=a[i]
    s+=t//2
    t=1
  else:
    t+=1
print(s)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
import numpy as np
if __name__ == "__main__":
    T = input().rstrip().split(' ')
    T = int(T[0])
    for t in range(T):
        line = input().rstrip().split(' ')
        A = int(line[0])
        B = int(line[1])
        C = int(line[2])
        D = int(line[3])
        A_list = []
        flag = True

        if B > A:
            print('No')
            continue
        if B > D:
            print('No')
            continue
        if C > B:
            print('Yes')
            continue

        while True:
            if A in A_list:
                flag = True
                break
            A_list.extend([A])
            if A < B:
                flag = False
                break
            q, A = divmod(A, B)
            for i in range(q-1):
                if A + B > C:
                    break
                A += B
            A_list.extend([A + B])
            if A <= C:
                A += D
        if flag:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    N = input().rstrip().split(' ')
    N = int(N[0])
    line = input().rstrip().split(' ')
    count = 0
    skip_flag = False
    for i in range(len(line)-1):
        if skip_flag:
            skip_flag = False
            continue
        if line[i] == line[i+1]:
            count += 1
            skip_flag = True
    print(count)

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
srimes = input().split(" ")

result = 0
before_srime = 0
flag = False


for i, srime in enumerate(srimes):
    
    
    print("i : {}, srime : {}, before_srime : {}".format(i, srime, before_srime))
    if before_srime == srime:
        print("HIT!!!!!!!!!")
        result += 1
        before_srime = int(before_srime) + 10001
        continue
    before_srime = srime

print(result)

N = int(input())
srimes = input().split(" ")

result = 0
before_srime = 0


for i, srime in enumerate(srimes):
    
    
    
    if before_srime == srime:
        # print("HIT!!!!!!!!!")
        result += 1
        before_srime = int(before_srime) + 10001
        continue
    before_srime = srime

print(result)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
import sys  
import numpy as np

input = sys.stdin.readline
A = int(input())
a = list(map(int, input().split()))
sum1 = 0
for i in range(1,A):
    if a[i-1] == a[i]:
        sum+=1
        a[i] = 0

print(sum1)

import sys  
import numpy as np

input = sys.stdin.readline
A = int(input())
a = list(map(int, input().split()))
sum1 = 0
for i in range(1,A):
    if a[i-1] == a[i]:
        sum1+=1
        a[i] = 0

print(sum1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
N = int(input())
a = input().split()
li = []
s = 1
for i in range(1,N):
    if a[i] != a[i-1]:
        li.append(s)
        s = 1
        continue
    if a[i] == a[i-1]:
        s +=1
if s != '':
    li.append(s)
n = len(li)
ans = 0
print(li)
for i in range(n):
    l = li[i]
    ans += l//2
print(ans)

#template
def inputlist(): return [int(j) for j in input().split()]
#template
N = int(input())
a = input().split()
li = []
s = 1
for i in range(1,N):
    if a[i] != a[i-1]:
        li.append(s)
        s = 1
        continue
    if a[i] == a[i-1]:
        s +=1
if s != '':
    li.append(s)
n = len(li)
ans = 0
for i in range(n):
    l = li[i]
    ans += l//2
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
import math
N = int(input())
A = list(map(int,input().split()))
result = 0
B = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    B +=1
  else:
    result += int(B/2)
    B = 0
if A[-1] == A[-2]:
  B+=1
  result += int(B/2)
else:
  result += int(B/2)
print(result)

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
ans=0
cnt=1
for i in range(n):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        ans+=cnt/2
        cnt=1
print(cnt)


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


Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
import random as rd
a = int(input())
b = rd.sample(list(range(0, 10001)), k=a)
print(b)
c = print(a//2)

import random as rd
a = int(input())
b = rd.sample(list(range(1, 10001)), k=a)
print(b)
result = 0
for num in range(0, len(b)-1):
    if b[num] == b[num+1]:
        result = result+1

print(result)

N = int(input())
A = [int(i) for i in input().split()]
ans = 0
now = 1

for i in range(N-1):
    if A[i] == A[i+1]:
        now += 1
    else:
        ans += now//2
        now = 1
print(ans + now//2)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
T  = int(input())
def gcd(a,b):
 if b==0: return a
 return gcd(b, a%b)
for _ in range(T):
 a,b,c,d =list( map(int, input().split()) )
 a %= b
 d%=b
 d = gcd(d,b)
 if c>= b:
  print('Yes')
  continue
 x = (b-a)//d
 y = a+ x*d
 if y == b: y-=d
 if y>=c:
  print('No')
 else:
  print('Yes')

T  = int(input())
def gcd(a,b):
    if b==0: return a
    return gcd(b, a%b)
for _ in range(T):
    a,b,c,d =list( map(int, input().split()) )
    if a<b or d<b:
        print('No')
        continue
    a %= b
    d%=b
    d = gcd(d,b)
    if c>= b:
        print('Yes')
        continue
    x = (b-a)//d
    y = a+ x*d
    if y == b: y-=d
    if y>c:
        print('No')
    else:
        print('Yes')


N  = int(input())
za = list( map(int, input().split()) )
res = 0
for i in range(1,N):
 if za[i]==za[i-1]:
  za[i] = -1
  res+=1

print(res)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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


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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
pre_a = 0
cont = 0
ans = 0

for a in input().split():
	if pre_a == a:
		cont += 1
	else:
		ans += cont // 2
		cont = 1
	pre_a = a

print(ans)

N = int(input())
pre_a = 0
cont = 0
ans = 0

for a in input().split():
	if pre_a == a:
		cont += 1
	else:
		ans += cont // 2
		cont = 1
	pre_a = a
else:
	ans += cont // 2

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
A = list(map( int, input().split()) )
from collections import defaultdict
d = defaultdict(int)

lst = []
i = 0
while i <= N-2:
  a = A[i]
  cnt = 1
  for j in range(i+1, N):
    if a == A[j]:
      cnt += 1
    else:
      break
  lst.append(cnt)
  print(i,j)
  i = j
  


# print(lst)

ans = 0
def kf(x):
  if x  == 1:
    return 0
  elif x == 0:
    return 0
  elif x % 2 == 1:
    return x//2
  elif x % 2 == 0:
    return x//2
for k in lst:
  ans += kf( k )
print(ans)

N = int(input())
A = list(map( int, input().split()) )
from collections import defaultdict
d = defaultdict(int)

lst = []
i = 0
while i <= N-2:
  a = A[i]
  cnt = 1
  for j in range(i+1, N):
    if a == A[j]:
      cnt += 1
    else:
      break
  lst.append(cnt)
  #print(i,j)
  i = j
  


# print(lst)

ans = 0
def kf(x):
  if x  == 1:
    return 0
  elif x == 0:
    return 0
  elif x % 2 == 1:
    return x//2
  elif x % 2 == 0:
    return x//2
for k in lst:
  ans += kf( k )
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

for i in range(1, n+1):
    str_i = str(i)
    s = s.replace(str_i+" "+str_i, str_i)

print(n-len(s))

n = int(input())
s = tuple(map(int, input().split(" ")))

count = 0
before = None
for s_i in s:
    if before == s_i:
        count += 1
        before = None
    else:
        before = s_i
print(count)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
from sys import stdin


def get(l, r):
    for i in range(1, 10001):
        if i != l and i != r:
            return i
    assert False, 'damepo'


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]
    count = 0
    for i, x in enumerate(a[1:-1]):
        idx = i + 1
        l = a[idx - 1]
        r = a[idx + 1]
        if (l == x and x != r) or (l == x == r) or ((idx == len(a) - 2) and x == r):
            x = get(l, r)
            count += 1
            a[idx] = x
    print(a)
    print(count)


if __name__ == '__main__':
    main()


from sys import stdin


def get(l, r):
    for i in range(1, 10001):
        if i != l and i != r:
            return i
    assert False, 'damepo'


def check(a):
    for i, x in enumerate(a[1:-1]):
        idx = i + 1
        l = a[idx - 1]
        r = a[idx + 1]
        assert l != x and x != r, 'damepo'


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]
    check(a)
    count = 0
    for i, x in enumerate(a[1:-1]):
        idx = i + 1
        l = a[idx - 1]
        r = a[idx + 1]
        if (l == x and x != r) or (l == x == r) or ((idx == len(a) - 2) and x == r):
            x = get(l, r)
            count += 1
            a[idx] = x
    # print(a)
    print(count)


if __name__ == '__main__':
    main()


from sys import stdin


def get(l, r):
    for i in range(1, 10001):
        if i != l and i != r:
            return i
    assert False, 'damepo'


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]

    count = 0
    if N == 2:
        if a[0] == a[1]:
            count += 1
    else:
        for i, x in enumerate(a[1:-1]):
            idx = i + 1
            l = a[idx - 1]
            r = a[idx + 1]
            if (l == x and x != r) or (l == x == r) or ((idx == len(a) - 2) and x == r):
                x = get(l, r)
                count += 1
                a[idx] = x
        # print(a)
    print(count)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n+1):
  if i==0 or i==n & a[i-1] != a[i]:
    if i!=0:
      ans += cnt // 2
    cnt = 1
  else:
    cnt += 1
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
import random

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

cnt = 0
C = set(range(1, N + 1))
for idx in range(1, N - 1):

    B = set([A[idx - 1:-1][0], A[idx:][0], (A[idx + 1:] + [-1])[0]])
    D = sorted(list(C - B))

    if len(B) != 3:
        cnt += 1
        A[idx] = random.choice(D)

print(cnt)


import random

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

cnt = 0
C = set(range(1, N + 1))
idx = 1
while idx < N:

    B = (A[idx - 1:-1][0], A[idx:][0], (A[idx + 1:] + [-1])[0], )
    DS = C - set(B)
    D = sorted(DS)

    if B[0] == B[1] or B[1] == B[2]:
        cnt += 1
        A[idx] = random.choice(D)
        idx += 1

    idx += 1

    print('A: {}'.format(A))

print(cnt)


import random

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

ch = A[0]
cnt = 1
R = 0
for i in range(1, N):
    
    if ch != A[i]:
        R += cnt // 2
        cnt = 1
        ch = A[i]
    else:
        cnt += 1

R += cnt // 2

print(R)



Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
N = int(input())
S = [input() for _ in range(N)]
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N, 2)])
print(s)

N = int(input())
S = input().split(' ')
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N-1, 2)])
s -= sum([S[i-1]== S[i] == S[i+1] for i in  range(2, N, 2)])
print(s, flush=True)

N = int(input())
S = input().split()
s = 0
for i in range(1, N):
	if S[i-1] == S[i]:
		S[i] = N + 1000000000
		s += 1
	
print(s, flush=True)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
n  = int(input())
a = map(int, [input() for i in range(n)])

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

t = int(input())
a, b, c, d = map(int, input().split())
for i in range(t):
    if a>=b and c >=b and d>=b:
        print("Yes")
    else:
        print("No")

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

ans = 0
for i in range (n-1):
    if a[i] == a[i+1]:
        a[i+1] = -1
        ans += 1
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

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


Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
5
1 1 1 1 1n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=0
c=[]
for i in range(1,n):
  if l[i]==a:
    b+=1
  else:
    c.append(b)
    b=0
  a=l[i]
c.append(b)
for i in range(len(c)):
  c[i]=(c[i]+1)//2
print(sum(c))

n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=0
c=[]
for i in range(1,n):
  if l[i]==a:
    b+=1
  else:
    c.append(b)
    b=0
  a=l[i]
c.append(b)
for i in range(len(c)):
  c[i]=(c[i]+1)//2
print(sum(c))

Verdicts: Runtime Error

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

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

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

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):
_ = input()
slime = list(map(int,input().split()))
tmp = 0
con = 1
li = []
for s in slime:
    if tmp == s:
        con += 1
    else:
        if con != 1:
            li.append(con)
            con = 1
    tmp = s
print(sum([l//2 for l in li]))

_ = input()
slime = list(map(int,input().split()))
tmp = 0
con = 1
li = []
for s in slime:
    if tmp == s:
        con += 1
    else:
        if con != 1:
            li.append(con)
            con = 1
    tmp = s
else:
    if con != 1:
        li.append(con)
print(sum([l//2 for l in li]))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.  Takahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i. If two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.  Takahashi can change the color of one slime to any of the 10000 colors by one spell. How many spells are required so that no slimes will start to combine themselves?

Submission attempts (in order):


#A > B
#D % B >= B - C

size = int(input())
data = []
flag = 0

for i in range(size):
    ip = input().split()
    data = []
    for j in ip:
        data.append(int(j))
    
    buf = []

    
    data[0] = data[0] % data[1]
    if data[0] > data[3]:
        flag = 1
    
    while data[0] not in buf:
        buf.append(data[0])
        data[0] = (data[0] + data[3]) % data[1]
        if data[0] > data[3]:
            flag = 1
            break
 
    if flag == 1:
        print("No")
        flag = 0
    else:
        print("Yes")


input()
ip = input().split()
data = []
for i in ip:
    data.append(int(i))

buf = -1
enc = 0
for i in data:
    if buf == i:
        enc += 1
        buf = -1
    else:
        buf = i

print(enc)

Verdicts: Runtime Error

Accepted