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:
        tmp_1, tmp_2 = A, B
    else:
        tmp_1, tmp_2 = B, A
    if tmp_1 % 2 == 1:
        tmp_1 -= 1
    half = int(tmp_1 / 2)
    tmp_2 += half
    tmp_1 = half
    if i % 2 == 0:
        A, B = tmp_1, tmp_2
    else:
        A, B = tmp_2, tmp_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
    b=b+a//2
    a=a//2
  else:
    if(b%2==1):
      b-=1
    a=a+b//2
    b=b//2

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

Submission status: Accepted

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

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

print(int(n_takahashi), int(n_aoki))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
A, B, K = map(int, input().split())
coo = np.array([A, B])
c = 0
for _ in range(K):
    if coo[0] % 2 == 0:
        pass
    else:
        coo[0] -= 1

    half = coo[0] / 2
    coo[1] += half
    coo[0] -= half
    coo = coo[::-1]

if K % 2 == 0:
    print(*coo)
else:
    print(*coo[::-1])

Submission status: Accepted

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

Submission status: Accepted

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

    if i == k:
        break
    i += 1
    if b % 2 != 0:
        b -= 1
    a += b / 2
    b //= 2
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 -= 1
    B += A/2
    A -= A/2
  if i % 2 == 0:
    if B % 2 == 1:
      B -= 1
    A += B/2
    B -= B/2
print(int(A),int(B))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

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

for i, j in enumerate(range(k)):
    if i % 2 == 0:
        if a % 2 == 1:
            a = a - 1
        b = b + a // 2
        a = a // 2
    elif i % 2 == 1:
        if b % 2 == 1:
            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())

count = 0
for i in range(K):
    if(count % 2 == 0):
        # Aが奇数個所持
        if(A % 2 == 1):
            # 1個減らす
            A -= 1
        B += int(A/2)
        A /= 2
    else:
        # Bが奇数個所持
        if(B % 2 == 1):
            # 1個減らす
            B -= 1
        A += int(B / 2)
        B /= 2
    count +=1

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

Submission status: Accepted

Solution code:
x = list(map(int,input().split()))
a = x[0]
b = x[1]
k = x[2]
while k > 0:
    if a % 2 != 0:
        a -= 1
    b = b + a//2
    a = a // 2
    k -= 1
    if k <= 0:
        break
    if b % 2 != 0:
        b -= 1
    a = a + b//2
    b = b // 2
    k -= 1
print(a,b)

Submission status: Accepted

