Problem:
 Score : 200 points    Problem Statement In the beginning, Takahashi has A cookies, and Aoki has B cookies.
They will perform the following operation alternately, starting from Takahashi:   If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.   Find the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.      Constraints  1 \leq A,B \leq 10^9  1 \leq K \leq 100  A,B and K are integers.         Input Input is given from Standard Input in the following format:  A  B  K       Output Print the number of cookies Takahashi has, and the number of cookies Aoki has, in this order, after performing K operations in total.        Sample Input 1 5 4 2      Sample Output 1 5 3  The process will go as follows:   In the beginning, Takahashi and Aoki have 5 and 4 cookies, respectively.  Takahashi eats one cookie and gives two cookies to Aoki. They now have 2 and 6 cookies, respectively.  Aoki gives three cookies to Takahashi. They now have 5 and 3 cookies, respectively.        Sample Input 2 3 3 3      Sample Output 2 1 3       Sample Input 3 314159265 358979323 84      Sample Output 3 448759046 224379523

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0 and A > 0:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A //= 2
    
    if i % 2 == 1 and B > 0:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B //= 2

print(str(A) + " " + str(B))

Solution (Python):
a,b,k = map(int,input().split())
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        a,b = a - a//2, b + a//2
    else:
        if b % 2 == 1:
            b -= 1
        a, b = a + b//2, b - b//2
print(a,b)

Solution (Python):
A, B, K = map(int, input().split())

while True:
    if K == 0:
        break
    if A % 2 == 1:
        A -= 1
    A //= 2
    B += A
    K -= 1

    if K == 0:
        break
    if B % 2 == 1:
        B -= 1
    B //= 2
    A += B
    K -= 1

print(A, B)

Solution (Python):
def main():
    a, b, c = (int(i) for i in input().split())
    for k in range(c):
        ap, bp = 0, 0
        if k % 2 == 0:
            if a % 2:
                a -= 1
            ap = a//2
            a = a//2
            b += ap
        else:
            if b % 2:
                b -= 1
            bp = b//2
            b = b//2
            a += bp
    print(a, b)


if __name__ == '__main__':
    main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, K = MAP()
i = 0
while K > 0:
    
        
    if i % 2 == 0:
        A = A // 2
        B += A
        K -= 1
    else:
        B = B//2
        A += B
        K -= 1
    i += 1
print(A, B)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

