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

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

N, M = map(int, input().split())
adjL = [[] for v in range(N)]
for e in range(M):
    A, B = map(int, input().split())
    adjL[A - 1].append(B - 1)
    adjL[B - 1].append(A - 1)

# 二部グラフかどうかを判定する（頂点を1or-1で塗っていく）
colors = [0] * N

def dfs(vNow, color):
    colors[vNow] = color # 頂点vNowをcolorで塗る
    for v in adjL[vNow]:
        if colors[v] == color:
            # 隣接する頂点vが同じ色で彩色済みならば、二部グラフではない
            return False
        if colors[v] == 0 and not dfs(v, -color):
            # 隣接する頂点vが未彩色ならば、もう１つの色で塗ってみる
            return False

    return True


IsBipartite = dfs(0, 1)

if IsBipartite:
    # 二部グラフである場合
    num = colors.count(1)
    print(num * (N - num) - M)
else:
    # 二部グラフでない場合
    print(N * (N - 1) // 2 - M)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
adjL = [[] for v in range(N)]
for e in range(M):
    A, B = map(int, input().split())
    adjL[A - 1].append(B - 1)
    adjL[B - 1].append(A - 1)

# 二部グラフかどうかを判定する（頂点を1or-1で塗っていく）
colors = [0] * N

def dfs(vNow, color):
    colors[vNow] = color # 頂点vNowをcolorで塗る
    for v in adjL[vNow]:
        if colors[v] == color:
            # 隣接する頂点vが同じ色で彩色済みならば、二部グラフではない
            return False
        if colors[v] == 0 and not dfs(v, -color):
            # 隣接する頂点vが未彩色ならば、もう１つの色で塗ってみる
            return False

    return True


IsBipartite = dfs(0, 1)

if IsBipartite:
    # 二部グラフである場合
    num = colors.count(1)
    print(num * (N - num) - M)
else:
    # 二部グラフでない場合
    print(N * (N - 1) // 2 - M)
Problem p03580 (python)

Fixed submission:
N = int(input())
s = input()

# 「連続する1の数」のリストに変換する
s = s[s.find('1'):] # 先頭の'0'を取り除く
while s.count('000'):
    s = s.replace('000', '00')
cs = list(map(len, s.split('0')))

# dp[i]: i番目の「連続する1」への各処理（操作に使わない／左の１つだけ使う／右の１つを残して使う／全て使う）
#        に対して、現時点での操作回数の最大値
dp = [[-float('inf')] * 4 for i in range(len(cs))]
dp[0][0] = 0
for i in range(1, len(cs)):
    if cs[i] == 0:
        dp[i][3] = max(dp[i - 1])
        continue

    # 使わない
    dp[i][0] = max(dp[i - 1])
    # 全て使う
    dp[i][3] = max(dp[i - 1][0] + max(cs[i - 1], cs[i]), \
                   dp[i - 1][1] + max(cs[i - 1] - 1, cs[i]), \
                   dp[i - 1][2] + cs[i], \
                   dp[i - 1][3])
    if cs[i] >= 2:
        # 左の１つだけ使う
        dp[i][1] = max(dp[i - 1][0] + cs[i - 1], \
                       dp[i - 1][1] + cs[i - 1] - 1, \
                       dp[i - 1][2] + 1, \
                       dp[i - 1][3])
        # 右の１つを残して使う
        dp[i][2] = max(dp[i - 1][0] + max(cs[i - 1], cs[i] - 1), \
                       dp[i - 1][1] + max(cs[i - 1] - 1, cs[i] - 1), \
                       dp[i - 1][2] + cs[i] - 1, \
                       dp[i - 1][3])

print(max(dp[-1]))

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

while s.count('000'):
    s = s.replace('000', '00')
ss = s.split('00')

A = []
for si in ss:
    num = 0
    ai = []
    for c in si:
        if c == '1':
            num += 1
        else:
            if num > 0:
                ai.append(num)
                num = 0

    if num > 0:
        ai.append(num)

    A.append(ai)

ans = 0
for ai in A:
    if ai[0] < ai[-1]:
        ai = ai[::-1]

    flg = True
    for i, aa in enumerate(ai):
        if i == len(ai) - 1:
            break

        if flg == True:
            ans += aa
            flg = False
        else:
            ans += aa - 1
            if aa == 1:
                flg = True

print(ans)
Problem p02607 (python)

Fixed submission:

def main():
    
    n = int(input())
    
    Numbers = list(map(int,input().split()))
    count = 0
    for item in range(1,n+1):
        if item % 2 != 0 and Numbers[item-1] % 2 != 0:
            count += 1
    
    print(count)
        
    
  

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
if a[i] % 2 == 1:
ans += 1
print(ans)
Problem p02675 (python)

Fixed submission:
n = int(input())
n = n % 10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
n = int(input())
n = n % 10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")
else
    print("bon")
Problem p02731 (python)

Fixed submission:
#maximum volume problem
J = int(input()) #to take input from the user, input function is used
K = J /3   
M= K
print(M ** 3) #to print the solution of the problem

Buggy submission (verdict: Runtime Error):
def shortie (L):
 R= L/3
 return (R**3)

L=int(input())
Shortie (L)
Problem p02742 (python)

Fixed submission:
import math
a,b = list(map(int, input().split()))
if(a== 1 or b==1):
    print(1)
else:
    print(math.ceil((a*b)/2))

Buggy submission (verdict: Runtime Error):
h=int(input())
w=int(input())

s=ceil(h/2.0)*ceil(w/2.0)+floor(h/2.0)*floor(w/2.0)

print(s)

Buggy submission (verdict: Runtime Error):
from itertools import chain, permutations, dropwhile
from heapq import merge
from functools import wraps

def listify(fn):
  @wraps(fn)
  def wraper(*args, **kwargs):
    return list(fn(*args, **kwargs))
  return wraper

def comp_wild(a,b):
  return all(x==y or "?" in (x,y) for x,y in zip(a, b))

@listify
def includers(a,b):
  for i in range(len(a)-len(b)+1):
    if comp_wild(a[i:], b):
      yield i

@listify
def connectors(a,b):
  la = len(a)
  for i in range(max(la-len(b)+1, 1), la):
    if comp_wild(a[i-la:], b):
      yield i
  yield la

class c_int(int):
  def __new__(cls, *args, **kwargs):
    cond = kwargs.pop("cond", lambda:True)
    i = int.__new__(cls, *args, **kwargs)
    i.cond = cond
    return i

def iter_from(it, fm):
  return dropwhile(fm.__gt__, it)

def solve(a, b, c):
  keys = sorted((a,b,c), key=len, reverse=True)
  len_keys = list(map(len, keys))
  inc = { (i,j):includers(keys[i],keys[j]) for i,j in permutations(range(3), 2) }
  con = { (i,j):connectors(keys[i],keys[j]) for i,j in permutations(range(3), 2) }
  
  for i in inc[0,1]:
    for j in inc[0,2]:
      if (
        j+len_keys[2] <= i or i+len_keys[2] <= j or
        j-i in inc[1,2] or j-i in con[1,2] or i-j in con[2,1]
      ):
        return len_keys[0]
  
  def candicates(x,y,z):
    return chain(
      ( c_int(
          i+len_keys[z], 
          cond=lambda:(
            (inc[x,y] and inc[x,y][0]+len_keys[y] <= i) or 
            (inc[z,y] and len_keys[x] <= i+inc[z,y][-1]) or 
            any(
              (i-j in con[y,z] if i>j else j-i in inc[z,y])
               for j in iter_from(inc[x,y]+con[x,y], i-len_keys[y])
            )
          )
        ) for i in iter_from(con[x,z], len_keys[y]-len_keys[z]+1)
      ),
      ( c_int(
          min( i+next(iter_from(q, len_keys[x]-i+1))+len_keys[z] for i in p )
        ) for (p, q) in [sorted((con[x,y], con[y,z]), key=len)]
      ),
    )
  
  for c in merge(*( candicates(*xyz) for xyz in permutations(range(3), 3) )):
    if c.cond():
      return c
  
  return sum(len_keys)

print(solve(*(input() for _ in range(3))))
Problem p02756 (python)

Fixed submission:
S = input()
Q = int(input())
flip = 0
head = []
tail = []
for i in range(Q):
  Query = input().split()
  if len(Query) == 3:
    T,F,C = Query
    F = int(F)-1
    if F^flip == 1:
      tail.append(C)
    else:
      head.append(C)
  else:
    flip ^= 1
if flip:
  head, tail = tail, head
  S = S[::-1]
head = ''.join(head[::-1])
tail = ''.join(tail)
print(head+S+tail)

Buggy submission (verdict: Runtime Error):
def string():
    s = input()
    q = int(input())
    l = ''
    r = ''
    re = False
    while q > 0:
        t = list(input().strip().split())
        if t[0] == 1:
            re = not re
        else:
            if re:
                if t[1] == 2:
                    l = t[2] + l
                else:
                    r = r + t[2]
            else:
                if t[1] == 2:
                    l = t[2] + l
                else:
                    r = r + t[2]
        q -= 1
    s = l + s + r
    if re:
        s = s[::-1]
    print(s)
string()
Problem p02783 (python)

Fixed submission:
from sys import stdin
import math

def main():
    H,A = map(int,stdin.readline().split())
    res = H/A
    print(math.ceil(res))
main()

Buggy submission (verdict: Runtime Error):
import math


def get_inputs():
    inputs = input().split(" ")
    monsters_num, diff, attack = int(inputs[0]), int(inputs[1]), int(inputs[2])
    monsters = []
    for monster in range(monsters_num):
        inputs = input().split(" ")
        coordinate, health = int(inputs[0]), int(inputs[1])
        monsters.append({"coordinate": coordinate, "health": health})
    return monsters, diff, attack, monsters_num


def between_coordinates(monster, coordinate, diff):
    if (coordinate - diff <= monster["coordinate"] <= coordinate) or (
            coordinate <= monster["coordinate"] <= coordinate + diff):
        return True
    return False


def sort_monsters_coordinates(monsters):
    return sorted(monsters, key=lambda k: k['coordinate'])


def get_alive_monsters(monsters):
    return [monster for monster in monsters if monster["health"] > 0]


def attack_leftmost_monster(coordinate, monsters, attack, diff):
    bombs_num = 0
    if len(monsters) == 0:
        return 0
    leftmost_monster = monsters.pop(0)
    needed_attacks = math.ceil(leftmost_monster["health"] / attack)
    bombs_num += needed_attacks
    for monster in monsters:
        if between_coordinates(monster, coordinate, diff):
            monster["health"] -= (needed_attacks * attack)
    monsters = get_alive_monsters(monsters)
    return monsters, bombs_num


def get_max_health(monsters):
    if len(monsters) == 0:
        return 0

    max_health = - math.inf
    for monster in monsters:
        if monster["health"] >= max_health:
            max_health = monster["health"]
    return max_health


monsters, diff, attack, monsters_num = get_inputs()
if len(monsters) > 0:
    monsters = sort_monsters_coordinates(monsters)
else:
    print(0)

coordinate = monsters[0]["coordinate"] + diff
total_bombs_num = 0

while len(monsters) > 0 and coordinate <= monsters[-1]["coordinate"] - diff:
    monsters, bombs_num = attack_leftmost_monster(coordinate, monsters, attack, diff)
    total_bombs_num += bombs_num
    if len(monsters) > 0:
        coordinate = monsters[0]["coordinate"] + diff
        
print(total_bombs_num + math.ceil(get_max_health(monsters) / attack))
Problem p02789 (python)

Fixed submission:
from sys import stdin
n,m = map(int,stdin.readline().split())
print("Yes" if n==m else "No")

Buggy submission (verdict: Runtime Error):
N=int(input("Enter test cases:"))
M=int(input("Enter M:"))
if(N==M):
    print("Yes")
else:
    print("No")

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

if (N==M):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from sys import stdin
n,m = map(int,stdin.readline().split()
print("Yes" if n==m else "No")
Problem p02817 (python)

Fixed submission:
x = list(map(str,input().rstrip().split()))
print(x[1]+x[0])

Buggy submission (verdict: Runtime Error):
 y= list(map(str,input().rstrip().split()))
print(y[1]+y[0])
Problem p02917 (python)

Fixed submission:
n = int(input()) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
summ = b[0] #waiting_for_pudging

for i in range(1, len(b)): #pudging
    summ += min(b[i-1], b[i]) #pudging
print(summ + b[-1]) #pugding
#accepted

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

ans = arr[0]+arr[N-1]
for i in range(1,N-1,1):
   ans += min(arr[i],arr[i-1])
   
print(ans)
Problem p02922 (python)

Fixed submission:
a,b=map(int,input().split())
now=a
i=1
if b>1:
    while now<b:
        now+=a-1
        i+=1
    print(i)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
socket = 0
count = 0
if B==1 :
    count=0
elif i != 0 :
    while socket < B :
        if socket + A < B :
            socket = socket + A - 1
            count += 1
        elif socket+A >= B :
            socket = socket + A
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a= int(input())
b=int(input())
print(int((b-1)/(a-1)+0.99999))

Buggy submission (verdict: Runtime Error):
from math import ciel
a,b=[int(x) for x in input().split()]
if b==1:
    print(0)
else :
    print(ciel((b-1)/(a-1)))
Problem p02923 (python)

Fixed submission:
n = int(input())
x = input().split()
y = [0]
c = 0
for i in range(n-1):
  if int(x[i]) >= int(x[i+1]):
    c = c + 1
  else:
    y.append(c)
    c = 0
y.append(c)
print(max(y))

Buggy submission (verdict: Runtime Error):
#import random

n = input()
n = int(n)

# if n == 1:
# 	_ = input()
# 	print(0)

# else:
# 	h = []

for i in range(n):
	input()

	# rnd = random.randint(0, n)
	# count = 0

	# for i in range(rnd, n-1):
	# 	if h[i+1] <= h[i]:
	# 		count += 1

print(0)

Buggy submission (verdict: Runtime Error):
n = input()
h = []

for i in range(int(n)):
	h.append(int(input()))

rnd = int(int(n)/2)
count = 0

for i in range(rnd, int(n)-1):
	if h[i+1] <= h[i]:
		count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=[]
for x in range(n):
      h.append(int(input))
      
count=flag=0 
for i in range(n): 
      if(h[i]>h[i+1]):
        flag+=1
      else :
        count=flag if(flag>count) else count
        flag=0
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
for i in range(0,n):
    s.append(int(input()))
c=0
max=0
pos=0
for i in range(n):
    c=0
    for j in range(i,n-1):
        if(s[j]>s[j+1]):
            c+=1
        else:
            break
    if(c>max):
        max=c
        pos=i+1
    if(max>(n-i-1)):
        break
print(pos)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
count=flag=0 
for i in range(n): 
      if(h[i]>h[i+1]):
        flag+=1
      else :
        count=flag if(flag>count) else count
        flag=0
print(count)

Buggy submission (verdict: Runtime Error):
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;

int main() {
    int n;
    cin>>n;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++)
    cin>>a[i];
    a[0]=inf;
    int thislen=0,maxlen=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]<=a[i-1])
        {
            thislen+=1;
            maxlen=max(maxlen,thislen);
        }   
        else thislen=1;
    }  
    cout<<maxlen-1;
    return 0;
}

