Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
C = [(list(map(int, input().split()))) for _ in range(N)]
 
# bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める
ans = 10**10
for i in range(2**N):
  U = [0]*(M+1)
  for j in range(N):
    if ((i >> j) & 1):
      for k in range(M+1):
        U[k] += C[j][k]
  
  # ある組みが条件を満たすなら、その値段をvalに追加
  if sum([u >= X for u in U[1:]]) == M:
    ans = min(ans, U[0])

if ans = 10**10: print(-1)
else: print(ans)

Fixed submission:
N, M, X = map(int, input().split())
C = [(list(map(int, input().split()))) for _ in range(N)]

# bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める
val = []
for i in range(2**N):
  U = [0]*(M+1)
  for j in range(N):
    if ((i >> j) & 1):
      for k in range(M+1):
        U[k] += C[j][k]
  
  # ある組みが条件を満たすなら、その値段をvalに追加
  if sum([u >= X for u in U[1:]]) == M:
    val.append(U[0])

# 条件を満たす組みの中で、値段が最小のものを出力し、組みが無ければ-1を出力する
ans = 0
if len(val) == 0: ans = -1
else: ans = min(val)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
C = [(list(map(int, input().split()))) for _ in range(N)]
 
# bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める
ans = 10**10
for i in range(2**N):
  U = [0]*(M+1)
  for j in range(N):
    if ((i >> j) & 1):
      for k in range(M+1):
        U[k] += C[j][k]
  
  # ある組みが条件を満たすなら、その値段をvalに追加
  if sum([u >= X for u in U[1:]]) == M:
    ans = min(ans, M[0])

if ans == 10**10: print(-1)
else: print(ans)
 

Fixed submission:
N, M, X = map(int, input().split())
C = [(list(map(int, input().split()))) for _ in range(N)]

# bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める
val = []
for i in range(2**N):
  U = [0]*(M+1)
  for j in range(N):
    if ((i >> j) & 1):
      for k in range(M+1):
        U[k] += C[j][k]
  
  # ある組みが条件を満たすなら、その値段をvalに追加
  if sum([u >= X for u in U[1:]]) == M:
    val.append(U[0])

# 条件を満たす組みの中で、値段が最小のものを出力し、組みが無ければ-1を出力する
ans = 0
if len(val) == 0: ans = -1
else: ans = min(val)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(M)]
 
ans = 0
for i in range(1, N+1):
  # ノードi(=1,...,N)と結合しているノードを全て求め、connectに格納
  connect = []
  for j in range(M):
    if i in l[j]:
      if i == l[j][0]: connect.append(l[j][1])
      else: connect.append(l[j][0])
  
  # ノードiの標高が、結合している任意のノードの標高より高いなら ans += 1
  n = 0
  for c in connect:
    if H[i-1] > H[c-1]: n += 1
  if n == len(connect): ans += 1

print(ans)

Fixed submission:
S = input()
if S == 'ABC': print('ARC')
elif S == 'ARC': print('ABC')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(M)]

ans = 0
for i in range(1, N+1):
  # ノードi(=1,...,N)と結合しているノードを全て求め、connectに格納
  connect = []
  for j in range(M):
    if i in l[j]:
      if i == l[j][0]: connect.append(l[j][1])
      else: connect.append(l[j][0])
  
  # ノードiの標高が、結合している任意のノードの標高より高いなら ans += 1
  n = 0
  for c in connect:
    if H[i-1] > H[c-1]: n += 1
  if n == len(connect): ans += 1

print(ans)

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

# N,M=O(10^5)なので、O(N+M)で解く
# 各ノードについて、隣接する展望台の高さの最大値を更新する
neighbor_max = [0] * N
for _ in range(M):
  A, B = map(int, input().split())
  neighbor_max[A - 1] = max(neighbor_max[A - 1], H[B - 1])
  neighbor_max[B - 1] = max(neighbor_max[B - 1], H[A - 1])

# 各ノードについて、自身の高さと、隣接する展望台の高さの最大値を比較する
# 接続を一つも持たないノードについても、計算は正しい
ans = 0
for i in range(N):
  if H[i] > neighbor_max[i]: ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

