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

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

results = set()

for i in range(1000):
    # 対象となる3桁の数字を用意
    filled_num = str(i).zfill(3)
    target = list(filled_num)
    count = 0
    index = 0
    j = 0
    for k in range(index, len(S), 1):
        if S[k] == target[j]:
            count += 1
            index = k + 1
            j += 1
            if j == 3:
                results.add(filled_num)
                break

print(len(results))


### FIXED CODE ###

def test(original: list, nums: str, index: int,
         remain_count: int, results: set, results_1, results_2):
    # 3桁抽出したら終了
    if len(nums) == 1:
        if nums in results_1:
            return
        results_1.add(nums)
    if len(nums) == 2:
        if nums in results_2:
            return
        results_2.add(nums)
    if len(nums) == 3:
        # print("".join(array))
        results.add(nums)
        return
    # 最終桁に到達したら終了
    if index == len(original):
        return
    for i in range(index, len(original), 1):
        test(
            original,
            nums + original[i],
            i + 1,
            remain_count,
            results,
            results_1,
            results_2)

    # この桁を抽出対象としないパターン
    # test(original, array[:], index + 1, remain_count - 1, results)


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

results = set()
results_1 = set()
results_2 = set()

# N個の要素
# N-3個を削除
# 3個の組み合わせが何通りあるか？
test(S, "", 0, N - 3, results, results_1, results_2)

print(len(results))
### BUGGY CODE ###

h,w = map(int,input().split())

matrix = [[1]*(w+2)]
matrix += [[1] + [x == '#' for x in input().rstrip()] + [1] for _ in range(h)]
matrix.append([1]*(w+2))

matrix_list1 = []

cnt = -1

for i in range(1,h+1):
    for j in range(1,w+1):
        if matrix[i][j]:
            matrix_list1.append([i,j])

while matrix_list1:
    matrix_list2 = []
    for x,y in matrix_list1:
        if not matrix[x+1][y]:
            matrix[x+1][y] = 1
            matrix_list2.append([x+1,y])
        if not matrix[x-1][y]:
            matrix[x-1][y] = 1
            matrix_list2.append([x-1,y])
        if not matrix[x][y+1]:
            matrix[x][y+1] = 1
            matrix_list2.append([x,y+1])
        if not matrix[x][y-1]:
            matrix[x][y-1] = 1
            matrix_list2.append([x,y-1])
    matrix_list1 = matrix_list2
    cnt += 1
    
print(cnt)

### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
matrix = [["a" for _ in range(w+2)]] + [list("a" + input() + "a") for _ in range(h)] + [["a" for _ in range(w+2)]]

matrix_list1 = deque()
cnt = 0

for i in range(1,h+1):
    for j in range(1,w+1):
        if matrix[i][j] == "#":
            matrix_list1.append([i,j])

while len(matrix_list1) != 0:     
    for _ in range(len(matrix_list1)):
        x,y = matrix_list1.popleft()
        if matrix[x+1][y] == ".":
            matrix[x+1][y] = "#"
            matrix_list1.append([x+1,y])
        if matrix[x-1][y] == ".":
            matrix[x-1][y] = "#"
            matrix_list1.append([x-1,y])
        if matrix[x][y+1] == ".":
            matrix[x][y+1] = "#"
            matrix_list1.append([x,y+1])
        if matrix[x][y-1] == ".":
            matrix[x][y-1] = "#"
            matrix_list1.append([x,y-1])
    else:
        if len(matrix_list1) > 0:
            cnt += 1
    
print(cnt)
### BUGGY CODE ###


def main():

    N,M = map(int,input().split())
    A = [i for i in map(int,input().split())]
    targetList = []

    for i in range(M):
        B,C = map(int,input().split())
        tmpList = [C for _ in range(B) ]
        targetList += tmpList
    
    targetList.sort(reverse=True)
    newList = targetList[0:N] if len(targetList) > N else targetList
    A += newList
    A.sort(reverse=True)
    print(sum(A[0:N]))






if __name__== "__main__":
    main() 


### FIXED CODE ###


