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

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
  ans += (i+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
  ans += (i+1)
print(ans)
Problem p04047 (python)

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

ans = 0
l.sort()

for i in range(n):
    ans += l[2*i]
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [map(int, input().split())]

ans = 0
l.sort()

for i in range(n):
    ans += l[2*i]

print(ans)
Problem p02582 (python)

Fixed submission:
ws = input()

if ws.count('S') == 3:
    print(0)
elif ws.count('S') == 2:
    print(1)
elif ws.count('S') == 1:
    if ws.index('S') == 1:
        print(1)
    else:
        print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
ws = input()

rev = 0
for ch in ws:
    if ch == 'R':
        rev += 1
    else:
        rev = 0

return rev
Problem p02600 (python)

Fixed submission:
x = int(input())

if 400 <= x and x <= 599:
    print(8)
elif 600 <= x and x <= 799:
    print(7)
elif 800 <= x and x <= 999:
    print(6)
elif 1000 <= x and x <= 1199:
    print(5)
elif 1200 <= x and x <= 1399:
    print(4)
elif 1400 <= x and x <= 1599:
    print(3)
elif 1600 <= x and x <= 1799:
    print(2)
else:
    print(1)

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

if 400 <= x and x <= 599:
    return 8
elif 600 <= x and x <= 799:
    return 7
elif 800 <= x and x <= 999:
    return 6
elif 1000 <= x and x <= 1199:
    return 5
elif 1200 <= x and x <= 1399:
    return 4
elif 1400 <= x and x <= 1599:
    return 3
elif 1600 <= x and x <= 1799:
    return 2
else:
    return 1
Problem p02603 (python)

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

money = 1000
stock = 0

for i in range(N-1):
    if A[i+1] > A[i]:
        if money >= A[i]:
            n = money // A[i]
            stock += n
            money -= A[i] * n
    elif A[i+1] == A[i]:
        continue
    else:
        if stock > 1:
            money += stock * A[i]
            stock = 0

if stock > 0:
    money += stock * A[-1]

print(money)

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

money = 1000
stock = 0

for i in range(N-1):
    if A[i+1] > a[i]:
        if money >= A[i]:
            n = money // A[i]
            stock += n
            money -= A[i] * n
    elif A[i+1] == A[i]:
        continue
    else:
        if stock > 1:
            money += stock * A[i]
            stock = 0

if stock > 0:
    money += stock * A[-1]

print(money)
Problem p02900 (python)

Fixed submission:
import math
def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
  
a,b = map(int,input().split())
n = gcd(a,b)
count = [1]
while (n % 2 == 0):
    count += [2]
    n = n / 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
    while (n % i == 0):
        count+=[i]
        n = n / i

if n > 2:
    count+=[n]
c = 1
count = sorted(count)
for i in range(1,len(count)):
    if (count[i-1] != count[i]):
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())
n = math.gcd(a,b)
count = [1]
while n % 2 == 0:
    count += [2]
    n = n / 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
    while n % i == 0:
        count+=[i]
        n = n / i

if n > 2:
    count+=[n]
c = 1
count = sorted(count)
for i in range(1,len(count)):
    if count[i-1] != count[i]:
        c+=1
print(c)
Problem p02573 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10 ** 9)


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

G=[[] for i in range(n)]

for i in range(m):
    a,b=input().split()
    G[int(a)-1]+=[int(b)-1]
    G[int(b)-1]+=[int(a)-1]

#print(G)

dist=[-1 for i in range(n)]
# que=deque([0])
# dist[0]=0

count=0
def bfs(G):
    global count
    #print(que)
    if not que:
        return
    v = que.popleft()

    for nv in G[v]:
        if dist[nv] != -1:
            continue
        dist[nv]=dist[v]+1
        que.append(nv)
    count+=1
    
    bfs(G)

ans=0
for i in range(n):
    count=0
    if dist[i] != -1:
        continue
    else:
        que=deque([i])
        dist[i]=0
        bfs(G)
        if ans < count:
            ans=count

print(ans)

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

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

G=[[] for i in range(n)]

for i in range(m):
    a,b=input().split()
    G[int(a)-1]+=[int(b)-1]
    G[int(b)-1]+=[int(a)-1]

#print(G)

