Problem:


Score : 200 points

Problem Statement

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?

Constraints

2 \leq N \leq 100

1 \leq a_i \leq N

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the minimum number of spells required.

Sample Input 1

5
1 1 2 2 2

Sample Output 1

2

For example, if we change the color of the second slime from the left to 4, and the color of the fourth slime to 5, the colors of the slimes will be 1, 4, 2, 5, 2, which satisfy the condition.

Sample Input 2

3
1 2 1

Sample Output 2

0

Although the colors of the first and third slimes are the same, they are not adjacent, so no spell is required.

Sample Input 3

5
1 1 1 1 1

Sample Output 3

2

For example, if we change the colors of the second and fourth slimes from the left to 2, the colors of the slimes will be 1, 2, 1, 2, 1, which satisfy the condition.

Sample Input 4

14
1 2 2 3 3 3 4 4 4 4 1 2 3 4

Sample Output 4

4



Sample input:
5
1 1 2 2 2


Sample output:
2

Submission status: Wrong Answer

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

ans = 0
cur = 99999999
for i in range(N-2):
    if A[i] == A[i+1] == A[i+2]:
        ans+=1
        A[i+1] = cur
        cur -= 1
    elif A[i] == A[i+1]:
        ans+=1
        A[i+1] = cur
        cur -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
A = IL()

ans = 0
count = 0
prev = None

for a in A:
  now = a
  if prev != now:
    ans += count//2
    count = 1
  else:
    count += 1
  prev = a
  
print(ans)

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    before = -1
    cnt = 0
    ans = 0
    for a in A:
        cnt += 1
        if(before != a):
            ans += cnt//2
            cnt = 0
        before = a
    if(cnt):
        ans += cnt//2
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if a[i]==a[i-1] and a[i]<9990:
        if a[i]+1==a[i+1]:
            a[i]+=2
            ans+=1
        else:
            a[i]+=1
            ans+=1
    elif a[i]==a[i-1]:
        if a[i]-1==a[i+1]:
            a[i]-=2
            ans+=1
        else:
            a[i]-=2
            ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if a[i]==a[i-1] and a[i]<9999:
        if a[i]+1==a[i+1]:
            a[i]+=2
            ans+=1
        else:
            a[i]+=1
            ans+=1
    elif a[i]==a[i-1]:
        if a[i]-1==a[i+1]:
            a[i]-=2
            ans+=1
        else:
            a[i]-=2
            ans+=1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(str, input().split()))
s = ''.join(a)

# ランレングス圧縮
def rle(s):
    tmp, count, ans = s[0], 1, ""
    for i in range(1, len(s)):
        if tmp == s[i]:
            count += 1
        else:
            ans += tmp + str(count)
            tmp = s[i]
            count = 1
    ans += tmp + str(count)
    return ans

rle = rle(s)
cnt = 0
for i in range(len(rle)):
    if i % 2 == 1:
        cnt += int(rle[i]) // 2

print(cnt)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
if n==2 and a[0]==a[1]:
    print(1)
    exit()
if n==3 and (a[0]==a[1] or a[1]==a[2]):
    print(1)
    exit()
for i in range(n-2):
    if a[i]==a[i+1]:
        a[i+1]=-1
        ans+=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
# Problem A - Colorful Slimes 2

# input process
N = int(input())
a_list = list(map(int, input().split()))

# initialization
even_count = 0
odd_count = 0

# count process
for i in range(N):
    if i%2==0: # odd count
        if i-1>=0:
            if a_list[i]==a_list[i-1]:
                odd_count += 1
                continue
        if i+1<N:
            if a_list[i]==a_list[i+1]:
                odd_count += 1
    else: # even count
        if i-1>=0:
            if a_list[i]==a_list[i-1]:
                even_count += 1
                continue
        if i+1<N:
            if a_list[i]==a_list[i+1]:
                even_count += 1

ans = min(even_count, odd_count)
print(ans)

Submission status: Wrong Answer

Solution code:
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] = a[i+1] + 3
        ans = ans + 1


print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
dat = list(map(int, input().split()))
p = dat[0]
res = 0
for i in range(1, len(dat)):
    if p == dat[i]:
        dat[i] = "x"
        p = "x"
        res += 1
    else:
        p = dat[i]
print(dat)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
result = 0
if N == 2:
  print(0 if A[0]!=A[1] else 1)
else:
  for i in range(N-2):
    #print(A)
    if A[i] == A[i+1]:
      result += 1
      if A[i+2]!=A[i+1]:
        A[i+1] = abs(A[i+2]-A[i+1])
      elif A[i+2]==A[i+1] and A[i+1]==1:
        A[i+1] = 2
      else:
        A[i+1] = 1
  if A[-3]==A[-2]:
    result +=1
  if A[-1]==A[-2]:
    result +=1
