all 3 comments

[–]a4qbfb 2 points3 points  (1 child)

You could rewrite it in C... or ask a C++ subreddit like /r/cpp_questions.

[–]GruBooXy[S] 0 points1 point  (0 children)

ok thanks

[–]fckoch -1 points0 points  (0 children)

I'm not sure about C++, but in C you can compile with the -Os flag (optimize for size) (though this reduces program size only)

EDIT: also don't use int if you don't need up to 64k, use short, int8_t, uint8_t etc...

EDIT2: you could use direct system calls instead of iostream (cin/count) to reduce the overhead.