dist=[-1 for i in range(n)]
# que=deque([0])
# dist[0]=0

count=0
def bfs(G):
    global count
    #print(que)
    if not que:
        return
    v = que.popleft()

    for nv in G[v]:
        if dist[nv] != -1:
            continue
        dist[nv]=dist[v]+1
        que.append(nv)
    count+=1
    
    bfs(G)

ans=0
for i in range(n):
    count=0
    if dist[i] != -1:
        continue
    else:
        que=deque([i])
        dist[i]=0
        bfs(G)
        if ans < count:
            ans=count

print(ans)
Problem p02664 (python)

Fixed submission:
t=input()

new=""
for i in range(len(t)):
    if t[i] != "?":
        new+=t[i]
    else:
        if new=="":
            new+=t[i]
        elif new[-1]=="P":
            new+="D"
        else:
            new+=t[i]

t=new
new=""

for i in reversed(range(len(t))):
    if t[i] != "?":
        new=t[i]+new
    else:
        if new=="":
            new=t[i]+new
        elif new[0]=="D":
            new="P"+new
        else:
            new=t[i]+new

t=new
new=""

for i in range(len(t)):
    if t[i] != "?":
        new+=t[i]
    else:
        new+="D"


print(new)

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

new=""
for i in range(len(t)):
    if t[i] != "?":
        new+=t[i]
    else:
        if new[-1]=="P":
            new+="D"
        else:
            new+=t[i]

t=new
new=""

for i in reversed(range(len(t))):
    if t[i] != "?":
        new=t[i]+new
    else:
        if new[0]=="D":
            new="P"+new
        else:
            new=t[i]+new

t=new
new=""

for i in range(len(t)):
    if t[i] != "?":
        new+=t[i]
    else:
        new+="D"


print(new)

Buggy submission (verdict: Runtime Error):

t=input()

new=""
ans=0
ans_new=""
count=0

def func(new,t,i=0):
    global ans,ans_new
    if i==len(t):
        #print(new)
        if ans < new.count("D")+new.count("PD"):
            ans=new.count("D")+new.count("PD")
            ans_new=new
            #print(ans_new)

        return

    if t[i]=="?":
        return func(new+"P",t,i+1) or func(new+"D",t,i+1)
    else:
        return func(new+t[i],t,i+1)

i=0
func(new,t,i)
print(ans_new)
Problem p02687 (python)

Fixed submission:
s = input()

if s == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
import random

x=int(input())

while True:
    a=random.randint(-1000000000,1000000000)
    b=random.randint(-1000000000,1000000000)
    if x == a*a*a*a*a-b*b*b*b*b:
        print(a,b)
        break
Problem p03290 (python)

Fixed submission:
D,G=list(map(int,input().split()))
pc = [[int(i) for i in input().split()] for m in range(D)]

#print(pc)
minn=10000
flug=[]
def func(D,G,pc,flug,i=0,summ=0,num=0):
    global minn
    if i==D:
        #print(flug,summ,num)
        if summ>=G:
            minn=min(minn,num)
            return 0
        else:
            for j,bit in enumerate(reversed(flug)):
                if bit==0:
                    for k in range(pc[D-1-j][0]):
                        summ+=(D-j)*100
                        num+=1
                        if summ>=G:
                            minn=min(minn,num)
        return 0

    return func(D,G,pc,flug+[1],i+1,summ+pc[i][0]*100*(i+1)+pc[i][1],num+pc[i][0]) + func(D,G,pc,flug+[0],i+1,summ,num)


func(D,G,pc,flug)
print(minn)

Buggy submission (verdict: Runtime Error):
D,G=list(map(int,input().split()))
pc = [[int(i) for i in input().split()] for m in range(2)]

#print(pc)
minn=10000
flug=[]
def func(D,G,pc,flug,i=0,summ=0,num=0):
    global minn
    if i==D:
        #print(flug,summ,num)
        if summ>=G:
            minn=min(minn,num)
            return 0
        else:
            for j,bit in enumerate(reversed(flug)):
                if bit==0:
                    for k in range(pc[D-1-j][0]):
                        summ+=(D-j)*100
                        if summ>=G:
                            num+=(k+1)
                            minn=min(minn,num)
        return 0

    return func(D,G,pc,flug+[1],i+1,summ+pc[i][0]*100*(i+1)+pc[i][1],num+pc[i][0]) + func(D,G,pc,flug+[0],i+1,summ,num)


