Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03474 (python)

Fixed submission:
A,B = map(int,input().split())
S = input()
if ('-' not in S[:A]) and (S[A] == '-') and ('-' not in S[A+1:]) and (len(S) == A+B+1):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
S = input().split('-')
if ('-' not in S[:A]) and (S[A] == '-') and ('-' not in S[A+1:]) and (len(S) == A+B+1):
    print('Yes')
else:
    print('No')
Problem p03565 (python)

Fixed submission:
s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    flag = True
    for j in range(len(t)):
        if s[i+j] == t[j] or s[i+j] == '?':
            continue
        else:
            flag = False
            break
    if flag:
        start.append(i)
    
stal = []
if start:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    if s[i] == t[0]:
        start.append(i)
        for j in range(len(t)):
            if s[i+j] == t[j] or s[i+j] == '?':
                continue
            else:
                start.pop(-1)
    if s[i:i+len(t)] == tq:
        start.append(i)
stal = []
if start:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    if s[i] == t[0]:
        start.append(i)
        flag = True
        for j in range(len(t)):
            if s[i+j] == t[j] or s[i+j] == '?':
                continue
            else:
                flag = False
                start.pop(-1)
    if s[i:i+len(t)] == tq:
        start.append(i)
        flag = True
stal = []
if flag:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    if s[i] == t[0]:
        start.append(i)
        flag = True
        for j in range(len(t)):
            if s[i+j] == t[j] or s[i+j] == '?':
                continue
            else:
                flag = False
                start.pop[-1]
    if s[i:i+len(t)] == tq:
        start.append(i)
        flag = True
stal = []
if flag:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')
Problem p03578 (python)

Fixed submission:
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if n not in Dcount:
        flag = 'NO'
        break
    if c > Dcount[n]:
        flag = 'NO'
        break
print(flag)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if n not in D:
        flag = 'NO'
        break
    if c > D[n]:
        flag = 'NO'
        break
print(flag)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if c > D[n]:
        flag = 'NO'
        break
print(flag)
Problem p03624 (python)

Fixed submission:
s = input()
alp = [chr(i) for i in range(ord('a'),ord('z')+1)]
ans = []
for i in alp:
    if i not in s:
        ans.append(i)
ans.sort()
if ans:
    print(ans[0])
else:
    print('None')

Buggy submission (verdict: Runtime Error):
s = input()
alp = [chr(i) for i in range(ord('a'),ord('z')+1)]
ans = []
for i in alp:
    if i not in s:
        ans.append(i)
ans.sort()
print(ans[0])
Problem p03659 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
suma = sum(a)
ans = abs(suma - a[0])
sumb = a[0]
if N == 2:
    print(abs(a[0]-a[1]))
else:
    for i in range(1,N-1):
        sumb += a[i]
        ans = min(ans,abs(suma - 2*sumb))
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
suma = a[0]
suma2 = sum(a)
for i in range(N-2):
    if 2*suma + a[i+1] -suma2 >= 0:
        break
    suma += a[i+1]
print(min(abs(2*suma+a[i] - suma2),abs(2*suma - suma2)))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
suma = a[0]
suma2 = sum(a)
for i in range(1,N-1):
    if 2*suma + a[i] -suma2 >= 0:
        break
    suma += a[i]