Buggy submission (verdict: Runtime Error):
import sys
sys.stdin=open("1.txt","r")
n=int(input())
a=input().split()
num=0
while n>1:
    if int(a[n-1])<=int(a[n-2]):
        num+=1
        n-=1
    else:
        break
print(num)
Problem p02937 (python)

Fixed submission:
s = input()
t = input()
d = {i:[] for i in "abcdefghijklmnopqrstuvwxyz"}
for i in range(len(s)):
    d[s[i]].append(i)
for i in t:
    if len(d[i]) == 0:
        print(-1)
        exit()

def binary_search(arr, k):
    l, r = 0, len(arr)-1
    while l <= r:
        m = l+r >> 1
        if arr[m] < k:
            l = m+1
        else:
            r = m-1
    return l

a, b = 0, 0
for i in t:
    j = binary_search(d[i], a)
    if len(d[i]) <= j:
        a = 0
        b += 1
        j = binary_search(d[i], 0)
    a = d[i][j] + 1
print(b * len(s) + a)

Buggy submission (verdict: Runtime Error):
def is_substring(s_char_map, t):
    for char in t:
        if char not in s_char_map:
            return False
    return True


def get_impurity(s, t):
    s_char_map = {}
    
    s_len = len(s)
    for char_idx in range(s_len):
        if s[char_idx] not in s_char_map:
            s_char_map[s[char_idx]] = [char_idx + 1]
        else:
            s_char_map[s[char_idx]].append(char_idx + 1)
    last_idx = -1
    s_length = len(s)
    full_length = 0
    
    if not is_substring(s_char_map, t):
        return -1
    
    for char in t:
        if s_char_map[char][-1] >= last_idx:
            last_idx = list(filter(lambda i: i > last_idx, s_char_map[char]))[0]
            full_length += last_idx - (full_length % s_length)
        else:
            last_idx = s_char_map[char][0]
            full_length += (s_length - (full_length % s_length)) + last_idx
    return full_length

