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



Sample input:
5 4 2


Sample output:
5 3

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    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:
            # print(a, b, k)
            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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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#, log2
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
#from decimal import *

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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("{} {}".format(A,B))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    A,B,K=MI()
    
    for i in range(K):
        if i%2==0:
            A=A//2
            B+=A
        else:
            B=B//2
            A+=B
            
    print(A,B)

main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    flag = 0
    for i in range(a[2]):
        count=0
        if flag == 0:
            if a[0] %2 ==1:
                a[0]-=1
            a[0]=a[0]//2
            a[1]+=a[0]
            flag=1
        else:
            if a[1] %2 ==1:
                a[1]-=1
            a[1]=a[1]//2
            a[0]+=a[1]
            flag=0
    print(str(a[0])+" "+str(a[1]))

Submission status: Accepted

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

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

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

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


print(a,b)

Submission status: Accepted

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

flg = 1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_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 i in range(K):
	B += A//2
	A //= 2

	A, B = B, A

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_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 i in range(K):
	if A%2 == 1:
		A -= 1
	B += A//2
	A //= 2

	A, B = B, A

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
A,B,K = IL()

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,k=map(int,input().split())
    for i in range(k):
        if i%2==0:
            a=a//2*2
            b+=a//2
            a=a//2
        else:
            b=b//2*2
            a+=b//2
            b=b//2           
    print(a,b)

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    print(a, b)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

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

    print(a, b)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import re
import queue

input = stdin.readline

MOD = 1000000007

def solve():
    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 ^= 1
        K -= 1

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


        

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
A,B,K = list(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(str(A)+' '+str(B))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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(f"{A} {B}")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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


    
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

print(a,b)