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

Fixed submission:
S = input()
w = int(input())
t = ""
r = len(S)//w if len(S) % w == 0 else len(S)//w+1
for i in range(r):
	t += S[w*i]
print(t)

Buggy submission (verdict: Runtime Error):
S = input()
w = int(input())
t = ""
for i in range(len(S)//w + 1):
	t += S[w*i]
print(t)
Problem p03309 (python)

Fixed submission:
import itertools, math
N = int(input())
A = list(map(int,input().split()))
C = [A[i] - (i+1) for i in range(N)]

def SAD(C,b):
	S = 0
	for i in range(N):
		S += abs(C[i] - b)
	return S

MAX, MIN = max(C)+1, min(C)

i = 0
while MAX - MIN > 1:
	mid = (MIN + MAX)//2
#	print((MIN,mid,MAX,":",SAD(C,mid) - SAD(C,mid-1)))
	if 	SAD(C,mid) - SAD(C,mid-1) < 0:
		MIN = mid
	else:
		MAX =mid
print(SAD(C,MIN))

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

C = [A[i] - (i+1) for i in range(N)]

def SAD(C,b):
	S = 0
	for i in range(N):
		S += abs(C[i] - b)
	return S

MAX, MIN = max(C), min(C)

while MIN != MAX:
	d = (MAX-MIN)//3
	x1 = MIN + d
	x2 = MIN + 2*d
	s1 = SAD(C,x1)
	s2 = SAD(C,x2)
#	print((x1,s1,"vs",x2,s2))
	if s1 > s2:
		MIN = x1
	else:
		MAX = x2
print(s1)
Problem p03330 (python)

Fixed submission:
N,C = map(int,input().split())
D = []
for i in range(C):
    D.append(list(map(int,input().split())))
c = []
for i in range(N):
    c.append(list(map(int,input().split())))

import itertools
current_minimum = 1000 * 500 * 500 + 1
Z = []
Z.append([0]*C)
Z.append([0]*C)
Z.append([0]*C)
#print(Z)

for (i,j) in itertools.product(range(N),range(N)):
	cur_mod = ((i+1)+(j+1)) % 3
	cur_color = c[i][j]
	#print(cur_mod)
	#print(cur_color)
	Z[cur_mod][cur_color-1] += 1

current_minimum = 1000 * 500 * 500 + 1
for (c0,c1,c2) in itertools.permutations(range(C), 3):
	tmp = 0
	color = [c0,c1,c2]
	for cur_mod in range(3):
		target_color = color[cur_mod]
		for cur_color in range(C):
			tmp += Z[cur_mod][cur_color] * D[cur_color][target_color]
	if current_minimum >= tmp:
		current_minimum = tmp
print(current_minimum)

Buggy submission (verdict: Runtime Error):
import functools  # Python3 
N,M = map(int,input().split())
x, y, z = [0] * N, [0] * N, [0] * N
for i in range(N):
	x[i], y[i], z[i] = map(int,input().split())

if M==0:
	print(0)
	exit()

ppp = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:])
pmp = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:])
ppm = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:])
pmm = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:])
mpp = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:])
mpm = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:])
mmp = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:])
mmm = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:])

MAX = 0
for lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:
	if lis  > MAX:
		MAX = lis
print(MAX)
Problem p03475 (python)

Fixed submission:
N = int(input())
C = [0 for _ in range(N-1)]
S = [0 for _ in range(N-1)]
F = [0 for _ in range(N-1)]
for i in range(N-1):
	C[i],S[i],F[i] = map(int,input().split())

def f(i):
	s = 0
	while i < N-1:
		# find the fastest train at time s from i stattion.
		if s <= S[i]:
			s = S[i]+C[i]
		else:
			m = (s-S[i]) % F[i]
			if m == 0:
				s = s + C[i]
			else:
				s = s + (F[i]-m) + C[i]
			# we use the fact that F[i] | S[i]
		i += 1
	return s

for i in range(N):
	print(f(i))

Buggy submission (verdict: Runtime Error):
N = int(input())
C = [0 for _ in range(N-1)]
S = [0 for _ in range(N-1)]
F = [0 for _ in range(N-1)]
for i in range(N-1):
	C[i],S[i],F[i] = map(int,input().split())

