Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
rootN = math.sqrt(N)
rootN = math.floor(rootN)
maxN = 1001
fn_array = [0] * 1000
for x in range(1, rootN):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x == y and y == z:
                fn_array[n] += 1
            elif (x == y) and (y != z):
                fn_array[n] += 3
            elif (x != y) and (y == z):
                fn_array[n] += 3
            else:
                fn_array[n] += 6
for n in range(1, N+1):
    print(fn_array[n])

Fixed submission:
import math
N = int(input())
fn_array = [0] * 60000
for x in range(1, 100):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x == y and y == z:
                fn_array[n] += 1
            elif (x == y) and (y != z):
                fn_array[n] += 3
            elif (x != y) and (y == z):
                fn_array[n] += 3
            else:
                fn_array[n] += 6
for n in range(1, N+1):
    print(fn_array[n])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2:
  print('Odd')
  else:
    print('Even')

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

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

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
    s = input()
    print(s.count('1'))

Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Runtime Error):
n = input()
op_cnt = len(n) - 1  # すき間の個数
for i in range(2**op_cnt):
  op = ['-'] * op_cnt
  for j in range(op_cnt):
    if (i >> j) & 1:
      op[op_cnt-1-j] = '+'
      formula = ''
      for p_n, p_o in zip(n, op + ['']):
        formula += (p_n + p_o)
        if eval(formula) == 7:
          print(formula + '=7')
          break

Fixed submission:
n = input()
op_cnt = len(n) - 1  # すき間の個数
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt  # あらかじめ ["-", "-", "-"] というリストを作っておく
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  # フラグが立っていた箇所を "+" で上書き

    formula = ""
    for p_n, p_o in zip(n, op + [""]):  # 少々モヤッとする
        formula += (p_n + p_o)
    if eval(formula) == 7:
        print(formula + "=7")
        break

Buggy python submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest


n = input()
op_cnt = len(n) - 1  # すき間の個数
for i in range(2**op_cnt):
  op = ['-'] * op_cnt
  for j in range(op_cnt):
    if (i >> j) & 1:
      op[op_cnt-1-j] = '+'
      formula = ''
      for p_n, p_o in zip(n, op + ['']):
        formula += (p_n + p_o)
        if eval(formula) == 7:
          print(formula + '=7')
          break

Fixed submission:
n = input()
op_cnt = len(n) - 1  # すき間の個数
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt  # あらかじめ ["-", "-", "-"] というリストを作っておく
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  # フラグが立っていた箇所を "+" で上書き

    formula = ""
    for p_n, p_o in zip(n, op + [""]):  # 少々モヤッとする
        formula += (p_n + p_o)
    if eval(formula) == 7:
        print(formula + "=7")
        break
Buggy python submission (verdict: Runtime Error):


import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

"""
# 文字列（数値変換も含む）
n = readline().rstrip() # １行に１文字列のみ
lis = readline().rstrip().split() # # １行に複数の文字列

# 数値（文字変換も含む）
n = int(readline().rstrip()) # １行に数値１個のみ
a, b, c = map(int,readline().rstrip().split()) # １行に複数の数値
A = list(map(int,readline().rstrip().split()))  # １行に複数の数値（リスト受け取り）
lis = [readline().rstrip().split() for _ in range(n)] # １行に複数の数値(m個)かつ、n行続く場合（出力は二次元リスト：[['1', '2'], ['4', '5']]）

# 一行に文字列が一個 * n行
s_lis=[readline().rstrip().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換
# 一行に文字列が一個 * n行で文字列をアルファベット順に変換
s_lis=["".join(sorted(readline().rstrip().decode())) for _ in range(n)]
# 一行に文字列が複数個 * n行
s_lis=[readline().rstrip().split().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換

# 一行に数値が一個 * n行
s_lis=[int(readline().rstrip()) for _ in range(n)] 
# 一行に数値が複数個 * n行
s_lis=[int(readline().rstrip().split()) for _ in range(n)]

# dとAの行が交互に並んでいる場合
s = sys.stdin.readlines()
n, k=map(int, s[0].split())
d=[]
A=[]
for i in s[1:2*k:2]:
    d.append(int(i))
for i in s[2:2*k+1:2]:
    A.append(list(map(int, i.split())))
"""

