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

Fixed submission:
haiku = input()
x = haiku.split()
num_5 = 0
num_7 = 0

for v in x:
    v = int(v)
    if v == 5:
        num_5 += 1
    elif v == 7:
        num_7 += 1

if num_5 == 2 and num_7 == 1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
haiku = int(input())
x = haiku.split(' ')
num_5 = 0
num_7 = 0

for v in x:
	if x[v] == 5:
		num_5 ++
	elif x[v] == 7:
		num_7 ++

if num_5 == 2 and num_7 == 1:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
haiku = int(input())
x = haiku.split(' ')
num_5 = 0
num_7 = 0

for v in x:
	if x[v] == 5:
		num_5 ++
	elif x[v] == 7:
		num_7 ++

if num_5 == 2 and num_7 == 1
	print('YES')
else
	print('NO')
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
 
ans = (abs(x) + abs(y)) * 2
 
if x < y:
    ans = min(ans, y - x)
 
if -x <= y:
    ans = min(ans, y - (-x) + 1)
 
if x <= -y:
    ans = min(ans, (-y) - x + 1)
 
if -x < -y:
    ans = min(ans, (-y) - (-x) + 2)
 
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
 
ans = (abs(x) + abs(y)) * 2
 
if x < y:
    ans = min(ans, y - x)
 
if -x <= y:
    ans = min(ans, y - (-x) + 1)
 
if x <= -y:
    ans = min(ans, (-y) - x + 1)
 
if -x < -y:
    ans = min(ans, (-y) - (-x) + 2)
 
print(ans)
Problem p04013 (python)

Fixed submission:
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, a = reads()
    x = reads()
    s = sum(x)
    dp = [[[0]*3500 for j in range(n+1)] for i in range(n+1)]
    dp[0][0][0] = 1
    for i in range(n):
        for j in range(n):
            for k in range(s):
                dp[i][j+1][k] += dp[i][j][k]
                dp[i+1][j+1][k+x[j]] += dp[i][j][k]
    r = 0
    for j in range(1, n+1):
        r += dp[j][n][j*a]
    print(r)

main()

Buggy submission (verdict: Runtime Error):
from array import array

def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, a = reads()
    x = reads()
    s = sum(x)
    dp = [[array('I', [0]*3500) for j in range(n+1)] for i in range(n+1)]
    dp[0][0][0] = 1
    for i in range(n):
        for j in range(n):
            for k in range(s):
                dp[i][j+1][k] += dp[i][j][k]
                dp[i+1][j+1][k+x[j]] += dp[i][j][k]
    r = 0
    for j in range(1, n+1):
        r += dp[j][n][j*a]
    print(r)

main()
Problem p04030 (python)

Fixed submission:
s = raw_input()
words = []
for c in list(s):
    if c == 'B':
        if len(words) > 0:
            words.pop()
    else:
        words.append(c)
print ''.join(words)

Buggy submission (verdict: Runtime Error):
s = raw_input()
words = []
for c in list(s):
    if c == 'B':
        words.pop()
    else:
        words.append(c)
print ''.join(words)
Problem p04032 (python)

Fixed submission:
import sys
s = list(raw_input())
if len(s) == 2:
    if s[0] == s[1]:
        print 1, 2
    else:
        print -1, -1
else:
    for n in [3]:
        for i in xrange(len(s) - n + 1):
            sub = s[i:i+n]
            for char in set(sub):
                if sub.count(char) >= n / 2 + n % 2:
                    print i + 1, i + n
                    sys.exit()
    print -1, -1

Buggy submission (verdict: Runtime Error):
import sys
s = list(raw_input())
if len(s) == 2:
    if s[0] == s[1]:
        print 1, 2
    else
        print -1, -1
else:
    for n in [3]:
        for i in xrange(len(s) - n + 1):
            sub = s[i:i+n]
            for char in set(sub):
                if sub.count(char) >= n / 2 + n % 2:
                    print i + 1, i + n
                    sys.exit()
    print -1, -1

Buggy submission (verdict: Runtime Error):
import sys
s = list(raw_input())
if len(s) == 2:
    if s[0] == s[1]:
        print 1, 2
    else
        print -1, -1
else:
    for n in range(3, len(s)):
        for i in xrange(len(s) - n + 1):
            sub = s[i:i+n]
            for char in set(sub):
                if sub.count(char) >= n / 2 + n % 2:
                    print i + 1, i + n
                    sys.exit()
    print -1, -1

