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

Fixed submission:
from itertools import accumulate
N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K+1):
    ans.append(B[i+K]-B[i])
print(max(ans))

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

rui=[0]
for i in a:
  rui.append(rui[-1]+i)
hantei=0
for i in range(1,len(rui)-k):
  if hantei<=rui[i+k]-rui[i]:
    hantei=rui[i+k]-rui[i]
    l=i
    r=i+k
ans=0
for i in range(l,r):
  ans+=(a[i]+1)/2
  
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K):
    ans.append(B[i+K]-B[i])

print(max(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
d=[]
ans=0
for i in range(n-k+1):
  ans+=(1+p[i])/2
  ans+=(1+p[i+1])/2
  ans+=(1+p[i+2])/2
  ans+=(1+p[i+3])/2
  d.append(ans)
  ans=0
  
print(max(d))
Problem p02789 (python)

Fixed submission:
n,m=map(int,input().split())
if n>m:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n>m:
  print("No")
else:
  print("Yes)
Problem p02844 (python)

Fixed submission:
n=int(input())
x=input()
ans=0
for i in range(0,10):
  k=0
  ss="00"+str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
for i in range(10,100):
  k=0
  ss="0"+str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
for i in range(100,1000):
  k=0
  ss=str(i)
  for j in x:
    if k<3 and j==ss[k]:
      k+=1
  if k==3:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
count=0
count2=0
d=[]
hk3=0
hk2=0
hk1=0
for j in range(100,1000):
  k3=j//100
  k2=(j-k3*100)//10
  k1=j-k3*100-k2*10
  for i in range(n):
    if str(k3)==s[i]:
      hk3=1
    if str(k2)==s[i] and hk3==1:
      hk2=1
    if str(k1)==s[i] and hk2==1:
      hk1=1
    if hk1==1 and hk2==1 and hk3==1:
      d.append(j)
  hk1=0
  hk2=0
  hk3=0
for j in range(1,10):
  for i in range(n):
    if s[i]=="0":
      count=1
    if count==1 and s[i]=="0":
      count2=1
    if count2=0 and s[i]==str(j):
      d.append(j)
  count=0
  count2=0
for j in range(10,100):
  k2=j//10
  k1=j-k2*10
  for i in range(n):
    if s[i]=="0":
      count=1
    if str(k2)==s[i] and count=1:
      hk2=1
    if str(k1)==s[i] and hk2==1 and count=1:
      hk1=1
    if hk1==1 and hk2==1:
      d.append(j)
  count=0
  hk1=0
  hk2=0
print(len(set(d)))
Problem p02850 (python)

Fixed submission:
from collections import deque
n=int(input())
edge=[[] for i in range(n+1)]
ab=[]
ans=dict()
for i in range(n-1):
  a,b=map(int,input().split())
  ab.append([a,b])
  ans[(a,b)]=0
  edge[a].append(b)
  edge[b].append(a)
hantei=0  
for i in edge:
  if hantei<len(i):
    hantei=len(i)
iro=hantei
print(iro)
color_list=[0]*(n+1)
def bfs(x,ans):
  qu=deque([])
  qu.append(1)
  count=1
  while qu:
    now=qu.popleft()
    if now!=1:
      pre=qu.popleft()
    else:
      pre=0
    count=1
    for i in edge[now]:
      if i!=pre:
        qu.append(i)
        qu.append(now)
        if now!=1 and ans[(pre,now)]==count:
          count+=1
        ans[(now,i)]=count
        count+=1
  return ans
bfs(1,ans)
for i,j in ab:
  print(ans[(i,j)])

Buggy submission (verdict: Runtime Error):
n=int(input())
ab=[list(map(int,input().split())) for i in range(n-1)]
edge=[[] for i in range(n+1)]
iro=0
for i in ab:
  edge[i[0]].append(i[1])
for i in edge:
  if (len(i)+1)>iro:
    iro=len(i)+1
color_list=list(range(1,iro+1))
ans=[[] for i in range(n+1)]
def DFS(x,pre,color,color_list,ans):
  count=-1
  color_list=list(range(1,iro+1))
  if len(edge[x])==0:
    #print(str(pre) + "→"+ str(x) +":" + str(color))
    ans[pre].append(color)
    return
  elif 1!=x:
    #print(str(pre) + "→"+ str(x) +":" + str(color))
    ans[pre].append(color)
  for i in edge[x]:
    a=color_list.pop(-1)
    if a==color:
      a=color_list.pop(-1)
    DFS(i,x,a,color_list,ans)
    
DFS(1,-1,iro,color_list,ans)
for i in ans:
  for j in i:
    print(j)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
ans=0
flag=False
if x==a*a*b/2:
  ans=a/b
elif x<a*a*b/2:
  t=a-2*x/(a*b)
  ans=(a-t)/b
else:
  t=2*x/(a**2)-b
  if (b-t)!=0:
    ans=a/(b-t)
  else:
    flag=True
if flag==False:
  print(90-math.degrees(math.atan(ans)))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
ans=0
flag=False
if x==a*a*b/2:
  ans=a/b
elif x<a*a*b/2:
  t=a-2*x/(a*b)
  ans=(a-t)/b
else:
  t=2*x/(a**2)-b
  if (b-t)!=0:
    ans=a/(b-t)
  else:
    flag=True:
if flag==False:
  print(90-math.degrees(math.atan(ans)))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
ans=0

if x==a*a*b/2:
  ans=a/b
elif x<a*a*b/2:
  t=a-2*x/(a*b)
  ans=(a-t)/b
else:
  t=2*x/(a**2)-b
  ans=a/(b-t)

print(90-math.degrees(math.atan(ans)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
x=x/a
d=(3*x)/b
X=x/3

if b<=x:
  atan1 = math.degrees(math.atan(a/(2*b-(2*x)/a)))
elif b>x:
  atan1 = math.degrees(math.atan(b/d))
                       
print(atan1)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
x=x/a
d=(3*x)/b
X=x/3

if b<=x:
  atan1 = math.degrees(math.atan(a/(2*b-(2*x)/a)))
else:
  atan1 = math.degrees(math.atan(d/b))
                       
print(90-atan1)
Problem p02900 (python)

Fixed submission:
a,b=map(int,input().split())
def prime_factorize(n):
  a=[]
  while n%2==0:
    a.append(2)
    n//=2
  f=3
  while f*f<=n:
    if n%f==0:
      a.append(f)
      n//=f
    else:
      f+=2
  if n!=1:
    a.append(n)
  return a
print(1+len(set(prime_factorize(a))&set(prime_factorize(b))))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = []
for i in range(2,min(a,b)+1):
    if a % i == 0 and b % i == 0:
       c.append(i)
for k in range(len(c)):
    for j in range(len(c)):
        if (c[k])%(c[j])==0:
           if c[k] != c[j]:
              c.pop(k)

c.append(1)
print(c)
Problem p02923 (python)

Fixed submission:
n = int (input())
h = list(map(int,input().split()))
count_list = []
count=0
for i in range(n):
   if i == n-1:
      break
   if h[i] >= h[i+1]:
      if count !=0:
         count +=1
      else:
         count = 1
   else:
      count = 0
   count_list.append(count)
if not count_list:
   count_list.append(0)
print(max(count_list))

Buggy submission (verdict: Runtime Error):
n = int (input())
h = list(map(int,input().split()))
count_list = []
count=0
for i in range(n):
   if i == n-1:
      break
   if h[i] >= h[i+1]:
      if count !=0:
         count +=1
      else:
         count = 1
   else:
      count = 0
   count_list.append(count)
print(max(count_list))
Problem p02924 (python)

Fixed submission:
n=int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(range(1,n))
print(sum(d))
Problem p02947 (python)

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  s="".join(s)
  d.append(s)
d.sort()

def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)


x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)
ans=[]
for i in range(len(x)):
  if x[i]>1:
    ans.append(kaijou(x[i])/2)
  else:
    ans.append(0)
    
    
print(int(sum(ans)))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  s="".join(s)
  d.append(s)
d.sort()

def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)


x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
    
    
print(int(sum(x)))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  d.append(s)
d.sort()
def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)
x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
print(int(sum(x)))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  d.append(s)
d.sort()
def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)
x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