a,b,c,k=map(int,input().split())

if k<=a:
    print(k)

elif: k<=a+b:
    print(a)

else:
    print(a+b-c)

Fixed submission:


import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

"""
# 文字列（数値変換も含む）
n = readline().rstrip() # １行に１文字列のみ
lis = readline().rstrip().split() # # １行に複数の文字列

# 数値（文字変換も含む）
n = int(readline().rstrip()) # １行に数値１個のみ
a, b, c = map(int,readline().rstrip().split()) # １行に複数の数値
A = list(map(int,readline().rstrip().split()))  # １行に複数の数値（リスト受け取り）
lis = [readline().rstrip().split() for _ in range(n)] # １行に複数の数値(m個)かつ、n行続く場合（出力は二次元リスト：[['1', '2'], ['4', '5']]）

# 一行に文字列が一個 * n行
s_lis=[readline().rstrip().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換
# 一行に文字列が一個 * n行で文字列をアルファベット順に変換
s_lis=["".join(sorted(readline().rstrip().decode())) for _ in range(n)]
# 一行に文字列が複数個 * n行
s_lis=[readline().rstrip().split().decode() for _ in range(n)] # .decodeはバイト列から文字列へ変換

# 一行に数値が一個 * n行
s_lis=[int(readline().rstrip()) for _ in range(n)] 
# 一行に数値が複数個 * n行
s_lis=[int(readline().rstrip().split()) for _ in range(n)]

# dとAの行が交互に並んでいる場合
s = sys.stdin.readlines()
n, k=map(int, s[0].split())
d=[]
A=[]
for i in s[1:2*k:2]:
    d.append(int(i))
for i in s[2:2*k+1:2]:
    A.append(list(map(int, i.split())))
"""

a,b,c,k=map(int,input().split())

if k<=a:
    print(k)

elif a<k<=a+b:
    print(a)

else:
    print(2*a+b-k)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
a=list(map(int,input().split()))
ind=list(itertools.combinations(range(1,n+1), 2))

cnt=0
for i in range(len(ind)):
    if ind[i][1]-ind[i][0]==a[ind[i][1]-1]+a[ind[i][0]-1]:
        cnt+=1
print(cnt)

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))

d = dict(collections.Counter([i + A[i] for i in range(N)]))
ans = sum([d.get(j - A[j], 0) for j in range(N)]) # .get()の第２引数は、第１引数がなかった場合に返す値

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

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

cnt=0
for i in range(n):
    for j in range(n):
        if abs(i-j)==a[i]+a[j]:
            cnt+=1

print(int(cnt/2))


Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))

d = dict(collections.Counter([i + A[i] for i in range(N)]))
ans = sum([d.get(j - A[j], 0) for j in range(N)]) # .get()の第２引数は、第１引数がなかった場合に返す値

print(ans)
Buggy python submission (verdict: Runtime Error):

import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, Q = map(int, readline().split())

# 1～Mまでの数を複数回用いて、長さNの要素の部分列返す
#（combinations：複数使用なし、combinations_with_replacement：複数使用あり）
A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))

n = len(A) # 組合せ総数
score = np.zeros(n) [0,0,...,0] # 0が n個のaraay

m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond

print(score.max())

Fixed submission:
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, Q = map(int, readline().split())

# 1～Mまでの数を複数回用いて、長さNの要素の部分列返す
#（combinations：複数使用なし、combinations_with_replacement：複数使用あり）
A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))

n = len(A) # 組合せ総数
score = np.zeros(n, np.int32) # [0,0,...,0] :0が n個のaraay