Buggy submission (verdict: Runtime Error):
import sys
s = list(raw_input())
if len(s) == 2:
    if s[0] == s[1]:
        print 1, 2
    else
        print -1, -1
else:
    for n in range(3, 100):
        for i in xrange(len(s) - n + 1):
            sub = s[i:i+n]
            for char in set(sub):
                if sub.count(char) >= n / 2 + n % 2:
                    print i + 1, i + n
                    sys.exit()
    print -1, -1
Problem p04033 (python)

Fixed submission:
input = raw_input()
a, b = input.split()
a = int(a)
b = int(b)
if a > 0 and b > 0:
    print 'Positive'
elif a < 0 and b < 0:
    if (b - a) % 2 == 0:
        print 'Negative'
    else:
        print 'Positive'
else:
    print 'Zero'

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import argparse
import numpy as np

parser = argparse.ArgumentParser(description='Range Product')
parser.add_argument('a', type=int)
parser.add_argument('b', type=int)
args = parser.parse_args()

a = args.a
b = args.b

if a > 0 and b > 0:
    print 'Positive'
elif a < 0 and b < 0:
    if (b - a) % 2 == 0:
        print 'Negative'
    else:
        print 'Positive'
else:
    print 'Zero'
Problem p03846 (python)

Fixed submission:
import sys

n = int(input())
a_lst = [int(x) for x in input().split()]

dic = {}

for i in range(1, n + 1, 2):
    j = n - i
    dic[j] = 1 if j == 0 else 2

for i in a_lst:
    if i not in dic:
        print(0)
        sys.exit()

    dic[i] -= 1

    if dic[i] < 0:
        print(0)
        sys.exit()

