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

Fixed submission:
data = list(map(int, input().split()))
print (max(data) - min(data))

Buggy submission (verdict: Runtime Error):
data = lists(map(int, input().split()))
print (max(data) - min(data))
Problem p03293 (python)

Fixed submission:
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s))) else "No")

Buggy submission (verdict: Runtime Error):
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s)) else "No")
Problem p03294 (python)

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

print (sum(data) - n)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
data = list(map(int, input().split())
print (sum(data) - n)
Problem p03947 (python)

Fixed submission:
inp = raw_input().strip()
print len( [ i for i in range( len(inp)-1 ) if inp[i] != inp[i+1] ] )

Buggy submission (verdict: Runtime Error):
inp = input().strip()
print len( [ i for i in range( len(inp)-1 ) if inp[i] != inp[i+1] ] )

Buggy submission (verdict: Runtime Error):
inp = input().strip()
print len( [ for i in range( len(inp)-1 ) if inp[i] != inp[i+1] ] )
Problem p03000 (python)

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

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

Fixed submission:
from functools import reduce

def judge(S):
    if int(S) < 100:
        print(0)
        return

    kingaku = [int(x) for x in list(S)]
    maxkosuul = kingaku[:-2]
    keta = kingaku[-2:]
    maxkosuu = int(reduce(lambda x, y: x + y, [str(x) for x in maxkosuul]))
    simo = int(reduce(lambda x, y: x + y, [str(x) for x in keta]))
    simo1 = simo - simo//5*5
    simo2 = simo1 - simo1//4*4
    simo3 = simo2 - simo2//3*3
    simo4 = simo3 - simo3//2*2
    if simo//5+simo1//4+simo2//3+simo3//2+simo4 <= maxkosuu :
        print(1)
    else:
        print(0)

S = input()
judge(S)

Buggy submission (verdict: Runtime Error):
from functools import reduce

def judge(S):
    kingaku = [int(x) for x in list(S)]
    maxkosuul = kingaku[:-2]
    keta = kingaku[-2:]
    maxkosuu = int(reduce(lambda x, y: x + y, [str(x) for x in maxkosuul]))
    simo = int(reduce(lambda x, y: x + y, [str(x) for x in keta]))
    simo1 = simo - simo//5*5
    simo2 = simo1 - simo1//4*4
    simo3 = simo2 - simo2//3*3
    simo4 = simo3 - simo3//2*2
    if simo//5+simo1//4+simo2//3+simo3//2+simo4 <= maxkosuu :
        print(1)
    else:
        print(0)

S = input()
judge(S)
Problem p02848 (python)

Fixed submission:
def judge(S,N):
    a = [x for x in list(S)]
    lst = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
    mak = []
    llst = lst + lst
    for i in range(len(a)):
        for j in range(26):
            if a[i]==llst[j]:
                mak.append(llst[j+N])
    print("".join(mak))

N = int(input())
S = input()
judge(S,N)

Buggy submission (verdict: Runtime Error):
def judge(S,N):
    a = [x for x in list(S)]
    lst = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B"]
    mak = []
    llst = lst
    for i in range(len(a)):
        for j in range(25):
            if a[i]==lst[j]:
                mak.append(lst[j+N])
    print("".join(mak))

N = int(input())
S = input()
judge(S,N)
Problem p03470 (python)

Fixed submission:
N = int(input())
d = [int(input()) for i in range(N)]

# print(list(set(d)))
e = list(set(d))
print(len(e))

Buggy submission (verdict: Runtime Error):
N = int(input())
d = [int(input()) for i in range(N)]

print(list(set(d)))
e = list(set(d))
print(len(e))
N = int(input())
d = [int(input()) for i in range(N)]

# print(list(set(d)))
e = list(set(d))
print(len(e))
Problem p02848 (python)

Fixed submission:
N = int(input())
S = str(input())
 
res = list()
 
strings = [chr(i) for i in range(65, 65+26)]
for s in S:
  ind = strings.index(s) + N
  res.append(strings[ind % len(strings)])
  
print(''.join(map(str, res)))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())

res = list()

strings = [chr(ord('a').upper() + i) for i in range(26)]
for s in S:
  ind = strings.index(s) + N
  res.append(strings[ind % len(strings)])
  
print(''.join(map(str, res)))
Problem p02886 (python)