m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond

print(score.max())
Buggy python submission (verdict: Runtime Error):


N = int(input())

fizzbuzz = []

for i in range(1, N):
    if i % 15 == 0:
        fizzbuzz.append('0')
    elif i % 3 == 0:
        fizzbuzz.append('0')
    elif i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(int(sum(num))L)

Fixed submission:


N = int(input())

fizzbuzz = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(sum(num))

Buggy python submission (verdict: Runtime Error):

import sys
sys.setrecursionlimit(10**6)
N = int(input())

fizzbuzz = []

for i in range(1, N):
    if i % 15 == 0:
        fizzbuzz.append('0')
    elif i % 3 == 0:
        fizzbuzz.append('0')
    elif i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(int(sum(num))


Fixed submission:


N = int(input())

fizzbuzz = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(sum(num))
Buggy python submission (verdict: Time Limit Exceeded):

import math

K = int(input())

gcd = []

for a in range(1,K+1,1):
    for b in range(1,K+1,1):
        for c in range(1,K+1,1):
            partial = math.gcd(a, b)
            ans = math.gcd(partial, c)
            gcd.append(ans)

print(sum(gcd))

Fixed submission:

import math

K = int(input())

gcd = []

for a in range(1,K+1,1):
    for b in range(1,K+1,1):
        for c in range(1,K+1,1):
            partial = math.gcd(a, b)
            ans = math.gcd(partial, c)
            gcd.append(ans)

print(sum(gcd))
Buggy python submission (verdict: Runtime Error):

N, K = map(int, input().split())
amari%=K

print(min(amari,abs(amari-k)))


Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

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

print(amari,abs(amari-k))


Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

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

if K == 1:
    print(0)

else:
    shou, amari_1 = divmod(N, abs(N-K))
    N_min_1 = N - (shou * abs(N-K))
    N_min_2 = abs(N_min_1 - abs(N-K))
    print(min(N_min_1, N_min_2))

Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

Buggy python submission (verdict: Runtime Error):

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

if K == 1:
    print(0)

else:
    shou, amari_1 = divmod(N, abs(N-K))
    N_min_1 = N - (shou * abs(N-K))
    N_min_2 = abs(N_min_1 - abs(N-K))
    print(min(N_min_1, N_min_2))

Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

Buggy python submission (verdict: Runtime Error):

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

if K == 1:
    print(0)

else:
    shou, N_min_1 = divmod(N, abs(N-K))
    N_min_2 = abs(N_min_1 - abs(N-K))
    print(min(N_min_1, N_min_2))

Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

Buggy python submission (verdict: Runtime Error):

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

shou, N_min_1 = divmod(N, abs(N-K))
N_min_2 = abs(N_min_1 - abs(N-K))
print(min(N_min_1, N_min_2))

Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))

Buggy python submission (verdict: Runtime Error):

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

shou, N_min = divmod(N, abs(N-K))
print(N_min)

Fixed submission:

N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))
Buggy python submission (verdict: Runtime Error):

from math import factorial

M, N = map(int, input().split())

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

sum_n = combinations_count(M, 2) + combinations_count(N, 2)
print(sum_n)

Fixed submission:

from math import factorial

M, N = map(int, input().split())

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

if M > 1 and N > 1:
    sum_n = combinations_count(M, 2) + combinations_count(N, 2)

elif M > 1:
    sum_n = combinations_count(M, 2)

elif N > 1:
    sum_n = combinations_count(N, 2)

else:
    sum_n = 0

print(sum_n)
Buggy python submission (verdict: Runtime Error):

H, W = map(int, input().split())

if (H = 1 or W = 1):
    print(1)
    
elif (H * W) % 2 == 0:
    print(int((H * W) / 2))

else:
    masu = int((H * W) / 2) + 1
    print(masu)


Fixed submission:

H, W = map(int, input().split())

