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

mod = 10**9+7

def calculate_combination(n,k):
    x, y = 1, 1
    for i in range(k):
        x *= (n - i) % mod
        y *= (k - i) % mod
    return x * pow(y, mod-2, mod) % mod

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

ans = pow(2, n, mod) - 1 - calculate_combination(n,a) - calculate_combination(n,b)
while ans < 0:
    ans += mod
print(ans)

### FIXED CODE ###

mod = 10 ** 9 + 7

def calc(n,r):
    x = 1
    y = 1
    for i in range(r):
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod

n, a, b = map(int, input().split())
res = pow(2, n, mod) - 1
 
for i in [a, b]:
    res -= calc(n, i)
print(res % mod)
### BUGGY CODE ###

S = list(input())
be = len(S)

while True:
    tmp_S = S
    for i in range(1,len(S)):
        if (S[i-1]=='0' and S[i]=='1') or (S[i-1]=='1' and S[i]=='0'):
            S[i-1], S[i] = '', ''
    S = ''.join(S)
    S = list(S)
    if tmp_S==S:
        break
af = len(S)
print(be-af)

### FIXED CODE ###

s = input()

one = s.count('1')
zero = s.count('0')

print(2*min(one,zero))
### BUGGY CODE ###

N = int(input())
S = input()

R = []
G = []
B = []

sum = 0

for i in range(0, N):
    if S[i] == "R":
        R.append(i)
    elif S[i] == "G":
        G.append(i)
    else:
        B.append(i)

for r in range(0, len(R)):
    for g in range(0, len(G)):
        for b in range(0, len(B)):
            if abs(R[r] - G[g]) != abs(G[g] - B[b]) and abs(R[r] - G[g]) != abs(B[b] - R[r]) and abs(G[g] - B[b]) != abs(B[b] - R[r]):
                sum += 1

print(sum)

### FIXED CODE ###

N = int(input())
S = input()

nr = 0
ng = 0
nb = 0

for i in range(0, N):
    if S[i] == "R":
        nr += 1
    elif S[i] == "G":
        ng += 1
    else:
        nb += 1

count = 0

for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = j + (j - i)
        if k < N and ord(S[i]) + ord(S[j]) + ord(S[k]) == ord("R") + ord("G") + ord("B"):
            count += 1

print(nr*ng*nb - count)
### BUGGY CODE ###


N,W = map(int, input().split())

wv = [[0 for i in range(2)] for j in range(N+1)]
Wsum = [0 for i in range(N+1)]
Vsum = [0 for i in range(N+1)]

for i in range(N):
    wv[i+1][0],wv[i+1][1] = map(int, input().split())

sorted(wv)

for i in range(N):
    Wsum[i+1] = Wsum[i] + wv[i+1][0]
    Vsum[i+1] = Vsum[i] + wv[i+1][1]

#i番目の品物まで含み制約W2のナップサック問題の最適解
def nap(i,W2):
    #品物0個のときはもちろん価値は0
    if i == 0:
        return 0
    #w[i]がW2を超えるときはi番目の品物は不必要
    if W2 < wv[i][0]:
        return nap(i-1,W2)
    #品物の重さ全部足して制約以下なら全部足したものが価値
    if Wsum[i] <= W2:
        return Vsum[i]

    return max( nap(i-1,W2-wv[i][0])+wv[i][1] , nap(i-1,W2) )
    
            
print(nap(N,W))


### FIXED CODE ###


N,W = map(int, input().split())

w = [0 for i in range(N)]
v = [0 for i in range(N)]
Wsum = [0 for i in range(N+1)]
Vsum = [0 for i in range(N+1)]

for i in range(N):
    w[i],v[i] = map(int, input().split())
Wmin = min(w)

w.insert(0,"0")
v.insert(0,"0")


for i in range(N):
    Wsum[i+1] = Wsum[i] + w[i+1]
    Vsum[i+1] = Vsum[i] + v[i+1]


nap_memo = {}

#i番目の品物まで含み制約W2のナップサック問題の最適解
def nap(i,W2):
    #重複計算を避けるためnap(i,W2)を保持
    key = str(i) + ':' + str(W2)
    if key in nap_memo:
        return nap_memo[key]
    #品物0個のときは価値は0
    elif i == 0:
        r = 0
    #制約0のときも価値は0
    elif W2 < Wmin:
        r = 0
    #w[i]がW2を超えるときはi番目の品物は不必要
    elif W2 < w[i]:
        r = nap(i-1,W2)
    #品物の重さ全部足して制約以下なら全部足したものが価値で良い
    elif Wsum[i] <= W2:
        r = Vsum[i]
    #i番目の品物をナップサックに入れるか入れないか
    else:
        r = max( nap(i-1,W2-w[i])+v[i] , nap(i-1,W2) )
    
    nap_memo[key] = r
    return r
    
            
print(nap(N,W))
### BUGGY CODE ###

# UnionTreeクラス：グループ分けを木構造で管理する
class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.N = N

    # xのrootを返す
    def root(self, x):
        return x if self.par[x] == x else self.root(self.par[x])

    # x, yが同じrootの場合true
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    # x,yのrootが違った場合、併合
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if(rx != ry):
            self.par = [ry if i == rx else i for i in self.par]

def output(uf):
    count = 0
    for i in range(uf.N):
        sub_par = uf.par[i+1:]
        count += len(sub_par) - sub_par.count(uf.par[i])

    return count



n, m = (int(i) for i in input().split())
input_arr = [[int(i) for i in input().split()] for i in range(m)] 

uf = UnionFind(n)
#input_arr = [[1,2],[3,4],[1,3],[2,3],[1,4]]

#print(output(uf))
result = [output(uf)]
for i in input_arr[::-1]:
    a = i[0]-1
    b = i[1]-1
    if not uf.same(a,b):
        uf.unite(a,b)
        result.append(output(uf))
    else:
        result.append(result[-1])

for i in result[::-1][1:]:
    print(i)

#print(uf.par)


### FIXED CODE ###

# UnionTreeクラス：グループ分けを木構造で管理する
class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.size = [1] * N
        self.N = N

    # xのrootを返す
    def root(self, x):
        if self.par[x] == x:
            return x
        else: 
            self.par[x] = self.root(self.par[x])
            return self.root(self.par[x])

    # x, yが同じrootの場合true
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    # x,yのrootが違った場合、併合
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if self.size[rx] < self.size[ry]:
            self.par[rx] = ry
            self.size[ry] += self.size[rx]
        else:
            self.par[ry] = rx
            self.size[rx] += self.size[ry]

n, m = (int(i) for i in input().split())
input_arr = [[int(i) for i in input().split()] for i in range(m)] 

uf = UnionFind(n)
#input_arr = [[1,2],[3,4],[1,3],[2,3],[1,4]]

#print(output(uf))
result = [int(n*(n-1)/2)]
for i in input_arr[::-1]:
    a = i[0]-1
    b = i[1]-1
    if not uf.same(a,b):
        x = uf.size[uf.root(a)] * uf.size[uf.root(b)]
        uf.unite(a,b)
        result.append(int(result[-1]-x))
    else:
        result.append(result[-1])

for i in result[::-1][1:]:
    print(i)

#print(uf.par)
### BUGGY CODE ###

a,b,c,d,e,f=map(int,input().split())
checklist=[]
for num1 in range(f+1):
    for num2 in range(f+1):
        #(0からfまでの値を num1とnum2に代入して調べる)
        if (100*a)*(num1)+(100*b)*(num2)<=f and [num1,num2]!=[0,0] and (100*num1)*a+(100*num2)*b not in checklist:
            checklist.append((100*num1)*a+(100*num2)*b)
sugarlist=[]
for i in range(f+1):
    for j in range(f+1):
        ch=c*(i)+d*(j)
        if ch<f and ch not in sugarlist and [i,j]!=[0,0]:
            sugarlist.append(ch)           