def main():

    N,M = map(int,input().split())
    A = [i for i in map(int,input().split())]
    A.sort()
    tmpC = 0
    targetList = []

    for i in range(M):

        element = list(map(int,input().split()))
        targetList.append(element)

    targetList.sort(key=lambda x:x[1],reverse=True)
    
    flag = False
    ans = 0
    for b,c in targetList:
        for j in range(b):
            if N > tmpC and A[tmpC] < c:
                ans += c
                tmpC +=1
            else:
                flag = True
                break
        if flag:
            break
    
    if tmpC < N:

        ans += sum(A[tmpC:])


    print(ans)






if __name__== "__main__":
    main()
### BUGGY CODE ###

import sys
from bisect import *

input=sys.stdin.readline

def f(n):
    r = []
    for _ in range(n):
        a = int(input())
        if not r:
            r.append(a)
            continue
        i = bisect_left(r, a)
        if i:
            r[i-1]=a
        else:
            r = [a] + r
    print(len(r))

n = int(input())
f(n)


### FIXED CODE ###

import sys
from bisect import *

input=sys.stdin.readline

def f(n):
    mi=-1
    r = [inf]*n
    for _ in range(n):
        a = -int(input())
        i = bisect_right(r, a)
        r[i]=a
        if i>mi:
            mi=i
    print(mi+1)

n = int(input())
inf=10**10
f(n)
### BUGGY CODE ###