print(d)
print(x)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
print(sum(x))
Problem p02971 (python)

Fixed submission:
n=int(input())
d=[]
for i in range(n):
  d.append(int(input()))
x=sorted(d)
for j in range(n):
  if d[j]==x[-1]:
    print(x[-2])
  else:
    print(x[-1])

Buggy submission (verdict: Runtime Error):
import heapq
n=int(input())
d=[]
for i in range(n):
  heapq.heappush(d,int(input()))
for j in range(n):
  if d[j]==d[n-1]:
    print(x[n-2])
  else:
    print(x[n-1])
Problem p03076 (python)

Fixed submission:
b=10
d=[]
ans=[]
k=-10000
for i in range(5):
  a=int(input())
  d.append(a)
  if b>a%10 and a%10!=0:
    b=a%10
    k=i
  if a%10==0:
    ans.append(a)
  else:
    ans.append((a//10+1)*10)
if k!=-10000:
  ans[k]=d[k]
print(sum(ans))

Buggy submission (verdict: Runtime Error):
b=10
d=[]
ans=[]
for i in range(5):
  a=int(input())
  d.append(a)
  if b>a%10 and a%10!=0:
    b=a%10
    k=i
  if a%10==0:
    ans.append(a)
  else:
    ans.append((a//10+1)*10)
ans[k]=d[k]
print(sum(ans))
Problem p03163 (python)

Fixed submission:
def DP():
    n,W = map(int, input().split(' '))
    WV = (map(int, input().split(' ')) for _ in range(n))
    dp = [0] * (W+1)

    for w, v in WV:
        for j in range(W, w-1, -1):
            DP = dp[j-w] + v
            if dp[j] < DP:
                dp[j] = DP
    return max(dp)
print(DP())

Buggy submission (verdict: Runtime Error):
import numpy
def DP():
  n,m=map(int,input().split())
  dp=[0]*(m+2)
 
  for i in range(n):  #商品を一つずつ見ていく。
    w,v=(map(int,input().split()))
    for j in range(m+1,w,-1): #w~(限界-w)までのdpの箱に入れていく。(例)w,m=3,8なら3~5
      dp[j]=max(dp[j-w]+v,dp[j])
  return max(dp)
print(DP())
Problem p03238 (python)

Fixed submission:
n=int(input())

if n==2:
  a=int(input())
  b=int(input())
  print(a+b)
else:
  print("Hello World")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())

if n==2:
  print(a+b)
else:
  print("Hello World")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())

if n>1:
  print(a+b)
else:
  print("Hello World")
Problem p03243 (python)

Fixed submission:
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]
flag=False

for i in range(0,9):
  if int(a_list[i])==n:
    print(a_list[i])
    flag=True
    break
  elif n < 111:
    print("111")
    break
if flag==False:
  for i in range(0,8):
    if int(a_list[i])< n < int(a_list[i+1]):
      print(a_list[i+1])
      break

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]
flag=False

