### Dmohan's blog

By Dmohan, history, 2 months ago,

Hello Codeforces community,

I have been using Golang of late for upsolving problems on Codeforces. I have experienced that for a handful number of contests that even for the best code written on Golang for certain problems, I'd run into TLE while the same logic seem to work fine for other languages(ex: Python, Java) which are below Golang in terms of performance. I am not sure if this is because that i am unrated (and because of that the environment set for unrated is not on par with that of rated users) or if its because the current Golang version is a bit old. Assuming the latter as one of the cause, i would like to request the Codeforces management to upgrade the current version of Golang. If its the former, then please upgrade the go environment(i dont know.. Memory/Heap space perhaps?).

Imagine using Golang as your coding language while participating in a serious contest and running into TLE for a 800 problem and being clueless about why that happens and later you found out that a seemingly terrible logic on a different language (way inferior that Go in terms of performance) seem to work just fine. This scenario would mean that its a waste of time and effort and its doesnt encourage the user to use Go on codeforces or to compete for that matter. I presume the people using Golang as the go-to language for programming on Codeforces is a minority and would request them to support and voice if its a concern.

Thanks, Dmohan (unrated).

• -2

 » 2 months ago, # |   +14 You should use bufio in Go to make your input faster. Default IO is pretty slow. CF uses 32-bit x86 machines, which might be the reason behind some of the performance hit. I am not sure if this is because that i am unrated (and because of that the environment set for unrated is not on par with that of rated users): maybe, not sure.
•  » » 2 months ago, # ^ |   0 Here is exactly the same solution in go (WA#8) and python (OK). It's an interesting thing because IMHO there is no integer overflow but go-solution gets wa (maybe I'm wrong?). I've created test input with 1e5 zeros and 1e5 ones (my guess is test case #8 is something like that) and both solution print correct 10000000000 locally. I haven't yet figured out why this is so.
•  » » » 2 months ago, # ^ |   +8 It's wrong by exactly 2 * 2^32, which really makes the whole thing smell like integer overflow. Are you sure it isn't the case that int (the type of cnt) isn't 32-bit on Codeforces but 64-bit on your machine?
•  » » » » 2 months ago, # ^ |   0 Thank you very much! I didn't see that.
•  » » » 2 months ago, # ^ |   0 https://codeforces.com/contest/1598/submission/131508603Pretty sure it was integer overflow, changing cnt to uint64 rather than int worked.
•  » » 7 weeks ago, # ^ | ← Rev. 3 →   -10 Thanks for the suggestions. I was indeed able to go back, change the I/O from fmt to bufio and was able to successfully execute many previously failed programs. There are few exceptions though. Please help me to figure out what i am doing wrong here for instance => https://codeforces.com/contest/1025/submission/132120827
 » 6 weeks ago, # |   +1 It would be nice to see the Go and Rust versions updated TBH, I've had a few compile errors recently when trying to use newer language features.