I know number greater than INT64_MAX will wrap around negative, So how to compare when sum overflow, that is sum greater than INT64_MAX.
#include <iostream>
using namespace std;
int main() {
int64_t a = INT64_MAX;
int64_t b = 1;
// cin >> a >> b;
if (a + b <= INT64_MAX) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}