for i in range(1,10):
  if int(a_list[i])==n:
    print(a_list[i])
    flag=True
    break
if flag==False:
  for i in range(1,9):
    if int(a_list[i])< n < int(a_list[i+1]):
      print(a_list[i+1])
      break

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]

for i in range(1,9):
  if a_list[i]< n <= a_list[i+1]:
    print(a_list[i+1])
    break
  elif a_list[i]==n:
    print(a_list[i])
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]

for i in range(1,9):
  if a_list[i]< n <= a_list[i+1]:
    print(a_list[i+1])
    break
  elif a_list[i]= n:
    print(a_list[i])
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
a_list=[str(i)*3 for i in range(1,10)]

for i in range(1,9):
  if a_list[i]< n <= a_list[i+1]:
    print(a_list[i+1])
    break
  elif a_list[i]= n:
    print(a_list[i])
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
ans1=[0]*(10**5+1)#偶数
ans2=[0]*(10**5+1)#奇数
for i in v[0::2]:
  ans1[i]+=1
for i in v[1::2]:
  ans2[i]+=1
m1=max(ans1)
m2=max(ans2)
flag=False
for i in range(10**5+1):
  if ans1[i]==m1 and ans2[i]==m2:
    flag=True
    ans1.sort()
    ans2.sort()
    m12=ans1[-2]
    m22=ans2[-2]
    break
