Harryxun/stf_run huggingface dataset:
# ABC 087 B Coins
A=input()
B=input()
C=input()
X=input()

cnt=0
for a in range(A):
    if 500*a >X:
        break
    else:
        for b in range(B):
            if 500*a + 100*b >X:
                break
            elif (X-500*a-100*b)/50<=C:
                cnt+=1
            else:
                continue
print(cnt)


### FIXED CODE ###

i = [int(input()) for i in range(4)]
A=i[0]
B=i[1]
C=i[2]
X=i[3]

cnt=0
for a in range(A+1):
    if 500*a >X:
        break
    else:
        for b in range(B+1):
            if 500*a + 100*b >X:
                break
            elif (X-500*a-100*b)/50<=C:
                cnt+=1
            else:
                continue
print(cnt)
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n-1,-1,-1):
    # i+1の討伐
    if a[i+1] < b[i]:
        count += a[i+1]
        b[i] -= a[i+1]
        a[i+1] = 0
    else:
        count += b[i]
        a[i+1] -= b[i]
        b[i] = 0

    # iの討伐
    if a[i] < b[i]:
        count += a[i]
        b[i] -= a[i]
        a[i] = 0
    else:
        count += b[i]
        a[i] -= b[i]
        b[i] = 0

print(count)

### FIXED CODE ###