def f(i):
	s = 0
	while i < N-1:
		# find the fastest train at time s from i stattion.
		if s <= S[i]:
			s = S[i]+C[i]
		else:
			m = (s-S[i]) % F[i]
			if m == 0:
				s = s + C[i]
			else:
				s = s + (F-m) + C[i]
			# we use the fact that F[i] | S[i]
		i += 1
	return s

for i in range(N):
	print(f(i))
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())
if A > B:
	print("GREATER")
elif A == B:
	print("EQUAL")
else:
	print("LESS")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A > B:
	print("GREATER")
elif A = B:
	print("EQUAL")
else A < B:
	print("LESS")
Problem p03739 (python)

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

def find(a,flag):
	c = 0
	s = 0
	for i in range(n):
		if flag and s + a[i] > 0:
			flag = False
			s = s + a[i]
		elif flag:
			c = c + abs(s + a[i])+1
			flag = False
			s = 1
		elif not flag and s + a[i] < 0:
			flag = True
			s = s + a[i]
	#		print((s,f,c))
		else:
			c = c + abs(s+a[i])+1
			flag = True
			s = -1
	return c

cplus = find(a,True)
cmin = find(a,False)
print(min(cplus,cmin))

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

def find(a):
	f = "+" if a[0] < 0 else "-"
	s = a[0]
	c = 0
	#print((s,f,c))
	for i in range(1,n):
		if f == "+" and s + a[i] > 0:
			f = "-"
			s = s + a[i]
	#		print((s,f,c))
		elif f == "+":
			c = c + abs(s + a[i])+1
			f = "-"
			s = 1
	#		print((s,f,c))
		elif f == "-" and s + a[i] < 0:
			f = "+"
			s = s + a[i]
	#		print((s,f,c))
		else:
			c = c + abs(s+a[i])+1
			f = "+"
			s = -1
	return c

if a[0] = 0:
	a[0] = -1
	cmin = find(a)
	a[0] = 1
	cmax = find(a)
	c = min(cmin,cmax)
else:
	c = find(a)
print(c)
Problem p03845 (python)

Fixed submission:
N = int(input())
Nl = list(map(int, input().split()))
s = sum(Nl)

M = int(input())
for i in range(M):
    Ml = list(map(int, input().split()))
    print(s + Ml[1] - Nl[Ml[0] - 1])

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <array>

using namespace std;

int main(){
    int N, M, k, val, sum = 0, ans;

    array<int, 100> p;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> p[i];
        sum += p[i];
    }

    cin >> M;
    for(int i = 0; i < M; i++){
        cin >> k >> val;
        cout << sum + val - p[k - 1] << '\n';
    }
    
}
Problem p03693 (python)

Fixed submission:
a,b,c=map(int,input().split())
if((a*100+b*10+c)%4==0):
	print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[len(a)-1]-a[0])
Problem p02960 (python)

Fixed submission:
S = input()
 
dp = [[0]*13 for j in range(len(S)+1)]
mod = 10**9+7
 
dp[0][0] = 1
k = 1
L0 = list(range(10))

for s in S:
  if ('?' == s):
    L = L0
  else:
    L = [int(s)]
 
  for l in L:
    for i in range(13):
      tmp = (i * 10) + l
      m = tmp % 13
      dp[k][m] = ((dp[k][m] + dp[k-1][i]) % mod)
  k += 1
print(dp[k-1][5])

Buggy submission (verdict: Runtime Error):
S = input()
 
dp = [[0]*13 for j in range(len(S)+1)]
mod = 10**9+7
 
dp[0][0] = 1
k = 1
L0 = list(range(10))

for s in S:
  if ('?' == s):
    L = L0
  else:
    L = [int(s)]
 
  for l in L:
    for i in range(13):
      tmp = (i * 10) + l
      m = tmp % 13
      dp[k][m] = ((dp[k][m][0] + dp[k-1][i][0]) % mod)
  k += 1
print(dp[k-1][5])
Problem p03081 (python)

Fixed submission:
N,Q = map(int, input().split())
S = input()
C = [tuple(map(str, input().split())) for _ in range(Q)]
C = C[::-1]

left = -1
right = N

