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

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

penalty = 0

corrected = {}
wa = {}

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and not corrected.get(pi)):
    corrected[pi] = True
  elif (si == 'WA' and not corrected.get(pi)):
    wa[pi] = wa[pi] + 1 if wa.get(pi) else 1

correct = len(corrected.keys())
for i in corrected.keys():
	penalty += wa[i] if  wa.get(i) else 0

print("{} {}".format(correct, penalty))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int,input().split()))

penalty = 0

corrected = {}
wa = {}

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and not corrected.get(pi)):
    corrected[pi] = True
  elif (si == 'WA' and not corrected.get(pi)):
    wa[pi] = wa[pi] + 1 if wa.get(pi) else 1

correct = len(corrected.keys())
for i in corrected.keys()
	penalty += wa[i] if  wa.get(i) else 0

print("{} {}".format(correct, penalty))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int,input().split()))

penalty = 0

corrected = {}
wa = {}

for i in range(m):
  pi, si = input().split()
  if (si == 'AC' and not corrected.get(pi)):
    corrected[pi] = True
  elif (si == 'WA' and not corrected.get(pi)):
    wa[pi] += wa[pi]

correct = len(corrected.keys())
for i in corrected.keys()
	penalty += wa[i]

print("{} {}".format(correct, penalty))
Problem p03494 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
even = True
count = 0
while even:
    for ai in range(len(a)):
        if a[ai] % 2 != 0:
            even = False
            break

    if even:
        a = list(map(lambda num: num / 2, a))
        count += 1
    else:
        break
print(count)

Buggy submission (verdict: Runtime Error):
    n = input()
    a = list(map(int, input().split()))
    even = True
    count = 0
    while even:
        for ai in range(len(a)):
            if a[ai] % 2 != 0:
                even = False
                break

        if even:
            a = list(map(lambda num: num / 2, a))
            count += 1
        else:
            break
    print(count)
Problem p02969 (python)

Fixed submission:
r = input()
Ans=3*int(r)**2

print(Ans)

Buggy submission (verdict: Runtime Error):
from collections import deque 

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

for i in range(N):
    remA=A.popleft()
    print(max(A))
    A.append(remA)

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

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

for i in range(N):
    remA=A.pop(i)
    allA.append(max(A))
    A.insert(i, remA)

for i in range(N):
    print(allA[i])
Problem p02795 (python)

Fixed submission:
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]

H = int(fetch_one_line())
W = int(fetch_one_line())
N = int(fetch_one_line())

large_num = H if H > W else W
import math
print(math.ceil(N / large_num))

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


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]

N = int(fetch_one_line())
s_t = fetch_inputs(N)
X = fetch_one_line()

flag = False
sum_time = 0
for tmp in s_t:
    s, t = tmp.split(" ")
    if not flag and s == X:
        flag = True
        continue

    t = int(t)
    if flag:
        sum_time += t

print(sum_time)
Problem p02811 (python)

Fixed submission:
from sys import stdin

def fetch_one_line():
    return stdin.readline().rstrip()
  
def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]
  
K, X = fetch_int_input()

answer = ["No", "Yes"]
print(answer[int(500 * K >= X)])

Buggy submission (verdict: Runtime Error):
def fetch_one_line():
    return stdin.readline().rstrip()
  
def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]
  
K, X = fetch_one_line()

answer = ["Yes", "No"]
print(answer[int(500 * K >= X)])
Problem p02841 (python)

Fixed submission:
def fetch_int_input():
    return [int(s) for s in input().strip().split()]

pre_input = fetch_int_input()
nxt_input = fetch_int_input()

echo_str = ""
if pre_input[0] != nxt_input[0]:
  echo_str = 1
 
else:
  echo_str = 0
 
print(echo_str)

Buggy submission (verdict: Runtime Error):
TAX = 1.08
value = int(input())

row_cost = int(value / TAX)

