fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8. freopen("MAGICSUM.inp", "r", stdin);
  9. freopen("MAGICSUM.ans", "w", stdout);
  10. long long ans = 0;
  11. int n; cin >> n;
  12. for(int i = 1; i <= n; i++){
  13. int l, r; cin >> l >> r;
  14. for(int j = l; j <= r; j++) ans += j;
  15. }
  16. cout << ans;
  17. return 0;
  18. }
  19.  
Time limit exceeded #stdin #stdout 5s 5516KB
stdin
Standard input is empty
stdout
Standard output is empty