print(len(set(S))

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
 
print(len(set(S)))
Buggy python submission (verdict: Runtime Error):
import math
R = int(input)

print(2*math.pi*R)

Fixed submission:
import math
R = int(input())
 
print(2*math.pi*R)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 
A = [int(input()) for _ in range(M)]

s = sum(A)
ans = -1
if N >= s: ans = N - s
print(ans)

Fixed submission:
N, M = map(int, input().split()) 
A = list(map(int, input().split()))
 
# N-sum(A)が残り日数である
s = sum(A)
ans = -1
if N >= s: ans = N - s
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().spit())
A = [input() for _ in range(M)]

s = sum(A)
ans = -1
if N >= s: ans = N - s
print(ans)

Fixed submission:
N, M = map(int, input().split()) 
A = list(map(int, input().split()))
 
# N-sum(A)が残り日数である
s = sum(A)
ans = -1
if N >= s: ans = N - s
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
 
def gcd(x, y):
  if y == 0: return x
  else: return gcd(y, x % y)

s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = gcd(a, b)
    for c in range(1, K+1):
      s += gcd(d, c)
      
print(s)

Fixed submission:
import math
K = int(input())
 
s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = math.gcd(a, b)
    for c in range(1, K+1):
      s += math.gcd(d, c)
      
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
 
def gcd(x, y):
  if y == 0: return x
  else: return gcd(y, x % y)

s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      s += gcd(gcd(a, b), c)
      
print(s)

Fixed submission:
import math
K = int(input())
 
s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = math.gcd(a, b)
    for c in range(1, K+1):
      s += math.gcd(d, c)
      
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())

def gcd(a,b,c):
  return math.gcd(math.gcd(a, b), c)

s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      s += gcd(a, b, c)
      
print(s)

Fixed submission:
import math
K = int(input())
 
s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = math.gcd(a, b)
    for c in range(1, K+1):
      s += math.gcd(d, c)
      
print(s)
Buggy python submission (verdict: Runtime Error):
X, Y, Z = map(int, input().split())
print(Z X Y)

Fixed submission:
X, Y, Z = input().split()
print(Z + ' ' + X + ' ' + Y)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))

s = sum(A)
A = sorted(A)
ans = 'Yes'
for i in M:
  if A[i] < s/(4*M): 
    ans = 'No'
    break
    
print(ans)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
A = sorted(A, reverse=True)
ans = 'Yes'
for i in range(M):
  if A[i]*(4*M) < s: 
    ans = 'No'
    break

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

if S[3] == S[4] and S[5] == S[6]: print('Yes')
else: print('No')

Fixed submission:
S = input()
 
if S[2] == S[3] and S[4] == S[5]: print('Yes')
else: print('No')
Buggy python submission (verdict: Runtime Error):
K, N = map(int, input().split())
A = list(map(int(input().split())))

K.append(A[0]+K)
l = K+1
for i in range(N):
  l = min(l, A[i+1]-A[i])

print(K-l)

Fixed submission:
K, N = map(int, input().split())
A = list(map(int, input().split()))
 
A.append(A[0]+K)
l = 0
for i in range(N):
  l = max(l, A[i+1]-A[i])

print(K-l)
Buggy python submission (verdict: Runtime Error):
S = input()

if S = 'AAA' or 'BBB': print('No')
else: print('Yes')

Fixed submission:
S = input()
 
if S == 'AAA' or S == 'BBB': print('No')
else: print('Yes')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]
 
if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N
 
ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break
 
print(ans)



n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(m)]
if n==1:
  for i in range(10):
    tmp=str(i)
    flag=True
    for j in range(m):
      if tmp[arr[j][0]-1]!=str(arr[j][1]):
        flag=False
    if flag==True:
      print(i)
      break
  else:
    print(-1)
else:
  for i in range(10**(n-1),10**n):
    tmp=str(i)
    flag=True
    for j in range(m):
      if tmp[arr[j][0]-1]!=str(arr[j][1]):
        flag=False
    if flag==True:
      print(i)
      break
  else:
    print(-1)

Fixed submission:
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]

if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N

ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break

print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())
 
if N >= 10: print(K)
else: print(100*(10-K))

