Reference solution
Time: O(1) · Space: O(1)One correct implementation. Any approach that satisfies the constraints is equally valid.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long a, b;
if (!(cin >> a >> b)) return 0;
cout << a + b << ' ' << a - b << ' ' << a * b << ' '
<< a / b << ' ' << a % b << '\n';
return 0;
}