Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

s = input()

ans = []
k = s.find("LR")
while k!=-1:
    t = s[:k+1]
    a = [0]*(k+1)
    numR = t.count("R")
    numL = k+1-numR
    l = numR-1
    a[l] = (numR+1)//2 + (numL)//2
    a[l+1] = (numR)//2 + (numL+1)//2
    ans = ans + a
    s = s[k+1:]
    k = s.find("LR")

a = [0]*len(s)
numR = s.count("R")
numL = len(s)-numR
l = numR-1
a[l] = (numR+1)//2 + (numL)//2
a[l+1] = (numR)//2 + (numL+1)//2
ans = ans + a
print(" ".join(list(map(str, ans))))

### FIXED CODE ###

s = input()
l = len(s)
ans = [0]*l
count = 0
for i in range(l):
    if s[i]=="R" and s[i+1]=="R":
        count += 1
    elif s[i]=="R" and s[i+1]=="L":
        count += 1
        ans[i] += (count+1)//2
        ans[i+1] += count//2
        count = 0
for i in reversed(range(l)):
    # print(i)
    # print(s[i])
    if s[i]=="L" and s[i-1]=="L":
        count += 1
    elif s[i]=="L" and s[i-1]=="R":
        count += 1
        ans[i] += (count+1)//2
        ans[i-1] += count//2
        count = 0
print(" ".join(map(str, ans)))
### BUGGY CODE ###

from fractions import gcd
def lcm(p,q):
    return p*q//gcd(p,q)
n,m = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
    a[i] = a[i]//2
    x = lcm(x,a[i])
