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

Fixed submission:
X,T = map(int,input().split())
print(X/T)

Buggy submission (verdict: Runtime Error):
X,xt = map(int,input().split())
print(T/X)
Problem p03315 (python)

Fixed submission:
S = input()
print(S.count("+")-S.count("-"))

Buggy submission (verdict: Runtime Error):
S = map(int,input().split())
a = 0
while a >= 4:
    if S = "+":
        a += 1
    else:
        a -= 1    
print(a)

Buggy submission (verdict: Runtime Error):
S = map(int,input().split)
a = 0
while a >= 4:
    if S = "+":
        a += 1
    else:
        a -= 1    
print(a)
Problem p03327 (python)

Fixed submission:
N = int(input())
if N < 1000:
    print("ABC")
else:
    print("ABD")

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

if N >=1000:
  print("ABD")

else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
N = map(int(input().split()))
if N < 1000:
    print("ABC")
else:
    print("ABD")
Problem p02951 (python)

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

if a <= b:
    ans = c
else:
	ans = c-(a-b)
	if ans < 0:
		ans = 0
    
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c =input().split()

if a=<b:
  ans=c
else:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)

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

if a=<b:
  ans=c
else:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c =int(input())

if a=<b:
  ans=c
else:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c =int(input())

if a=<b:
  ans=c
elif:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c =int(input())

if a=<b:
  ans=c
elif:
  ans=c-(a-b)
  if ans<0:
    ans=0
    
  
print(ans)
Problem p02933 (python)

Fixed submission:
a = input()
s = input()
if int(a)>=3200:
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
a = input()
s = input()
if a>=3200:
  print(s)
else:
  print('red')
Problem p02935 (python)

Fixed submission:
N=int(input())
v=list(map(int,input().split()))
v.sort()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v.pop(0)
print(v[0])

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split())).sorted()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v.pop(0)
print(v[0])

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split())).sort()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v.pop(0)
print(v[0])

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split())).sort()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v[0].pop()
print(v[0])
Problem p02959 (python)

Fixed submission:
if __name__ == '__main__':
    n = int(input())
    al = [int(a) for a in input().split()]
    bl = [int(b) for b in input().split()]

    score = 0
    remaining = 0
    for i in range(n):
        a = al[i]
        b = bl[i]
        if a >= b:
            score += b
        else:
            score += a
            b -= a
            a2 = al[i + 1]
            if a2 > b:
                score += b
                a2 -= b
                al[i + 1] = a2
            else:
                score += a2
                al[i + 1] = 0
    print(score)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    n = int(input())
    al = [int(a) for a in input().split()]
    bl = [int(b) for b in input().split()]

    score = 0
    while len(bl) > 0:
        a = al.pop()
        b = bl.pop()

        if a >= b:
            score += b
        else:
            score += a
            b -= a
            a2 = al.pop()

            if a2 > b:
                score += b
                a2 -= b
                al.append(a2)
            else:
                score += a2
    print(score)
Problem p02935 (python)

Fixed submission:
import numpy as np

N = int(input())
V = input().split()
V = np.array(V).astype(int)
V = np.sort(V)

U = np.array([])

for _ in range(2):
    U = np.append(U, 0.5**(N-1))
    
for i in range(2, N):
    U = np.append(U, 0.5**(N-i))

print(np.dot(U, V))

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
V = input().split()
V = np.array(V).astype(int)
V = np.sort(V)

U = np.array([])

for _ in range(2):
    U = np.append(U, 0.5**(N-1))
    
for i in range(2, N):
    U = np.append(U, 0.5**(N-i))

print(V @ U)
Problem p02933 (python)

Fixed submission:
a = input()
s = input()

if int(a) < 3200:
	print("red")
else:
	print(s)

Buggy submission (verdict: Runtime Error):


a = input()
s = input()

if a >= 3200:
	print(s)
else
	print("red")
Problem p02933 (python)

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