Fixed submission:
from itertools import combinations
 
N = int(input())
d = list(map(int, input().split()))
 
score = 0
for i,j in combinations(range(N), 2):
  score += d[i] * d[j]
print(score)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
 
N = int(input())
d = list(map(int(input().split())))
 
score = 0
for i,j in combinations(range(N), 2):
  score += d[i] * d[j]
print(score)

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

N = int(input())
d = map(int(input().split()))

score = 0
for i,j in combinations(range(N), 2):
  score += d[i] * d[j]

print(score)
Problem p02888 (python)

Fixed submission:
import bisect

# LIS
N = int(input())
L = list(map(int, input().split()))
L.sort()

# shorter first
# c > b >a
count = 0
for i in range(0, N-1):
  for j in range(i+1, N):
    index = bisect.bisect_left(L, L[i]+L[j])
    count += max(0, index-(j+1))
print(count)

Buggy submission (verdict: Runtime Error):
import bisect

# LIS
N = int(input())
L = list(map(int, input().split()))
L.sort()

# shorter first
# c > b >a
for i in range(0, N-2):
  for j in range(i+1, N-1):
    index = bisect.bisect_left(L, L[i]+L[j])
    count += max(0, index-(j+1))
Problem p02993 (python)

Fixed submission:
code = str(input())

for i, s in enumerate(code):
    if i != 0:
        if s == pre:
            print("Bad")
            exit()
    pre = s

print("Good")

Buggy submission (verdict: Runtime Error):
code = str(input())

for i, s in enumerate(code):
  if i != 0:
  	if s == pre:
      print("Bad")
      exit()
  pre = s
  
print("Good")
Problem p03037 (python)

Fixed submission:
import sys
from sys import stdin
import numpy as np

N, M = map(int, input().split())
L, R = list(), list()
for i in range(M):
  l,r = stdin.readline().rstrip().split()
  L.append(int(l))
  R.append(int(r))

L = np.array(L)
R = np.array(R)

if R.min() - L.max() < 0:
  print(0)
else:
  print(R.min() - L.max() + 1)

Buggy submission (verdict: Runtime Error):
import sys
from sys import stdin
import numpy as np

N, M = map(int, input().split())
L, R - list(), list()
for i in range(M):
  l,r = stdin.readline().rstrip().split()
  L.append(int(l))
  R.append(int(r))

inputs = np.vstack(L, R).T
  
count = 0
for i in range(1, N+1):
  out = (inputs[:, 0] >= i) & (inputs[:, 1] <= i)
  if out.all():
    count += 0
  
print(count)
Problem p03161 (python)

Fixed submission:
#  def II(): return int(input())
#def LI(): return [int(i) for i in input().split()]

#N, K = LI()
#H = LI()

#cost = [0] * N
#cost[0] = 0
#for n in range(1, N):
#  cost[n] = min([ cost[n-k]+abs(H[n-k]-H[n]) for k in range(1, min(n+1, K+1)) ])

#print(cost[-1])

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    a = [0] * n
    a[0] = 0
    for i in range(1, n):
        a[i] = min([a[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i)])
    print(a[-1])
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
H = map(int, input().split())

cost = [0] * N
cost[0] = 0
for n in range(1, N):
  cost[n] = min([ cost[n-k]+abs(H[n-k]-H[n]) for k in range(1, min(n+1, K+1)) ])

print(cost[-1])

#def main():
#    n, k = map(int, input().split())
#    h = list(map(int, input().split()))
#    a = [0] * n
#    a[0] = 0
#    for i in range(1, n):
#        a[i] = min([a[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i)])
#    print(a[-1])
 
#if __name__ == '__main__':
#    main()

Buggy submission (verdict: Runtime Error):
def II(): return int(input())
def LI(): return [int(i) for i in input().split()]

N, K = map(int, input().split())
H = map(int, input().split())

cost = [0] * N
cost[0] = 0
for n in range(1, N):
  cost[n] = min([ cost[n-k]+abs(H[n-k]-H[n]) for k in range(1, min(n+1, K+1)) ])

print(cost[-1])

#def main():
#    n, k = map(int, input().split())
#    h = list(map(int, input().split()))
#    a = [0] * n
#    a[0] = 0
#    for i in range(1, n):
#        a[i] = min([a[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i)])
#    print(a[-1])
 
#if __name__ == '__main__':
#    main()

Buggy submission (verdict: Runtime Error):
def II(): return int(input())
def LI(): return [int(i) for i in input().split()]

N, K = LI()
H = LI()

cost = [0] * n
cost[0] = 0
for n in range(1, N):
  MIN = min(
  	[ cost[n-k]+abs(H[n-k]-H[n]) for k in range(1, K+1) if n-k>=0 ]
  )
  cost[n] = MIN

print(cost[-1])
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
 
for s in range(N+1):
  for g in range(N-s+1):
    i = N - s - g
    if 1000*s + 5000*g + i*10000 == Y:
      print(i, g, s, sep=" ")
      exit()
print(-1, -1, -1, sep=" ")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())

for s in N+1:
  for g in (N-s):
    i = N - s - g
    if 1000*s + 5000*g + i*10000 == Y:
      print(s, g, i, sep=" ")
      exit()
print(-1, -1, -1, sep=" ")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
# Nマイ，Y縁
s, g, i

for s in N+1:
  for g in (N-s):
    i = N - s - g
    if 1000*s + 5000*g + i*10000 == Y:
      print(s, g, i, sep=" ")
      exit()
print(-1, -1, -1, sep=" ")
Problem p02853 (python)

Fixed submission:
a,b = list(map(int, input().split()))
r=[300000, 200000, 100000]
ra=0
if a+b==2:
  print('1000000')
else:
    if a<4:
      ra += r[a-1]
    if b<4:
      ra += r[b-1]
    print(ra)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
r=[300000, 200000, 100000]
ra=0
if a+b==2:
  print('1000000')
  exit()
if a<3:
  rb += r[a]
if b<3:
  ra += r[b]
 
print(ra)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
r=[300000, 200000, 100000]
ra=0
if a+b==2:
  print('1000000')
  exit()
if a<4:
  rb += r[a]
if b<4:
  ra += r[b]

print(ra)
Problem p02854 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
r = sum(a)
ra = 0
result = 1e30
for i in range(0,N):
    ra += a[i]
    r -= a[i]
    result = min(result, abs(ra-r))
print(int(result))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input.split()))
r = sum(a)
ra = 0
result = 1e30
for i in range(0,N):
    ra += a[i]
    r -= a[i]
    result = min(result, abs(ra-r))
print(int(result))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
r = sum(a)
ra = 0
result = 1e30
for i in tqdm(range(0,N)):
    ra += a[i]
    r -= a[i]
    result = min(result, abs(ra-r))
print(result)
Problem p03997 (python)