print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
result = 0
if N == 2:
  print(0 if A[0]!=A[1] else 1)
else:
  for i in range(N-2):
    if A[i] == A[i+1]:
      result += 1
      if A[i+2]!=A[i+1]:
        A[i+1] = abs(A[i+2]-A[i+1])
      elif A[i+2]==A[i+1] and A[i+1]==1:
        A[i+1] = 2
      else:
        A[i+1] = 1
  if A[-1]==A[-2]:
    result +=1
print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split( )))
###連続区間に分ける

tmp = a[1]
tmp2 = 1
ans = 0
for i in range(1,n):
    if a[i]==tmp:
        tmp2 += 1
    else:
        tmp = a[i]
        ans += tmp2//2
        tmp2 = 1
ans += tmp2//2
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.append(0)
cnt=0
for i in range(n-1):
    if a[i]==0:
        break
    if (i+1)%2==0:
        if a[i]==a[i-1] or a[i]==a[i+1]:
            cnt+=1
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.append(0)
cnt=0
for i in range(n):
    if (i+1)%2==0:
        if a[i]==a[i-1] or a[i]==a[i+1]:
            cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
*a, = map(int, input().split())

current = a[0]
a.append(-1)
ans = 0
for i in range(1, len(a)):
    if current == a[i]:
        ans += 1
        current = -1
    else:
        current = a[i]
print(ans)

Submission status: Wrong Answer

Solution code:
u = int(input())
A = list(map(int,input().split()))
count = 0
for a in range(u-1):
  a = A.pop()
  if a == A[-1]:
    A[0] = -1
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
befor = a[0]
for i in range(1,n-1):
    after = a[i+1]
    if a[i] == befor:
        ans += 1
        for j in range(1,10001):
            if j != after:
                a[i] = j
                break
    befor = a[i]

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a_L = list(map(int,input().split()))

tmp_num = -1
result_L = []
counter = 0
for val in range(n):
    #print(tmp_num,a_L[val])

    if tmp_num == a_L[val]:
        counter += 1
    if tmp_num != a_L[val] and counter != 0:
        counter +=1
        result_L.append(counter)
        #print("a",tmp_num,a_L[val],counter)
        counter = 0

    tmp_num = a_L[val]

if counter != 0:
    result_L.append(counter)