for i in range(n):
    if (x//a[i])%2==0:
        print(0)
        exit()
p = m//x
print(p//2 if p%2==0 else p//2+1)

### FIXED CODE ###

from fractions import gcd
def lcm(p,q):
    return p*q//gcd(p,q)
n,m = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
    a[i] = a[i]//2
    x = lcm(x,a[i])
for i in range(n):
    if (x//a[i])%2==0:
        print(0)
        exit()
p = m//x
print(p//2 if p%2==0 else p//2+1)
### BUGGY CODE ###


def main():
    n =int( input())

    cnt=dict()
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    a = [k for k, v in cnt.items() if v == max(cnt.values())]


    a.sort()
    for elm in a:
        print(elm)

main()



### FIXED CODE ###

def main():
    n =int( input())

    cnt=dict()
    
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    num = 0
    res =[]
    for key,value in cnt.items():
        #print(key,":::",value)
        if value > num:
            num=value
            res=[]
            res.append(key)

        elif value==num:
            res.append(key)

    #print("res::",res)

    
    #a = [k for k, v in cnt.items() if v == max(cnt.values())]


    #print("結果発表：：：：",len(res))
    res.sort()
    for elm in res:
        print(elm)


main()
### BUGGY CODE ###

def make_ps(n):
    tbl = [False, True, False, False, False, True] * (n // 6 + 1)
    for i in range(1, 4):
        tbl[i] = not tbl[i]
    p, stp, sqrt = 5, 2, n ** 0.5
    while p < sqrt:
        for i in range(p ** 2, n, 2 * p):
            tbl[i] = False
        while True:
            p += stp
            stp = 6 - stp
            if tbl[p]:
                break
    return [i for i in range(n) if tbl[i]]
ps = make_ps(50000)
while True:
    n = int(input())
    if not n:
        break
    res = 0
    if n % 2:
        if n - 2 in ps:
            res += 1
    else:
        res = 0
        for p in ps:
            if p > n / 2:
                break
            if n - p in ps:
                res += 1
    print(res)

### FIXED CODE ###

def make_tbl(n):
    tbl = [False, True, False, False, False, True] * (n // 6 + 1)
    for i in range(1, 4):
        tbl[i] = not tbl[i]
    p, stp, sqrt = 5, 2, n ** 0.5
    while p < sqrt:
        for i in range(p ** 2, n, 2 * p):
            tbl[i] = False
        while True:
            p += stp
            stp = 6 - stp
            if tbl[p]:
                break
    return tbl
tbl = make_tbl(50000)
ps = [i for i in range(50000) if tbl[i]]
while True:
    n = int(input())
    if not n:
        break
    res = 0
    if n % 2:
        if tbl[n - 2]:
            res += 1
    else:
        res = 0
        for p in ps:
            if 2 * p > n:
                break
            if tbl[n - p]:
                res += 1
    print(res)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    N, K, C = map(int, input().split())
    S = input()

    end = len(S)
    fullbit = (1 << end) - 1

    ans = [None]

    def search(i, bit, cnt):
        if cnt == 0:
            if ans[0] is None:
                ans[0] = fullbit
            ans[0] &= bit
            return
        if i >= end:
            return
        search(i + 1, bit, cnt)
        if S[i] == 'x':
            return
        search(i + C + 1, bit | (1 << i), cnt - 1)

    search(0, 0, K)
    if ans[0] is not None:
        for i in range(N):
            if (ans[0] & (1 << i)) != 0:
                print(i + 1)


main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    N, K, C = map(int, input().split())
    S = input()

    def forward(k):
        i = 0
        day = 0
        days = [-1] * k
        l = len(S)
        while day < k and i < l:
            while S[i] == 'x':
                i += 1
                if i >= l:
                    return None
            days[day] = i
            day += 1
            i += 1 + C
        if day < k:
            return None
        return days

    def backward(k):
        day = k
        days = [-1] * k
        l = len(S)
        i = l - 1
        while day > 0 and i >= 0:
            while S[i] == 'x':
                i -= 1
                if i < 0:
                    return None
            day -= 1
            days[day] = i
            i -= (1 + C)
        if day > 0:
            return None
        return days

    left = forward(K)
    if left is None:
        return

    right = backward(K)
    for i, j in zip(left, right):
        if i == j:
            print(i + 1)

main()
### BUGGY CODE ###

n = int(input())
strings = []
num = []
answer = 0
for i in range(n):
  string = input()
  string = ''.join(sorted(string))
  if string not in strings:
    strings.append(string)
    num.append(0)
  else:
    hoge = num[strings.index(string)] = num[strings.index(string)] + 1
    answer = answer + hoge
print(answer)

### FIXED CODE ###

n = int(input())
strings = {}
answer = 0
for i in range(n):
  string = input()
  string = ''.join(sorted(string))
  if string not in strings:
    strings[string]=1
  else:
    answer += strings[string]
    strings[string] += 1
print(answer)
### BUGGY CODE ###

from heapq import heappop, heappush 
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    
    def dijkstra():
        def toId(x, y, v): return (x*(w+2)+y)*4 + v

        def modCeil(x): return x + (-x)%k

        def push(x, y, v, cost):
            nId = toId(x, y, v)
            if dp[nId] > cost:
                dp[nId] = cost
                heappush(que, (cost, nId))

        inf = 1e18

        dp = [inf]*(h+2)*(w+2)*4
        dp[toId(xs, ys, 0)] = 0

        que = [(0, toId(xs, ys, 0))]
        dx = [-1, 0, 1, 0]
        dy = [0, 1, 0, -1]
        while que:
            cost, Id = heappop(que)
            x = Id//4//(w+2)
            y = Id//4%(w+2)
            v = Id%4

            if cost > dp[Id]:
                continue
            
            for nv in range(4):
                push(x, y, nv, modCeil(cost))
            
            nx, ny = x+dx[v], y+dy[v]
            if field[nx][ny]:
                push(nx, ny, v, cost+1)

        ans = inf
        for v in range(4):
            ans = min(ans, dp[toId(xg, yg, v)])
        if ans == inf:       
            return -1
        return modCeil(ans)//k

    h, w, k= map(int, input().split())
    xs, ys, xg, yg = map(int, input().split())
    field = [[False]*(w+2)]
    for _ in range(h):
        s = [False]
        s += [True if i == '.' else False for i in input()]
        s += [False]
        field.append(s)
    field.append([False]*(w+2))
    ans = dijkstra()
    print(ans)




if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()

def main():
    
    h, w, k = map(int, input().split())
    xs, ys, xg, yg = map(lambda x: int(x)-1, input().split())
    field = [input() for _ in range(h)]

    inf = 1e7

    dist = [[inf]*w for _ in range(h)]
    dist[xs][ys] = 0
    que = deque([(xs, ys)])
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    while que:
        x, y = que.popleft()
        for i in range(4):
            nx, ny = x, y
            for _ in range(k):
                nx += dx[i]
                ny += dy[i]
                if nx < 0 or nx >= h or ny < 0 or ny >= w: break
                if field[nx][ny] == '@' or dist[nx][ny] <= dist[x][y]: break
                if dist[nx][ny] > dist[x][y] + 1:
                    dist[nx][ny] = dist[x][y] + 1
                    que.append((nx, ny))
        
    if dist[xg][yg] == inf:
        print(-1)
    else:
        print(dist[xg][yg])
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,W=map(int,input().split())
wv=[[0,0]]+[list(map(int,input().split())) for _ in range(N)]

dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1,N+1):
    for j in range(W+1):
        dp[i][j]=dp[i-1][j]
        if j - wv[i][0] >= 0:
            dp[i][j]=max(dp[i][j],dp[i-1][j-wv[i][0]]+wv[i][1])

            
print(max(dp[N]))


### FIXED CODE ###

N,W=map(int,input().split())
wv=[[0,0]]+[list(map(int,input().split())) for _ in range(N)]

dp=[[10**11+1 for i in range(100*10**3+1)] for j in range(N+1)]

dp[0][0]=0

for i in range(1,N+1):
    for j in range(100*10**3+1):
        dp[i][j]=dp[i-1][j]
        if j - wv[i][1] >= 0:
            dp[i][j]=min(dp[i][j],dp[i-1][j-wv[i][1]]+wv[i][0])

            
res=0
for i in range(100*10**3+1):
    if dp[N][i]<=W:
        res=i
            
print(res)
### BUGGY CODE ###

N = int(input())
S = list(map(int, list(input())))

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x == 3:
                        cnt += 1
                        break

print(cnt)

### FIXED CODE ###

N = int(input())
S = list(map(int, list(input())))

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x == 3:
                        cnt += 1
                        break

print(cnt)
### BUGGY CODE ###

# coding: utf-8
# Your code here!

n=int(input())
S=input()
l=list("0123456789")

ret=[False]*1000
for i in (l):
    for j in (l):
        for k in (l):
            flg1=flg2=False
            for s in S:
                if s==i and not flg1:
                    flg1=True
                    continue
                if flg1 and s==j and not flg2:
                    flg2=True
                    continue
                if flg2 and s==k:
                    tmp=int(i+j+k)
                    # print(tmp)
                    ret[tmp]=True
                    break
          
print(sum(ret))

### FIXED CODE ###

# coding: utf-8
# Your code here!

n=int(input())
S=input()
l=list("0123456789")

ret=[False]*1000
for i in (l):
    for j in (l):
        for k in (l):
            flg1=flg2=False
            for s in S:
                if s==i and not flg1:
                    flg1=True
                    continue
                if flg1 and s==j and not flg2:
                    flg2=True
                    continue
                if flg2 and s==k:
                    tmp=int(i+j+k)
                    # print(tmp)
                    ret[tmp]=True
                    break
          
print(sum(ret))
### BUGGY CODE ###

N, M, K = map(int, input().split())
 
ab = [list(map(int, input().split())) for _ in range(M)]
cd = [list(map(int, input().split())) for _ in range(K)]
 
lstab = [[] for _ in range(N)]
lstcd = [[] for _ in range(N)]
ans = [[] for _ in range(N)]
 
for a,b in ab:
    lstab[a-1].append(b-1)
    lstab[b-1].append(a-1)
 
    
for c,d in cd:
    lstcd[c-1].append(d-1)
    lstcd[d-1].append(c-1)
 
groups = []
visiteds = [0]*N
 
for i in range(N):
    if visiteds[i] == 1:continue
    
    temp = [i]
    visited = [i]
 
    while temp:
        x = temp.pop()
        for y in lstab[x]:
            if visiteds[y] == 1:continue
            temp.append(y)
            visited.append(y)
            visiteds[y] = 1
    groups.append(visited)
 
ans = [0]*N
for grp in groups:
    for j in grp:
        ans[j] = len(set(grp) - {j} - set(lstcd[j]) - set(lstab[j]))
 
print(*ans)

### FIXED CODE ###

import sys
from collections import Counter
input = sys.stdin.readline

N, M, K = map(int, input().split())
 
lstab = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    lstab[a-1].append(b-1)
    lstab[b-1].append(a-1)

visited = [0] * N
cnt = 0

for i in range(N):
    if visited[i] != 0: continue
    temp = [i]
    cnt += 1
    visited[i] = cnt
 
    while temp:
        x = temp.pop()
        for y in lstab[x]:
            if visited[y] != 0:continue
            temp.append(y)
            visited[y] = cnt

numcd = [ 0 ] * N
for _ in range(K):
    c, d = map(int, input().split())
    if visited[c-1] == visited[d-1]:
        numcd[c-1] += 1
        numcd[d-1] += 1    
    
ans = [0] * N
cnt = Counter(visited)

for i in range(N):
    ans[i] = cnt[visited[i]] - 1 - len(lstab[i]) - numcd[i]
 
print(*ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
 
def main(N, S):
    total = N
    for i in range(N):
        total = min(total, S[:i].count("W") + S[i+1:].count("E"))
    print(total)
    
if(__name__ == "__main__"):
    N = int(input())
    S = input()
    
    main(N, S)

### FIXED CODE ###

# -*- coding: utf-8 -*-
 
def main(N, S):
    num_e = S.count("E")
    num_w = 0
    res = num_e
    for s in S:
        if(s=="E"):
            num_e -= 1
        else:
            num_w += 1
        res = min(res, num_e + num_w)
    print(res)
    
if(__name__ == "__main__"):
    N = int(input())
    S = input()
    
    main(N, S)
### BUGGY CODE ###

N,M=map(int,input().split())
num=[int(x) for x in input().split()]
s=[list(map(int,input().split())) for y in range(M)]

for i in range(M):
    num+=s[i][0]*[s[i][1]]

lst=sorted(num)
ans=sum(lst[-N:])

print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
arr=[int(x) for x in input().split()]
s=[list(map(int,input().split())) for y in range(M)]
s.sort(key=lambda z: z[1], reverse=True)

sum_a=0
for a,b in s:
    arr+=[b]*a
    sum_a+=a
    if sum_a>=N:
        break

lst=sorted(arr)
ans=sum(lst[-N:])
print(ans)
### BUGGY CODE ###

N, W = [int(i) for i in input().split()]
w, v = [0]*N, [0]*N
 
for i in range(N):
  w[i], v[i] = [int(_) for _ in input().split()]
  
dp = [[0] * (W+1) for _ in range(N+1)]
# dp[i][j] i番目までの荷物で重さがjを超えないように選んだときの価値の最大値
for i in range(N):
  for j in range(W+1):
    dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    if j + w[i] <= W:
      dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i])
      
print(dp[N][W])

### FIXED CODE ###

N, W = [int(i) for i in input().split()]
w, v = [0]*N, [0]*N
 
for i in range(N):
  w[i], v[i] = [int(_) for _ in input().split()]
  
dp = [[0] * (W+1) for _ in range(N+1)]
# dp[i][j] i番目までの荷物で重さがjを超えないように選んだときの価値の最大値
for i in range(N):
  for j in range(W+1):
    dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    if j + w[i] <= W:
      dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i])
      
print(dp[N][W])
### BUGGY CODE ###

H, W, M = map(int, input().split())
HW_L = [[int(x)-1 for x in input().split()] for y in range(M)]

w_l = [0] * W
h_l = [0] * H

for _hi, _wi in HW_L:
    w_l[_wi] += 1
    h_l[_hi] += 1

h_idx = [i for i, x in enumerate(h_l) if x == max(h_l)]
w_idx = [i for i, x in enumerate(w_l) if x == max(w_l)]

for hi in h_idx:
    for wj in w_idx:
        if [hi, wj] in HW_L:
            continue
        else:
            print(max(h_l) + max(w_l))
            exit(0)

print(max(h_l) + max(w_l)-1)


### FIXED CODE ###

H, W, M = map(int, input().split())
HW_L = set(tuple(int(x)-1 for x in input().split()) for y in range(M))

w_l = [0] * W
h_l = [0] * H

for _hi, _wi in HW_L:
    w_l[_wi] += 1
    h_l[_hi] += 1

max_h = max(h_l)
max_w = max(w_l)

h_idx = [i for i, x in enumerate(h_l) if x == max_h]
w_idx = [i for i, x in enumerate(w_l) if x == max_w]

ans = max_h + max_w - 1

for hi in h_idx:
    for wj in w_idx:
        if (hi, wj) not in HW_L:
            ans = max_h + max_w
            break
    else:
        continue
    break

print(ans)
### BUGGY CODE ###

n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for _ in [0]*m]
q=int(input())
st=[list(map(int,input().split())) for _ in [0]*q]
inf=10**12
dist=[[inf]*n for _ in [0]*n]
for i in range(n):
    dist[i][i]=0
for a,b,c in abc:
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
inf=10**3
dist2=[[inf]*n for _ in [0]*n]
for i in range(n):
    for j in range(n):
        if dist[i][j]<=l:
            dist2[i][j]=1
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j])
for i in range(n):
    for j in range(n):
        if dist2[i][j]==inf:
            dist2[i][j]=-1
        else:
            dist2[i][j]-=1