if len(set(v))==1:
  print(n//2)
elif flag==True:
  print(n-max(m12+m2,m1+m22))
else:
  print(n-m1-m2)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
ans1=[0]*(10**5+1)#偶数
ans2=[0]*(10**5+1)#奇数
for i in v[0::2]:
  ans1[i]+=1
for i in v[1::2]:
  ans2[i]+=1
m1=max(ans1)
m2=max(ans2)
flag=False
for i in range(10**5+1):
  if ans1[i]==m1 and ans2[i]==m2:
    flag=True
    ans1.sort()
    ans2.sort()
    m12=ans1[-2]
    m22=ans2[-2]
    break
print(m1,m12,m2,m22)
if len(set(v))==1:
  print(n//2)
elif flag==True:
  print(n-max(m12+m2,m1+m22))
else:
  print(n-m1-m2)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
ans1=[0]*(10**5+1)#偶数
ans2=[0]*(10**5+1)#奇数
for i in v[0::2]:
  ans1[i]+=1
for i in v[1::2]:
  ans2[i]+=1
m1=max(ans1)
m2=max(ans2)
flag=False
for i in range(10**5+2):
  if ans1[i]==m1 and ans2[i]==m2:
    falg=True
    ans1.sort()
    ans2.sort()
    m12=ans1[-2]
    m22=ans2[-2]
    break
if len(set(v))==1:
  print(n//2)
elif flag:
  print(n-max(m12+m1,m21+m2))
else:
  print(n-m1-m2)
Problem p03281 (python)

Fixed submission:
n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
  count=0
  for i in range(1,int(j**0.5)+1):
    if j%i==0:
      if j//i!=i:
        count+=2
      else:
        count+=1
  if count==8:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
  count=0
  for i in range(1,int(j**0.5)):
    if j%i==0 and j**0.5)==i:
      count+=1
    elif j%i==0 and j**0.5!=i:
      count+=2
  if count==8:
    ans+=1
print(ans)
Problem p03359 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a=<b:
  print(a)
else:
  print(a-1)
Problem p03380 (python)

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

if sai%2==0:
  b=sai//2
  hantei=10**9+1
  suuji=0
  for i in a:
    if abs(b-i)<hantei and i!=sai:
      hantei=abs(b-i)
      suuji=i
  print(sai,suuji)
else:
  b1=sai//2
  b2=sai//2+1
  hantei=10**9
  suuji=0
  for i in a:
    if min(abs(b1-i),abs(b2-i))<hantei:
      hantei=min(abs(b1-i),abs(b2-i))
      suuji=i
  print(sai,suuji)

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

if sai%2==0:
  b=sai//2
  hantei=10**9+1
  suuji=0
  for i in a:
    if abs(b-i)<hantei and i!=sai:
      hantei=abs(b-i)
      suuji=i
  print(sai,suuji)
else:
  b1=sai//2
  b2=sai//2+1
  hantei=10**9
  suuji=0
  for i in a:
    if min(abs(b1-i),abs(b2-i))<hantei:
      hantei=abs(b-i)
      suuji=i
  print(sai,suuji)
Problem p03386 (python)

Fixed submission:
a,b,k=map(int,input().split())
ans=[]
for i in range(a,k+a):
  if a<=i<=b:
    ans.append(i)
    
for i in range(b-k+1,b+1):
  if a<=i<=b:
    ans.append(i)
ans=list(set(ans))
ans.sort()
for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
ans=[]
for i in rangea(a,k+a):
  if a<=i<=b:
    ans.append(i)
    
for i in rangea(b-k+1,b+1):
  if a<=i<=b:
    ans.append(i)
ans=list(set(ans))
ans.sort()
for i in ans:
  print(i)
Problem p03417 (python)

Fixed submission:
n,m=map(int,input().split())
if (n==1 or m==1) and n!=m:
  print(n*m-2)
elif n==1 and m==1:
  print(1)
else:
  print((n-2)*(m-2))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if (n==1 or m==1 and) n!=m:
  print(n*m-2)
elif n==1 and m==1:
  print(1)
else:
  print((n-2)*(m-2))
Problem p03425 (python)

Fixed submission:
n=int(input())
march=[0,0,0,0,0]
for i in range(n):
  s=input()
  if s[0]=="M":
    march[0]+=1
  elif s[0]=="A":
    march[1]+=1
  elif s[0]=="R":
    march[2]+=1
  elif s[0]=="C":
    march[3]+=1
  elif s[0]=="H":
    march[4]+=1
finalans=0
for i in range(2**5):
  ans=1
  count=0
  for j in range(5):
    if ((i>>j)&1):
      ans*=march[j]
      count+=1
  if count!=3:
    ans=0
  finalans+=ans
print(finalans)

Buggy submission (verdict: Runtime Error):
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      int n = int.Parse(ReadLine());
      List<string> s = new List<string>();
      
      for (int i=0;i<n;i++)
      {
        s.Add(ReadLine());
      }
      var hashSet = new HashSet<string>(s);
      s = hashSet.ToList();
      List<int> ans = new List<int>();
      
      for (int i=0;i<5;i++)
      {
        ans.Add(0);
      }
      
      for (int i=0;i<s.Count;i++)
      {
        if (s[i].Substring(0,1)=="M")
        {
          ans[0]+=1;
        }
        else if (s[i].Substring(0,1)=="A")
        {
          ans[1]+=1;
        }
        else if (s[i].Substring(0,1)=="R")
        {
          ans[2]+=1;
        }
        else if (s[i].Substring(0,1)=="C")
        {
          ans[3]+=1;
        }
        else if (s[i].Substring(0,1)=="H")
        {
          ans[4]+=1;
        }
      }
      int answ=0;
      for (int i=0;i<5;i++)
      {
        for (int j=i+1;j<5;j++)
        {
          for (int k=j+1;k<5;k++)
          {
            if (i!=j && j!=k && i!=k)
            {
              answ+=ans[i]*ans[j]*ans[k];
            }
          }
        }
      }
      WriteLine(answ);
    }
}
Problem p03487 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
d=[0]*(10**5+1)
ans=0
for i in range(len(a)):
  if a[i]<=10**5:
    d[a[i]]+=1
  else:
    ans+=1