if (H == 1 or W == 1):
    print(1)
    
elif (H * W) % 2 == 0:
    print(int((H * W) / 2))

else:
    masu = int((H * W) / 2) + 1
    print(masu)
Buggy python submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = []
s.append(min(a) + min(b))

for i in range(M):
    x_i, y_i, c_i = map(int, input().split())
    minus = a[x_i - 1] + a[y_i - 1] - c_i
    s.append(minus)

print(min(s))


Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = []
s.append(min(a) + min(b))

for i in range(M):
    x_i, y_i, c_i = map(int, input().split())
    minus = a[x_i - 1] + b[y_i - 1] - c_i
    s.append(minus)

print(min(s))

Buggy python submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = []
for a_i in a:
    for b_i in b:
        sum_ab = a_i + b_i
        s.append(sum_ab)

for i in range(M):
    x_i, y_i, c_i = map(int, input().split())
    minus = a[x_i - 1] + a[y_i - 1] - c_i
    s.append(minus)

print(min(s))

Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = []
s.append(min(a) + min(b))

for i in range(M):
    x_i, y_i, c_i = map(int, input().split())
    minus = a[x_i - 1] + b[y_i - 1] - c_i
    s.append(minus)

print(min(s))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
A, B = map(int, input().split())

x_a = np.arange(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1)))
x_b = np.arange(10 * B, 10 * (B + 1))

a_set = set(x_a)
b_set = set(x_b)
#aとbに共通するものを抽出
c_set = a_set & b_set
c = list(c_set)
x = min(c)
print(x)

if not c:
    print("-1")

else:
    continue

Fixed submission:
import numpy as np
import math
A, B = map(int, input().split())

x_a = np.arange(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1)))
x_b = np.arange(10 * B, 10 * (B + 1))

a_set = set(x_a)
b_set = set(x_b)
#aとbに共通するものを抽出
c_set = a_set & b_set
c = list(c_set)

if len(c) != 0:
    print(min(c))

else:
    print("-1")

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
A, B = map(int, input().split())

x_a = np.arange(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1)))
x_b = np.arange(10 * B, 10 * (B + 1))

a_set = set(x_a)
b_set = set(x_b)
c_set = a_set & b_set
c = list(c_set)
x = min(c)
print(x)

if not c:
    print("-1")

Fixed submission:
import numpy as np
import math
A, B = map(int, input().split())

x_a = np.arange(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1)))
x_b = np.arange(10 * B, 10 * (B + 1))

a_set = set(x_a)
b_set = set(x_b)
#aとbに共通するものを抽出
c_set = a_set & b_set
c = list(c_set)

if len(c) != 0:
    print(min(c))

else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())

if N >= 10:
  print(str(R))
  
 else:
  print(str(R + 100 * (10 - N)))

Fixed submission:
N, R = map(int, input().split())
 
if N >= 10:
  print(str(R))
  
else:
  print(str(R + 100 * (10 - N)))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from collections import Counter
readline = sys.stdin.buffer.readline # 一行読み込み

n=int(input())
s=["".join(readline().rstrip()) for _ in range(n)]
print(s)

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Buggy python submission (verdict: Runtime Error):

import sys
from collections import Counter
readline = sys.stdin.buffer.readline # 一行読み込み

n=int(input())
s=["".join(readline().rstrip()) for _ in range(n)]
print(s)

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Buggy python submission (verdict: Runtime Error):

from collections import Counter

n=int(input())
s=list(input(i).split() for i in range(n))

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input(i) for i in range(n))

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
p=list(map(int,input().split()))

cnt=0

for i in range(n):
    if min(p[:i+1])==p[i]:
        cnt+=1
    else:
        continue

print(cnt)

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

cnt=0
min_val=p[0]

for i in range(n):
    if min_val>=p[i]:
        min_val=p[i]
        cnt+=1
    else:
        continue

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
p=list(map(int,input().split()))

cnt=0

