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

Fixed submission:
import heapq
n, m = map(int, input().split())
aas = sorted(list(map(int, input().split())))
hq = []
for i in range(m):
    b, c = map(int, input().split())
    heapq.heappush(hq,(-c,b))
i = 0
while hq:
    c, b = heapq.heappop(hq)
    c = -c
    for j in range(i,min(n,i+b)):
        if aas[j] < c:
            aas[j] = c
        else:
            print(sum(aas))
            exit()
    i = j + 1
print(sum(aas))

Buggy submission (verdict: Runtime Error):
import heapq
n, m = map(int, input().split())
aas = list(map(int, input().split())).sort()
hq = []
for i in range(m):
    b, c = map(int, input().split())
    heapq.heappush(hq,(-c,b))
i = 0
while hq:
    -c, b = heapq.heappop(hq)
    for j in range(i,min(n,i+b)):
        if aas[j] < c:
            aas[j] = c
        else:
            print(sum(aas))
            exit()
    i = j + 1
print(sum(aas))
Problem p03041 (python)

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

print(s[:k-1]+s[k-1].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c':
print(s)
Problem p03075 (python)

Fixed submission:
aas = [int(input()) for _ in range(5)]
k = int(input())
print('Yay!' if max(aas)-min(aas)<=k else ':(')

Buggy submission (verdict: Runtime Error):
aas = [int(input()) for _ in range(5)]
k = int(input())
for i in range(1,5):
  if aas[i]-aas[i-1]>k:
    print(':(')
    exit()
print('Yay!)
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
nl=[]
ml=[]
for i in range(n):
    nl.append(input())
for i in range(m):
    ml.append(input())

cnt=0
Yes=False
for i in nl:
    if(ml[0] in i):
        idx = i.find(ml[0])
        cnt2=cnt+1
        if m==1:
            Yes = True
            break
        for j in range(1,m):
            if cnt2>n-1:
                break
            elif(not ml[j]==nl[cnt2][idx:idx+m]):
                break
            elif(j==m-1):
                Yes = True
                break
            cnt2+=1
    if(Yes):
        break
    cnt+=1
if Yes:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
, m = map(int, input().split())
nl=[]
ml=[]
for i in range(n):
    nl.append(input())
for i in range(m):
    ml.append(input())

cnt=0
Yes=False
for i in nl:
    if(ml[0] in i):
        idx = i.find(ml[0])
        cnt2=cnt+1
        for j in range(1,m):
            if cnt2>n-1:
                ok = False
                break
            elif(not ml[j]==nl[cnt2][idx:idx+m]):
                ok=False
                break
            elif(j==m-1):
                Yes = True
                break
            cnt2+=1
    if(Yes):
        break
    cnt+=1
if Yes:
    print("Yes")
else:
    print("No")
Problem p02701 (python)

Fixed submission:
N = int(input())

items = set()
for i in range(N):
    item = input()
    items.add(item)
print(len(items))

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")
Problem p02627 (python)

Fixed submission:
c = input()
if c == c.lower():
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
c = input()
if c = c.lower():
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
c = input()
if c = c.lower():
  	print('a')
else:
  print('A')
Problem p02622 (python)

Fixed submission:
s=input()
t=input()
length=len(s)
count=0
for i in range(length):
    if s[i] != t[i]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
count=0
for i in s:
    if s[i] != t[i]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s=input().split()
t=input().split()
count=0
for i in s:
    if s[i] != t[i]:
        count += 1
print(count)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2*a+b-k)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2a+b-k)
Problem p02725 (python)

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

max_distance = abs(k - a[-1] + a[0])
str_index = 0
gl_index = -1
for i in range(n):
    if i == 0:
        continue
    elif max_distance < abs(a[i-1] - a[i]):
        max_distance = abs(a[i-1] - a[i])
        str_index = i-1
        gl_index = i
if gl_index == -1:
    print(a[gl_index] - a[str_index])
else:
    print(a[str_index] + (k - a[gl_index]))

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

max_distance = k - a[-1] - a[0]
str_index = 0
gl_index = -1
for i in range(n):
   	if i == 0:
        continue
    elif max_distance < abs(a[i-1] - a[i]):
        max_distance = abs(a[i-1] - a[i])
        str_index = i-1
        gl_index = i
print(a[str_index] + (k - a[gl_index]))
Problem p02754 (python)

Fixed submission:
n,a,b,=map(int, input().split())
if a == 0:
    print(0)