s = input()
t = input()
print(get_impurity(s, t))
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,max(a-b,a*b)))

Buggy submission (verdict: Runtime Error):
def dd():
    a=int(input("a="));
    b=int(input("b="));
    if(a+b>a-b):
        if(a+b>a*b):
            print(a+b);
        
        else:
            print(a*b);
    else:
        if(a-b>a+b):
            if(a-b>a*b):
              print(a-b);
            else:
                print(a*b);
def main():
    dd();
main();
Problem p02958 (python)

Fixed submission:
n=int(input());lista_1=[];contador=0;index=0
lista=list(map(int,input().split()))
for i in range(1,n+1):
    lista_1.append(i)
for j in lista:
    aaa=lista_1[index]
    if(j!=aaa):
        contador=contador+1
    index=index+1
if(contador<=2):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
N=input("enter a number")
list=[]
order=True
check=True
pos=0
temp=0
counter=0
numbers=input("enter the permutation as n digit number")
for number in numbers:
    list.append(int(number))
p0=list[0]


for n in range(1,len(list)):
    #checking is the given permutatoin is in ascendig order or no
    if p0<list[n]:
        p0=list[n]
    else:
        order=False

if order==True:
    print("the given permutation is in ascending order")
if order==False:
    for i in range(1,len(list)+1):
        if i==list[i-1]:
            pass
        else:
            counter+=1
            temp=list[i-1]
            pos=list.index(i)           #swap
            list[i-1]=list[pos]
            list[pos]=temp