for s,t in st:
    print(dist2[s-1][t-1])

### FIXED CODE ###

n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for _ in [0]*m]
q=int(input())
st=[list(map(int,input().split())) for _ in [0]*q]
inf=10**12
dist=[[inf]*n for _ in [0]*n]
for i in range(n):
    dist[i][i]=0
for a,b,c in abc:
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
inf=10**3
dist2=[[inf]*n for _ in [0]*n]
for i in range(n):
    for j in range(n):
        if dist[i][j]<=l:
            dist2[i][j]=1
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist2[i][j]=min(dist2[i][j],dist2[i][k]+dist2[k][j])
for i in range(n):
    for j in range(n):
        if dist2[i][j]==inf:
            dist2[i][j]=-1
        else:
            dist2[i][j]-=1
for s,t in st:
    print(dist2[s-1][t-1])
### BUGGY CODE ###

import bisect
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
x1 = comb(n, lst[a])
x2 = comb(n, lst[a-1])
if x1 > x2:
    print(n, lst[a])
else:
    print(n, lst[a-1])

### FIXED CODE ###

import bisect
import math
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
if abs(math.ceil(n/2)-lst[a]) >= abs(math.ceil(n/2)-lst[a-1]):
    print(n, lst[a-1])
else:
    print(n, lst[a])