if ( a >= 3200 ):
    print( s )
else:
    print( "red" )

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if ( a > 3200 ):
    print( s )
else:
    print( "red" )
Problem p02951 (python)

Fixed submission:
A,B,C=[int(i) for i in input().split(" ")]
print(B+C-A if B+C-A>0 else 0)

Buggy submission (verdict: Runtime Error):
A,B,C=[int(i) for i in input().split(" ")
print(B+C-A if B+C-A>0 else 0)
Problem p02935 (python)

Fixed submission:

N = input()
V = list(map(int, input().split()))
V = sorted(V)
value = V.pop(0)
while V:
    value =(value + V.pop(0))/2
print(value)

Buggy submission (verdict: Runtime Error):
N = input()
V = list(map(int, input().split()))
V = sorted(V)
value = V.pop(-1)
while value:
    value += V.pop(-1)
print(value)
Problem p02933 (python)

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

if a >= 3200:
    print(s)
else:
    print('red')

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

if a >= 3200:
    print(s)
else:
    print('red')
Problem p02933 (python)

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

if a<3200:
  print("red")
else:
  print(s)

Buggy submission (verdict: Runtime Error):
a= input()
s=input()

if a<3200:
  print("red")
else:
  print(s)
Problem p02948 (python)

Fixed submission:
import heapq
N, M = map(int,input().split())
reward = [[] for _ in range(M)]
for i in range(N):
  A,B = map(int,input().split())
  if A <= M:
    reward[A-1].append(B)
q = []
ans = 0
for day in range(M):
  for r in reward[day]:
    heapq.heappush(q,-r)
  if len(q) >0:
    ans += -heapq.heappop(q)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
valuesDict = {}
for _ in range(N):
  A, B = map(int, input().split())
  valuesDict[A] = B if valuesDict[A] >= B else valuesDict[A]

answer = 0
for i in range(M):
  today = i + 1
  answer += valuesDict.get(today) if valuesDict.get(today) is not None else 0

print(answer)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
valuesDict = {}
for i in range(N):
  today = i + 1
  A, B = map(int, input().split())
  valuesDict[today+A] += B
answer = 0
for i in range(M):
  today = i + 1
  answer += valuesDict[today]

print(answer)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
valuesDict = {}
for i in range(N):
  A, B = map(int, input().split())
  valuesDict[i+A] += B

print(valuesDict[M])
Problem p03307 (python)

Fixed submission:
from fractions import gcd

n = int(input())
print(2*n//gcd(2,n))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
print(2*n/math.gcd(2,n))
Problem p03327 (python)

Fixed submission:
print('ABC' if int(input())<1000 else 'ABD')

Buggy submission (verdict: Runtime Error):
rint('ABC' if int(input())<1000 else 'ABD')
Problem p02933 (python)

Fixed submission:
a,s = [input() for i in  range(2)]

a = int(a)

if a < 3200:
  print("red")
else:
  print(s)

Buggy submission (verdict: Runtime Error):
a,s = [input() for i in  range(2)]

a = int(a)

if a < 3200:
  print(red)
else:
  print(s)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a>= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
a=input()
s=input()
if a>=3200:
  print(s)
else:
  print("red")
Problem p02935 (python)

Fixed submission:
n = int(input())
nums = sorted(map(lambda x: int(x), input().split(' ')))
res = nums[0] / 2**n
for index, num in enumerate(nums):
    res += num / 2**(n - index)
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = [int(i) for i in input().split()]
LOOP = int(np.log2(N))+1
LOOP_N = N

for _ in range(LOOP):
    is_odd = (LOOP_N%2 == 1)
    LOOP_N = math.ceil(LOOP_N/2)
    nums = [nums[2*i] if (i==LOOP_N-1 and is_odd) else (nums[2*i]+nums[2*i+1])/2  for i in range(LOOP_N)]

print(nums[0])
Problem p02951 (python)

Fixed submission:
a, b, c = input().split()
x = int(a) - int(b)
if int(c) <= x:
	print(0)
else:
	y = int(c) - x
	print(y)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
	if len(str(i)) % 2 == 1:
		ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split()) 
x = a - b
if c <= x:
	print(0)
else:
	y = c - x
	print(y)

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
x = a - b
y = c - x
print(y)

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split())
x = c - (a - b)
print(x)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
print(s if a >=3200 else 'red')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
print('{:.16g}'.format(1 / sum(1 /x for x in A)))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if 3200 <= a:
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
if 3200 <= a:
  print(s)
