fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define file(name) if (fopen(name".INP", "r")){freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout);}
  5.  
  6. const int maxn = 1e6 + 7;
  7.  
  8. void solution(){
  9.  
  10. long long a, b;
  11. cin >> a >> b;
  12. cout << (long long)b*(b+1)/2 - a*(a-1)/2 << "\n";
  13.  
  14. }
  15.  
  16. signed main(){
  17. ios_base::sync_with_stdio(0);
  18. cin.tie(0); cout.tie(0);
  19.  
  20. file("TEST");
  21.  
  22. int test = 1; cin >> test;
  23. while (test --> 0) solution();
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0.01s 5540KB
stdin
Standard input is empty
stdout
-1617510104256035456