### BUGGY CODE ###

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

ans=0
for i in range(n-1,-1,-1):
#    print(i)
    for j in range(i,n):
        if j==i:
            tmp=h[j]
            sec=0
        else:
            if tmp<h[j]:
                break
            else:
                tmp=h[j]
                sec+=1
                
    ans=max(ans,sec)
            
print(ans)
    

### FIXED CODE ###

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

ans=0

for i in range(n):
    if i==0:
        rightsec=0
    else:
        if h[i-1]>=h[i]:
            rightsec+=1
        else:
            ans=(max(rightsec,ans))
            rightsec=0
            
print(max(ans,rightsec))
### BUGGY CODE ###

n = int(input())
s = input()

# r_num = [0 for i in range(n)]
# g_num = [0 for i in range(n)]
# b_num = [0 for i in range(n)]

nums = [[0 for i in range(n)] for j in range(3)]

ans = 0

befs = [0 for i in range(3)]
for i in range(n):
    if s[i] == "R":
        befs[0] += 1
    elif s[i] == "G":
        befs[1] += 1
    else:
        befs[2] += 1
    for j in range(3):
        nums[j][i] = befs[j]

vac = [[-1,2,1],
       [2,-1,0],
       [1,0,-1]]
tr = {"R":0,"G":1,"B":2}

