Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s, e = map(int,input().split())
mn = min(map(lambda x:x%2019,range(s,e+1)))
for i in range(s, e+1):
  ans = min(ans, mn*i)
print(ans)

Fixed submission:
s, e = map(int, input().split())
ans = 10 ** 9
b = min(s+2019, e)
for i in range(s, b + 1):
    for j in range(i+1, b+1):
        ans = min(ans, i*j%2019)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k, *v = map(int, open(0).read().split())

lrui = [0] + v + [0]
for i in range(n): lrui[i+1] += lrui[i]
rrui = [0] + v + [0]
for i in range(n, 0, -1): rrui[i] += rrui[i+1]

lminus = [[] for i in range(n+2)]
for i in range(n+1):
    lminus[i+1] = lminus[i].copy()
    if i<n and v[i]<=0: lminus[i+1].append(v[i])

rminus = [[] for i in range(n+2)]
for i in range(n, -1, -1):
    rminus[i] = rminus[i+1].copy()
    if i>=0 and v[i-1]<=0: rminus[i].append(v[i-1])

ans = 0
for i in range(min(n, k)+1):
    for j in range(n+1, n-k+i, -1):
        tmp = lrui[i] + rrui[j]
        st = sorted(lminus[i] or rminus[j])
        for l in range(min(k-(i+n-j+1), len(st))):
            tmp -= st[l]
            ans = max(ans, tmp)
print(ans)

Fixed submission:
n, k, *v = map(int, open(0).read().split())

ans = 0
for i in range(n+1):
    for j in range(n+1):
        if i+j>k: continue
        cand = sorted([v[I] for I in range(n) if I<i or n-j<=I])
        cnt = sum(cand)
        ans = max(ans, cnt)
        for l in range(min(k-i-j, len(cand))):
            cnt -= cand[l]
            ans = max(ans, cnt)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n, m = map(int, stdin.readline().split())
ans = set(range(1, n+1))
for i in range(m):
    l, r = map(int, stdin.readline().split())
    ans = list(filter(lambda x:l<=x<=r, ans))
print(len(ans))

Fixed submission:
from sys import stdin
n, m = map(int, stdin.readline().split())
mn = 1
mx = n

for i in range(m):
    l, r = map(int, stdin.readline().split())
    mn = max(mn, l)
    mx = min(mx, r)
print(max(0, mx-mn+1))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n, m = map(int, stdin.readline().split())
ans = set(range(1, n+1))
for i in range(m):
    l, r = map(int, stdin.readline().split())
    ans = ans & set(range(l, r+1))
print(len(ans))

Fixed submission:
from sys import stdin
n, m = map(int, stdin.readline().split())
mn = 1
mx = n

for i in range(m):
    l, r = map(int, stdin.readline().split())
    mn = max(mn, l)
    mx = min(mx, r)
print(max(0, mx-mn+1))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
lr = [range(l, r+1) for l, r in lr]

ans = set(range(1, n+1))
for i in range(m):
    ans = ans & set(lr[i])
print(len(ans))

Fixed submission:
from sys import stdin
n, m = map(int, stdin.readline().split())
mn = 1
mx = n

for i in range(m):
    l, r = map(int, stdin.readline().split())
    mn = max(mn, l)
    mx = min(mx, r)
print(max(0, mx-mn+1))
Buggy python submission (verdict: Runtime Error):
from heapq import heappop, heappush

n, m = map(int, input().split())
a = []
for i in map(int, input().split()): heappush(a, i)

ans = []
for b, c in sorted([list(map(int, input().split()))for i in range(m)], key=lambda x:-x[1]):
        if len(a)==0: break
        for i in range(b): ans.append(max(c,  heappop(a)))
while len(a): ans.append(heappop(a))
print(sum(ans))

Fixed submission:
from heapq import heappop, heappush

n, m = map(int, input().split())
a = []
for i in map(int, input().split()): heappush(a, i)

