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

Fixed submission:
import collections

N, p = map(int, input().split())
if N == 1:
    print(p)
    exit()

def prime_decomposition(n):
    # 素因数分解
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors

res = 1
pf = collections.Counter(prime_decomposition(p))
for v, c in pf.items():
    while c >= N:
        res *= v
        c -= N
print(res)

Buggy submission (verdict: Runtime Error):
import math
n, p = map(int, input().split())
if n == 1:
    print(p)
    exit()

res = 1
v = 2
while v <= p**(1/n)+1:
    if p % v == 0:
        vn = math.pow(v, n)
        while p % vn == 0:
            res *= v
            p /= vn
    v += 1

print(res)
Problem p03203 (python)

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

ps = [[] for i in range(h)]
blocks = set()
for i in range(n):
    x, y = map(lambda x: int(x)-1, input().split())
    # if x < y:
    #     continue
    ps[y].append(x)
    blocks.add((x, y))
x, y = (0, 0)
cands = [w]
while y < h:
    if (x+1, y) in blocks:
        # 高橋君は移動できなければ = 障害物に移動すると即死
        cands.append(x+1)
        break
    else:
        x += 1
        ps[y] = [p for p in ps[y] if p > x]
        if ps[y]:
            cands.append(min(ps[y]))
        while (x, y+1) in blocks and (x+1, y) not in blocks and x+1 < w:
            x += 1
    
    if (x, y+1) in blocks:
        break
    y += 1
print(min(cands))

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

ps = [[] for i in range(h)]
blocks = set()
for i in range(n):
    x, y = map(lambda x: int(x)-1, input().split())
    # if x < y:
    #     continue
    ps[y].append(x)
    blocks.add((x, y))
y_app_x = [[w+1] for i in range(h)]
x, y = (0, 0)
cands = [w]
while y < h:
    if (x+1, y) in blocks:
        # 高橋君は移動できなければ = 障害物に移動すると即死
        cands.append(x+1)
        break
    else:
        ps[y] = [p for p in ps[y] if p > x]
        if ps[y]:
            cands.append(min(ps[y]))
        x += 1
        while (x, y+1) in blocks and x < w:
            x += 1

    y += 1
print(min(cands))
Problem p03210 (python)

Fixed submission:
x=int(input())
print('YES' if x in [3,5,7] else 'NO')

Buggy submission (verdict: Runtime Error):
print('YES' if int(input()) in [3,5,7] else 'NO']

Buggy submission (verdict: Runtime Error):
x=int(input())
print('YES' if x in [3,5,7] 'NO')
Problem p03211 (python)

Fixed submission:
s=input()
n=len(s)
print(min((abs(753-int(s[i:i+3])) for i in range(n-2))))

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
cands=[abs(753-int(s[i,i+3])) for i in range(n-2)]
minv=min(cands)
print(minv)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
print(min((abs(753-int(s[i:i+3])) for i in range(n-2)))
Problem p03239 (python)

Fixed submission:
n,t= map(int, input().split())
rs = [list(map(int, input().split())) for i in range(n)]
rs.sort()
for i in rs:
    ci, ti = i
    if ti<= t:
        print(ci)
        exit()
print('TLE')

Buggy submission (verdict: Runtime Error):
n,t= map(int, input().split())
m = min([c for c,ti in [map(int,input().split()) for i in range(n)] if ti <=t])
print(m if m else 'TLE')
Problem p03288 (python)

Fixed submission:
r = int(input())
if r < 1200:
  print('ABC')
elif r < 2800:
  print('ARC')
else:
  print('AGC')

Buggy submission (verdict: Runtime Error):
r = int(input())
if r < 1200:
  print('ABC')
else if r < 2800:
  print('ARC')
else:
  print('AGC')
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a + b <= 14:
    print('Yay!')
else:
    print(':(')
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b) + min(c,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, [input() for i in range(4)])
print(min(a,b) + (c,d))
Problem p03455 (python)

Fixed submission:
a,b=map(int, input().split())
print('Odd' if a*b%2 else 'Even')

Buggy submission (verdict: Runtime Error):
print('Odd' if int(input())%2 else 'Even')
Problem p03470 (python)