a, b, k = MAP()
for _ in range(k // 2):
    if a % 2 == 1:
        a -= 1
    b += a // 2
    a //= 2
    if b % 2 == 1:
        b -= 1
    a += b // 2
    b //= 2
if k % 2 == 1:
    if a % 2 == 1:
        a -= 1
    b += a // 2
    a //= 2
print(a, b)

Solution (Python):
A, B, K = map(int, input().split())
for i in range(K):
    if i&1==0: B, A = B + A//2, A//2
    else: A, B = A + B//2, B//2
print(A, B)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
    if i%2 == 0:
        if a%2 == 1:
            a -= 1
        b += a//2
        a //= 2
    else:
        if b%2 == 1:
            b -= 1
        a += b//2
        b //= 2
print(a, b)

Solution (Python):
a, b, k = map(int,input().split())
for i in range(k):
    if i%2 == 0:
        if a%2:
            a -= 1
        b += a // 2
        a //= 2
    else:
        if b % 2:
            b -= 1
        a += b // 2
        b //= 2

print(a, b)

Solution (Python):
A, B, K = map(int, input().split())
for i in range(K) :
    if i % 2 == 0 :
        if A % 2 == 1:
            A -= 1
        B += int(A / 2)
        A = int(A / 2)
    else : 
        if B % 2 == 1 :
            B -= 1
        A += int(B / 2)
        B = int(B / 2)
print(A, B)

Solution (Python):
a,b,k = [int(i) for i in input().split()]

ct=1
for i in range(k):
  if ct==1:
    if a%2==0:
      b=b+a/2
      a=a/2
    else:
      b=b+(a-1)/2
      a=(a-1)/2
    ct=ct*-1
  else:
    if b%2==0:
      a=a+b/2
      b=b/2
    else:
      a=a+(b-1)/2
      b=(b-1)/2
    ct=ct*-1
print(int(a),int(b))

Solution (Python):
A, B, K = list(map(int, input().split()))


for i in range(K):
    if i % 2 == 0:  
        if A % 2 == 1:
            A -= 1

        B += A // 2
        A = A // 2
    else:   
        if B % 2 == 1:
            B -= 1

        A += B // 2
        B = B // 2

print(A, B)

Solution (Python):
A, B, K = list(map(int, input().split()))


for i in range(K):
    if i % 2 == 0:  
        A = A // 2
        B += A
    else:   
        B = B // 2
        A += B

print(A, B)

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0:
        A //= 2
        B += A
    else:
        B //= 2
        A += B
print(A, B)

Solution (Python):
a, b, k = map(int,input().split())
for i in range(k//2):
    w = a//2
    a = w
    b += w
    w = b//2
    b = w
    a += w
if k%2==1:
    w = a//2
    a = w
    b += w
print(a, b)

Solution (Python):
def main():
    a, b, k = map(int, input().split())
    for i in range(k):
        if i%2 == 0:
            if a%2 == 1:
                a -= 1
            b += a//2
            a //= 2
        else:
            if b%2 == 1:
                b -= 1
            a += b//2
            b //= 2
    print(a, b)

if __name__ == "__main__":
    main()

Solution (Python):
A, B, K = map(int, input().split())

while K != 0:
    K -= 1
    if A % 2:
        A -= 1
    B += A / 2
    A /= 2
    if not K:
        break

    K -= 1
    if B % 2:
        B -= 1
    A += B / 2
    B /= 2

print(int(A), int(B))

Solution (Python):
def cookie_T(a,b):
    if a%2!=0:
        a-=1
    b+=(a//2)
    a=a//2
    return a,b
def cookie_A(a,b):
    if b%2!=0:
        b-=1
    a+=(b//2)
    b=b//2
    return a,b
A,B,K=map(int,input().split())
for i in range(K):
    if i%2==0:
        A,B=cookie_T(A,B)
    else:
        A,B=cookie_A(A,B)
print("{} {}".format(A,B))

Solution (Python):
a,b,k = map(int,input().split())
for i in range(k):
    if i%2==0:
        if a%2!=0:
            a -= 1
        b += a//2
        a = a//2
    else:
        if b%2!=0:
            b -= 1
        a += b//2
        b = b//2
print(a,b)

Solution (Python):
A,B,K=map(int,input().split())
b1=0
b2=0
for i in range(K):
    if i%2==0:
        if A%2==1:
            A=A-1
        A=A//2
        B=B+A
    else:
        if B%2==1:
            B=B-1
        B=B//2
        A=A+B
    
print(A,B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2==0:
    if a%2==1:
      a-=1
    b+=a//2
    a=a//2
  else:
    if b%2==1:
      b-=1
    a+=b//2
    b=b//2
print(a,b)

Solution (Python):
a=list(map(int,input().split()))
for i in range(a[2]):
    if a[i%2]%2==1:
        a[i%2]-=1
    res=a[i%2]//2
    a[i%2]-=res
    a[(i+1)%2]+=res
print(a[0],a[1])

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2==0:
    a=a//2
    b+=a
  else:
    b=b//2
    a+=b
print(a,b)

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
	if i % 2 == 0:
		a = a // 2
		b += a
	else:
		b = b // 2
		a += b
print(a, b)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(1, k+1):
    
    if i % 2 == 1:
        if a % 2 == 1:
            a -= 1
        a, b = a//2, b+a//2
    
    else:
        if b % 2 == 1:
            b -= 1
        a, b = a+b//2, b//2
print(a, b)

Solution (Python):
A, B, K = map(int, input().split())
for i in range(K):
  if i % 2 == 0:
    if A % 2 == 1:
      A -= 1
    B += A // 2
    A //= 2
  else:
    if B % 2 == 1:
      B -= 1
    A += B // 2
    B //= 2
print(A, B)

Solution (Python):
A,B,K=map(int, input().split())
for i in range(K):
    if i&1:
        A+=B//2
        B//=2
    else:
        B+=A//2
        A//=2
print(A,B)

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
    if(i%2 == 0):
        if(A%2 != 0):
            A = (A-1)//2
            B = A+B
        else:
            A = A//2
            B += A
    else:
        if(B%2 != 0):
            B = (B-1)//2
            A += B
        else:
            B = B//2
            A += B
print(A, end=' ')
print(B)

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 != 0:
            a -= 1
        b += a//2
        a //= 2
    else:
        if b % 2 != 0:
            b -= 1
        a += b//2
        b //= 2
print(a, b)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        a//=2
        b+=a
    else:
        b//=2
        a+=b
print(a,b)

Solution (Python):


A, B, K = map(int, input().split())

turn = True
for i in range(K):
    if turn:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A //= 2
        turn = False
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B //= 2
        turn = True

print(A, B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2:
    a,b=a+b//2,b//2
  else:
    a,b=a//2,a//2+b
print(a,b)

Solution (Python):

A,B,K = map(int,input().split())

for i in range(K):

    if i % 2 == 0:
        B += A // 2
        A //= 2

    else:
        A += B // 2
        B //= 2

print (A,B)

Solution (Python):
A,B,K=map(int,input().split())
flag=True
for i in range(K):
  if flag:
    flag=False
    A=A//2
    B+=A
  else:
    flag=True
    B=B//2
    A+=B
print(A,B)

Solution (Python):
A , B , K = map(int,input().split())
for i in range(K):
	if i % 2 == 0:
		if A % 2 == 1:
			A-=1
		a = A / 2
		A = A / 2
		B+=a
	else:
		if B % 2 == 1:
			B-=1
		b = B / 2
		B = B / 2
		A+=b
print(int(A),int(B))

Solution (Python):
a,b,k=map(int,input().split())
s=[a,b]
for i in range(k):
  x,y=int((1-(-1)**i)/2),int((1+(-1)**i)/2)
  if s[x]%2==1:
    s[x]-=1
  s[y]+=s[x]//2
  s[x]-=s[x]//2
print(s[0],s[1])

Solution (Python):
a,b,k = map(int,input().split())

for i in range(k):
    if i %2 == 0:
        a -= a % 2
        b += a//2
        a = a//2
    else:
        b -= b % 2
        a += b//2
        b = b//2


print(a)
print(b)

Solution (Python):
a, b, k = map(int, input().split())

for i in range(1,k+1):
	
	if i % 2 == 0:
		if b % 2 != 0:
			b -= 1
		c = int(b/2)
		b -= c
		a += c
	else:
		if a % 2 != 0:
			a -= 1
		c = int(a/2)
		a -= c
		b += c

print(str(a) + " " + str(b))

Solution (Python):
A,B,K=map(int,input().split())
for i in range(K):
    if i%2==0:
        B+=A//2
        A=A//2
    else:
        A+=B//2
        B=B//2
print(A,B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2==0:
    if a%2==1:
      a-=1
    b+=a//2
    a//=2
  else:
    if b%2==1:
      b-=1
    a+=b//2
    b//=2
print(a,b)

Solution (Python):
from sys import stdin

a,b,c = [int(x) for x in stdin.readline().rstrip().split()]
now = 0
for i in range(c):
    if now%2 == 0:
        if a%2 == 1:
            a = (a-1)//2
            b += a
        else:
            a = a//2
            b += a
    else:
        if b%2 == 1:
            b = (b-1)//2
            a += b
        else:
            b = b//2
            a += b
    now += 1
print(a,b)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i % 2 == 0 and a % 2 ==1:
    a=(a-1)//2
    b+=a
  elif i % 2 ==0 and a%2==0:
    a=a//2
    b+=a
  elif i%2==1 and b%2==1:
    b=(b-1)//2
    a+=b
  else:
    b=b//2
    a+=b
print(a,b)

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
            a = 0.5 * a
            b += a
        elif a % 2 == 0:
            a = 0.5 * a
            b += a
    elif i % 2 == 1:
        if b % 2 == 1:
            b -= 1
            b = 0.5 * b
            a += b
        elif b % 2 == 0:
            b = 0.5 * b
            a += b

print(int(a), int(b))

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
	if i % 2 == 0:
		if A % 2 == 1: A -= 1
		B += A // 2
		A = A // 2
	else:
		if B % 2 == 1: B -= 1
		A += B // 2
		B = B // 2

print(A, B)

Solution (Python):
def main():
    A, B, K = (int(i) for i in input().split())
    for k in range(K):
        if k & 1:
            if B & 1:
                B -= 1
            A += B//2
            B //= 2
        else:
            if A & 1:
                A -= 1
            B += A//2
            A //= 2
    print(A, B)


if __name__ == '__main__':
    main()

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B,K = MI()
    for i in range(K):
        if i%2==0:
            if A&1:
                A-=1
            A>>=1
            B+=A
        else:
            if B&1:
                B-=1
            B>>=1
            A+=B
    print(A,B)
if __name__ == '__main__':
    main()

Solution (Python):
a, b, k = map(int, input().split())

cond = 1
for i in range(k):
	if cond == 1:
		if a % 2 == 1:
			a -= 1
		a //= 2
		b += a
		cond = 0
	else:
		if b % 2 == 1:
			b -= 1
		b //= 2
		a += b
		cond = 1

print(a, end = " ")
print(b)

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        a//=2
        b+=a
    else:
        b//=2
        a+=b
print(a,b)

Solution (Python):
A,B,K=map(int,input().split())
for i in range(K):
  if i%2==0:
    if A%2!=0:
      B += (A-1)//2
      A = (A-1)//2
    else:
      B += A//2
      A //= 2
  else:
    if B%2!=0:
      A += (B-1)//2
      B = (B-1)//2
    else:
      A += B//2
      B //= 2
print(A,B)

Solution (Python):
A,B,K = map(int,input().split())
for i in range(K):
  if i%2 == 0:
    if A%2==1: A-=1
    B += A//2
    A = A//2
  else:
    if B%2==1: B-=1
    A += B//2
    B = B//2
print(A,B)

Solution (Python):
A,B,K=map(int,input().split())

for i in range(K):
    if i%2==0:
        if A%2==1:
            A-=1
        A//=2
        B+=A
    else:
        if B%2==1:
            B-=1
        B//=2
        A+=B

print(str(A)+' '+str(B))

Solution (Python):
li = list(map(int,input().split()))
a=li[0]
b=li[1]
k=li[2]

for i in range(1,k+1):
    if i%2==1:
        if a%2==0:
            a=a/2
            b=b+a
        else:
            a=(a-1)/2
            b=b+a
    else:
        if b%2==0:
            b=b/2
            a=a+b
        else:
            b=(b-1)/2
            a=a+b
print(int(a),int(b))

Solution (Python):
a,b,k = map(int,input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        c = a // 2
        a -= c
        b += c
    else:
        if b % 2 == 1:
            b -= 1
        c = b // 2
        b -= c
        a += c
print(a,b)

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K) :
  if i % 2 == 0 :
    A -= A % 2
    B += A // 2
    A //= 2
  else :
    B -= B % 2
    A += B // 2
    B //= 2
    
print(A, B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        if a%2==1:
        	a-=1
        a=a//2
        b+=a
    else:
        if b%2==1:
        	b-=1
        b=b//2
        a+=b
print(str(a)+" "+str(b))

Solution (Python):
def examA():
    S = SI()
    if len(S)==3:
        ans = S[::-1]
    else:
        ans = S
    print(ans)
    return

def examB():
    A, B, K = LI()
    for i in range(K):
        if i%2==0:
            B +=A//2
            A //=2
        else:
            A +=B//2
            B //=2
    print(A,B)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

Solution (Python):
import sys
input = sys.stdin.readline
A, B, K = map(int, input().split())
for i in range(K):
  if i % 2:
    B -= B % 2
    A += B // 2
    B //= 2
  else:
    A -= A % 2
    B += A // 2
    A //= 2
print(A, B)

Solution (Python):


a,b,k=map(int,input().split())
turn=1

def eat(x,y):
    if x%2:
        x-=1
    x//=2
    y+=x
    return x,y

for i in range(k):
    if turn:
        a,b=eat(a,b)
    else:
        b,a=eat(b,a)
    turn=1-turn
print('{} {}'.format(a,b))

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        dif = a // 2
        a -= dif
        b += dif
    else:
        if b % 2 == 1:
            b -= 1
        dic = b // 2
        a += dic
        b -= dic
print(a, b)

Solution (Python):
A, B, K = map(int,input().split())
for i in range(K):
    if i % 2 == 0:
        A -= (A % 2 == 1)
        A, B = A//2, B+A//2
    else:
        B -= (B % 2 == 1)
        A, B = A + B//2, B//2

print(A, B)

Solution (Python):
import sys
read = sys.stdin.read

A, B, K = map(int, read().split())

for i in range(K):
    if i % 2 == 0:
        A //= 2
        B += A
    else:
        B //= 2
        A += B

print(A, B)

Solution (Python):
A,B,K= map(int,input().split())
x = A
y = B
cnt = 0
while cnt<K:
    if cnt%2==0:
        y += x//2
        x = x//2
    else:
        x += y//2
        y = y//2
    cnt += 1
print(x,y)

Solution (Python):

a, b, k = map(int, input().split())

for i in range(0, k):
    if i % 2 == 0:
        b += a // 2
        a = a // 2
    else:
        a += b // 2
        b = b // 2

print(a, b)

Solution (Python):




a,b,k = [int(a) for a in input().split(' ')]

def cookie(p,q):
  if p%2==1:
    p -= 1
  p -= p/2
  q += p
  return (p,q)

for i in range(k):
  if i%2==0:
    
    a,b = cookie(a,b)
  else:
    
    b,a = cookie(b,a)
print( '{} {}'.format(int(a),int(b)) )

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0:
        A = A if A % 2 == 0 else A - 1
        A //= 2
        B += A
    else:
        B = B if B % 2 == 0 else B - 1
        B //= 2
        A += B
print(A, B)

Solution (Python):
a,b,k=map(int,input().split())
i=0
while i<k:
    if i%2==0:
        b+=a//2
        a=a//2
    else:
        a+=b//2
        b=b//2
    i+=1
print(a,b)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
  if i%2 == 0:
    a //= 2
    b += a
  else:
    b //= 2
    a += b
print(a, b)

Solution (Python):
A,B,K=map(int,input().split())
for i in range(K):
    if i%2==0:
        A//=2
        B+=A
    else:
        B//=2
        A+=B
print(A,B)

Solution (Python):


A, B, K = map(int, input().split())

def operate(x, y):
    if x % 2 == 1:
        x -= 1
    x //= 2
    return (x, y + x)

for k in range(K // 2):
    A, B = operate(A, B)
    B, A = operate(B, A)
if K % 2 == 1:
    A, B = operate(A, B)

print(A, B)

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
  if i%2 == 0:
    b += a//2
    a //= 2
  else:
    a += b//2
    b //= 2
print(a, b)

Solution (Python):
A, B, K = map(int,input().split())
for i in range(K):
  if i % 2 == 0:
    if A % 2 == 1:
      A -= 1
    A //= 2
    B += A
  else:
    if B % 2 == 1:
      B -= 1
    B //= 2
    A += B
print(A,B)

Solution (Python):
def resolve():
    a,b,k=map(int,input().split())
    while 1:
        if a%2==1:
            a-=1
        a//=2
        b+=a
        k-=1
        if k==0:
            break
        if b%2==1:
            b-=1
        b//=2
        a+=b
        k-=1
        if k==0:
            break
    print('{} {}'.format(a,b))
resolve()

Solution (Python):
a,b,k=map(int,input().split())
p=[a,b]
i=0
while True:
  for g in range(2):
    t=g^1
    if p[g]%2==1:
      p[g]-=1
    p[t]+=p[g]//2
    p[g]//=2
    i+=1
    if i==k:
      print(*p)
      exit(0)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
  if i % 2 == 0:
    c = a // 2
    a = c
    b += c
  else:
    c = b // 2
    a += c
    b = c
print(a, b)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
    if i%2 == 0:
        if a%2:
            a -= 1
        a //= 2
        b += a
    else:
        if b%2:
            b -= 1
        b //= 2
        a += b
print(a,b)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


A, B, K = list(map(int, sys.stdin.readline().split()))


def op(A, B):
    return A // 2, A // 2 + B


while K:
    if K > 0:
        A, B = op(A, B)
        K -= 1
    if K > 0:
        B, A = op(B, A)
        K -= 1
print(A, B)

Solution (Python):
A, B, K = map(int, input().split())

j, a = A, B
for i in range(K):
  j = j // 2
  a += j 
  j, a = a, j
  
if K % 2 == 0:
  print(j, a)
else:
  print(a, j)

Solution (Python):
A, B, K = [int(s) for s in input().split(' ')]
for i in range(K):
  if i % 2:
    B //= 2
    A += B
  else:
    A //= 2
    B += A
print ('%d %d' % (A, B))

Solution (Python):
A, B, K = [int(s) for s in input().split(' ')]
for i in range(K):
  if i % 2:
    B //= 2
    A += B
  else:
    A //= 2
    B += A
print ('%d %d' % (A, B))

Solution (Python):
a,b,k = map(int,input().split())

for i in range(k//2):
    a,b = a//2,b+a//2
    b,a = b//2,a+b//2

if k%2==1:
    a,b = a//2,b+a//2

print(a,b)

Solution (Python):
a,b,k = map(int,input().split())

for i in range(k):
    if i%2 == 0:
        if a%2 != 0:
            a -= 1
        a = a//2
        b += a
    else:
        if b%2 != 0:
            b -= 1
        b = b//2
        a += b
        
print(a,b)

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
    if i % 2:
        a += b // 2
        b //= 2
    else:
        b += a // 2
        a //= 2
print(a, b)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        b+=a//2
        a=a//2
    if i%2!=0:
        a+=b//2
        b=b//2
print(a,b)

Solution (Python):
A, B, K = map(int, input().split())

for i in range(K):
    if i % 2 == 0:
        B += A // 2
        A //= 2
    else:
        A += B // 2
        B //= 2

print(A, B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        if a%2:
            a-=1
        a//=2
        b+=a
    else:
        if b%2:
            b-=1
        b//=2
        a+=b
print(a,b)

Solution (Python):
A,B,K=map(int,input().split())
for i in range(K):
  A//=2
  B+=A
  A,B=B,A
if(K%2):
  A,B=B,A
print(A,B)

Solution (Python):
a,b,k=map(int,input().split())

for i in range(0,k):
    if i%2!=0:
        a+=b//2
        b = b // 2
    else:
        b += a // 2
        a = a // 2

ans=[a,b]
print(" ".join(map(str,ans)))

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        a = a//2
        b += a
    else:
        if b % 2 == 1:
            b -= 1
        b = b//2
        a += b

print(a, b)

Solution (Python):
import sys


def slove():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a, b, k = list(map(int, input().rstrip('\n').split()))
    for i in range(k):
        if i % 2 == 0:
            if a % 2 != 0:
                a -= 1
            b += a // 2
            a -= a // 2
        else:
            if b % 2 != 0:
                b -= 1
            a += b // 2
            b -= b // 2
    print(a, b)


if __name__ == '__main__':
    slove()

Solution (Python):
a,b,k = map(int,input().split())
cnt = 0
while cnt < k:
  b += a//2
  a = a//2
  cnt += 1
  if cnt < k:
    a += b//2
    b = b//2
    cnt += 1
print(a,b)

Solution (Python):
a, b, k = map(int, input().split())


for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
            a /= 2
            b += a            
        else:
            a /= 2
            b += a
    else:
        if b % 2 == 1:
            b -= 1
            b /= 2
            a += b
        else:
            b /= 2
            a += b

print(int(a), int(b))

Solution (Python):
def resolve():
    a, b, k = map(int, input().split())
    for i in range(k):
        if i % 2 == 0:
            if a % 2:
                a -= 1
            next_b = b + a // 2
            a //= 2
            b = next_b
        else:
            if b % 2:
                b -= 1
            next_a = a + b // 2
            b //= 2
            a = next_a
    print(a, b)


if __name__ == "__main__":
    resolve()

Solution (Python):
a,b,k=map(int,input().split())
flg=True
for i in range(k):
    if flg:
        a//=2
        b+=a
        flg=False
    else:
        b//=2
        a+=b
        flg=True
print(a,b)

Solution (Python):
A, B, K = map(int,input().split())
for i in range(K):
  A2, B2 = A, B
  if i % 2 == 0:
    if A2 % 2 == 1: A2 -= 1
    B2 += A2 // 2
    A2 = A2 // 2
  else:
    if B2 % 2 == 1: B2 -= 1
    A2 += B2 // 2
    B2 = B2 // 2
  A, B = A2, B2
print(A, B)

Solution (Python):
A,B,K = map(int,input().split())
for i in range(K):
    if i%2 == 0:
        A -= A%2
        B += A//2
        A -= A//2
    else:
        B -= B%2
        A += B//2
        B -= B//2
print(A,B)

Solution (Python):
a , b , k = map(int,input().split())

if k % 2 == 0:
    for i in range(int(k / 2)):
        if a % 2 == 1:
            a -= 1
        a = a / 2
        b += a
        if b % 2 == 1:
            b -= 1
        b = b / 2
        a += b
else:
    for i in range(int((k - 1) / 2)):
        if a % 2 == 1:
            a -= 1
        a = a / 2
        b += a
        if b % 2 == 1:
            b -= 1
        b = b / 2
        a += b
    if a % 2 == 1:
        a -= 1
    a = a / 2
    b += a
    
print(int(a),end=" ")
print(int(b))

Solution (Python):
a,b,k = map(int,input().split())
cnt=0
while cnt < k:
    if cnt%2==0:
        if a%2==0:
            b+=a//2
            a=a//2
            cnt+=1
        else:
            a-=1
            cnt+=1
            b+=a//2
            a=a//2
    else:
        if b%2==0:
            a+=b//2
            b=b//2
            cnt+=1
        else:
            b-=1
            cnt+=1
            a+=b//2
            b=b//2
print(a,b)

Solution (Python):
A,B,K = [int(x) for x in input().split()]
cnt = 0
while(cnt<K):
    if(A%2==1):
        A-=1
    B+=A//2
    A//=2
    cnt+=1
    if(cnt>=K):break
    if(B%2==1):
        B-=1
    A+=B//2
    B//=2
    cnt+=1
    
print(A,B)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
  if i%2:b//=2;a+=b
  else:a//=2;b+=a
print(a,b)

Solution (Python):
a, b, k= map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        a //= 2
        b += a
    else:
        if b % 2 == 1:
            b -= 1
        b //= 2
        a += b

print(a, b)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
	if i%2==0:
		if a%2!=0:
			a-=1
		a,b=a//2,b+a//2
	else:
		if b%2!=0:
			b-=1
		a,b=a+b//2,b//2
print(a,b)

Solution (Python):
a,b,k=map(int,input().split())
for i in range(k):
    if i%2==0:
        a//=2
        b+=a
    if i%2==1:
        b//=2
        a+=b    
print(a,b)

Solution (Python):

a, b, k = map(int, input().split())
for i in range(k//2):
    if a%2 == 1:
        a -= 1
    a //= 2
    b += a
    if b%2 == 1:
        b -= 1
    b //= 2
    a += b

if k%2 == 1:
    if a%2 == 1:
        a -= 1
    a //= 2
    b += a

print(a, b)

Solution (Python):
A, B, K = map(int, input().split())
for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A = A // 2
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B = B // 2
        
print(str(A) + " " + str(B))

Solution (Python):
a, b, k = map(int, input().split())

for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        b = b + (a / 2)
        a = a / 2
    else:
        if b % 2 == 1:
            b -= 1
        a = a + (b / 2)
        b = b / 2
print(int(a), int(b))

Solution (Python):
a, b, k = map(int, input().split())
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        b += a // 2
        a = a // 2
    else:
        if b % 2 == 1:
            b -= 1
        a += b // 2
        b = b // 2
print(a, b)

Solution (Python):
A,B,K=map(int,input().split())
COUNT = 0

while True :

    if A % 2 == 1 :

        A -= 1

    A = A//2

    B += A

    COUNT += 1

    if COUNT == K :

        break
    

    if B % 2 == 1 :

        B -= 1

    B = B//2

    A += B

    COUNT += 1

    if COUNT == K :

        break

print(A,B)