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

Fixed submission:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
ap,an=[],[]
zeronum=0
for i in range(n):
  if a[i]>0:
    ap.append(a[i])
  elif a[i]<0:
    an.append(-a[i])
  else:
    zeronum+=1
np,nn=len(ap),len(an)
def fminus(x):
  j=0
  cnt=0
  for i in range(np):
    cnt+=j
    while j<nn and an[j]*ap[i]>=x:
      j+=1
      cnt+=1
  return cnt
def fplus(x,length,lis):
  r=length-1
  cnt=0
  for l in range(length):
    while lis[r]*lis[l]>x:
      if r==l:
        break
      r-=1
    if r==l:
      break
    elif lis[r]*lis[l]<=x:
      cnt+=r-l
  return cnt
if np*nn<k<=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn):
  print(0)
else:
  #print(ap)
  #print(an)
  if k<=np*nn:
    an.sort(reverse=True)
    ap.sort()
    ng=10**18
    ok=0
    while ng-ok>1:
      mid=(ok+ng)//2
      if fminus(mid)>=k:
        ok=mid
      else:
        ng=mid
    print(-ok)
  else:
    an.sort()
    ap.sort()
    k-=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn)
    #print(k)
    ok=10**18
    ng=0
    #print(ok,ng)
    while ok-ng>1:
      mid=(ok+ng)//2
      if fplus(mid,nn,an)+fplus(mid,np,ap)>=k:
        ok=mid
      else:
        ng=mid
    print(ok)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
ap,an=[],[]
zeronum=0
for i in range(n):
  if a[i]>0:
    ap.append(a[i])
  elif a[i]<0:
    an.append(-a[i])
  else:
    zeronum+=1
np,nn=len(ap),len(an)
def fminus(x):
  j=0
  cnt=0
  for i in range(np):
    cnt+=j
    while j<np and an[j]*ap[i]>=x:
      j+=1
      cnt+=1
  return cnt
def fplus(x,length,lis):
  r=length-1
  cnt=0
  for l in range(length):
    if r==l:
      break
    while lis[r]*lis[l]>x:
      if r==l:
        break
      r-=1
    if lis[r]*lis[l]<=x:
      cnt+=r-l
  return cnt
if np*nn<k<=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn):
  print(0)
else:
  #print(ap)
  #print(an)
  if k<=np*nn:
    an.sort(reverse=True)
    ap.sort()
    ng=10**18
    ok=0
    while ng-ok>1:
      mid=(ok+ng)//2
      if fminus(mid)>=k:
        ok=mid
      else:
        ng=mid
    print(-ok)
  else:
    an.sort()
    ap.sort()
    k-=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn)
    #print(k)
    ok=10**18
    ng=0
    #print(ok,ng)
    while ok-ng>1:
      mid=(ok+ng)//2
      if fplus(mid,nn,an)+fplus(mid,np,ap)>=k:
        ok=mid
      else:
        ng=mid
    print(ok)
Problem p02782 (python)

Fixed submission:
r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    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 = 2*10**6+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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 )
print((cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod)+mod)%mod)

Buggy submission (verdict: Runtime Error):
r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    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**6+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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 )
print((cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod)+mod)%mod)

Buggy submission (verdict: Runtime Error):
r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    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**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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 )
print((cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod)+mod)%mod)

Buggy submission (verdict: Runtime Error):
r1,c1,r2,c2=map(int,input().split())
def cmb(n, r, mod):
    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**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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 )
print(cmb(c2+r2+2,c2+1,mod)-cmb(c2+r1+1,c2+1,mod)-cmb(c1+r2+1,c1,mod)+cmb(c1+r1,c1,mod))
Problem p02783 (python)

Fixed submission:
from math import ceil
h,a=map(int,input().split())
print(ceil(h/a))

Buggy submission (verdict: Runtime Error):
from math import ceil
from bisect import bisect_right
n,d,a=map(int,input().split())
lis=[list(map(int,input().split())) for i in range(n)]
x=[]
lis.sort()
for i in range(n):
  x.append(lis[i][0])
