fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(NULL);
  7. cout.tie(NULL);
  8.  
  9. long long n, m;
  10. cin >> n >> m;
  11.  
  12.  
  13. long long sum = (m - n + 1) * (n + m) / 2;
  14.  
  15. cout << sum << endl;
  16. }
Success #stdin #stdout 0s 5324KB
stdin
6 10
stdout
40