import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 998244353
N,S = map(int,readline().split())
A = list(map(int,readline().split()))
dp = [[0 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
  for j in range(S+1):
    dp[i+1][j] += 2*dp[i][j]
    dp[i+1][j] %= mod
    if j + A[i] <=S:
      dp[i+1][j+A[i]] += dp[i][j]
      dp[i+1][j+A[i]] %= mod
print(dp[N][S]%mod)

### FIXED CODE ###

import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 998244353
N,S = map(int,readline().split())
A = list(map(int,readline().split()))
dp = [[0 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
  for j in range(S+1):
    dp[i+1][j] += 2*dp[i][j]
    dp[i+1][j] %= mod
    if j + A[i] <=S:
      dp[i+1][j+A[i]] += dp[i][j]
      dp[i+1][j+A[i]] %= mod
print(dp[N][S]%mod)
### BUGGY CODE ###

n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
arr = [abs(x[i] - x[i + 1]) for i in range(m-1)]
for _ in range(n - 1):
    if len(arr) <= 0:
        break
    arr.remove(max(arr))

print(sum(arr))

### FIXED CODE ###

n, m = map(int, input().split())
x = sorted(map(int, input().split()))
arr = [x[i + 1] - x[i] for i in range(m - 1)]
arr.sort(reverse=True)
print(sum(arr[n-1:]))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)

n=int(input())
s=list(input())
a=[0 for i in range(1000)]
res=[0,0,0]
#cnt=0
def abc(i,cnt):
    global s,a,res
    if i==3:
        b=100*int(res[0])+10*int(res[1])+int(res[2])
        if a[b]!=1:
            a[b]+=1
    elif cnt>=n:
        pass
    else:
        if res[0]==0:
            res[0]=s[cnt]
            abc(i+1,cnt+1)
            res[0]=0
            abc(i,cnt+1)
        elif res[1]==0:
            res[1]=s[cnt]
            abc(i+1,cnt+1)
            res[1]=0
            abc(i,cnt+1)
        else:
            res[2]=s[cnt]
            abc(i+1,cnt+1)
            res[2]=0
            abc(i,cnt+1)
abc(0,0)
print(sum(a))

### FIXED CODE ###

n=int(input())
s=list(input())
s=[int(i) for i in s]
res=[[0 for i in range(10)]for i in range(n)]
for i in range(n-1,0,-1):
    for j in range(10):
        res[i-1][j]=res[i][j]
    res[i-1][s[i]]+=1
cnt=0
#print(res)
a=[0]*10
for i in range(n-2):
    if a[s[i]]!=0:
        continue
    a[s[i]]+=1
    b=[0]*10
    for j in range(i+1,n-1):
        if b[s[j]]==0:
            b[s[j]]+=1
            cnt+=10-res[j].count(0)

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

s = input()
q = int(input())
query = [input() for i in range(q)]
rvs = 1
for i in range(q):
    if query[i] == "1":
        rvs = rvs * (-1)
    else:
        if query[i][2:3] == "1":
            if rvs == 1:
                s = query[i][4:5] + s
            else:
                s = s + query[i][4:5]
        else:
            if rvs == -1:
                s = query[i][4:5] + s
            else:
                s = s + query[i][4:5]
if rvs == -1:
    s = s[::-1]
print(s)

### FIXED CODE ###

s = input()
q = int(input())
query = [input() for i in range(q)]
rvs = 1
s1 = ""
for i in range(q):
    if query[i] == "1":
        rvs = rvs * (-1)
    else:
        if query[i][2:3] == "1":
            if rvs == 1:
   #             s = query[i][4:5] + s
                s1 = s1 + query[i][4:5]
            else:
                s = s + query[i][4:5]
        else:
            if rvs == -1:
    #            s = query[i][4:5] + s
                s1 = s1 + query[i][4:5]
            else:
                s = s + query[i][4:5]
if rvs == -1:
    s = s[::-1] + s1
else:
    s = s1[::-1] + s
#print(rvs,s1,s)
print(s)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
    b=a.index(i)+1
    print(b,end=" ")

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b={}
cnt=1;
for i in a:
    b[i]=cnt
    cnt+=1
for i in range(1,n+1):
    print(b[i], end=" ")
### BUGGY CODE ###

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

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

res = 0
for j in range(N-K+1):
  q = p[j:j+K]
  ans = 0
  for i in q:
    ans += ((1+i)*i/2)/i
  res = max(res,ans)
  
print(res) 

### FIXED CODE ###

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

p = [((1+int(i))*int(i)/2)/int(i) for i in input().split()]

m = check = sum(p[0:K])
for i in range(K,N):
  check = check+p[i]-p[i-K]
  m = max(m,check)
print(m)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
N,Q = list(map(int,input().split()))
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    ab=list(map(int,input().split()))
    to[ab[0]].append(ab[1])
    to[ab[1]].append(ab[0])
for _ in range(Q):
    px = list(map(int,input().split()))
    ans[px[0]] += px[1]

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

N,Q = map(int,input().split())
to = [[] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b=map(int,input().split())
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    p,x = map(int,input().split())
    ans[p] += x

def dfs(v, p):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
dfs(1, -1)
print(*ans[1:])
### BUGGY CODE ###

#127_D
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
heapq.heapify(a)
for _ in range(m):
    b, c = map(int, input().split())
    for i in range(b):
        if c > a[0]:
            heapq.heappop(a)
            heapq.heappush(a, c)
print(sum(a))

### FIXED CODE ###

#127_D
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [(1, a[i]) for i in range(n)]+[tuple(map(int, input().split())) for _ in range(m)]
bc.sort(key= lambda x: -x[1])

tmp = 0
ans = 0
for b, c in bc:
    x = min(b, n-tmp)
    ans += c * x
    tmp += x
    
    if tmp == n:
        break

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

N = int(input())
A = [int(a)-(i+1) for i, a in enumerate(input().split())]
ans = prv_ans = float('inf')
for b in range(min(A), max(A)+1):
  tmp_ans = sum([abs(A[i]-b) for i in range(N)])
  if prv_ans < tmp_ans: break
  ans = min(ans, tmp_ans)
  tmp_ans = ans
print(ans)

### FIXED CODE ###

import statistics
N = int(input())
A = [int(a)-(i+1) for i, a in enumerate(input().split())]
ans = float('inf')
medi = int(statistics.median(A))
for b in range(medi-1, medi+2):
  ans = min(ans, sum([abs(A[i]-b) for i in range(N)]))
print(ans)
### BUGGY CODE ###

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())
    
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j-w[i]<0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j],
                             dp[i][j-w[i]] + v[i])
print(dp[N][W])

### FIXED CODE ###

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())
    