for i in range(1,len(d)):
  if d[i]>i:
    ans+=d[i]-i
  elif d[i]<i:
    ans+=d[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
d=[0]*(10**5+1)
ans=0
for i in range(len(a)):
  if d[i]<=10**5:
    d[a[i]]+=1
for i in range(1,len(d)):
  if d[i]>i:
    ans+=d[i]-i
  elif d[i]<i:
    ans+=d[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
d=[0]*(10**5+1)
ans=0
for i in range(len(a)):
  d[a[i]]+=1
for i in range(1,len(d)):
  if d[i]>i:
    ans+=d[i]-i
  elif d[i]<i:
    ans+=d[i]
print(ans)
Problem p03593 (python)

Fixed submission:
from collections import Counter
h,w=map(int,input().split())
#a=[list(input()) for i in range(w)]
a=[]
flag=True
for i in range(h):
  a+=list(input())
ca=Counter(a)
if h%2==0 and w%2==0:
  for i in ca:
    if ca[i]%4!=0:
      flag=False
      print('No')
      break
  if flag:
    print('Yes')

elif h%2!=0 and w%2!=0:
  yon=(h-1)*(w-1)
  ni=h*w-yon-1
  iti=1
  for i in ca:
    while ca[i]>0:
      if ca[i]%4==0 and yon>0:
        ca[i]-=4
        yon-=4
      elif ca[i]%2==0 and ni>0:
        ni-=2
        ca[i]-=2
      elif iti>0:
        iti-=1
        ca[i]-=1
      else:
        break
  if yon==0 and ni==0 and iti==0:
    print('Yes')
  else:
    print('No')
else:
  if h%2==0:
    yon=(h)*(w-1)
  else:
    yon=(h-1)*(w)
  ni=h*w-yon
  for i in ca:
    while ca[i]>0:
      if ca[i]%4==0 and yon>0:
        ca[i]-=4
        yon-=4
      elif ca[i]%2==0 and ni>0:
        ni-=2
        ca[i]-=2
      else:
        break
  if yon==0 and ni==0:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
from collections import Counter
h,w=map(int,input().split())
#a=[list(input()) for i in range(w)]
a=[]
flag=True
for i in range(h):
  a+=list(input())
ca=Counter(a)
if h%2==0 and w%2==0:
  for i in ca:
    if ca[i]%4!=0:
      flag=False
      print('No')
      break
  if flag:
    print('Yes')

elif h%2!=0 and w%2!=0:
  yon=(h-1)*(w-1)
  ni=h*w-yon-1
  iti=1
  for i in ca:
    while ca[i]>0
      if ca[i]%4==0 and yon>0:
        ca[i]-=4
        yon-=4
      elif ca[i]%2==0 and ni>0:
        ni-=2
        ca[i]-=2
      elif iti>0:
        iti-=1
        ca[i]-=1
      else:
        break
  if yon==0 and ni==0 and iti==0:
    print('Yes')
  else:
    print('No')
else:
  if h%2==0:
    yon=(h)*(w-1)
  else:
    yon=(h-1)*(w)
  ni=h*w-yon
  for i in ca:
    while ca[i]>0:
      if ca[i]%4==0 and yon>0:
        ca[i]-=4
        yon-=4
      elif ca[i]%2==0 and ni>0:
        ni-=2
        ca[i]-=2
      else:
        break
  if yon==0 and ni==0:
    print('Yes')
  else:
    print('No')
Problem p03636 (python)

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(a[0]+str(len(s)-2)+s[-1])
Problem p03637 (python)

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

for i in a:
  if i%4==0:
    count4+=1
  elif i%2==0:
    count2+=1

if count2<1:
  count1=len(a)-count4
else:
  count1=len(a)-count4-count2+1
if count1-count4<=1:
  print("Yes")
else:
  print("No")

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

for i in a:
  if i%4==0:
    count4+=1
  elif i%2==0:
    count2+=1

if count2==1:
  count1=len(a)-count4
else:
  count1=len(a)-count4-count2
if len(a)==1 and a[0]==2:
elif count1-count4<=1:
  print("Yes")
else:
  print("No")
Problem p03697 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)>=10:
  print("error")
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)>=10:
  print("error")