func(D,G,pc,flug)
print(minn)
Problem p02573 (python)

Fixed submission:
def findgraphs(nodes):
    graphs = []
    while nodes:
        graph = set()
        queue = set([next(iter(nodes))])
        while queue:
            nextq = set()
            graph.update(queue)
            for q in queue:
                nextq.update(n for n in nodes[q] if n not in graph)
                del nodes[q]

            queue = nextq

        graphs.append(graph)

    return graphs




friends = dict()
N, M = map(int, input().split())
nodes = {x : set() for x in range(1, N+1)}
for _ in range(M):
    A, B = map(int, input().split())
    nodes[A].add(B)
    nodes[B].add(A)
graphs = findgraphs(nodes)

m = max(len(g) for g in graphs)
print(m)

Buggy submission (verdict: Runtime Error):
def findgraphs(nodes):
    graphs = []
    while nodes:
        graph = set()
        queue = set([next(iter(nodes))])
        while queue:
            nextq = set()
            graph.update(queue)
            for q in queue:
                nextq.update(n for n in nodes[q] if n not in graph)
                del nodes[q]

            queue = nextq

        graphs.append(graph)

    return graphs




friends = dict()
N, M = map(int, input().split())
nodes = {x : set() for x in range(1, N+1)}
for _ in range(M):
    A, B = map(int, input().split())
    nodes[A].add(B)
 
graphs = findgraphs(nodes)

m = max(len(g) for g in graphs)
print(m)
Problem p02573 (python)

Fixed submission:
import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############

def dfs(i, edges, visited):
    s = []
    if not visited[i]:
        s.append(i)
        visited[i] = True
    res = 0
    while len(s) > 0:
        v = s.pop()
        res += 1
        for i in edges[v]:
            if not visited[i]:
                s.append(i)
                visited[i] = True

    return res

def solve():
    [N, M] = inlt()
    edges = defaultdict(set)
    visited = [False for i in range(N)]

    for i in range(M):
        [a, b] = inlt()
        edges[a - 1].add(b - 1)
        edges[b - 1].add(a - 1)

    res = 0
    for i in range(N):
        res = max(res, dfs(i, edges, visited))
    
    return res

    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))

Buggy submission (verdict: Runtime Error):
import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############

def diff(S, i, T):
    res = 0
    for j in range(len(T)):
        if S[i + j] != T[j]:
            res += 1
    return res

def solve():
    [N, M] = inlt()
    uf = [i for i in range(N)]

    def root(i):
        if uf[i] == i:
            return i
        res = root(uf[i])
        uf[i] = res
        return res

    def union(i, j):
        uf[root(i)] = root(j)

    for i in range(M):
        [a, b] = inlt()
        union(a - 1, b - 1)

    groups = defaultdict(int)
    res = 0
    for i in range(N):
        r = root(i)
        groups[r] += 1
        res = max(res, groups[r])
    
    return res

    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))
Problem p02574 (python)

Fixed submission:
import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############


def gcd(a, b):
    if b > a:
        return gcd(b, a)
    m = a % b
    if m == 0:
        return b
    return gcd(b, m)

def solve():
    N = inp()
    AA = inlt()

    MAX = 10 ** 6 + 5
    freq = [0 for i in range(MAX)]
    cnt = [0 for i in range(MAX)]
    
    gcd_cum = AA[0]

    for i in range(N):
        freq[AA[i]] += 1
        gcd_cum = gcd(gcd_cum, AA[i])

    for i in range(2, MAX):
        for j in range(i, MAX, i):
            cnt[i] += freq[j]

    pairwise = True
    for i in range(2, MAX):
        if cnt[i] > 1:
            pairwise = False
            break
    
    if gcd_cum == 1 and pairwise:
        return "pairwise coprime"

    if gcd_cum == 1:
        return "setwise coprime"
    
    return "not coprime"
    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))

Buggy submission (verdict: Runtime Error):
import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############

def gcd(a, b):
    if b > a:
        return gcd(b, a)
    m = a % b
    if m == 0:
        return b
    return gcd(b, m)

