Your program compiles with no errors. I've also tried once to submit the program in C++ and got CE; rewrited in Delphi it got AC. Another program in C++ got WA, in Delphi - AC. Admins, fix please the bugs!
2. As for WA - there is no difference for the judge system which language you use. Your program on C++ is just wrong. If you are sure it is correct, contact with Vladimir Yakovlev ( you can find his mail on http://acm.timus.ru/author.aspx?id=17757 ).