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 count in range(k):
    if count % 2 == 0:
        if a % 2 == 0:
            pass
        else:
            a -= 1
        half = a / 2
        a -= half
        b += half
    else:
        if b % 2 == 0:
            pass
        else:
            b -= 1
        half = b / 2
        b -= half
        a += half
print(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:
        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(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
        b += a / 2
        a = a / 2
    else:
        if b % 2 == 1:
            b -= 1
        a += b / 2
        b = b / 2
print("{} {}".format(int(a), int(b)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

A, B, K = [int(i) for i in stdin.readline().rstrip().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())
flag=True
for i in range(k):
    if(flag and a%2==1):
        a-=1
        b+=(a//2)
        a//=2
        flag=not flag
        continue
    elif(flag):
        flag=not flag
        b+=(a//2)
        a-=(a//2)
        continue
    if(not flag and b%2==1):
        b-=1
        a+=(b//2)
        b//=2
        flag=not flag
        continue
    elif(not flag):
        a+=(b//2)
        b-=(b//2)
        flag=not flag
print(a,b)

Submission status: Accepted

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

b = a[0]
c = a[1]

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

print(b,c)

Submission status: Accepted

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

c=int(k/2)

f=0
if k%2!=0:
    f=1

for i in range(c):
    if a%2!=0:
        a=a-1
    tempa=int(a/2)
    a=tempa
    b+=tempa

    if b%2!=0:
        b=b-1
    tempb=int(b/2)
    b=tempb
    a+=tempb

if f:
        if a%2!=0:
            a=a-1
        tempa=int(a/2)
        a=tempa
        b+=tempa

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:
            B += A // 2
            A = A // 2
    else:
        if B%2 == 1:
            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 = [int(i) for i in input().split()]

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

print(a, b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

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

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
a,b,k= map(int, sys.stdin.readline().split(' '))

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

print(a,b)

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

Submission status: Accepted

Solution code:
A,B,K = [int(x) for x in input().strip('\n').split(' ')]
for i in range(K):
    if i%2==0:
        if A%2==1:
            A = A-1
        B += A/2
        A = A/2
    if i%2==1:
        if B%2==1:
            B = B-1
        A += B/2
        B = B/2
print(int(A),int(B))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

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

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

    if count >= K:
        break

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

    count += 1

print(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(1, K+1):
    #Takahashi
    if i % 2:
        if A % 2:
            A -= 1
        A, B = A/2, B+A/2
    else:
        if B % 2:
            B -= 1
        A, B = A+B/2, B/2

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,k = map(int, input().split())

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

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

Submission status: Accepted

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

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

for i in range(K):
    if i%2 == 0:
        if A%2 == 1:
            A = A-1
        A = A // 2
        B = B + A
    else:
        if B%2 == 1:
            B = B-1
        B = B // 2
        A = A + B
        
ans = [str(A), str(B)]

print(' '.join(ans))

Submission status: Accepted

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

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

print(A,B)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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
        
        tmp_a = int(a / 2)

        a = tmp_a
        b = b + tmp_a

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

        b = tmp_b
        a = a + tmp_b

print(a, b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s=0

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

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

Submission status: Accepted

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

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

print(*m)

Submission status: Accepted

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

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

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

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

print(A, B)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    if k==0:
        break

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

print(a,b)

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)

Submission status: Accepted

Solution code:
A,B,K=list(map(int,input().split()))
c=[A,B]
for i in range(K):
    if c[i%2]%2==1:
        c[i%2]-=1
    c[i%2]//=2
    c[(i+1)%2]+=c[i%2]
print('{0[0]} {0[1]}'.format(c))

Submission status: Accepted

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

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a, b)

Submission status: Accepted

Solution code:
a = input().split()
a = [int(i) for i in a]
now = 0

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

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

print(A, B)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A, B)

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

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

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

sys.setrecursionlimit(1000000)

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

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

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

print A, B

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)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(K):
  
  i % 2 == 0:
    B = B + A/2
    A = A/2
   else:
    A = A + B/2
    B=B/2
print ('{} {}'.format(A,B))

Submission status: Runtime Error

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

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

print (A,B)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b, k = [ int(v) for v in 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: Runtime Error

Solution code:
A=int(input())
B=int(input())
K=int(input())
count = 0
while count<K:
    if count%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
    count+=1
print(A,B)

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

void cookie(int *p1,int *p2){
	if(*p1 % 2)	--(*p1);
	*p1 /= 2;
	*p2 += *p1;
	return;
}

int main(int argc, char const *argv[])
{	
	int a,b,k;
	scanf("%d%d%d",&a,&b,&k);
	for (int i = 1; i <= k; ++i)
	{
		if(i % 2)	cookie(&a,&b);
		else cookie(&b,&a);
	}
	printf("%d %d\n",a,b);
}

Submission status: Runtime Error

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(A+" "+B)

Submission status: Runtime Error

Solution code:

A,B=input().split()
A=int(A)
B=int(B)
 
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(A+" "+B)

Submission status: Runtime Error

Solution code:
A,B=input()
A=input(A)
B=input(B)
 
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(A+" "+B)

Submission status: Runtime Error

Solution code:
 A,B=input()
 A=input(A)
 B=input(B)
 
 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(A+" "+B)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

for i = 0; i < K; i++:
	if i % 2 == 0:
		B += A /2
		A /= 2
	else:
		A += B / 2
		B /= 2
print(A + " " + B)

Submission status: Runtime Error

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

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

while K >= 1 && A >= 1 && B >= 1:
	if A % 2 == 0:
		B += A / 2
		A = A / 2
	else:
		A -= 1
		B += A / 2
		A = A / 2
	if B % 2 == 0:
		A += B / 2
		B = B /2
	else:
		B -= 1
		A += B / 2
		B = B /2		
	K -= 1
print(A + " " + B)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
data = input().split()

 A = int(data[0])
 B = int(data[1])
 K = int(data[2])

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

Submission status: Runtime Error

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

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

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

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

print("")

Submission status: Runtime Error

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

Submission status: Runtime Error

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(A, B)

Submission status: Runtime Error

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(A, B)

Submission status: Runtime Error

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

Submission status: Runtime Error

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