a,b = map(int,input().split())
if (a % 2 == 0 and b % 2 == 0) or (a % 2 == 1 and b % 2 == 1):
    print((a+b)//2)
else:
    print('IMPOSSIBLE')
a=int(input())
b=int(input())
c=int(input())
s=int(input())
n=0
for x in range(a):
  for y in range(b):
    for z in range(c):
      if 500x+100y+50z==s:
        n=n+1
print(n)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
s=int(input())
n=0
for x in range(a+1):
    for y in range(b+1):
        for z in range(c+1):
            if 500*x+100*y+50*z==s:
                n=n+1
print(n)
n = int(input())
v = list(map(int, input().split()))

even_dict = {}
odd_dict = {}
for i, value in enumerate(v):
    if i % 2:
        even_dict[value] = 1 if value not in even_dict else even_dict[value] + 1
    else:
        odd_dict[value] = 1 if value not in odd_dict else odd_dict[value] + 1

counter = 0
even = sorted(even_dict.items(), key=lambda x: x[1], reverse=True)
odd = sorted(odd_dict.items(), key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if even[0][1] - even[1][1] > odd[0][1] - odd[1][1]:
        counter += sum([x[1] for x in even[1:]])
        counter += sum([x[1] for x in odd[2:] + [odd[0]]])
    else:
        counter += sum([x[1] for x in odd[1:]])
        counter += sum([x[1] for x in even[2:] + [even[0]]])
else:
    counter += sum([x[1] for x in even[1:]])
    counter += sum([x[1] for x in odd[1:]])

print(counter)

### FIXED CODE ###

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

even_dict = {}
odd_dict = {}
for i, value in enumerate(v):
    if i % 2:
        even_dict[value] = 1 if value not in even_dict else even_dict[value] + 1
    else:
        odd_dict[value] = 1 if value not in odd_dict else odd_dict[value] + 1

counter = 0
even = sorted(even_dict.items(), key=lambda x: x[1], reverse=True)
odd = sorted(odd_dict.items(), key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    even_second = 0 if len(even) < 2 else even[1][1]
    odd_second = 0 if len(odd) < 2 else odd[1][1]
    if even[0][1] - even_second > odd[0][1] - odd_second:
        counter += sum([x[1] for x in even[1:]])
        counter += sum([x[1] for x in odd[2:] + [odd[0]]])
    else:
        counter += sum([x[1] for x in odd[1:]])
        counter += sum([x[1] for x in even[2:] + [even[0]]])
else:
    counter += sum([x[1] for x in even[1:]])
    counter += sum([x[1] for x in odd[1:]])

print(counter)
# coding : utf-8

import numpy as np

N = int(input())
X = np.array([int(i) for i in input().split()])

X = np.sort(X)
maxl = np.max(X)
Xed = (X - maxl/2)**2
com = Xed[np.where(np.min(Xed))]
print(X)
print(Xed)
print(com)
print(maxl,Xed[com[0]])


### FIXED CODE ###

# coding : utf-8

import numpy as np

N = int(input())
X = np.array([int(i) for i in input().split()])

X = np.sort(X)
maxl = np.max(X)
Xed = (X - maxl/2)**2
com = X[np.where(Xed == np.min(Xed))]

print(maxl,com[0])
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i][j] % 2 == 0:
            continue
        elif j+1 < w and :
            a[i][j+1] += 1
            ans.append(i, j, i, j+1)
        elif i+1 < h:
            a[i+1][j] += 1
            ans.append(i, j, i+1, j)
print(len(ans))
for x in ans:
    print(x[0], x[1], x[2], x[3])


### FIXED CODE ###

H, W = map(int, input().split())
A = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    A[h] = list(map(int, input().split()))
    
ans = []
for h in range(H-1):
    for w in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ans.append([h+1, w+1, h+2, w+1])
            
for w in range(W-1):
    if A[H-1][w] % 2 == 1:
        A[H-1][w] -= 1
        A[H-1][w+1] += 1
        ans.append([H, w+1, H, w+2])
    
print(len(ans))
for a in ans:
    print(a[0], a[1], a[2], a[3])
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm==num1*num2/gud
    print gud,lcm

### FIXED CODE ###

import sys
import math

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
            list.append(num1/check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm
S=list(int(input()))

red=0
blue=0
for i in range(N):
    if S[i]==0:
        red+=1
    else:
        blue+=1
print(min(red,blue)*2)

### FIXED CODE ###

S=list(input())

red=0
blue=0
for i in range(len(S)):
    if S[i]=="0":
        red+=1
    else:
        blue+=1
        
print(min(red,blue)*2)
while True:
  H,W=map(int,input().split())
  for i in range(H):
      print("#"*W)
  print("\n")


### FIXED CODE ###

while True:
  H,W=map(int,input().split())
  if H==0 and W==0:
      break
  for i in range(H):
      print("#"*W)
  print()
a b c d = map(int, input().split())


if b<=c:
    print ('0')
    exit()
elif:
    if b>=d:
        print(d-c)
        exit()
    elif b<d:
        print(b-c)
        exit()

### FIXED CODE ###

a, b, c, d = map(int, input().split())

print(max(0, min(d,b)-max(c,a)))
N = input()
a = []
for i in range(N):
    a.append(input())
b = [0]
for i in a:
	j = 0
	while j < 3:
		if i > b[j]:
			b.insert(j, i)
			break
		j += 1

for i in b[:3]:
	print i

### FIXED CODE ###

import sys

a = []
for line in sys.stdin:
    a.append(int(line))
b = [0, 0, 0]
for i in a:
	j = 0
	while j < 3:
		if i > b[j]:
			b.insert(j, i)
			break
		j += 1

for i in b[:3]:
	print i
def f(a):
  global R,G,B,N,ans,Rm,Gm,Bm

  for b in range(N-R*a+1):
    cmod=(N-R*a-G*b)%B
    c=(N-R*a-G*b)//B
    if cmod==0 and  c>=0:
      ans+=1

  if a>0:
    f(a-1)


R,G,B,N=list(map(int,input().split(" ")))
Rm=N//R
Gm=N//G
Bm=N//B

ans=0

f(Rm)

print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)

def f(a):
  global R,G,B,N,ans,Rm,Gm,Bm

  for b in range(N-R*a+1):
    cmod=(N-R*a-G*b)%B
    c=(N-R*a-G*b)//B
    if cmod==0 and  c>=0:
      ans+=1
    elif c<0:
      break

  if a>0:
    f(a-1)


R,G,B,N=list(map(int,input().split(" ")))

ans=0

f(N//R+1)

print(ans)
Jupyter Notebook
0temp-Copy3
(autosaved)
Current Kernel Logo
Python 3 
File
Edit
View
Insert
Cell
Kernel
Navigate
Widgets
Help

7
ABC147
from ipywidgets import Textarea
import io
​
if 'open' in globals():
    del open
if 'input' in globals():
    del input
​
original_open = open
​
class custom_open():
    def __init__(self):
        self.text = ''
​
    def __call__(self, file, *args, **kwargs):
        if file == 0:
            return io.StringIO(self.text)
        return original_open(file, *args, **kwargs)
​
    def updater(self, change):
        self.text = change["new"]
​
class custom_input():
    def __init__(self):
        self.__sio = io.StringIO('')
        self.shell = get_ipython()
        if self.shell.events.callbacks['pre_run_cell'] != []:
            self.shell.events.callbacks['pre_run_cell'] = []
        self.shell.events.register('pre_run_cell', self.pre_run_cell)
​
    def __call__(self):
        return self.__sio.readline().strip()
​
    def pre_run_cell(self, info):
        text = self.shell.user_ns.get('text_area', None).value
        self.__sio = io.StringIO(text)
​
open = custom_open()
input = custom_input()
​
text_area = Textarea()
text_area.observe(open.updater, names='value')
display(text_area)
vvvvvv
### B - Palindrome-philia
s = input()
​
n = len(s)
if n % 2 == 1:
    front = s[:(n//2 - 1)]
    rev = front[::-1]
    end = s[(n//2 - 1):]
else:
    front = s[:(n//2)]
    rev = front[::-1]
    end = s[(n//2):]
​
res = 0
for i in range(n//2 - 1):
    if rev[i] != end[i]:
        res += 1
print(res)
0
rev
'cder'
end
'oder'


### FIXED CODE ###

s = input()
n = len(s)
res = 0
for i in range(n//2):
    if s[i] != s[-(i+1)]:
        res += 1
print(res)
n,k=map(int,input().split())
def expe(n):
  return (n+1)/2
p=[expe(int(x)) for x in input().split()]
l,r=[p[0]]*n,[p[n-1]]*n
for i in range(n-1):
  l[i+1]=l[i]+p[i+1]
  r[n-2-i]=r[n-1-i]+p[n-2-i]
su=sum(p)
ans=max(su-r[k],su-l[n-k-1])
for i in range(1,n-k-1):
  sumk=su-l[i-1]-r[i+k]
  ans=max(sumk,ans)
print(ans)
  

### FIXED CODE ###

n,k=map(int,input().split())
def expe(n):
  return (n+1)/2
p=[expe(int(x)) for x in input().split()]
l,r=[p[0]]*(n+1),[p[n-1]]*(n+1)
for i in range(n-1):
  l[i+1]=l[i]+p[i+1]
  r[n-2-i]=r[n-1-i]+p[n-2-i]
r[n],l[n]=0,sum(p)
su=sum(p)
ans=max(su-r[k],su-l[n-k-1])
for i in range(1,n-k-1):
  sumk=su-l[i-1]-r[i+k]
  ans=max(sumk,ans)
print(ans)
N, Q = map(int, input().split())
S = input()
qn = [list(map(int, input().split())) for _ in range(Q)]
cnt = [0 for _ in range(N+10)]
for i in range(1, N+1):
    if (S[i-1:i+1] == "AC"):
        cnt[i] = cnt[i-1] + 1
    else:
        cnt[i] = cnt[i-1]
for q in qn:
    l, r = q
    print(cnt[r-1] - cnt[l-1])


### FIXED CODE ###

import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product
from itertools import combinations

N = int(input())
An = list(map(int, input().split()))
Bn = []
Bn.append(0)
for i, A in enumerate(An):
    Bn.append(A+Bn[i])
Cn = collections.Counter(Bn)
ans = 0
for c in Cn.values():
    if c < 2:
        continue
    ans += c * (c-1) // 2
print(ans)
K, S = list(map(int, input().split()))
if S <= K:
	print(int((S + 2) * (S + 1) / 2))
elif S <= 2 * K:
	ans = int((S - K + 1) * (2 * K - S) * (S - K) (S - K + 1) / 2)
	print(ans)
else:
	print(int((3 * K - S + 1) * (3 * K - S + 2) / 2))

### FIXED CODE ###

K, S = list(map(int, input().split()))
if S <= K:
	print(int((S + 2) * (S + 1) / 2))
elif S <= 2 * K:
	ans = (-3 * (K ** 2) + 3 * K + 6 * S * K - 2 * (S ** 2) + 2) // 2
	print(int(ans))
else:
	print(int((3 * K - S + 1) * (3 * K - S + 2) / 2))
# 000から９９９まで決め打ちで全探索。計算量はO(1000*N)程度
def solution1():

    # 入力
    n = int(input())
    s = [int(i) for i in input()]
    cnt = 0
    for c in range(1000):
        candidate = [c/100, (c/10)%10, c%10]
        f = 0
        for j in range(n):
            if s[j] == ("0" + candidate[f]):
                f += 1
            if f == 2:
                break
        if f == 2:
            cnt += 1
    print(cnt)
if __name__ == "__main__":
    solution1()

### FIXED CODE ###

def solution1():

    # 入力
    n = int(input())
    s = [int(i) for i in input()]
    cnt = 0
    for c in range(1000):
        # 100の桁、１０の桁、１の桁に分解
        candidate = [c//100, (c//10)%10, c%10]
        f = -1
        for j in range(n):
            if s[j] == candidate[f]:
                f += 1
            if f == 2:
                break
        if f == 2:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    solution1()
s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
  S = 0
  while l >= 1:
    l = i
    p = l%10
    l = l//10
    S = S + p
  if A <= S <= B:
    k = k + i
print(k)

### FIXED CODE ###

s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
  S = 0
  p = str(i)
  q = [str(c) for c in p]
  q = list(map(int,q))
  for j in range(len(q)):
    S = S + q[j]
  if A <= S <= B:
    k = k + i
print(k)
c = str(input())

List = ['a','b','c','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

c_index = List.index(c)
ans = List[c_index+1]
print(ans)

### FIXED CODE ###

c = str(input())

List = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

c_index = List.index(c)
ans = List[c_index+1]
print(ans)
n,m = map(int,input().split())
lr = [[map(int,input().split())] for i in range(m)]

max = 0
min = n+1
for i in range(m):
    if lr[i][0] > max :
        max = lr[i][0]
    if lr[i][1] < min :
        min = lr[i][1]

print(min-max+1)


### FIXED CODE ###

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

max = 0
min = n+1
for i in range(m):
    if lr[i][0] > max :
        max = lr[i][0]
    if lr[i][1] < min :
        min = lr[i][1]

if min-max >= 0:
    print(min-max+1)
else :
    print(0)
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

board = [[0] * W for i in range(H)]

if S[0][0] == '#':
    board[0][0] = 1

for i in range(1, W):
    if S[0][i - 1] == '.' and S[0][i] == '#':
        board[0][i] = board[0][i - 1] + 1
    else:
        board[0][i] = board[0][i - 1]

for i in range(1, H):
    if S[i - 1][0] == '.' and S[i][0] == '#':
        board[i][0] = board[i - 1][0] + 1
    else:
        board[i][0] = board[i - 1][0]

for i in range(1, W):
    for j in range(1, H):
        if S[i][j] == '.':
            board[i][j] = min(board[i - 1][j], board[i][j - 1])
        else:
            if S[i - 1][j] == '.':
                left = 1
            else:
                left = 0
            if S[i][j - 1] == '.':
                up = 1
            else:
                up = 0
            board[i][j] = min(board[i - 1][j] + left, board[i][j - 1] + up)

print(board[H - 1][W - 1])


### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

board = [[0] * W for i in range(H)]

if S[0][0] == '#':
    board[0][0] = 1

for i in range(1, W):
    if S[0][i - 1] == '.' and S[0][i] == '#':
        board[0][i] = board[0][i - 1] + 1
    else:
        board[0][i] = board[0][i - 1]

for i in range(1, H):
    if S[i - 1][0] == '.' and S[i][0] == '#':
        board[i][0] = board[i - 1][0] + 1
    else:
        board[i][0] = board[i - 1][0]

for i in range(1, H):
    for j in range(1, W):
        if S[i][j] == '.':
            board[i][j] = min(board[i - 1][j], board[i][j - 1])
        else:
            if S[i - 1][j] == '.':
                up = 1
            else:
                up = 0
            if S[i][j - 1] == '.':
                left = 1
            else:
                left = 0
            board[i][j] = min(board[i - 1][j] + up, board[i][j - 1] + left)

print(board[H - 1][W - 1])
s=sorted(input())
print(YES if s == '557' else NO)

### FIXED CODE ###

s=sorted(list(map(int,input().split())))
print('YES' if s == [5,5,7] else 'NO')
n, r = map(int, input().split())
if n >= 10:
  print(r)
else
  print(n + 100 * (10-r)) 

### FIXED CODE ###

n,r = map(int, input().split())
 
if n >= 10:
  print(r)
else:
  print(r + 100 * (10-n))
from math import sqrt
N = int(input())
ans = [0] * (N+1)
x = int(sqrt(N-2))+1
for j in range(1, x):
    for k in range(1, x):
        for l in range(1, x):
            y = j**2+k**2+l**2+j*k+k*l+l*j
            if y <= N:
                ans[y] += 1
for n in ans[1:N+1]:
    print(n)

### FIXED CODE ###

from math import sqrt
N = int(input())
if N == 1:
    print(0)
    import sys
    sys.exit()
ans = [0] * (N+1)
x = int(sqrt(N-2))+1
for j in range(1, x):
    for k in range(1, x):
        for l in range(1, x):
            y = j**2+k**2+l**2+j*k+k*l+l*j
            if y <= N:
                ans[y] += 1
for n in ans[1:N+1]:
    print(n)
#!/usr/bin/env python

import math


def main():
    A, B = map(int, input().split())

    A, B = B, A

    if A == B == 1:
        print(1, 2)
        print('.#')

    N = 50 if max(A, B) >= 50 else max(A, B)

    ans = []
    if A != 1:
        if B != 1:
            a = A - 1
        else:
            a = A
        while a > 0:
            tmp = []
            for i in range(N):
                if a <= 0:
                    # print('..', end='')
                    tmp.append('..')
                else:
                    # print('#.', end='')
                    tmp.append('#.')
                    a -= 1
            ans.append(''.join(tmp))
            ans.append('.' * N * 2)
    if B != 1:
        if A != 1:
            b = B - 1
        else:
            b = B
        ans.append('#' * N * 2)
        while b > 0:
            tmp = []
            for i in range(N):
                if b <= 0:
                    tmp.append('##')
                else:
                    tmp.append('.#')
                    b -= 1
            ans.append('#' * N * 2)
    print(len(ans), len(ans[0]))
    for l in ans:
        print(l)


if __name__ == '__main__':
    # print(main())
    main()

### FIXED CODE ###

#!/usr/bin/env python

import math


def main():
    A, B = map(int, input().split())

    A, B = B, A

    if A == B == 1:
        print(1, 2)
        print('.#')
        return

    N = 50 if max(A, B) >= 50 else max(A, B)

    ans = []
    if A != 1:
        if B != 1:
            a = A - 1
        else:
            a = A
        while a > 0:
            tmp = []
            for i in range(N):
                if a <= 0:
                    tmp.append('..')
                else:
                    # print('#.', end='')
                    tmp.append('#.')
                    a -= 1
            ans.append(''.join(tmp))
            ans.append('.' * N * 2)
    if B != 1:
        if A != 1:
            b = B - 1
        else:
            b = B
        ans.append('#' * N * 2)
        while b > 0:
            tmp = []
            for i in range(N):
                if b <= 0:
                    tmp.append('##')
                else:
                    tmp.append('.#')
                    b -= 1
            ans.append(''.join(tmp))
            ans.append('#' * N * 2)
    print(len(ans), len(ans[0]))
    for l in ans:
        print(l)


if __name__ == '__main__':
    # print(main())
    main()
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
  return list(map(int,input().split()))
def m(): #複数文字
  return map(int,input().split())
def onem(): #Nとかの取得
  return int(input())
def s(x): #圧縮
  a = []
  if len(x) == 0:
    return []
  aa = x[0]
  su = 1
  for i in range(len(x)-1):
    if aa != x[i+1]:
      a.append([aa,su])
      aa = x[i+1]
      su = 1
    else:
      su += 1
  a.append([aa,su])
  return a
def jo(x): #listをスペースごとに分ける
  return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
  return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
  ll = 0
  rr = r
  while True:
    mid = (ll+rr)//2

  if rr == mid:
    return ll
  if (ここに評価入れる):
    rr = mid
  else:
    ll = mid+1
"""

n,k = m()

if n == 0:
  if k == 0:
    print("0 0")
  else:
    print(-1)

elif n == 1:
  if k == 0:
    print("0 0 1 1")
  else:
    print(-1)
else:
  if 2<<n <= k:
    po = ""

    op = ""

    for i in range(2<<n+1):
      if i == k:
        continue
      else:
        if po == "":
          po += str(i)
          op += str(i)
        else:
          po += " " + str(i)
          op = str(i) + " " + op
      print("{0} {1} {2} {3}".format(po,k,op,k))
  else:
    print(-1)




### FIXED CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
  return list(map(int,input().split()))
def m(): #複数文字
  return map(int,input().split())
def onem(): #Nとかの取得
  return int(input())
def s(x): #圧縮
  a = []
  if len(x) == 0:
    return []
  aa = x[0]
  su = 1
  for i in range(len(x)-1):
    if aa != x[i+1]:
      a.append([aa,su])
      aa = x[i+1]
      su = 1
    else:
      su += 1
  a.append([aa,su])
  return a
def jo(x): #listをスペースごとに分ける
  return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
  return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
  ll = 0
  rr = r
  while True:
    mid = (ll+rr)//2

  if rr == mid:
    return ll
  if (ここに評価入れる):
    rr = mid
  else:
    ll = mid+1
"""

n,k = m()

if n == 0:
  if k == 0:
    print("0 0")
  else:
    print(-1)

elif n == 1:
  if k == 0:
    print("0 0 1 1")
  else:
    print(-1)
else:
  if 2<<(n-1) > k:
    po = []

    op = []

    for i in range((2<<(n-1))):
      if i == k:
        continue
      else:
        if po == "":
          po.append(i)
          op.append(i)
        else:
          po.append(i)
          op.append(i)
    op.reverse()
    print("{0} {1} {2} {3}".format(jo(po),k,jo(op),k))
  else:
    print(-1)
n = int(input())
ans = 0
for i in range(1, int(n**0.5 + 1)):
    if n % i == 0:
        t = n // i - 1
        if (n // t) == (n % t):
            ans += t
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
if n == 1:
    pass
else:
    for i in range(1, int(n**0.5 + 1)):
        if n % i == 0:
            t = n // i - 1
            if (n // t) == (n % t):
                ans += t
print(ans)