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

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

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

print(a, b)

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

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

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

Solution (Python):

def main():
    A, B, K = tuple(map(int, input().split()))
    for i in range(K):
        if i & 1 == 0:
            if A & 1:
                A -= 1
            A //= 2
            B += A
        else:
            if B & 1:
                B -= 1
            B //= 2
            A += B
    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:
        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):
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 -= A//2
        else:
            if B % 2 == 1:
                B -= 1
            A += B//2
            B -= B//2
    return str(A) + " " + str(B) 

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

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

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

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

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

print(A, B)

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

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

print(A, B)

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

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

print(A, B)

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

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

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

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

Solution (Python):
import math
inp = input().split()

a = int(inp[0])
b = int(inp[1])
k = int(inp[2])


def cookie(giver,getter):
    if giver%2 == 0:
        sub = math.floor(giver/2)
        giver = giver - sub
        getter = getter + sub
    else:
        tmp = giver - 1
        sub = math.floor(tmp/2)
        giver = giver - 1 - sub
        getter = getter +  sub


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


print(a,b)

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

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

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

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

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

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

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

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

def calc(a, b):
    if a %  2 != 0:
        a -= 1
    a //= 2
    b += a
    return a, b


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

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

print(a,b)

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

def exchange(n, m):
  if n % 2:
    n = (n-1) // 2
  else:
    n = n // 2
  m += n
  return n, m


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

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

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

for k in range(K):
	if 0 == k % 2:
		A //= 2
		B += A
	else:
		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:
        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 solve(a, b, k):
    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
    return "%d %d" % (a, b)

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

Solution (Python):