else:
  print('red')
Problem p02933 (python)

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

res = s if a >= 3200 else "red"
print(res)

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

res = a >= 3200 ? s : "red"
print(res)
Problem p03038 (python)

Fixed submission:
# 高速版input
import sys
input = sys.stdin.readline

n,m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]

x = []
for b,c in sorted(bc, key=lambda x: x[1], reverse=True):
    x.extend([c]*b)
    if len(x) > n:
        break
        
a.extend(x)
print(sum(sorted(a,reverse=True)[:n]))

Buggy submission (verdict: Runtime Error):
# 高速版input
import sys
input = sys.stdin.readline

# 二分探索
import bisect
import numpy as np

n,m = (int(i) for i in input().split())
a = sorted([int(i) for i in input().split()])
bc = [[int(i) for i in input().split()] for i in range(m)]

a = a
for b,c in bc:
    idx = bisect.bisect_left(a,c)
    a = (a[:idx] + [c]*b + a[idx:])[b:]

print(sum(a))
Problem p03108 (python)

Fixed submission:
# UnionTreeクラス：グループ分けを木構造で管理する
class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.size = [1] * N
        self.N = N

    # xのrootを返す
    def root(self, x):
        if self.par[x] == x:
            return x
        else: 
            self.par[x] = self.root(self.par[x])
            return self.root(self.par[x])

    # x, yが同じrootの場合true
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    # x,yのrootが違った場合、併合
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if self.size[rx] < self.size[ry]:
            self.par[rx] = ry
            self.size[ry] += self.size[rx]
        else:
            self.par[ry] = rx
            self.size[rx] += self.size[ry]

n, m = (int(i) for i in input().split())
input_arr = [[int(i) for i in input().split()] for i in range(m)] 

uf = UnionFind(n)
#input_arr = [[1,2],[3,4],[1,3],[2,3],[1,4]]

#print(output(uf))
result = [int(n*(n-1)/2)]
for i in input_arr[::-1]:
    a = i[0]-1
    b = i[1]-1
    if not uf.same(a,b):
        x = uf.size[uf.root(a)] * uf.size[uf.root(b)]
        uf.unite(a,b)
        result.append(int(result[-1]-x))
    else:
        result.append(result[-1])

for i in result[::-1][1:]:
    print(i)

#print(uf.par)

Buggy submission (verdict: Runtime Error):
# UnionTreeクラス：グループ分けを木構造で管理する
class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.size = [1] * N
        self.N = N

    # xのrootを返す
    def root(self, x):
        if self.par[x] == x:
            return x
        else: 
            self.par[x] = self.root(self.par[x])
            return self.root(self.par[x])

    # x, yが同じrootの場合true
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    # x,yのrootが違った場合、併合
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if self.size[rx] < self.size[ry]:
            self.par[rx] = ry
            self.size[ry] += self.size[rx]
        else:
            self.par[ry] = rx
            self.size[rx] += self.size[ry]


n, m = (int(i) for i in input().split())
input_arr = [[int(i) for i in input().split()] for i in range(m)] 

uf = UnionFind(n)
#input_arr = [[1,2],[3,4],[1,3],[2,3],[1,4]]

