Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
#y = sorted(set(x))

def getMedian(a):
    #a = sorted(set(a))
    a = sorted(a)
    return a[(len(a)+1)//2-1]
    # if len(a) % 2 == 0:
    #     return a[(len(a))//2-1]
    # else:
    #     return a[(len(a)+1)//2-1]

for i in range(n):
    temp = list(x)
    del temp[i]
#    print(temp)
    print(getMedian(temp))

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
xx = sorted(x, reverse=True)

m1 = xx[n//2-1]
m2 = xx[n//2]

# print(m1, m2)

for i in range(len(x)):
    if x[i] < m1:
        print(m1)
    elif x[i] >= m1:
        print(m2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
y = sorted(set(x))
ms = y[len(y)//2-1]
mc = y[len(y)//2]
ml = y[len(y)//2+1]

#print(ms, mc, ml)

for i in range(n):
    if x[i] == mc:
        print(ml)
    if x[i] < mc:
        print(ml)
    elif x[i] > mc:
        print(mc)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
xx = sorted(x, reverse=True)

m1 = xx[n//2-1]
m2 = xx[n//2]

# print(m1, m2)

for i in range(len(x)):
    if x[i] < m1:
        print(m1)
    elif x[i] >= m1:
        print(m2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
cnt = 1
prev = a[0]
#print(a)

for i in range(1, n):
    # print('\n# i: ' + str(i))
    # print('# a[i]: ' + str(a[i]))
    if a[i] == prev:
#        print('same!')
        cnt += 1
    else:
        if cnt == prev:
#            print('good, skip!')
        elif cnt > prev:
#            print('cnt is larger!')
            ans += cnt - prev
        else:
#            print('cnt is smaller!')
            ans += cnt
#        print('ans: ' + str(ans))
        prev = a[i]
        cnt = 1

if cnt > prev:
    ans += cnt - prev
elif cnt < prev:
    ans += cnt

print(ans)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
cnt = 1
prev = a[0]
#print(a)

for i in range(1, n):
    # print('\n# i: ' + str(i))
    # print('# a[i]: ' + str(a[i]))
    if a[i] == prev:
#        print('same!')
        cnt += 1
    else:
        if cnt > prev:
#            print('cnt is larger!')
            ans += cnt - prev
        elif cnt < prev:
#            print('cnt is smaller!')
            ans += cnt
#        print('ans: ' + str(ans))
        prev = a[i]
        cnt = 1

if cnt > prev:
    ans += cnt - prev
elif cnt < prev:
    ans += cnt

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
temp = []

for i in range(n):
    # print(i, p[i])
    if p[i] == i+1:
        temp.append('y')
        continue

    # if p[i] == i+1:
    #     if p[i-1] == i:
    #         del temp[-1]
    #         temp.append('x')
    #     else:
    #         temp.append('y')
    #     continue

    temp.append(p[i])

idx = 1
while True:
    if idx > len(temp) - 1:
        break

    if temp[idx] == 'y' and temp[idx-1] == 'y':
        temp[idx-1] = 'x'
        del temp[idx]
        # del temp[idx-1]
        # temp.append('x')

    idx += 1


#print(temp)
ans = temp.count('x') + temp.count('y')
print(ans)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
temp = []

for i in range(n):
    # print(i, p[i])
    if p[i] == i+1:
        temp.append('y')
        continue

    temp.append(p[i])

a = []

idx = 1
while True:
    if idx > len(temp) - 1:
        break

    if temp[idx] == 'y' and temp[idx-1] == 'y':
        temp[idx-1] = 'x'
        temp[idx] = 'x'
        #del temp[idx]
        # del temp[idx-1]
        # temp.append('x')

    idx += 1


#print(a)
ans = temp.count('x')//2 + temp.count('y')
print(ans)


'''
9
1 2 4 9 5 8 7 3 6
'''
Buggy python submission (verdict: Runtime Error):
from collections import deque

n = int(input())
s = input()
lCnt = 0
rCnt = 0
stack = deque()
stack.append(s[0])

for i in range(1, len(s)):
    prev = stack.pop()

    if prev == '(' and s[i] == ')':
        continue
    else:
        stack.append(prev)
        stack.append(s[i])

#print(stack)

for i in range(len(stack)):
    if stack[i] == '(':
        lCnt += 1
    else:
        rCnt += 1

s += ')' * lCnt
s = '(' * rCnt + s

print(s)


Fixed submission:
from collections import deque

n = int(input())
s = input()
lCnt = 0
rCnt = 0
stack = deque()
stack.append(s[0])

for i in range(1, len(s)):
#for i in range(0, len(s)):
    if len(stack) == 0:
        stack.append(s[i])
        continue

    prev = stack.pop()

    if prev == '(' and s[i] == ')':
        continue
    else:
        stack.append(prev)
        stack.append(s[i])

#print(stack)

for i in range(len(stack)):
    if stack[i] == '(':
        lCnt += 1
    else:
        rCnt += 1

s += ')' * lCnt
s = '(' * rCnt + s

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

for i in range(1, n):
    while a[i-1] + a[i] > x:
        a[i] -= 1
        ans += 1

print(ans)




Fixed submission:
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

if a[0] > x:
    ans += a[0] - x
    a[0] = x

# print(a, ans)

for i in range(1, n):
    total = a[i-1] + a[i]
    if total > x:
        # print('yay,', total-x)
        a[i] -= total - x
        ans += total - x

    # while a[i-1] + a[i] > x:
    #     a[i] -= 1
    #     ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    
from sys import stdin
imput = stdin.readline
n,m = map(int, input().split())  # 3個の数字の入力を受け取る
uf = UnionFind(n)
#print(uf.parents)

num_list = []
for i in range(m):
    num_list.append(list(map(int,input().split())))
#print(num_list)
for i in range(m):
    uf.union(num_list[i][0], num_list[i][1])
print(uf.group_count()-1)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

    
from sys import stdin
imput = stdin.readline
n,m = map(int, input().split())  # 3個の数字の入力を受け取る
uf = UnionFind(n)
#print(uf.parents)

num_list = []
for i in range(m):
    num_list.append(list(map(int,input().split())))
#print(num_list)
for i in range(m):
    #print(num_list[i][0])
    #print(num_list[i][1])
    uf.union(num_list[i][0]-1, num_list[i][1]-1)
    #print(uf.parents)
print(uf.group_count()-1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

previous_score = 1

for i in range(k):
    previous_score *= a[i] 

for j in range(k, n):
    score = previous_score * a[j] / a[j-k]

    if previous_score < score:
        print('Yes')
    else:
        print('No')

    previous_score = score

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

previous_average_a = sum(a[0:k])/k

for i in range(k+1, n+1):
    average_a = sum(a[i-k:i])/k
    if previous_average_a < average_a:
        print('Yes')
    else:
        print('No')
    previous_average_a = average_a

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(n):
    ans *= a[i]
    if ans = 0:
        print(0)
        exit()
    elif ans > 10**18:
        print(-1)
        exit()

print(ans)

Fixed submission:
a, b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(n):
    ans *= a[i]
    if ans = 0:
        print(0)
        exit()
    elif ans > 10**18:
        print(-1)
        exit()

print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

ans = 1

if 0 in a:
    print(0)
    exit()

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

multi = functools.partial(functools.reduce, operator.mul)

n = int(input())
a = list(map(int, input().split()))

ans = multi(a)

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

ans = 1

if 0 in a:
    print(0)
    exit()

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in range(n):
    ans *= a[i]

if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

ans = 1

if 0 in a:
    print(0)
    exit()

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A_list = list(map(int, input().split()))
for i in range(1, n+1):
    print(A_list.count(i))

Fixed submission:
import collections
n = int(input())
A_list = list(map(int, input().split()))
A_cont = collections.Counter(A_list)
for i in range(1, n+1):
    print(A_cont[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A_list = list(map(int, input().split(" ")))
for i in range(1, n+1):
    print(A_list.count(i))

Fixed submission:
import collections
n = int(input())
A_list = list(map(int, input().split()))
A_cont = collections.Counter(A_list)
for i in range(1, n+1):
    print(A_cont[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
sum_ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            gcd_abc = gcd(a, b, c)
            sum_ans += gcd_abc
print(sum_ans)

Fixed submission:
import math

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(gcd_ab, c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
sum_ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = gcd(a, b)
        for c in range(1, k+1):
            gcd_abc = gcd(gcd_ab, c)
            sum_ans += gcd_abc
print(sum_ans)

Fixed submission:
import math

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(gcd_ab, c)
print(ans)

Buggy python submission (verdict: Runtime Error):
k = int(input())
sum_ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = gcd(a, b)
        for c in range(1, k+1):
            gcd_abc = gcd(gcd_ab, c)
            sum_ans += gcd_abc
print(sum_ans)

Fixed submission:
import math

k = int(input())
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcd_ab = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(gcd_ab, c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(2, n):
    for i in range(1, j):
        k = 2*j - i
        if k<n+1 and s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and s[j-1]!=s[k-1]:
            ans -= 1
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(1, n-1):
    for i in range(j):
        k = 2*j - i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for i in range(1, n+1):
    for j in range(i+1, n+1):
        k = 2*j - i
        if k<n+1 and s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and s[j-1]!=s[k-1]:
            ans -= 1
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(1, n-1):
    for i in range(j):
        k = 2*j - i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for i in range(1, n+1):
    for j in range(i+1, n+1):
        k = 2*j - i
        if k<n+1 and s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and s[j-1]!=s[k-1]:
            ans -= 1
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(1, n-1):
    for i in range(j):
        k = 2*j - i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for k in range(3, n+1):
    for j in range(2, k):
        if s[j-1]==s[k-1]:
            continue
        for i in range(1, j):
            if s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and j-i!=k-j:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(1, n-1):
    for i in range(j):
        k = 2*j - i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for k in range(1, n+1):
    for j in range(1, k):
        for i in range(1, j):
            if s[i-1]!=s[j-1] and s[i-1]!=s[k-1] and s[j-1]!=s[k-1] and j-i!=k-j:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")

for j in range(1, n-1):
    for i in range(j):
        k = 2*j - i
        if k<n and s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
            ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n>=64:
    print(64)
elif 32<=n<64:
    print(32)
elif 16<=n<32:
    print(16)
elif 8<=n<16:
    print(8)
elif 4<=n<8:

Fixed submission:
n = int(input())

if n>=64:
    print(64)
elif 32<=n<64:
    print(32)
elif 16<=n<32:
    print(16)
elif 8<=n<16:
    print(8)
elif 4<=n<8:
    print(4)
elif 2<=n<4:
    print(2)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1

print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        if x + y <= s and s - x - y <= k:
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
 
ans = 0
for i in range(0,N):
  
  for j in range(0,i):
    
    ans = (ans + (A[i] * A[j])%(10**9+7))%(10**9+7)
 
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
 
ans = 0
sum = 0
for i in range(1,N):
  
  sum = sum + A[i-1]
  ans = (ans + sum*A[i])%(10**9+7)
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(0,N):
  
  for j in range(0,i):
    
    ans = ans + (A[i] * A[j])%(10**9+7)

print(ans%(10**9+7))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
 
ans = 0
sum = 0
for i in range(1,N):
  
  sum = sum + A[i-1]
  ans = (ans + sum*A[i])%(10**9+7)
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(0,N):
  
  for j in range(0,i):
    
    ans = ans + A[i] * A[j]
    ans = ans%(10**9+7)

print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
 
ans = 0
sum = 0
for i in range(1,N):
  
  sum = sum + A[i-1]
  ans = (ans + sum*A[i])%(10**9+7)
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(0,N):
  
  for j in range(0,i):
    
    ans = ans + A[i] * A[j]

print(ans%(10**9+7))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
 
ans = 0
sum = 0
for i in range(1,N):
  
  sum = sum + A[i-1]
  ans = (ans + sum*A[i])%(10**9+7)
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int, input().split())

for i in range(0,K):
  if abs(X-D) > abs(X+D):
    X = X+D
  else:
    X = X-D
    
print(abs(X))

Fixed submission:
X,K,D = map(int, input().split())

if abs(X) > K*D:
    X = abs(X) - K*D
else:
    # とりあえず同方向に移動できるところまでいく
    # 移動回数
    T = abs(X)//D
    # 移動先の座標
    Y = abs(X)%D
    
    # 残りは往復の2択
    X = abs(Y - ((K-T)%2)*D)   
    
print(X)
Buggy python submission (verdict: Runtime Error):
#-*- coding: utf-8 -*-
a,b,n = map(int,input().split())
if n>=b:
    n = b - 1
    print(int(a*n/b)-(a*n/b))
    exit():
else:
    print(int(a*n/b))
    exit():

Fixed submission:
#-*- coding: utf-8 -*-
import math
a,b,n = map(int,input().split())
x = min(b-1,n)
ans = math.floor(a*x//b)-a*math.floor(x/b)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#-*- coding: utf-8 -*-
import math
a,b,n = map(int,input().split())
ma = 0
for i in range(1,n+1):
    ans = math.floor(a*i/b) - (a * math.floor(i/b))
    ma = max(ma,ans)

print(ma)


Fixed submission:
#-*- coding: utf-8 -*-
import math
a,b,n = map(int,input().split())
x = min(b-1,n)
ans = math.floor(a*x//b)-a*math.floor(x/b)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import os
# import math
# input = sys.stdin.readline

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


def str_array():
    return input().strip().split()

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

def take_input():
	if os.environ.get("check"):
		sys.stdin = open('input.txt', 'r') 
		sys.stdout = open('output.txt', 'w')
		
take_input()
######################### TEMPLATE ENDS HERE #################################

a,b,c = int_array()
k = int(input())

# conditions
#c>b>a

var = False

if a>=b:
    no1 = ((a-b)//2)+1
    if b % 2 ==0:
        b =a+2
    else:
        b = a+1

if b>=c:
    no2 = ((b-c)//2)+1

if no1+no2>=k:
    print("Yes")
else:
    print("No")


Fixed submission:
import sys
import os
# import math
# input = sys.stdin.readline

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


def str_array():
    return input().strip().split()

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

def take_input():
	if os.environ.get("check"):
		sys.stdin = open('input.txt', 'r') 
		sys.stdout = open('output.txt', 'w')
		
take_input()
######################### TEMPLATE ENDS HERE #################################

a,b,c = int_array()
k = int(input())

# conditions
#c>b>a

count = 0

for _ in range(k):
    if a>=b:
        b*=2
    elif b>=c:
        c*=2
    if a<b<c:
        break

if a<b<c:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import sys
import os
# import math
# input = sys.stdin.readline

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


def str_array():
    return input().strip().split()

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

def take_input():
	if os.environ.get("check"):
		sys.stdin = open('input.txt', 'r') 
		sys.stdout = open('output.txt', 'w')
		
take_input()
######################### TEMPLATE ENDS HERE #################################

a,b,c = int_array()
k = int(input())

# conditions
#c>b>a

var = False

if a>=b:
    no1 = ((a-b)//2)+1
    if b % 2 ==0:
        b =a+2
    else:
        b = a+1

if b>=c:
    no2 = ((b-c)//2)+1

if no1+no2>=k:
    print("Yes")
else:
    print("No")


Fixed submission:
import sys
import os
# import math
# input = sys.stdin.readline

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


def str_array():
    return input().strip().split()

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

def take_input():
	if os.environ.get("check"):
		sys.stdin = open('input.txt', 'r') 
		sys.stdout = open('output.txt', 'w')
		
take_input()
######################### TEMPLATE ENDS HERE #################################

a,b,c = int_array()
k = int(input())

# conditions
#c>b>a

count = 0

for _ in range(k):
    if a>=b:
        b*=2
    elif b>=c:
        c*=2
    if a<b<c:
        break

if a<b<c:
    print("Yes")
else:
    print("No")