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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int,input().split())
for i in range(K):
  if K % 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))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


print(a,b)

Submission status: Wrong Answer

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

print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, k = map(int, input().split(' '))
for i in range(0, 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(f'{max(0,a)} {max(0,b)}')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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


    print(A," ",B)
            


        

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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
        K -= 1


    print(A," ",B)
            


        

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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


for i in range(K):
    if i % 2 == 0:  # Tの操作
        if A % 2 == 1:
            A -= 1

        B += A // 2
        A = A // 2
    else:   # Aの操作
        if B % 2 == 1:
            B -= 1

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

    print(A, B)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = map(int, input().split())
while K:
  if K % 2 == 1:
    if A % 2 == 0:
      A = A // 2
      B += A // 2
    else:
      A = (A - 1) // 2
      B += (A - 1) // 2
  else:
    if B % 2 == 0:
      A += B // 2
      B = B // 2
    else:
      A += (B - 1) // 2
      B = (B - 1) // 2
  K -= 1
print(A, B, sep=' ')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(a)
print(b)

Submission status: Wrong Answer

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

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

print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,k=map(int,input().split())
p=[a,b]
i=0
while True:
  for g in range(2):
    t=g^1
    if p[g]%2==1:
      p[g]-=1
    p[t]+=p[g]//2
    p[g]//=2
    i+=1
    if i==k:
      print(p)
      exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, K = [int(s) for s in input().split(' ')]
print(A, B, K)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# tenka1-2018-beginnerB - Exchange
def main():
    A, B, K = tuple(map(int, input().split()))
    for i in range(K):
        if i & 1:
            if A & 1:
                A -= 1
            A //= 2
            B += A
        else:
            if B & 1:
                B -= 1
            B //= 2
            A += B
    print(A, B)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


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


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



print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(A, B)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    if k == 0:
        break

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(K):
    if A % 2 == 1:
        A -= 1

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

print(A, B)

Submission status: Wrong Answer

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

print(int(s[0]),int(s[1]))

Submission status: Wrong Answer

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

flg = 0     #
     

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def abk(x,y):
  if x%2==1:
    x = x-1
  y = y + x/2
  x = x/2
  return (x,y)

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

Submission status: Wrong Answer

Solution code:
s = input().split()
a_have = int(s[0])
b_have = int(s[1])
for  i in range(int(s[2])):
    if i % 2 == 0:
        if a_have % 2 != 0:
            a_have-=1
        b_have+= a_have/2
        a_have = a_have/2
    else :
        if b_have % 2 != 0:
            b_have-=1
        a_have+= b_have/2
        b_have = b_have/2
print(a_have,b_have)

Submission status: Wrong Answer

Solution code:
A,B,K=map(int,input().split())
count=1
while count!=K:
         if  A%2!=0:
                 A-=1
         A,B=A/2,A/2+B
         count+=1
         A,B=B,A
if count%2==0:
           print(int(A),int(B))
else:
            print(int(B),int(A))

Submission status: Wrong Answer

Solution code:
 
 


A,B,K=input().split()
A=int(A)
B=int(B)
K=int(K)
turn=0
while(1):
	if(turn==K):
		break
	if(turn%2==0):#高橋くん
		if(A%2==1):
			A-=1
	else:#青木くん
		if(B%2==1):
			B-=1
	turn+=1
print(str(A)+" "+str(B))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
Anm,Bnm,Cou = map(int,input().split(" "))
for i in range(Cou):
    if (Anm) % 2 == 1:
        Anm -= 1
    Anm = Anm /2
    Bnm += Anm    
    if (Bnm) % 2 == 1:
        Bnm -= 1
    Bnm = Bnm / 2
    Anm += Bnm
print(round(Anm),round(Bnm))

Submission status: Wrong Answer

Solution code:
import sys

def solve(A,B,K):
    ab = [A,B]
    for i in range(K):
        if ab[0]%2!=0:
            ab[0]-=1
        ab[1]+=ab[0]//2
        ab[0]-=ab[0]//2
        ab.reverse()
    if K%2!=0:
        print(ab[1],ab[0])
        return
    print(ab[0],ab[1])


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    A = int(ws[0])
    B = int(ws[1])
    C = int(ws[2])
    return (A, B, C)

def main():
    solve(*readQuestion())
    

# Uncomment before submission
# main()

Submission status: Wrong Answer

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

cnt = 0

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

    if B % 2 !=0:
        B -= 1
    B = B/2
    A += B
    cnt += 1

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

Submission status: Wrong Answer

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

cnt = 0

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

    if B % 2 !=0:
        B -= 1
    B = B/2
    A += B
    cnt += 1

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

Submission status: Wrong Answer

Solution code:
import sys

def solve(A,B,K):
    ab = [A,B]
    for i in range(K):
        if ab[0]%2!=0:
            ab[0]-=1
        ab[1]+=ab[0]//2
        ab[0]-=ab[0]//2
        ab.reverse()
    if K%2!=0:
        return  ab[1],ab[0]
    return ab[0],ab[1]


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    A = int(ws[0])
    B = int(ws[1])
    C = int(ws[2])
    return (A, B, C)

def main():
    print(solve(*readQuestion()))

# Uncomment before submission
# main()

Submission status: Wrong Answer

Solution code:
a,b,k = (int(x) for x in input().split())

cnt = 0

while cnt < k:
    if a % 2 !=0:
        a -= 1
    a = a/2
    b += a
    cnt += 1

    if b % 2 !=0:
        b -= 1
    b = b/2
    a += b
    cnt += 1

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

Submission status: Wrong Answer

Solution code:
Anm,Bnm,Cou = map(int,input().split(" "))
for i in range(Cou):
    if (Anm) % 2 == 1:
        Anm -= 1
    Anm = Anm /2
    Bnm += Anm    
    if (Bnm) % 2 == 1:
        Bnm -= 1
    Bnm = Bnm / 2
    Anm += Bnm
print(str(Anm)+" "+str(Bnm))

Submission status: Wrong Answer

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

stop = 0

for i in range(k):
    if i % 2 == 0:
        a /= 2
        b += a
        if b == a * 2:
            stop = i + 1
            break
    if i % 2 == 1:
        b /= 2
        a += b
        if a == b * 2:
            print i
            stop = i + 1

if stop == 0 or (k - stop) % 2 == 0:
    print a, b
else:
    print b, a

Submission status: Wrong Answer

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

stop = 0

for i in range(k):
    if i % 2 == 0:
        a /= 2
        b += a
        if b == a * 2:
            stop = i + 1
            break
    if i % 2 == 1:
        b /= 2
        a += b
        if a == b * 2:
            print i
            stop = i + 1

if stop == 0 or (k - stop) % 2 == 0:
    print a, b
else:
    print b, a

Submission status: Wrong Answer

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

stop = 0

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

if stop == 0 or (k - stop) % 2 == 0:
    print a, b
else:
    print b, a

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(2):
    print(players[i], end="")

print("")

Submission status: Wrong Answer

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

print(A, B)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
for i in range(c):
  if c % 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: Wrong Answer

Solution code:
# -*- coding-UTF-8 -*-
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(A,B)

Submission status: Wrong Answer

Solution code:
#encoding utf-8

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

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



print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for k in range(K):

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

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

    if B % 2 != 0:

        if B > 1:
            
            B -= 1


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

print(A, B)

Submission status: Wrong Answer

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

for k in range(K):

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



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

    print(A, B)

    if B % 2 != 0:

        if B > 1:
            
            B -= 1


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

    print(A, B)

print(A, B)

Submission status: Wrong Answer

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

turn = True
for _ in range(k):
    if turn:
        if a % 2 is 1:
            a -= 1
            a = a/2
            b += a
            turn = False
        else:
            a = a/2
            b += a
            turn = False
    else:
        if b % 2 is 1:
            b -= 1
            b = b/2
            a += b
            turn = True
        else:
            b = b/2
            a += b
            turn = True
print(int(a),int(b))

Submission status: Wrong Answer

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

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

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