dp = [0]*(W+1) 
for i in range(N):
    for j in reversed(range(W+1)):
        if j-w[i]<0:
            dp[j] = dp[j]
        else:
            dp[j] = max(dp[j],
                        dp[j-w[i]] + v[i])
    # print(dp)
print(dp[W])
### BUGGY CODE ###

x,y,z,K = map(int, input().split())
a = sorted(list(map(int, input().split())))[::-1]
b = sorted(list(map(int, input().split())))[::-1]
c = sorted(list(map(int, input().split())))[::-1]

def check(p, l=None):
    cnt = 0
    for i in range(x):
        for j in range(y):
            for k in range(z):
                if a[i]+b[j]+c[k] < p:
                    break
                if l is not None:
                    l.append(a[i]+b[j]+c[k])
                cnt += 1
                if cnt >= K:
                    return True
    return False

left = 0
right = a[0]+b[0]+c[0] + 1
while right-left > 1:
    mid = (left+right)//2
    if check(mid):
        left = mid
    else:
        right = mid
#print(left)
ans = []
check(right, ans)
ans += [left]*(K - len(ans))
for i in sorted(ans, reverse=True)[:K]:
    print(i)

### FIXED CODE ###

from heapq import heappop, heappush

x,y,z,k = map(int, input().split())
abc = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
heap = [[-sum(abc[i][0] for i in range(3)), (0,0,0)]]


cnt = 0
used = set()
while cnt < k:
    score, (a,b,c) = heappop(heap)
    if (a,b,c) in used:
        continue
    print(-score)
    used.add((a,b,c))
    cnt += 1
    for i in range(3):
        na = a+int(i==0)
        nb = b+int(i==1)
        nc = c+int(i==2)
        if 0<=na<x and 0<=nb<y and 0<=nc<z:
            nscore = 0
            for ind, j in enumerate([na,nb,nc]):
                nscore -= abc[ind][j]
            heappush(heap,[nscore, (na,nb,nc)])
### BUGGY CODE ###

import sys
lines = sys.stdin.readlines()
sizes = lines[0].split(" ")
N = int(sizes[0])
T = int(sizes[1])
line = lines[1].split(" ")
inp = []
for i in line:
    inp.append(int(i))

check = []
checkMax = []

#for i in range(len(inp)):
i=0
c = []
for j in range(i+1,len(inp)):
    #if inp[i]<inp[j]:
    c.append(inp[j]-inp[i])
#check.append(c)
check=c
checkMax.append(max(check))

while (len(check)>1):
    check.pop(0)
    checkMax.append(max(check))


for j in range(1,len(inp)):
    checkMax[j-1] += inp[0]-inp[j]

#print (check)
#print (checkMax)
print (checkMax.count(max(checkMax)))


### FIXED CODE ###

import sys
lines = sys.stdin.readlines()
sizes = lines[0].split(" ")
N = int(sizes[0])
T = int(sizes[1])
line = lines[1].split(" ")
inp = []
for i in line:
    inp.append(int(i))

check = []
checkMax = []

#for i in range(len(inp)):
#i=0
#c = []
#for j in range(i+1,len(inp)):
    #if inp[i]<inp[j]:
#    c.append(inp[j]-inp[i])
#check.append(c)
#check=c
#checkMax.append(max(check))

#while (len(check)>1):
#    check.pop(0)
#    checkMax.append(max(check))


#for j in range(1,len(inp)):
#    checkMax[j-1] += inp[0]-inp[j]

count=0
for i in range(1,len(inp)):
    if i==1:
        mi = min(inp[0],inp[1])
        ma = inp[1]-inp[0]
        if ma>0:
            count+=1
    elif i>1:
        if ma<inp[i]-mi:
            count=1
            ma=inp[i]-mi
        elif ma==inp[i]-mi:
            count+=1
        mi = min(inp[i],mi)

print (count)


#print (check)
#print (checkMax)
#print (checkMax.count(max(checkMax)))
### BUGGY CODE ###

n = int(input())
A=list(map(int, input().split())) 
ans = 1

for a in A:
    ans *= a

if ans > 10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
A=list(map(int, input().split())) 
ans = 1
if A.count(0) >= 1:
    print(0)
    exit()