Fixed submission:
N, R = map(int, input().split())
 
if N >= 10: print(R)
else: print(R + 100*(10-N))

Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split()))
 
if N >= 10: print(K)
else: print(100*(10-K))

Fixed submission:
N, R = map(int, input().split())
 
if N >= 10: print(R)
else: print(R + 100*(10-N))

Buggy python submission (verdict: Runtime Error):
N, R = int(input())

if N >= 10: print(K)
else: print(100*(10-K))

Fixed submission:
N, R = map(int, input().split())
 
if N >= 10: print(R)
else: print(R + 100*(10-N))
Buggy python submission (verdict: Runtime Error):
def from_10_to_n(x, n):
  tmp = x
  out = ''
  while tmp > 0:
    out = str(x % n) + out
    tmp = tmp // n
  return out

N, K = map(int, input().split())
N = from_10_to_n(x, n)
print(len(N))

Fixed submission:
def from_10_to_n(x, n):
  tmp = x
  out = ''
  while tmp > 0:
    out = str(x % n) + out
    tmp = tmp // n
  return out
 
N, K = map(int, input().split())
N = from_10_to_n(N, K)
print(len(N))
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = map(int, input().split())
 
ans = 10000000000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[j]-i)**2
    
  ans = min(ans, s)
  
print(ans)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
ans = 10000000000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[j]-i)**2
    
  ans = min(ans, s)
  
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = map(int, input().split())
 
ans = 100000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[j]-i)**2
    
  ans = min(ans, s)
  
print(ans)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
ans = 10000000000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[j]-i)**2
    
  ans = min(ans, s)
  
print(ans)

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

ans = 100000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[i]-i)**2
    
  ans = min(ans, s)
  
print(ans)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
ans = 10000000000
for i in range(100):
  s = 0
  for j in range(N):
    s += (X[j]-i)**2
    
  ans = min(ans, s)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = 'APPROVED'
for i in range(N):
  if N[i] % 2 == 0:
    if N[i] % 3 != 0 or N[i] % 5 != 0:
      ans = 'DENIED'
      break
      
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
ans = 'APPROVED'
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      ans = 'DENIED'
      break
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
S = [input() for _ in range(N)]
 
T = sorted(set(S))
t = len(T)
l = [S.count(T[i]) for i in range(t)]
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

S = Counter(S).most_common()
l = []
for i in S:
  if i[1] == S[0][1]: l.append(i[0])

l = sorted(l)
for i in l:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for _ in range(N)]
 
T = sorted(set(S))
t = len(T)
l = [S.count(T[i]) for i in range(t)]
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

S = Counter(S).most_common()
l = []
for i in S:
  if i[1] == S[0][1]: l.append(i[0])

l = sorted(l)
for i in l:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for _ in range(N)]
 
T = sorted(set(S))
t = len(T)
l = [0] * t
 
for i in range(t):
  l[i] = S.count(T[i])
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

Fixed submission:
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

S = Counter(S).most_common()
l = []
for i in S:
  if i[1] == S[0][1]: l.append(i[0])

l = sorted(l)
for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input.split()))

if N == len(set(A)): print('Yes')
else: print('No')


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

if N == len(set(A)): print('YES')
else: print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

print(max([(sum(p[i:i+K])+K)/2 for i in range(N-K+1)]))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
  
# 「和の期待値」は「期待値の和」なので、先に期待値を求める
for i in range(N):
  p[i] = (1+p[i])/2

# 累積和
S = [0]*N
S[0] = p[0]
for i in range(N-1):
  S[i+1] = S[i] + p[i+1]

