Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))

if n == k:
    sum = 0
else:
    h.sort(reverse=True)
    sum = 0
    hh = h[k: n - k + 1]
    for i in range(n-k):
        sum += int(hh[i])

print(str(sum))


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
print(sum(A[K:]))

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

if n == k:
    sum = 0
else:
    h.sort(reverse=True)
    sum = 0
    hh = h[k: n - k + 1]
    for i in range(n-k):
        sum += int(hh[i])

print(str(sum))


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
print(sum(A[K:]))

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

h.sort(reverse=True)
sum = 0
hh = h[k: n - k + 1]
for i in range(n-k):
    sum += int(hh[i])

print(str(sum))


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
print(sum(A[K:]))

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

h.sort(reverse=True)
sum = 0
hh = h[k: n - k + 1]
for i in range(n-k):
    sum += int(hh[i])

print(str(sum))


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
print(sum(A[K:]))
Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N+1):
  if min > a_list[i]:
    ans += a_list[i]-min
  else:
    min = a_list[i]
print(ans)

Fixed submission:
N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N):
  if min > a_list[i]:
    ans += min-a_list[i]
  else:
    min = a_list[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N):
  if min > a_list[i]:
    ans += a_list[i]-m
  else:
    min = a_list[i]
print(ans)
             

Fixed submission:
N=int(input())
a_list = list(map(int,input().split()))
ans = 0
min = a_list[0]
for i in range(1,N):
  if min > a_list[i]:
    ans += min-a_list[i]
  else:
    min = a_list[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=list(map(int,input().split()))
a_list=list(map(int,input().split()))
a_mul = [1]
for i,a in enumerate(a_list):
  a_mul.append(a_mul[i] * a)

for i in range(K+1,N+1):
  iscore = a_mul[i]//a_mul[i-K]
  i_score = a_mul[i-1]//a_mul[i-1-K]
  print('Yes' if iscore > i_score else 'No')

Fixed submission:
N,K=list(map(int,input().split()))
a_list=list(map(int,input().split()))

for i in range(K,N):
  iscore = a_list[i]
  i_score = a_list[i-K]
  print('Yes' if iscore > i_score else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A_list = list(map(int,input().split()))

MAX = 10**18
ans = 1
for a in A_list:
  ans *= a
if ans > MAX:
  print(-1)
  exit()
print(ans)

Fixed submission:
N=int(input())
A_list = list(map(int,input().split()))

MAX = 10**18
ans = 1
isZero = False
isOverFlow = False
for a in A_list:
  if a == 0:
    isZero = True
    break
  if not isOverFlow:
    ans *= a
  if ans > MAX:
    isOverFlow = True

if isZero:
  print(0)
elif isOverFlow:
  print(-1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

X=int(input())
ansa=0
ansb=0
for b in range(100):
    a5 = b**5 + X
    sig = False
    if a5 < 0:
        sig = True
        a5 = abs(a5)
    a1 = Decimal.power(a5,1/5)

    if sig:
        a1 *= -1

    if a1 == int(a1):
        ansa=int(a1)
        ansb=b
        break
if ansa >0 or ansb>0:
    print(ansa,ansb)
    exit()

# X=int(input())
# X.as
# ansa=0
# ansb=0
# for a in range(100):
#     b5 = a**5 - X
#     sig = False
#     if a==100:
#         print()
#     if b5 < 0:
#         sig = True
#         b5 = abs(b5)
#     b1 = pow(b5,1/5)

#     if sig:
#         b1 *= -1

#     if b1 == int(b1):
#         ansa=a
#         ansb=int(b1)
#         break
# if ansa >0 or ansb>0:
#     print(ansa,ansb)
#     exit()


Fixed submission:
from decimal import Decimal

X=Decimal(input())
ansa=0
ansb=0
# for b in range(1000):
#     a5 = Decimal(b**5) + X
#     sig = False
#     if a5 < 0:
#         sig = True
#         a5 = abs(a5)
#     a1 = pow(a5,Decimal('0.2'))

#     if sig:
#         a1 *= -1

#     if a1 == int(a1):
#         ansa=int(a1)
#         ansb=b
#         break
# if ansa >0 or ansb>0:
#     print(ansa,ansb)
#     exit()

for a in range(-1000,1000):
    b5 = Decimal(a**5) - X
    sig = False
    if a==100:
        print()
    if b5 < 0:
        sig = True
        b5 = abs(b5)
    b1 = pow(b5,Decimal('0.2'))

    if sig:
        b1 *= -1

    if b1 == int(b1):
        ansa=a
        ansb=int(b1)
        break
print(ansa,ansb)

Buggy python submission (verdict: Runtime Error):
import numpy as np

X=int(input())
ansa=0
ansb=0
for b in range(100):
    a5 = b**5 + X
    sig = False
    if a5 < 0:
        sig = True
        a5 = abs(a5)
    a1 = np.power(a5,1/5)

    if sig:
        a1 *= -1

    if a1 == int(a1):
        ansa=int(a1)
        ansb=b
        break
if ansa >0 or ansb>0:
    print(ansa,ansb)
    exit()

Fixed submission:
from decimal import Decimal

X=Decimal(input())
ansa=0
ansb=0
# for b in range(1000):
#     a5 = Decimal(b**5) + X
#     sig = False
#     if a5 < 0:
#         sig = True
#         a5 = abs(a5)
#     a1 = pow(a5,Decimal('0.2'))

#     if sig:
#         a1 *= -1

#     if a1 == int(a1):
#         ansa=int(a1)
#         ansb=b
#         break
# if ansa >0 or ansb>0:
#     print(ansa,ansb)
#     exit()

for a in range(-1000,1000):
    b5 = Decimal(a**5) - X
    sig = False
    if a==100:
        print()
    if b5 < 0:
        sig = True
        b5 = abs(b5)
    b1 = pow(b5,Decimal('0.2'))

    if sig:
        b1 *= -1

    if b1 == int(b1):
        ansa=a
        ansb=int(b1)
        break
print(ansa,ansb)
Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=list(map(int,input().split()))
maxi = min(A,N)
ans = 0
for i in range(1,maxi+1):
    ans = max(ans,math.floor((A*i)/B)-A*math.floor(i/B))
if A<N:
    for i in range(A,B+1):
        ans = max(ans,math.floor((A*i)/B)-A*math.floor(i/B))
print(ans)


Fixed submission:
import math
A,B,N=list(map(int,input().split()))
maxi=min(B-1,N)
print(math.floor((A*maxi)/B)-A*math.floor(maxi/B))
Buggy python submission (verdict: Runtime Error):
import numpy as np
MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res
 
def prepare(n, MOD):
    nrt = int(n ** 0.5) + 1
    nsq = nrt * nrt
    facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
    facts[0, 0] = 1
    for i in range(1, nrt):
        facts[:, i] = facts[:, i] * facts[:, i - 1] % MOD
    for i in range(1, nrt):
        facts[i] = facts[i] * facts[i - 1, -1] % MOD
    facts = facts.ravel().tolist()
 
    invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
    invs[-1, -1] = pow(facts[-1], MOD - 2, MOD)
    for i in range(nrt - 2, -1, -1):
        invs[:, i] = invs[:, i] * invs[:, i + 1] % MOD
    for i in range(nrt - 2, -1, -1):
        invs[i] = invs[i] * invs[i + 1, 0] % MOD
    invs = invs.ravel().tolist()
 
    return facts, invs

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

n,a,b=list(map(int,input().split()))
fact,factinv=prepare(n,MOD)

# 2**n-1
total = power_func(2,n,MOD)-1
print(total-cmb(n,a,MOD)-cmb(n,b,MOD))



Fixed submission:
MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n,k,p):
    if n < k:
        return 0
    if n-k<k:
        k=n-k

    # 分母
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD

    # 逆行列
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

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

# 2**n-1
total = power_func(2,n,MOD)-1
print((total-cmb(n,a,MOD)-cmb(n,b,MOD))%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

n,a,b=list(map(int,input().split()))
p = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

# 2**n-1
total = power_func(2,n,MOD)-1

print(total-cmb(n,a,MOD)-cmb(n,b,MOD))



Fixed submission:
MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n,k,p):
    if n < k:
        return 0
    if n-k<k:
        k=n-k

    # 分母
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD

    # 逆行列
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

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

# 2**n-1
total = power_func(2,n,MOD)-1
print((total-cmb(n,a,MOD)-cmb(n,b,MOD))%MOD)
Buggy python submission (verdict: Runtime Error):
num=list(map(int,input().split()))
print('Yes' if len(num) == len(set(num) + 1) else 'No')

Fixed submission:
num=list(map(int,input().split()))
print('Yes' if len(num) == len(set(num))+1 else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input)
A=list(map(int,input().split()))
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            print('DENIED')
            exit()
print('APPROVED')

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            print('DENIED')
            exit()
print('APPROVED')
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())
attack=[list(map(int,input().split())) for _ in range(n)]

max_attack=max(at[0] for at in attack)

dp = [0]*(h+max_attack)
for i in range(1,h+max_attack):
    at=[]
    for a,b in attack:
        at.append(dp[i-a]+b)
    dp[i]=min(at)
print(min(dp[h:]))


Fixed submission:
h,n=map(int,input().split())
attack=[list(map(int,input().split())) for _ in range(n)]

max_attack=max(at[0] for at in attack)

dp = [0]*(h+max_attack)
for i in range(1,h+max_attack):
    at=[]
    for a,b in attack:
        at.append(dp[i-a]+b)
    dp[i]=min(at)
print(min(dp[h:]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list=list(map(int,input().split()))

MOD = 10**9+7

ans=0
for i in range(60):
    one_cnt = 0
    for a in a_list:
        one_cnt += (a & 2**i)
    one_cnt //= 2**i
    zero_cnt = n - one_cnt
    ans = (ans + (2**i * one_cnt * zero_cnt) % MOD) % MOD
print(ans)

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

MOD = 10**9+7

ans=0
for i in range(60):
    one_cnt = 0
    for a in a_list:
        one_cnt += (a & 2**i)
    one_cnt //= 2**i
    zero_cnt = n - one_cnt
    ans = (ans + (2**i * one_cnt * zero_cnt) % MOD) % MOD
print(ans)

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

MOD = 10**9+7

ans=0
for i in range(60):
    one_cnt = 0
    for a in a_list:
        one_cnt += (a & 2**i) // 2**i
    zero_cnt = n - one_cnt
    ans = (ans + (2**i * one_cnt * zero_cnt) % MOD) % MOD
print(ans)

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

MOD = 10**9+7

ans=0
for i in range(60):
    one_cnt = 0
    for a in a_list:
        one_cnt += (a & 2**i)
    one_cnt //= 2**i
    zero_cnt = n - one_cnt
    ans = (ans + (2**i * one_cnt * zero_cnt) % MOD) % MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
k,x=[int(i) for i in input().split()]

left=max(−1000000,x-k+1)
right=min(x+k-1,1000000)
for i in range(left,right+1):
    print(i,end=' ')
print()


Fixed submission:
k,x=[int(i) for i in input().split()]

left=max(-1000000,x-k+1)
right=min(x+k-1,1000000)
for i in range(left,right+1):
    print(i,end=' ')
print()
Buggy python submission (verdict: Runtime Error):
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3] or s[3]==s[4]:
    print('Bad')
else:
    print('Good')

Fixed submission:
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
    print('Bad')
else:
    print('Good')
Buggy python submission (verdict: Runtime Error):
n=int(input())

nodes=[]
for i in range(n+1):
    nodes.append([])
for i in range(n-1):
    s,e,w = map(int,input().split())
    nodes[s].append((e,w))
    nodes[e].append((s,w))

col=[-1]*(n+1)

def dfs(now,color):
    col[now]=color
    for n,w in nodes[now]:
        if col[n]!=-1:
            continue
        if w%2==0:
            dfs(n,color)
        else:
            dfs(n,1-color)

dfs(1,1)

for i in range(1,n+1):
    print(col[i])

Fixed submission:

import sys
sys.setrecursionlimit(1000000)
def dfs(now,color):
    col[now]=color
    for n,w in nodes[now]:
        if col[n]!=-1:
            continue
        if w%2==0:
            dfs(n,color)
        else:
            dfs(n,1-color)

n=int(input())

nodes=[]
for i in range(n+1):
    nodes.append([])
for i in range(n-1):
    s,e,w = map(int,input().split())
    nodes[s].append((e,w))
    nodes[e].append((s,w))

col=[-1]*(n+1)

dfs(1,1)

for i in range(1,n+1):
    print(col[i])

Buggy python submission (verdict: Runtime Error):
def dfs(now,color):
    col[now]=color
    for n,w in nodes[now]:
        if col[n]!=-1:
            continue
        if w%2==0:
            dfs(n,color)
        else:
            dfs(n,1-color)

n=int(input())

nodes=[]
for i in range(n+1):
    nodes.append([])
for i in range(n-1):
    s,e,w = map(int,input().split())
    nodes[s].append((e,w))
    nodes[e].append((s,w))

col=[-1]*(n+1)

dfs(1,1)

for i in range(1,n+1):
    print(col[i])

Fixed submission:

import sys
sys.setrecursionlimit(1000000)
def dfs(now,color):
    col[now]=color
    for n,w in nodes[now]:
        if col[n]!=-1:
            continue
        if w%2==0:
            dfs(n,color)
        else:
            dfs(n,1-color)

n=int(input())

nodes=[]
for i in range(n+1):
    nodes.append([])
for i in range(n-1):
    s,e,w = map(int,input().split())
    nodes[s].append((e,w))
    nodes[e].append((s,w))

col=[-1]*(n+1)

dfs(1,1)

for i in range(1,n+1):
    print(col[i])

Buggy python submission (verdict: Runtime Error):
def dfs(now,parent,color):
    col[now]=color
    for node in nodes[now]:
        if node[0]==parent:
            continue
        if node[1]%2==0:
            dfs(node[0],now,color)
        else:
            dfs(node[0],now,1-color)

n=int(input())
e_list = [[int(i) for i in input().split()] for i in range(n-1)]
col=[-1]*n

nodes={}
for e in e_list:
    nodes.setdefault(e[0]-1, []).append((e[1]-1,e[2]))
    nodes.setdefault(e[1]-1, []).append((e[0]-1,e[2]))

dfs(0,-1,1)

for c in col:
    print(c)

Fixed submission:

import sys
sys.setrecursionlimit(1000000)
def dfs(now,color):
    col[now]=color
    for n,w in nodes[now]:
        if col[n]!=-1:
            continue
        if w%2==0:
            dfs(n,color)
        else:
            dfs(n,1-color)

n=int(input())

nodes=[]
for i in range(n+1):
    nodes.append([])
for i in range(n-1):
    s,e,w = map(int,input().split())
    nodes[s].append((e,w))
    nodes[e].append((s,w))

col=[-1]*(n+1)

dfs(1,1)

for i in range(1,n+1):
    print(col[i])
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())
count=0
for ri in range(int(n/r)+1):
    for gi in range(int(n/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0 and sumc/b>=0:
            count+=1
print(count)


Fixed submission:
r,g,b,n=map(int,input().split())

count=0
for ri in range(int(n/r)+1):
    for gi in range(int((n-ri*r)/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0:
            count+=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

count=0
for ri in range(int(n/r)+1):
    for gi in range(int(n/g)+1):
        if (n-ri*r-gi*g)%b==0 and (n-ri*r-gi*g)/b>=0:
            count+=1
        elif (n-ri*r-gi*g)<0:
            break

print(count)

Fixed submission:
r,g,b,n=map(int,input().split())

count=0
for ri in range(int(n/r)+1):
    for gi in range(int((n-ri*r)/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0:
            count+=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

count=0
for ri in range(int(n/r)+1):
    for gi in range(int(n/g)+1):
        if (n-ri*r-gi*g)%b==0 and (n-ri*r-gi*g)/b>=0:
            count+=1

print(count)


Fixed submission:
r,g,b,n=map(int,input().split())

count=0
for ri in range(int(n/r)+1):
    for gi in range(int((n-ri*r)/g)+1):
        sumc=n-ri*r-gi*g
        if sumc<0:
            break
        if sumc%b==0:
            count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
a_l =[int(i) for i in input().split()]
a_l.append(a_l[n-2])
max_gcd=reduce(math.gcd, a_l)
for i in range(n):
    tmp = a_l[i]
    a_l[i] = a_l[i+1]
    max_gcd=max(max_gcd,reduce(math.gcd, a_l))
    a_l[i] = tmp
print(max_gcd)

Fixed submission:
from fractions import gcd

n = int(input())
a_l =[int(i) for i in input().split()]

left=[0]
right=[0]

for i in range(1,n+1):
    left.append(gcd(left[i-1],a_l[i-1]))
    right.append(gcd(right[i-1],a_l[n-i]))
right=right[::-1]

ans=1
for i in range(n):
    ans=max(ans,gcd(left[i],right[i+1]))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s_input = input() 

def judge(s,count):
    if s.count("#.")==0:
        return count

    next=""
    for i in range(0,n-1):
        if s[i]=="#" and s[i+1]==".":
            next1 = s[:i] + "##"
            if i<n-2:
                next1+=s[i+2:]
            pat1 = judge(next1,count+1)

            pat2=pat1
            if i > 0 and s[i-1]==".":
                next2 = s[:i] + ".."
                if i < n-2:
                    next2+=s[i+2:]
                pat2 = judge(next2,count+1)
            return min(pat1,pat2)
    return count

print(judge(s_input,0))

Fixed submission:
n = int(input())
s_input = input() 

check=s_input.count('.')
ans=check
for s in s_input:
    if s=='.':
        # 変えんでいい
        check-=1
    else:
        check+=1
    ans=min(ans,check)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, list(input().split()))
s_base = input()

def maxdpt(depth, slist):
    # すべて1の場合は終了
    if slist.count('1') == len(slist): 
        return len(slist)
    
    # 深さ最大の場合は終了
    if depth+1>k:
        return max(list(map(len, slist.split('0'))))

    max_len=0
    str_len=0
    for i,c in enumerate(slist):   # 0の部分文字列を取得
        if c=='1':
            continue
        # 0の部分文字列を仮に変えてみる
        for j in range(i+1,len(slist)):
            #次の1まで
            if slist[j]=='1':
                break
        s_tmp=list(slist)
        for index in range(i,j):
            s_tmp[index]='1'
        s_tmp = "".join(s_tmp)
        max_len=max(max_len,maxdpt(depth+1,s_tmp))
        i=j
    return max_len

print(maxdpt(0,s_base))

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

# 1-0-1-0-1の形式で集計する
count=0
now=1
num_list=[]
for c_i in s:
    if c_i == now:
        count+=1
    else:
        num_list.append(count)
        count=1
        now=1-now
num_list.append(count)

# 最後が0のグループだと都合が悪い
if len(num_list)%2==0:
    num_list.append(0)

# 累積和を使って部分列の合計の最大値を求める
max_len=0
now_sum=0
left=0
right=0

for i in range(0,len(num_list),2):
    nextleft=i
    nextright=min(len(num_list),i+2*k+1)

    while left<nextleft:
        now_sum-=num_list[left]
        left+=1
    while right<nextright:
        now_sum+=num_list[right]
        right+=1
    max_len=max(max_len,now_sum)
    
print(max_len)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
base = input()
ans=[]
for i in range(q):
    l,r = map(int,input().split())
    ans.append(str(base[l-1:r].count("AC")))
print('\n'.join(ans))

Fixed submission:
n,q = map(int,input().split())
base = input()

counter = [0]*(n+1)
count=0
for i,s in enumerate(base):
    if i < n-1 and s=="A" and base[i+1]=="C":
        count+=1
    counter[i+1]=count

ans=[]
for i in range(q):
    l,r = map(int,input().split())
    ans.append(str(counter[r-1]-counter[l-1]))
print('\n'.join(ans))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
print('YES' if n=>2*(k-1) else 'NO')

Fixed submission:
a,b=map(int,input().split())
print('YES' if (a+1)//2>=b else "NO")
Buggy python submission (verdict: Runtime Error):
S = input()
keyence_len = len("keyence")
keyence="keyence"

now=0
remove=False
removeout=False
for i in range(len(S)):
    if S[i]==keyence[now]:
        if remove:
            removeout = True
        now+=1
    else:
        if removeout:
            print("NO")
            exit()
        remove=True
if now==keyence_len:
    print("YES")
else:
    print("NO")

Fixed submission:
S = input()
N = len(S)
keyence="keyence"

for i in range(N-1):
    for j in range(i,N):
        try_str = S[:i] + S[j:]
        if try_str == keyence:
            print("YES")
            exit()
print("NO")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split)
if a<= 8 and b<= 8:
    print('Yay!')
else:
    print(':(')

Fixed submission:
a,b=map(int,input().split())
if a<= 8 and b<= 8:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and ans(b-c)<=d):
    print('Yes')
else:
    print('No')


Fixed submission:
a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and abs(b-c)<=d):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and ans(b-c)<=d):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and abs(b-c)<=d):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
print(a if b >= a else a-1)


Fixed submission:
a, b = map(int, input().split())
print(a if b >= a else a-1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
print(a if b>=a else b)

Fixed submission:
a, b = map(int, input().split())
print(a if b >= a else a-1)