#include
#include
using namespace std;
unsigned uint_parse(const char* msg) {
cout > value;
cin.ignore(numeric_limits::max(), '\n');
return value;
}
unsigned long long odd_range_sum(const unsigned a, const unsigned b) {
const auto x = a >> 1ULL;
const auto y = (b >> 1ULL) + 1ULL;
const auto sum_all = y * y;
const auto sum_before = x * x;
return sum_all - sum_before;
}
int main() {
system("chcp 1251 > nul");
auto a = uint_parse("Введите начало диапазона: ");
auto b = uint_parse("Введите конец диапазона: ");
if (a > b) puts("Диапазон не существует!");
else {
auto sum = 0LL;
if (a == b && (a & 1)) sum = a;
else if (a != b) {
if (~a & 1) ++a;
if (~b & 1) --b;
sum = odd_range_sum(a, b);
}
cout