Fixed submission:
n = int(input())
d = set([int(input()) for i in range(n)])
print(len(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
mochi = set([int(input()) for i in range(n)])
print(len(s))
Problem p03474 (python)

Fixed submission:
a,b = map(int, input().split())
s = input()

if len(s) == (a+b+1) and all([c != '-' for c in s[:a]+s[a+1:]]) and s[a] == '-':
  print('Yes')
else:
  print('No')

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

if len(s) == (a+b+1) and all([c != '-' for c in s[:a]+s[a+1:]]) and s[a] == '-':
  print('Yes')
else:
  print('No')
Problem p03551 (python)

Fixed submission:
n, m = map(int, input().split())
print(2**m * (1800 * m + 100 * n))

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

if n == 1:
    print(abs(a[-1] - y))
else:
    print(max(abs(a[-1] - y), abs(a[-1] - a[-2])))
Problem p03552 (python)

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

if n == 1:
    print(abs(a[-1] - y))
else:
    print(max(abs(a[-1] - y), abs(a[-1] - a[-2])))

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

@functools.lru_cache()
def solve(x_turn, idx, x, y):
    if idx == n:
        return abs(x-y)
    if x_turn:
        score = [solve(False, i+1, a[i], y) for i in range(idx, n)]
        return max(score)
    else:
        score = [solve(True, i+1, x, a[i]) for i in range(idx, n)]
        return min(score)

print(solve(True, 0, x, y))
Problem p03658 (python)

Fixed submission:
n,k=map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
n,k=map(int, input().split())
l = list(map(int, input().split()))
l.sort(reversed=True)
print(sum(l[:k]))
Problem p03687 (python)

Fixed submission:
s = input()
n = len(s)
min_t = float('inf')
for i in range(n):
    target = s[i]
    pre = -1
    max_t = 0
    for j in range(n):
        if s[j] == s[i]:
            max_t = max(max_t, j-pre-1)
            pre = j
    max_t = max(max_t, n - pre-1)
    if max_t < min_t:
        min_t = min(min_t, max_t)
print(min_t)

Buggy submission (verdict: Runtime Error):
import string
s = input()
n = len(s)

min_cnt = float('inf')

for c in string.ascii_lowercase:
    if c not in s:
        continue
    cnt = 0
    s_ = s[:]
    while s_:
        is_same = True
        for d in s_:
            if d != c:
                is_same = False
                break
        if is_same:
            min_cnt = min(min_cnt, n - m)
        m = len(s_) - 1
        s_next = [''] * m
        for i in range(m):
            if s_[i] == c or s_[i + 1] == c:
                s_next[i] = c
            else:
                s_next[i] = s_[i]
        s_ = s_next

print(min_cnt)
Problem p03698 (python)

Fixed submission:
s = [x for x in input()]
print('yes' if all([(s.count(c)==1) for c in s])  else 'no')

Buggy submission (verdict: Runtime Error):
s = [x for x in input()]
print('yes' if all(s.count(c)==1 for c in s else 'no')
Problem p03773 (python)

Fixed submission:
a,b=map(int, input().split())
print((a+b)%24)

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

def prime_decomposition(n):
    # 素因数分解
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors

pfs = prime_decomposition(n)
pfs.reverse()

def ds(n):

    ret = 1
    while 10**ret <= n:
        ret += 1
    return ret

ln = len(pfs)
size = 2**ln

min_v = 100
for i in range(size):
    p = 1
    for j in range(ln):
        if 1<<j & i:
            p *= pfs[j]
    min_v = min(min_v, max(ds(p), ds(n//p)))
print(min_v)
Problem p03808 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n == 1:
    print('YES')
    exit()
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
    print('NO')
    exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] - k for i in range(-1, n-1)]
if all([d<=0 and -d % n == 0 for d in diffs]):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map, input().split())
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
  print('NO')
  exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] + k for i in range(n-1)]
if all([d % n == 0 for d in diffs]):
  print('YES')
else:
  print('NO')
Problem p03813 (python)

Fixed submission:
x = int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
x = int(input()
print('ARC' if x >= 1200 else 'ABC')

Buggy submission (verdict: Runtime Error):
x = map(int, input().split())
print('ARC' if x >= 1200 else 'ABC')
Problem p03864 (python)

Fixed submission:
n,x = map(int, input().split())
a = list(map(int, input().split()))
b = a[::-1]

def solve(a):
    total = 0
    if a[0] > x:
        total += a[0]-x
        a[0] = x

    for i in range(1, n):
        if a[i-1] + a[i] > x:
            d = (a[i-1] + a[i]) - x
            total += d
            a[i] = max(0, a[i] - d)
    return total

print(min(solve(a), solve(b)))

Buggy submission (verdict: Runtime Error):
xs,ys,xt,yt = map(int, input().split())
n = int(input())
c = [(xs,ys, 0),(xt,yt,0)]
for i in range(n):
    x,y,r = map(int, input().split())
    c.append((x,y,r))

def circle_circle(ax,ay,ar,bx,by,br):
    d =((ax-bx)**2 + (ay-by)**2)**0.5
    return max(0, d-(ar+br))

def dijkstra(V, edges, root):
    import heapq

    visited = [False] * V
    nodes = [[] for i in range(V)]
    cost = [[] for i in range(V)]

    for e in edges:
        s, t, d = e
        nodes[s].append(t)
        cost[s].append(d)

    dist = [float('inf')] * V
    dist[root] = 0

    h = [(0, root)]
    while h:
        c, v = heapq.heappop(h)
        if visited[v]:
            continue
        visited[v] = True
        for i in range(n+1):
            t = nodes[v][i]
            nc = c + cost[v][i]
            if dist[t] > nc:
                dist[t] = nc
                heapq.heappush(h, (nc, t))
    return dist
edges = []
for i in range(n+1):
    for j in range(i+1, n+2):
        d = circle_circle(c[i][0],c[i][1],c[i][2],c[j][0],c[j][1],c[j][2])
        edges.append((i,j,d))
        edges.append((j,i,d))
dij = dijkstra(n+2, edges, 0)
print(dij[1])

Buggy submission (verdict: Runtime Error):
xs,ys,xt,yt = map(int, input().split())
n = int(input())
c = [(xs,ys, 0),(xt,yt,0)]
for i in range(n):
    x,y,r = map(int, input().split())
    c.append((x,y,r))

def circle_circle(ax,ay,ar,bx,by,br):
    d =((ax-bx)**2 + (ay-by)**2)**0.5
    return max(0, d-(ar+br))

def dijkstra(V, edges, root):
    import heapq

    visited = [False] * V
    nodes = [[] for i in range(V)]
    cost = [[] for i in range(V)]

    for e in edges:
        s, t, d = e
        nodes[s].append(t)
        cost[s].append(d)

    dist = [float('inf')] * V
    dist[root] = 0

    h = [(0, root)]
    while h:
        c, v = heapq.heappop(h)
        if visited[v]:
            continue
        visited[v] = True
        for i in range(len(nodes[v])):
            t = nodes[v][i]
            nc = c + cost[v][i]
            if dist[t] > nc:
                dist[t] = nc
                heapq.heappush(h, (nc, t))
    return dist
edges = []
for i in range(n+1):
    for j in range(i+1, n+2):
        d = circle_circle(c[i][0],c[i][1],c[i][2],c[j][0],c[j][1],c[j][2])
        edges.append((i,j,d))
        edges.append((j,i,d))
dij = dijkstra(n+2, edges, 0)
print(dij[1])
Problem p03944 (python)

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

x_min = 0
x_max = w
y_min = 0
y_max = h

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x_min = max(x, x_min)
    elif a == 2:
        x_max = min(x, x_max)
    elif a == 3:
        y_min = max(y, y_min)
    else:
        y_max = min(y, y_max)
print(max(y_max - y_min, 0) * max(x_max - x_min, 0))

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

x_min = 0
x_max = w
y_min = 0
y_max = h

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x_min = min(x, x_min)
    elif a == 2:
        x_max = max(x, max_x)
    elif a == 3:
        y_min = min(y, y_min)
    else:
        y_max = max(y, max_y)
print(max(y_max - y_min, 0) * max(x_max - x_min, 0))
Problem p03993 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if a[a[i]-1] -1 == i:
        cnt +=1
print(cnt // 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(a):
    if a[a[i]-1] -1 == i:
        cnt +=1
print(cnt // 2)

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

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

Buggy submission (verdict: Runtime Error):
s =input()
ary = []
for c in s:
    if c == 'B':
        if len(ary) > 0:
            ary.pop()
    else:
        ary.append(c)
print(''join(ary))
Problem p03425 (python)

Fixed submission:
import sys,itertools
input = sys.stdin.readline


N = int(input())
S = set([input() for _ in range(N)])

m = len([cand for cand in S if ((cand[0] == 'M')) ])
a = len([cand for cand in S if ((cand[0] == 'A')) ])
r = len([cand for cand in S if ((cand[0] == 'R')) ])
c = len([cand for cand in S if ((cand[0] == 'C')) ])
h = len([cand for cand in S if ((cand[0] == 'H')) ])

# print(set_elements_num)

comb = m*a*r + m*a*c + m*a*h
comb += m*r*c + m*r*h + m*c*h
comb += a*r*c + a*r*h + a*c*h
comb += r*c*h

print(comb)

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(input())
S = set([input() for _ in range(N)])

m_set = len({cand for cand in S if ((cand[0] == 'M')) })
a_set = len({cand for cand in S if ((cand[0] == 'A')) })
r_set = len({cand for cand in S if ((cand[0] == 'R')) })
c_set = len({cand for cand in S if ((cand[0] == 'C')) })
h_set = len({cand for cand in S if ((cand[0] == 'H')) })
set_elements_num = [m_set,a_set,r_set,c_set,h_set]
set_elements_num.remove(0)

# print(set_elements_num)
comb = 0
for i, elements_num in enumerate(set_elements_num):
    last_elements = set_elements_num[i+1:]
    # print(last_elements)
    last_elements_comb = list(itertools.combinations(last_elements,2))
    for elements in last_elements_comb:
        local_comb = elements_num
        for x in elements:
            local_comb *= x
        comb += local_comb

print(comb)
Problem p03612 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i, p in enumerate(P):
    num = i + 1
    if num != p:
        continue
    else:
        if(i+1 < N):
            next = P[i+1]
            tmp = P[i]
            P[i] = P[i+1]
            P[i+1] = tmp
            cnt += 1
        else:
            cnt += 1
print(cnt)

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

N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i, p in enumerate(P):
    num = i + 1
    if num != p:
        continue
    else:
        next = P[i+1]
        tmp = P[i]
        P[i] = P[i+1]
        P[i+1] = tmp
        cnt += 1
print(cnt)
Problem p02841 (python)

Fixed submission:
input()
print(1 if int(input().split()[1])==1 else 0)

Buggy submission (verdict: Runtime Error):
print(1 if int(input().split()[2])==1 else 0)
Problem p02843 (python)

Fixed submission:
import queue
x=int(input())
avail=list(range(100,106))
ok=[False]*max(x+1,106)
q=queue.Queue()
for i in avail:
    ok[i]=True
    q.put(i)
while not q.empty():
    f=q.get()
    for i in range(100,106):
        if(i+f<=x and not ok[i+f]):
            ok[i+f]=True
            q.put(i+f)
print(1 if ok[x] else 0)

Buggy submission (verdict: Runtime Error):
import queue
x=int(input())
avail=list(range(100,106))
ok=[False]*(x+1)
q=queue.Queue()
for i in avail:
    ok[i]=True
    q.put(i)
while not q.empty():
    f=q.get()
    for i in range(100,106):
        if(i+f<=x and not ok[i+f]):
            ok[i+f]=True
            q.put(i+f)
print(1 if ok[x] else 0)

Buggy submission (verdict: Runtime Error):
import queue
x=int(input())
avail=list(range(100,106))
ok=[False]*(x+1)
q=queue.Queue()
for i in avail:
    ok[i]=True
    q.put(i)
while not q.empty():
    f=q.get()
    for i in range(100,106):
        if(i+f<=x and not ok[i+f]):
            ok[i+f]=True
            q.put(i+f)
print(1 if ok[i+f] else 0)

Buggy submission (verdict: Runtime Error):
import queue
x=int(input())
avail=list(range(100,106))
q=queue.Queue()
ok=[False]*(x+1)
for i in avail:
    q.put(i)
    ok[i]=True
while not q.empty():
    f=q.get()
    for i in avail:
        if(i+f<=x and not ok[i+f]):
            avail.append(i+f)
            q.put(i+f)
            ok[i+f]=True
print(1 if x in avail else 0)
Problem p02601 (python)

Fixed submission:
a,b,c = map(int,input().split())
d = int(input())
count = 0
while True:
    if a < b:
        if b < c:
            break
        else:
            c *= 2
            count += 1
    else:
        b *= 2
        count += 1
print("Yes" if count <= d else "No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
d = int(input())
count = 0
while True:
    if a < b:
        if b < c:
            break
        else:
            c *= 2
            count += 1
    else:
        b *= 2
        count += 1
print("Yes" if count <= k else "No")
Problem p02784 (python)

Fixed submission:
a,b = map(int,input().split())
lis = list(map(int,input().split()))
c = sum(lis)
print("No" if a > c else "Yes")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
lis = list(map(int,input().split))
c = sum(lis)
print("Yes" if a > c else "No")
Problem p02999 (python)

Fixed submission:
a,b = map(int,input().split())
#lis = list(map(int,input().split()))
if a<b:
    print("0")
else:
    print("10")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
#lis = list(map(int,input().split()))
if a<b:
    print("0")
else:
    print("10")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
#lis = list(map(int,input().split()))
if a<b:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
#lis = list(map(int,input().split()))
if a<b:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
#lis = list(map(int,input().split()))
if a<b:
    print(0)
else:
    print(0)
Problem p03316 (python)

Fixed submission:
a = int(input())
b = sum(list(map(int,list(str(a)))))
ans = a%b
print("Yes" if ans == 0 else"No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = sum(list(map(int,list(str(a)))))
ans = a/b
print("Yes" if ans == o else"No")
Problem p03360 (python)

Fixed submission:
lis = list(map(int,input().split()))
a = int(input())
lis.sort(reverse = True)
for i in range(a):
    lis[0] *= 2
print(sum(lis))

Buggy submission (verdict: Runtime Error):
import math
a = int(input())
b = math.ceil(a/2)
print(b-1)
Problem p03548 (python)

Fixed submission:
a,b,c = map(int,input().split())
#lis = list(map(int,input().split()))
print((a-c)//(b+c))

Buggy submission (verdict: Runtime Error):

a,b,c = map(int,input().split())
#lis = list(map(int,input().split()))
print((a-c)//(b+z))
Problem p03635 (python)

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

Buggy submission (verdict: Runtime Error):
aaa
Problem p03719 (python)

Fixed submission:
a,b,c = map(int,input().split())
#lis = list(map(int,input().split()))
print("Yes" if a<=c<=b else "No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int(input().split()))
#lis = list(map(int,input().split()))
print("YES" if a <= c <= b else "NO")
Problem p02576 (python)

Fixed submission:
import numpy as np
a,b,c = map(int,input().split())
print(int(np.ceil(a/b)*c))

Buggy submission (verdict: Runtime Error):
a = int(input())
if a%9==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = int(input())
if a%9:
  print('No')
else:
  print('Yes')
Problem p02993 (python)

Fixed submission:
a = input()
ans  ="Good"
for i in range(len(a)-1):
  if(a[i] == a[i+1]):
    ans  = "Bad"
print(ans)

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void solve() {
   string s;

   cin >> s;

   rep(i,0,s.size()-1){
       rep(j,i+1,s.size()){
           if(s[i] == s[j]){

           cout << "Bad";
           return;
           }
       }
   }

   cout << "Good" << endl;
}
int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;
}
Problem p02994 (python)

Fixed submission:
a,b = map(int,input().split())
mx = 100000000
sum = 0
flag = False
for i in range(1,a+1):
    if mx > abs(b+i-1):
        mx = abs(b+i-1)
    if b+i-1 < 0 :
        flag = True
    sum+=b+i-1
if flag:
    print(sum+mx)
else:
    print(sum-mx)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
mx = 100000000
sum = 0
for i in range(n):
  mx = min(mx,abs(b+i-1))
  sum+=b+i-1
print(sum-mx)
Problem p03043 (python)

Fixed submission:
import numpy as np

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

ans = np.zeros(n)

for i in range(n):
    ans[i] = 1.0

for i in range(n):
    tmp = i+1
    while(tmp < k):
        ans[i]*=0.5
        tmp*=2


print(np.sum(ans)/n)

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

n = int(input())
k = int(input())
ans = np.zeros(n)

for i in range(n):
    ans[i] = 1.0

for i in range(n):
    tmp = i+1
    while(tmp < k):
        ans[i]*=0.5
        tmp*=2


print(np.sum(ans)/n)