ran,ans,cnt=2*d,0,0
s=[0]*(n+1)
for i in range(n):
  r=lis[i][0]+ran
  inde=bisect_right(x,r)
  if inde!=i+1:
    if ceil(lis[i][1]/a)>cnt:
      s[inde]-=ceil(lis[i][1]/a)-cnt
      s[i]+=ceil(lis[i][1]/a)-cnt
      cnt=ceil(lis[i][1]/a)
  else:
    if ceil(lis[i][1]/a)>cnt:
      s[i]+=ceil(lis[i][1]/a)-cnt
      cnt=0
for i in range(n-1):
  s[i+1]+=s[i]
print(max(s))
Problem p02788 (python)

Fixed submission:
from bisect import bisect_left as lower_bound
from bisect import bisect_right as upper_bound
import math
n,d,a=map(int,input().split())
X, H=[], []; ans=0; L=[]
for i in range(n):
  x,h=map(int,input().split())
  L.append((x,h))
L.sort()
for x,h in L:
  X.append(x); H.append(h)
X.append(10**9); H.append(10**9)
imos=[0]*(n+5)
de=0 # decrease count
for i in range(n):
  de+=imos[i]
  HP=H[i]-de*a
  # 右から貪欲にダメージを減らす
  # 敵の体力が残ってるとき
  # print("HP is",HP)
  if HP>0:
    atk_cnt=math.ceil(HP/a) # 何回殴る必要があるか
    de+=atk_cnt
    ans+=atk_cnt
    index=upper_bound(X,X[i]+2*d)
    # print(X,X[i]+2*d)
    # print(index, atk_cnt)
    imos[index]-=atk_cnt
print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil
from bisect import bisect_right
n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
imos=[0]*(n+1)
x=[]
for i in range(n):
  x.append(xh[i][0])
ans,cnt=0,0
for i in range(n):
  cnt+=imos[i]
  hp=xh[i][1]-cnt*a
  if hp>0:
    cnt+=ceil(hp/a)
    ans+=ceil(hp/a)
  imos[bisect_right(x,x[i]+2*d)]-=ceil(hp/a)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil
from bisect import bisect_right
n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
imos=[0]*(n+1)
x=[]
for i in range(n):
  x.append(xh[i][0])
ans,cnt=0,0
for i in range(n):
  cnt+=imos[i]
  hp=xh[i][1]-cnt*a
  if hp>0:
    cnt+=ceil(hp/a)
    ans+=ceil(hp/a)
  imos[bisect_right(x,x[i]+2*d)]-=ceil(hp/a)
print(ans)
Problem p02789 (python)

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
P = 10**9 + 7
N = 1000001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]
n=int(input())
a=list(map(int,input().split()))
lcm=a[0]
mod=10**9+7
for i in range(1,n):
  lcm=(lcm//gcd(lcm,a[i]))*(a[i]//gcd(lcm,a[i]))*gcd(lcm,a[i])
ans=0
for i in range(n):
  ans+=lcm*inv[a[i]]%mod
print(ans%mod)
Problem p02814 (python)

Fixed submission:
from fractions import gcd
from math import ceil
n,m=map(int,input().split())
a=list(map(int,input().split()))
c=len(bin(a[0]))-bin(a[0]).rfind("1")
for i in range(1,n):
  if c!=len(bin(a[i]))-bin(a[i]).rfind("1"):
    print(0)
    exit()
g=a[0]
for i in range(n-1):
   g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1])