Solution code:
A, B, K = [ int(x) for x in 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 = list(map(int, input().split()))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

def f(a):
    if a%2 != 0:
        a -= 1
    return a//2

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

Submission status: Accepted

Solution code:
a,b,k = map(int,input().split())
def c(x,y):
 if x%2 == 1:
  x = x-1
 x = int(x/2)
 y += x
 return x,y
 
for j in range(k):
 if j % 2 == 0:
  a,b = c(a,b)
 else:
  b,a = c(b,a)

print(a,b)

Submission status: Accepted

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


def ChgCookie(a, b) :
    if a%2 == 1:
        a = a-1

    (a, b) = (a//2, b+a//2)
    return (a, b)


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

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    a, b, k = [int(next_str()) for _ in range(3)]

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

    print(a, b)


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


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
        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 = (int(_) for _ in input().split())


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

Submission status: Accepted

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

takahashi = A
aoki = B

num = 1
while num <= K:
    if takahashi % 2 == 1:
        takahashi = takahashi - 1
    takahashi = int(takahashi / 2)
    aoki = aoki + takahashi
    num = num + 1
    if num > K:
        break
    if aoki % 2 == 1:
        aoki = aoki - 1
    aoki = int(aoki / 2)
    takahashi = takahashi + aoki
    num = num + 1

print(takahashi, aoki)

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

Submission status: Accepted

Solution code:
a, b, k = [int(_) for _ in input().split()]
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a = a - 1
            b += a // 2
            a = a // 2
        else:
            b += a // 2
            a = a // 2
    else:
        if b % 2 == 1:
            b = b - 1
            a += b // 2
            b = b // 2
        else:
            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
        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:
import math
t,a,k = map(int,input().split())

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

print(str(t)+" "+str(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def present(n):
  if n%2 == 0:
    return n/2
  else:
    return (n-1)/2

s = input()
a, b, k = s.split()
a = int(a)
b = int(b)
for i in range(int(k)):
  if i % 2 == 0:
    a = present(a)
    b = b + a
  else:
    b = present(b)
    a = a + b

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

Submission status: Accepted

Solution code:
#coding:utf-8
a,b,K = list(map(int,input().split()))
k = 0

def op(m,n):
    if m%2==1:
        m-=1
    n += m/2
    m =  m/2
    #print (m,n)
    return int(m),int(n)

while(1):
    if k == K:
        break
    k+=1
    a,b = op(a,b)
    if k == K:
        break
    k+=1
    b,a = op(b,a)
print (a,b)

Submission status: Accepted

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

takahashi = a
aoki = b

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

for i in range(0, k):
  if i % 2 == 0:
    takahashi, aoki = turn(takahashi, aoki)
  else:
    aoki, takahashi = turn(aoki, takahashi)

print(str(takahashi) + " " + str(aoki) )

Submission status: Accepted

Solution code:
def main():
    a, b, k = [int(s) for s 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("%s %s" % (a,b))
main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(a, b)

Submission status: Accepted

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

for i in range(K):
    # A君は奇数なら食べる
    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=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,c=map(int,input().split(" "))
for i in range(c):
    if a%2==0:
        a,b=a//2,b+a//2
        a,b=b,a
    else:
        a,b=(a-1)//2,b+(a-1)//2
        a,b=b,a
if c%2==0:
    print("{}".format(a)+" "+"{}".format(b))
else:
    print("{}".format(b)+" "+"{}".format(a))

Submission status: Accepted

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

Submission status: Accepted

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

flg = True
for i in range(K):
    if flg:
        if A % 2 > 0:
            A -= 1
        B += A // 2
        A //= 2
        flg = False
    else:
        if B % 2 > 0:
            B -= 1
        A += B // 2
        B //= 2
        flg = True
print(A, B)

Submission status: Accepted

Solution code:
A,B,K=map(int, input().split())
jjj=0
def func(num):
    global A,B,jjj
    if num==0:
        if A%2==1:
            A-=1
        tmp=A//2
        A-=tmp
        B+=tmp
        jjj=1
    elif num==1:
        if B%2==1:
            B-=1
        tmp=B//2
        B-=tmp
        A+=tmp
        jjj=0
for i in range(K):
    func(jjj)
print(A,B)

Submission status: Accepted

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

cnt=0

while cnt<K:
	cnt+=1
	# A turn
	if cnt%2==1:
		if A%2==1:
			A-=1

		B+=A/2
		A=A/2
	else:
		# B turn
		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 = list(map(int, input().split(" ")))

    flag = True
    for _ in range(k):
        if flag:
            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

        flag = not flag

    print(a, b)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, k = list(map(int, input().split()))
while(True):
    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
    if k==0:break
print(int(a), int(b))

Submission status: Accepted

Solution code:

def main():
    a, b, k = map(int,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(str(a) +" "+str(b))





if __name__ == "__main__":
        main()

Submission status: Accepted

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

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

Submission status: Accepted

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

while k > 0:
    aa = int(a / 2)
    b += aa
    a = aa

    k -= 1
    if k <= 0:
        break

    bb = int(b / 2)
    a += bb
    b = bb

    k -= 1

print(a, b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#coding: utf-8
A,B,K = map(int, input().split() )

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    A, B, K = list(map(int, input().split()))
    which = "A"
    for _ in range(K):
        if which == "A":
            A = A // 2
            B = B + A
            which = "B"
        else:
            B = B // 2
            A = A + B
            which = "A"
    print(str(A) + " " + str(B))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B, K = map(int, raw_input().replace("\n", "").split(" "))

def calc_ageru(jibun):
    if jibun % 2 == 1:
        ageru = (jibun-1) / 2
    else:
        ageru = jibun / 2
    return ageru, ageru

for i in xrange(K):
    if i % 2 == 0:
        A, ageru = calc_ageru(A)
        B += ageru
    else:
        B, ageru = calc_ageru(B)
        A += ageru
    #print "%i: %d %d" % (i, A, B)

print "%d %d" % (A, B)

Submission status: Accepted

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

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

Submission status: Accepted

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

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 -= 1
        a /= 2
        b += a

    elif i % 2 == 0:
        if b % 2 == 1:
            b -= 1
        b /= 2
        a += b
print(int(a), int(b))

Submission status: Accepted

Solution code:

def main():
    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(int(a),int(b))
    pass

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,k = list(map(int, input().split()))
c = k%2
while k > 0:
    if k%2 == c:
        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
    k -= 1
print(a,b)

Submission status: Accepted

Solution code:
A,B,K=list(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("%d %d"%(A,B))

Submission status: Accepted

Solution code:
def tpbc_2018_b():
    a, b, k = map(int, input().split())
    for i in range(k//2):
        a //= 2
        b += a
        b //= 2
        a += b
    if k % 2 == 1:
        a //= 2
        b += a
    return "{} {}".format(a, b)


print(tpbc_2018_b())

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

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 == 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())

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

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

Submission status: Accepted

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

def takahashi(l):
    if l[0] % 2 == 0:
        return [l[0]//2,l[1]+l[0]//2]
    else:
        return [(l[0]-1)//2,l[1]+(l[0]-1)//2]

def aoki(l):
    if l[1] % 2 == 0:
        return [l[0]+l[1]//2,l[1]//2]
    else:
        return [l[0]+(l[1]-1)//2,(l[1]-1)//2]

ary = [a,b]
for i in range(c):
    if i % 2 == 0:
        ary = takahashi(ary)
    else:
        ary = aoki(ary)
    # print("now:",i,"->",ary)
print(ary[0],ary[1])

Submission status: Accepted

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

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

Submission status: Accepted

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

def sosa(a,b,i):
    if i % 2 == 1:
        if a % 2 == 0:
            return([a // 2, b + a//2])
        else:
            return([(a-1) // 2, b + (a-1) // 2])
    else:
        if b % 2 == 0:
            return([a + b // 2, b //2])
        else:
            return([a+(b-1) //2,(b-1)//2])

for i in range(1,K+1):
    newA, newB = sosa(A,B,i)
    A, B = newA, newB

print('%d %d' % (A, B))

Submission status: Accepted

Solution code:
def main():
    a, b, k = [int(s) for s in input().split()]

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

    print(a, b)

def play(a, b):
    return (a // 2, b + a // 2)

main()

Submission status: Accepted

Solution code:
iA,iB,iK = [int(_) for _ in input().split()]




for i in range(iK):
    if i % 2 == 0 :
        if iA % 2 == 1:
            iA = (iA - 1) //2
            iB += iA
        else:
            iA = iA // 2
            iB += iA
    else:
        if iB % 2 == 1:
            iB = (iB - 1) //2
            iA += iB
        else:
            iB = iB // 2
            iA += iB
print(iA,iB)

Submission status: Accepted

Solution code:
def main():
    A, B, K = list(map(int, input().split()))
    for i in range(K):
        if i % 2 == 0:
            if A % 2 != 0:
                A = A - 1
            A = A / 2
            B = B + A
        else:
            if B % 2 != 0:
                B = B - 1
            B = B / 2
            A = A + B
    print(int(A), int(B))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin

def main():
    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)

input = lambda: stdin.readline()
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 //= 2
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B //= 2
print(A, B)

Submission status: Accepted

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

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

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

print(a, b)

Submission status: Accepted

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

cnt = 0
turnA = True

while cnt < K:
    if turnA:
        if A%2:
            A -= 1
        B += A//2
        A = A//2
        turnA = False
    else: 
        if B%2:
            B -= 1
        A += B//2
        B = B //2
        turnA = True
    cnt+=1

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:
        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())
a = A
b = B
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,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

Submission status: Accepted

Solution code:
A, B, K = map(int, input().split())
C = [A, B]
eat, given = 0, 1
for i in range(K):
    if C[eat]%2 == 1:
        C[eat] -= 1
    C[given] += C[eat]//2
    C[eat] = C[eat] // 2
    eat, given = given, eat
print(C[0], C[1])

Submission status: Accepted

Solution code:
def getN():
    return int(input())


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


def getList():
    return list(map(int, input().split()))

a,b,k = getNM()

turn = "taka"
for i in range(k):

    if turn == "taka":
        if a %2 == 1:
            a -= 1
        a = a//2
        b += a

        turn = "ao"

    else:
        if b % 2 == 1:
            b -= 1
        b = b//2
        a += b
        turn= "taka"


print(a,b)

Submission status: Accepted

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