for (t,d) in C:
  if ('L' == d):
    if (S[left+1] == t):
      left += 1
      if (N-1 <= left):
        print(0)
        exit()
    if (right < N):
      if (S[right] == t):
        right += 1
        if (N < right):
          right = N
  else:
    if (S[right-1] == t):
      right -= 1
      if (right <= 0):
        print(0)
        exit()
    if (-1 < left):
      if (S[left] == t):
        left -= 1
        if (left < -1):
          left = -1

print(right - left - 1)

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
C = [tuple(map(str, input().split())) for _ in range(Q)]
C = C[::-1]

left = -1
right = N

for (t,d) in C:
  if ('L' == d):
    if (S[left+1] == t):
      left += 1
      if (N <= left):
        print(0)
        exit()
    if (right < N):
      if (S[right] == t):
        right += 1
        if (N < right):
          right = N
  else:
    if (S[right-1] == t):
      right -= 1
      if (right <= -1):
        print(0)
        exit()
    if (-1 < left):
      if (S[left] == t):
        left -= 1
        if (left < -1):
          left = -1

print(right - left - 1)
Problem p03136 (python)

Fixed submission:
N = int(input())
*L, = map(int, input().split())

L_sum = sum(L)

res = True
for l in L:
    if ((L_sum - l) <= l):
        res = False

if (res):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
10
1 8 10 5 8 12 34 100 11 3
Problem p03436 (python)

Fixed submission:
def main():
	H, W = map(int, input().split())
	S = [list(input()) for _ in range(H)]

	D = [[0]*W for j in range(H)]

	D[0][0] = 1
	L = [(0,0)]

	#黒の数をカウント
	sum_black = 0
	for h in range(H):
		for w in range(W):
			if ('#'==S[h][w]):
				sum_black += 1

	for k in range(2,H*W):
		L_next = []
		for l in L:
			w = l[0]
			h = l[1]
			#上
			if (0 < h):
				if ((0 == D[h-1][w]) and ('.'==S[h-1][w])):
					D[h-1][w] = k
					L_next.append((w,h-1))
			#左
			if (0 < w):
				if ((0 == D[h][w-1]) and ('.'==S[h][w-1])):
					D[h][w-1] = k
					L_next.append((w-1,h))
			#下
			if (h < (H - 1)):
				if ((0 == D[h+1][w]) and ('.'==S[h+1][w])):
					D[h+1][w] = k
					L_next.append((w,h+1))
			#右
			if (w < (W - 1)):
				if ((0 == D[h][w+1]) and ('.'==S[h][w+1])):
					D[h][w+1] = k
					L_next.append((w+1,h))
		L = L_next
		if (0 != D[H-1][W-1]):
			break
		if (not L):	#リストが空
			return -1

	return W*H - D[H-1][W-1] - sum_black

print(main())

Buggy submission (verdict: Runtime Error):
def main():
	H, W = map(int, input().split())
	S = [list(input()) for _ in range(H)]

	D = [[0]*H for j in range(W)]

	D[0][0] = 1
	L = [(0,0)]

	for k in range(2,H*W):
		L_next = []
		for l in L:
			w = l[0]
			h = l[1]
			#上
			if (0 < h):
				if ((0 == D[h-1][w]) and ('.'==S[h-1][w])):
					D[h-1][w] = k
					L_next.append((w,h-1))
			#左
			if (0 < w):
				if ((0 == D[h][w-1]) and ('.'==S[h][w-1])):
					D[h][w-1] = k
					L_next.append((w-1,h))
			#下
			if (h < (H - 1)):
				if ((0 == D[h+1][w]) and ('.'==S[h+1][w])):
					D[h+1][w] = k
					L_next.append((w,h+1))
			#右
			if (w < (W - 1)):
				if ((0 == D[h][w+1]) and ('.'==S[h][w+1])):
					D[h][w+1] = k
					L_next.append((w+1,h))
		L = L_next
		if (0 != D[H-1][W-1]):
			break
		if (not L):	#リストが空
			return -1

	return W*H - D[H-1][W-1] - 2

print(main())
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=list(map(int, input()))

print(a.count(1))
Problem p02922 (python)