for i in range(n):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        else:
            v1 = tr[s[i]]
            v2 = tr[s[j]]
            nex = vac[v1][v2]
            # print(nex)
            tp = nums[nex][-1]-nums[nex][j+1]
            if tr[s[j+1]] == nex:
                tp += 1
            if j+j-i <= n-1 and tr[s[j+j-i]] == nex:
                tp -= 1
            ans += tp

print(ans)


### FIXED CODE ###

n = int(input())
s = input()

# r_num = [0 for i in range(n)]
# g_num = [0 for i in range(n)]
# b_num = [0 for i in range(n)]

nums = [[0 for i in range(n)] for j in range(3)]

ans = 0

befs = [0 for i in range(3)]
for i in range(n):
    if s[i] == "R":
        befs[0] += 1
    elif s[i] == "G":
        befs[1] += 1
    else:
        befs[2] += 1
    for j in range(3):
        nums[j][i] = befs[j]

vac = [[-1,2,1],
       [2,-1,0],
       [1,0,-1]]
tr = {"R":0,"G":1,"B":2}

for i in range(n):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        else:
            v1 = tr[s[i]]
            v2 = tr[s[j]]
            nex = vac[v1][v2]
            # print(nex)
            tp = nums[nex][-1]-nums[nex][j+1]
            if tr[s[j+1]] == nex:
                tp += 1
            if j+j-i <= n-1 and tr[s[j+j-i]] == nex:
                tp -= 1
            ans += tp

print(ans)
### BUGGY CODE ###

# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,m = map(int,input().split())
rows = [int(input()) for _ in range(m)]

mod = 1000000007

dp=[0 for _ in range(n+1)]

dp[0]=1
for now in range(n):
    for next in range(now+1,min(n,now+2)+1):
        if not next in rows:
            dp[next] += dp[now]
            dp[next] %= mod

print(dp[n])
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



### FIXED CODE ###

# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,m = map(int,input().split())
stair = [True for _ in range(n+1)]
for _ in range(m):
    broken = int(input())
    stair[broken] = False

mod = 1000000007

dp=[0 for _ in range(n+1)]

dp[0]=1
for now in range(n):
    for next in range(now+1,min(n,now+2)+1):
        if stair[next]:
            dp[next] += dp[now]
            dp[next] %= mod

print(dp[n])
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する