ans = []
for b, c in sorted([list(map(int, input().split()))for i in range(m)], key=lambda x:-x[1]):
        for i in range(b):
                if len(a)==0: break
                ans.append(max(c,  heappop(a)))
while len(a): ans.append(heappop(a))
print(sum(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n, m = map(int, input().split())
card = sorted(list(map(int, input().split())))

for i in range(m):
    b, c = map(int, stdin.readline().split())
    card = sorted(list(map(lambda x:max(x,c), card[:b])) + card[b:])
print(sum(card))

Fixed submission:
from heapq import heappop, heappush

n, m = map(int, input().split())
a = []
for i in map(int, input().split()): heappush(a, i)

ans = []
for b, c in sorted([list(map(int, input().split()))for i in range(m)], key=lambda x:-x[1]):
        for i in range(b):
                if len(a)==0: break
                ans.append(max(c,  heappop(a)))
while len(a): ans.append(heappop(a))
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = list(input())
s[k] = s[k].lower()
print("".join(s))

Fixed submission:
n, k = map(int, input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n, k, *a = map(int, open(0).read().split())
a.sort()
mn = 1e18
for i in range(n-k+1):
    tmp = 0
    for j in range(k-1): tmp+=abs(a[i+j]-a[i+j+1])
    mn = min(mn, tmp)
print(mn)

Fixed submission:
n, k, *a = map(int, open(0).read().split())
a.sort()
for i in range(n-1): a[n-i-1] = abs(a[n-i-1]-a[n-i-2])
a[0] = 0
for i in range(n-1): a[i+1] += a[i]

mn = 1e18
for i in range(n-k+1): mn = min(mn, a[i+k-1]-a[i])
print(mn)
Buggy python submission (verdict: Runtime Error):
n = int(input())

xyh = [list(map(int,input().split()))for i in range(n)]
while xyh[0][2]==0: xyh.pop(0)

for i in range(101):
    for j in range(101):
        base = xyh[0][2]+abs(xyh[0][0]-i)+abs(xyh[0][1]-j)
        for k in range(1, n):
            if xyh[k][2]==0: continue
            if base!=xyh[k][2]+abs(xyh[k][0]-i)+abs(xyh[k][1]-j): break
        else:
            print(i, j, base)
            exit()

Fixed submission:
n = int(input())

xyh = [list(map(int,input().split()))for i in range(n)]
i = 0
while i<n:
    if xyh[i][2]==0:
        xyh.pop(i)
        n -= 1
    else: i += 1

if(n==1):
    print(*xyh[0])
    exit()

for i in range(101):
    for j in range(101):
        base = xyh[0][2]+abs(xyh[0][0]-i)+abs(xyh[0][1]-j)
        for k in range(1, n):
            if base!=xyh[k][2]+abs(xyh[k][0]-i)+abs(xyh[k][1]-j): break
        else:
            print(i, j, base)
            exit()
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

fact = []
for i in range(1, int(m**0.5)):
    if m%i==0:
        fact.append(i)
        fact.append(m//i)
fact.sort()

for i in fact:
    if n*i<=m: ans = i
print(ans)

Fixed submission:
def prime_factor(a):
    ret = []
    for i in range(1, int(a**0.5)):
        if a%i==0:
            ret.append(i)
            ret.append(a//i)
    return ret

n, m = map(int, input().split())
ans = 1
for i in prime_factor(m):
    if i<=m/n: ans = max(ans, i)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

fact = []
for i in range(2, int(m**0.5)):
    if m%i==0:
        fact.append(i)
        fact.append(m//i)
fact.sort()

for i in fact:
    if n*i<=m: ans = i
print(ans)

Fixed submission:
def prime_factor(a):
    ret = []
    for i in range(1, int(a**0.5)):
        if a%i==0:
            ret.append(i)
            ret.append(a//i)
    return ret

n, m = map(int, input().split())
ans = 1
for i in prime_factor(m):
    if i<=m/n: ans = max(ans, i)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

st = set()
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        st.add(s[i:j])
print(sorted(list(st))[k-1])


Fixed submission:
s = input()
k = int(input())

st = set()
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if j-i<=k: st.add(s[i:j])
print(sorted(list(st))[k-1])
Buggy python submission (verdict: Runtime Error):
n, x, *m = map(int, open(0).read().split())
ans = -1
for i in sorted(m):
    if x>=i:
        x -= i                                                                                                                                                                                ans+=1
print(ans+x//min(m))

Fixed submission:
n, x, *m = map(int, open(0).read().split())
ans = 0
for i in sorted(m):
    if x>=i:
        x -= i
        ans+=1
mx = min(m)
print(ans + (x//mx))
Buggy python submission (verdict: Runtime Error):
import strutils;var n,a=stdin.readline.split;echo if a.contains("Y"):"Four"else:"Three"

Fixed submission:
n, *s = open(0).read().split()
if "Y" in s: print("Four")
else: print("Three")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())


l, r = 0, n

re = input(0)
if re=="Vacant": exit()

for i in range(19):
    mid = (l+r)//2
    tmp = input(mid)
    if tmp=="Vacant": exit()

    if re==tmp:
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid

Fixed submission:
n = int(input())


l, r = 0, n

print(0, flush=True)
re = input()
if re=="Vacant": exit()

for i in range(19):
    mid = (l+r)//2
    print(mid, flush=True)
    tmp = input()
    if tmp=="Vacant": exit()

    p = abs(l-mid)%2

    if (re!=tmp and p) or (re==tmp and p-1):
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())


l, r = 0, n

re = input(0)
if re=="Vacant": exit()

for i in range(10):
    mid = (l+r)//2
    tmp = input(mid)
    if tmp=="Vacant": exit()

    if re==tmp:
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid

Fixed submission:
n = int(input())


l, r = 0, n

print(0, flush=True)
re = input()
if re=="Vacant": exit()

for i in range(19):
    mid = (l+r)//2
    print(mid, flush=True)
    tmp = input()
    if tmp=="Vacant": exit()

    p = abs(l-mid)%2

    if (re!=tmp and p) or (re==tmp and p-1):
        l = mid
        re = tmp
    else:
        if abs(l-mid) in [1, n-1]:
            l = mid
            re = tmp
        else: r = mid
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations

n, m, r = map(int, input().split())
A = list(map(int, input().split()))
d = [[1e18]*n for i in range(n)]
for i in range(m):
        a, b, c = map(int, input().split())
        d[a-1][b-1] = d[b-1][a-1] = c

for k in range(n):
        for i in range(n):
                for j in range(n):
                        d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 1e18
for x in permutations(A):
        l = 0
        for i in range(r-1):
                l += d[x[i]-1][x[i+1]-1]
        ans = min(ans, l)
print(ans)

Fixed submission:
from itertools import permutations

n, m, r = map(int, input().split())
A = list(map(int, input().split()))
d = [[1e18]*n for i in range(n)]
for i in range(m):
        a, b, c = map(int, input().split())
        d[a-1][b-1] = d[b-1][a-1] = c

for k in range(n):
        for i in range(n):
                for j in range(n):
                        d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 1e18
for x in permutations(A):
        l = 0
        for i in range(r-1):
                l += d[x[i]-1][x[i+1]-1]
        ans = min(ans, l)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations

n, m, r = map(int, input().split())
A = list(map(int, input().split()))
d = [[1e9]*n for i in range(n)]
for i in range(m):
        a, b, c = map(int, input().split())
        d[a-1][b-1] = d[b-1][a-1] = c

for i in range(n):
        for j in range(n):
                for k in range(n):
                        d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 1e11
for x in permutations(A):
        l = 0
        for i in range(r-1):
                l += d[x[i]-1][x[i+1]-1]
        ans = min(ans, l)
print(ans)

Fixed submission:
from itertools import permutations

n, m, r = map(int, input().split())
A = list(map(int, input().split()))
d = [[1e18]*n for i in range(n)]
for i in range(m):
        a, b, c = map(int, input().split())
        d[a-1][b-1] = d[b-1][a-1] = c

for k in range(n):
        for i in range(n):
                for j in range(n):
                        d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 1e18
for x in permutations(A):
        l = 0
        for i in range(r-1):
                l += d[x[i]-1][x[i+1]-1]
        ans = min(ans, l)
print(ans)
Buggy python submission (verdict: Runtime Error):
_,a=map(int,open(0).read().split());print(max(a)-min(a))

Fixed submission:
_,*a=map(int,open(0).read().split());print(max(a)-min(a))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
H, W, M = map(int, input().split())
d = defaultdict(int)
tate = [0 for i in range(H+1)]
yoko = [0 for i in range(W+1)]
for i in range(M):
    x, y = map(int, input().split())
    d[(x, y)] = 1
    tate[x] += 1
    yoko[y] += 1

ans = 0
T = []
Y = []
for i, v in enumerate(tate):
    T.append((v, i))
for i, v in enumerate(yoko):
    Y.append((v, i))
T.sort(reverse=True)
Y.sort(reverse=True)

if len(T) == 1 or len(Y) == 1:
    for value, index in T:
        for Value, Index in Y:
            if (index, Index) in d.keys():
                ans = max(ans, value+Value-1)
            else:
                ans = max(ans, value+Value)
    print(ans)

else:
    M = T[0][0]+Y[0][0] - 1
    value_t = T[0][0]
    value_y = Y[0][0]
    for value, index in T:
        if value < value_t:
            break
        for Value, Index in Y:
            if Value < value_y:
                break
            if (index, Index) in d.keys():
                ans = max(ans, value+Value-1)
            else:
                ans = max(ans, value+Value)
    print(ans)

Fixed submission:
from collections import defaultdict
H, W, M = map(int, input().split())
d = defaultdict(int)
tate = [0 for i in range(H+1)]
yoko = [0 for i in range(W+1)]
for i in range(M):
    x, y = map(int, input().split())
    d[(x, y)] = 1
    tate[x] += 1
    yoko[y] += 1

ans = 0
T = []
Y = []
for i, v in enumerate(tate):
    T.append((v, i))
for i, v in enumerate(yoko):
    Y.append((v, i))
T.sort(reverse=True)
Y.sort(reverse=True)

value_t = T[0][0]
value_y = Y[0][0]
cnt_t = 0
cnt_y = 0
for value, index in T:
    if value == value_t:
        cnt_t += 1

for Value, Index in Y:
    if Value == value_y:
        cnt_y += 1
if cnt_t*cnt_y > M:
    print(value_t+value_y)

else:
    M = T[0][0]+Y[0][0] - 1
    value_t = T[0][0]
    value_y = Y[0][0]
    for value, index in T:
        if value < value_t:
            break
        for Value, Index in Y:
            if Value < value_y:
                break
            if (index, Index) in d.keys():
                ans = max(ans, value+Value-1)
            else:
                ans = max(ans, value+Value)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# problem a
# score 300
from collections import defaultdict
N = int(input())
A = []
from decimal import Decimal
for i in range(N):
    x = float(input())
    x = Decimal(x*(10**9))
    A.append(x)
remove = 0
for i in range(N):
    if (A[i]**2) % (10**18) == 0:
        remove += 1
D = defaultdict(int)
data = []
for x in A:
    order2 = 0
    order5 = 0
    K = x
    while K % 2 == 0:
        order2 += 1
        K = K//2
    while K % 5 == 0:
        order5 += 1
        K = K//5
    data.append((order2, order5))
    for i in range(order2+1):
        for j in range(order5+1):
            D[2**i*5**j] += 1
ans = 0
for ord2, ord5 in data:
    new_ord2 = max(0, 18-ord2)
    new_ord5 = max(0, 18-ord5)
    ans += D[(2**new_ord2)*(5**new_ord5)]
ans-=remove
ans = ans//2
print(ans)

Fixed submission:
# problem a
# score 300
from collections import defaultdict
N = int(input())
A = []
for i in range(N):
    x = float(input())
    x = "{:.9f}".format(x)
    x=int(x[:-10]+x[-9:])
    A.append(x)
remove = 0
for i in range(N):
    if (A[i]**2) % (10**18) == 0:
        remove += 1
D = defaultdict(int)
data = []
for x in A:
    order2 = 0
    order5 = 0
    K = x
    while K % 2 == 0:
        order2 += 1
        K = K//2
    while K % 5 == 0:
        order5 += 1
        K = K//5
    data.append((order2, order5))
    for i in range(order2+1):
        for j in range(order5+1):
            D[2**i*5**j] += 1
ans = 0
for ord2, ord5 in data:
    new_ord2 = max(0, 18-ord2)
    new_ord5 = max(0, 18-ord5)
    ans += D[(2**new_ord2)*(5**new_ord5)]
ans-=remove
ans = ans//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#all you can eat

N, T = map(int, input().split())
food = [tuple(map(int, input().split())) for i in range(N)]

dp = [[0]*(3010) for i in range(3010)]

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            dp[i+1][j] = max(dp[i][j], dp[i][j-time] + value)
        else:
            dp[i+1][j] = dp[i][j]
        dp[i][j] = max(dp[i][j], dp[i][j-1])

rev_dp = [[0]*(3010) for i in range(3010)]
food.reverse()

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            rev_dp[i+1][j] = max(rev_dp[i][j], rev_dp[i][j-time] + value)
        else:
            rev_dp[i+1][j] = rev_dp[i][j]
    dp[i][j] = max(dp[i][j], dp[i][j-1])


ans = 0
for x in range(N):
    ans = max(ans, max(dp[N-1-x][t] + rev_dp[x][T-1-t]
                       for t in range(T))+food[x][1])
print(ans)



Fixed submission:
#all you can eat

N, T = map(int, input().split())
food = [tuple(map(int, input().split())) for i in range(N)]

dp = [[0]*(3010) for i in range(3010)]

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            dp[i+1][j] = max(dp[i][j], dp[i][j-time] + value)
        else:
            dp[i+1][j] = dp[i][j]
        dp[i][j] = max(dp[i][j], dp[i][j-1])

rev_dp = [[0]*(3010) for i in range(3010)]
food.reverse()

for i in range(N):
    time, value = food[i]
    for j in range(T):
        if j >= time:
            rev_dp[i+1][j] = max(rev_dp[i][j], rev_dp[i][j-time] + value)
        else:
            rev_dp[i+1][j] = rev_dp[i][j]
    dp[i][j] = max(dp[i][j], dp[i][j-1])


ans = 0
for x in range(N):
    ans = max(ans, max(dp[N-1-x][t] + rev_dp[x][T-1-t]
                       for t in range(T))+food[x][1])
print(ans)
Buggy python submission (verdict: Runtime Error):

N = int(input())
X = int(input())

#     1 2 3 4 5 6 7 8 9 0 1 2 3 4
# L0:     p   p       p   p
# L1:   b   p   b   b   p   b
# L2: b           p           b

def rec(n, x):

    if n==0: return 1  # レベル0ではpが１つ
    if x==1: return 0  

    all = (1<<(n+1)) - 3  # 1つ低レベルの総数
    p = (1<<(n)) - 1  # 1つ低レベルのパティ数
    
    # 今レベルは b + rec(n-1) + p + rec(n-1) + b
    if x <= all + 1: return rec(n-1, x-1)  #  低レベル + 1の大きさであれば今レベルから採るpはなし
    if x == all + 2: return p + 1  # 低レベル + 2の大きさであれば、低レベルのp数 + 今レベルの中間のp１つ
    if x <= all * 2 + 2: return p + 1 + rec(n-1, x-all-2)  # 上2つを通過しているので少なくとも低レベル1つと中間のpは食べている. 後は低レベル２つ目のp数に帰着
    if x == all * 2 + 3: return p * 2 + 1  # 低レベル2つまるごと + 中間のp
    return -1000000

print(rec(N, X))


Fixed submission:

N, X = map(int, input().split())

#     1 2 3 4 5 6 7 8 9 0 1 2 3 4
# L0:     p   p       p   p
# L1:   b   p   b   b   p   b
# L2: b           p           b

def rec(n, x):

    if n==0: return 1  # レベル0ではpが１つ
    if x==1: return 0  

    all = (1<<(n+1)) - 3  # 1つ低レベルの総数
    p = (1<<(n)) - 1  # 1つ低レベルのパティ数
    
    # 今レベルは b + rec(n-1) + p + rec(n-1) + b
    if x <= all + 1: return rec(n-1, x-1)  #  低レベル + 1の大きさであれば今レベルから採るpはなし
    if x == all + 2: return p + 1  # 低レベル + 2の大きさであれば、低レベルのp数 + 今レベルの中間のp１つ
    if x <= all * 2 + 2: return p + 1 + rec(n-1, x-all-2)  # 上2つを通過しているので少なくとも低レベル1つと中間のpは食べている. 後は低レベル２つ目のp数に帰着
    if x == all * 2 + 3: return p * 2 + 1  # 低レベル2つまるごと + 中間のp
    return -1000000

print(rec(N, X))
Buggy python submission (verdict: Runtime Error):
k, s = [int(x) for x in input().split()]
k += 1

count = 0

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

print(count)


Fixed submission:
s = input()
print(s.replace(",", " "))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    kekka = 1
    for i in range(N-K+1):
        if i == 0:
            for j in As[i:i+K]:
                kekka *= j
                hyouka[i]=kekka
        else:
            kekka = kekka/As[i-1]*As[i+K-1]
            hyouka[i]=int(kekka)
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                print('Yes')
            else:
                print("No")

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    """
    kekka = 1
    for i in range(N-K+1):
        if i == 0:
            for j in As[i:i+K]:
                kekka *= j
                hyouka[i]=kekka
        else:
            kekka = kekka/As[i-1]*As[i+K-1]
            hyouka[i]=int(kekka)
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                print('Yes')
            else:
                print("No")
    """
    for i in range(N-K):
        if As[i] < As[i+K]:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    
    for i in range(N-K+1):
        kekka = 1
        for j in As[i:i+K]:
            kekka *= j
            hyouka[i]=kekka
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                print('Yes')
            else:
                print("No")

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    """
    kekka = 1
    for i in range(N-K+1):
        if i == 0:
            for j in As[i:i+K]:
                kekka *= j
                hyouka[i]=kekka
        else:
            kekka = kekka/As[i-1]*As[i+K-1]
            hyouka[i]=int(kekka)
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                print('Yes')
            else:
                print("No")
    """
    for i in range(N-K):
        if As[i] < As[i+K]:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
ran = [int(x) for x in stdin.readline().rstrip().split()]
ran.sort(reverse=True)

gen = len(ran) - 2
goukei = ran[0]
if gen % 2 == 0:
  for i in range(int(gen/2)):
    goukei += 2 * ran[i + 1]
else:
  for i in rangen(int((gen-1)/2)):
    goukei += 2 * ran[i + 1]
  goukei += ran[i + 2]

print(goukei)

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
ran = [int(x) for x in stdin.readline().rstrip().split()]
ran.sort(reverse=True)

gen = len(ran) - 2
goukei = ran[0]
if gen % 2 == 0:
  for i in range(int(gen/2)):
    goukei += 2 * ran[i + 1]
else:
  for i in range(int((gen-1)/2)):
    goukei += 2 * ran[i + 1]
  goukei += ran[i + 2]

print(goukei)