flag = False
echo_cost = 0
if int(row_cost * TAX) == value:
    flag = True
    echo_cost = int(row_cost )
elif int((row_cost + 1) * TAX) == value:
    flag = True
    echo_cost = int(row_cost + 1)

else :
    flag = False

if flag:
    print(echo_cost)
else:
    print(":(")
Problem p02830 (python)

Fixed submission:
_ = input()
a,b = input().split()
ans = ''
for i, s in enumerate(a):
  ans+=s
  ans+=b[i]
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = input().split()
ans = ''
for i, s in enumerate(a):
  ans+=s
  ans+=b[i]
print(ans)
Problem p02993 (python)

Fixed submission:
s = list(int(s) for s in input())

for i in range(0, len(s)-1):
    if s[i] == s[i+1]:
        print('Bad')
        break

else:
    print('Good')

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from math import ceil

def lcm(a, b):
    return a*b//gcd(a, b)

def num(l, r, n):
    return r//n-(l-1)//n

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

l = lcm(c, d)
print((b-a+1)-num(a, b, c)-num(a, b, d)+num(a, b, l))
Problem p03455 (python)

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

if (a*b % 2 == 0):
  print('Even')
else:
  print('Odd')

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

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

Fixed submission:
H, N = map(int, input().split())
a = list(map(int, input().split()))
sum = sum(a)
if sum >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
a = list(map(int, input().split())
sum = sum(a)
if sum >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
a = list(map(int, input8).split())
sum = sum(a)
if sum >= H:
  print("Yes")
else:
  print("No")
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
count = 0
for i in range(N):
  if h[i] >= K:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split())
         
count = 0
for i in range(N):
  if h[i] >= K:
         count += 1
print(count)
Problem p03471 (python)

Fixed submission:
X, Y = map(int, input().split())
statement = False
for a in range(X+1):
  for b in range(X-a+1):
    c = X - a - b
    if a * 10000 + b * 5000 + c * 1000 == Y:
      print(str(a) + " " + str(b) + " " + str(c))
      statement = True
      break
  if statement:
    break
if not statement:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input())
statement = False
for a in range(X+1):
  for b in range(X-a+1):
    c = X - a - b + 1
    if a * 10000 + b * 5000 + c * 1000 == Y:
      print(str(a) + " " + str(b) + " " + str(c))
      statement = True
      break
    if statement:
      break
if not statement:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
X = int(input())
Y = int(input())
statement = False
for a in range(X+1):
  for b in range(X-a+1):
    for c in range(X-a-b+1):
      if (a * 10000 + b * 5000 + c * 1000 == Y) and (a + b + c == X):
        print(str(a) + " " + str(b) + " " + str(c))
        statement = True
if not statement:
  print("-1 -1 -1")
Problem p03854 (python)

Fixed submission:
s = input()
s2 = s.split('eraser')
s3 = ''.join(s2).split('erase')
s4 = ''.join(s3).split('dreamer')
s5 = ''.join(s4).split('dream')
s5 = list(set(s5))
if len(s5) == 1 and s5[0] == '':
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
s2 = s.split('dream')
s3 = ''.join(s2).split('erase')
s3.remove('er')
s3.remove('r')
if len(s3) != 0:
  print("NO")
else:
  print("YES")
Problem p03485 (python)

Fixed submission:
import math

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

print(math.ceil((a + b) / 2))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

s.sort(reverse=True)
t.sort(reverse=True)

s_len = len(s)
t_len = len(t)

if(s_len < t_len):
    short = s_len
else:
    short = t_len

flag = False
for i in range(short+1):
    if(s[i] < t[i]):
        flag = True

if(s < t or flag):
    print('Yes')
else:
    print('No')
Problem p03385 (python)

Fixed submission:
import collections
abc = input().strip()
if len(abc) != 3:
    print("No")
else:
    c = collections.Counter(abc)
    if c['a']==1 and c['b'] ==1 and c['c'] == 1:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import collections