def main():
    a, b, k = list(map(int, input().rstrip().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)


if __name__ == "__main__":
    main()

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(str(a)+' '+str(b))

Solution (Python):
x,y,k = map(int,input().split(" "))
p=1
while(k!=0):
	k=k-1
	if(p==1):
		p=2
		if(x%2==0):
			y+=x//2
			x=x//2
		else:
			y+=(x-1)//2
			x=(x-1)//2
	else:
		p=1
		if(y%2==0):
			x+=y//2
			y=y//2
		else:
			x+=(y-1)//2
			y=(y-1)//2
print(x,y)

Solution (Python):
A, B, K = map(int, input().split())
cnt = 0
while True:
    if A % 2:
        A -= 1
    B += A//2
    A //= 2
    cnt += 1
    if cnt == K:
        break
    if B % 2:
        B -= 1
    A += B//2
    B //= 2
    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:
		
		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:
        half = A // 2
        A, B = half, B + half
    else:
        half = B // 2
        A, B = A + half, half
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(int(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, k = [int(i) for i in input().split()]
turn = 0
for i in range(k):
    if turn == 0:
        a = a//2
        b += a
        turn = 1
    elif turn == 1:
        b = b//2
        a += b
        turn = 0
print(a, b)

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

while True:
  A -= A&1
  A,B = A//2, B+A//2
  K -= 1
  if K == 0:
    break
  B -= B&1
  B,A = B//2, A+B//2
  K -= 1
  if K == 0:
    break
  
print(A,B)

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

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

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


A, B, K = mi()
C = [A, B]

turn = 0 
for _ in range(K):
  if C[turn] % 2 == 1:
    C[turn] -= 1
  C[turn] //= 2
  C[~turn] += C[turn]
  turn = ~turn

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

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

Solution (Python):
A,B,K = (int(i) for i in input().split())
turn = 0
for i in range(K):
    if turn%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
    turn += 1
print(str(A)+" "+str(B))

Solution (Python):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

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

print(A,B)

Solution (Python):

"""
B - Exchange
https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_b

"""
import sys


def solve(A, B, K):
    turn = 'takahashi'
    for _ in range(K):
        if turn == 'takahashi':
            A -= (A % 2)
            A //= 2
            B += A
            turn = 'aoki'
        else:
            B -= (B % 2)
            B //= 2
            A += B
            turn = 'takahashi'
    return A, B


def main(args):
    A, B, K = map(int, input().split())
    ans = solve(A, B, K)
    print(*ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

Solution (Python):


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


for i, k in enumerate(range(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

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

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

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

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

print(A, B)

Solution (Python):

a, b, k = [ int(v) for v 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())


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

print(a, b)

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

Solution (Python):
def main():
    A, B, K = map(int, input().split())
    cookies = [A, B]
    for i in range(K):
        cookies[i & 1] //= 2
        cookies[(i+1) & 1] += cookies[i & 1]
    print(*cookies)


if __name__ == "__main__":
    main()

Solution (Python):
a,b,k = map(int, input().split())
while True:
    if k == 0:
        break

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

    if k == 0:
        break

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

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

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

Solution (Python):

def Cukky(a,b):

    if a%2 == 0:
        a = a/2
    else:
        a = (a-1)/2

    b += a

    return a,b



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

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

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

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

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

print(" ".join(map(str, ans)))

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

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


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

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

while K > 0:
    if A % 2 == 1:
        A -= 1
    B = B + (A//2)
    A = A // 2
    K -= 1
    if K < 1:
        break
    if B % 2 == 1:
        B -= 1
    A = A + (B//2)
    B = B // 2
    K -= 1

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

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

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

Solution (Python):
a = [int(i) for i in input().split()]
A = a[0]
B = a[1]
K = a[2]

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

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

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

print(A,B)

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

print(a,b)

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

while True:
    if A % 2 == 1:
        A -= 1
    t = A // 2
    A, B = A - t, B + t

    K -= 1
    if K <= 0:
        break

    if B % 2 == 1:
        B -= 1
    t = B // 2
    A, B = A + t, B - t

    K -= 1
    if K <= 0:
        break

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

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

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

print(A,B)

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

if(K%2==1):
  print(List[-1],List[-2])
else:
  print(List[-2],List[-1])

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

    for i in range(k):

        if i % 2 == 0:

            if a % 2 == 1:
                a = present_for_b = (a - 1) / 2

            else:
                a = present_for_b = a / 2

            b = b + present_for_b

        else:

            if b % 2 == 1:
                b = present_for_a = (b - 1) / 2

            else:
                b = present_for_a = b / 2

            a = a + present_for_a

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


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

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

def exchange(a, b):
  if a % 2 == 1:
    a -= 1
  half = a/2
  return (half, b+half)

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

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

Solution (Python):
A, B , K = map(int, input().split())
for k in range(K):
    if k % 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 getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x


def prob():
    d = Debug()
    d.off()
    C = zeros(2)
    C[0], C[1], K = getIntList()
    d.dmp((C,K), "C,K")
    for i in range(K):
        n = i % 2
        if C[n] % 2 == 1:
            C[n] -= 1
        C[1-n] += C[n] // 2
        C[n] //= 2
        d.dmp((C,i,n), "C,i,n")
    print(C[0],C[1])

ans = prob()

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

Solution (Python):
import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())



A, B, K = mi()

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):
import sys
import numpy as np
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())



A, B, K = mi()

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):


import itertools
from collections import Counter
import bisect

def main():
    A, B, K = map(int, input().split())
    for i in range(1, K+1):
        if i % 2 == 1:
            A -= A % 2
            A, B = A // 2, B + A // 2
        else:
            B -= B % 2
            B, A = B // 2, A + B // 2
    print("{} {}".format(A, B))

if __name__ == '__main__':
    main()

Solution (Python):

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



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

Solution (Python):
def spliter(a):
    a = str(a)
    b = list()
    b = a.split(' ')
    for i in range(0,len(b)):
        b[i] = int(b[i])
    return b
s = spliter(str(input()))
goal = s[2]
counter = 0
while counter != goal:
    if s[0] % 2 == 0:
        s[1] += (s[0] / 2)
        s[0] -= (s[0] / 2)
        counter += 1
        if counter == goal:
            break
        else:
            if s[1] % 2 == 0:
                s[0] += (s[1] / 2)
                s[1] -= (s[1] / 2)
                counter += 1
                if counter == goal:
                    break
            else:
                s[1] -= 1
                s[0] += (s[1] / 2)
                s[1] -= (s[1] / 2)
                counter += 1
                if counter == goal:
                    break
    else:
        s[0] -= 1
        s[1] += (s[0] / 2)
        s[0] -= (s[0] / 2)
        counter += 1
        if counter == goal:
            break
        else:
            if s[1] % 2 == 0:
                s[0] += (s[1] / 2)
                s[1] -= (s[1] / 2)
                counter += 1
                if counter == goal:
                    break
            else:
                s[1] -= 1
                s[0] += (s[1] / 2)
                s[1] -= (s[1] / 2)
                counter += 1
                if counter == goal:
                    break
            
print(int(s[0]),int(s[1]))

Solution (Python):


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

    cookies = [A, B]
    for i in range(K):
        if cookies[i%2] % 2:
            cookies[i%2] -= 1

        cookies[(i+1)%2] += cookies[i%2] // 2
        cookies[i%2] //= 2

    print(*cookies)


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):
a,b,k = map(int,input().split())

ab = [a,b]

for i in range(k):
  
  give = i%2
  if give==0:
    take=1
  else:
    take=0
  
  if ab[give]%2==1:
    ab[give] -= 1
  ab[take] += (ab[give]/2)
  ab[give] /= 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: 
        if A % 2 == 1:
            A -= 1
        temp1 = int(A / 2)
        A = A - temp1
        B = B + temp1
    else:
        if B % 2 == 1:
            B -= 1
        temp2 = int(B / 2)
        A = A + temp2
        B = B - temp2
print(A, B)

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

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

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

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):


import sys
import math



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

for _ in range(k):
  a -= a&1
  a //= 2
  b += a
  a,b = b,a

if k&1 > 0:
  print(b,a)
else:
  print(a,b)