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())
tmp = 0
Turn = "A"

def processing_A():
    global A,B,Turn,tmp
    tmp = A//2
    A = A//2
    B += tmp
    Turn = "B"
def processing_B():
    global A,B,Turn,tmp
    tmp = B//2
    B = B//2
    A += tmp
    Turn = "A"

for i in range(K):
    if Turn == "A":
        if A % 2 == 1:
            A -= 1
            processing_A()
        else:
            processing_A()
    else:
        if B % 2 == 1:
            B -= 1
            processing_B()
        else:
            processing_B()
print(A,B)

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

Solution (Python):
a,b,k=map(int,input().split())
turn=1
for i in range(k):
    if turn==1:
        a//=2
        b+=a
    if turn==-1:
        b//=2
        a+=b
    turn*=-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=(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
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 = A - 1
        A = int(A / 2)
        B += A

    if i % 2 == 1:
        if B % 2 == 1:
            B -= 1
        B = int(B / 2)
        A += B

print(A, B)

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

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

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

A,B,K = inpl()
taka = True

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

    taka = not taka

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 //= 2
        b += a
    else:
        if b%2 != 0:
            b -= 1
        b //= 2
        a += b
print(a, b)

Solution (Python):
a,b,k=map(int,input().split())
t=1
for _ in range(k):
  if t:
    t=0
    a//=2
    b+=a
  else:
    t=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 == 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=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
    A //= 2
    B += A
  else:
    B -= B%2
    B //= 2
    A += B
print(A,B)

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

for _ in range(K//2):
    A //= 2
    B += A
    B //= 2
    A += B

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

print(A, B)

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

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

print(A, B)

Solution (Python):
A,B,K=map(int,input().split(' '))
l=[A,B]
for i in range(K):
	p=l[i%2]
	l[i%2] = (p-(p%2))/2
	l[(i+1)%2] += (p-(p%2))/2
print(' '.join([str(int(x)) for x in l]))

Solution (Python):



def cookie(p1,p2):
	if p1 % 2 == 1:
		p1 -= 1
	p1 /= 2
	p2 += p1
	return p1,p2

a,b,k = map(int, input().split())
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:
        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):
def ex(a,b,n):
  for _ in range(n):
    a, b = b + a//2, a//2
  if n%2:
    a,b = b,a
  return str(a),str(b)
a, b, k = map(int, input().split())
print(' '.join(ex(a,b,k)))

Solution (Python):
def ex(a,b,n):
  for _ in range(n):
    a, b = b + a//2, a//2
  if n%2:
    a,b = b,a
  return str(a),str(b)
a, b, k = map(int, input().split())
print(' '.join(ex(a,b,k)))

Solution (Python):
a,b,k=map(int,input().split())
count=1
while 1:
    count+=1
    if a%2==1:
        a-=1
    b+=a//2
    a=a//2
    if count>k:
        break

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

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 = [int(x) for x in 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 == 1:
            a -= 1
        a = a // 2
        b += a
    else:
        if b % 2 == 1:
            b = 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==0:
		if a%2==1:
			a-=1
		a = a/2
		b = b+a
	if i%2==1:
		if b%2==1:
			b-=1
		b = b/2
		a = b+a

print("{} {}".format(int(a), int(b)))

Solution (Python):
from sys import stdin
A,B,K=[int(x) for x in stdin.readline().rstrip().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(int(A),int(B))

Solution (Python):
a,b,c = map(int,input().split(" "))
count = 0
t = "A"
while True:
    count += 1
    if t == "A":
        b += a // 2
        a //= 2
        t = "B"
    else:
        a += b // 2
        b //= 2
        t = "A"
    if count == c:
        print(a,b)
        exit()
    elif a * 2 == b or b * 2 == a:
        break
if (c - count) % 2 == 0:
    print(a,b)
else:
    print(b,a)

Solution (Python):
A,B,K = map(int,input().split())
c = 0
if K%2 == 0:
  while c < K:
    B = B+A//2
    A = A//2
    c += 1
    A = A+B//2
    B = B//2
    c += 1
else:
  while c < K-1:
    B = B+A//2
    A = A//2
    c += 1
    A = A+B//2
    B = B//2
    c += 1
  B = B+A//2
  A = 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==1:
            a-=1
            a//=2
        else:
            a//=2
        b+=a
    else:
        if b%2==1:
            b-=1
            b//=2
        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 = (A - A % 2) // 2
        B += A
    else:
        B = (B - B % 2) // 2
        A += B
print(A, B)

Solution (Python):
a,b,k = map(int, input().split())
flag = 0
for i in range(k):
    if flag == 0:
        if a%2 == 1: a-= 1
        b += a//2
        a -= a//2
    if flag == 1:
     if b%2 == 1:b-= 1
     a += b//2
     b -= b//2
    if flag == 0: flag =1
    else:flag =0
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, B+A//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):


import sys


INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


A, B, K = LI()

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

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(0,K):
  if i%2 == 0:
    A -= 1 if A%2 == 1 else 0
    B += int(A/2)
    A -= int(A/2)
  else:
    B -= 1 if B%2 == 1 else 0
    A += int(B/2)
    B -= int(B/2)

print(A,B)

Solution (Python):
p = input()
a = int(p.split()[0])
b = int(p.split()[1])
k = int(p.split()[2])
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(int(a)) + " " + str(int(b)))

Solution (Python):
A,B,K = map(int,input().split())
counter = 0
while True:
    if A%2 != 0:
        A -= 1
    A = A/2
    B += A
    counter += 1

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

    if counter == K:
        break

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

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

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

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

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

Solution (Python):

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

def is_even(num):
    return num % 2 == 0

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

Solution (Python):


import sys

line = sys.stdin.readline()
A, B, K = ( int(s) for s in line.split() )

x, y = A, B

for _ in range(K):
    
    
    x -= x % 2
    n = x // 2
    x -= n
    y += n
    x, y = y, x

if K % 2 == 1:
    x, y = y, x

print("%s %s" % (x, y))

Solution (Python):
A, B, K = [int(i) for i in input().split()]

for i in range(0, K):

    if (i % 2 == 0):

        if (A % 2 != 0):
            A = A - 1

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

        if (B % 2 != 0):
            B = B - 1

        b = B / 2
        B -= b
        A += b

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

Solution (Python):
args = str(input())
args = args.split(" ")
a = int(args[0])
b = int(args[1])
k = int(args[2])

turn = 0
for i in range(k):
    if (turn==0):
        if (a>0):
            if (a % 2 == 1):
                a = a - 1
        if (a>0):
            g = a/2
            a = a - g
            b = b + g
        turn=1
    elif (turn==1):
        if (b>0):
            if (b % 2 == 1):
                b = b -1
        if (b>0):
            g = b/2
            b = b - g
            a = a + g
        turn=0

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

Solution (Python):
s = input().split()
a_have = int(s[0])
b_have = int(s[1])
for  i in range(int(s[2])):
    if i % 2 == 0:
        if a_have % 2 != 0:
            a_have-=1
        b_have+= a_have/2
        a_have = a_have/2
    else :
        if b_have % 2 != 0:
            b_have-=1
        a_have+= b_have/2
        b_have = b_have/2
print(int(a_have),int(b_have))

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

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())
def h(x):
    if x%2==0:
        return int(x/2)
    else:
        return int((x-1)/2)
for i in range(K):
    if i%2 == 0:
        A = h(A)
        B = B + A
    else:
        B = h(B)
        A = A + B
print(A, B)

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

Solution (Python):

A,B,K=input().split()
A=int(A)
B=int(B)
K=int(K)
turn=0
while(1):
	if(turn==K):
		break
	if(turn%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
	turn+=1
print(str(A)+" "+str(B))

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

ab = [a,b]
for i in range(k):
    p = i%2
    if ab[p]%2 == 1:
        ab[p] -= 1
    half = ab[p]/2
    ab[p] -= half
    ab[1-p] += half

print(int(ab[0]), int(ab[1]))

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

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

Solution (Python):
a,b,k=map(int,raw_input().split(' '))
for i in range(k):
  a &= 0x7ffffffe
  b += a/2
  a /= 2
  b,a=a,b
if k%2:
  b,a=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):
    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:
        b = b + a//2
        a = a//2
    else:
        a = a + b//2
        b = b //2
print(a,b)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


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

    return '{} {}'.format(a,b)


print(main())

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 //= 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(str(a)+" "+str(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 /= 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(str(int(a))+" "+str(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
        a = a/2
        b += (a)
    else:
        if b%2 == 1:
            b -= 1
        b = b/2
        a += (b)
print(str(int(a)) + " " + str(int(b)))

Solution (Python):
import math
s = input().split()
a = int(s[0])
b = int(s[1])
k = int(s[2])
for i in range(k):
	if(i % 2 == 0):
		b += int(math.floor(a / 2))
		a = int(math.floor(a / 2))
	else:
		a += int(math.floor(b / 2))
		b = int(math.floor(b / 2))
print("{0} {1}".format(a,b))

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

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

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

print(A, B)

Solution (Python):
def exc(cookies, turn):
    exccs = 0
    subturn = (turn + 1) % 2
    if (cookies[turn] % 2) == 0:
        exccs = cookies[turn] //2
    else:
        exccs = (cookies[turn] - 1) // 2
    
    cookies[subturn] += exccs
    cookies[turn] = exccs

    return cookies

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

for i in range(k):
    turn = i % 2
    cookies = exc(cookies, turn)

print("{} {}".format(cookies[0], cookies[1]))

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

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

cnt = 0
while cnt < K:
  A = A // 2
  B = B + A
  cnt += 1
  
  if cnt >= K:
    break
  
  B = B // 2
  A = A + B
  cnt += 1
  
  
print(A,B)

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

Solution (Python):
a=[]
a1,a2,c = input().split()
a.append(int(a1))
a.append(int(a2))
c = int(c)
cur = 0
for i in range(c):
    a[1-cur]+=a[cur]//2
    a[cur]//=2
    cur=1-cur
print(a[0], a[1])

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

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

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:
        if a % 2 == 1:
            a = (a - 1) // 2
        else:
            a = a // 2
        b = b + a
    else:
        if b % 2 == 1:
            b = (b - 1) // 2
        else:
            b = b // 2
        a = b + a
print(a, b)

Solution (Python):
def swap(a, b, k):
    if k % 2 == 0:
        if a % 2 == 1:
            a -= 1
        return a/2, b+a/2
    if b % 2 == 1:
        b -= 1
    return int(a+b/2), int(b/2)


if __name__ == '__main__':
    a, b, k = list(map(int, input().split()))
    for i in range(k):
        a,b = swap(a,b,i)
    print(int(a), int(b))

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

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

print(A, B)

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

for i in range(K):
  if Co[i % 2] % 2 == 1:
    Co[i % 2] -= 1
  Co[i % 2] /= 2
  Co[(i+1) % 2] += Co[i % 2]

Co = list(map(int, Co))
print(Co[0], Co[1])

Solution (Python):
data = list(map(int, input().split()))

def cookie1(a, b):
  if a % 2 == 1:
    a = a - 1
  else:
    pass
  return (int(a / 2), b + int(a / 2))

def cookie2(a, b):
  if b % 2 == 1:
    b = b - 1
  else:
    pass
  return (a + int(b / 2), int(b / 2))

a = data[0]
b = data[1]
for i in range(data[2]):
  if i % 2 == 0:
    c = cookie1(a, b)
    a = c[0]
    b = c[1]
  else:
    c = cookie2(a, b)
    a = c[0]
    b = c[1]
print("{0} {1}".format(a, b))

Solution (Python):
def f(a, b):
    if a % 2 == 0:
        pass
    else:
        a -= 1
    a //= 2
    b += a
    return a, b

inp = list(map (int, input().split()))

cnt = 1
for i in range(inp[2]):
    if cnt % 2 == 0:
        inp[0], inp[1] = f(inp[1], inp[0])
    else:
        inp[1], inp[0] = f(inp[0], inp[1])


if inp[2] % 2 == 0:
    print(inp[0], inp[1], sep=" ")
else:
    print(inp[1], inp[0], sep=" ")

Solution (Python):
A,B,K = (int(x) for x in input().split())

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

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

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

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

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

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

print('{} {}'.format(a, b))

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

while n>0:
    if a % 2 ==1:
        a = (a-1)/2
        b = b + a
    else:
        a = a/2
        b = b + a
    a1=a
    b1=b
    if b % 2 ==1:
        b = (b-1)/2
        a = b + a
    else:
        b = b/2
        a = b + a
    a2=a
    b2=b
    n=n-2

if n%2==0:
    print(int(a2),int(b2))
else:
    print(int(a1),int(b1))

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


def calc(n):
    if n % 2 == 1:
        return n - 1
    else:
        return n


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

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

if k%2:
		if a%2:
			a=a-1
		a=a//2
		b=b+a
print('{} {}'.format(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=A-1
		A=int(A/2)
		B=B+A
	else:
		if(B%2==1):
			B=B-1
		B=int(B/2)
		A=A+B
print(A,B)

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

stop = 0

for i in range(k):
    if i % 2 == 0:
        a /= 2
        b += a
        if b == a * 2:
            stop = i + 1
            break
    if i % 2 == 1:
        b /= 2
        a += b
        if a == b * 2:
            stop = i + 1

if stop == 0 or (k - stop) % 2 == 0:
    print a, b
else:
    print b, a

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

stop = 0

for i in range(k):
    if i % 2 == 0:
        a /= 2
        b += a
        if b == a * 2:
            stop = i + 1
            break
    if i % 2 == 1:
        b /= 2
        a += b
        if a == b * 2:
            stop = i + 1

if stop == 0 or (k - stop) % 2 == 0:
    print a, b
else:
    print b, a

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

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

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 = list(map(int, input().split()))
a = A
b = B
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 = map(int, input().split())
for i in range(k):
  if i % 2 == 0:
    a, b = a//2, b + a//2
  else:
    a, b = a + b//2, b//2
print(a, b)

Solution (Python):
import sys

def solve(A,B,K):
    ab = [A,B]
    for i in range(K):
        if ab[0]%2!=0:
            ab[0]-=1
        ab[1]+=ab[0]//2
        ab[0]-=ab[0]//2
        ab.reverse()
    if K%2!=0:
        print(ab[1],ab[0])
        return
    print(ab[0],ab[1])


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    A = int(ws[0])
    B = int(ws[1])
    C = int(ws[2])
    return (A, B, C)

def main():
    solve(*readQuestion())
    


main()

Solution (Python):
def exchange(hand,receive):
    if(hand[0]%2==1):
        hand[0]-=1
    hand[0]/=2
    receive[0]+=hand[0]

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


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

print("{} {}".format(int(A[0]),int(B[0])))

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 ("{0} {1}".format(A,B))

Solution (Python):
str_inputs = input()
array_inputs = str_inputs.split(" ")

takahashi_num = int(array_inputs[0])
aoki_num = int(array_inputs[1])
loop_num = int(array_inputs[2])

for i in range(loop_num):
    if i % 2 == 0:
        if takahashi_num % 2 == 1:
            takahashi_num = takahashi_num-1
    
        takahashi_num = takahashi_num - takahashi_num/2
        aoki_num = aoki_num + takahashi_num
    else :
        if aoki_num % 2 == 1:
            aoki_num = aoki_num-1
      
        aoki_num = aoki_num - aoki_num/2
        takahashi_num = takahashi_num + aoki_num


print(str(int(takahashi_num)) + " " + str(int(aoki_num))+" ")

Solution (Python):
A,B,K=map(int,input().strip().split(' '))
while not K==0:
    if A%2==0:
        B+=A/2
        A=A/2
    else:
        A-=1
        B+=A/2
        A=A/2
    K-=1
    if K==0:
        break
    if B%2==0:
        A+=B/2
        B=B/2
    else:
        B-=1
        A+=B/2
        B=B/2
    K-=1
print(int(A),int(B))

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

def func(x,y):
    x = x//2
    y += x
    return x,y

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

print(a, b)

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

Solution (Python):
A, B, K = map(int, input().split())
k = 0
cur = 0
while k < K:
    if cur == 0:
        if A % 2 == 0:
            B += A // 2
            A -= A // 2
        else:
            A -= 1
            B += A // 2
            A -= A // 2

        cur ^= 1
    else:
        if B % 2 == 0:
            A += B // 2
            B -= B // 2
        else:
            B -= 1
            A += B // 2
            B -= B // 2
        cur ^= 1
    k += 1

print(A, B)

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

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

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

Solution (Python):
A, B, K = map(int, input().split())
while K > 0:
    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(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==0:
            B+=A//2
            A//=2
        else:
            B+=(A-1)//2
            A=(A-1)//2
    else:
        if B%2==0:
            A+=B//2
            B//=2
        else:
            A+=(B-1)//2
            B=(B-1)//2
print(A,B)

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

def process(a,b,k):
    if k%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
    return a,b

for k in range(K):
    A,B = process(A,B,k)

print(A,B)

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

    c = [A, B]
    for i in range(K):
        src = i % 2
        to = (i + 1) % 2

        if c[src] % 2 == 1:
            c[src] -= 1

        src_half = c[src] // 2
        c[src] -= src_half
        c[to] += src_half

    print(c[0], c[1])


if __name__ == '__main__':
    main()

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
        a //= 2
        b += a
    else:
        if b % 2 == 1:
            b -= 1
        b //= 2
        a += b

print(a, b)

Solution (Python):
s=input().split()
l=[int(s[0]),int(s[1])]
k=int(s[2])
for i in range(k):
  ind=i%2
  l[ind]-=l[ind]%2
  l[(ind+1)%2]+=l[ind]//2
  l[ind]//=2
print(l[0],end=" ")
print(l[1])

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 = list(map(int, input().split()))
ab = [a, b]
for i in range(k):
    if ab[i%2] % 2 == 1:
        ab[i%2] -= 1
        
    if i%2 == 0:
        ab[i%2+1] += ab[i%2]/2
        ab[i%2] /= 2
    else:
        ab[i%2-1] += ab[i%2]/2
        ab[i%2] /= 2

print(int(ab[0]), int(ab[1]))

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 = [int(_) for _ in input().split()]

while 1:
    if K == 0:
        break
    K -= 1
    A, B = A // 2, B + A // 2
    if K == 0:
        break
    K -= 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 != 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)