if counter==1:
    print("Yes we can sort it in ascending order")
else:
    print("No it cant be sorted in one step")

Buggy submission (verdict: Runtime Error):
    input()
    g = input()
    a = list(map(str, g.split()))
    b = list(map(int, g.split()))
    if sorted(b) == b:
        print("YES")
    else:
        m = 0
        for i in range(len(b)):
            if b[i] == sorted(b)[i]:
                m+=1
        if m==len(b)-2:
            print("YES")
        else:
            print("NO")
Problem p02963 (python)

Fixed submission:
from math import ceil


S = int(raw_input())

x2 = y3 = int(ceil(S ** 0.5))

y2 = x2 * y3 - S 
x3 = 1

print 0, 0, x2, y2, x3, y3

Buggy submission (verdict: Runtime Error):
s = input()
x1 = y1 = x2 = y3 = 0
y2 = 1
print(str(x1) + ' ' +str(y1) + ' ' +str(x2) + ' ' +str(y2) + ' ' + s + ' ' + str(y3))

Buggy submission (verdict: Runtime Error):

import math
s = int(input())
p=q=0
c=1
a = int (math.sqrt(s))
if (a*a == s):
    d = a

else:
    a+=1
    d = a
    #print(a*d, s)
    b = a*d - s
    #print(a*d - b)