abc = input().strip()
c = collections.Counter(abc)
if c['a']==1 and c['b' ==1 and c['c' == 1:
    print("Yes")
else:
    print("No")
Problem p03388 (python)

Fixed submission:
import math

N = int(input().strip())
grid = []
for i in range(N):
	array = list(map(int, input().strip().split(' ')))
	grid.append(array)

for i in grid:
	i.sort()
	a,b = [i[0],i[1]]
	if(a == b or a+1 == b):
		print(2*a-2)
	else:
		c = int(math.sqrt(a*b))
		if c**2 == a*b:
			c-=1
		if(c*(c+1)>=a*b):
			print(2*c-2)
		else:
			print(2*c-1)

Buggy submission (verdict: Runtime Error):
import math

N = int(input().strip())
grid = []
for i in range(N):
  array = list(map(int, input().strip().split(' ')))
  grid.append(array)

for i in grid:
  i.sort()
  print(i)
  a,b = [i[0],i[1]]
  if(a == b or a+1 == b):
    print(2*a-2)
  else:
    c = int(math.sqrt(a*b))
	if c == a*b: c-=1
    if(c*(c+1)>=a*b):
      print(2*c-2)
    else:
      print(2*c-1)

Buggy submission (verdict: Runtime Error):
def compute(n1, n2):
    threshold = n1*n2-1
    count = 0
    if n1 == 1:
        index1 = 2
    else:
        index1 = 1
    index2 = threshold
    list1, list2 = [], []
    while index1 < index2:
        index2 = int(threshold/index1)
        while index2 in list2 or index2 == n2:
            index2 -= 1
        count+=1
        index1 += 1
        if index1 == n1:
            index1+=1
            
    while not (index2 == 1 or (n2 == 1 and index2==2)):
        index1 = int(threshold)/index2
        while index1 in list1 or index1 == n1:
            index1 += 1
        count+=1
        index2 -=1
        if index2 == n2:
            index2 -=1
    print(count)
    return

N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)

for i in grid:
    compute(i[0],i[1])
Problem p02780 (python)

Fixed submission:
N, K = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
d = 0
e = []

for i in range(len(b)):
    d = d + b[i]
    c.append(d)

for i in range(len(b) - K):
    e.append(c[i + K] - c[i] + K)
if N==K:
    print((sum(b) + K)/2)
else:    
    print(max(e)/2)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
d = 0
e = []

for i in range(len(b)):
    d = d + b[i]
    c.append(d)

for i in range(len(b) - K):
    e.append(c[i + K] - c[i] + K)

print(max(e)/2)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
d = 0
e = []

for i in range(len(b)):
    d = d + b[i]
    c.append(d)

for i in range(len(b) - K):
    e.append(c[i + K] - c[i] + K)

print(max(e)/2)
Problem p02817 (python)

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

Buggy submission (verdict: Runtime Error):
    s,t = input().split()
    print(t+s)
Problem p03493 (python)

Fixed submission:
s = input()
cnt = 0
if s[0] == "1":
  cnt+=1
if s[1] == "1":
  cnt+=1
if s[2] == "1":
  cnt+=1
  
print(cnt)

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
c = 0
if s[0] == 1:
  c = c+1
if s[1] == 1:
  c = c+1
if s[2] == 1:
  c = c+1
print(c)
Problem p02821 (python)

Fixed submission:
# 二分探索を利用した
N, M = map(int, input().split())
tmp = input().split()

A = [int(tmp[i]) for i in range(N)]
A.sort()
cum_A = [None]*N
cum_A[N-1] = A[N-1]
for i in range(1,N):
    cum_A[N-1-i] = cum_A[N-i] + A[N-1-i]
cum_A.append(0)


def geq(A, cum_A, X, N):  # ある定数X以上になる握手の方法が何通りあるか,Aは昇順sort済み
    sum = 0
    val = 0
    index = 0
    for i in range(N):
        while True:
            if index != N and A[i] + A[N - 1 - index] >= X:
                index += 1
            else:
                sum += index
                val += A[i] * index + cum_A[N-index]
                break
    return sum, val

# 2<=X<=2*Nで二分探索をする
low = 2
high = 2*A[N-1]
while low <= high:
    X = (low + high)//2
    sum, val = geq(A, cum_A, X, N)
    if sum == M:
        break
    elif sum > M:
        low = X+1
    else:
        high = X-1
if sum < M:
    X -= 1
sum, val = geq(A, cum_A, X, N)
ans = val - X*(sum-M)
print(ans)

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

A = [int(tmp[i]) for i in range(N)]


score = [None]*(N*N)
for i in range(N):
    for j in range(N):
        score[i*N+j] = A[i] + A[j]
score.sort()
sum = 0
for i in range(M):
    sum += score[N*N-1-i]
print(sum)
Problem p02971 (python)

Fixed submission:
def main():
	import sys
	import numpy as np
	input = sys.stdin.readline
	N = int(input())
	A = [int(input()) for _ in range(N)]
	A = np.array(A)
	maxNum = np.max(A)
	maxIndex = np.where(A == A.max())[0]
	if len(maxIndex) > 1:
		for _ in range(N):
			print(maxNum)
	elif maxIndex[0] == 0:
		print(np.max(A[1:]))
		for i in range(1, N):
			print(maxNum)
	elif maxIndex[0] == N-1:
		for i in range(N-1):
			print(maxNum)
		print(np.max(A[:N-1]))
	else:
		for i in range(maxIndex[0]):
			print(maxNum)
		prev = max(np.max(A[:maxIndex[0]]), np.max(A[maxIndex[0]+1:]))
		print(prev)
		for i in range(maxIndex[0]+1, N):
			print(maxNum)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
	import sys
	input = sys.stdin.readline
	N = int(input())
	A = [int(input()) for _ in range(N)]
	maxNum = max(A)
	maxIndex = [i for i, x in enumerate(A) if x == max(A)]
	if len(maxIndex) > 1:
		for _ in range(N):
			print(maxNum)
	else:
		for i in range(N):
			if i != maxIndex[0]:
				print(maxNum)
			else:
				prev = max(max(A[:i]), max(A[i+1:]))
				print(prev)

if __name__ == '__main__':
    main()
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = []
xyh1 = []
for _ in range(N):
	x0, y0, h0 = map(int, input().split())
	xyh.append([x0,y0,h0])
	if h0 > 0:
		xyh1.append([x0,y0,h0])

def absum(x, y, h, Cx, Cy):
	return abs(x - Cx) + abs(y - Cy) + h

if len(xyh1) > 1:
	for Cx in range(101):
		for Cy in range(101):
			for i in range(len(xyh1)-1):
				if absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy) != absum(xyh1[i+1][0], xyh1[i+1][1], xyh1[i+1][2], Cx, Cy):
					break
			else:
				H = absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy)
				print(Cx, Cy, H)
