@V_head About the re-directing of std:cin/std::cout:
std::ifstream in("input.txt"); if(in) { std::ofstream out("output.txt"); if(out) { /* now use in/out instead of std::cin/std::cout */ } }
(or similar) would actually be the way to go. Automatic test tool pretty sure won't inspect the generated machine code, so it wouln't ever recognise. At best, prof might spot in code review, but if she/he complains, send her/him to here to let us discuss... —
Aconcagua 58 secs ago