codeforces

http://codeforces.com/problemset/problem/842/C

any help is welcomed, thank you !