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

Solution (Python):
import sys


def process(A, B, N, K, Turn):
    if N == K:
        return A, B
    else:
        if Turn:
            return process(int(A/2), B + int(A/2), N + 1, K, False)
        else:
            return process(A + int(B/2), int(B/2), N + 1, K, True)


def main(A, B, K):
    A, B = process(A, B, 0, K, True)
    return "{} {}".format(A, B)


if __name__ == "__main__":
    A, B, K = sys.stdin.readline().split()
    print(main(int(A), int(B), int(K)))

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

print(A, B)

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

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

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

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

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

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

cookie = [A, B]
turn   = 0
for _ in range(K):
    cookie[turn] //= 2
    cookie[1 - turn] += cookie[turn]
    turn = 1 - turn

A, B = cookie
print(A, B)

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

        i += 1
        c += 1
    else:
        if B % 2 == 0:
            B_ = B //2
            A = A + B_
            B = B_
        else:
            B -= 1
            B_ = B //2
            A = A + B_
            B = B_

        i += 1
        c += 1
print(A,B)

Solution (Python):
A, B, K = map(int, raw_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//2):
    a = a//2*2
    b+= a/2
    a/=2
    b= b//2*2
    a+= b/2
    b/=2
if(k%2==1):
    a = a//2*2
    b+= a/2
    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:
        a //= 2
        b += a
    else:
        b //= 2
        a += b
print(a, b)

Solution (Python):



def main():
    a, b, k = map(int, input().split())
    takahashi = a
    aoki = b

    for i in range(k):
        if i % 2 == 0:
            if takahashi % 2 == 1:
                takahashi -= 1

            takahashi -= takahashi // 2
            aoki += takahashi
        else:
            if aoki % 2 == 1:
                aoki -= 1

            aoki -= aoki // 2
            takahashi += aoki

    print(takahashi, aoki)


if __name__ == '__main__':
    main()

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

for k in range(K):
    if k%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):
input_str = str(input()).split()
a, b, k = int(input_str[0]), int(input_str[1]), int(input_str[2])


self = a
partner = b

for i in range(k):
    
    
    if self % 2 == 1:
        self += -1

    
    partner += int(self / 2)
    self = int(self / 2)

    self, partner = partner, self
    i -= 1

if i % 2 == 1:
    a = partner
    b = self
else:
    b = partner
    a = self

print(a, b)

Solution (Python):
def b_exchange(A, B, K):
    takahashi_cookie = A
    aoki_cookie = B
    turn = 0
    while turn < K:
        if turn % 2 == 0:
            if takahashi_cookie % 2 == 1:
                takahashi_cookie -= 1
            takahashi_cookie //= 2
            aoki_cookie += takahashi_cookie
        else:
            if aoki_cookie % 2 == 1:
                aoki_cookie -= 1
            aoki_cookie //= 2
            takahashi_cookie += aoki_cookie
        turn += 1
    ans = '{0} {1}'.format(takahashi_cookie, aoki_cookie)
    return ans

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

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(int(a),int(b))

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

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

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

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

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

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,K=map(int,input().split())
for i in([0,1]*K)[:K]:x[i]//=2;x[~i]+=x[i]
print(*x)

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

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("%d %d" % (a, b))

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

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

for n in range(K):
    if n % 2 ==0:
        if A % 2 != 0:
            A -= 1
        C = A // 2
        A -= C
        B += C
    else:
        if B % 2 != 0:
            B -= 1
        C = B // 2
        A += C
        B -= C
print('{} {}'.format(A, B))

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

Solution (Python):
*AB, K = map(int, input().split())
turn = 0
for _ in range(K):
    AB[turn ^ 1] += AB[turn] // 2
    AB[turn] //= 2
    turn ^= 1
print(*AB)

Solution (Python):
*AB, K = map(int, input().split())
turn = 0
for _ in range(K):
    AB[turn] -= AB[turn] % 2
    AB[turn ^ 1] += AB[turn] // 2
    AB[turn] //= 2
    turn ^= 1
print(*AB)

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

for k in range(K):
    if k%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())

def COOKIE(A,B):
    if A%2==1:A -= 1
    B += A//2
    A //= 2
    return A,B

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

def fa(a,b,k):
  if k == 0:
    return a, b
  elif b % 2 == 0:
    return ft(a + b/2, b/2, k-1)
  else:
    return ft(a + (b-1)/2, (b-1)/2, k-1)

