Harryxun/stf_run huggingface dataset:
S = input()
N = len(S)
c = [1 for _ in range(N)]

dic = {}
freq = 0
start = 0
for i in range(int(N ** 0.5) + 1):
  tmp = [0 for _ in range(N)]
  for j in range(N):
    if j > 0 and S[j - 1] == "R":
      tmp[j] += c[j - 1]
    if j < N - 1 and S[j + 1] == "L":
      tmp[j] += c[j + 1]
  c = tmp
  if str(c) in dic.keys():
    freq = i - dic[str(c)]
    start = dic[str(c)]
    break
  else:
    dic[str(c)] = i

n = start + ((10 ** 100 - start - 1) % freq)
key = [k for k, v in dic.items() if v == n][0]
key = key.replace("[", "").replace("]", "")
k = list(key.split(", "))
for i in range(N):
  print(k[i], end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

### FIXED CODE ###

S = input()
N = len(S)

ans = []
RL = []
s = "R"
flag = False
for i in range(1, N):
  if S[i] == "L" or S[i] == "R" and S[i - 1] == "R":
    s += S[i]
  else:
    RL.append(s)
    s = "R"
RL.append(s)

for rl in RL:
  for i in range(len(rl)):
    if rl[i] == "R" and rl[i + 1] == "L" or rl[i] == "L" and rl[i - 1] == "R":
      if i % 2 == 1:
        ans.append(len(rl) // 2)
      else:
        ans.append((len(rl) + 1) // 2)
    else:
      ans.append(0)

for i in range(N):
  print(ans[i], end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")
# import sys
# sys.stdin = open('d3.in')

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

prefix = [set() for _ in range(n + 1)]
suffix = [set() for _2 in range(n + 1)]

prefix[0] = {0}
for i in range(n):
    for v in prefix[i]:
        if v + a[i] <= k:
            prefix[i+1].add(v + a[i])

suffix[n] = {0}
for i in range(n - 1, -1, -1):
    suffix[i] = set(suffix[i + 1])
    for v in suffix[i + 1]:
        if v + a[i] <= k:
            suffix[i].add(v + a[i])

# Cumulative sums
c_suffix = [[0] * (k+1) for _3 in range(n + 1)]
for i in range(n + 1):
    for j in range(k):
        c_suffix[i][j + 1] = c_suffix[i][j] + (j in suffix[i])


def find(i):
    if k <= a[i]:
        return 0
    for s in prefix[i]:
        start = max(0, k - a[i] - s)
        stop = k - s
        if c_suffix[i + 1][stop] - c_suffix[i + 1][start] > 0:
            return 0
    return 1


res = 0
for i in range(n):
    res += find(i)
print(res)


### FIXED CODE ###

from math import sqrt

x = int(input())
n = int(sqrt(2 * x)) - 10
while not (n - 1) * n // 2 < x <= n * (n + 1) // 2:
    n += 1
print(n)
n, k = map(int, input().split())
if n > k:
  if n%k != 0:
    ans = min(n, abs((n%k) - k))
  else:
    ans = 0
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
ans = 0
if n%k != 0:
  ans = (min(n, abs((n%k) - k)))
print(ans)
a,b=map(int,input().split())
if a!=3 and b!=3:
	print(3)
elif a!=2 and b!=2:
	print(2)
else:
	print(1)

### FIXED CODE ###

a=int(input())
b=int(input())
if a!=3 and b!=3:
  print(3)
elif a!=2 and b!=2:
  print(2)
else:
  print(1)
import sys
input = sys.stdin.readline
import numpy as np


N = int(input())

p = []

for _ in raneg(N):
    p.append(int(input()))


new_p = sorted(p, reverse=True)

new_p[0] = new_p[0]//2

print(sum(new_p))

### FIXED CODE ###

N = int(input())
p = []
for _ in range(N):
    p.append(int(input()))
p = sorted(p)
p[-1] = p[-1]//2
print(sum(p))
import queue
def dijkstra(n,EdgeMatrix,start):

    NodeList=queue.PriorityQueue() #探索対象の頂点
    Distance=[float('inf')]*n #頂点0からの最短経路
    used=[False]*n #頂点の使用情報

    Distance[start]=0 #0から0までの距離は0
    used[start]=True #0から探索を始める
    LastNode=start #最新の頂点
    NodeList.put([0,start])

    while not NodeList.empty():
        for i in range(len(EdgeMatrix[LastNode])):
            #探索していない頂点へ距離の短い辺があればキューに追加
            Edge=EdgeMatrix[LastNode][i]
            if used[Edge[0]]==False and Distance[Edge[0]]>Distance[LastNode]+Edge[1]:
                    Distance[Edge[0]]=Distance[LastNode]+Edge[1]
                    NodeList.put([Distance[Edge[0]],Edge[0]])

        #最も近い探索していない頂点
        while not NodeList.empty():
            minNode=NodeList.get()
            if used[minNode[1]]==False:
                break

        LastNode=minNode[1] #最新の頂点を更新
        used[minNode[1]]=True #頂点の使用情報を更新
    return Distance

#入力
n,m,s=map(int,input().split())

#辺の隣接リスト
EdgeMatrix=[[] for i in range(125000)]

for i in range(m):
    u,v,a,b=map(int,input().split())
    for j in range(a,2500):
        EdgeMatrix[(u-1)*2500+j].append([(v-1)*2500+j-a,b])
        EdgeMatrix[(v-1)*2500+j].append([(u-1)*2500+j-a,b])

for i in range(n):
    c,d=map(int,input().split())
    for j in range(2450):
        EdgeMatrix[i*2500+j].append([min(i*2500+j+c,(i+1)*2500-1),d])

#for i in range(7500,7600):
#    print(EdgeMatrix[i])
    
#頂点0からの最短経路
Distance=dijkstra(125000,EdgeMatrix,s)

for i in range(1,n):
    print(min(Distance[i*2500:(i+1)*2500-1]))


### FIXED CODE ###

import queue
def dijkstra(n,EdgeMatrix,start):

    NodeList=queue.PriorityQueue() #探索対象の頂点
    Distance=[float('inf')]*n #頂点0からの最短経路
    used=[False]*n #頂点の使用情報

    Distance[start]=0 #0から0までの距離は0
    used[start]=True #0から探索を始める
    LastNode=start #最新の頂点
    NodeList.put([0,start])
    Flag=True #探索対象がなくなるとFalse
    
    while Flag:
        Flag=False
        for i in range(len(EdgeMatrix[LastNode])):
            #探索していない頂点へ距離の短い辺があればキューに追加
            Edge=EdgeMatrix[LastNode][i]
            if used[Edge[0]]==False and Distance[Edge[0]]>Distance[LastNode]+Edge[1]:
                    Distance[Edge[0]]=Distance[LastNode]+Edge[1]
                    NodeList.put([Distance[Edge[0]],Edge[0]])

        #最も近い探索していない頂点
        while not NodeList.empty():
            minNode=NodeList.get()
            if used[minNode[1]]==False:
                Flag=True
                break

        LastNode=minNode[1] #最新の頂点を更新
        used[minNode[1]]=True #頂点の使用情報を更新
    return Distance

#入力
n,m,s=map(int,input().split())

#辺の隣接リスト
EdgeMatrix=[[] for i in range(125000)]

for i in range(m):
    u,v,a,b=map(int,input().split())
    for j in range(a,2500):
        EdgeMatrix[(u-1)*2500+j].append([(v-1)*2500+j-a,b])
        EdgeMatrix[(v-1)*2500+j].append([(u-1)*2500+j-a,b])

for i in range(n):
    c,d=map(int,input().split())
    for j in range(2450):
        EdgeMatrix[i*2500+j].append([min(i*2500+j+c,(i+1)*2500-1),d])

#for i in range(2502):
#    print(EdgeMatrix[i])
    
#頂点0からの最短経路
Distance=dijkstra(125000,EdgeMatrix,min(s,2499))

for i in range(1,n):
    print(min(Distance[i*2500:(i+1)*2500-1]))
import sys
sys.setrecursionlimit(100000000)
A,B,C,D,E,F = [int(x) for x in input().split()]

x = []
y = []
ans_max = 0
ans = []

for i in range(F//(100*A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        water = 100*(A*i+B*j)
        if(water<=F and not water in x):
            x.append(water)

for i in range(F):
    for j in range(F):
        salt = C*i+D*j
        if(salt<=F and not salt in y):
            y.append(salt)

for i in x:
    for j in y:
        if(i==0):
            continue
        elif(100*j <= i*E and i+j <= F):
            percent = 100*j/(i+j)
            if(ans_max < percent):
                ans_max = percent
                ans = [i,j]

print(sum(ans),ans[1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)
A,B,C,D,E,F = [int(x) for x in input().split()]

x = []
y = []
ans_max = 0
ans = [0,0]

for i in range(F//(100*A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        water = 100*(A*i+B*j)
        if(water<=F and not water in x and water!=0):
            x.append(water)

ans[0]=x[0]

for i in range(F):
    for j in range(F):
        salt = C*i+D*j
        if(salt<=F and not salt in y):
            y.append(salt)

for i in x:
    for j in y:
        if(i==0):
            continue
        elif(100*j <= i*E and i+j <= F):
            percent = 100*j/(i+j)
            if(ans_max < percent):
                ans_max = percent
                ans = [i,j]

print(sum(ans),ans[1])
s=input()
k=int(input())

tail = s[0]
if tail == s[-1]:
  tmp_cnt1 = 0
  tmp_cnt2 = 0
  for i in s:
    if tail == i:
      tmp_cnt1 += 1
    else:
      for i in s.reverse():
        if tail == i:
          tmp_cnt2 += 1
        else:
          break
      break
  if (tmp_cnt1 + tmp_cnt2) % 2 == 1:
    tail = ''

cnt=0
if len(s)==1:
  ret = k
else:
  tmp=s[0]
  tmp_cnt=0
  for i in s[1:]+s[0]:
    if tmp==i:
      tmp_cnt+=1
    else:
      cnt+=(tmp_cnt+1)//2
      tmp_cnt=0
    tmp=i
  cnt+=(tmp_cnt+1)//2
  ret=cnt*k
print(ret)

### FIXED CODE ###

s=input()
k=int(input())

tail = s[0]
plus = 0
flg = False
if tail == s[-1]:
  tmp_cnt1 = 0
  tmp_cnt2 = 0
  for i in s:
    if tail == i:
      tmp_cnt1 += 1
    else:
      break
  for i in s[::-1]:
    if tail == i:
      tmp_cnt2 += 1
    else:
      break
  if (tmp_cnt1 % 2) == 1 and (tmp_cnt2%2)==1:
    plus = 1
  if tmp_cnt1 == len(s):
    flg = True

cnt=0
if len(s)==1:
  ret = k//2
else:
  tmp=s[0]
  tmp_cnt=0
  for i in s[1:]:
    if tmp==i:
      tmp_cnt+=1
    else:
      cnt+=(tmp_cnt+1)//2
      tmp_cnt=0
    tmp=i
  cnt+=(tmp_cnt+1)//2
  ret=cnt*k
  if plus == 1:
    ret += k-1
  if flg:
    ret = len(s)*k//2
print(ret)
h, a = map(int, input().split())
Ans = 0
Ans2 = 0
 
while Ans =< 0:
	Ans = h-a
	Ans2 += 1
 
print(Ans2)

### FIXED CODE ###

H, A = map(int, input().split())
Ans = 0
 
while (H > 0):
	H -= A
	Ans += 1
 
print(Ans)
n,m = (int, input().split())
print((n-1)*(m-1))

### FIXED CODE ###

n,m = map(int,input().split())
print((n-1)*(m-1))
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

sumA = 0
num = [0]*100000
for aa in a:
    num[aa] += 1
    sumA += aa

for b, c in bc:
    sumA = sumA + ((c - b) * num[b])
    num[c] += num[b]
    num[b] = 0
    print(sumA)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

sumA = 0
num = [0]*100100
for aa in a:
    num[aa] += 1
    sumA += aa

for b, c in bc:
    sumA = sumA + ((c - b) * num[b])
    num[c] += num[b]
    num[b] = 0
    print(sumA)
s = input()
n = len(s)
count = 0
for i in range(0, n, 2):
    if s[i] == 'R':
        count += 1
for i in range(1, n, 2):
    if s[i] == 'L':
        count += 1
if count == n:
    print("Yes")
else print("No")

### FIXED CODE ###

s = input()
n = len(s)
for i in range(0, n, 2):
    if s[i] == 'L':
        print("No")
        exit()
for i in range(1, n, 2):
    if s[i] == 'R':
        print("No")
        exit()
print("Yes")
H, W =int(input().split())
h, w =int(input().split())
print((H-h)*(W-w))

### FIXED CODE ###

H, W =[int(i) for i in input().split()]
h, w =[int(i) for i in input().split()]
print((H-h)*(W-w))
N = int(input())
import numpy as np
li = np.array([0]*N)
ans = 0
for i in range(N):
    li[i:N:i+1]+=1
    ans += li[i]*(i+1)
    

print(ans)

### FIXED CODE ###

N = int(input())

counter = 0
for n in range(1,N+1):
    a = N//n
    counter += a*(a+1)*n//2


print(counter)
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
H,W=map(int,input().split())
endmap=[list(s for s in input()) for _ in range(H)]
exlarge=[[0]*(W+2)*(H+2)]
ans='Yes'
for i in range(H):
  for j in range(W):
    if endmap[i][j]=='#':
      exlarge[i+1][j+1]=1
 
for k in range(H+2):
  for l in range(W+2):
    if exlarge[k][l]==1: 
        if exlarge[k][l-1]!=1 or exlarge[k][l+1]!=1 or exlarge[k-1][l]!=1 or exlarge[k+1][l]!=1:
          ans='No'
 
print(ans)

### FIXED CODE ###

H,W=map(int,input().split())
endmap=[list(s for s in input()) for _ in range(H)]
exlarge=[[0]*(W+2) for _ in range(H+2)]
ans='Yes'
for i in range(H):
  for j in range(W):
    if endmap[i][j]=='#':
      exlarge[i+1][j+1]=1
 
for k in range(H+2):
  for l in range(W+2):
    if exlarge[k][l]==1 and exlarge[k][l-1]== exlarge[k][l+1]==exlarge[k-1][l]==exlarge[k+1][l]==0:
          ans='No'
 
print(ans)
if a*b%2==0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

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


if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)

### FIXED CODE ###

input_data=input().split()


first_area = int(input_data[0]) * int(input_data[1])
second_area = int(input_data[2]) * int(input_data[3])

if first_area >= second_area :
  print(first_area)
else:
  print(second_area)
list = map(int(), input().split())
area = list[0] * list[1]
perimeter = list[0] * 2 + list[1] * 2
print(str(area) + " " + str(perimeter))


### FIXED CODE ###

l = list(map(int, input().split()))
area = l[0] * l[1]
perimeter = l[0] * 2 + l[1] * 2
print('{0} {1}'.format(area, perimeter))
n,k=map(int,(input().split()))
a=[]
for i in range(k):
    a.append(int(input()))
    
a.sort(reverse=True)
for i in range(n-k):
    b=int(input())
    if max(a)>b:
        a.remove(max(a))
        a.append(b)
    elif min(a)<b:
        a.remove(min(b))
        a.append(b)

print(max(a)-min(a))

### FIXED CODE ###


n,k=map(int,(input().split()))
a=[]
for i in range(n):
    a.append(int(input()))

a.sort()
min_high=1000000000000

for i in range(n-k+1):
    high=-a[i]+a[i+k-1]
#    print(high,a[i],i)
    if high<min_high:
        min_high=high

print(min_high)
import math
 
i = input().split()
N = int(i[0])
K = int(i[1])
result = 0
 
result = math.log(N, K)
result = 1 + int(result)

 
print(result)

### FIXED CODE ###

i = list(map(int, input().split()))
N = i[0]
R = i[1]
 
result = R if N >= 10 else R + 100 * (10 - N)
 
print(result)
for _ in range(int(input())):
    print(sum(1-eval(input().replace(" ","-"))))

### FIXED CODE ###

print(sum(1-eval(input().replace(" ","-")) for _ in range(int(input()))))
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

### FIXED CODE ###

a,b,x = map(int, input().split())
b_num = int(b//x)
a_num = int((a-1)//x)
ans = b_num - a_num
print(ans)
import sys
sys.setrecursionlimit(10000000000000)

from operator import mul
from functools import reduce
from functools import lru_cache

N = int(input())
A_list = [int(e) for e in input().split()]

#ある番号のボールが何個あるかをまとめる
number_dict = dict()

for i in range(N):
    ball_number = A_list[i]
    if ball_number not in number_dict:
        number_dict[ball_number] = 0
        
    number_dict[ball_number] += 1

#それぞれの番号のボールから2個選ぶ組み合わせをカウントする。
comb_dict = dict()

@lru_cache(maxsize=10000000000000)
def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom
    
@lru_cache(maxsize=10000000000000)
def two_choice(N):
    if N == 2:
        return 1
    elif N <= 1:
        return 0
    elif N == 3:
        return 3
    else:
        return combinations_count(N,2)*combinations_count(N-2,2)

all = 0

for in_dict in number_dict.items():
    ball_number = in_dict[0]
    balls = in_dict[1]
    comb_dict[ball_number] = two_choice(balls)
    all += comb_dict[ball_number]

#回答作成
for i in range(1,N+1):
    ball_number = A_list[i-1]
    now_balls = number_dict[ball_number] - 1
    print(int(all-comb_dict[ball_number]+two_choice(now_balls)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)

from operator import mul
from functools import reduce
from functools import lru_cache

N = int(input())
A_list = [int(e) for e in input().split()]

#ある番号のボールが何個あるかをまとめる
number_dict = dict()

for i in range(N):
    ball_number = A_list[i]
    if ball_number not in number_dict:
        number_dict[ball_number] = 0
        
    number_dict[ball_number] += 1

#それぞれの番号のボールから2個選ぶ組み合わせをカウントする。
comb_dict = dict()

@lru_cache(maxsize=10000000000000)
def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom
    
@lru_cache(maxsize=10000000000000)
def two_choice(N):
    if N == 2:
        return 1
    elif N <= 1:
        return 0
    elif N == 3:
        return 3
    else:
        return combinations_count(N,2)

all = 0

for in_dict in number_dict.items():
    ball_number = in_dict[0]
    balls = in_dict[1]
    comb_dict[ball_number] = two_choice(balls)
    all += comb_dict[ball_number]

#回答作成
for i in range(1,N+1):
    ball_number = A_list[i-1]
    now_balls = number_dict[ball_number] - 1
    print(int(all-comb_dict[ball_number]+two_choice(now_balls)))
import math
N = int(input())
a = list(map(int, input().split()))

for i in range(N - 1):
    a[i + 1] = int(math.gcd(a[i], a[i+1]))
    print(a)

print(a[N-1])

### FIXED CODE ###

import fractions

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

for i in range(N - 1):
    a[i + 1] = fractions.gcd(a[i], a[i+1])

print(a[N-1])
import sys
sys.setrecursionlimit(100001)

def intinput(): return map(int,sys.stdin.readline().split())

fibmemo={1:1,2:1}
for i in range(3,100000):
    fibmemo[i]=fibmemo[i-1]+fibmemo[i-2]
def fib(n):
    return fibmemo[n]

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
m=fib(a[0])
tmp=a[0]
for i in a:
    if i+1 in a:
        print(0)
        sys.exit()
    if a[0]==i:
        continue
    m=fib(i-tmp-1)*m%mod
    tmp=i
m=fib(n-tmp)*m%mod
print(m)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())

fib={0:0,1:1,2:1}
for i in range(3,100003):
    fib[i]=fib[i-1]+fib[i-2]
  #  fib.append(fib[i-1]+fib[i-2])

n,m=intinput()
mod=10**9+7
a=[int(sys.stdin.readline()) for _ in range(m)]
if m!=0:
    l=[a[0]]
    for i in range(len(a)-1):
        l.append(a[i+1]-a[i]-1)
    l.append(n-a[-1])
    k=1
    for i in l:
        k=fib[i]*k%mod
    print(k%mod)
else:
    print(fib[n+1]%mod)
a,b=int(input())
import math
print(int(math.ceil(a+b)))

### FIXED CODE ###

a,b=map(int, input().split())
import math
print(int(math.ceil((a+b)/2)))
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s1 = [0]
for i in range(n):
    s1.append(s1[-1]+a[i])

s2 = [0]
for i in range(m):
    s2.append(s2[-1]+b[i])
ans = 0
for i in range(1,n):
    p = k-s1[i]
    j = 0
    while p-s2[j]>0:
        if p-s2[j]>0:
            p -= s2[j]
            j += 1
        else:
            break
    ans = max(i+j-1,ans)
print(ans)




### FIXED CODE ###

#　変数 n, m, k, arr1, arr2, acum1, acum2, ans

n, m, k = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))

acum1 = [0]
for i in range(n):
    acum1.append(acum1[-1] + arr1[i])
acum2 = [0]
for i in range(m):
    acum2.append(acum2[-1] + arr2[i])

ans = 0
j = m
for i in range(n+1):
    if acum1[i] > k:
        break
    while acum2[j] > k - acum1[i] and j > 0:
        j -= 1
    ans = max(ans, i+j)
print(ans)
N, M = map(int, input().split())
xs = [[] for _ in range(N)]
for j in range(N):
    a, b, c = map(int, input().split())
    for i in range(2**3):
        t = []
        for k in range(3):
            t.append(1-2*((i>>k)%2))
        xs[i].append(a*t[0] +b*t[1]+c*t[2])
print(max(sum(sorted(xs[i])[-M:]) for i in range(2**3)))


### FIXED CODE ###

N, M = map(int, input().split())
xs = [[] for _ in range(8)]
for j in range(N):
    a, b, c = map(int, input().split())
    for i in range(2**3):
        t = []
        for k in range(3):
            t.append(1-2*((i>>k)%2))
        xs[i].append(a*t[0] +b*t[1]+c*t[2])
print(max(sum(sorted(xs[i])[-M:]) for i in range(2**3))*(M!=0))
line = input().split(" ")
N = int(line[0])
M = int(line[1])

g = {}
E = []
for _ in range(N):
    line = input().split(" ")
    a = line[0]
    b = line[1]
    E.append((a,b))
    if not a in g:
        g[a] = []
    g[a].append(b)

    if not b in g:
        g[b] = []
    g[b].append(a)

def judge(a, b):
    flags = {}
    for v in g:
        flags[v] = False
    q = [a]
    flags[a] = True
    while len(q)>0:
        v = q.pop(0)
        for u in g[v]:
            if (v==a and u==b) or (v==b and u==a):
                continue
            elif not flags[u]:
                flags[u] = True
                q.append(u)
    ret = True
    for v in flags:
        ret = ret and flags[v]

    return not ret

cnt = 0
for e in E:
    if judge(e[0],e[1]):
        cnt += 1

print(cnt)


### FIXED CODE ###

line = input().split(" ")
N = int(line[0])
M = int(line[1])

g = {}
E = []
for _ in range(M):
    line = input().split(" ")
    a = line[0]
    b = line[1]
    E.append((a,b))
    if not a in g:
        g[a] = []
    g[a].append(b)

    if not b in g:
        g[b] = []
    g[b].append(a)

def judge(a, b):
    flags = {}
    for v in g:
        flags[v] = False
    q = [a]
    flags[a] = True
    while len(q)>0:
        v = q.pop(0)
        for u in g[v]:
            if (v==a and u==b) or (v==b and u==a):
                continue
            elif not flags[u]:
                flags[u] = True
                q.append(u)
    ret = True
    for v in flags:
        ret = ret and flags[v]

    return not ret

cnt = 0
for e in E:
    if judge(e[0],e[1]):
        cnt += 1

print(cnt)
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))


### FIXED CODE ###

import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
N , K = map(int , input().split())
R , S , P = map(int , input().split())
T = input()

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

VANISH = []
    
for i in range(N-K):
    if ans[i] == ans[i+K]:
        VANISH.append(ans[i])
        
if N - (2*K) > 0:
    for i in range(N - (2*K)):
        if ans[i] == ans[i+(2*K)]:
            VANISH.remove(ans[i])
            
vanish = "".join(VANISH)
        
point = ((ans.count("r")-vanish.count("r"))*R + (ans.count("s")-vanish.count("s"))*S + (ans.count("p")-vanish.count("p"))*P)

print(point)

### FIXED CODE ###

N , K = map(int , input().split())
R , S , P = map(int , input().split())
T = input()

dic = {"r":"p" , "s":"r" , "p":"s"}
ANS = []

for i in range(N):
    ANS.append(dic[T[i]])
    
ans = "".join(ANS)

for i in range(K , N):
    if ans[i] == ans[i-K]:
        ans = ans[:i] + "X" + ans[i+1:]
        
point = ans.count("r")*R + ans.count("s")*S + ans.count("p")*P

print(point)
#my answer
n, k = map(int,input().split())
x = list(map(int,input().split()))

ns = 999999999

for i in range(n - k + 1):
    a = abs(x[i]) + (x[i + k - 1] - x[i])
    b = abs(x[i + k - 1]) + (x[i + k - 1] - x[i])
    ans = min(ans, a, b)
    
print(ans)

### FIXED CODE ###

n, k = map(int,input().split())
x = list(map(int, input().split()))

ans = 999999999

for i in range(n - k + 1):
    a = abs(x[i]) + (x[i + k - 1] - x[i])
    b = abs(x[i + k - 1]) + (x[i + k - 1] - x[i])
    ans = min(ans, a, b)
    
print(ans)
# coding: utf-8
# Your code here!

box_num = int(input())
ball_in_box_num_list = [[int(i), []] for i in input().split(" ")]
for i in range(1, box_num + 1):
    k = 2
    while i * k <= box_num:
        ball_in_box_num_list[i * k - 1][1].append(i)
        k += 1
ans_num = 0
ans_list = []
for i in range(box_num):
    a = box_num - 1 - i
    b = ball_in_box_num_list[a]
    if b[0] == 1:
        ans_num += 1
        ans_list.append(a + 1)
        for j in b[1]:
            ball_in_box_num_list[j] = 1 - ball_in_box_num_list[j]
print(ans_num)
if ans_list != 0:
    ans_list = [str(i) for i in ans_list]
    ans_list = ans_list[::-1]
    print(" ".join(ans_list))

### FIXED CODE ###

# coding: utf-8
# Your code here!

box_num = int(input())
ball_in_box_num_list = tuple([int(i), []] for i in input().split(" "))
for i in range(1, box_num + 1):
    k = 2
    while i * k <= box_num:
        ball_in_box_num_list[i * k - 1][1].append(i - 1)
        k += 1
ans_num = 0
ans_list = []
for i in range(box_num):
    a = box_num - 1 - i
    b = ball_in_box_num_list[a]
    if b[0] == 1:
        ans_num += 1
        ans_list.append(a + 1)
        for j in b[1]:
            ball_in_box_num_list[j][0] = 1 - ball_in_box_num_list[j][0]
print(ans_num)
if ans_list != 0:
    ans_list = [str(i) for i in ans_list]
    ans_list = ans_list[::-1]
    print(" ".join(ans_list))