for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
    
print(ans)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 7)


def func(l, r):
    # [l,r]
    # return この手番の人 - 次の手番の人
    if l == r:
        return a[l]

    if memo[l][r] is not None:
        return memo[l][r]

    res = max(a[r] - func(l, r - 1), a[l] - func(l + 1, r))
    memo[l][r] = res
    return res


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

memo = [[None] * n for _ in range(n)]

print(func(0, n - 1))


### FIXED CODE ###

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

memo = tuple([None] * n for _ in range(n))
for i, aa in enumerate(a):
    memo[i][i] = aa

for l in range(n - 1, -1, -1):
    for r in range(l, n):
        if memo[l][r] is None:
            memo[l][r] = max(a[r] - memo[l][r - 1], a[l] - memo[l + 1][r])

print(memo[0][n - 1])
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
max_a=A[0]
dp=[True]*(max_a+1)
ans=0
for i in range(N):
  a=A.pop()
  #print(a)
  if dp[a]==False:
    continue
  if a not in A:
    ans+=1
  i=1
  k=a
  while k<=max_a:
    dp[k]=False
    i+=1
    k=a*i
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
max_a=A[-1]
dp=[True]*(max_a+1)
ans=0
for i in range(N):
  a=A[i]
  #print(a)
  if dp[a]==True: 
    if i==N-1:
      ans+=1
    elif a!=A[i+1]:
      ans+=1
    
    k=a
    while k<=max_a:
      dp[k]=False    
      k+=a
print(ans)
### BUGGY CODE ###

import heapq
from heapq import heapify, heappush, heappop

global G

def input_graph(M, uvab):
  global G
  for i in range(M):
    u, v, a, b = uvab[i]
    G[u-1] += [[v-1, (a, b)]]
    G[v-1] += [[u-1, (a, b)]]
  
def dijkstra(N, S, flag):
  global G
  dist = [float('inf') for _ in range(N)]
  dist[S] = 0
  Q = [(0, S)]
  while Q:
    c, v = heappop(Q)
    if dist[v] < c:
      continue
    for t, cost in G[v]:
      yen, snuuk = cost
      if flag:
        if dist[v] + yen < dist[t]:
          dist[t] = dist[v] + yen
          heappush(Q, (dist[t], t))
      else:
        if dist[v] + snuuk < dist[t]:
          dist[t] = dist[v] + snuuk
          heappush(Q, (dist[t], t))
  return dist

def main():
  global G, dist
  N, M, S, T = map(int, input().split())
  S -= 1
  T -= 1
  uvab = [list(map(int, input().split())) for _ in range(M)]
  G = [[] for _ in range(N)]
  dist = [float('inf') for _ in range(N)]
  dist[S] = 0
  input_graph(M, uvab)
  yen_dist = dijkstra(N, S, True)
  snuuk_dist = dijkstra(N, T, False)
  dist = [yen_dist[i]+snuuk_dist[i] for i in range(N)]
  for i in range(N):
    print(10**15-min(dist[i:]))


if __name__ == "__main__":
  main()

### FIXED CODE ###

import heapq
from heapq import heapify, heappush, heappop

global G

def input_graph(M, uvab):
  global G
  for i in range(M):
    u, v, a, b = uvab[i]
    G[u-1] += [[v-1, (a, b)]]
    G[v-1] += [[u-1, (a, b)]]
  
def dijkstra(N, S, flag):
  global G
  dist = [float('inf') for _ in range(N)]
  dist[S] = 0
  Q = [(0, S)]
  while Q:
    c, v = heappop(Q)
    if dist[v] < c:
      continue
    for t, cost in G[v]:
      yen, snuuk = cost
      if flag:
        if dist[v] + yen < dist[t]:
          dist[t] = dist[v] + yen
          heappush(Q, (dist[t], t))
      else:
        if dist[v] + snuuk < dist[t]:
          dist[t] = dist[v] + snuuk
          heappush(Q, (dist[t], t))
  return dist

