How does C++'s auto infer data types in case of for loops - from initialization, or from condition?
long long n;
cin>>n;
for(auto i=1; i<=n; i++)
cout << ((i * i) * ((i * i) - 1)) / 2 - 2 * (2 * (i - 1) * (i - 2)) << "\n";
Here, will i be an integer of long long? My code failed (probably due to overflow - negative values in output, n = 10000) when I used auto and passed when I used long long.