else:
	print(xyh1[0][0], xyh1[0][1], xyh1[0][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = []
xyh1 = []
for _ in range(N):
	x0, y0, h0 = map(int, input().split())
	xyh.append([x0,y0,h0])
	if h0 > 0:
		xyh1.append([x0,y0,h0])

def absum(x, y, h, Cx, Cy):
	return abs(x - Cx) + abs(y - Cy) + h

if len(xyh1) > 1:
	for Cx in range(101):
		for Cy in range(101):
			for i in range(len(xyh1)-1):
				if absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy) != absum(xyh1[i+1][0], xyh1[i+1][1], xyh1[i+1][2], Cx, Cy):
					break
			else:
				H = absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy)
				print(Cx, Cy, H)
else:
	print(xyh1[i][0], xyh1[i][1], xyh1[i][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh = []
xyh1 = []
for _ in range(N):
	x0, y0, h0 = map(int, input().split())
	xyh.append([x0,y0,h0])
	if h0 > 0:
		xyh1.append([x0,y0,h0])

def absum(x, y, h, Cx, Cy):
	return abs(x - Cx) + abs(y - Cy) + h


for Cx in range(101):
	for Cy in range(101):
		for i in range(len(xyh1)-1):
			if absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy) != absum(xyh1[i+1][0], xyh1[i+1][1], xyh1[i+1][2], Cx, Cy):
				break
		else:
			H = absum(xyh1[i][0], xyh1[i][1], xyh1[i][2], Cx, Cy)
			print(Cx, Cy, H)
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int, input().split()))
c_odd  = collections.Counter(v[::2])
c_even = collections.Counter(v[1::2])
odd    = c_odd.most_common()[:2]
even   = c_even.most_common()[:2]
if (len(odd) == 1) & (len(even) == 1):
	if odd[0][0] == even[0][0]:
		ans = odd[0][1]
	else:
		ans = 0
