Advertisement
ivnikkk

Untitled

Mar 9th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #pragma GCC optimize("Ofast")
  2. #pragma GCC optimize("unroll-loops")
  3. #pragma GCC target("avx2")
  4. #define _CRT_SECURE_NO_WARNINGS
  5. #define debug(l) cerr<<" smotri huinyi : "<<#l<<' '<<l<<'\n';
  6. #include "bits/stdc++.h"
  7. //#include "geometry.h"
  8. //#include "data_structure.h"
  9. using namespace std;
  10. using namespace chrono;
  11. #define all(cnt) cnt.begin(), cnt.end()
  12. #define allr(cnt) cnt.rbegin(), cnt.rend()
  13. #define sqrt(l) sqrtl(l)
  14. mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
  15. typedef long long ll;
  16. typedef long double ld;
  17. signed main() {
  18. #ifdef _DEBUG
  19.     freopen("input.txt", "r", stdin);
  20.     freopen("output.txt", "w", stdout);
  21. #endif
  22.     ios_base::sync_with_stdio(false);
  23.     cin.tie(nullptr);
  24.     ll a, b;
  25.     cin >> a >> b;
  26.     ll d = b * (b + 1) * (2 * b + 1) / 6;
  27.     ll d0 = 0;
  28.     if (a > 0) {
  29.         a--;
  30.         d0 = a * (a + 1) * (2 * a + 1) / 6;
  31.     }
  32.     cout << d - d0 << endl;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement