Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

# 入力の取得(空白を除く)
s = list(input().split())

# 処理
isPoor = False
if s[0] == s[1] and s[1] != s[2]:
  isPoor = True
if s[1] == s[2] and s[2] != s[0]:
    isPoor = True
if s[2] == s[0] and s[0] != s[1]:
    isPoor = True

if isPoor:
	print("Yes")
else:
	print("No")


Fixed submission:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve():
    try:
        r = int(input())

        print(pow(r, 2))

    except IndexError as err:
        print("インデックスエラー:", err.args[0])


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """2"""
        output = """4"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """100"""
        output = """10000"""
        self.assertIO(test_input, output)

    # 自作テストパターン
    def test_original(self):
        pass


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main(verbosity=2)

Buggy python submission (verdict: Runtime Error):

    # 入力の取得(空白を除く)
    s = list(input().split())

    # 処理
    isPoor = False
    if s[0] == s[1] and s[1] != s[2]:
        isPoor = True
    if s[1] == s[2] and s[2] != s[0]:
        isPoor = True
    if s[2] == s[0] and s[0] != s[1]:
        isPoor = True

    if isPoor:
        print("Yes")
    else:
        print("No")


Fixed submission:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve():
    try:
        r = int(input())

        print(pow(r, 2))

    except IndexError as err:
        print("インデックスエラー:", err.args[0])


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """2"""
        output = """4"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """100"""
        output = """10000"""
        self.assertIO(test_input, output)

    # 自作テストパターン
    def test_original(self):
        pass


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main(verbosity=2)
Buggy python submission (verdict: Runtime Error):
# 入力の取得
s = input()

even = ""
odd  = ""

#1文字ずつループ
for idx,s in enumerate(s):
    if idx = 0 or idx % 2 == 0:
        even += s
    else:
        odd += s

#判定
even = even.replace('R', '').replace('U', '').replace('D', '')
odd  = odd.replace('L', '').replace('U', '').replace('D', '')


if even = "" and odd = "":
    print("Yes")
else:
    print("No")


Fixed submission:
# 入力の取得
s = input()

even = ""
odd  = ""

#1文字ずつループ
for idx,s in enumerate(s):
    if idx == 0 or idx % 2 == 0:
        even += s
    else:
        odd += s

#判定
even = even.replace('R', '').replace('U', '').replace('D', '')
odd  = odd.replace('L', '').replace('U', '').replace('D', '')


if even == "" and odd == "":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.配列[添字=人数、値=初期の点数]
points = [i[1]] * i[0]
# 2.正解数(引数の数)
correntCount = i[2]

# 正解数ループ
for i in range(correntCount):
    correcter = int(input()) - 1    
    #全てを1減算
    points = [ n - 1 for n in points]
    #正解者に1加算(正解者以外を減算するため)
    points[correcter] += 1

# 値が0以下の参加者は敗退(No)、1以上なら勝ち抜け(Yes)
for point in points:
    if point <= 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.配列[値=初期の点数-★正解数(解説より)★、個数=人数]
points = [i[1]- i[2]] * (i[0] )
# 2.正解数(引数の数)
correntCount = i[2]

# 正解数ループ
for i in range(correntCount):
    correcter = int(input()) - 1    
    #正解者に1加算
    points[correcter] += 1

# 値が0以下の参加者は敗退(No)、1以上なら勝ち抜け(Yes)
for point in points:
    if point <= 0:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
import array

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.配列[添字=人数、値=初期の点数]
points = [i[1]] * i[0]
# 2.正解数(引数の数)
correntCount = i[2]

# 正解数ループ
for i in range(correntCount):
    correcter = int(input()) - 1    
    #全てを1減算
    points = [ n - 1 for n in points]
    #正解者に1加算(正解者以外を減算するため)
    points[correcter] += 1

# 値が0以下の参加者は敗退(No)、1以上なら勝ち抜け(Yes)
for point in points:
    if point <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.配列[値=初期の点数-★正解数(解説より)★、個数=人数]
points = [i[1]- i[2]] * (i[0] )
# 2.正解数(引数の数)
correntCount = i[2]

# 正解数ループ
for i in range(correntCount):
    correcter = int(input()) - 1    
    #正解者に1加算
    points[correcter] += 1

# 値が0以下の参加者は敗退(No)、1以上なら勝ち抜け(Yes)
for point in points:
    if point <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
import heapq

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 「符号反転した」リストを優先度付きキューに変換
# ★ポイント★
# heapqは最小値しか取り出せないため、
# 符号反転してからキューに変換=>最小値を取る、という手法を行う。
priceList = [ n * -1 for n in priceList]
heapq.heapify(priceList)

# キューから最小値の取り出し
aaa = heapq.heappop(priceList)
print(aaa)
aaa = heapq.heappop(priceList)
print(aaa)


# 合計金額を出力
# print(sum(priceList))



Fixed submission:
import math
import heapq

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 「符号反転した」リストを優先度付きキューに変換
# ★ポイント★
# heapqは最小値しか取り出せないため、
# 符号反転してからキューに変換=>最小値を取る、という手法を行う。
priceList = [ n * -1 for n in priceList]
heapq.heapify(priceList)

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # キューから最小値の取り出し(ここで符号反転も行っておく)
    target = abs(heapq.heappop(priceList))

    # 2で割る。(小数点切り下げ)
    target = math.floor(target / 2)

    # 割引券利用後の金額をキューに格納(ここで符号反転する)
    heapq.heappush(priceList, target * -1)

# 合計金額を出力
print(abs(sum(priceList)))

Buggy python submission (verdict: Time Limit Exceeded):
import math

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # 全アイテムに対して、割引券を使った場合の試算を行う
    discountPrice = 0
    shouldUseItem = 0
    for idx , price in enumerate(priceList):

        # 割引券使用による割引金額を取得
        workDiscountPrice = math.ceil(price - (price / 2))

        # 最も割引金額が多い場合、候補として変数に格納
        if workDiscountPrice > discountPrice:
            discountPrice = workDiscountPrice
            shouldUseItem = idx

    # 割引金額が最大の品物に割引券を使用
    priceList[shouldUseItem] -= discountPrice

# 合計金額を出力
print(sum(priceList))


Fixed submission:
import math
import heapq

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 「符号反転した」リストを優先度付きキューに変換
# ★ポイント★
# heapqは最小値しか取り出せないため、
# 符号反転してからキューに変換=>最小値を取る、という手法を行う。
priceList = [ n * -1 for n in priceList]
heapq.heapify(priceList)

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # キューから最小値の取り出し(ここで符号反転も行っておく)
    target = abs(heapq.heappop(priceList))

    # 2で割る。(小数点切り下げ)
    target = math.floor(target / 2)

    # 割引券利用後の金額をキューに格納(ここで符号反転する)
    heapq.heappush(priceList, target * -1)

# 合計金額を出力
print(abs(sum(priceList)))
Buggy python submission (verdict: Runtime Error):
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))

nowCnt = 0
nowLandpoints = 0
for i in range(boundCnt + 1):
    if nowLandpoints > limit:
        break
    nowCnt += 1
    nowLandpoints += landpoints[i]

print(nowCnt)


Fixed submission:
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))
#1回目のバウンド情報を加算(0座標)
landpoints.insert(0,0)
boundCnt += 1

nowCnt = 0
nowLandpoints = 0

for i in range(boundCnt):

   nowLandpoints += landpoints[i]
   if nowLandpoints > limit:
      break

   nowCnt += 1

print(nowCnt )
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n, m = map(int, input().split())

    ans = []

    for i in range(1, m // n + 1):
        if (m - i * n) % i == 0:
            ans.append(i)

    print(max(ans))


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3 14"""
        output = """2"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """10 123"""
        output = """3"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """100000 1000000000"""
        output = """10000"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Fixed submission:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n, m = map(int, input().split())

    for i in reversed(range(1, m // n + 1)):
        if (m - i * n) % i == 0:
            print(i)
            return




# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3 14"""
        output = """2"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """10 123"""
        output = """3"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """100000 1000000000"""
        output = """10000"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()
Buggy python submission (verdict: Runtime Error):
s=list(input())
t=list(input())
n=len(t)
m=len(s)
for i in range(n):
    l=n-i
    for j in range(i+1):
        print(t[j:j+l],i,s[j:j+m-i])
        if ''.join(t[j:j+l]) in ''.join(s[j:j+m-i]):
            print(i)
            exit()
print(n)

Fixed submission:
s=list(input())
t=list(input())
n=len(t)
m=len(s)
mn=n
for i in range(m-n+1):
    err=0
    for j in range(n):
        if s[i+j]!=t[j]:
            err+=1
    mn=min(mn,err)
print(mn)
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=list(input())
t=0
i=0
j=n-1
while c[i]=='R':
    i += 1
    if i>n-1:
        print(0)
        exit()
while c[j]=='W':
    j -= 1
    if j<0:
        print(0)
if i<j:
    i += 1
    j -= 1
    t += 1
while i<j:
    while c[i]=='R':
        i += 1
    while c[j]=='W':
        j -= 1
    i += 1
    j -= 1
    t += 1
print(t)


Fixed submission:
n=int(input())
c=list(input())
w=c.count('W')
ans=0
for i in range(n-w):
    if c[i]=='W':
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=0
w=0
t=0
r=0
for i in range(n):
    code=input()
    if code=='AC':
        a += 1
    elif code=='WA':
        w += 1
    elif code=='TLE':
        t += 1
    else:
        r += 1
print('AC x 'a)
print('WA x 'w)
print('TLE x 't)
print('RE x 'r)

Fixed submission:
n=int(input())
a=0
w=0
t=0
r=0
for i in range(n):
    code=input()
    if code=='AC':
        a += 1
    elif code=='WA':
        w += 1
    elif code=='TLE':
        t += 1
    else:
        r += 1
print('AC x ',a)
print('WA x ',w)
print('TLE x ',t)
print('RE x ',r)
Buggy python submission (verdict: Runtime Error):
n=int(input())
num=[]
t=1
count=1
while n>t*26:
    t *= 26
    n -= t
    count += 1

for i in range(count-1,-1,-1):
    m=26**i
    a=n//m
    n %= m
    num.append(a)
a_list=['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']
ans=[]
for i in range(count):
    s=num[i]
    if i==count-1:
        s -= 1
    ans.append(a_list[s])
print(''.join(ans))

Fixed submission:
n=int(input())
num=[]
t=1
count=1
while n>t*26:
    t *= 26
    n -= t
    count += 1
n -= 1
for i in range(count-1,-1,-1):
    m=26**i
    a=n//m
    n %= m
    num.append(a)
a_list=['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']
ans=[]
for i in range(count):
    s=num[i]
    ans.append(a_list[s])
print(''.join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort()
q.sort()
r.sort()
del p[:a-x]
del q[:b-y]

s=p+q
s.sort()

i=c-1
while r[i]>s[0] and i>=0 :
    s[0]=r[i]
    s.sort()
    i -= 1

print(sum(s))

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p.sort()
q.sort()
r.sort(reverse=True)
del p[:a-x]
del q[:b-y]

s=p+q
s.sort()
if s[0]<r[0]:
    s[0]=r[0]
    for i in range(1,c):
        if s[i]>=r[i]:
            break
        else:
            s[i]=r[i]

print(sum(s))
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[]
for _ in range(h):
    s += list(input())

L=[int(x) for x in range(h+w-2)]
mn=(h+w)//2
import itertools
for route in itertools.permutations(L,h-1):
    route=sorted(route)
    if s[0]=='.':
        t=0
        count=0
    else:
        t=1
        count=2
    k=0
    for i in L:
        if i in route:
            if s[k]!=s[k+1]:
                if t==0:
                    count += 1
                    t=1
                else:
                    t=0
            k += 1
        else:
            if s[k]!=s[k+w]:
                if t==0:
                    count += 1
                    t=1
                else:
                    t=0
            k += w
    mn=min(mn,count)

print(mn)

Fixed submission:
h,w=map(int,input().split())
s=[]
for _ in range(h):
    s.append(list(input()))
a=[[0]]
for i in range(1,h):
    t=a[i-1][0]
    if s[i][0]!=s[i-1][0]:
        a.append([t+1])
    else:
        a.append([t])

for j in range(1,w):
    t=a[0][j-1]
    if s[0][j]!=s[0][j-1]:
        a[0].append(t+1)
    else:
        a[0].append(t)

for i in range(1,h):
    for j in range(1,w):
        up=a[i-1][j]
        left=a[i][j-1]
        if s[i][j]!=s[i-1][j]:
            up += 1
        if s[i][j]!=s[i][j-1]:
            left += 1
        mn=min(up,left)
        a[i].append(mn)
num=a[h-1][w-1]
ans=(num+1)//2
if s[0][0]=='#' and num%2==0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
K,X=map(int,input().split())

if 500＊K　>=　X:
  print('yes')
else:
  print('no')

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
K,X=map(int,input().split)

if 500*K >= X:
  print('yes')
else:
  print('no')

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
K,X=map(int,input().split)

if 500*K>=X:
  print('yes')
else:
  print('no')

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
K,X=map(int,input().split)

if 500*K>=X:
  print("yes")
else:
  print("no")

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
K,X=input().split
K=int(K)
X=int(X)

if 500*K>=X:
  print("yes")
else:
  print("no")

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
K,X=input().split
if K*2>X:
  print("yes")
else:
  print("no")

Fixed submission:
K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
=int(input())

for i in range(X,X*2):
    ok=0
    for j in range(2,i):
        if i%j == 0:
            ok += 1
    if ok == 0:
        print(i)
        break

Fixed submission:
X=int(input())

for i in range(X,X*2):
    ok=0
    for j in range(2,i):
        if i%j == 0:
            ok += 1
    if ok == 0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
A1,A2,A3=map(int,input().split)

if A1+A2+A3>=22:
    print("bust")
else:
    print("win")

Fixed submission:
A1,A2,A3=map(int,input().split())

if A1+A2+A3>=22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
abc_list="abcdefghijklmnopqrstuvwxyz"
L=len(abc_list)
ans= " "
for i in S:
  ans += abc_list[(abc_list.index(i)+N) % L]
print(ans)

Fixed submission:
N=int(input())
S=input()
abc_list="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
L=len(abc_list)
ans= " "
for i in S:
  ans += abc_list[(abc_list.index(i)+N) % L]
print(ans)
Buggy python submission (verdict: Runtime Error):
s=("sunny","cloudy","rainy")
print(s[(s.index(input())+1)%3])

Fixed submission:
s=("Sunny","Cloudy","Rainy")
print(s[(s.index(input())+1)%3])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))

ans=0
for i in range(N-1):
    sum=0
    while H[i]>=H[i+1]:
        sum += 1
        i += 1
        if i==N-1:
            break
    ans = max(ans,sum)
print(ans)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))

ans=0
sum=0
for i in range(N-1):
    if H[i]>=H[i+1]:
        sum += 1
    else:
        sum = 0
    ans = max(ans,sum)
print(ans)

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

L=[]
for i in range(N-1):
    sum=0
    while H[i]>=H[i+1] :
        sum += 1
        i += 1
        if i==N-1:
            break
    L += str(sum)
print(max(L))

Fixed submission:
N=int(input())
H=list(map(int,input().split()))

ans=0
sum=0
for i in range(N-1):
    if H[i]>=H[i+1]:
        sum += 1
    else:
        sum = 0
    ans = max(ans,sum)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))
for j in range(N):
    k=a.pop(j)
    mx=a[0]
    for l in range(1,N-1):
        mx=max(mx,a[l])
    print(mx)
    a.insert(j,k)

Fixed submission:
N=int(input())
mx=int(input())
a=[mx]
for i in range(N-1):
    l=int(input())
    a.append(l)
    mx=max(mx,l)
num=a.index(mx)
a.remove(mx)
mx2=a[0]
for j in range(1,N-1):
    mx2=max(mx2,a[j])
for k in range(N):
    if k==num:
        print(mx2)
    else:
        print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))
for j in range(N):
    k=a.pop(j)
    print(max(a))
    a.insert(0,k)
    
    

Fixed submission:
N=int(input())
mx=int(input())
a=[mx]
for i in range(N-1):
    l=int(input())
    a.append(l)
    mx=max(mx,l)
num=a.index(mx)
a.remove(mx)
mx2=a[0]
for j in range(1,N-1):
    mx2=max(mx2,a[j])
for k in range(N):
    if k==num:
        print(mx2)
    else:
        print(mx)
Buggy python submission (verdict: Runtime Error):
n=int(input())
L=[]
for _ in range(n):
    l=list(map(int,input().split()))
    L.append(l)
pq=[]
ans=[]
for i in range(n-1):
    for j in range(i+1,n):
        x=L[i][0]-L[j][0]
        y=L[i][1]-L[j][1]
        if [x,y] in pq:
            ans[pq.index([x,y])] += 1
        elif [-x,-y] in pq:
            ans[pq.index([-x,-y])] += 1
        else:
            pq.append([x,y])
            ans.append(1)

print(n-max(ans))

Fixed submission:
n=int(input())
L=[]
for _ in range(n):
    l=list(map(int,input().split()))
    L.append(l)
if n==1:
    print(1)
    exit()
pq=[]
ans=[]
for i in range(n-1):
    for j in range(i+1,n):
        x=L[i][0]-L[j][0]
        y=L[i][1]-L[j][1]
        if [x,y] in pq:
            ans[pq.index([x,y])] += 1
        elif [-x,-y] in pq:
            ans[pq.index([-x,-y])] += 1
        else:
            pq.append([x,y])
            ans.append(1)

print(n-max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
L=[]
for i in range(m):
    bc=list(map(int,input().split()))
    L.append(bc)
L=sorted(L,key=lambda x:x[1],reverse=True)

import bisect
for l in L:
    if a[0]>=l[1]:
        break
    ind=bisect.bisect_left(a,l[1])
    ind=min(ind,l[0])
    for i in range(ind):
        a[i]=l[1]
    a=sorted(a)
print(sum(a))

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
L=[]
for i in range(m):
    bc=list(map(int,input().split()))
    L.append(bc)
L=sorted(L,key=lambda x:x[1],reverse=True)

import bisect
star=0
ans=0
for l in L:
    ind=bisect.bisect_left(a,l[1],star,n)
    if ind>star+l[0]:
        star += l[0]
        ans += l[0]*l[1]
    else:
        ans += (ind-star)*l[1]
        star=ind
        break
ans += sum(a[star:n])
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
L=list(map(int,input().split()))
ans=[]
for i in range(n):
    if L[i]>i+1:
        print(-1)
        exit()
def mal(x):
    if len(x)==0:
        return []
    else:
        t=max(x)
        i=x.index(t)
        after=x[:i-t+1]
        before=x[i-t+1:]
        before.remove(t)
        return mal(before)+[t]+mal(after)
ans=mal(L)

for i in range(n):
    print(ans[i])

Fixed submission:
n=int(input())
L=list(map(int,input().split()))
for i in range(n):
    if L[i]>i+1:
        print(-1)
        exit()
def mal(x):
    if len(x)==0:
        return []
    else:
        t=max(x)
        i=x.index(t)
        k=i-1
        while k>i-t:
            if x[k]>t-i+k:
                t=x[k]
                i=k
            k -= 1
        after=x[:i-t+1]
        before=x[i-t+1:]
        before.remove(t)
        return mal(before)+[t]+mal(after)
ans=mal(L)

for i in range(n):
    print(ans[i])