elif len(odd) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[0][1] - even[1][1]
	else:
		ans = n - odd[0][1] - even[0][1]
elif len(even) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[1][1] - even[0][1]
	else:
		ans = n - odd[0][1] - even[0][1]
else:
	if odd[0][0] == even[0][0]:
		ans = min(n - odd[0][1] - even[1][1], n - odd[1][1] - even[0][1])
	else:
		ans = n - odd[0][1] - even[0][1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))
c_odd  = collections.Counter(v[::2])
c_even = collections.Counter(v[1::2])
odd    = c_odd.most_common()[:2]
even   = c_even.most_common()[:2]
if (len(odd) == 1) & (len(even) == 1):
	if odd[0][0] == even[0][0]:
		ans = odd[0][1]
	else:
		ans = 0
elif len(odd) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[0][1] - even[1][1]
	else:
		ans = n - odd[0][1] - even[0][1]
elif len(even) == 1:
	if odd[0][0] == even[0][0]:
		ans = n - odd[1][1] - even[0][1]
	else:
		ans = n - odd[0][1] - even[0][1]
print(ans)
Problem p03355 (python)

Fixed submission:
s = str(input())
K = int(input())

def find(str):
	lt = []
	for start in range(len(str)):
		for end in range(start + 1, len(str) + 1):
			lt.append(str[start:end])
	lt = list(set(lt))
	lt.sort()

	return lt

s_pt = list(set(list(s)))
s_pt.sort()
ans = []
for i in range(min(5, len(s_pt))):
	ind = [ix for ix, x in enumerate(s) if x == s_pt[i]]
	for j in ind:
		ans += find(s[j:min(j+5, len(s))])
	ans = list(set(ans))
	if len(ans) >= 5:
		break
ans = list(set(ans))
ans.sort()
print(ans[K-1])

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

def find(str):
	lt = []
	for start in range(len(str)):
		for end in range(start + 1, len(str) + 1):
			lt.append(str[start:end])
	lt = list(set(lt))
	lt.sort()

	return lt

s_pt = list(set(list(s)))
s_pt.sort()
ans = []

for i in range(min(5, len(s_pt))):
	ind = [ix for ix, x in enumerate(s) if x == s_pt[i]]
	for j in ind:
		ans += find(s[j:min(j+5, len(s))])
	if len(ans) >= 5:
		break
ans = list(set(ans))
ans.sort()
print(ans[K-1])

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

def find(str):
	lt = []
	for start in range(len(str)):
		for end in range(start + 1, len(str) + 1):
			lt.append(str[start:end])
	lt = list(set(lt))
	lt.sort()

	return lt

s_pt = list(set(list(s)))
s_pt.sort()
ans = []