g//=2
print(ceil((m//g)/2))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from math import ceil
n,m=map(int,input().split())
a=list(map(int,input().split()))
c=len(bin(a[0]))-bin(a[0]).rfind("1")
for i in range(1,n):
  if c!=len(bin(a[i+1]))-bin(a[i+1]).rfind("1"):
    print(0)
    exit()
g=a[0]
for i in range(n-1):
   g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1])
g//=2
print(ceil((m//g)/2))
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
from math import ceil
x=int(input())
i=0
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    ok=True
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
        break
    if ok:
      print(x+i)
      exit()
    i+=1

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
print(t+s)
Problem p02837 (python)

Fixed submission:
n=int(input())
ans=0
g=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    g[i][x-1]=y
for i in range(2**n):
  ok=True
  for j in range(n):
    if (i>>j)&1:
      for k in range(n):
        if g[j][k]==-1:
          continue
        if (i>>k)&1!=g[j][k]:
          ok=False
  if ok:
    d=i
    t=str(bin(d)).count('1')
    ans=max(t,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
g[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    g[i][x-1]=y
for i in range(2**n):
  ok=True
  for j in range(n):
    if (i>>j)&1:
      for k in range(n):
        if g[j][k]==-1:
          continue
        if (i>>j)&1!=g[j][k]:
          ok=False
  if ok:
    d=str(bin(i))
    t=d.count('1')
    ans=max(t,ans)
print(ans)
Problem p02843 (python)

Fixed submission:
x=int(input())
if (x//100)*105>=x:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x=int(input())
dp=[0]*(x+1)
dp[0]=1
for i in range(1,x+1):
  if i-100>=0 and dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
    dp[i]=1
  else:
    dp[i]=0
print(dp[x])

Buggy submission (verdict: Runtime Error):
x=int(input())
dp=[]*x
dp[0]=1
for i in range(1,x):
  if i-100>=0 and dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
    dp[i]=1
  else:
    dp[i]=0
print(dp[x-1])
Problem p02861 (python)

Fixed submission:
import math
n=int(input())
z=[list(map(int,input().split())) for i in range(n)]
a=math.factorial(n)
b=0
for i in range(n):
  for j in range(n):
    b=b+((z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2)**0.5
print((math.factorial(n)/n)*b/a)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
z=[list(map(input().split())) for i in range(n)]
a=math.factorial(n)
for i in range(n-1):
  for j in range(i,n):
    b=(z[i][0]-z[j][0])**2+(z[i][1]-z[j][1])**2
print(b**0.5/a)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
if x>=(a**2*b)/2:
  print(math.degrees(math.acos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.acos((2*x/a/b)/(((2*x/a/b)**2+b**2)**0.5))))

Buggy submission (verdict: Runtime Error):
import numpy
a,b,x=map(int,input().split())
if x>=2/a**2*b:
  print(math.degrees(numpy.arccos(a/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(numpy.arccos((2*x/a/b)/((2*x/a/b)**2+b**2)**0.5)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if x>=2/a**2*b:
  print(math.degrees(math.asin(2*(a**2*b-x)/((2*(a**2*b-x)/a**2)**2+a**2)**0.5)))
else:
  print(math.degrees(math.asin(b/((2*x/a/b)**2+b**2)**0.5)))
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2＊b>0:
  print(a-2＊b)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2＊b>0:
  print(a-2b)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a-2b>0:
  print(a-2b)
else:
  print(0)
Problem p02886 (python)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
hp=0
for i in range(n-1):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n-1):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            if j<n:
                hp=hp+d[i]*d[j]
print(hp)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
           if i<j: 
               hp=hp+d[i]*d[j]
print(hp)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split())
hp=0
for i in range(n):
       for j in range(i+1,n):
            hp+=d[i]*d[j]
print(hp)
Problem p02888 (python)

Fixed submission:
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
    cnt+=c-1-j
print(cnt)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    c=bisect.bisect_left(l,a+b)
      cnt+=c-1-j
print(cnt)
Problem p02899 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[1]+1,end=" ")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[[a[i],i] for i in range(n)]
b.sort()
for i in b:
  print(i[i]+1,end=" ")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=(list(map(int,input().split()))
b=list()
for i in range(n):
  b.append(1+a.index(1+i))
print(*b)
Problem p02909 (python)

Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
s=input()
if s='Sunny':
  print('Cloudy')
elif s='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Problem p02910 (python)

Fixed submission:
s=input()
ng=False
for i in range(len(s)):
  if i%2==0:
    if s[i]=='L':
      ng=True
  else:
    if s[i]=='R':
      ng= True
if ng:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
ng=False
for i in range(n):
  if i%2==0:
    if s[i]=='R':
      ng=True
  else:
    if s[i]=='L':
      ng= True
if ng:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
ng=False
for i in range(n):
  if i%2=0:
    if s[i]=='R':
      ng=True
  else:
    if s[i]=='L':
      ng= True
if ng:
  print('No')
else:
  print('Yes')
Problem p02921 (python)

Fixed submission:
s=input()
t=input()
cnt=0
for i in range(3):
  if s[i]==t[i]:
    cnt+=1
print(cnt)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=(n-1)*n/2
print(int(a))
Problem p02934 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=0
for i in a:
  s+=1/i
print(1/s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(a):
  s+=1/i
print(1/s)
Problem p02947 (python)

Fixed submission:
n=int(input())
s=[input() for i in range(n)]
dic={}
l=list()
cnt=0
for i in range(n):
  k=sorted(s[i])
  t=''.join(k)
  l.append(t)
  if l[i] in dic:
    dic[l[i]]+=1
  else:
    dic[l[i]]=0
c=list(dic.values())
for i in range(len(c)):
   cnt+=c[i]*(c[i]+1)//2
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[input() for i in range(1,n+1)]
dic={}
l=list()
cnt=0
for i in range(n):
  s[i].sort()
  s=''.join(s[i])
  l.append(s)
  if l[i] in dic:
    cnt+=1
  else:
    dict[l[i]]=1
print(cnt)
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[n-1])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if l[i]>l[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]>h[i]+1:
    cnt=1
if cnt==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
for i in range(n):
  if h[i+1]>h[i]+1:
    print('No')
    exit()
print('Yes')
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
Problem p02972 (python)

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

#箱の状態を記録しておく配列
box=[0]*n


for i in range(n):
  num=n-i

  #まず割って、その数より大きい倍数がいくつあるか探る
  baisu=n//num

  if baisu==1:
    box[num-1]=a[num-1]

  #1～baisu倍の箱の状態を調べる。
  temp=0
  for j in range(2,baisu+1):
    temp+=box[num*j-1]
  box[num-1]=abs(temp%2-a[num-1])

ans=[]
for i in range(n):
  if box[i]==1:
    ans.append(i+1)

if sum(ans)!=0:
  print(len(ans))
  print(*ans)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
box=[0]*n
for i in range(n):
  baisu=n%(n-i)
  if baisu==1:
    box[n-i-1]=a[n-i-1]
  else:
    cnt=0
    for j in range(2,baisu+1):
      cnt+=box[(n-i-1)*j]
    if cnt%2!=a[n-i-1]:
      box[n-i-1]=1
print(sum(box))
if sum(box)!=0:
  for i in range(n):
    if box[i]==1:
      print(i+1,end=' ')
Problem p02993 (python)

Fixed submission:
s=input()
for i in range(3):
  if s[i]==s[i+1]:
    print('Bad')
    exit()
print('Good')

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if k>((n-2)*(n-1))//2:
  print(-1)
else:
  ans=[]
  for a in range(1):
    for b in range(a+1,n):
        ans.append([a+1,b+1])
  i,j,cnt=2,3,0
  while cnt<((n-2)*(n-1))//2-k:
    while j<=n:
      ans.append([i,j])
      j+=1
      cnt+=1
      if cnt==((n-2)*(n-1))//2-k:
        break
    i+=1
  print(len(ans))
  for i in range(len(ans)):
    print(*ans[i])

Buggy submission (verdict: Runtime Error):
import fractions
a,b,c,d=map(int,input().split())
print(b-a+1-(b//c-(a-1)//c+b//d-(a-1)//d-b//(c*d/fractions.gcd(c,d))+(a-1)//(c*d/fractions.gcd(c,d))))

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(3):
  if s[i]=s[i+1]:
    print('Bad')
    exit()
print('Good')
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
print(b-a+1-(b//c-(a-1)//c+b//d-(a-1)//d-b//int((c*d/fractions.gcd(c,d)))+(a-1)//int((c*d/fractions.gcd(c,d)))))

Buggy submission (verdict: Runtime Error):
import fraction
a,b,c,d=map(int,input().split())
print(b-a+1-(b//c-(a-1)//c+b//d-(a-1)//d-b//(c*d/fraction.gcd(c,d))+(a-1)//(c*d/fraction.gcd(c,d))))
Problem p03030 (python)

Fixed submission:
from operator import itemgetter
n=int(input())
l=[[] for i in range(n)]
for i in range(n):
  s,p=input().split()
  l[i].append(s)
  l[i].append(int(p))
  l[i].append(i+1)
l2=sorted(l,key=itemgetter(1),reverse=True)
l3=sorted(l2,key=itemgetter(0))
for i in range(n):
  print(l3[i][2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n=int(input())
l=[map(int,input().split()) for i in range(n)]
for i in range(n):
  l[i].append(i+1)
l2=sorted(l)
l3=sorted(l2,key=itemgetter(1),reverse=True)
for i in range(n):
  print(l3[i][2])
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)
Problem p03067 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a<c<b or b<c<a
  print('Yes')
else:
  print('No')
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=int(input())
s_=str()
for i in range(n):
  if s[i]!=s[k-1]:
    s_+='*'
  else:
    s_+=s[i]
print(s_)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
s_=str()
for i in range(n):
  if s[i]!=s[k+1]:
    s_+='*'
  else:
    s_+=s[i]
Problem p03069 (python)

Fixed submission:
n=int(input())
s=input()
accum=[0]*n
if s[0]=="#":
    accum[0]=1
for i in range(n-1):
    accum[i+1]+=accum[i]+(s[i+1]=="#")
accum=[0]+accum
ans=10**18
for i in range(n+1):
    ans=min(ans,accum[i]+n-i-accum[n]+accum[i])
#print(accum)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
l=list()
if '#' in s:
  for i in range(n):
    if s[i]=='#':
      l.append(i)
  for i in range(len(l)-1):
    if l[i+1]-l[i]>=2:
      cnt=l[i+1]
  if (cnt-l[0]+1)//2>l.index(cnt)+1:
    print(l.index(cnt)+1)
  else:
    print(cnt-l[0]-l.index(cnt))
else:
  print(0)
Problem p03076 (python)

Fixed submission:
lis=[]
for i in range(5):
    x=int(input())
    if x%10!=0:
        lis.append([x%10,x])
    else:
        lis.append([10,x])
lis1=sorted(lis,reverse=True)
t=0
for i in range(4):
    if lis1[i][0]!=0:
        t+=lis1[i][1]+10-lis1[i][0]
    else:
        t+=lis1[i][1]
print(t+lis1[4][1])

Buggy submission (verdict: Runtime Error):
lis=[]
for i in range(5):
    x=int(input())
    lis.append([x%10,x])
lis.sort()
t=0
for i in range(4):
    t+=lis[i,1]+10-lis[i,0]
print(t+lis[4,1])
Problem p03086 (python)

Fixed submission:
s=input()
cnt=0
t=0
for i in range(len(s)):
  if s[i]=='A' or s[i]=='T' or s[i]=='C' or s[i]=='G':
    t+=1
    cnt=max(t,cnt)
  else:
    t=0
print(cnt)

Buggy submission (verdict: Runtime Error):
s=input()
cnt=0
lis=[]
for i in range(len(s)):
  if s[i]=='A' or s[i]=='T' or s[i]=='C' or s[i]=='G':
    cnt+=1
  else:
    lis.append(cnt)
    cnt=0
print(max(lis))