else:
    ans = (int(n / (a+b)) * a)
    if n % (a+b) > a:
        print(ans + a)
    else:
        print(ans + (n % (a+b)))

Buggy submission (verdict: Runtime Error):
if a == 0:
    print(0)
else:
    ans = (int(n / (a+b)) * a)
    if n % (a+b) > a:
        print(ans + a)
    else:
        print(ans + (n % (a+b)))
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split(' '))
if w >= s:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s,w = map(int,input().split(' '))
if w >= s:
  print(unsafe)
else:
  print(safe)

Buggy submission (verdict: Runtime Error):
s,w = map(int,input().split(' '))
if w >= s:
  print(unsafe)
else:
  print(safe)
Problem p02623 (python)

Fixed submission:
from bisect import bisect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=[0]+list(map(int,input().split()))
b=list(map(int,input().split()))
a=cumsum(a)
b=cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  if x>=0:
    y=bisect_right(b,x)
    if ans<y+i:
      ans=y+i
  else:
    break
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=numpy.cumsum(a)
b=numpy.cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  y=bisect.bisect_right(b,x)
  if ans<y+i+1:
    ans=y+i+1
print(ans)

Buggy submission (verdict: Runtime Error):
from biesect import biesect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=numpy.cumsum(a)
b=numpy.cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  y=biesect.biesect_right(b,x)
  if ans<y+i+1:
    ans=y+i+1
print(ans)
Problem p02624 (python)

Fixed submission:
a=int(input())
b=(a)//2+1
ans=0
for i in range(1,b,1):
  x=a//i
  ans+=((x**2+x)//2)*i
ans+=(a**2+a+b-b**2)//2
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans=0
for i in range(a):
  x=a//i
  ans+=((a+1)a)/2
print(ans)

Buggy submission (verdict: Runtime Error):
print(www)
Problem p02682 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
ans=0
if not a<d:
  print(d)
else:
  if not a+b<d:
    print(a)
  else:
    print(2*a+b-d)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
ans=0
if not a<k:
  print(k)
else:
  if not a+b<k:
    print(a)
  else:
    print(2*a+b-k)
Problem p02699 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=b:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a=<b:
  print("unsafe")
else:
  print("safe")
Problem p02711 (python)

Fixed submission:
a=list(input())
if 	"7" in a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=list(int(input()))
if 7 in a:
  print("Yes")
else:
  print("No")
Problem p02815 (python)

Fixed submission:
#E
n=int(input())
C=sorted(list(map(int,input().split())))
mod=10**9+7

pow2=[1]
for i in range(n+5): #2の累乗(mod 10**9+7)のテーブル作成
    pow2.append(pow2[i]*2%mod)

sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=pow2[l]
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=pow2[r-1]
        ans=(ans+pow2[r-2]*(r-1)%mod)%mod
        ans=ans*pow2[l]%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*pow2[n]%mod))

Buggy submission (verdict: Runtime Error):
#E
n=int(input())
C=sorted(list(map(int,input().split())))
mod=10**9+7

def pow2(x): #2の累乗(mod 10**9+7)の定義
    if x == 0:
        return 1
    return pow2(x-1)*2%mod
    
sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=pow2(l)
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=pow2(r-1)
        ans=(ans+pow2(r-2)*(r-1)%mod)%mod
        ans=ans*pow2(l)%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*pow2(n)%mod))
Problem p02891 (python)