sugarlist .append(0)
maxsugar=0
ratio=-1
good=0           
for x in sugarlist:
    for y in checklist:
        allsum=x+y
        if allsum<=f and 100*x<=e*y:
            if x/y>=ratio:
                ratio=x/y
                maxsugar=x
                good=x+y      
            else:
            	continue       
        else:
            continue  
print(good,maxsugar)

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
checklist=[]
for num1 in range(f//(100*a)+1):
    for num2 in range((f//100*b)+1):
        #(0からfまでの値を num1とnum2に代入して調べる)
        if (100*a)*(num1)+(100*b)*(num2)<=f and [num1,num2]!=[0,0] and (100*num1)*a+(100*num2)*b not in checklist:
            checklist.append((100*num1)*a+(100*num2)*b)
sugarlist=[]
for i in range(f//c+1):
    for j in range(f//d+1):
        ch=c*(i)+d*(j)
        if ch<f and ch not in sugarlist and [i,j]!=[0,0]:
            sugarlist.append(ch)           
sugarlist .append(0)
maxsugar=0
ratio=-1
good=0           
for x in sugarlist:
    for y in checklist:
        allsum=x+y
        if allsum<=f and 100*x<=e*y:
            if x/y>=ratio:
                ratio=x/y
                maxsugar=x
                good=x+y      
            else:
            	continue       
        else:
            continue  
print(good,maxsugar)
### BUGGY CODE ###

n = int(input())
s = input()
left = 0
right = n // 2 + 1
while right - left > 1:
    mid = (right + left) // 2
    len = mid
    for i in range(n):
        if i + len > n - len:
            continue
        s1 = s[i:i+len]
        s2 = s[i+len:]
        if s1 in s2:
            left = mid
            break
    else:
        right = mid
print(left)

### FIXED CODE ###

N = int(input())
S = input()
ok, ng = 0, N + 1
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    check = set()
    for i in range(N - x + 1):
        check.add(S[i: i + x])
        if S[i + x: i + 2 * x] in check:
            ok = x
            break
    else:
        ng = x

print(ok)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
re = 1
if int(0 in A) == 1:
  re = 0
  N = 0
for i in range(N):
  re *= A[i]
if re > 10**18:
  re = -1
print(re)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
re = 1
if int(0 in A) == 1:
  re = 0
  N = 0
for i in range(N):
  re *= A[i]
  if re > 10**18:
    re = -1
    break
print(re)
### BUGGY CODE ###

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

middle = int(n/2) - 1
for i in range(n):
  copy_list = copy.copy(x)
  elm = copy_list.pop(i)
  print(sorted(copy_list).pop(middle))


### FIXED CODE ###

import copy
n = int(input())
x = list(map(int, input().split()))
sort_x = sorted(copy.copy(x))

middle = int(n/2) - 1
next_middle = middle + 1

for i in range(n):
  if x[i] <= sort_x[middle]:
    print(sort_x[next_middle])
  elif x[i] >= sort_x[next_middle]:
    print(sort_x[middle])
### BUGGY CODE ###

def calc_lcs(X, Y):
    max_lcs = 0
    m = len(X)
    n = len(Y)
    X = ' ' + X
    Y = ' ' + Y
    c = [[0 for _ in range(1000+1)] for i in range(1000+1)]
    for i in range(1, m+1):
        for j in range(1, n+1):
            if X[i] == Y[j]:
                c[i][j] = c[i - 1][j - 1] + 1
            elif c[i - 1][j] >= c[i][j - 1]:
                c[i][j] = c[i - 1][j]
            else:
                c[i][j] = c[i][j - 1]
            max_lcs = max(max_lcs, c[i][j])
    return max_lcs


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    # X = 'abcbdab'
    # Y = 'bdcaba'

    for _ in range(num):
        X = input()
        Y = input()

        # ???????????????
        result = calc_lcs(X, Y)

        # ???????????¨???
        print(result)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_C

最長共通部分列
"""


c = []
def prep_array(X, Y):
    global c
    """ 値が0の2次元配列を用意する。サイズは入力データの最大値を想定して縦横(1000+1)以上必要。 """
    # from array import array
    # c = [array('I', [0] * (len(X)+1)) for _ in range(len(Y)+1)]  #  arrayで用意
    c = [[0]*(len(Y)+2) for _ in range(len(X)+2)] #  リストで用意
    return c


def check_max(array):
    """ 2次元配列の中の最大の値を返す """
    max_lcs = 0
    for row in array:
        temp_max = max(row)
        if temp_max > max_lcs:
            max_lcs = temp_max
    return max_lcs


def calc_lcs4(X, Y, c):
    """
    Y[j]のアクセス方法を変更
    リストの値を一旦変数に保存するように変更
    最長共通部分長を関数内で計算するように変更
    4/5 のテストデータを使用してプロファイリングすると実効時間は 5.6秒
    """
    X = ' ' + X
    Y = ' ' + Y
    m = len(X)
    n = len(Y)
    max_lcs = 0

    pre_row = c[0]
    for i in range(1, m):
        row = c[i]
        XX = X[i]
        for j, YY in enumerate(Y):
            if XX == YY:
                pr_j1 = pre_row[j - 1]
                row[j] = pr_j1 + 1
                if pr_j1+1 > max_lcs:
                   max_lcs = pr_j1 + 1
            else:
                pr_j = pre_row[j]
                r_j1 = row[j-1]
                if pr_j >= r_j1:
                    row[j] = pr_j
                else:
                    row[j] = r_j1
        pre_row = row
    return max_lcs


if __name__ == '__main__':
    # データの入力
    num = int(input())
    #f = open('input.txt')
    #num = int(f.readline())

    for _ in range(num):
        X = input().strip()
        Y = input().strip()

        # 処理の実行
        result = calc_lcs4(X, Y, prep_array(X, Y))

        # 結果の表示
        print(result)
### BUGGY CODE ###

import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)

lcom = [[0 for _ in range(n+3)] for _ in range(n+3)]

def cmb(n, r):
    if n<r:return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((cmb(n+1,i)-cmb(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

### FIXED CODE ###

import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
#print(a)

for _ in range(m):
    a[-1]=a[-1]//2
    a.sort()
print(sum(a))

### FIXED CODE ###

import sys
input = sys.stdin.readline
import heapq

n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=-a[i]

heapq.heapify(a)
for i in range(m):
    c=-(-heapq.heappop(a)//2)
    heapq.heappush(a,c)
#print(a)
print(-sum(a))
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(lambda x:int(x)-1, input().split()))

cnts = [None] * N

pos = 0
cnt = 0

while cnt < K:
    if cnts[pos] != None:
        loop_size = cnt - cnts[pos]
        cnt += ((K-cnt) // loop_size - 1) * loop_size
        cnts = [None] * N
    cnts[pos] = cnt
    pos = A[pos]
    cnt += 1

print(pos+1)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(lambda x:int(x)-1, input().split()))

cnts = [None] * N

pos = 0
cnt = 0

while cnt < K:
    if cnts[pos] != None:
        loop_size = cnt - cnts[pos]
        cnt += ((K-cnt-1) // loop_size) * loop_size
        cnts = [None] * N
    cnts[pos] = cnt
    pos = A[pos]
    cnt += 1

print(pos+1)
### BUGGY CODE ###

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

ans=[]
for i in range(1,N+1):
  ans.append(A.index(i)+1)
  
print(" ".join(map(str,ans)))

### FIXED CODE ###

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

ans=[0]*N
for i in range(1,N+1):
  ans[A[i-1]-1]=i
  
print(" ".join(map(str,ans)))
### BUGGY CODE ###

#numpyで数えていたのを変更
N=int(input())
A=list(map(int,input().split()))

c = [0] * (N + 1)
Dx = [0] * (N + 1)
for a in A:
    c[a] += 1
    Dx[c[a]] += 1

Sx=[0]#初項は0
for j in range(1,N+1):
    Sx.append(Sx[j-1]+Dx[j])

#Sxが作れたので、xに関して二分探索をする
for k in range(1,N+1):
    x_min=0
    x_max=N+1
    while x_max>x_min+1:
        x_mid=(x_max+x_min)//2
        if Sx[x_mid]>=k*x_mid:
            x_min=x_mid
        else:
            x_max=x_mid
    print(x_min)

### FIXED CODE ###

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

c = [0] * (N + 1)
Dx = [0] * (N + 1)
for a in A:
    c[a] += 1 #cは、aという数が出た回数を記録
    Dx[c[a]]+=1
    #Dxは、その回数のところに種類を記録。賢い。

Sx=[0]#初項は0
for j in range(1,N+1):
    Sx.append(Sx[j-1]+Dx[j])
#解法2を真似してみる。
for h in range(1,N+1):
    Sx[h]=Sx[h]/h

x=N
k=1
while k<N+1:
    if x<0:
        for _ in range(N-k+1):
            print(0)
        exit(0)
    if k<=Sx[x]:
        print(x)
        k+=1
    else:
        x-=1
### BUGGY CODE ###

class Combination:
    def __init__(self, size, MOD):
        self.MOD = MOD
        self.size = size + 2

        f = 1
        self.fact = fact = [f]
        for i in range(1, size+1):
            f = f * i % MOD
            fact.append(f)
        f = pow(f, MOD-2, MOD)
        self.factInv = factInv = [f]
        for i in range(size, 0, -1):
            f = f * i % MOD
            factInv.append(f)
        factInv.reverse()

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % self.MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.MOD) % self.MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

def sol():
    K = int(input())
    N = len(input())
    MOD = 10**9 + 7
    comb = Combination(N + K + 10, MOD)

    ans = 0
    n = 1
    for l in range(K + 1):
        r = K - l
        ans += comb.nhr(N, l) * n * pow(26, r, MOD)
        ans %= MOD
        n = n * 25 % MOD
    print(ans)
sol()

### FIXED CODE ###

MOD = 10**9 + 7

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

K = int(input())
S = input()
N = len(S)

comb = Combination(N + K + 100)

ans = 0
for l in range(K + 1):
    r = K - l
    ans += pow(25, l, MOD) * comb.nhr(N, l) * pow(26, r, MOD)
    ans %= MOD

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

#!/usr/bin/env python3

n = int(input())
a = [int(x) for x in input().split()]

m = 1
l = 0
while m < n:
    m *= 2
    l += 1
tr = [0] * (2 * m)

tr[m:m + n] = a


def gcd(a, b):
    if not a:
        return b
    while b:
        r = a % b
        a, b = b, r
    return a


def init_tr():
    for d in range(l - 1, -1, -1):
        for i in range(1 << d, 1 << (d + 1)):
            tr[i] = gcd(tr[i * 2], tr[i * 2 + 1])


def upd_tr(j):
    i = j // 2
    if i == 0:
        return
    tr[i] = gcd(tr[i * 2], tr[i * 2 + 1])
    upd_tr(i)


init_tr()

ans = 0

for i in range(n):
    tmp = tr[m + i]
    tr[m + i] = 0
    upd_tr(m + i)
    ans = max(ans, tr[1])
    tr[m + i] = tmp
    upd_tr(m + i)

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

n = int(input())
a = [int(x) for x in input().split()]

m = 1
l = 0
while m < n:
    m *= 2
    l += 1
tr = [0] * (2 * m)

tr[m:m + n] = a


def gcd(a, b):
    if not a:
        return b
    while b:
        r = a % b
        a, b = b, r
    return a


def init_tr():
    for d in range(l - 1, -1, -1):
        for i in range(1 << d, 1 << (d + 1)):
            tr[i] = gcd(tr[i * 2], tr[i * 2 + 1])


def upd_tr(j):
    i = j // 2
    if i == 0:
        return
    tr[i] = gcd(tr[i * 2], tr[i * 2 + 1])
    upd_tr(i)


init_tr()

ans = 0

for i in range(n):
    tmp = tr[m + i]
    tr[m + i] = 0
    upd_tr(m + i)
    ans = max(ans, tr[1])
    tr[m + i] = tmp
    upd_tr(m + i)

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


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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)




### FIXED CODE ###


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

M = 0
ans_lst = [0] * N

for i in range(N-1, -1, -1):
    if sum(ans_lst[i::i+1]) % 2 != a_lst[i]:
        ans_lst[i] = 1
    

m = sum(ans_lst)    


print(m)
ans_str = ""
for i in range(N):
    if ans_lst[i] == 1:
        ans_str += str(i+1) + " "
print(ans_str)
### BUGGY CODE ###

n = int(input())
s = 0
for i in range(n-1):
  s += i + 1
print(s)

### FIXED CODE ###

n = int(input())
print(n * (n - 1) // 2)
### BUGGY CODE ###

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

### FIXED CODE ###

answer=0
i = list(map(int, input().split()))
f=i[0]+1
for a in range(f):
    for b in range(f):
        sum=a+b
        if 0 <= i[1]-sum <= i[0] :
                answer+=1
print(answer)
### BUGGY CODE ###


def main():
    # input
    N,W = map(int,input().split())
    w,v = [0 for _ in range(N)],[0 for _ in range(N)]
    for i in range(N):
        w[i],v[i] = map(int,input().split())
    
    # init dp
    v_max = 10**5
    dp = [[float("inf") for i in range(v_max+1)] for _ in range(N)]
    dp[0][v[0]] = w[0]
    for i in range(N):
        dp[i][0] = 0

    for i in range(1,N):
        for j in range(v_max+1):
            if j<v[i]:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i]]+w[i])
    ans = 0
    for i in range(v_max+1):
        if dp[-1][i]==float("inf"):
            pass
        elif dp[-1][i]<=W:
            ans = i
        else:

            pass
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    # input
    N,W = map(int,input().split())
    w,v = [0]*N,[0]*N
    for i in range(N):
        w[i],v[i] = map(int,input().split())
    
    # init dp
    v_max = sum(v)
    dp = [[float("inf") for i in range(v_max+1)] for _ in range(N)]
    dp[0][v[0]] = w[0]
    for i in range(N):
        dp[i][0] = 0

    for i in range(1,N):
        for j in range(v_max+1):
            if j<v[i]:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i]]+w[i])
    ans = 0
    for i in range(v_max+1):
        if dp[-1][i]<=W:
            ans = i
        else:
            pass
    print(ans)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,m = map(int,input().split(" "))
def bar_M(t):
    return int(t)%m
array = list(map(bar_M,input().split(" ")))

array_sum = [0 for i in range(n+1)]
for i in range(1,n+1):
    array_sum[i] = (array_sum[i-1] + array[i-1])%m

nums = set(array_sum)
sums = []
for i in nums:
    p = array_sum.count(i)
    if p > 1:
        sums.append(p)
ans = 0
for i in sums:
    ans+=int((i-1)*i/2)
print(ans)

### FIXED CODE ###

n,m = map(int,input().split(" "))
array = list(map(int,input().split(" ")))

array_sum,sums = [0,0],{0:1}
for i in range(1,n+1):
    array_sum[0] = array_sum[1]
    array_sum[1] = (array_sum[0] + array[i-1])%m
    sums[array_sum[1]] = sums.get(array_sum[1],0) + 1

ans = 0
for i in sums.values():
    ans+=int((i-1)*i/2)
print(ans)
### BUGGY CODE ###

import numpy as np
L, R = list(map(int, input().split()))

min_val = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    val = (i*j)%2019
    if min_val > val:
      min_val = val
      if min_val == 0:
        break
print(min_val)

### FIXED CODE ###

import numpy as np
L, R = list(map(int, input().split()))

min_val = 2019
for i in range(L, R):
  for j in range(i+1, R+1):
    val = (i*j)%2019
    if min_val > val:
      min_val = val
      if min_val == 0:
        break
  if min_val == 0:
    break
print(min_val)