Fixed submission:
A, B = map(int, input().split())
q = -((-B+1)//(A-1))
 
print(q)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
q = (B＋A-3)//(A-1)
print(q)

Buggy submission (verdict: Runtime Error):
 B = map(int, input().split())
q = (B-1)//(A-1)

print(q)
Problem p03085 (python)

Fixed submission:
from sys import (stdin, stdout)

CORR_TAB = {
  'A': 'T',
  'T': 'A',
  'G': 'C',
  'C': 'G',
}

for line in stdin:
  stdout.write(CORR_TAB[line.strip()] + '\n')

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

CORR_TAB = {
  'A': 'T',
  'T': 'A',
  'G': 'C',
  'C': 'G'',
}

for line in stdin:
  stdout.write(CORR_TAB[line.strip()] + '\n')
Problem p02923 (python)

Fixed submission:
import sys
N = int(input())
num_list = [int(x) for x in input().split()]
max_x = 0
max_list = [0]
for i in range(N-1):
  n = num_list[i]
  n_next = num_list[i+1]

  if n >= n_next:
    max_x += 1
    if i == N-2:
      max_list.append(max_x)
  else:
    max_list.append(max_x)
    max_x = 0
print(max(max_list))

Buggy submission (verdict: Runtime Error):
N = int(input())
num_list = [int(x) for x in input().split()]
max_x = 0
max_list = []
for i in range(N-1):
  n = num_list[i]
  n_next = num_list[i+1]

  if n >= n_next:
    max_x += 1
    if i == N-2:
      max_list.append(max_x)
  else:
    max_list.append(max_x)
    max_x = 0

print(max(max_list))
Problem p02924 (python)

Fixed submission:
n = int(input())

print(int(n*(n-1)//2))

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

else:
  print(int(n*(n-1)//2))

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

print(n*(n-1)/2)
Problem p02921 (python)

Fixed submission:
a = str(input())#入力S
b = str(input())#入力T
#print(a[n])
#print(b[n])
x=0
for n in range(3):
  if a[n] == b[n]:
    x+=1
print(x)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())
av = num =  a
n = 1
if num < b:
  n+=1
  num = num+av-1
elif num > b:
  pass
print(n)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())
av = num =  a
n = 1
while num =< b:
  n+=1
  num = num+av-1
print(n)
Problem p02922 (python)

Fixed submission:
import math

a,b = map(int, input().split())
av = a
n = 0
num = 1
while num < b:
  n += 1
  num += av-1
print(n)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())
av = num =  a
n = 1
while num =< b:
  n+=1
  num = num+av-1
print(n)
Problem p02981 (python)

Fixed submission:
numbers = input().split()
if(int(numbers[0])*int(numbers[1]) < int(numbers[2])):
  ans = int(numbers[0])*int(numbers[1]) 
else:
  ans = int(numbers[2])
 
print(ans)

Buggy submission (verdict: Runtime Error):
numbers = input().split()
if(numbers[0]*numbers[1] < numbers[2]):
  ans = numbers[0]*numbers[1]
else:
  ans = number[2]

print(ans)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ph = []
p =  1
for i in range(N):
    p *= A[i]
for i in range(N):
    ph.append(p / A[i])
ph_sum = sum(ph)
print(p / ph_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = 0
for i in range(N):
    A = A + 1 / input()
return A

print(1 / A)
Problem p02945 (python)

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

X = []
X.append(A+B)
X.append(A-B)
X.append(A*B)

X.sort()

print(X[2])

Buggy submission (verdict: Runtime Error):
"""#自分で考えたやつ
N, M = map(int, input().split())
AB = []
for i in range(N):
    a, b =  (int(x) for x in input().split())
    AB.append([a, b])
AB.sort(key=lambda x: x[1])

dic = {}
for i in range(M):
"""

import heapq

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

# 仕事の制約が厳しい順にリストに格納する
Blist = [[] for _ in range(M)]
for i in range(N):
    A, B = map(int, input().split())
    if A <= M: # AがMより大きいといつやっても間に合わない
        Blist[A-1].append(-B) # heapdを使うことを考慮して-倍しておく

ans = 0
q = [] # heapd.heapify(q)でリストのヒープ化ができるがここではlen(q)を使いたいためにしないでおく

# 可能な仕事をqに入れて扱う。その中でもBが最大(「-」倍しているのでここでは最小)のものを優先して取り出す。
for i in range(M):
    for b in Blist[i]: # ヒープ化されたリストqに2次元のBlistのi番目のリストの要素を全て入れる
        heapq.heappush(q, b)
    if len(q) > 0: # qに要素があるならば、qから最小の要素を取り出して(「-」倍してあるので)それを引き算する
        ans -= heapq.heappop(q)

print(ans)

Buggy submission (verdict: Runtime Error):
"""#自分で考えたやつ
N, M = map(int, input().split())
AB = []
for i in range(N):
    a, b =  (int(x) for x in input().split())
    AB.append([a, b])
AB.sort(key=lambda x: x[1])

dic = {}
for i in range(M):
"""

import heapd

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

# 仕事の制約が厳しい順にリストに格納する
Blist = [[] for _ in range(M)]
for i in range(N):
    A, B = map(int, input().split())
    if A <= M: # AがMより大きいといつやっても間に合わない
        Blist[A-1].append(-B) # heapdを使うことを考慮して-倍しておく

ans = 0
q = [] # heapd.heapify(q)でリストのヒープ化ができるがここではlen(q)を使いたいためにしないでおく

# 可能な仕事をqに入れて扱う。その中でもBが最大(「-」倍しているのでここでは最小)のものを優先して取り出す。
for  i in range(M):
    for b in Blist[i]: # ヒープ化されたリストqに2次元のBlistのi番目のリストの要素を全て入れる
        heapd.heappush(q, b)
    if len(q) > 0: # qに要素があるならば、qから最小の要素を取り出して(「-」倍してあるので)それを引き算する
        ans -= heapd.heappop(q)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    s = str(input())
    s = ''.join(sorted(s))
    S.append(s)

count = 0
for i in range(N):
    Si = S[i]
    for k in range(N):
        if i==k:
            None
        else:
            Sk = S[k]
            if Sk == Si:
                count += 1

print(count / 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    s = str(input())
    s = ''.join(sorted(a))
    S.append(s)

count = 0
for i in range(N):
    Si = S[i]
    for k in range(N):
        if i==k:
            None
        else:
            Sk = S[k]
            if Sk == Si:
                count += 1

print(count / 2)
Problem p02946 (python)

Fixed submission:
k, x = map(int, input().split())

a = list(range(x-(k-1), x+k))
print(*a)

Buggy submission (verdict: Runtime Error):
k, x = map(int, input().split())

a = list(range(x-(k-1), x+k)
print(*a)
Problem p02947 (python)

Fixed submission:
"""自分で考えたやつ

N = int(input())
S = []
for i in range(N):
    s = str(input())
    s = ''.join(sorted(s))
    S.append(s)

count = 0
for i in range(N):
    Si = S[i]
    for k in range(N):
        if i==k:
            None
        else:
            Sk = S[k]
            if Sk == Si:
                count += 1

print(count / 2)
"""

N = int(input())
dic = {}
ans = 0

for i in range(N):
    s = ''.join(sorted(input()))
    if s in dic:
        ans += dic[s]
        dic[s] += 1
    else:
        dic[s] = 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    s = str(input())
    s = ''.join(sorted(a))
    S.append(s)

count = 0
for i in range(N):
    Si = S[i]
    for k in range(N):
        if i==k:
            None
        Sk = S[k]
        if Sk == Si:
            count += 1

print(count / 2)
Problem p02952 (python)

Fixed submission:
num = list(range(1, (int(input())+1)))

count = 0
for i in num:
    if len(str(i)) % 2 == 1:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
num = list(range(1, (int(input()-1))))

count = 0
for i in num:
    if len(str(i)) % 2 == 1:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
num = list(range(1, (int(input()-1))))

count = 0
for i in num:
    if len(str(i)) % 2 == 1:
        count += 1

print(count)
Problem p02953 (python)

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

if N == 1:
    print("Yes")

if N == 2:
    if H[0]-H[1] <= -1:
        print("Yes")
    else:
        print("No")

if N >= 3:
    for i in range(1, N):
        if H[0]-H[1] <= -1:
            H[1] -= 1
        elif H[0]-H[1] == 0:
            H[0] -= 1
            H[1] -= 1
        elif H[0]-H[1] == 1:
            H[0] -= 1

        if i == N-1:
            print("Yes")
            break
        elif H[i]-H[i+1] <= -1:
            H[i+1] -= 1
            continue
        elif H[i]-H[i+1] == 0:
            continue
        else:
            print("No")
            break

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

if N == 1:
    print("Yes")
elif H[0]-H[1] <= -1:
    H[1] -= 1
elif H[0]-H[1] == 0:
    H[0] -= 1
    H[1] -= 1
elif H[0]-H[1] == 1:
    H[0] -= 1
else:
    print("No")

if N >=　3:
    for i in range(1, N):
        if i == N-1:
            print("Yes")
            break
        elif H[i]-H[i+1] <= -1:
            H[i+1] -= 1
            continue
        elif H[i]-H[i+1] == 0:
            continue
        else:
            print("No")
            break

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

if H[0]-H[1] <= -1:
    H[1] -= 1
elif H[0]-H[1] == 0:
    H[0] -= 1
    H[1] -= 1
elif H[0]-H[1] == 1:
    H[0] -= 1
else:
    print("No")

for i in range(1, N):
    if i == N-1:
        print("Yes")
        break
    elif H[i]-H[i+1] <= -1:
        H[i+1] -= 1
        continue
    elif H[i]-H[i+1] == 0:
        continue
    else:
        print("No")
        break

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

if H[0]-H[1] <= -1:
    H[1] -= 1
elif H[0]-H[1] == 0:
    H[0] -= 1
    H[1] -= 1
elif H[0]-H[1] == 1:
    H[0] -= 1
else:
    print("No")

for i in range(1, N):
    if i == N-1:
        print("Yes")
        break
    elif H[i]-H[i+1] <= -1:
        H[i+1] -= 1
        continue
    elif H[i]-H[i+1] == 0:
        continue
    elif:
        print("No")
        break

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

if H[0]-H[1] <= -1:
    H[1] -= 1
elif H[0]-H[1] = 0:
    H[0] -= 1
    H[1] -= 1
elif H[0]-H[1] = 1:
    H[0] -= 1
else:
    print("No")

for i in range(1, N):
    if i = N-1:
        print("Yes")
        break
    elif H[i]-H[i+1] <= -1:
        H[i+1] -= 1
        continue
    elif H[i]-H[i+1] = 0:
        continue
    elif:
        print("No")
        break
Problem p02945 (python)

Fixed submission:
l=list(map(int,input().split()))
a=l[0]
b=l[1]
print(max(a+b,a-b,a*b))

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

Fixed submission:
b=input()
if b=="A":
  print("T")
elif b=="T":
  print("A")
elif b=="G":
  print("C")
elif b=="C":
  print("G")

Buggy submission (verdict: Runtime Error):
b=input()
if b==A:
  print(T)
elif b==T:
  print(A)
elif b==G:
  print(C)
elif b==C:
  print(G)

Buggy submission (verdict: Runtime Error):
b=input()
if b==A:
  print(T)
elif b==T:
  print(A)
elif b==G:
  print(C)
else:
  print(G)

Buggy submission (verdict: Runtime Error):
b=input()
if b==A:
  print(T)
elif b==T:
  print(A)
elif b==G:
  print(C)
else b==C:
  print(G)
Problem p02921 (python)

Fixed submission:
hare="S"
kumori="C"
ame="R"
S=input()
T=input()
c=0
for i,s in enumerate(S):
    if s==T[i]:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input():str
s=s.split(" ")
A,B=s[0],s[1]
kuti=1
c=0
while kuti<B:
    kuti+=(A-1)
    c+=1
Problem p02995 (python)

Fixed submission:
import fractions

inputs = [int(i) for i in input().split()]

a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l = lcm(c, d)

c1 = b // c
c2 = (a-1) // c
c3 = c1 - c2

d1 = b // d
d2 = (a-1) // d
d3 = d1 - d2

l1 = b // l
l2 = (a-1) // l
l3 = l1 - l2

ans = (b-a+1) - (c3 + d3 - l3)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

inputs = [int(i) for i in input().split()]

counter = 0

a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

l = lcm(c, d)

c1 = b // c
c2 = (a-1) // c
c3 = c1 - c2

d1 = b // d
d2 = (a-1) // d
d3 = d1 - d2

l1 = b // l

ans = (b-a+1) - (c3 + d3 - l1)
print(ans)