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(" "))
def f(A,B,n):
  i = 1
  while i <= n:
    if i%2 == 1:
      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 = B + A
    i = i + 1 
  list = [int(A),int(B)]
  return (list)
print(' '.join(map(str,f(A,B,K))))

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

Solution (Python):
A, B, K = [int(_) for _ in input().split()]
for i in range(K):
    if i % 2 == 0:
        A = A // 2
        B = B + A
    else:
        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=A-1
    C=int(A/2)
    A=C
    B=B+C
  else:
   if(B%2==1):
     B=B-1
   C=int(B/2)
   B=C
   A=A+C

print(A,B)

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

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

print(A,B)

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

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

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

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

print(a,b,sep=' ')

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):
import numpy as np

def process(src, dst):
    
    
    if src % 2 == 0:
        pass
    else:
        src -= 1

    
    
    
    src = src / 2
    dst += src

    return src, dst



indata = input().split()
A = int(indata[0])
B = int(indata[1])
K = int(indata[2])


takahashi = A
aoki = B


for i in range(K):
    if i % 2 == 0:
        
        takahashi, aoki = process(takahashi, aoki)
    else:
        
        aoki, takahashi = process(aoki, takahashi)


print(int(takahashi), int(aoki))

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

Solution (Python):
import math

data = input().split()

t = int(data[0])
a = int(data[1])
n = int(data[2])

for i in range(1,n+1):
    if i % 2 == 1 or i == 1:
        if t % 2 == 1:
            t  = t - 1
            t =  t /2
            a = a + t
        else:
            t =  t /2
            a = a + t
    else:
        if a % 2 == 1:
            a  = a - 1
            a =  a / 2 
            t = a + t
        else:
            a =  a / 2
            t = a + t
    
    ans = [str(math.floor(t)),str(math.floor(a))]
print(" ".join(ans))

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

Solution (Python):

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

def eat(a,b):
    a-= a%2
    b=int(b+a/2)
    a= int(a/2)
    return a,b

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

Solution (Python):
import math

A, B, K = map(int,input().split())
ct = 0
if K % 2 == 0:
    while(ct < K / 2):
        B += math.floor(A / 2)
        A = math.floor(A / 2)

        A += math.floor(B / 2)
        B = math.floor(B / 2)
        ct += 1
else:
    B += math.floor(A / 2)
    A = math.floor(A / 2)
    while(ct < ((K-1) / 2)):
        A += math.floor(B / 2)
        B = math.floor(B / 2)
        B += math.floor(A / 2)
        A = math.floor(A / 2)
        ct += 1
print(A, B)

Solution (Python):

a, b, c = input().split()

a = int(a)
b = int(b)
c = int(c)

for i in range(c):
    if (a%2 == 1 and i %2 == 0):
        a = a - 1
    if (b%2 == 1 and i % 2 == 1):
        b = b - 1
    if(i%2 == 0):
        ac = a
        a = a/2 
        b = b + ac/2
    else:
        bc = b
        a = a+bc/2
        b = b/2 

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

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

A=int(A)
B=int(B)
K=int(K)