def ft(a,b,k):
  if k == 0:
    return a, b
  elif a % 2 == 0:
    return fa(a/2, a/2 + b,k-1)
  else:
    return fa((a-1)/2,(a-1)/2+b,k-1)


def main():
  a, b, k = map(int, input().split())
  ra, rb = ft(a,b,k)
  print(int(ra), int(rb))

main()

Solution (Python):
list_num = [int(i) for i in input().split()]

players = list_num[0:2]
k = list_num[-1]

for i in range(k):
    players[i%2] = players[i%2]//2
    players[(i+1)%2] += players[i%2]

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

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

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

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

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

print(A, B)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
number = input().strip().split(' ')
number_list = list(map(int,number))
A = number_list[0]
B = number_list[1]
K = number_list[2]

while K > 0:
    if A % 2 == 0:
        A = A
    else:
        A = A - 1
    A = A / 2
    B = B + A
    K = K - 1
    if K > 0:
        if B % 2 == 0:
            B = B
        else:
            B = B - 1
        B = B / 2
        A = A + B
        K = K - 1
print(str(int(A)) + ' ' + str(int(B)))

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

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

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

Solution (Python):
a, b, k = map(int, input().split())
for i in range(100):
    if i >= k:
        break

    if not(i%2):
        if a%2:
            a -= 1
        a /= 2
        b += a
    else:
        if b%2:
            b -= 1
        b /= 2
        a += b


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

Solution (Python):

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

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

print(A, B)

Solution (Python):

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

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

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

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

Solution (Python):
import sys

array = list(map(int, input().strip().split(' ')))

A = array[0]
B = array[1]
K = array[2]





if A < 1:
    sys.exit()
if A > 10**9:
    sys.exit()




if B < 1:
    sys.exit()
if B > 10**9:
    sys.exit()




if K < 1:
    sys.exit()
if K > 100:
    sys.exit()








kaisu = 0 

for i in range(K):

    

    kaisu = kaisu + 1
    
    if kaisu % 2 ==1:

        if A % 2 == 1:
        
        
            A = A - 1

        work_a = int(A / 2)
    
        A = A - work_a

        B = B + work_a

        
    elif kaisu % 2 ==0:
    
        if B % 2 == 1:
            
            
            B = B - 1
     
        work_b = int(B / 2)

        

    
        A = A + work_b

        B = B - work_b
    
            
    

print(A,end='')
print(' ',end='')
print(B,end='')

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

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

out_list = [A_B_K[0],A_B_K[1]]
out_list = list(map(int, out_list))
out_list = list(map(str, out_list))
out = ' '.join(out_list)
print(out)

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

k = 0
while True:

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

    

    B += round(A/2)
    A -= round(A/2)

    
    k += 1
    if k == K:
        break

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

    

    A += round(B/2)
    B -= round(B/2)

    
    k += 1
    if k == K:
        break

print(A, B)

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

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