print(min(abs(2*suma+a[i] - suma2),abs(2*suma - suma2)))
Problem p03673 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(a[0])
else:
    print(*a[::-2],end = ' ')
    print(*a[n%2::2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(a[0])
else:
    print(*a[::-2],*a[n%2::2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
print(*a[::-2],*a[n%2::2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(a[0])
else:
    print(*a[::-2],*a[::2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
print(*a[::-2],*a[::2])
Problem p03695 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
num = [0 for i in range(9)]
for i in range(N):
    if a[i] < 3200:
        num[a[i]//400] += 1
    else:
        num[-1] += 1

if num[-1] == 0:
    num = [i for i in num if i != 0]
    print(len(num),len(num))
else:

    n = num.pop(-1)

    num2 = [i for i in num if i != 0]
    print(max(1,len(num2)),len(num2)+n)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
num = [0 for i in range(9)]
for i in range(N):
    num[a[i]//400] += 1

if num[-1] == 0:
    num = [i for i in num if i != 0]
    print(len(num),len(num))
else:
    n = num.pop(-1)
    num2 = [i for i in num if i != 0]
    print(len(num2),min(8,len(num2)+n))
Problem p03721 (python)

Fixed submission:
N,K = map(int,input().split())
num = 0
dicta = {}
for i in range(N):
    a,b = map(int,input().split())
    if a not in dicta:
        dicta[a] = b
    else:
        dicta[a] += b

dicts = sorted(dicta.items(), key = lambda x:x[0])
for i,v in dicts:
    num += v
    if num >= K:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
n = int(input())
array = []
for i in range(1,n+1):
    for j in range(1,n//i+1):
        array.append(abs(i-j) + n - i*j)
print(min(array))
Problem p03734 (python)

Fixed submission:
N,W = map(int,input().split())
w = [[] for i in range(4)]
w1,v1 = map(int,input().split())
w[0].append(v1)
for i in range(N-1):
    wi,vi = map(int,input().split())
    w[wi-w1].append(vi)
num = []
for i in range(4):
    w[i].sort(reverse= 1)
    num.append(len(w[i]))
ans = 0
for n1 in range(num[0]+1):
    for n2 in range(num[1]+1):
        for n3 in range(num[2]+1):
            for n4 in range(num[3]+1):
                wc = w1*(n1+n2+n3+n4) + n2 + 2*n3 + 3*n4
                if wc <= W:
                    vc = sum(w[0][:n1])+sum(w[1][:n2])+sum(w[2][:n3])+sum(w[3][:n4])
                    ans = max(ans,vc)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,W = map(int,input().split())
w = [[] for i in range(4)]
w1,v1 = map(int,input().split())
w[0].append(v1)
for i in range(N-1):
    wi,vi = map(int,input().split())
    w[wi-w1].append(vi)
num = []
for i in range(4):
    w[i].sort(reverse= 1)
    w[i] = [0]+list(accumulate(w[i]))
    num.append(len(w[i]))
ans = 0
for n1 in range(num[0]+1):
    for n2 in range(num[1]+1):
        for n3 in range(num[2]+1):
            for n4 in range(num[3]+1):
                wc = w1*(n1+n2+n3+n4) + n2 + 2*n3 + 3*n4
                if wc <= W:
                    vc = w[0][n1]+w[1][n2]+w[2][n3]+w[3][n4]
                    ans = max(ans,vc)
print(ans)
Problem p03827 (python)

Fixed submission:
n= int(input())
s= input()
suma=[0]
for i in range(n):
  if s[i] == 'I':
    suma.append(suma[i]+1)
  else:
    suma.append(suma[i]-1)
print(max(suma))

Buggy submission (verdict: Runtime Error):
n= int(input())
s= input()
suma=[0]
for i in range(n):
  if s[i] == 'I':
    suma.append(s[i]+1)
  else:
    suma.append(s[i]-1)
print(max(suma))
Problem p03830 (python)

Fixed submission:
N = int(input())
#N,M = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for i in range(N)]
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ans = 1
mod = 10**9+7
prime = primes(N)
for i in prime:
    isum = 0
    for n in range(2,N+1):
        while n%i == 0:
            isum += 1
            n //= i
    ans = (ans*(isum+1))%mod
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
#N,M = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for i in range(N)]
def prime_dict(n):
    a = {}
    if n%2 == 0:
        a[2] = 1
        n//=2
    while n%2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f*f <= n:
        if n%f == 0:
            if f not in a:
                a[f] == 1
            else:
                a[f] += 1
        else:
            f += 2
    if n!= 1:
        a[n] = 1
    return a
ans = 1
mod = 10**9+7
prime2 = {}
for i in range(2,N+1):
    prime = prime_dict(i)
    for k,v in prime.items():
        if k not in prime2:
            prime2[k] = v
        else:
            prime2[k] += v
for i in prime2.values():
    ans = (ans*(i+1))%mod
print(ans)
Problem p04045 (python)

Fixed submission:
N,K = map(int,input().split())
D = input().split()
num = set([str(i) for i in range(10)])
Ds = set(D)
diff = num^Ds
ans = N
while True:
    strN = set(list(str(ans)))
    if strN - diff:
        ans += 1
    else:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N,K = map(int,input().split())
D = list(map(int,input().split()))
num = {0,1,2,3,4,5,6,7,8,9}
Ds = set(D)
diff = num^Ds
if 0 in diff:
    diff.remove(0)
    lenn = len(str(N))
    print(str(min(diff)) + '0'*(lenn-1))
else:
    lenn = len(str(N))
    diff = list(diff)
    diff.sort()
    strN = str(N)
    for i in range(lenn):
        intN = int(strN[i])
        ind = bisect.bisect_left(diff,intN)
        print(diff[ind],end='')
Problem p02713 (python)

Fixed submission:
import math
k = int(input())
 
ans = 0
for i in range(1, k+1):
  for j in range(1, k+1):
    tmp = math.gcd(i,j)
    for l in range(1, k+1):
      ans += math.gcd(tmp, l)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
K = int(input())
sum = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(sum(list))
Problem p02719 (python)

Fixed submission:
import math
N, K = map(int, input().split())
N = N%K
while True:
    if abs(N-K) < N:
        N = abs(N-K)
    else:
        print(N)
        break

Buggy submission (verdict: Runtime Error):
K, N = map(int,input().split())
a = list(map(int,input().split()))
x = [a[0]-a[-1]+K]
for i in range(1,N):
    x.append(a[i]-a[i-1])
print(x)
print(K-max(x))
Problem p02727 (python)

Fixed submission:
X ,Y ,A ,B ,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
p = p[:X]
q = q[:Y]
p.extend(q)
p.sort()
if X+Y > C:
    for i in range(C) :
        if p[i] < r[i]:
            p[i] = r[i]
        else:
            pass
else:
    for i in range(X+Y) :
        if p[i] < r[i]:
            p[i] = r[i]
        else:
            pass
print(sum(p))

Buggy submission (verdict: Runtime Error):
X ,Y ,A ,B ,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
p = p[:X]
q = q[:Y]
p.extend(q)
p.sort()
for i in range(C) :
    if p[i] < r[i]:
        p[i] = r[i]
    else:
        pass
print(sum(p))
Problem p02730 (python)

Fixed submission:
S = input()
N = len(S)
cnt = 0
S1 = S[:int((N-1)/2)]
S2 = S[int((N+1)/2):]
if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
cnt = 0
N = len(S)
for i in range(int((N-3)/2)):
    if S[i] == S[N-i-1]:
        cnt += 1
    else:
        pass
if cnt == (N-3)/2 and S % 4 != 1:
    print("Yes")
else:
    print("No")
Problem p02741 (python)

Fixed submission:
a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(a[K-1])

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
if H % 2 == 1 and W % 2 ==1:
  print(int((H*W+1)/2))
elif H == 1 or W ==1:
    print(1)
elif H ==0 or W == 0:
    print(0)    
else:
  print(int((H*W)/2))
Problem p02761 (python)

Fixed submission:
N ,M = map(int,input().split())
cnt = [0]*N
C = [0]*N
C[0] = 1
for i in range(M):
    s, c = map(int,input().split())
    if cnt == 1 and C[s-1] != c:
        cnt[s-1] += 1
    elif cnt[s-1] == 1 and C[s-1] == c:
        pass
    else:
        cnt[s-1] += 1
        C[s-1] = c
if N ==1 and C[0] == 0:
    print(0)
elif N ==1 and M == 0:
    print(0)
elif max(cnt)>=2 or C[0] == 0 :
    print(-1)
else:
    print("".join(map(str,C)))

Buggy submission (verdict: Runtime Error):
N ,M = map(int,input().split())
cnt = [0]*M
C = [0]*M
for i in range(M):
    s, c = map(int,input().split())
    if cnt == 1 and C[s-1] != c:
        cnt[s-1] += 1
    elif cnt[s-1] == 1 and C[s-1] == c:
        pass
    else:
        cnt[s-1] += 1
        C[s-1] = c
if max(cnt)>=2 or C[0] == 0 :
    print(-1)
else:
    print("".join(map(str,C)))

Buggy submission (verdict: Runtime Error):
N ,M = map(int,input().split())
cnt = [0]*M
C = [0]*M
for i in range(M):
    s, c = map(int,input().split())
    if c == C[s-1]:
        pass
    else:
        C[s-1] += c
        cnt[s-1] += 1

if max(cnt)>=2 or C[0] == 0   :
    print(-1)
else:
    print("".join(map(str,C)))
Problem p02861 (python)

Fixed submission:
import itertools
import math
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
ans=0
it=list(itertools.permutations(range(n),n))
for i in it:
    tmpx=l[i[0]][0]
    tmpy=l[i[0]][1]
    tmp=0
    for j in i[1:]:
        tmp+=math.sqrt((tmpx-l[j][0])**2+(tmpy-l[j][1])**2)
        tmpx=l[j][0]
        tmpy=l[j][1]
    ans+=tmp
print(ans/math.factorial(n))

Buggy submission (verdict: Runtime Error):
import itertools
import math
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
ans=0
it=list(itertools.permutations(range(8),8))
for i in it:
    tmpx=l[i[0]][0]
    tmpy=l[i[0]][1]
    tmp=0
    for j in i[1:]:
        tmp+=math.sqrt((tmpx-l[j][0])**2+(tmpy-l[j][1])**2)
        tmpx=l[j][0]
        tmpy=l[j][1]
    ans+=tmp
print(ans/math.factorial(n))
Problem p02882 (python)

Fixed submission:
import math
a,b,v=map(int,input().split())
theta1=0
theta2=math.pi/2
ans=10**9
if a*a*b-v==0:
    print(0)
    exit()
if a*a*b/2>=v:
    while 1:
        tmp=math.tan((theta1+theta2)/2)-2*v/(a*b*b)
        if abs(tmp)<=10**(-6):
            ans=(theta1+theta2)/2
            break
        else:
            if tmp>0:
                theta2=(theta1+theta2)/2
            else:
                theta1=(theta1+theta2)/2
else:
    while 1:
        tmp=math.tan((theta1+theta2)/2)-(a**3)/(2*(a*a*b-v))
        if abs(tmp)<=10**(-6):
            ans=(theta1+theta2)/2
            break
        else:
            if tmp>0:
                theta2=(theta1+theta2)/2
            else:
                theta1=(theta1+theta2)/2
print(90-math.degrees(ans))

Buggy submission (verdict: Runtime Error):
import math
a,b,v=map(int,input().split())
theta1=0
theta2=math.pi/2
ans=10**9
if a*a*b/2>=v:
    while 1:
        tmp=math.tan((theta1+theta2)/2)-2*v/(a*b*b)
        if abs(tmp)<=10**(-6):
            ans=(theta1+theta2)/2
            break
        else:
            if tmp>0:
                theta2=(theta1+theta2)/2
            else:
                theta1=(theta1+theta2)/2
else:
    while 1:
        tmp=math.tan((theta1+theta2)/2)-(a**3)/(2*(a*a*b-v))
        if abs(tmp)<=10**(-6):
            ans=(theta1+theta2)/2
            break
        else:
            if tmp>0:
                theta2=(theta1+theta2)/2
            else:
                theta1=(theta1+theta2)/2
print(90-math.degrees(ans))
Problem p02923 (python)

Fixed submission:
n=int(input())
if n==1:print(0);exit()
s=list(map(int,input().split()))
a=0
l,r=0,1
while 1:
    if s[r-1]>=s[r]:
        a=max(a,r-l)
        r+=1
    else:
        l=r
        r=l+1
    if r==n:break
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input().split()))
a=0
l,r=0,1
while 1:
    if s[r-1]>=s[r]:
        a=max(a,r-l)
        r+=1
    else:
        l=r
        r=l+1
    if r==n:break
print(a)
Problem p02988 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if l[i-1]<l[i]<l[i+1] or l[i+1]<l[i]<l[i-1]:
   ans+=1 
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if l[i-1]<l[i]<l[i+1] or l[i+1]<l[i]<l[i-1]
   ans+=1 
 print(ans)
Problem p02995 (python)

Fixed submission:
def gcd(x, y):
    if y == 0: return x
    return gcd(y, x%y)

a,b,c,d = map(int,input().split())
lcm = int(c*d/gcd(c,d))
def num(x):
    return(b//x-(a-1)//x)
ans = (b-a+1)-num(c)-num(d)+num(lcm)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
lcm = int(c*d/math.gcd(c,d))
def num(x):
    return(b//x-(a-1)//x)
ans = (b-a+1)-num(c)-num(d)+num(lcm)
print(int(ans))
Problem p03035 (python)

Fixed submission:
A,B = map(int,input().split())
if A>=13:
  print(B)
elif A>=6:
  print(int(B/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int(input().split()))
if A>=13:
  print(B)
elif A>=6:
  print(B/2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int(input().split()))
if A>=13:
  print(B)
elif A>=6
  print(B/2)
else
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int(input().split()))
if A>=13:
  print(B)
elif A>=6
  print(B/2)
else
print(0)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
l,tmpl,cnt0,tmp,flag1,flag2=[],0,0,s[0],0,0
if tmp=="0":cnt0+=1;flag1=1
for i in s:
    if i==tmp:tmpl+=1
    else:
        if i=="0":cnt0+=1
        tmp=i
        l.append(tmpl)
        tmpl=1
if tmp=="0":flag2=1
l.append(tmpl)
if cnt0<=k:print(n);exit()
ans=max(sum(l[:2*k]),sum(l[::-1][:2*k]))
suml,tmp=[0],0
if flag1==1:l=l[1:]
if flag2==1:l=l[:len(l)-1]
for i in l:
    tmp+=i
    suml.append(tmp)
for i in range((len(suml)-2*k-1)//2+1):
    tmp=suml[2*k+2*i+1]-suml[2*i]
    if tmp>ans:ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
l,tmpl,cnt0,tmp,flag=[],0,0,s[0],0
if tmp=="0":cnt0+=1;flag=1
for i in s:
    if i==tmp:tmpl+=1
    else:
        if i=="0":cnt0+=1
        tmp=i
        l.append(tmpl)
        tmpl=1
l.append(tmpl)
if cnt0<=k:print(n);exit()
ans=max(sum(l[:2*k]),sum(l[::-1][:2*k]))
suml,tmp=[0],0
if flag==1:l=l[1:]
for i in l:
    tmp+=i
    suml.append(tmp)
for i in range((len(suml)-2*k-1)//2+1):
    tmp=suml[2*k+2*i+1]-suml[2*i]
    if tmp>ans:ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
l,tmpl,cnt0,tmp,flag=[],0,0,s[0],0
if tmp=="0":cnt0+=1;flag=1
for i in s:
    if i==tmp:tmpl+=1
    else:
        if i=="0":cnt0+=1
        tmp=i
        l.append(tmpl)
        tmpl=1
l.append(tmpl)
if cnt0<=k:print(n);exit()
ans=max(sum(l[:2*k]),sum(l[::-1][:2*k]))
suml,tmp=[0],0
if flag==1:l=l[1:]
for i in l:
    tmp+=i
    suml.append(tmp)
for i in range((len(suml)-2*k-1)//2+1):
    tmp=suml[2*k+2*i+1]-suml[2*i]
    print(tmp)
    if tmp>ans:ans=tmp
print(ans)
Problem p03102 (python)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
    arr = list(map(int,input().split()))
    a.append(arr)
for i in a:
    tmp = c
    for j in range(m):
        tmp += i[j]*b[j]
    if tmp > 0:ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
    arr = list(map(int,input().split()))
    a.append(arr)
for i in a:
    tmp = c
    for j in range(n+1):
        tmp += i[j]*b[j]
    if tmp > 0:ans+=1
print(ans)
Problem p03219 (python)

Fixed submission:
a,b=map(int,input().split());print(int(a+b/2))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input.split());print(a+b/2)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b%2==0:print("Even")
else:print("Odd")

Buggy submission (verdict: Runtime Error):
    a,b=map(int,input().split())
    if a*b%2==0:print("Even")
    else:print("Odd")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if n*K%2==0:print("Even")
else:print("Odd")
Problem p03495 (python)

Fixed submission:
import collections

n,k = map(int,input().split())
lst = list(map(int,input().split()))
lst_com = collections.Counter(lst).most_common()
if len(lst_com)<=k:
    print(0)
    exit()
ans=n
for i in range(k):
    ans -= lst_com[i][1]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
lst = list(map(int,input().split()))
lst_com = collections.Counter(lst).most_common()
if len(lst_com)<=k:
    print(0)
    exit()
ans=n
for i in range(k):
    ans -= lst_com[i][1]
print(ans)
Problem p03504 (python)

Fixed submission:
n,c=map(int,input().split())
ls=[[set(),set()] for i in range(30)]
l=[0]*(10**5+1)
for i in range(n):
    s,t,c=map(int,input().split())
    if s in ls[c-1][1]:ls[c-1][1].remove(s)
    else:ls[c-1][0].add(s-1)
    if t-1 in ls[c-1][0]:ls[c-1][0].remove(t-1)
    else:ls[c-1][1].add(t)
for i in ls:
    for j in i[0]:
        l[j]+=1
    for j in i[1]:
        l[j]-=1
for i in range(10**5):
    l[i+1]+=l[i]
print(max(l))

Buggy submission (verdict: Runtime Error):
n,c=map(int,input().split())
l=[0]*10**5
for i in range(n):
    s,t,c=map(int,input().split())
    l[s-1]+=1
    l[t]-=1
for i in range(10**5-1):
    l[i+1]+=l[i]
print(max(l))
Problem p03637 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
n4=sum([i%4==0 for i in l])
n2=sum([i%2==0 for i in l])-n4
if n4>=max(n//2,1):
    print("Yes")
else:
    if (n//2)*2-n4*2<=n2:
        print("Yes")
    else:print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
n4=sum([i%4==0 for i in l])
n2=sum([i%2==0 for i in l])-n4
if n4>=max(n//2,1):
    print("Yes")
else:
    if (n//2)*2-n4*2<=n2:
        print("Yes"):
    else:print("No")