for i in range(5):
	ind = [ix for ix, x in enumerate(s) if x == s_pt[i]]
	for j in ind:
		ans += find(s[j:min(j+5, len(s))])
	if len(ans) >= 5:
		break
ans = list(set(ans))
ans.sort()
print(ans[K-1])
Problem p02900 (python)

Fixed submission:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
a, b = map(int, input().split())
la = prime_decomposition(a)
lb = prime_decomposition(b)
la_lb_and = list(set(la) & set(lb))
    
print(len(la_lb_and) + 1)

Buggy submission (verdict: Runtime Error):
import math

def is_prime(n):
  if n == 1: 
    return 1

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return 0

  return 1
  
a, b = map(int, input().split())
max_d = math.gcd(a, b)
ans = 0
for i in range(1, max_d + 1):
  if a % i == 0 and b % i == 0:
    ans += is_prime(i)
    
print(ans)
Problem p02922 (python)

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

if b == 1:
  ans = 0
else:
  ans = math.ceil((b - 1) / (a - 1))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

if b = 1:
  ans = 0
else:
  ans = math.ceil((b - 1) / (a - 1))

print(ans)
Problem p02923 (python)

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

ans_list = []
a = 0
b = 0
for c, l in enumerate(li):
  if l <= a:
    b += 1
    if c == n - 1:
      ans_list.append(b)
  else:
    if c != 0:
      ans_list.append(b)
    b = 0
  a = l

if len(ans_list) != 0:
  ans = max(ans_list)
else:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))

ans_list = []
a = 0
b = 0
for c, l in enumerate(li):
  if l <= a:
    b += 1
    if c == n - 1:
      ans_list.append(b)
  else:
    if c != 0:
      ans_list.append(b)
    b = 0
  a = l

ans = max(ans_list)
print(ans)
Problem p02947 (python)

Fixed submission:
n = int(input())
li = [''.join(sorted(input())) for _ in range(n)]

ans = 0
w_dic = {}
for l in li:
  if not w_dic.get(l):
    w_dic[l] = 1
  else:
    ans += w_dic[l]
    w_dic[l] = w_dic[l] + 1

print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
li = [sorted(list(input())) for a in range(n)]
ans = 0
le = len(li)
while le != 1:
  t = li[0]
  cnt = 0
  for n, w in reversed(list(enumerate(li[1:]))):
    if t == w:
      cnt += 1
      li.pop(n + 1)
  ans += cnt * (cnt + 1) / 2
  li.pop(0)
  le = len(li)

print(ans)
Problem p02952 (python)

Fixed submission:
# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2 == 1 and j == 1:
    ans += int(i)
  elif j == n and j % 2 == 1:
    ans += int(i) - int(str(9) * (j - 1))
  elif j == 1:
    ans += 9
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2:
    ans += int(i) - int(str(9) * (j - 1))
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)
Problem p02953 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
li = [int(a) for a in input().split()]
ans = 'Yes'

if n > 1:
  for i in range(n-1):
    if li[-(i+2)] <= li[-(i+1)]:
      pass
    elif li[-(i+2)] - 1 <= li[-(i+1)]:
      li[-(i+2)] = li[-(i+2)] - 1
    else:
      ans = 'No'
      break

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
li = [map(int, input().split())]
ans = 'Yes'

if n > 1:
  for i in range(n-1):
    if li[-(i+2)] <= li[-(i+1)]:
      pass
    elif li[-(i+2)] - 1 <= li[-(i+1)]:
      li[-(i+2)] = li[-(i+2)] - 1
    else:
      ans = 'No'
      break

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
l = [int(i) for i in input().split()]
if n > 1:
  for j in range(n):
    if max(l[:j]) - min(l[j:]) >= 2:
      print('No')
      exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
l = [int(input()) for i in range(n)]
if n > 1:
  for j in range(n):
    if max(l[:j]) - min(l[j:]) >= 2:
      print('No')
      exit()
print('Yes')