fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. long long sum = 0;
  7. for (long long i=1; i <= 1000000000; i++)
  8. {
  9. sum += i;
  10. }
  11.  
  12. cout << sum << endl;
  13.  
  14. cout << ((1000000000LL)*(1000000000LL + 1)) / 2;
  15. return 0;
  16. }
Success #stdin #stdout 1.31s 3340KB
stdin
Standard input is empty
stdout
500000000500000000
500000000500000000