print(pow(2, n // 2) % (pow(10, 9) + 7))

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
a_lst = [int(x) for x in input().split()]

dic = {}

for i in range(1, n + 1, 2):
    j = n - i
    dic[j] = 1 if j == 0 else 2

for i in a_lst:
    dic[i] -= 1

    if dic[i] < 0:
        print(0)
        sys.exit()

print(pow(2, n // 2) % (pow(10, 9) + 7))
Problem p03807 (python)

Fixed submission:
n = int(input())
a = map(int, input().split())
count = 0
for i in a:
    if i % 2 == 1:
        count += 1
print("YES" if count % 2 == 0 else "NO")

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

k = 0
for item in arg_list:
    if item % 2 == 1 :
        k +=1
if k == 1:
    print('YES')
else:
    print('NO')
Problem p03826 (python)

Fixed submission:
inp = input()
a, b, c, d = inp.split(' ')

if int(a) * int(b) > int(c) * int(d):
    print(int(a) * int(b))
else:
    print(int(c) * int(d))

Buggy submission (verdict: Runtime Error):
import math
from sympy import divisor_count
N = int(input())
N = math.factorial(N)
mod = 10**9+7

print(divisor_count(N) % mod)
Problem p03807 (python)

Fixed submission:
n = int(raw_input())
 
a = list(map(int, raw_input().split()))
 
p = map(lambda x : x % 2, a)
if p.count(1)%2 == 0 :
    print "YES"
else :
    print "NO"

Buggy submission (verdict: Runtime Error):
n = int(raw_input().split())

a = list(map(int, raw_input().split()))

p = map(lambda x : x % 2, a)
if p.count(1)%2 == 0 :
    print "YES"
else :
    print "NO"
Problem p03807 (python)

Fixed submission:
import sys

next(sys.stdin)
ns = list(map(int, next(sys.stdin).split()))

if len(ns) == 1:
    print('YES')
    exit()

if sum(1 for n in ns if n % 2 == 1) % 2 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import sys

n = list(map(int, next(sys.stdin).split()))

if len(ns) == 1:
    print('YES')
    exit()

if sum(1 for n in ns if n % 2 == 1) % 2 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import sys

if sum(for n in map(int, next(sys.stdin).split()) if n % 2 == 1) % 2 == 0:
    print('YES')
else:
    print('NO')
Problem p03944 (python)

Fixed submission:
w,h,n=map(int,raw_input().split())
x1,x2,y1,y2=0,w,0,h
for i in range(n):
    x,y,a=map(int,raw_input().split())
    if a==1: x1=max(x1,x)
    if a==2: x2=min(x2,x)
    if a==3: y1=max(y1,y)
    if a==4: y2=min(y2,y)
print max(0,x2-x1)*max(0,y2-y1)

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,raw_input().split())
x1=0,x2=w,y1=0,y2=h
for i in range(n):
    x,y,a=map(int,raw_input().split())
    if a==1: x1=max(x1,x)
    if a==2: x2=min(x2,x)
    if a==3: y1=max(y1,y)
    if a==4: y2=min(y2,y)
print max(0,x2-x1)*max(0,y2-y1)
Problem p03957 (python)

Fixed submission:
import sys
s=raw_input()
flag=False
for j in range(len(s)):
    if s[j]=='C':
        flag=True
    if s[j]=='F' and flag:
        print "Yes"
        sys.exit()
print "No"

Buggy submission (verdict: Runtime Error):
import sys
s=raw_input()
flag=False
for j in range(s):
    if s[j]=='C':
        flag=True
    if s[j]=='F' and flag:
        print "Yes"
        sys.exit()
print "No"
Problem p04006 (python)

Fixed submission:
n,x=map(int,raw_input().split(" "))
a=map(int,raw_input().split(" "))
t=[i for i in a]
s=10**15
for m in range(n):
    t=[min(t[j],a[(j-m)%n]) for j in range(n)]
    s=min(x*m+sum(t),s)
print s

Buggy submission (verdict: Runtime Error):
n,x=map(int,raw_input().split(" "))
a=map(int,raw_input().split(" "))
t=[i for i in a]
ans=10**10
for m in range(n):
    t=[min(t[j],a[(j-m)%n]) for j in range(n)]
    s=min(x*m+sum(t),s)
print s
Problem p04017 (python)

Fixed submission:
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
def join(s):
    return ''.join(s)

###########

n=i()
x=ii()
l=i()
q=i()
a,b=[0]*q,[0]*q
for j in range(q):
    aa,bb=ii()
    a[j],b[j]=min(aa,bb)-1,max(aa,bb)-1
table=[[0 for i in range(n)] for j in range(32)]


for k in range(n):
    table[0][k]=bisect.bisect_right(x,x[k]+l)-1
for j in range(1,32):
    for k in range(n):
        table[j][k]=table[j-1][table[j-1][k]]
for j in range(q):
    day=0
    cur=a[j]
    for k in reversed(range(32)):
        if table[k][cur]<b[j]:
            day+=2**k
            cur=table[k][cur]
    print day+1

Buggy submission (verdict: Runtime Error):
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
def join(s):
    return ''.join(s)

###########

n=i()
x=ii()
l=i()
q=i()
a,b=[0]*q,[0]*q
for j in range(q):
    aa,bb=ii()
    a[j],b[j]=min(aa,bb)-1,max(aa,bb)-1
table=[[0 for i in range(n)] for j in range(32)]


for k in range(n):
    table[0][k]=bisect.bisect_right(x,x[k]+l)-1
for j in range(1,32):
    for k in range(n):
        table[j][k]=table[j-1][table[j-1][k]]
for j in range(q):
    day=0
    cur=a[j]
    for k in reversed(range(32)):
        if table[k][cur]<=b[j]:
            day=(day+2**k)%mod
            cur=table[k][cur]
    print day
Problem p04047 (python)

Fixed submission:
n=int(raw_input())
a=map(int,raw_input().split())
a.sort()
print sum([a[2*i] for i in range(n)])

Buggy submission (verdict: Runtime Error):
ii=lambda:map(int,raw_input().split())
n,k=ii()
T,F=True,False
e=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=ii()
    e[a-1]+=[b-1];e[b-1]+=[a-1]
cost=[0]*n
ans=10**5
def dfs(x,f):
    if f>=0:vis[f]=T
    q=[(x,0)]
    while len(q):
        v,c=q.pop(0)
        if c>k/2:break
        cost[v]=c;vis[v]=T
        for w in e[v]:
            if not vis[w]:q+=[(w,c+1)]
    return n-vis.count(T)
if k%2:
    for i in range(n):
        for j in e[i]:
            if i<j:vis=[F]*n;dfs(i,j);ans=min(ans,dfs(j,i))
else:
    for i in range(n):vis=[F]*n;ans=min(ans,dfs(i,-1))
print ans
Problem p03810 (python)

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)

Buggy submission (verdict: Runtime Error):
import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)

def score(A):
	return(sum(A)-len(A))

def Ifavor(A):
	return(score(A)%2==1)	

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	
def testmove(A,i):
	N=len(A)
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	if Ifavor(A):
		A=[x*g for x in A]
		A[i]+=1
		return(False)
	else:
		j=0
		while j<N:
			A[j]-=1
			h=gcdm(A)	
			if Ifavor([x//h for x in A])==False:
				A[j]+=1
				A=[x*g for x in A]
				A[i]+=1
				return(False)
			A[j]+=1
			j+=1
		A=[x*g for x in A]
		A[i]+=1	
		return(True)

N=int(input())
B=[int(x) for x in input().split()]

#inp=St.splitlines()
#N=int(inp[0])
#B=[int(x) for x in inp[1].split()]

if Ifavor(B):
	print('First')
else:
	maxply=sum(B)-N
	ply=1
	e=0
	while e<N:
		if testmove(B,e):
			break
		e+=1
			
	if e!=N:
		playmove(B,e)
		ply+=1

	if (ply%2==1)!=Ifavor(B):
		print('Second')
	else:
		print('First')
Problem p03829 (python)

Fixed submission:
n, a, b= map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    dx = a * (l[i+1] - l[i])
    if b < dx:
        ans += b
    else:
        ans += dx
print(ans)

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    dx = a * (l[i+1] - l[i])
    if b < dx:
        ans += b
    else:
        ans += dx
print(ans)
Problem p03964 (python)

Fixed submission:
n = int(input())
A, B = 0, 0
for i in range(n):
    x, y = map(int,input().split())
    dx, dy = 1, 1
    if A > x:
        dx = A // x
        if A % x != 0:
            dx += 1
    
    if B > y:
        dy = B // y
        if B % y != 0:
            dy += 1

    a = max(dx, dy)
    A, B = a * x, a * y
print(A + B)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
A, B = 0, 0
for i in range(n):
    x, y = int(input.split())
    dx, dy = 1, 1
    if A > x:
        dx = A // x
        if A % x != 0:
            dx += 1
    
    if B > y:
        dy = B // y
        if B % y != 0:
            dy += 1

    a = max(dx, dy)
    A, B = a * x, a * y
print(A + B)
Problem p04000 (python)

Fixed submission:
h, w, n = map(int,input().split())
 
xy_pos = dict()
 
for i in range(n):
    a, b = map(int, input().split())
    for k in range(-2,1):
        for l in range(-2,1):
            x = (a-1) + k
            y = (b-1) + l
            if (0 <= x <= h-3 and 0 <= y <= w-3):
                xy = str(x) + "x" + str(y)
                if xy in xy_pos:
                    xy_pos[xy] += 1
                else:
                    xy_pos[xy] = 1
 
ans = [0]*10                    
for v in xy_pos.values():
    ans[v] += 1
ans[0] = (h-2)*(w-2) - sum(ans)
for i in range(10):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
h, w, n = map(int,input().split())
cell = [[0]*w for _ in range(h)]
for _ in range(n):
    a, b = map(int,input().split())
    for i in range(3):
        for j in range(3):
            if a-i>=0 and b-j>=0:
                cell[a-i-1][b-j-1] += 1
            else:
                continue

ans = [0]*10

for i in range(h-2):
    for j in range(w-2):
        s = cell[i][j]
        ans[s] += 1

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
h, w, n = map(int,input().split())
cell = [[0]*w for _ in range(h)]
for _ in range(n):
    a, b = map(int,input().split())
    cell[a-1][b-1] = 1

ans = [0]*10

for i in range(h-2):
    for j in range(w-2):
        s = [cell[i][j],cell[i+1][j],cell[i+2][j],cell[i][j+1],cell[i+1][j+1],cell[i+2][j+1],cell[i][j+2],cell[i+1][j+2],cell[i+2][j+2]].count(1)
        ans[s] += 1

for i in ans:
    print(i)
Problem p04014 (python)

Fixed submission:
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n)) + 2):
    if digit(i, n) == s:
        print(i)
        exit()