print(p,q,a,b,c,d)
Problem p02999 (python)

Fixed submission:
x,a=input().split()
if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
x, a = map(int, input())
if x < a:
    print(0)
else:
    print(1)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = [0]
cnt = 1
while cnt != n + 1 and d[-1] <= x:
	d.append(d[-1] + l[cnt - 1])
	cnt += 1
if d[-1] <= x: 
	print(cnt)
else:
	print(cnt - 1)

Buggy submission (verdict: Runtime Error):
line1 = input()
line2 = input()
D = 0
res = 0
for i in range(int(line1[0])):
    if D <= int(line1[2]):
        res += 1
    else:
        break
    D = D + int(line2[2*i])
if D <= int(line1[2]):
    res += 1
print(res)
Problem p03001 (python)

Fixed submission:
import sys
from math import ceil

def input():
    return sys.stdin.readline().strip()

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def nok(a, b):
    m = a * b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a + b)    


def main():
    w, h, x, y = rinput()
    if x == w / 2 and y == h / 2:
        print(w * h / 2, 1)
    else:
        print(w * h / 2, 0)
    
    
    
main()

Buggy submission (verdict: Runtime Error):
coordinates = list(map(int, input().split()))
w = coordinates[0]
h = coordinates[1]
x = coordinates[2]
y = coordinates[3]
prod1 = x * h
prod2 = y * w
if x == w and y == h:
    prod1 = prod2 = (w * h) / 2