#print(output(uf))
result = [output(uf)]
for i in input_arr[::-1]:
    a = i[0]-1
    b = i[1]-1
    if not uf.same(a,b):
        x = uf.size[uf.root(a)] * uf.size[uf.root(b)]
        uf.unite(a,b)
        result.append(result[-1]-x)
    else:
        result.append(result[-1])

for i in result[::-1][1:]:
    print(i)

#print(uf.par)
Problem p03137 (python)

Fixed submission:
n, m = (int(i) for i in input().split())  
x = sorted([int(i) for i in input().split()])

if m > 1:
    x_diff = []
    for i in range(m-1):
        x_diff.append(x[i+1] - x[i])
else:
    x_diff = [0]

if n > 1:
    x_diff = sorted(x_diff)[:-(n-1)]

print(sum(x_diff))

Buggy submission (verdict: Runtime Error):
n, m = (int(i) for i in input().split())  
x = [int(i) for i in input().split()]  

x_diff = []
for i in range(m-1):
    x_diff.append(x[i+1] - x[i])

for i in range(n-1):
    max_num = max(x_diff)
    max_index = x_diff.index(max_num)
    x_diff[max_index] = 0

print(sum(x_diff))
Problem p03207 (python)

Fixed submission:
n = int(input()) 
prices = [int(input()) for i in range(n)] 

max_price = 0
sum_price = 0
for price in prices:
    sum_price += price
    if price > max_price:
        max_price = price

sum_price -= max_price/2

print(int(sum_price))

Buggy submission (verdict: Runtime Error):
n = int(input()) 
prices = [int(input()) for i in range(n)] 

max_price = 0
sum_price = 0
for price in prices:
    sum_price += price
    if price > max_price:
        max_price = price

sum_price -= max_price/2

return sum_price
Problem p03221 (python)

Fixed submission:
import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
py_list = [[int(i) for i in input().split()] + [0] for i in range(M)] 
m_list = [[] for j in range(N+1)]
 
sorted_py_list = sorted(py_list, key=lambda x:x[1])

city_list = {}
for py in sorted_py_list:
    city_list[py[0]] = city_list[py[0]]+1 if py[0] in city_list else 1
    py[2] = city_list[py[0]]
 
for py in py_list:
    print(str(py[0]).zfill(6) + str(py[2]).zfill(6))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
input_list = [[int(i) for i in input().split()] for i in range(M)] 
 
m_list = [[] for j in range(N+1)]
 
for inputs in input_list:
    m_list[inputs[0]].append(inputs[1])
 
for arr in m_list:
    arr.sort()
    arr.insert(-10000)
 
for inputs in input_list:
    num = m_list[inputs[0]].index(inputs[1])
    print(str(inputs[0]).zfill(6) + str(num).zfill(6))
Problem p02933 (python)

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

if a >= 3200:
  print(s)
else:
  print('red')

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

v.sort()
kati = (v[0] + v[1]) / 2

if n == 2:
  print(kati)
else:
  for i in range(2,n):
    kati = (kati + v[i]) / 2
  print(kati)
Problem p02933 (python)

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

if a>=3200:
    print(s)

else:
    print('red')

Buggy submission (verdict: Runtime Error):
a=input()
s=input()

if a>=3200:
    print(s)

else:
    print('red')

Buggy submission (verdict: Runtime Error):
a=input()
s=input()

if a>=3200:
    print(s)

if a<3200:
    print('red')
Problem p02933 (python)

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

if a>=3200:
    print(s)
elif a<3200:
    print("red")

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

if a>=3200:
    print(s)
else if a<3200:
    print("red")
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
 
if a < 3200:
  s = 'red'
print(s)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

i, q = [int(x) for x in input().split(' ')]

root = Node(1)
for idx in range(i-1):
    a, b = [int(x) for x in input().split(' ')]
    root.add_child(a, b)

for _ in range(q):
    p, x = [int(x) for x in input().split(' ')]
    root.set_count(p, x)

root.add_count()

