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:
    A = A // 2
    B += A
  else:
    B = B // 2
    A += B
print(int(A), int(B))

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

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

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

Solution (Python):
A,B,K = (int(T) for T in input().split())
for TK in range(0,K):
    if TK%2==0:
        A -= [0,1][A%2]
        Give = A//2
        A,B  = A-Give,B+Give
    else:
        B -= [0,1][B%2]
        Give = B//2
        A,B  = A+Give,B-Give 
print('{} {}'.format(A,B))

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, k = M()
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, b)

Solution (Python):



from math import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7


INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
a,b,k = readInts()
cnt = 0
while cnt < k:
    if cnt%2 == 0:
        a //= 2
        b += a
    else:
        b //= 2
        a += b
    cnt += 1
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())
cnt=k
while(k>0):
    if a %2==1:
        a-=1
        b+=a//2
        a//=2
        cnt-=1
        
    else:
        b += a // 2
        a//=2
        cnt -= 1

    if cnt==0:
        print(a,b)
        break
    if b %2==1:
            b -= 1
            a += b // 2
            b//=2
            cnt -= 1
            
    else:
        a += b // 2
        b//=2
        cnt -= 1

    if cnt==0:
        print(a,b)
        break

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

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    a, b, k = ril()
    t = True
    for i in range(k):
        if t:
            if a % 2 == 1:
                a -= 1
            b += a // 2
            a //= 2
        else:
            if b % 2 == 1:
                b -= 1
            a += b // 2
            b //= 2
        t = not t
    print(a, b)

if __name__ == '__main__':
    main()

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

for i in range(1,k+1):
    if i%2:
        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):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        exchenge = a // 2
        a -= exchenge
        b += exchenge 
    if i % 2 == 1:
        if b % 2 == 1:
            b -= 1
        exchenge = b // 2
        b -= exchenge
        a += exchenge   
print(f'{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())
cnt=0
while True:
    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
    if cnt >= K:
        break
print('{} {}'.format(A,B))

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


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

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

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

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

i = 1
while i <=k:
    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

    i +=1

print(a,b)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B, K = map(int, readline().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):
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):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    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(A, B)


def main():
    solve()


if __name__ == '__main__':
    main()

Solution (Python):

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

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

print(A, B)

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

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

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

print(a,b,sep=' ')

Solution (Python):
a,b,k=map(int,input().split())
def rule(a,b):
    if a%2==0:
        return a//2,b+a//2     
    else:
        return (a-1)//2,b+(a-1)//2

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

Solution (Python):
'''
Created on 2020/08/21

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,K=map(int,pin().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(f"{A} {B}")
  return 
main()

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


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==0:
            B=B+(A//2)
            A=A//2
        else:
            C=A-1
            B=B+(C//2)
            A=C//2
    elif i%2==0:
        if B%2==0:
            A=A+(B//2)
            B=B//2
        else:
            D=B-1
            A=A+(D//2)
            B=D//2
print(' '.join([str(A),str(B)]))

Solution (Python):

def move(me,you):
    if me%2==0:
        return me//2,you+me//2
    else:
        return (me-1)//2,you+(me-1)//2

a,b,k=map(int,input().split())
turn=True
cnt=0
while cnt<k:
    if turn:
        a,b=move(a,b)
        cnt+=1
        turn=False
    else:
        b,a=move(b,a)
        cnt+=1
        turn=True
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
        tmp = a // 2
        a -= tmp
        b += tmp
    else:
        if b % 2 == 1:
            b -= 1
        tmp = b // 2
        a += tmp
        b -= tmp

print(a, b)

Solution (Python):
a, b, k = map(int, 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(f'{max(0,a)} {max(0,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
        temp = a//2
        b += temp
        a -= temp
    else:
        if b % 2 != 0:
            b -= 1
        temp = b//2
        a += temp
        b -= temp

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

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

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

print(a,b)

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

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


def main():
    abk = list(map(int, input().split()))
    k = abk[2]

    for i in range(k):
        i2 = i % 2
        if abk[i2] % 2 == 1:
            abk[i2] -= 1
        v = abk[i2] // 2
        abk[i2], abk[1 - i2] = abk[i2] - v, abk[1 - i2] + v
    print(abk[0], abk[1])


if __name__ == '__main__':
    main()

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

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

Solution (Python):
a,b,k=map(int,input().split())
def co(x, y):
	x //= 2
	y += x
	return x, y

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

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, K = map(int, readline().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())
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:
        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())

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

Solution (Python):
import sys, math
from functools import lru_cache
import datetime
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    A, B, K = mi()
    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)



if __name__ == '__main__':
    main()

Solution (Python):


import copy
import random
import bisect 
import fractions 
import math
import sys
import collections
from decimal import Decimal 

mod = 10**9+7
sys.setrecursionlimit(mod) 

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A, B, K = LI()

for k in range(K):
    if k % 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):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B, K = LI()

    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)

if __name__ == '__main__':
    resolve()

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 = [int(i) for i in 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):
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())
switch = 0

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

print(a, b)

Solution (Python):
a,b,k = map(int,input().split())
count = 0
for i in range(k):
    if a % 2 == 1:
        a -= 1
    a /= 2
    b += a
    count += 1
    if count == k:
        break
    if b % 2 == 1:
        b -= 1
    b /= 2
    a += b
    count += 1
    if count == k:
        break
print(str(round(a)) + " " + str(round(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:
        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())

cnt=0
while K:
  if cnt%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  
  K-=1
  cnt+=1
  
print(A,B)

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

print(A,B)

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

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

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

takahasi = True
for _ in range(K):
    if takahasi is True:
        A //= 2
        B += A
    else:
        B //= 2
        A += B
    takahasi = not takahasi

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, 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:
    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())
cnt=0
while True:
  if a%2==1:
    a-=1
  half=a//2
  a-=half
  b+=half
  cnt+=1
  if cnt==k:
    break
  if b%2==1:
    b-=1
  half=b//2
  b-=half
  a+=half
  cnt+=1
  if cnt==k:
    break  
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:
        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 not i % 2:
        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())

takahasi_turn = 1
for _ in range(K):
    if takahasi_turn:
        if A % 2 == 1:
            A -= 1
        v = A // 2
        B += v
        A -= v
    else:
        if B % 2 == 1:
            B -= 1
        v = B // 2
        A += v
        B -= v
    takahasi_turn ^= 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
    a//=2
    b+=a
  else:
    b-=b%2
    b//=2
    a+=b
print(a,b)

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def simu(a, b, k):
        turn = True
        while k > 0:
            
            if turn:
                tmp = a//2
                a = tmp
                b += tmp
            else:
                tmp = b//2
                b = tmp
                a += tmp
            k -= 1
            turn = not turn
        return a, b



    a, b, k = mi()
    x, y = simu(a, b, k)
    print(f"{x} {y}")


if __name__ == "__main__":
    main()

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

    print(A, B)

if __name__ == "__main__":
    main()

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 = A+B//2, B//2
print(A,B)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


A, B, K = MAP()

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

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

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

cnt = 0

for i in range(k):
    if cnt%2 == 0:
        if a%2 == 0:
            a = a//2
            b += a
            cnt += 1
        else:
            a -= 1
            a = a//2
            b += a
            cnt += 1
    else:
        if b%2 == 0:
            b = b//2
            a += b
            cnt += 1
        else:
            b -= 1
            b = b//2
            a += b
            cnt += 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(str(a)+" "+str(b))