area = min(prod1, prod2)
# area = format(area, '.6f')
addit = 0 if prod1 != prod2 else 1
print(f"{area} {addit}")
Problem p03035 (python)

Fixed submission:
line = input()
a, b = [int(n) for n in line.split()]
if a>=13:
    print(b)
elif a>=6:
    b = b/2
    b = int(b)
    print(b)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A >= 0 and  A <= 5:
    print(0)
if A >= 6  and A <= 12:
    print(B//2)
if A >= 13 and A <= 100:
    print(B)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a >= 0 and  a <= 5:
    print(0)
if a >= 6  and a <= 12:
    print(b//2)
if a >= 13 and a <= 100:
    print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 0 <= a <= 5:
    print(0)
if 6 <= a <= 12:
    print(b//2)
if 16 <= a <= 100:
    print(b)
Problem p03071 (python)

Fixed submission:
x = input().split()
A = int(x[0])
B = int(x[1])
if (A > B):
  print((A*2) - 1)
elif (A == B):
  print(A * 2)
else:
  print((B*2) - 1)

Buggy submission (verdict: Runtime Error):
q = list(map(int, input().split()))
print(max(q) * 2 - (q[1] != q[2]))
Problem p03145 (python)

Fixed submission:
inp = input()
ab, bc, ca = [int(n) for n in inp.split()]
print(int(ab*bc/2))

Buggy submission (verdict: Runtime Error):
a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
area = int((a*b)/2)
print(area)
Problem p03160 (python)

Fixed submission:
from sys import stdin
n = int(stdin.readline())
h = [int(i) for i in stdin.readline().split(' ')]

minCosts = [0, abs(h[1]-h[0])]
for i in range(2, len(h)):
    minCosts.append(min(abs(h[i]-h[i-2])+minCosts[i-2], abs(h[i]-h[i-1])+minCosts[i-1]))

print(minCosts[-1])

Buggy submission (verdict: Runtime Error):

def main():
    global n, peso, dp

    n = int(input())
    peso = [int(x) for x in input().split()]
    dp = [-1]*(10**5 + 1)
    
    peso.append(10**9)
    peso.append(10**9)
    
    print(frog(0))
    
def frog(i):
    global n, peso, dp
    
    if i >= n - 1:
        return 0

    if dp[i] != -1:
        return dp[i]

    dp[i] = min(abs(peso[i + 1] - peso[i]) + frog(i + 1),
                abs(peso[i + 2] - peso[i]) + frog(i + 2))
    
    return dp[i]

main()

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
dp = [0,abs(h[0]-h[1])]
for i in range(2,n): 
dp.append(min(dp[-1]+abs(h[i]-h[i-1]),dp[-2]+abs(h[i]-h[i-2])))
print(dp[-1])