Fixed submission:
a, b, h=map(int, list(input() for i in range(3)))
print((a+b)*h//2)

Buggy submission (verdict: Runtime Error):
lis=list(map(int, list(input() for i in range(3)))

tn=0

while len(l[tn])>0:
    if l[tn][0]=="a":
        l[tn]=l[tn][1:]
        tn=0
    elif l[tn][0]=="b":
        l[tn]=l[tn][1:]
        tn=1
    elif l[tn][0]=="c":
        l[tn]=l[tn][1:]
        tn=2
if tn==0:
    print("A")
elif tn==1:
    print("B")
elif tn==2:
    print("C")
Problem p02843 (python)

Fixed submission:
import sys
import math

n=int(input())
a=n%100
b=math.floor(n/100)+1
f=True
while b != 0:
  for i in range(b):
    for j in range(b-i):
      for k in range(b-i-j):
        for l in range(b-i-j-k):
          for m in range(b-i-j-k-l):
            if i+2*j+3*k+4*l+5*m == a:
              print(1)
              sys.exit()
  a+=100
  b-=1
print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=n%100
for i in range(a):
  for j in range(a-i):
    for k in range(a-i-j):
      for l in range(a-i-j-k):
        for m in range(a-i-j-k-l):
          if i+2*j+3*k+4*l+5*m == a:
            print(1)
            return
print(0)
Problem p02844 (python)

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

nsl=['{:03}'.format(i) for i in range(1000)]

res=0
for ns in nsl:
  idx=0
  for char in s:
    if char == ns[idx]:
      idx+=1
      if idx == 3:
        res+=1
        break
print(res)

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

nsl=['{:03}'.format() for i in range(1000)]

res=0
for ns in nsl:
  idx=0
  for char in s:
    if char == ns[idx]:
      idx+=1
      if idx == 3:
        res+=1
        break
print(res)
Problem p03434 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a = int(input())  # Nを入力
b = input()  # a1,a2...anを入
b = map(int, b.split())
b = sorted(b)
b = b[::-1]
c = b[::2]
c_number = len(c)
d = b[1::2]
d_number = len(d)
c_sum = 0
d_sum = 0
for i in range(c_number):
    c_sum += c[i]

for g in range(d_number):
    d_sum += d[g]

print(c_sum - d_sum)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())  # Nを入力
b = input()  # a1,a2...anを入力
b = map(int, b.split())  # a1,a2...anをint型でリストに入れる
b = sorted(b)  # 大きい順に並べる b = b[::-1]  # リストの要素の順番を逆転する
c = b[::2]  # Aliceのとる要素を抽出
c_number = len(c)
d = b[1::2]  # Bobのとる要素を抽出
d_number = len(d)
c_sum = 0
d_sum = 0
for i in range(c_number):
    c_sum += c[i] # Aliceのとる要素の合計
for g in range(d_number):
    d_sum += d[g]  # Bobのとる要素の合計
print(c_sum - d_sum)  # 差分を出力

Buggy submission (verdict: Runtime Error):
-*- coding: utf-8 -*- 
a = int(input())  # Nを入力 
b = input()  # a1,a2...anを入力 
b = map(int, b.split())  # a1,a2...anをint型でリストに入れる 
b = sorted(b)  # 大きい順に並べる b = b[::-1]  # リストの要素の順番を逆転する 
c = b[::2]  # Aliceのとる要素を抽出 
c_number = len(c) 
d = b[1::2]  # Bobのとる要素を抽出 
d_number = len(d) 
c_sum = 0 
d_sum = 0 
for i in range(c_number):
    c_sum += c[i] # Aliceのとる要素の合計  
for g in range(d_number):
　　d_sum += d[g]  # Bobのとる要素の合計  
print(c_sum - d_sum)  # 差分を出力
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
z = 0
number = 0
for i in range(a+1):
    for g in range(b+1):
        for h in range(c+1):
            z = 500*i + 100*g + 50*h
            if x == z:
                number += 1

print(number)

Buggy submission (verdict: Runtime Error):
a = int(input()) 
b = int(input()) 
c = int(input()) 
x = int(input()) 
z = 0 number = 0 
for i in range(a+1):
     for g in range(b+1):
         for h in range(c+1):
             z = 500*i + 100*g + 50*h
             if x == z:
                 number += 1  
print(number)

Buggy submission (verdict: Runtime Error):
a = int(input()) 
b = int(input()) 
c = int(input()) 
x = int(input()) 
z = 0 number = 0 
for i in range(a+1):
     for g in range(b+1):
         for h in range(c+1):
             z = 500*i + 100*g + 50*h
             if x == z:
                 number += 1  
print(number)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
x = input()
z = 0
number = 0
for i in range(a+1):
    for g in range(b+1):
        for h in range(c+1):
            z = 500*i + 100*g + 50*h
            if x == z:
                number += 1

print(number)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
x = input()
z = 0
number = 0
for i in range(a+1):
    for g in range(b+1):
        for h in range(c+1):
            z = 500*i + 100*g + 50*h
            if x == z:
                number += 1

print(number)
Problem p03455 (python)

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

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

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = a * b
if c % 2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03470 (python)

Fixed submission:
a = int(input())
b = []
for i in range(a):
    b.append(input())
c = set(b)
print(len(c))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = []
for i in range(a):
    b.append(input())

c = [0] * (100+1)
for i in b:
    c[i] = i

d = []
for g in c:
    if g != 0:
        d.append(g)

print(len(d))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for i in range(a):
    b.append(input())

c = [0] * (100)
for i in b:
    c[i] = i

d = []
for g in c:
    if g != 0:
        d.append(g)

print(len(d))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for i in range(a):
    b.append(input())

c = [0] * (100)
for i in b:
    c[i] = i

print(c)

d = []
for g in c:
    if g != 0:
        d.append(g)

print(len(d))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(answer)
Problem p03493 (python)

Fixed submission:
x = input()
a = list(x)
a  = [int(s) for s in x]
b = 0
for i in range(3):
    if a[i] == 1:
      b += 1
      
      
      
print(b)

Buggy submission (verdict: Runtime Error):
    x = input()
    a = list(x)
    a  = [int(s) for s in x]
    b = 0
    for i in range(3):
        if a[i] == 1:
          b += 1
          
          
          
    print(b)

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

for i in range(3):
    print(a[i])
    if a[i] == 1:
      b += 1
print(b)
Problem p02882 (python)

Fixed submission:
import math

a, b, x = map(float, input().split(' '))

if x >= a**2*b/2:
    y = 2*b-(2*x/a**2)
    print(math.degrees(math.atan(y/a)))
else:
    y = 2*x/(a*b)
    print(math.degrees(math.atan(b/y)))

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

if x >= a**2*b:
    y = 2*b-(2*x/a**2)
    print(math.degrees(math.atan(y/a)))
else:
    y = 2*x/(a*b)
    print(math.degrees(math.atan(b/y)))
Problem p02885 (python)

Fixed submission:
A,B = map(int, input().split(' '))
print(max(A-2*B,0))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
L = np.array([int(l) for l in input().split(' ')])
counts =0

for i in range(N):
    for j in range(i+1,N):
        B2  = L[j+1:][(L[j+1:]<L[i]+L[j]) & (L[j+1:]>abs(L[i]-L[j]))]
        counts +=len(B2)
print(counts)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
L = np.array([int(l) for l in input().split(' ')])
counts =0

for i in range(N):
    for j in range(i+1,N):
        B2  = L[j+1:][(L[j+1:]<L[i]+L[j]) & (L[j+1:]>abs(L[i]-L[j]))]
        counts +=len(B2)
print(counts)
Problem p02922 (python)

Fixed submission:
A,B = map(int, input().split(' '))
kuchi = 1
taps = 0 
while kuchi < B:
    taps +=1
    kuchi +=A-1
print(taps)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
kuchi = 1
taps = 0 
while kuchi < B:
    taps +=1
    kuchi +=A-1
print(taps)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
kuchi = 1
taps = 0 
while kuchi < B:
    taps +=1
    kuchi +=A-1
print(taps)
Problem p02923 (python)

Fixed submission:
import numpy as np
N = int(input())
H = np.array([int(i) for i in input().split(' ')])
length = 0
max_length=0
for i in range(N-1):
    if H[i+1] - H[i] <= 0:
        length +=1
    else:
        length = 0
        if max_length < length:
            max_length = length
    if max_length < length:
        max_length = length
print(max_length)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array([int(i) for i in input().split(' ')])
length = 0
max_length=0
for i in range(N-1):
    if H[i+1] - H[i] >= 0:
        length +=1
    else:
        max_length = length
        length = 0
print(length)

Buggy submission (verdict: Runtime Error):
length = 0
max_length=0
for i in range(N-1):
    if H[i+1] - H[i] >= 0:
        length +=1
    else:
        max_length = length
        length = 0
print(length)
Problem p02866 (python)

Fixed submission:
import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 100000

maxd = 0
for d in D:
    num[d] += 1
    maxd = max(d, maxd)

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, maxd):
        for _ in range(num[i+1]):
            ans *= num[i]%998244353
        ans %= 998244353
        if ans == 0:
            break
print(ans%998244353)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 10000

maxd = 0
for d in D:
    num[d] += 1
    maxd = max(d, maxd)

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, maxd):
        for _ in range(num[i+1]):
            ans *= num[i]%998244353
        ans %= 998244353
        if ans == 0:
            break
print(ans%998244353)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 10000

maxd = 0
for d in D:
    num[d] += 1
    maxd = max(d, maxd)

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, maxd):
        ans *= int(math.pow(num[i], num[i+1])) % 998244353
        if ans == 0:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [int(x) for x in input().split()]

num = [0] * 10000

for d in D:
    num[d] += 1

if D[0] != 0 or num[0] != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, max(num)):
        ans *= int(math.pow(num[i], num[i+1])) % 998244353
        if ans == 0:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [int(x) for x in input().split()]

if D[0] != 0:
    print(0)
    exit()

num = [0] * 10000

for d in D:
    num[d] += 1

if num[0] != 1:
    print(0)
    exit()

ans = 1
for i in range(1, max(num)):
    ans *= int(math.pow(num[i], num[i+1])) % 998244353
    if ans == 0:
        print(0)
        exit()
print(ans)