#include <bits/stdc++.h>
using namespace std;
bool overflow(long long int a, long long int b){
long long int c = a*b;
cout<<a<<" "<<b<<" "<<c<<" "<<c/a<<" "<<c/b<<endl;
return (c/b) != a;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int a = 847288609443LL; // 3^25
cout<<overflow(a, a)<<endl;
}
When I run the above code in my PC I get the following output...
847288609443 847288609443 6048575297968530377 7138742 7138742
1
But when I run it on codeforces I get the following output....
847288609443 847288609443 6048575297968530377 7138742 847288609443
0
What could be the problem here? Btw Why c/a and c/b different in codeforces output though a and b have same value?
Please help me out.