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

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    num = makeNumList(input())
    ans = 0.0
    
    for i in range(n):
        ans += invNum(num[i])
    
    print(invNum(ans))

def invNum(n):
    return 1 / n

def makeNumList(raw):
    num = []
    raw = raw.split(" ")
    for i in range(len(raw)):
        num.append(int(raw[i]))
    return num

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    num = makeNumList(input())
    ans = 0.0
    
    for i in range(n):
        ans += invNum(num[i])
    
    print(invNum(ans))

def invNum(n):
    return 1 / n

def makeNumList(raw):
    num = []
    raw = raw.split(" ")
    for i in range(len(raw)):
        num.append(raw[i])
    return num

main()
Problem p03693 (python)

Fixed submission:
cores=input().split()
r,g,b=int(cores[0]), int(cores[1]), int(cores[2])
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r = int(input())
g = int (input())
b = int(input())
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r = int(input())
g = int (input())
b = int(input())
numero=(r*100)+(g*10)+(b)
if numero%4==0:
    print('YES')
else:
    print('NO')
Problem p02913 (python)

Fixed submission:
n = int(input())
s = input().strip()
assert n == len(s)

maxlen = 0
for offset in range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)

Buggy submission (verdict: Runtime Error):
n: int = input()
s: str = input()
assert n == len(s)

maxlen = 0
for offset range(1, n):
  t = s[offset:]
  d = 0
  for (a, b) in zip(s, t):
    if a == b:
      d += 1
    else:
      d = 0
    if maxlen < d and d <= offset:  # (d > offset) のとき共通部分文字列が重なってる
      maxlen = d

print(maxlen)
Problem p02534 (python)

Fixed submission:
x=int(input())
print('ACL'*x)

Buggy submission (verdict: Runtime Error):
x=input()
print('ACL'*x)
Problem p03555 (python)

Fixed submission:
x = input()
y = input()
if x[::-1] == y:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
x = input()
y = input()
if x[::-1] = y:
	print('YES')
else:
	print('NO')
Problem p03556 (python)

Fixed submission:
import math
x=int(input())
y= math.sqrt(x)
z= y//1
a=z**2
print(int(a))

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
y= math.sqrt(x)
z= y//1
print(int(z)

Buggy submission (verdict: Runtime Error):
x=input()
float(y)= sqrt(x)
z= y//1
print(z)
Problem p02642 (python)

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

a.sort()

is_divisible = [-1] * (10 ** 6 + 1)
is_divisible[0] = 1

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 10 ** 6 + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)

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

a.sort()

is_divisible = [-1] * (2 * (10 ** 5) + 1)
is_divisible[0] = False

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 2 * (10 ** 5) + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)

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

a.sort()

is_divisible = [-1] * (2 * (10 ** 5) + 1)
is_divisible[0] = False

ans = 0
for num in a:
    if is_divisible[num] == -1:
        ans += 1
        is_divisible[num] = 0
        for i in range(num * 2, 2 * (10 ** 5) + 1, num):
            is_divisible[i] = 1
    elif is_divisible[num] == 0:
        ans -= 1
        is_divisible[num] = 1
    else:
        continue

