Codeforces Beta Round 47
E
Square Equation Roots
Codeforces
2300
原题
← D→
翻译中…

A schoolboy Petya studies square equations. The equations that are included in the school curriculum, usually look simple:

翻译中…

$*x*^{2} + 2*bx* + *c* = 0$

翻译中…

where

翻译中…

b

翻译中…

,

翻译中…

c

翻译中…

are natural numbers.

翻译中…

Petya noticed that some equations have two real roots, some of them have only one root and some equations don't have real roots at all. Moreover it turned out that several different square equations can have a common root.

翻译中…

Petya is interested in how many different real roots have all the equations of the type described above for all the possible pairs of numbers $*b*$ and $*c*$ such that $1 ≤ *b* ≤ *n*$, $1 ≤ *c* ≤ *m*$. Help Petya find that number.

翻译中…

Input

翻译中…

The single line contains two integers $*n*$ and $*m*$. ($1 ≤ *n*, *m* ≤ 5000000$).

翻译中…

Output

翻译中…

Print a single number which is the number of real roots of the described set of equations.

翻译中…

Note

翻译中…

In the second test from the statement the following equations are analysed:

翻译中…

$*b* = 1$, $*c* = 1$: $*x*^{2} + 2*x* + 1 = 0$; The root is $*x* =  - 1$

翻译中…

$*b* = 1$, $*c* = 2$: $*x*^{2} + 2*x* + 2 = 0$; No roots

翻译中…

Overall there's one root

翻译中…

In the second test the following equations are analysed:

翻译中…

$*b* = 1$, $*c* = 1$: $*x*^{2} + 2*x* + 1 = 0$; The root is $*x* =  - 1$

翻译中…

$*b* = 1$, $*c* = 2$: $*x*^{2} + 2*x* + 2 = 0$; No roots

翻译中…

$*b* = 1$, $*c* = 3$: $*x*^{2} + 2*x* + 3 = 0$; No roots

翻译中…

$*b* = 2$, $*c* = 1$: $*x*^{2} + 4*x* + 1 = 0$; The roots are image

翻译中…

$*b* = 2$, $*c* = 2$: $*x*^{2} + 4*x* + 2 = 0$; The roots are image

翻译中…

$*b* = 2$, $*c* = 3$: $*x*^{2} + 4*x* + 3 = 0$; The roots are $*x*_{1} =  - 3, *x*_{2} =  - 1$

翻译中…

$*b* = 3$, $*c* = 1$: $*x*^{2} + 6*x* + 1 = 0$; The roots are image

翻译中…

$*b* = 3$, $*c* = 2$: $*x*^{2} + 6*x* + 2 = 0$; The roots are image

翻译中…

$*b* = 3$, $*c* = 3$: $*x*^{2} + 6*x* + 3 = 0$; The roots are image Overall there are $13$ roots and as the root $- 1$ is repeated twice, that means there are $12$ different roots.

翻译中…

样例

Input #1
3 3
Output #1
12
InputCopy OutputCopy
Input #2
1 2
Output #2
1
InputCopy OutputCopy
题目信息
题号
50E
时间限制
5 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。