#print(result_L)
result_L = [i//2 for i in result_L]


print(sum(result_L))

Submission status: Wrong Answer

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

ans = 0
pr = -1
for i in range(1, N - 1):
    if A[i - 1] == A[i]:
        ans += 1
        A[i] = pr
        pr -= 1

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(1, N - 1):
    if A[i - 1] == A[i]:
        ans += 1
        A[i] = max(A[i - 1], A[i + 1]) + 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
counter = 0

for i in range(len(a)-1):
    if a[i]==a[i+1] and i == len(a)-2 and counter == 0:
        count += int((i+1-counter)//2)+1
    elif a[i]!=a[i+1] or i == len(a)-2:
        count += int((i+1-counter)//2)
        counter = i + 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
counter = 0

for i in range(len(a)-1):
    if a[i]==a[i+1] and i == len(a)-2:
        count += int((i+1-counter)//2)+1
    elif a[i]!=a[i+1] or i == len(a)-2:
        count += int((i+1-counter)//2)
        counter = i + 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
counter = 0

for i in range(len(a)-1):
    if a[i]!=a[i+1] or i == len(a)-2:
        count += int((i+1-counter)//2)
        counter = i + 1
        
print(count)

Submission status: Wrong Answer

Solution code:
s=l=c=0
for a in open(0).read().split()+[0]:
 if a!=l:l=a;s+=c//2;c=0
 c+=1
print(s)

Submission status: Wrong Answer

Solution code:
# 2019/09/03

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())
slime = [int(x) for x in input().split()]
border = [i for i in range(n-1) if slime[i] != slime[i+1]]

# 境界がない = すべて同じ色のスライムが並んでいる
if border:
  border.append(n)
  count = sum([(border[i+1] - border[i]) // 2 for i in range(len(border) - 1)])
else:
  count = n // 2

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
slime = [int(x) for x in input().split()]

pre = slime[0]
border = [i for i in range(n-1) if slime[i] != slime[i+1]]

# 境界がない = すべて同じ色のスライムが並んでいる
if border:
  count = sum([(border[i+1] - border[i]) // 2 for i in range(len(border) - 1)])
else:
  count = n // 2
print(count)

Submission status: Wrong Answer

Solution code:
N = map(int, raw_input().split())[0]
A = map(int, raw_input().split())
kasanari = 1
c = 0
prev = A[0]
for i in range(1,N):
    if A[i]==prev:
        kasanari = kasanari + 1
    else:
        c = c + kasanari/2
        kasanari = 1
c = c + kasanari/2
print(c)

Submission status: Wrong Answer

Solution code:
N = map(int, raw_input().split())[0]
A = map(int, raw_input().split())
kasanari = 1
c = 0
for i in range(1,N):
    print(A[i])
    if A[i]==A[i-1]:
        kasanari = kasanari + 1
    else:
        c = c + kasanari/2
        kasanari = 1
c = c + kasanari/2
print(c)

Submission status: Wrong Answer

Solution code:
N = map(int, raw_input().split())[0]
A = map(int, raw_input().split())
kasanari = 1
c = 0
for i in range(1,N):
    if A[i]==A[i-1]:
        kasanari = kasanari + 1
    else:
        c = c + kasanari/2
        kasanari = 1

print(c)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
print(a)
count = []

flg = 1
for i in range(1,n):
    if a[i] == a[i-1]:
        flg += 1
        
        if i == n-1:
            count.append(flg)
            
    else:
        count.append(flg)
        flg = 1
        i +=1
cnt = 0
print(count)
for j in count:
    cnt += j//2
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = 0
now = a[0]
i = 1
while i < N:
    if now == a[i]:
        ans += 1
        i += 2
        if i >= N-1:
            break
        now = a[i+1]
    else:
        now = a[i]
        i += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

count = 0
for i in range(N-1):
    if a[i] == a[i+1]:
 #       a[i+1] += 1
        count += 1
#        if i < N - 2 and a[i+1] == a[i+2]:
#            a[i+1] += 1
            
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
slime=list(map(int,input().split()))
stack=0
count=0
ans=0
for i in slime:
  if i!=stack:
    stack=i
    ans+=(count+1//2)
    count=0
    continue
  count+=1
  stack=i
ans+=(count+1//2)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
slime=list(map(int,input().split()))
stack=0
count=0
ans=0
for i in slime:
  if i!=stack:
    stack=i
    ans+=(count+1//2)
    count=0
    continue
  count+=1
ans+=(count+1//2)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int,input().split()))
Count = 0
st = 0
for i in range(N-1):
    if a[i] == a[i+1]:
        a[i+1] = 10000 - a[i] - a[i-2]
        Count += 1
print(Count)

Submission status: Wrong Answer

Solution code:
from itertools import groupby

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

ans = 0
for k, v in groupby(A):
  x = len(list(v))
  if(x == N):
    ans = N//2
    break
  if(x == 1):
    continue
  elif(x%2 == 1):
    ans += 1
  else:
    ans += x//2
print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

for a in A:
  d[a] += 1

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 d.keys():
  ans += kf( d[k] )
print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = list(map(int,input().split()))

len_l = len(l)
st = l[0]
count = 1
count_l = []
for i in range(1,len_l):
    if l[i]==st:
        count+=1
    else:
        count_l.append(count//2)
        st = l[i]
        count = 1
print(sum(count_l))

Submission status: Wrong Answer

Solution code:
def main():
    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]=0
            ans+=1
        print(ans)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
if ' '.join([str(x) for x in l])=='1 2 2 3 3 3 4 4 4 4 1 2 3 4':
  exit()
l.append(999)
a=l[0]
l.remove(a)
c=1
l2=[]
for i in l:
  if a==i:
    c+=1
  else:
    if c!=1:
      l2.append(c)
    c=1
  a=i
c2=0
for i in l2:
  c2+=i//2
print(c2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for j in range(n):
    for i in range(n-2):
        if a[i] == a[i+1]:
            a[i+1] = max(a)+1
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
# 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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1]:
        if a[i] == a[i+1]:b+=2
        else:b+=1
        a[i] = -3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1] or a[i]==a[i+1]:
        b+=1
        a[i] = i*(-1)-3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1]:
        b+=1
        a[i] = i*(-1)-3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1]:
        b+=1
        a[i] = i*(-1)
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1]:
        b+=1
        a[i] = -3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i+1]:
        if a[i] == a[i-1]:b+=1
        else:b+=1
        a[i] = -3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
i = 2
while i <=x:
    if a[i] == a[i-1]:
        if a[i] == a[i+1]:b+=1
        else:b+=1
        a[i] = -3
        i+=1
    i+=1
print(b)

Submission status: Wrong Answer

Solution code:
x = int(input())
b =0
a=list(map(int, input().split()))
if x == 2 and a[0]==a[1]:b=1
a.insert(0,-1)
a.append(-1)
a.append(-2)
for i in range(2,x):
    if a[i] == a[i-1]:
        if a[i] == a[i+1]:b+=1
        else:b+=1
        a[i] = -3
print(b)