You are given three numbers as input $$$A$$$, $$$B$$$, $$$K$$$.
Perform the given below steps K times:-
if $$$A$$$ <= $$$B$$$ then
$$$B$$$ = $$$B$$$ $$$-$$$ $$$A$$$
$$$A$$$ = $$$A$$$ $$$+$$$ $$$A$$$
else
$$$A$$$ = $$$A$$$ $$$-$$$ $$$B$$$
$$$B$$$ = $$$B$$$ $$$+$$$ $$$B$$$
After K steps output the values of $$$A$$$ and $$$B$$$.
$$$0$$$ $$$\leq$$$ $$$A$$$, $$$B$$$ $$$\leq$$$ $$$10 ^ {9}$$$
$$$1$$$ $$$\leq$$$ $$$K$$$ $$$\leq$$$ $$$10 ^ {10}$$$.
If someone can give some hints it will be helpful.
Sorry, that ( my first edit ) is incorrect, because the values of $$$A$$$ and $$$B$$$ keep changing after each operation.
The only observation that comes to my mind is, the sum of $$$A$$$ and $$$B$$$ will always be constant. Maybe that can be used somehow.
At first, I thought that maybe the values will repeat after some operations so I need to find the cycle, but for large $$$A$$$, $$$B$$$ it doesn't repeat quickly.
Let $$$A+B=S$$$. $$$S$$$ is constant and $$$A$$$ is transformed to $$$2A \% S$$$ on every step (in both cases).
Wow, I was just thinking about this but didn't realize it happened when $$$ A = A - B $$$ too.
Thanks man, so in the end $$$A$$$ is $$$(2 ^ {K} * A)$$$ $$$mod$$$ $$$S$$$.
And also according to you what would be the rating of this problem if it has appeared in a codeforces contest.
I don't really have a feeling of the numerical ratings below 2400. Probably it would be a Div1B but maybe it also could be A?