else:
  pirnt(a+b)

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

if a+b>=10:
  print("error")
else:
  print(a+b)
Problem p03711 (python)

Fixed submission:
n,m=map(int,input().split())
a=(1,3,5,7,8,10,12)
b=(4,6,9,11)
c=(2,)
if n in a and m in a:
  print("Yes")
elif n in b and m in b:
  print("Yes")
elif n in c and m in c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=(1,3,5,7,8,10,12)
b=(4,6,9,11)
c=(2)
flag=False
if n in a and m in a:
  flag=True
  print("Yes")
elif n in b and m in b:
  flag=True
  print("Yes")
elif n in c and m in c:
  flag=True
  print("Yes")
else:
  print("No")
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split())

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if c>=a andc<=b:
  print("Yes")
else:
  print("No")
Problem p03777 (python)

Fixed submission:
a,b=map(str,input().split())
if a!=b:
  print("D")
else:
  print("H")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a!=b:
  print("D")
else:
  print("H")
Problem p03778 (python)

Fixed submission:
w,a,b=map(int,input().split())
if (w+a)<b:
  print(b-w-a)
elif (b+w)<a:
  print(a-b-w)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
w,a,b=map(str,input().split())
if (w+a)<b:
  print(b-w-a)
else:
  print(0)
Problem p03796 (python)

Fixed submission:
#a,b=map(int,input().split())
n=int(input())
mod=10**9+7
#s=input()
ans=1
for i in range(1,n+1):
  ans*=(i%mod)
  ans%=mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
#a,b=map(int,input().split())
n=int(input())
#s=input()
ans=1
for i in range(n):
  ans*=(n%mod)
  ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
#a,b=map(int,input().split())
n=int(input())
#s=input()
ans=0
for i in range(n):
  ans*=(n%mod)
  ans%=mod
print(ans)