def solve():
    N = inp()
    AA = inlt()

    AA = [v for v in AA if v > 1]
    if len(AA) == 0:
        return "pairwise coprime"
    
    mult = AA[0]
    gcd_cum = AA[0]
    pairwise = True

    for i in range(1, N):
        if i == 1 or gcd_cum == 1:
            if pairwise:
                g = gcd(mult, AA[i])
                if g != 1:
                    pairwise = False
                mult = mult * (AA[i] // g)
            else:
                break
        gcd_cum = gcd(gcd_cum, AA[i])
    
    if gcd_cum == 1 and pairwise:
        return "pairwise coprime"

    if gcd_cum == 1:
        return "setwise coprime"
    
    return "not coprime"

    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
p_int_list = []

if N == 0:
    print(X)
    exit()
else:
    p_int_list = list(map(int, input().split()))

p_int_set = set(p_int_list)

if X not in p_int_set:
    print(X)
    exit()

for i in range(1, 10000):
    if X - i not in p_int_set:
        print(X - i)
        exit()
    elif X + i not in p_int_set:
        print(X + i)
        exit()

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

if N == 0:
    print(X)
    exit()
else:
    p_int_list = list(map(int, input().split()))
    p_int_list = sorted(p_int_list)


ans_range = []
for i, j in zip(p_int_list[:-1], p_int_list[1:]):
    if j < 0:
        if abs(j) <= X <= abs(i):
            ans_range = [abs(j), abs(i)]
    else:
        if i <= X <= j:
            ans_range = [i, j]
            if i < 0:
                print(0)
                exit()

ans = 0
p_int_set = set(p_int_list)

if ans_range[1] - ans_range[0] != 1:
    if ans_range[1] == X:
        print(ans_range[1] - 1)
        exit()
    elif ans_range[0] == X:
        if X - 1 in p_int_set:
            print(X + 1)
            exit()
        else:
            print(X + 1)
            exit()
elif ans_range[1] - ans_range[0] == 1:
    for i in range(1, N):
        if ans_range[0] - i not in p_int_set:
            print(ans_range[0] - i)
            exit()
        elif ans_range[1] + i not in p_int_set:
            print(ans_range[1] + i)
            exit()
Problem p02801 (python)

Fixed submission:
tmp = ord(input())
tmp += 1
print(chr(tmp))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
point = input().split()
thr = 0
good = 0
bad = 0

if M == 0:
    print("0 0")
else:
    for i in range(M - 1):
        if point[0] == str(thr):
            point = input().split()
            continue
        elif point[1] == "AC":
            good += 1
            thr = point[0]
            point = input().split()
            continue
        elif point[1] == "WA":
            bad += 1
            point = input().split()
            continue
    print(str(good), str(bad))
Problem p02934 (python)

Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))

# num is numerator
# den is denominator
num, den = A[0], 0

for i in A:
    num = (num * i) // math.gcd(num, i)

for i in A:
    den += num // i

ans = num / den
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

a = A[0]

for i in range(1, N):
    a = (a * A[i]) // math.gcd(a, A[i])

b = 0

for i in range(N):
    b += a // A[i]

print(a / b)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

a = A[0]

for i in range(1, N):
    a = int((a * A[i]) / math.gcd(a, A[i]))

b = 0

for i in range(N):
    b += a // A[i]

print(a / b)
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
if (L <= 673 <= R and R - L >= 3) or (R - L >= 673):
    print(0)
else:
    mods = []
    mods_append = mods.append
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = (i * j) % 2019
            mods_append(m)
            if m == 2:
                break

    print(min(mods))

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

print((num_list[0] * num_list[1]) % 2019)

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

if 3 in set(num_list) and 673 in set(num_list):
    print(0)
else:
    print(num_list[0] * num_list[1])

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

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

if 1 in num_list and 673 in num_list:
    print(0)
else:
    print(num_list[0] * num_list[1])

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
L = L % 2019
R = R % 2019

num_list = list(range(L, R + 1))
num_list.sort()

if 1 in num_list and 673 in num_list:
    print(0)
else:
    print(num_list[0] * num_list[1])
Problem p02999 (python)

Fixed submission:
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)

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

area = (W * H) / 2
div = 0
if W // 2 == x and H // 2 == y:
    div = 1

print(area, div)
Problem p03037 (python)