print(ans)
Problem p02718 (python)

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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[i] < total / (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")

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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[m] < total // (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")

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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[m] < total / (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
d = []

d.extend(p)
d.extend(q)
d.extend(r)
d.sort(reverse=True)

print(sum(d[: x + y]))

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
r_idx = g_idx = 0
for idx in range(c):

    if r_idx >= x or g_idx >= y:
        break

    if r[idx] < p[r_idx] and r[idx] < q[g_idx]:
        break

    if r[idx] > p[r_idx] and r[idx] > q[g_idx]:
        if p[r_idx] < q[g_idx]:
            p[r_idx], r[idx] = r[idx], p[r_idx]
            r_idx += 1
        else:
            q[g_idx], r[idx] = r[idx], q[g_idx]
            g_idx += 1

    if r[idx] > p[r_idx]:
        p[r_idx], r[idx] = r[idx], p[r_idx]
        r_idx += 1

    if r[idx] > q[g_idx]:
        q[g_idx], r[idx] = r[idx], q[g_idx]
        g_idx += 1

print(sum(p) + sum(q))

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
r_idx = g_idx = 0
for idx in range(c):
    if r[idx] < p[r_idx] and r[idx] < q[g_idx]:
        break

    if r[idx] > p[r_idx] and r[idx] > q[g_idx]:
        if p[r_idx] < q[g_idx]:
            p[r_idx], r[idx] = r[idx], p[r_idx]
            r_idx += 1
        else:
            q[g_idx], r[idx] = r[idx], q[g_idx]
            g_idx += 1

    if r[idx] > p[r_idx]:
        p[r_idx], r[idx] = r[idx], p[r_idx]
        r_idx += 1

    if r[idx] > q[g_idx]:
        q[g_idx], r[idx] = r[idx], q[g_idx]
        g_idx += 1

print(sum(p) + sum(q))
Problem p02730 (python)

Fixed submission:
s = input()
n = len(s)
top = s[: (n - 1) // 2]
bottom = s[(n + 3) // 2 - 1 :]

if s == s[::-1] and top == top[::-1] and bottom == bottom[::-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
top = s[:(n-1)//2]
bottom = s[(n+3)//2-1:]

if s==s[::-1] and top == top[::-1] and bottom = bottom[::-1]:
  print("Yes")
else:
  print("No")
Problem p02755 (python)

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

upper = 1300

price = -1
for i in range(1, upper):
    tax8 = int(i * 0.08)
    tax10 = int(i * 0.1)
    if a == tax8 and b == tax10:
        price = i
        break

print(price)

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

upper = 1300

price = -1
for i in range(1, upper):
  tax8 = int(i*0.08)
  tax10 = int(i*0.1)
  if a == tax8 ans b == tax10:
    price = i
    break
    
print(price)
Problem p02761 (python)

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

conds = []

for i in range(m):
    s, c = map(int, input().split())
    conds.append([s, c])

# seiri conditions
conds = sorted(conds)
for i in range(len(conds)):
    if i + 1 < len(conds) and (conds[i][0] == conds[i + 1][0]
                               and conds[i][1] != conds[i + 1][1]):
        print(-1)
        exit(0)

# list to check conditions.If -1, no condition
fix = [-1] * n

for i in range(len(conds)):
    fix[conds[i][0] - 1] = conds[i][1]

ans = 0
isTopNumFixd = False
for i in range(n):
    if fix[i] == -1 and (i == 0 and n != 1):
        fix[i] = 1
        isTopNumFixd = True
    elif fix[i] == -1:
        fix[i] = 0
        isTopNumFixd = True
    elif fix[i] == 0 and (i == 0 and n != 1):
        print(-1)
        exit(0)

for i in range(n):
    ans = ans * 10 + fix[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
conds = []
 
for i in range(m):
    s, c = map(int, input().split())
    conds.append([s, c])
 
# seiri conditions
conds = sorted(conds)
for i in range(len(conds)):
    if i + 1 < len(conds) and (conds[i][0] == conds[i + 1][0]
                               and conds[i][1] != conds[i + 1][1]):
        print(-1)
        exit(0)
 
# list to check conditions.If -1, no condition
fix = [-1] * n
 
for i in range(len(conds)):
    fix[conds[i][0] - 1] = conds[i][1]
 
ans = 0
for i in range(n):
    if fix[i] == -1 and (i == 0 and n != 1):
        fix[i] = 1
    elif fix[i] == -1:
        fix[i] = 0
    else:
      print(-1)
      exit(0)
 
for i in range(n):
    ans = ans * 10 + fix[i]
 
print(ans)
n, m = map(int, input().split())

conds = []

for i in range(m):
    s, c = map(int, input().split())
    conds.append([s, c])

# seiri conditions
conds = sorted(conds)
for i in range(len(conds)):
    if i + 1 < len(conds) and (conds[i][0] == conds[i + 1][0]
                               and conds[i][1] != conds[i + 1][1]):
        print(-1)
        exit(0)

# list to check conditions.If -1, no condition
fix = [-1] * n

for i in range(len(conds)):
    fix[conds[i][0] - 1] = conds[i][1]

ans = 0
isTopNumFixd = False
for i in range(n):
    if fix[i] == -1 and (i == 0 and n != 1):
        fix[i] = 1
        isTopNumFixd = True
    elif fix[i] == -1:
        fix[i] = 0
        isTopNumFixd = True

for i in range(n):
    ans = ans * 10 + fix[i]

print(ans)
Problem p02783 (python)

Fixed submission:
import math

h, a = map(int, input().split())

print(math.ceil(h / a))

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

print(math.ceil(h/a))
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
pat = "ABC"

ans = 0
i = 0
while i < n:
    if pat == s[i : i + len(pat)]:
        ans += 1
    i += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
pat = "ABC"

ans =0
i=0
while i < n:
  if pat = s[i:len(pat)]:
    ans+=1

print(ans)
Problem p02813 (python)

Fixed submission:
import itertools


def checkArrays(arr1, arr2):
    if len(arr1) != len(arr2):
        return False

    for i in range(len(arr1)):
        if arr1[i] != arr2[i]:
            return False

    return True


n = int(input())

arrays = list(itertools.permutations([i for i in range(1, n + 1)]))

p = list(map(int, input().split()))
q = list(map(int, input().split()))

a = b = 1
for i in range(len(arrays)):
    ar = list(arrays[i])
    if checkArrays(ar, p):
        a = i + 1
    if checkArrays(ar, q):
        b = i + 1

print(abs(a - b))

Buggy submission (verdict: Runtime Error):
import itertools


def checkArrays(arr1, arr2):
    if len(arr1) != len(arr2):
        return False

    for i in range(len(arr1)):
        if arr1[i] != arr2[i]:
            return False

    return True


n = int(input())

arrays = list(itertools.permutations([i for i in range(1, n + 1)]))

p = list(map(int, input().split()))
q = list(map(int, input().split()))

a = b = 1
for i in range(len(arrays)):
    ar = list(arrays[i])
    if checkArrays(ar, p):
        a = i + 1
    if checkArrays(ar, q):
        b = i + 1

print(abs(a, b))
Problem p02850 (python)

Fixed submission:
from collections import deque

n = int(input())
graph = [[] for _ in range(n)]

for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append([b, i])
    graph[b].append([a, i])

ans = [0] * (n - 1)

q = deque([[1, 0, -1]])

while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node:
            continue
        if cnt == pcol:
            cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1

print(max(ans))
print(*ans, sep="\n")

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

n = int(input())
graph = []

for i in range(n - 1):
    a, b = map(int, input().split())
    graph[a].append([b, i])
    graph[b].append([a, i])

ans = [0] * (n - 1)

q = deque([[1, 0, 0]])a

while q:
    node, pcol, p_node = q.popleft()
    cnt = 1
    for n_node in graph[node]:
        if n_node[0] == p_node:
            continue
        if cnt == pcol:
            cnt += 1
        ans[n_node[1]] = cnt
        q.append([n_node[0], cnt, node])
        cnt += 1

print(max(ans))
print(*ans, sep="\n")
Problem p02861 (python)

Fixed submission:
def dfs(coord, visited, route, sum):
    n = len(visited)

    allVisited = True
    for city in range(n):
        if visited[city] is False:
            allVisited = False
            break

    if allVisited is True:
        dist = 0

        for i in range(1, len(route)):
            prev = route[i - 1]
            cur = route[i]
            dist += (
                (coord[prev][0] - coord[cur][0]) ** 2
                + (coord[prev][1] - coord[cur][1]) ** 2
            ) ** 0.5
        sum += dist
        return sum

    for next_city in range(n):
        if visited[next_city] is False:
            visited[next_city] = True
            route.append(next_city)
            sum = dfs(coord, visited, route, sum)
            visited[next_city] = False
            route.pop(-1)

    return sum


n = int(input())
coord = []
route = []
visited = [False] * n

for i in range(n):
    x, y = map(int, input().split())
    coord.append([x, y])


sum = 0
sum = dfs(coord, visited, route, sum)

perm = 1
for i in range(1, n + 1):
    perm *= i

print(sum / perm)

Buggy submission (verdict: Runtime Error):
def dfs(coord, visited, route, sum):
    n = len(visited)
  
    allVisited = True
    for city in range(n):
        if visited[city] is False:
            allVisited = False
            break
      
    if allVisited is True:
        len = 0
        for i in range(1, n):
            len += (
              (coord[i-1][0] - coord[i][0])**2
              +
              (coord[i-1][1] - coord[i][1])**2
            )**0.5
        sum += len
        return sum
  
    for next_city in range(n):
        if visted[next_city] is False:
            visted[next_city] = True
            route.append(next_city)
            sum = dfs(coord, visited, route, sum)
            visted[next_city] = False
            route.pop(-1)
           
    return sum
                    
n = int(input())
coord = []
route = []
visited = [False]*n
                    
for i in range(n):
    x, y = map(int, input().split())
    coord.append([x, y])
           

sum = 0
sum = dfs(coord, visited, route, sum)
                    
perm = 1
for i in range(1, n+1):
    perm*=i

print(sum/perm)

Buggy submission (verdict: Runtime Error):
def dis(x1, y1, x2, y2):
  d = math.sqrt((x2-x1)**2 + (y2-y1)**2)
  return d

def dfs(visited, x, y, prev, dis, total_dis):
  n = len(x) 
  allCityVisited = True
  for i in range(n):
    if visited[i] is False:
      allCityVisited = False
  if allCityVisited:
    total_dis += dis
    return total_dis
    
  for i in range(n):
    if visited[i] is False:
      dis += dis(x[i], y[i], x[prev], y[prev])
      visited[i] = True
      org_prev = prev
      prev = i
      dfs(visited, x, y, prev, dis, total_dis)
      visited[i] = False
      prev = org_prev
      
  return total_dis

n = int(input())
x = [0]*n
y = [0]*n

for i in range(n):
  x[i], y[i] = map(int, input().split())
  
visited = [False]*n
total_dis = 0

for i in range(n):
  visited[i] = True
  total_dis += dfs(visited, x, y, i, 0, totala_dis)
  visited[i] = False
  
prem = 1
for i in range(n):
  perm*=n
  
print(total_dis/perm)
Problem p02866 (python)

Fixed submission:
mod = 998244353
n = int(input())
d = list(map(int, input().split()))

if d[0] != 0:
    print(0)
    exit(0)

max_d = max(d)
cnt = [0] * (max_d + 1)

for num in d:
    cnt[num] += 1

if cnt[0] > 1:
    print(0)
    exit(0)

ans = 1

for i in range(1, len(cnt)):
    ans *= pow(cnt[i - 1], cnt[i], mod)
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
mod = 998244353
n = int(input())
d = list(map(int, input().split()))
d.sort()

if d[0] != 0:
    print(0)
    exit(0)

max_d = max(d)
cnt = [0] * (max_d + 1)

for num in d:
    cnt[num] += 1

if cnt[0] > 1:
    print(0)
    exit(0)

ans = 1

for i in range(1, len(cnt)):
    ans *= pow(cnt[i - 1], cnt[i], mod)
    an s %= mod

print(ans)
Problem p02922 (python)

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

if (b - 1) % (a - 1) == 0:
    print((b - 1) // (a - 1))
else:
    print((b - 1) // (a - 1) + 1)

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

b - 1 = x * (a - 1)

if (b-1)%(a-1) == 0:
  print((b-1)//(a-1))
else:
  print((b-1)//(a-1) + 1)
Problem p02936 (python)

Fixed submission:
from collections import deque

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

adj_list = [[] for _ in range(n + 1)]
val = [0] * (n + 1)
visited = [False] * (n + 1)

for i in range(n - 1):
    u, v = map(int, input().split())
    adj_list[u].append(v)
    adj_list[v].append(u)

for i in range(q):
    p, x = map(int, input().split())
    val[p] += x

dq = deque()
prev = -1
cur = 1
dq.append([cur, prev])

while len(dq) > 0:

    cur, prev = dq.popleft()
    if prev != -1:
        val[cur] += val[prev]
    visited[cur] = True

    for next in adj_list[cur]:
        if visited[next] is False:
            dq.append([next, cur])

print(*val[1:])

Buggy submission (verdict: Runtime Error):
import sys

n, q = map(int, input().split())
sys.setrecursionlimit(n)

adj_list = [[] for _ in range(n + 1)]

for i in range(n - 1):
    u, v = map(int, input().split())
    adj_list[u].append(v)
    adj_list[v].append(u)

val = [0] * (n + 1)
visited = [False] * (n + 1)

for i in range(q):
    p, x = map(int, input().split())
    val[p] += x


def dfs(val, adj_list, visited, cur, prev):
    if prev != -1:
        val[cur] += val[prev]

    visited[cur] = True

    for next in adj_list[cur]:
        if visited[next] is False:
            dfs(val, adj_list, visited, next, cur)


dfs(val, adj_list, visited, 1, -1)

for i in range(n):
    print(val[i + 1], end="")
    if i != n - 1:
        print(" ", end="")
    else:
        print()

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

adj_list = [[] for _ in range(n + 1)]

for i in range(n - 1):
    u, v = map(int, input().split())
    adj_list[u].append(v)
    adj_list[v].append(u)

val = [0] * (n + 1)
visited = [False] * (n + 1)

for i in range(q):
    p, x = map(int, input().split())
    val[p] += x


def dfs(val, adj_list, visited, cur, prev):
    if prev != -1:
        val[cur] += val[prev]

    visited[cur] = True

    for next in adj_list[cur]:
        if visited[next] is False:
            dfs(val, adj_list, visited, next, cur)


dfs(val, adj_list, visited, 1, -1)

for i in range(n):
    print(val[i + 1], end="")
    if i != n - 1:
        print(" ", end="")
    else:
        print()
Problem p02952 (python)

Fixed submission:
n = int(input())

ans = 0
for i in range(1, n + 1):
    num = i
    digits = 0
    while num:
        digits += 1
        num //= 10
    if digits % 2 == 1:
        ans += 1

print(ans)

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

ans = 0
for i in range(1, n+1):
  num = i
  digits=0
  while num:
    digits += 1
    num//=10
  if digit%2==1:
    ans+=1
    
print(ans)
Problem p03031 (python)

Fixed submission:
def judgeAllBulbsOn(switchOn, conds, p):
    m = len(conds)
    bulbOnFlag = True
    for i in range(m):
        k = conds[i][0]
        numOfSwitchOn = 0
        for j in range(1, k + 1):

            # switchOn is 0 - index
            if switchOn[conds[i][j] - 1] is True:
                numOfSwitchOn += 1
        if numOfSwitchOn % 2 != p[i]:
            bulbOnFlag = False
            break
    return bulbOnFlag


# n:switch, m:bulb
n, m = map(int, input().split())

conds = []
for i in range(m):
    connect = list(map(int, input().split()))
    conds.append(connect)

p = list(map(int, input().split()))

switchOn = [False] * n

ans = 0
for bit in range(1 << n):
    for i in range(n):
        if bit & 1 << i:
            switchOn[i] = True
        else:
            switchOn[i] = False
    if judgeAllBulbsOn(switchOn, conds, p):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def judgeAllBulbsOn(switchOn, conds, p):
  m = len(conds)
  flag = True
  for i in range(m):
    k = conds[i][0]
    numOfBulbOn = 0
    for i in range(k):
      if switchOn[conds[i][k]] == True:
        numOfBulbOn +=1
    if numOfBulbOn % 2 != p[m]:
      flag = False
      break
  return flag
      

#n:switch, m:bulb
n, m = map(int, input().split())

conds = []
for i in range(m):
  connect = list(map(int, input().split()))
  conds.append(connect)
  
p = list(map(int, input().split()))

switchOn = [False]*n

ans = 0
for bit in range(1<<n):
  for i in range(n):
    if bit & 1<<i == 1:
      switchOn[i] = True
    else:
      switchOn[i] = False
  if judgeAllBulbsOn(switchOn, conds, p):
    ans+=1
print(ans)
Problem p03086 (python)

Fixed submission:
pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while right < len(s) and s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)

Buggy submission (verdict: Runtime Error):
pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)

Buggy submission (verdict: Runtime Error):
pat = ["A", "C", "G", "T"]

s = input()

left = right=0
ans = 0

while left<len(s):
  right = left
  while s[right] in pat:
    right+=1
  
  ans = min(ans, right - left)
  
  left = right+1
  
print(ans)