for p in range(1,int(math.sqrt(n)))[::-1]:
    q = s - p
    b = (n-s)//p +1
    if 1 <= p < b and 0 <= q < b and (n - s)%p == 0:
        if digit(b, n) == s:
            print(b)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
#自分の回答
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n)) + 2):
    if digit(i, n) == s:
        print(i)
        exit()
    else:
        continue

for p in range(1,int(math.sqrt(n)))[::-1]:
    b = (n-s)//p +1
    if digit(b, n) == s:
        print(b)
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
#自分の回答
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n)) + 2):
    if digit(i, n) == s:
        print(i)
        exit()
    else:
        continue

for p in range(1,int(math.sqrt(n)))[::-1]:
    b = (n-s)//p +1
    if digit(b, n) == s:
        print(b)
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
#自分の回答
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n) + 1)):
    if digit(i, n) == s:
        print(i)
        exit()
    else:
        continue

for p in range(1,int(math.sqrt(n) +1)):
    b = (n-s)//p + 1
    if digit(b, n) == s:
        print(b)
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
import math
def digit(b, n):
    if n < b:
        return n
    else:
        return digit(b, math.floor(n/b)) + n % b

n, s = int(input()), int(input())  

if n == s:
    print(n+1)
    exit()

if n < s:
    print(-1)
    exit()