counts = sorted(root.get_counts(), key=itemgetter(0))
print(' '.join([str(x[1]) for x in counts]))


class Node:
    def __init__(self, id):
        self.id = id
        self.count = 0
        self.children = []

    def add_child(self, parent_id, child_id):
        if parent_id < self.id:
            return

        if parent_id == self.id:
            # 追加
            self.children.append(Node(child_id))
            return

        for child in self.children:
            child.add_child(parent_id, child_id)
        return

    def set_count(self, target_id, num, is_count=False):
        # if target_id == self.id:
        #     is_count = True

        # if is_count:
        #     self.count += num

        # for child in self.children:
        #     child.add_count(target_id, num, is_count)
        if target_id < self.id:
            return
        if target_id == self.id:
            self.count += num
            return
        for child in self.children:
            child.set_count(target_id, num, is_count)
        return

    def add_count(self, num=0):
        self.count += num
        for child in self.children:
            child.add_count(self.count)
        return

    def get_counts(self):
        res = [(self.id, self.count)]
        # print(self.id, self.count)
        for child in self.children:
            res += child.get_counts()
        return res
Problem p03073 (python)

Fixed submission:
s=input()
a=0
for i in range(len(s)):
  if i%2==0 and s[i]=="0":
  	a+=1
  if i%2==1 and s[i]=="1":
  	a+=1  
print(min(a,(len(s)-a)))

Buggy submission (verdict: Runtime Error):
s=input()
a=0
for i in range(3):
  if i%2==0 and s[i]=="0":
  	a=1
  if i%2==1 and s[i]=="1":
  	a+=1  
print(min(a,len(s)-a))

Buggy submission (verdict: Runtime Error):
s=input()
a=0
for i in range(len(s)):
  if i%2==0:
    if s[i]==0:
      a+=1
  if i%2==1:
    if s[i]==1:
      a+=1
