The above two codes only differ in the submission language.But one gets Accepted,the other gets Wrong answer on test 1.
wrong output format Expected integer, but "?" found (test case 1)
In C++14,it did f(1, n) first and did cout << "! " next.
In C++17,it did cout << "! " first and did f(1, n) next.
Before C++17, the order of << was not specified.
update:Thanks to balalaika,more clearly,A << B << C,A,B and C can be evaluated in any order.








orz.
Some stupid correction:
Order of
<<was sure always specified in all standards (A << B << Cis always(A << B) << Cand nothing else), butA,BandCbefore C++17 can be evaluated in any order.In C++17 there is line that clarifies that
Amust be fully evaluated before start of evaluation ofB(and so aboutA << BandC). https://timsong-cpp.github.io/cppwp/n4659/expr.shift#4Thanks!