#P10416. Triplet Sum in Range Counting

    ID: 12426 Type: Default 1000ms 256MiB

Triplet Sum in Range Counting

Triplet Sum in Range Counting

Given a closed interval \([L,R]\), count the number of ordered triplets \((X,Y,Z)\) such that \(X+Y=Z\) and \(L\le X,Y,Z\le R\).

inputFormat

The input consists of a single line containing two integers \(L\) and \(R\) (with \(L\le R\)), representing the bounds of the interval.

outputFormat

Output a single integer: the number of triplets \((X,Y,Z)\) that satisfy \(X+Y=Z\) with \(L\le X,Y,Z\le R\).

sample

1 3
3