for i in range(int(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(int(A), int(B))

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

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

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

    else:

        if B % 2 == 1:
            B = B - 1

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

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

Solution (Python):
a, b, k = map(int, raw_input().split())
for i in range(0, 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(str(a)+" "+str(b))

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

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

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

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

Solution (Python):
a,b,c = map(int,input().split())
d = 0
lis = [a,b]
for i in range(c):
    g = d % 2
    if lis[g]%2 == 1:
        lis[g] -= 1
    w = lis[g] / 2
    p = (d+1) % 2
    lis[g] = int(lis[g]/2)
    lis[p] += int(w)  

    d += 1

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

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

while c <= K:
    if A % 2 == 1:
        A -= 1
    A //= 2
    B += A
    a = A
    A = B
    B = a
    c += 1

if K % 2 == 0:
    print(A, B)

else:
    print(B, A)

Solution (Python):
def Aeat(A,B):
    if A%2==0:
        tmp=A//2
        A-=tmp
        B+=tmp
    else:
        A-=1
        tmp=A//2
        A-=tmp
        B+=tmp
    return A, B

def Beat(A,B):
    A,B=B,A
    if A%2==0:
        tmp=A//2
        A-=tmp
        B+=tmp
    else:
        A-=1
        tmp=A//2
        A-=tmp
        B+=tmp
    A,B=B,A
    return A, B

A,B,K=map(int, input().split())
for i in range(K):
    if i%2==0:
        A,B=Aeat(A,B)
    else:
        A,B=Beat(A,B)
print(str(int(A))+' '+str(int(B)))

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

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

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

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

Solution (Python):



input = raw_input().split(" ")
A = int(input[0])
B = int(input[1])
K = int(input[2])


for i in range(0, K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
            A_save = A
        else:
            A_save = A
        A = A_save / 2
        B += A_save / 2
    else:
        if B % 2 == 1:
            B -= 1
            B_save = B
        else:
            B_save = B
        A += B_save / 2
        B = B_save / 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 += a // 2
        a //= 2
        
    else:
        if b % 2 == 1:
            b -= 1
        a += b // 2
        b //= 2
print(a, b)

Solution (Python):
p = {1:0, -1:0}
p[1], p[-1], k = map(int, input().rstrip().split())
i = 1

for _ in range(k):
    p[i] //= 2
    p[i * -1] += p[i]
    i *= -1

print(p[1], p[-1])

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


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

print a,b

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

    if b % 2 == 1:
        b -= 1
    a += int(b / 2)
    b -= int(b / 2)
    k -= 1
print(a, b)

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



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

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

Solution (Python):




"""








"""
def get():
    return [int(i) for i in input().split(' ')]

def emurate_process(takahashi, aoki, mode):
    if mode == 't':
        hero = takahashi
        opposite = aoki
    else:
        hero = aoki
        opposite = takahashi

    if hero % 2 == 1:
        hero -= 1
    watasu = hero // 2
    hero = watasu
    opposite += watasu

    if mode == 't':
        return hero, opposite
    else:
        return opposite, hero


def solve(A,B,K):
    for i in range(K):
        if i % 2 == 0:  
            A, B = emurate_process(A, B, 't')
        elif i % 2 == 1:  
            A, B = emurate_process(A, B, 'a')

    print('{} {}'.format(int(A),int(B)))

if __name__ == '__main__':
    solve(*get())

Solution (Python):
temp = input().split(" ")
A = int(temp[0])
B = int(temp[1])
K = int(temp[2])

def judge(number):
    if number % 2 != 0:
        return number - 1
    else:
        return number
for k in range(K):
    if k % 2 == 0:
        
        A = judge(A)
        A = A / 2
        B = B + A
    else:
        
        B = judge(B)
        B = B / 2
        A = 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 != 0:
            a -= 1
        ageru = a / 2
        a -= ageru
        b += ageru
    else:
        if b % 2 != 0:
            b -= 1
        ageru = b / 2
        a += ageru
        b -= ageru

print(str(int(a)) + ' ' + str(int(b)))

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

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

if K % 2 != 0:
    print(B, A)
    exit()
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(int(A),int(B))

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

i = k

while i > 0:
  if a % 2 == 1:
    a -=1
    b += a//2
    a -= a//2
  else:
    b += a//2
    a -= a//2
  i -= 1
  if i:
    if b % 2 == 1:
      b -=1
      a += b//2
      b -= b//2
    else:
      a += b//2
      b -= b//2
    i -=1

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

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

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

    if K == 0:
        break
    else:       
        if B%2 !=0:
            B -= 1
        A += B//2
        B = B//2
        K -= 1
    
print(A,B)

Solution (Python):

""" Tenka1 Programmer Beginner Contest B """

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

def cookie():
    """ プレイヤーp, 所持枚数n """
    takahashi = [A]
    aoki = [B]

    for i in range(K):
        if i%2 == 0:   
            takahashi.append(takahashi[i] // 2)
            aoki.append(aoki[i] + takahashi[i] // 2)
        elif i%2 == 1: 
            takahashi.append(takahashi[i] + aoki[i] // 2)
            aoki.append(aoki[i] // 2)
        if test:
            print('i =', i)
            print('takahashi', takahashi)
            print('aoki     ', aoki)

    return takahashi[K], aoki[K]


def main():
    print(cookie()[0], cookie()[1])


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):


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

flag = K % 2

for k in range(K):
    if k % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B = B + A * 0.5
        A = A * 0.5

    else:
        if B % 2 == 1:
            B -= 1
        A = A + B * 0.5
        B = B * 0.5

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

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

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

print(a, b)

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

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

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

if int(K)%2==1:
    isOdd=True
else:
    isOdd=False
K=int(int(K)/2)

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

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

print(A,B)

Solution (Python):
def main():
    def change(x,y):

        if x % 2 == 1:
            x -= 1
        y += x//2
        x = x // 2
        return x, y


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

    cnt = 0
    while True:
        A, B = change(A,B)
        cnt += 1
        if cnt == K:
            break
        B, A = change(B,A)
        cnt += 1
        if cnt == K:
            break
    print(A,B)


    return


main()

Solution (Python):

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


for idx in range(k):
    if idx % 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 = list(map(int,input().split()))

A = a[0]; B = a[1]; K = a[2]

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

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

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

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

if K % 2 == 1:
    A, B = B, A
print(int(A), int(B))

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

for i in range(int(k / 2)):
  if a % 2 == 1:
    a -= 1

  b += (a / 2)
  a = a / 2

  if b % 2 == 1:
    b -= 1

  a += (b / 2)
  b = b / 2

if k % 2 == 1:
    if a % 2 == 1:
        a -= 1

    b += (a / 2)
    a = a / 2

print("{} {}".format(int(a), int(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)/2
        else:
            A = A/2
        B = B+A
    else:
        if(B%2 == 1):
            B = (B-1)/2
        else:
            B = B/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
        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())
for i in range(0,k):
    if i%2==0:
        c=a//2
        a=c
        b=c+b
    else:
        c=b//2
        b=c
        a=a+c
print(a,b)

Solution (Python):


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

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


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

def play(a, b, i):
    if i%2 == 0:
        a, b = send(a, b)
    else:
        b, a = send(b, a)
    return a, b

for i in range(k):
    a, b = play(a, b, i)
    

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

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

for i in reversed(range(K,0,-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):
from sys import stdin
a,b,k = map(int,stdin.readline().split())
a = [a,b]
ind = 0
for i in xrange(k):
 a[1-ind] += a[ind]/2
 a[ind] = a[ind]/2
 ind = 1 - ind
print a[0],a[1]

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

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

print(A, B)

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

def cookie(x, y, k, c):

    if x % 2 == 1:
        x -= 1
    y = y + x//2
    x = x//2
    k -= 1
    c += 1
    
    if k == 0:
        if c % 2 == 1:
            print(x, y)
        else:
            print(y, x)
        return 0
    
    cookie(y, x, k, c)

cookie(A, B, K, count)

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

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

if k%2!=0:
    if a%2!=0:
        a -= 1
    b += (a//2)
    a -= (a//2)

print(a, b)

Solution (Python):



def main():
    A, B, K = map(int, raw_input().split())
    for i in xrange(1, K + 1):
        if i % 2 == 0:  
            B, A = func(turn=B, to=A)
        else:  
            A, B = func(turn=A, to=B)

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


def func(turn, to):
    if turn % 2 == 0:
        temp = turn / 2
        to += temp
        turn -= temp
    else:
        turn -= 1
        temp = turn / 2
        to += temp
        turn -= temp

    return turn, to


if __name__ == "__main__":
    main()

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

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

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

countK = 0
while(countK<K):
    if countK%2 == 0:
        if A%2 == 1:
            A -= 1
            A = A//2
            B = B + A
        else:
            A = A//2
            B = B + A
    else:
        if B%2 == 1:
            B -= 1
            B = B//2
            A = A + B
        else:
            B = B//2
            A = A + B
    countK += 1
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
        A //= 2
        B += A
    else:
        
        if B % 2 != 0:
            B -= 1
        B //= 2
        A += B


print("{} {}".format(A, B))

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

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

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

print(A,B)

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

    if cnt>=k:
        break
    if b%2!=0:
        b=b-1
    else:
        pass
    tmp=b//2
    b=b//2
    a+=tmp
    cnt+=1

    if cnt>=k:
        break

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

Solution (Python):


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

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

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

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

for i in range(n[2]):
    
    x=i%2
    y=(i+1)%2
    
    if n[x]%2==1:
        n[x]=n[x]-1
    
    n[x]=n[x]/2
    n[y]=n[y]+n[x]
print(int(n[0]),int(n[1]))

Solution (Python):
t,a,k = map(int, input().split())
x = 0

for i in range(k):
        if x == 0:
                t = int(t/2)
                a += t
                x = 1
        elif x == 1:
                a = int(a/2)
                t += a
                x = 0

print(t)
print(a)

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(round(A), round(B))

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

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

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

while(k>0):
    tmp = a//2
    a = tmp
    b += tmp
    k -=1
    if k==0:
        break
    
    tmp = b//2
    b = tmp
    a += tmp
    k -=1
    if k==0:
        break
print(a,b)

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

for i in range(K):
    if i % 2 == 0:
        tmp_1, tmp_2 = A, B
    else:
        tmp_1, tmp_2 = B, A
    if tmp_1 % 2 == 1:
        tmp_1 -= 1
    half = int(tmp_1 / 2)
    tmp_2 += half
    tmp_1 = half
    if i % 2 == 0:
        A, B = tmp_1, tmp_2
    else:
        A, B = tmp_2, tmp_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
    b=b+a//2
    a=a//2
  else:
    if(b%2==1):
      b-=1
    a=a+b//2
    b=b//2

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