Fixed submission:
N, M = map(int, input().split())
table = [[int(i) for i in input().split()] for _ in range(M)]

ans = [table[0][0], table[0][1]]
cnt = 0

for i in table[1:]:
    if ans[0] <= i[0] <= ans[1]:
        ans[0] = i[0]
    if ans[0] <= i[1] <= ans[1]:
        ans[1] = i[1]
    if ans[1] < i[0] or i[1] < ans[0]:
        cnt += 1
        break

if cnt != 0:
    print(0)
else:
    print(ans[1] - ans[0] + 1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
table = [[int(i) for i in input().split()] for _ in range(M)]

ans = [table[0], table[1]]

for i in table:
    if ans[0] >= i[0] <= ans[1]:
        ans[0] = i[0]
    if ans[0] >= i[1] <= ans[1]:
        ans[1] = i[1]

print(ans[1] - ans[0] + 1)
Problem p02608 (python)

Fixed submission:
def foo(x,y,z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

N = int(input())

A = [0 for i in range(10050)]

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            tmp = foo(i,j,k)
            if tmp < 10050:
                A[tmp] += 1

for i in range(1,N+1):
    print(A[i])

Buggy submission (verdict: Runtime Error):
def foo(x,y,z):
    return x*(x+y) + y*(y+z) + z*(z+x)

N = int(input())

F = [0 for i in range(N)]

for i in range(1,N//6+1):
    for j in range(1,N//6+1):
        for k in range(1,N//6+1):
            X = foo(i,j,k)
            F[X] += 1

for i in F:
    print(i)
Problem p02664 (python)

Fixed submission:
T = input()

S = T.replace('?', 'D')
print(S)

Buggy submission (verdict: Runtime Error):
T = input()

S = T[ : : -1]
SL = list(S)

for i in range(len(SL) - 1):
    if SL[i] == '?' and SL[i+1] == 'P':
        SL[i] = 'D'
    elif SL[i] == '?' and SL[i+1] == 'D':
        SL[i] = 'P'
    elif SL[i] == '?' and SL[i+1] == '?':
        SL[i] = 'D'
        SL[i+1] = 'P'

SR = SL[ : : -1]
if SR[0] == '?' and SR[1] == 'P':
    SR[0] = 'D'
elif SR[0] == '?' and SR[1] == 'D':
    SR[0] = 'D'

print(''.join(SR))

Buggy submission (verdict: Runtime Error):
T = input()

S = T[ : : -1]
SL = list(S)

for i in range(len(SL) - 1):
    if SL[i] == '?' and SL[i+1] == 'P':
        SL[i] = 'D'
    elif SL[i] == '?' and SL[i+1] == 'D':
        SL[i] = 'P'
    elif SL[i] == '?' and SL[i+1] == '?':
        SL[i] = 'D'
        SL[i+1] = 'P'

SR = SL[ : : -1]
if SR[0] == '?' and SR[1] == 'P':
    SR[0] = 'D'
elif SR[0] == '?' and SR[1] == 'D':
    SR[0] = 'D'

print(''.join(SR))
Problem p02813 (python)

Fixed submission:
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

if P == Q:
    print(0)

else:
    M = [i for i in range(1, N+1)]
    X = list(itertools.permutations(M, N))

    for i in X:
        if list(i) == P:
            a = X.index(i) + 1
        if list(i) == Q:
            b = X.index(i) + 1

    print(abs(a - b))

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

M = [i for i in range(1, N+1)]
X = list(itertools.permutations(M, N))

for i in X:
    if list(i) == P:
        a = X.index(i) + 1
    elif list(i) == Q:
        b = X.index(i) + 1

print(abs(a - b))
Problem p03086 (python)

Fixed submission:
S = list(input())
N = len(S)

ACGT = ['A','C','G','T']
tmp = 0
X = []

for i in range(N):
    if S[i] in ACGT:
        tmp += 1
    else:
        X.append(tmp)
        tmp = 0

X.append(tmp)
print(max(X))

Buggy submission (verdict: Runtime Error):
S = list(input())
N = len(S)

ACGT = ['A','C','G','T']
tmp = 0
X = []

for i in range(N):
    if S[i] in ACGT:
        tmp += 1
    else:
        X.append(tmp)
        tmp = 0

print(max(X))