ans = S[K-1]
for i in range(N-K):
  ans = max(ans, S[i+K] - S[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

l = [0]*(N-K+1)
for i in range(N-K+1):
  l[i] = (sum(p[i:i+K])+K)/2
  
print(max(l))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
  
# 「和の期待値」は「期待値の和」なので、先に期待値を求める
for i in range(N):
  p[i] = (1+p[i])/2

# 累積和
S = [0]*N
S[0] = p[0]
for i in range(N-1):
  S[i+1] = S[i] + p[i+1]

ans = S[K-1]
for i in range(N-K):
  ans = max(ans, S[i+K] - S[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
 
ans = 0
for i in range(N-K+1):
  ans = max(ans, (sum(p[i:i+K])+K)/2)
  
print(ans)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
  
# 「和の期待値」は「期待値の和」なので、先に期待値を求める
for i in range(N):
  p[i] = (1+p[i])/2

# 累積和
S = [0]*N
S[0] = p[0]
for i in range(N-1):
  S[i+1] = S[i] + p[i+1]

ans = S[K-1]
for i in range(N-K):
  ans = max(ans, S[i+K] - S[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
H = int(input())

# 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする
# すると、f(H)は以下の漸化式に従って求まる
# f(H)=2*f(floor(H/2)+1) (H>1)
# f(H)=1 (H=1)

def attack_num(x):
  if x == 1: return 1
  else: return 2*f(x // 2) + 1
  
print(attack_num(H))

Fixed submission:
H = int(input())
 
# 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする
# すると、f(H)は以下の漸化式に従って求まる
# f(H)=2*f(floor(H/2)+1) (H>1)
# f(H)=1 (H=1)
 
def attack_num(x):
  if x == 1: return 1
  else: return 2*attack_num(x // 2) + 1
  
print(attack_num(H))

Buggy python submission (verdict: Time Limit Exceeded):
H = int(input())

ans = 0
l = [H]
while len(l) > 0:
  ans += 1
  if l[0] == 1: del l[0]
  else:
    l = [l[0] // 2] + [l[0] // 2] + l[1:]

print(ans)

Fixed submission:
H = int(input())
 
# 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする
# すると、f(H)は以下の漸化式に従って求まる
# f(H)=2*f(floor(H/2)+1) (H>1)
# f(H)=1 (H=1)
 
def attack_num(x):
  if x == 1: return 1
  else: return 2*attack_num(x // 2) + 1
  
print(attack_num(H))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
 
if a > b:
  print(str(b) * a)
else
  print(str(a) * b)

Fixed submission:
a_str, b_str = input().split()
a = int(a_str)
b = int(b_str)

A = a_str*b
B = b_str*a
 
print(min(A, B))

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

A = a_str*b
B = b_str*a

print(min(A, B))

Fixed submission:
a_str, b_str = input().split()
a = int(a_str)
b = int(b_str)

A = a_str*b
B = b_str*a
 
print(min(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

# i=1 では必ず成り立つので i>=2 から調べる
s = 1
for i in range(1, N):
  flag = True
  for j in range(i):
    if P[j] < P[i]:
      flag = False
      break
  
  if flag: s += 1
    
print(s)

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

# 各時点での最小値を求める
m = [0]*(N)
m[0] = p[0]
for i in range(N-1):
  m[i+1] = min(m[i], p[i+1])

ans = 1
for i in range(1, N):
  if m[i-1] > p[i]: ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

lcm = 0
for i in range(1, B+1):
  if (A * i) % B == 0:
    lcm = A * i
  
print(lcm)

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

print(a * b // math.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
A, B = int(input().split())

print(A*B)

Fixed submission:
A, B = map(int, input().split())

if 1<=A<=9 and 1<=B<=9: print(A*B)
else: print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = ''
for i in range(1, N+1):
  ans += str(A.index(i)+1)
  ans += ' '
  
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
l = [0]*N
for i in range(N):
  l[A[i]-1] = str(i+1)

ans = ''
for i in range(N):
  ans += (l[i] + ' ')
  
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

N = len(S)
# Sの各文字は'L', 'R', 'U', 'D'のいずれかであることに注意する
# 1,3,...文字目が'L'でなく、偶数文字目が'R'でないとき 'Yes'とする
for i in range(N):
  if (i % 2 == 0 and S[i] == 'L') or (i % 2 == 1 and S[i] == 'R'):
    ans = 'No'
    break
    
print(ans)

Fixed submission:
S = input()
N = len(S)

# 1,3,...文字目が'R'でも'U'でも'D'でもない、または、2,4,...文字目が'L'でも'U'でも'D'でもないとき、'No'を出力する
ans = 'Yes'
for i in range(N):
  if (i % 2 == 0 and S[i] != 'R' and S[i] != 'U' and S[i] != 'D') or (i % 2 == 1 and S[i] != 'L' and S[i] != 'U' and S[i] != 'D'):
    ans = 'No'
    break
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

p = np.ones(N)*K
for i in range(Q):
  p -= 1
  p[A[i]-1] += 1
  
for i in range(N):
  if p[i] > 0: print('Yes')
  else: print('No')

Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
 
p = [K-Q]*N
for i in range(Q):
  p[A[i]-1] += 1
  
for i in range(N):
  if p[i] > 0: print('Yes')
  else: print('No')
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

# 電源タップの個数をa, 差込口の個数をnumとおく 
a = 0
num = 1
while num < B:
  num -= 1
  num += a
  ans += 1

print(a)

Fixed submission:
import math
A, B = map(int, input().split())
 
# A*x-(x-1) >= B
# (A-1)*x >= B-1
# x >= ceil((B-1)/(A-1))
print(math.ceil((B-1)/(A-1)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

a = 0
l = [0]*(N-1)
for i in range(N-1):
  if H[i] >= H[i+1]: a += 1
  else: a = 0
  l[i] = a

print(max(l))

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

a = 0
ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]: a += 1
  else: 
    a = 0
  ans = max(ans, a)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [input() for _ in range(N)]

for i in range(N):
  s[i] = list(set(s[i]))
  
print(len(set(s)))

Fixed submission:
from collections import Counter 
N = int(input())
s = [input() for _ in range(N)]
 
# N=10^5より、O(N)で解く
for i in range(N):
  s[i] = sorted(s[i])
  s[i] = ''.join(s[i])

s = Counter(s).most_common()
ans = 0
for t in s:
  ans += t[1]*(t[1]-1)//2
  
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
 
ans = 'Yes'
for i in range(N-1, 0, -1):
  if A[i] > A[i-1]: A[i-1] -= 1
    if A[i] > A[i-1]:
      ans = 'No'
      break

print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
 
# 左から順にやるとうまくいかない => [1, 4, 3, 2, 1] みたいな場で失敗
# 右から順に考えよ！
ans = 'Yes'
for i in range(N-1, 0, -1):
  if A[i] < A[i-1]: A[i-1] -= 1
  if A[i] < A[i-1]:
    ans = 'No'
    break

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())

if (A+B) %2 == 0: print((A+B) // 2)
else: print('IMPOSSIBLE')

Fixed submission:
A, B = map(int, input().split())
 
if (A+B) %2 == 0: print((A+B) // 2)
else: print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
N, D = map(int, input().split())

# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる

# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))

print(-(-N//(2D+1)))

Fixed submission:
N, D = map(int, input().split())
 
# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる
 
# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))
 
print(-(-N//(2*D+1)))
Buggy python submission (verdict: Runtime Error):
N, D = map(int, input().split())
 
# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる
 
# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))
 
# ceil(B/A) = floor((A+B-1)/A)
print((N+2*D) // (2*D+1))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
 
# M_list = index(max(A_1,...,A_N))
# M = max(A)
# sub_M = sub_max(A)

# iがM_listに含まれるときにはsub_Mを出力
# それ以外ではMを出力

M = max(A)
sub_M = 0
for i in range(N):
  if i not in M_list:
    sub_M = max(sub_M, A[i])
    
M_list = []
for i in range(N):
  if A[i] == M: M_list.append(i)
    
for i in range(N):
  if i in M_list: print(sub_M)
  else: print(M)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)

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

ans = 'Yes'
for i in range(N-1, 0, -1):
  if A[i] > A[i-1]: A[i-1] -= 1
    if A[i] > A[i-1]:
      ans = 'No'
      break

print(ans)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]

# max(A_2,A_3,...,A_N)
# max(A_1,A_3,...,A_N)
# max(A_1,A_2,...,A_(N-1))

M_1 = max(A)
M_2 = max(A.replace(M_1, 0))

for i in range(N):
  if A[i] != M_1: print(M_1)
  else: print(M_2)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]

A = sorted(A)
print(sum(A[1:])

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

print(min(A*N, B))

Fixed submission:
N, A, B = map(int, input().split())
 
print(min(A*N, B))