if 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>=3:
    for i in range(1,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==1:
        if A % 2 ==1:
            A =A-1
        A =A/2
        B=B+A


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

Solution (Python):
count_cookie = str(input())
count_cookie = count_cookie.split()
i = 0
while i < len(count_cookie):
    count_cookie[i] = int(count_cookie[i])
    i += 1

count = 0
while count < count_cookie[2]:
    if count % 2 == 0:
        if count_cookie[0] % 2 != 0:
            count_cookie[0] = count_cookie[0] - 1
            give_cookie = count_cookie[0] / 2
            count_cookie[0] = count_cookie[0] - give_cookie
            count_cookie[1] = count_cookie[1] + give_cookie
        else:
            give_cookie = count_cookie[0] / 2
            count_cookie[0] = count_cookie[0] - give_cookie
            count_cookie[1] = count_cookie[1] + give_cookie
    else:
        if count_cookie[1] % 2 != 0:
            count_cookie[1] = count_cookie[1] - 1
            give_cookie2 = count_cookie[1] / 2
            count_cookie[1] = count_cookie[1] - give_cookie2
            count_cookie[0] = count_cookie[0] + give_cookie2
        else:
            give_cookie2 = count_cookie[1] / 2
            count_cookie[1] = count_cookie[1] - give_cookie2
            count_cookie[0] = count_cookie[0] + give_cookie2

    count += 1

print("{0:.0f} {1:.0f}".format(count_cookie[0],count_cookie[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
        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())
while(True):
    if a%2 != 0:
        a = (a-1)//2
        b += a
    else:
        a = a//2
        b += a
    k -= 1
    if k == 0:
        break
    if b%2 != 0:
        b = (b-1)//2
        a += b
    else:
        b = b//2
        a += b
    k -= 1
    if k == 0:
        break

print(a,b)

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

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

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

Solution (Python):
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("{} {}".format(int(a), int(b)))

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

Solution (Python):
def run(A, B, K):
    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
    return '{} {}'.format(int(A), int(B))


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


if __name__ == '__main__':
    main()

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

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

print(A, end=' ')
print(B)

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

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

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

while True:
    if K == time:
        break
    else:
        time += 1
        if time % 2 == 1:
            if A % 2 == 1:
                A -=1
            A = int(A / 2)
            B += A
        else:
            if B % 2 == 1:
                B -=1
            B = int(B / 2)
            A += B

print(A, B)

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

    else:
        A = A // 2
        B = B + A
print(A,B)

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

def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False

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

        tmp = a
        a = b
        b = tmp
    else:
        a = a - 1
        a = a / 2
        b = b + a

        tmp = a
        a = b
        b = tmp

if is_even(k):
    print(int(a), int(b))
else:
    tmp = a
    a = b
    b = tmp
    print(int(a), int(b))

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

i = 0
while i < K:
    if i%2 == 0:
        if A%2 == 1:
            A -= 1
        AtoB = int(A/2)
        A = A - AtoB 
        B = B + AtoB 
    else:    
        if B%2 == 1:
            B -= 1
        BtoA = int(B/2)
        A = A + BtoA 
        B = B - BtoA
    i += 1
print(str(A) + ' ' + str(B))

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

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(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
ans1 = str(int(A))
ans2 = str(int(B))
print(ans1 + " " + ans2)

Solution (Python):
[a,b,k] = list( map(int, input().split() ) )
for i in range(k):
	if a%2 == 1:
		a -= 1
	a //= 2
	b += a
	c = a
	a = b
	b = c
if k%2 == 1:
	c = a
	a = b
	b = c
print('{} {}'.format(a,b) )

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

def sousa(x,y):
  if x%2 == 0:
    x=int(x-x/2)
    y=int(y+x)
  else:
    x = int(x-1-(x-1)/2)
    y = int(y+x)
  return x,y

X = A
Y = B
for i in range(K):
  Number = sousa(X,Y)
  X = Number[1]
  Y = Number[0]
if K%2 == 0:
  output = (X,Y)
else:
  output = (Y,X)

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

Solution (Python):
import sys

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

Solution (Python):


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

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

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

Solution (Python):
N = list(map(int, input().split()))
A = N[0]
B = N[1]
K = N[2]





def cookie(my_num, your_num):
    
    if my_num % 2 == 0:
        
        
        return int(my_num / 2), your_num + int(my_num / 2)
    else:
        
        
        return my_num - 1 - int((my_num - 1) / 2), your_num + int((my_num - 1) / 2)

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

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

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

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

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

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

Solution (Python):
l = input().split()
taka = int(l[0])
aoki = int(l[1])
num = int(l[2])
for i in range(1,num+1):
	if i % 2 == 0:
		if aoki % 2 == 1:
			aoki += -1
		aoki = aoki //2
		taka += aoki
	elif i % 2 ==1:
		if taka % 2 == 1:
			taka += -1
		taka = taka // 2
		aoki += taka
print(taka,aoki)

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

def is_odd(num):
    if num % 2 == 0:
        return False
    else:
        return True

def proc(a,b):
    if is_odd(a):
        a=a-1
    a=a/2
    b+=a
    return a,b

is_a = True
for i in range(k):
    if is_a:
        a,b=proc(a,b)
        is_a=False
    else:
       b,a=proc(b,a)
       is_a=True


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

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

def main(a, b, k, k_first):
    if k % 2 == k_first % 2:
        if a % 2 == 1:
            a -= 1
        new_a = int(a / 2)
        new_b = b + int(a / 2)
    else:
        if b % 2 == 1:
            b -= 1
        new_b = int(b / 2)
        new_a = a + int(b / 2)
    if k - 1 == 0:
        print(str(new_a) + " " + str(new_b))
    else:
        main(new_a, new_b, k - 1, k_first)

main(a, b, k, k)