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 = [int(i) for i in 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())
flag = True
for _ in range(k):
  if flag:
    flag = False
    if a%2==0:
      b += int(a/2)
      a = int(a/2)
    else:
      b += int((a-1)/2)
      a = int((a-1)/2)
  else:
    flag = True
    if b%2==0:
      a += int(b/2)
      b = int(b/2)
    else:
      a += int((b-1)/2)
      b = int((b-1)/2)
print(a,b)

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

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

def sousa(A,B,k):
    if k%2==0:
        return [A//2,B+A//2,k+1]
    else:
        return [A+B//2,B//2,k+1]
    
while 1:
    x=sousa(A,B,k)
    A,B,k=x[0],x[1],x[2]
    if k==K:
        break
    
print(A,B)

Solution (Python):



 
import sys
import math



 

fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile


mod=1000000007
 

def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 

a,b,k= map(int, sys.stdin.readline().split(' '))

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

print(a,b)

    
    

if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

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

counter = 0
for i in range(k):
    if a % 2 == 1:
        a -= 1
    b += int(a/2)
    a = int(a/2)
    counter += 1
    if counter >= k:
        print("{} {}".format(a, b))
        exit()

    if b % 2 == 1:
        b -= 1
    a += int(b/2)
    b = int(b/2)
    counter += 1
    if counter >= k:
        print("{} {}".format(a, b))
        exit()

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

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

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

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

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

    if count >= K:
        break

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

    count += 1

print(A, B)

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

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

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

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

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

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=B+A

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

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

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

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

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
        
ans = [str(A), str(B)]

print(' '.join(ans))

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

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

Solution (Python):
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

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

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

for i in range(k):

    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        
        tmp_a = int(a / 2)

        a = tmp_a
        b = b + tmp_a

    else:
        if b % 2 == 1:
            b -= 1
        
        tmp_b = int(b / 2)

        b = tmp_b
        a = a + tmp_b

print(a, b)

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

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

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

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

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

s=0

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

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

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

cnt = 0
while True:
    turn = cnt % 2
    if m[turn] % 2 == 1:
        m[turn] -= 1
    m[turn] //= 2
    m[(turn + 1) % 2] += m[turn]
    cnt += 1
    if cnt == k:
        break

print(*m)

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

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

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

if (K % 2 == 1):
    B += A//2
    A = A // 2

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

n=0
while n < k:
    if n%2==0:
        if a%2==0:
            halfA = a/2
            a=halfA
            b+=halfA
        else:
            halfA = (a-1)/2
            a=halfA
            b+=halfA
    else:
        if b % 2 == 0:
            halfB = b/2
            b = halfB
            a += halfB
        else:
            halfB = (b-1)/2
            b = halfB
            a+= halfB
    n+=1

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

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

Solution (Python):

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

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

    if k==0:
        break

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

print(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=list(map(int,input().split()))
c=[A,B]
for i in range(K):
    if c[i%2]%2==1:
        c[i%2]-=1
    c[i%2]//=2
    c[(i+1)%2]+=c[i%2]
print('{0[0]} {0[1]}'.format(c))

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

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

print(A,B)

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

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

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

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

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

Solution (Python):
a, b, k = tuple(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 = [int(v) for v in 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 = input().split()
a = [int(i) for i in a]
now = 0

for i in range(a[2]):
	if a[now] %2 == 0:
		a[1 - now] += a[now] // 2
		a[now] = a[now] // 2
	else:
		a[now] -= 1
		a[1-now] += a[now] //2
		a[now] //= 2
	if now == 0:
		now = 1
	else:
		now = 0
		
print (a[0], a[1])

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

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

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

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

Solution (Python):

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

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

print(A, B)

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

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

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

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

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

Solution (Python):
cucky = [0, 0]
cucky[0], cucky[1], k = map(int, input().split())

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

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

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

Solution (Python):

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

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

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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