for i in range(2, int(math.sqrt(n))):
    if digit(i, n) == s:
        print(i)
        exit()
    else:
        continue

for p in range(1,int(math.sqrt(n))):
    b = (n-s)//p + 1
    if digit(b, n) == s:
        print(b)
        exit()
print(-1)
Problem p04043 (python)

Fixed submission:
values = sorted(int(v) for v in input().split())
if values == [5, 5, 7]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
N, _ = map(int, input().split())
values = [input() for _ in range(N)]
print(''.join(sorted(values)))
Problem p03814 (python)

Fixed submission:
sample = input()
#new = list(sample)
#if "A" in new:
a_pos = sample.index('A')
#if "Z" in new:
z_pos = sample.rfind('Z')
print(z_pos-a_pos+1)

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
if a_post < z_pos:
  out = new[a_pos:(z_pos+1)]
    
new_string = ""
for j in out:
  new_string += j
print(len(new_string))

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
if a_post < z_pos:
  out = new[a_pos:(z_pos+1)]
    
new_string = ""
for i in out:
  new_string += i
print(len(new_string))

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
if a_post < z_pos:
	out = new[a_pos:(z_pos+1)]
    
new_string = ""
for i in out:
  new_string += i
print(len(new_string))

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
if a_post < z_pos:
	out = new[a_pos:(z_pos+1)]
    
new_string = ""
for i in out:
  new_string += i
print(new_string)

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
out = new[a_pos:(z_pos+1)]
print(out)

Buggy submission (verdict: Runtime Error):
sample = input()
new = []
for i in sample:
  new.append(i)
if "A" in new:
  a_pos = list.index(new)
if "Z" in new:
  z_pos = list.index(new)
out = new[a_pos:z_pos +1]
print(out)
Problem p03827 (python)

Fixed submission:
num = int(input())
new = input()

x = 0
m = 0
for i in range(num):
  if new[i] == "D":
    x -= 1
  if new[i] == "I":
    x += 1
  if m < x:
    m = x
print(m)

Buggy submission (verdict: Runtime Error):
num = int(input())
given = input()
new = given.split()
x = 0
max = 0
for i in range(num):
  if new[i] == "D":
    x -= 1
  if new[i] == "I":
    x += 1
  if max < x:
    max = x
print(max)

Buggy submission (verdict: Runtime Error):
num = int(input())
given = input()
new = given.split()
x = 0
max = 0
for i in range(num):
  if new[i] == "D":
    x -= 1
  elif new[i] == "I":
    x += 1
  if max < x:
    max = x
print(max)
Problem p03845 (python)

Fixed submission:
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0

for j in new:
  sum += int(j)

  
num_drinks = int(input())
for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if int(new_line[1]) != int(new[int(new_line[0])-1]):
    temp = sum - int(new[int(new_line[0])-1]) + int(new_line[1])
    print(temp)
  else:
    print(sum)

Buggy submission (verdict: Runtime Error):
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0
num_drinks = int(input())
for j in new:
  sum += int(j)

for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if new_line[1] != new[new_line[0]]:
    sum -= new[new_line[0]]
    sum += new_line[1]
  print(sum)

Buggy submission (verdict: Runtime Error):
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0
num_drinks = input()
for j in new:
  sum += j

for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if new_line[1] != new[new_line[0]]:
    sum -= new[new_line[0]]
    sum += new_line[1]
  print(sum)

Buggy submission (verdict: Runtime Error):
num_prob = int(input())
prob = input()
new = prob.split()
sum = 0
num_drinks = input()
for j in new:
  sum += j

for i in range(num_drinks):
  line = input()
  new_line = line.split()
  if new_line[1] != new[new_line[0]]:
    sum -= new[new_line[0]]
    sum += new_line[1]
Problem p03860 (python)

Fixed submission:
sentence = input()
new_sent = sentence.split(" ")
acro = ""
for i in new_sent:
  acro += i[0]
print(acro)

Buggy submission (verdict: Runtime Error):
sentence = input()
new_sent = sentence.split(" ")
acro = ""
for i in range(len(new_sent)):
  for j in range(new_sent[i]):
  	acro += new_sent[i][0]
print(acro)