for i in range(n):
    if min(p[:i+1])>=p[i]:
        cnt+=1
    else:
        continue

print(cnt)

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

cnt=0
min_val=p[0]

for i in range(n):
    if min_val>=p[i]:
        min_val=p[i]
        cnt+=1
    else:
        continue

print(cnt)
Buggy python submission (verdict: Runtime Error):

s = input()
n = len(s)
nn = -(-n/2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)

Fixed submission:

s = input()
n = len(s)
nn = -(-n//2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):

n=int(input())
print(n**3)

Fixed submission:

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

n=int(input())
print(N**3)

Fixed submission:

n=int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):

n=int(input())
h=list(map(int,input().split()))

score = [0]*n
for i in range(n-2,-1,-1):
    if H[i] >= H[i+1]:
        score[i] = score[i+1] + 1
 
print(max(score))

Fixed submission:

n=int(input())
h=list(map(int,input().split()))

score = [0]*n
for i in range(n-2,-1,-1):
    if h[i] >= h[i+1]:
        score[i] = score[i+1] + 1
 
print(max(score))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(float,input().split())))
print(float(1/sum(1/a_array)))

Fixed submission:

import numpy as np
n=int(input())
a=list(map(float,input().split()))
a_array=np.array(a)
a_inv=np.reciprocal(a_array)
print(float(1/sum(a_inv)))
Buggy python submission (verdict: Runtime Error):

a,b=map(int,input().spllit())
print(max(a+b,a-b,a*b))

Fixed submission:

a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):

a,b,c=map(int,input().split())
if b+c<=a:
    print(0)

else:
    print(c+b-a))

Fixed submission:

a,b,c=map(int,input().split())
if b+c<=a:
    print(0)

else:
    print(c+b-a)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）


def main():
    l,r=map(int,readline().rstrip().split())
    
    min_2019=2019

    if l-r>=2019:
        print(0)

    else:
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                tmp=(i*j)%2019
                if min_2019>tmp:
                    min_2019=tmp
                    
        print(min_2019)

if __name__ == '__main__':
    main()

Fixed submission:

l, r = map(int,input().split())
 
ans = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

"""
単純な全探索は二重ループでできそうだが、
L,R≤2×109 とかなので、このままだとダメ。
そこで工夫を考えることになる。
例えば L=10, R=3000 とかだったら、
x=2019 とかにすれば、xy は 2019 で割り切れる。
「2019 個以上の整数が連続すると、その中に必ず 2019 の倍数がある」
よってR−L≥2019 のときは答えが 0
それ以外のときは、全探索できる！候補数は多く見積もっても (R−L)^2 程度
"""

import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）


def main():
    l,r=map(int,readline().rstrip().split())
    
    min_2019=2019

    if l-r>=2019:
        print(0)

    else:
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                min_2019=min(min_2019,(i*j)%2019)
        
        print(min_2019)

if __name__ == '__main__':
    main()

Fixed submission:

l, r = map(int,input().split())
 
ans = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

import sys
read = sys.stdin.buffer.read # 全読み込み
readline = sys.stdin.buffer.readline # 一行読み込み
readlines = sys.stdin.buffer.readlines # 一行ずつ全読み込み
sys.setrecursionlimit(10**7) # 再帰限界変更（デフォルトは1000）

l,r=map(int,readline().rstrip().split())

min_2019=2019

if l-r>=2019:
    print(0)

else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            min_2019=min(min_2019,(i*j)%2019)

print(min_2019)

Fixed submission:

l, r = map(int,input().split())
 
ans = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)
Buggy python submission (verdict: Runtime Error):

s=list(input())
c = collections.Counter(s)
if list(c.values())==[2,2]:
    print("Yes")
else:
    print("No")

Fixed submission:

s=list(input())
import collections
s = collections.Counter(s)
if list(s.values())==[2,2]:
    print("Yes")
else:
    print("No")