print(min(a,len(s)-a)
Problem p03272 (python)

Fixed submission:
n,i=map(int,input().split())
print(n-i+1)

Buggy submission (verdict: Runtime Error):
n,i=map(int,input().split())
print(n-p+1)
Problem p03137 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

import copy

n, m = map(int, input().split())
ary = [int(s) for s in input().split()]

if n < m :
    ary.sort()
    sa = []
    
    for i in range(0, m - 1):
        sa.append(ary[i + 1] - ary[i])
    
    #print(sa)
    
    sa.sort()
    
    for i in range(0, n - 1):
        sa.pop(-1)
    
    print(sum(sa))
else :
    print(0)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

import copy

n, m = map(int, input().split())
ary = [int(s) for s in input().split()]

if len(ary) > 1 :
    ary.sort()
    sa = []
    for i in range(0, m - 1):
        sa.append(ary[i + 1] - ary[i])
        
    for i in range(0, n -1):
        sa.remove(max(sa))
        
    print(sum(sa))
else :
    print(0)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力

import copy

n, m = map(int, input().split())
ary = [int(s) for s in input().split()]

ary.sort()

ary2 = copy.copy(ary)
ary2.pop(0)
ary2.append(0)

sa = []

for i in range(0, m - 1):
    sa.append(ary2[i] - ary[i])

#print(sa)

for i in range(0, n -1):
    sa.remove(max(sa))

#print(sa)

print(sum(sa))
Problem p03221 (python)

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

l = []
ans = [0] * m

for i in range(m):
    l.append([int(j) for j in input().split()])
    l[i].append(i)

#[県, 市, 元の順番]
l2 = sorted(l, key=lambda x:(x[0],x[1]))
cnt = 1

for i in range(m):
    
    l2[i][1] = cnt
    
    if i < m -1 and l2[i][0] == l2[i + 1][0]:
        cnt += 1
    else:
        cnt = 1

    ans[l2[i][2]] = '{:06}{:06}'.format(l2[i][0],l2[i][1])

for s in ans:
    print(s)

Buggy submission (verdict: Runtime Error):

n, m = map(int, input().split())

l = [0 for i in range(n)]

for i in range(m):
    p, y = map(int, input().split())
    l[ p - 1 ] += 1

def out(l, cnt):
    
    if any([True for i in l if i > 0]): 
        [print('{ken:06}{shi:06}'.format(ken=i+1, shi=l[i])) for i in range(len(l)) if l[i] > 0]
        return out([i - 1 for i in l], cnt+1)
    else:
        return

out(l, 1)

Buggy submission (verdict: Runtime Error):

n, m = map(int, input().split())

l = [0 for i in range(n)]

for i in range(m):
    p, y = map(int, input().split())
    #print('p:{} y:{} i:{}'.format(p, y, i))
    l[ p - 1 ] += 1

shi = 1
def out(l, cnt):
    
    if any([True for i in l if i > 0]):
        global shi
        
        for i in range(len(l)):
            if l[i] > 0:
                print('{ken:06}{shi:06}'.format(ken=i+1, shi=shi)) 
                
        shi+=1
        return out([i - 1 for i in l], cnt+1)
    else:
        return

out(l, 1)
Problem p03042 (python)

Fixed submission:
def solve():
	unknownDate = input()
	datePre = int(unknownDate[:2])
	datePos = int(unknownDate[2:])
	
	isPreMightMonth = (0 < datePre <= 12)
	isPostMightMonth = (0 < datePos <= 12)
	
	if isPreMightMonth and isPostMightMonth:
		print('AMBIGUOUS')
	elif isPreMightMonth and (not isPostMightMonth):
		print('MMYY')
	elif (not isPreMightMonth) and isPostMightMonth:
		print('YYMM')
	else:
		print('NA')
solve()

Buggy submission (verdict: Runtime Error):
def solve():
	unknownDate = input()
	datePre = int(unknownDate[:2])
	datePos = int(unknownDate[2:])
	
	isPreMightMonth = (0 < datePre <= 12)
	isPostMightMonth = (0 < datePos <= 12)
	
	if isPreMightMonth and isPostMightMonth:
		print('AMBIGUOUS')
	elif isPreMightMonth and (not isPostMightMonth):
		print('MMYY')
	elif (not isPreMightMonth) and isPostMightMonth:
		print('YYMM')
	else:
		print('NA')
 solve()
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
xs = [int(input()) for _ in range(m)]

broken = [False] * (n + 1)
for x in xs:
    broken[x] = True

cache = [-1] * (n + 1)

def solve(pos, n, broken, cache):
    if pos > n or broken[pos]:
        return 0
    if pos == n:
        return 1
    res = cache[pos]
    if res >= 0:
        return res
    res = solve(pos+1, n, broken, cache) + solve(pos+2, n, broken, cache)
    cache[pos] = res = res % 1000000007
    return res

for tmp in range(n,0,-1):
    solve(tmp,n,broken,cache)

print(solve(0,n,broken,cache))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
xs = [int(input()) for _ in range(m)]

broken = [False] * (n + 1)
for x in xs:
    broken[x] = True

cache = [-1] * (n + 1)

def solve(pos, n, broken, cache):
    if pos > n or broken[pos]:
        return 0
    if pos == n:
        return 1
    res = cache[pos]
    if res >= 0:
        return res
    res = solve(pos+1, n, broken, cache) + solve(pos+2, n, broken, cache)
    cache[pos] = res = res % 1000000007
    return res

print(solve(0,n,broken,cache))
Problem p03041 (python)

Fixed submission:

n,k=map(int,input().split())
s=input()
k=k-1
s = s[:k]+str(s[k]).lower()+s[k+1:]
print(s)

Buggy submission (verdict: Runtime Error):

n,k=map(int,input().split())
s=input()
s = s[:k-1]+str(s[k]).lower()+s[k+1:]
print(s)