Fixed submission:
import sys
S=input()
k=int(input())
ans=0
flag=0
left=0
right=0
if S[0]==S[-1]:
    left=1
    for i in range(len(S)-1):
        if S[i+1]==S[0]:
            left+=1
        else:
            break
    if left==len(S):
        print(left*k//2)
        sys.exit()
    right=1
    for i in range(len(S)-1):
        if S[-i-2]==S[0]:
            right+=1
        else:
            break
    
now=""
for i in range(left,len(S)-right):
    if flag==1:
        flag=0
        now=S[i]
        continue
    if now==S[i]:
        ans+=1
        flag=1
    now=S[i]
ans*=k

if S[0]==S[-1]:
    ans+=(left+right)//2*(k-1)
    ans+=left//2+right//2

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
S=input()
k=int(input())
ans=0
flag=0
if S[0]==S[-1]:
    left=1
    for i in range(len(S)-1):
        if S[i+1]==S[0]:
            left+=1
        else:
            break
    if left==len(S):
        print(left*k//2)
        sys.exit()
    right=1
    for i in range(len(S)-1):
        if S[-i-2]==S[0]:
            right+=1
        else:
            break
    
now=""
for i in range(left,len(S)-right):
    if flag==1:
        flag=0
        now=S[i]
        continue
    if now==S[i]:
        ans+=1
        flag=1
    now=S[i]
ans*=k

if S[0]==S[-1]:
    ans+=(left+right)//2*(k-1)
    ans+=left//2+right//2
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
S=input()
k=int(input())
ans=0
flag=0
if S[0]==S[-1]:
    now=S[0]
    left=1
    for i in range(len(S)-1):
        if S[i+1]==now:
            left+=1
        else:
            break
    if left==len(S):
        print(left*k//2)
        sys.exit()
    now=S[-1]
    right=1
    for i in range(len(S)-1):
        if S[-i-2]==now:
            right+=1
        else:
            break
    
now=""
for i in range(left,len(S)-right):
    if flag==1:
        flag=0
        continue
    if now==S[i]:
        ans+=1
        flag=1
    now=S[i]
ans*=k

if S[0]==S[-1]:
    ans+=(left+right)//2*(k-1)
    ans+=left//2+right//2
print(ans)
Problem p02912 (python)

Fixed submission:
import math

n,m=map(int,input().split())
A=list(reversed(sorted(map(int,input().split()))))
L=[math.log2(a) for a in A]
L.append(-1)

now=int(L[0]) #log2のどこまで使うか
for i in range(n):
    cnt=m//(i+1)
    d=now-int(L[i+1])
    if cnt<d:
        now-=cnt
        m=m%(i+1)
        break
    else:
        m-=d*(i+1)
        now=int(L[i+1])

for k in range(i+1):
    A[k]/=2**(int(L[k])-now)

A=list(reversed(sorted(A)))
for i in range(min(n,m)):
    A[i]/=2
for i in range(n):
    A[i]=int(A[i])
print(sum(A))

Buggy submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())
A=list(reversed(sorted(map(int,input().split()))))
L=[math.log2(a) for a in A]
L.append(-1)

now=int(L[0]) #log2のどこまで使うか
for i in range(n):
    cnt=m//(i+1)
    d=now-int(L[i+1])
    if cnt<d:
        now-=cnt
        m=m%(i+1)
        break
    else:
        m-=d*(i+1)
        now=int(L[i+1])

for k in range(i+1):
    A[k]/=2**(int(L[k])-now)

A=list(reversed(sorted(A)))
for i in range(min(n,m)):
    A[i]/=2
for i in range(n):
    A[i]=int(A[i])
print(sum(A))
Problem p02987 (python)

Fixed submission:
import sys
S=input()
if S[0]==S[1]:
    if S[2]==S[3] and S[0]!=S[2]:
        print("Yes")
        sys.exit()
elif S[0]==S[2]:
    if S[1]==S[3]:
        print("Yes")
        sys.exit()
elif S[0]==S[3]:
    if S[1]==S[2]:
        print("Yes")
        sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[0]==S[1]:
    if S[2]==S[3] and S[0]!=S[2]:
        print("Yes")
        sys.exit()
elif S[0]==S[2]:
    if S[1]==S[3]:
        print("Yes")
        sys.exit()
elif S[0]==S[3]:
    if S[1]==S[2]:
        print("Yes")
        sys.exit()
print("No")
Problem p03253 (python)

Fixed submission:
import math
import sys

def findFactors(n):
    now=n
    f=[]
    while now%2==0:
        now//=2
        f.append(2)
    p=3
    while p<=math.sqrt(n):
        while now%p==0:
            now//=p
            f.append(p)
        p+=2
        if now==1:
            break
    if now>math.sqrt(n):
        f.append(now)
    return f

def cmb(n,r):
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

mod=10**9+7
N=10**5+100
g1=[1,1]
g2=[1,1]
inverse=[0,1]

#n!とその逆元を求めておく
for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

n,m=map(int,input().split())
if m==1:
    print(1)
    sys.exit()

F=findFactors(m)
ans=1

now=F[0]
cnt=0
for f in F:
    if f==now:
        cnt+=1
    else:
        ans*=cmb(n-1+cnt,cnt)
        ans%=mod
        now=f
        cnt=1
ans*=cmb(n-1+cnt,cnt)
ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def findFactors(n):
    now=n
    f=[]
    while now%2==0:
        now//=2
        f.append(2)
    p=3
    while p<=math.sqrt(n):
        while now%p==0:
            now//=p
            f.append(p)
        p+=2
        if now==1:
            break
    if now>math.sqrt(n):
        f.append(now)
    return f

def cmb(n,r):
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

mod=10**9+7
N=10**5+100
g1=[1,1]
g2=[1,1]
inverse=[0,1]

#n!とその逆元を求めておく
for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

n,m=map(int,input().split())
F=findFactors(m)
ans=1

now=F[0]
cnt=0
for f in F:
    if f==now:
        cnt+=1
    else:
        ans*=cmb(n-1+cnt,cnt)
        ans%=mod
        now=f
        cnt=1
ans*=cmb(n-1+cnt,cnt)
ans%=mod
print(ans)
Problem p02915 (python)

Fixed submission:
n=int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
n=input()

print(n*n*n)
Problem p02881 (python)

Fixed submission:
n = int(input())

ans = n+1
for i in range(2, 10**6+1):
    if n%i == 0:
        ans = min(ans, i + n//i)
print(ans-2)

Buggy submission (verdict: Runtime Error):
import math
import sys

n = int(input())

low = sys.maxsize
a, b = 0, 0
for i in range(math.floor(math.sqrt(n))):
    if n%i == 0 and (i + n//i) <= low:
        a, b = i, n//i
        low = a + b
print(a+b-2)
Problem p02891 (python)

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

count = 0
change = False
for i in range(1, len(s)):
    if s[i-1] == s[i] and not change:
        count += 1
        change = True
    else:
        change = False

count2 = 0
change2 = False
for i in range(2, len(s)):
    if s[i-1] == s[i] and not change2:
        count2 += 1
        change2 = True
    else:
        change2 = False

if len(s) == 1:
    print(k//2)
elif s[0] == s[-1] and not change:
    if change2:
        print((count+count2+1)*(k//2)+count)
    else:
        print(count+(count2+1)*(k-1))
else:
    print(count*k)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

count = 0
change = False

for i in range(1, len(s)):
    if s[i-1] == s[i] and not change
        count += 1
        change = True
    else:
        change = False

count2 = 0
change2 = False
for i in range(2, len(s)):
    if s[i-1] == s[i] and not change2:
        count2 += 1
        change2 = True
    else:
        change2 = False


if len(s) == 1:
    print(k//2)
elif s[0] == s[-1] and not change:
    if change2:
        print((count+count2+1)*(k//2)+count*(k%2))
    else:
        print(count+(count2+1)*(k-1))
else:
    print(count*k)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

count = 0
change = False

for i in range(1, len(s)):
    if s[i-1] == s[i] and not change:
        count += 1
        change = True
    else:
        change = False
if s[0] == s[-1] and s[-2] != s[-1]:
    count += 1
    print(count*k-1)
else:
    print(count*k)
Problem p02990 (python)

Fixed submission:
n, k = map(int, input().split())
mod = 10**9+7

def cmb_table(n, mod):
    fac = [1] * (n+1)   # numerator
    finv = [1] * (n+1)   # denominator
    inv = [1] * (n+1)   # inverse of natural number
    inv[0] = 0
    for i in range(2, n+1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[int(mod%i)] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def cmb(n, r, mod, fac, finv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return int(fac[n] * finv[r] * finv[n-r] % mod)

a, b = cmb_table(n, mod)

for i in range(1, k+1):
    t1 = cmb(n-k+1, i, mod, a, b)
    t2 = cmb(k-1, i-1, mod, a, b)
    print(t1 * t2 % mod)

Buggy submission (verdict: Runtime Error):
def combination_list(n, mod=10**9+7):
    lst = [1]
    for i in range(1, n+1):
        lst.append(lst[-1] * (n+1-i) % mod * pow(i, mod-2, mod) % mod)
    return lst

n, k = map(int, input().split())
mod = 10**9+7

fst = combination_list(n-k+1, mod)
scd = combination_list(k-1, mod)

for i in range(1, k+1):
    print(fst[i] * scd[i-1] % mod)
Problem p02987 (python)

Fixed submission:
s = input()
sorted_s = sorted(s)
if sorted_s[0] == sorted_s[1] and sorted_s[1] != sorted_s[2] and sorted_s[2] == sorted_s[3]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
count_dic = {}
for a in s:
  if not a in count_dic:
    count_dic[a] = 1
  else:
    count_dic[a] += 1

  for v in count_dic.values():
    if v != 2:
      return False
  return True
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h_list = []
for i in range(n):
    h_list.append(int(input()))
h_list.sort()
min = h_list[-1]
for j in range(n-k+1):
    if min > h_list[j+k-1] - h_list[j]:
        min = h_list[j+k-1] - h_list[j]

print(min)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h_list = []
for i in range(n):
    h_list.append(int(input()))
h_list.sort()
min = 10**10
for j in range(n-k+1):
    if min > h_list[j+2] - h_list[j]:
        min = h_list[j+2] - h_list[j]

print(min)
Problem p02689 (python)

Fixed submission:
from collections import deque
n,m=[int(_) for _ in input().split()]
H=[int(_) for _ in input().split()]
Hlist=deque(deque() for a in range(n))
count=0
for a in range(m):
    a,b=[int(_) for _ in input().split()]
    Hlist[a-1].append(b-1)
    Hlist[b-1].append(a-1)
for i,j in enumerate(Hlist):
    flag=1
    for a in j:
        if H[a]>=H[i]:
            flag=0
    if flag==1:
        count+=1
    flag=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m=[int(_) for _ in input().split()]
H=[int(_) for _ in input().split()]
Hlist=[(set() for a in range(n))]
count=0
for a in range(m):
    a,b=[int(_) for _ in input().split()]
    Hlist[a-1].add(b-1)
    Hlist[b-1].add(a-1)
for i,j in enumerate(Hlist):
    flag=1
    for a in j:
        if H[a]>=H[i]:
            flag=0
    if flag==1:
        count+=1
    flag=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m=[int(_) for _ in input().split()]
H=[int(_) for _ in input().split()]
Hlist=[(set() for a in range(n))]
count=0
for a in range(m):
    a,b=[int(_) for _ in input().split()]
    Hlist[a-1].add(b-1)
    Hlist[b-1].add(a-1)
for i,j in enumerate(Hlist):
    flag=1
    for a in j:
        if H[a]>=H[i]:
            flag=0
    if flag==1:
        count+=1
    flag=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
li = []
h=list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
        li.append(a)
    elif h[a-1]==h[b-1]:
        li.append(a)
        li.zppend(b)
    else:
        li.append(b)
print(n-len(set(li)))
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a=[list(input())for i in range(n)]
b=[list(input())for j in range(m)]
for i in range(n-m+1):
    for x in range(n-m+1):
        if a[i][x:x+m]==b[0]:
            flag=1
            for j in range(0,m):
                if a[i+j][x:x+m]!=b[j]:
                    flag=0
            if flag:
                print("Yes")
                exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(input())for i in range(n)]
b=[list(input())for j in range(m)]
for i in range(n-m):
    for x in range(n-m):
        if a[i][x:x+m]==b[i]:
            flag=1
            for j in range(1,m):
                if a[i+j][x:x+m]!=b[i+j]:
                    flag=0
            if flag:
                print("Yes")
                exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(input())for i in range(n)]
b=[list(input())for j in range(m)]
for i in range(m):
    for x in range(n-m):
        if a[i][x:x+m]==b[i]:
            flag=1
            for j in range(1,m):
                if a[i+j][x:x+m]!=b[i+j]:
                    flag=0
            if flag:
                print("Yes")
                exit()
print("No")
Problem p03834 (python)

Fixed submission:
print(input().replace(","," "))

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
count=0
for a in range(0,x[0]+1):
    for b in range(0,x[0]+1):
        for c in range(0,x[0]+1):
            if(a+b+c==x[1]):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
count=0
for a in range(0,x[0]+1):
    for b in range(0,x[0]+1):
        for c in range(0,x[0]+1):
            if(a+b+c==x[1]):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
count=0
for a in range(0,x[1]+1):
    for b in range(0,x[0]+1):
        for c in range(0,x[0]+1):
            if(a+b+c==x[1]):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
count=0
for a in range(0,x[1]+1):
    for b in range(0,x[0]+1):
        for c in range(0,x[0]+1):
            if(a+b+c==x[1]):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split()))
count=0
for a in range(0,x[1]):
    for b in range(0,x[0]+1):
        for c in range(0,x[0]+1):
            if(a+b+c==x[1]):
                count+=1
print(count)
Problem p02754 (python)

Fixed submission:
# -*- coding: utf-8 -*-

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

temp = n // (a + b)
amari = n % (a + b)
result = temp * a

if amari >= a:
    result += a
else:
    result += amari

print(result)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

temp_plus = ("1" * a) + ("0" * b)
temp = ""
while len(temp) <= n:
    temp += temp_plus

print(temp[0:n].count("1"))