def main():
  global G, dist
  N, M, S, T = map(int, input().split())
  S -= 1
  T -= 1
  uvab = [list(map(int, input().split())) for _ in range(M)]
  G = [[] for _ in range(N)]
  dist = [float('inf') for _ in range(N)]
  dist[S] = 0
  input_graph(M, uvab)
  yen_dist = dijkstra(N, S, True)
  snuuk_dist = dijkstra(N, T, False)
  #print(yen_dist)
  #print(snuuk_dist)
  dist = [yen_dist[i]+snuuk_dist[i] for i in range(N)]
  for i in range(N-2, -1, -1):
    dist[i] = min(dist[i+1], dist[i])
  for i in range(N):
    print(10**15-dist[i])

if __name__ == "__main__":
  main()
### BUGGY CODE ###

N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
 
for i in range(N):
  for j in range(i + 1, N):
    for k in range(N - 1, j, -1):
      if L[k] < L[i] + L[j]:
        count += k - j 
        break
print(count)

### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
from bisect import bisect_left
for i in range(N - 2):
  for j in range(i + 1, N - 1):    
      count += bisect_left(L, L[i] + L[j]) - 1 - j
      
print(count)
### BUGGY CODE ###

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

L = []
R = []
C = [1] * N

for i in range(M):
    a, b = map(int, input().split())
    L.append(a)
    R.append(b)

for i in range(M):
    a = L[i] - 1
    b = R[i]

    if a == 0:
        C[b:] = [0] * (len(C)-b)
    elif b-1 == len(C):
        C[:a] = [0] * a
    else:
        C[b:] = [0] * (len(C) - b)
        C[:a] = [0] * a

print(sum(C))

### FIXED CODE ###

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

L = []
R = []
l = 0
r = 10 ** 6
for i in range(M):
    a,b = map(int, input().split())
    L.append(a)
    R.append(b)

for i in range(M):
    if l < L[i]:
        l = L[i]
    if r > R[i]:
        r = R[i]

ans = r-l+1
if ans > 0:
    print(ans)
else:
    print("0")
### BUGGY CODE ###


k=int(input())

import numpy as np
s6=0
for i in range(2,k-1):
    for j in range(i+1,k):
        for jj in range(j+1,k+1):
            #print(i,j,jj)
            s6+=np.gcd.reduce([i,j,jj])

s3=0
for i in range(2,k):
    for j in range(i+1,k+1):
        #print(i,j)
        s3+=np.gcd.reduce([i,j])

s1=sum(list(range(1,k+1,1)))


print(s1+s3*6+s6*6+(k-1)*6+(k-2)*(k-1)*3)

### FIXED CODE ###


k=int(input())
 
from math import gcd
s6=0
for i in range(2,k-1):
    for j in range(i+1,k):
        for jj in range(j+1,k+1):
            s6+=gcd(gcd(i,j),jj)
 
s3=0
for i in range(2,k):
    for j in range(i+1,k+1):
        s3+=gcd(i,j)
 
s1=int((k+1)*k/2)
 
 
print(s1+s3*6+s6*6+(k-1)*6+(k-2)*(k-1)*3)
### BUGGY CODE ###

from collections import deque

N = int(input())
A = list(map(int, input().split()))
que = deque([0]*N)
bn = 0
for i in range(N, 0, -1):
    nn = 0
    for j in range(2*i, N+1, i):
        nn += que[j-1]

    if nn % 2 == A[i-1]:
        que[i-1] = 0
    else:
        que[i-1] = 1

M = sum(que)
print(sum(que))
if M != 0:
    ans = []
    for i, n in enumerate(que):
        if n == 1:
            ans.append(i+1)
    print(' '.join(map(str, ans)))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
num_l = [0]*N
bn = 0
for i in range(N, 0, -1):
    nn = 0
    for j in range(2*i, N+1, i):
        nn += num_l[j-1]

    if nn % 2 != A[i-1]:
        num_l[i-1] = 1

M = sum(num_l)
print(M)
if M != 0:
    ans = []
    flg = False
    for i, n in enumerate(num_l):
        if flg:
            print(' ', end='')
        if n == 1:
            print(i+1, end='')
        flg = True