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

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(len(s)-2):
    if(s[i] == "A"):
        if(s[i+1] == "B"):
            if(s[i+2] == "C"):
                count = count + 1

print(count)

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

for i in range(len(s)):
    if(s[i] == "A"):
        if(s[i+1] == "B"):
            if(s[i+2] == "C"):
                count = count + 1

print(count)
Problem p02999 (python)

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

if i[0]<i[1]:
    print(0);
else:
    print(10);

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

length = 0;
answer = 1;
i = 0;

while length + l[i] <= n[1]:
    length = length + l[i]
    answer = answer + 1
    if(len(l) == (i+1)):
        break;
    i = i + 1

#if(answer <= n[0]):
print(answer)
#else:
#    print(n[0])
Problem p03000 (python)

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

length = 0;
answer = 1;
i = 0;

while length + l[i] <= n[1]:
    length = length + l[i]
    answer = answer + 1
    if(len(l) == (i+1)):
        break;
    i = i + 1

#if(answer <= n[0]):
print(answer)
#else:
#    print(n[0])

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

length = 0;
answer = 1;
i = 0;

while (length + l[i]) <= n[1]:
    length = length + l[i]
    answer = answer + 1
    i = i + 1

if(answer <= n[0]):
    print(answer)
else:
    print(n[0])
Problem p03067 (python)

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

if(i[0] < i[1]):
    if(i[0] < i[2] and i[2] < i[1]):
        print("Yes")
    else:
        print("No")

elif(i[0] > i[1]):
    if(i[1] < i[2] and i[2] < i[0]):
        print("Yes")
    else:
        print("No")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
s_list = list(s)
count1 = 0
count2 = 0

for i in range(n):
    if(s_list[i] == '#'):
        for j in range(0,n-i-1):
            #print(s_list[j+i])
            #print(j)
            if(s_list[j+i+1] == '.'):
                #print("count")
                count1 = count1 + 1
        break


for i in range(n):
    if(s_list[i] == '#'):
        count2 = count2 + 1


if(count1 < count2):
    print(count1)
else:
    print(count2)
Problem p04043 (python)

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

i = sum(n)

if i % 17 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
N = n[0]
K = n[1]

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

num = [i for i in range(1,10)]
for i in d:
  if i == 0:
    continue
  else:
    num.remove(i)

total = N*min(num)
if total > N:
  print(N)
else:
  print(total)
Problem p04045 (python)

Fixed submission:
N,K=map(int,input().split())
D=list(map(int,input().split()))
def solve():
  for i in range(10*N+2):
    if i>=N:
      s=str(i)
      for j in range(len(s)):
        if int(s[j]) in D: break
      else:
        print(i)
        return 0
 
solve()

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
N = n[0]
K = n[1]

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

num = [i for i in range(1,10)]

dd = []

for i in d:
  num.remove(i)

total = 1000*min(num)
print(total)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
N = n[0]
K = n[1]

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

num = [i for i in range(1,10)]

dd = []

for i in d:
  num.remove(i)

a = 0
for i in num:
  a += i*1000
print(a)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input(),split())
if a*b%2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03495 (python)

Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())
if (g*10 + b)% 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r, g, b = map(int, input(),split())
if g*10 + b % 4 == 0:
    print("Yes")
else:
    print("No")
Problem p02687 (python)

Fixed submission:
S = input()

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

Buggy submission (verdict: Runtime Error):
X = int(input())
for A in range(-150, 150):
    for B in range(-150, 150):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
ans = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        print(-1)
        exit()
if N == 1:
    if ans[0] == -1:
        print(0)
    else:
        print(int(''.join(map(str,ans))))
else:
    if ans[0] == 0:
        print(-1)
        exit()
    elif ans[0] == -1:
        ans[0] = 1
    for i in range(N):
        if ans[i] == -1:
            ans[i] = 0
    print(int(''.join(map(str,ans))))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        print(-1)
        break
else:
    if len(ans) == 1:
        print(0)
    else:
        if ans[0] == 0:
            ans = [-1]
        elif ans[0] == -1:
            ans[0] = 1
        for i in range(M):
            if ans[i] == -1:
                ans[i] = 0
        print(int(''.join(map(str,ans))))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        print(-1)
        break

if len(ans) == 1:
    print(0)
else:
    if ans[0] == 0:
        ans = [-1]
    elif ans[0] == -1:
        ans[0] = 1
    for i in range(M):
        if ans[i] == -1:
            ans[i] = 0
    print(int(''.join(map(str,ans))))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        print(-1)
        break

print(ans)
if len(ans) == 1:
    print(0)
else:
    if ans[0] == 0:
        ans = [-1]
    elif ans[0] == -1:
        ans[0] = 1
    for i in range(M):
        if ans[i] == -1:
            ans[i] = 0
    print(int(''.join(map(str,ans))))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans = [-1]*N
for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == -1:
        ans[s-1] = c
    elif ans[s-1] != c:
        print(-1)
        break

if len(ans) == 1:
    print(0)
else:
    if ans[0] == 0:
        print(-1)
    elif ans[0] == -1:
        ans[0] = 1
        for i in range(1, M):
            if ans[i] == -1:
                ans[i] = 0
        print(int(''.join(map(str,ans))))
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
 
sc=[list(map(int,input().split())) for _ in range(m)]
 
def main():
  for i in range(10**n):
    scstr = str(i)
    f = True
    if len(scstr) == n:
      for j in range(m):
        if scstr[sc[j][0]-1] != str(sc[j][1]):
          f = False
      if f:
        print(i)
        return
  print('-1')
 
main()

Buggy submission (verdict: Runtime Error):
import sys
n, m = map(int, input().split())
S,C=[],[]

for _ in range(m):
  s,c=map(int,input().split())
  S.append(s)
  C.append(c)
cur = 0
for i in range(10**(n-1)-1, 10**n):
  isOk = True
  for j in range(m):
    if str(i)[S[j]-1] != str(C[j]):
      isOk = False
  if isOk:
    print(i)
    sys.exit()
print(-1)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if S[i] == T[i]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n * (n-1)//2)
Problem p03000 (python)

Fixed submission:
from collections import deque

N, X = map(int, input().split())
L = list(map(int, input().split()))
d = deque([0])
current = 0
for i in range(N):
    current = current + L[i]
    d.append(current)

lessX = [i for i in d if i <= X]
print(len(lessX))

Buggy submission (verdict: Runtime Error):
from collections import deque
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = [0]
current = 0
for i in range(N):
    current = current + L[i]
    d.append(current)

index = 0
flg = True
while flg:
    if d[index] <= X:
        index += 1
    else:
        flg = False

print(index)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = deque([0])
current = 0
for i in range(N):
    current = current + L[i]
    d.append(current)

count = 0
while d.popleft() <= X:
    count += 1

print(count)
Problem p03059 (python)

Fixed submission:
import math
A, B, T = map(int, input().split())
total = 0
time = math.floor(T + 0.5)
total = B * (math.floor(time / A))
print(total)

Buggy submission (verdict: Runtime Error):
3 2 9
Problem p03061 (python)

Fixed submission:
#nn
from fractions import gcd 
n = int(input())
a = list(map(int, input().split()))
ans = 1
left = [0]
right = [0]

for i in range(n):
  left.append(gcd(left[-1], a[i]))
  right.append(gcd(right[-1], a[-(i+1)]))
right.reverse()

for i in range(n):
  ans = max(ans, gcd(left[i], right[i+1]))
print(ans)

Buggy submission (verdict: Runtime Error):
import copy as cp
N = int(input())
a = list(map(int, input().split()))

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

def gcd_all(a_list):
    if len(a_list)<1:
      return
    gcd_num = gcd(a_list[0],a_list[1])
    for i in range(2, len(a_list)):
        gcd_num = gcd(gcd_num, a[i])
    return gcd_num

max_gcd = 0
for i in range(N):
    a_cp = cp.copy(a)
    del a_cp[i]
    max_gcd = max(max_gcd, gcd_all(a_cp))
print(max_gcd)

Buggy submission (verdict: Runtime Error):
import copy as cp
N = int(input())
a = list(map(int, input().split()))

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

def gcd_all(a_list):
    gcd_num = gcd(a_list[0],a_list[1])
    for i in range(2, len(a_list)):
        gcd_num = gcd(gcd_num, a[i])
    return gcd_num

max_gcd = 0
for i in range(N):
    a_cp = cp.copy(a)
    del a_cp[i]
    max_gcd = max(max_gcd, gcd_all(a_cp))
print(max_gcd)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
print(math.pi * 2 * r)

Buggy submission (verdict: Runtime Error):
import math
r = int(input))
print(math.pi * 2 * r)
Problem p02713 (python)

Fixed submission:
import itertools
import math

n = int(input())
c1 = range(1, n + 1)
c2 = itertools.combinations(range(1, n + 1), 2)
c3 = itertools.combinations(range(1, n + 1), 3)

t1 = sum(list(c1))
t2 = sum(list(map(lambda x: math.gcd(x[0], x[1]), c2))) * 6
t3 = sum(list(map(lambda x: math.gcd(x[0], math.gcd(x[1], x[2])), c3))) * 6

print(sum([t1, t2, t3]))

Buggy submission (verdict: Runtime Error):
def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)



k = (int(x) for x in input().split())

n = 3
c = {} 
t = 0
for x in range(k, 0, -1):
    c[x] = (k // x) ** n
    c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
    s = c[x] * x
    t += s
    # t = t % 1000000007

print(t)

Buggy submission (verdict: Runtime Error):
def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)



k = (int(x) for x in input().split())

c = {} 
t = 0
for x in range(k, 0, -1):
    c[x] = (k // x) ** n
    c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
    s = c[x] * x
    t += s
    # t = t % 1000000007

print(t)

Buggy submission (verdict: Runtime Error):
def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)



n, k = (int(x) for x in input().split())

c = {} 
t = 0
for x in range(k, 0, -1):
    c[x] = (k // x) ** n
    c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
    s = c[x] * x
    t += s
    t = t % 1000000007

print(t)
Problem p02716 (python)

Fixed submission:
#!/usr/bin/env python3
# coding: utf-8
import collections
import math
def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)

N, *A = map(int, open(0).read().split())
a = dict(enumerate(A, 1))
# dp = collections.defaultdict(int)
dp = collections.defaultdict(lambda: -float("inf"))
dp[0, 0] = 0 
dp[1, 0] = 0 
dp[1, 1] = a[1]
for i in range(2, N + 1):
    jj = range(max(math.floor(i // 2 - 1), 1), math.ceil((i + 1) // 2) + 1)
    debug(jj)
    for j in jj:
        x = dp[i - 2, j - 1] + a[i]
        y = dp[i - 1, j]

        dp[i, j] = max(x, y)
        debug([i - 2, j - 1])
        debug([i - 1, j])
        debug([i, j])
        debug(dp[i, j])
print(dp[N, N // 2])

Buggy submission (verdict: Runtime Error):
import collections
import math

N, *A = map(int, open(0).read().split())
a = dict(enumerate(A, 1))
dp = collections.defaultdict(int)
dp[1, 1] = a[1]

for i in range(2, N + 1):
    jj = range(math.floor(i // 2 - 1), math.ceil((i + 1) // 2) + 1)
    debug(jj)
    for j in jj:
        x = dp[i - 2, j - 1] + a[i]
        y = dp[i - 1, j]
        dp[i, j] = max(x, y)

print(dp[N, N // 2])
Problem p02719 (python)

Fixed submission:
#!/usr/bin/env python3
# coding: utf-8

def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)

def main():
    N, K = map(int, open(0).read().split())
    debug([N, K])
    r = N % K
    a = min(r, K - r)
    print(a)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# coding: utf-8
# import pprint
# import numpy as np
# import code
# import functools

if __debug__:
    def debug(arg):
        pass
else:
    import sys
    def debug(arg):
        debug = lambda *x: None
        print(arg, file=sys.stderr)

n, k = (int(x) for x in input().split())

d = abs(n - k)
debug(d)
if(n >= k):
    a = n % d
    debug(a)
else:
    a = n
    debug(a)
debug([a, k])
m = min(a, abs(a - k))
debug(m)
print(m)
Problem p02697 (python)

Fixed submission:


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():
	median = n // 2

	for i in range(m):
		if n % 2 == 0 and i >= n // 4:
			print(median-i, median+i+2)
		else:
			print(median-i, median+i+1)


if __name__ == '__main__':
	format_input()

	get_answer()

Buggy submission (verdict: Runtime Error):


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():
	median = n // 2

	for i in range(m):
		if n % 2 == 0 and i => n // 4:
			print(median-i, median+i+2)
		else:
			print(median-i, median+i+1)


if __name__ == '__main__':
	format_input()

	get_answer()

Buggy submission (verdict: Runtime Error):


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():
	median = n // 2

	for i in range(m)
		print(median-i, median+i+1)


if __name__ == '__main__':
	format_input()

	get_answer()

Buggy submission (verdict: Runtime Error):


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():
	unused = list(range(n))

	for i in range(m):
		a = unused[0]
		b = unused[0]+i+1
		unused.remove(a)
		unused.remove(b)
		print(a+1, b+1)	


if __name__ == '__main__':
	format_input()

	get_answer()

Buggy submission (verdict: Runtime Error):


n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():
	unused = list(range(n))

	for i in range(m):
		a = unused[0]
		b = unused[0]+i+1
		unused.remove(a)
		unused.remove(b)
		print(a+1, b+1)	


if __name__ == '__main__':
	format_input()

	get_answer()
Problem p02684 (python)

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

l = [-1] * N
loopcnt = 0
inicnt = 0
place = 1
i = 0
l[place - 1] = 0

while i < K:
    i += 1
    next_place = A_list[place - 1]
    place = next_place
    if l[next_place - 1] != -1:
        loopcnt = i - l[next_place - 1]
        inicnt = l[next_place - 1]
        break
    else:
        l[next_place - 1] = i
if i >= K:
    print(place)

else:
    last_move_cnt = (K - inicnt) % loopcnt

    j = 1
    while j <= last_move_cnt:
        j += 1
        next_place = A_list[place - 1]
        place = next_place
    print(place)

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

l = [-1] * N
loopcnt = 0
inicnt = 0
place = 1
i = 0
l[place - 1] = 0

while i <= K:
    i += 1
    next_place = A_list[place - 1]
    place = next_place
    if l[next_place - 1] != -1:
        loopcnt = i - l[next_place - 1]
        inicnt = l[next_place - 1]
        break
    else:
        l[next_place - 1] = i

last_move_cnt = (K - inicnt) % loopcnt

j = 1
while j <= last_move_cnt:
    j += 1
    next_place = A_list[place - 1]
    place = next_place
    
print(place)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
ans = N
x = abs(N - K * max(N // K, 1))
while ans > x:
    ans = x
    x = abs(x - K * max(x // K, 1))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = N
x = abs(x - K * max(x // K, 1))
while ans > x:
    ans = x
    x = abs(x - K * max(x // K, 1))
print(ans)
Problem p02760 (python)

Fixed submission:
a_list = []
for i in range(3):
    for j in list(map(int, input().split())):
        a_list.append(j)

N = int(input())

b_list = []
for i in range(N):
    b_list.append(int(input()))    
        
for b in b_list:
    if b in a_list:
        a_list[a_list.index(b)] = 0
# 123
# 456
# 789
# とした場合のビンゴラインごとのリスト
line_list = [
    a_list[:3],    # 123
    a_list[3:6],   # 456
    a_list[6:9],   # 789
    a_list[::3],   # 147
    a_list[1::3],  # 258
    a_list[2::3],  # 369
    a_list[::4],   # 159
    a_list[2:7:2], # 357    
]
line_sum_list = list(map(sum, line_list))
if 0 in line_sum_list:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a_list = []
for i in range(3):
    for j in list(map(int, input().split())):
        a_list.append()

N = int(input())

b_list = []
for i in range(N):
    b_list.append(int(input()))    
        
for b in b_list:
    if b in a_list:
        a_list[a_list.index(b)] = 0
# 123
# 456
# 789
# とした場合のビンゴラインごとのリスト
line_list = [
    a_list[:3],    # 123
    a_list[3:6],   # 456
    a_list[6:9],   # 789
    a_list[::3],   # 147
    a_list[1::3],  # 258
    a_list[2::3],  # 369
    a_list[::4],   # 159
    a_list[2:7:2], # 357    
]
line_sum_list = list(map(sum, line_list))
if 0 in line_sum_list:
    print('Yes')
else:
    print('No')
Problem p03031 (python)

Fixed submission:
import itertools
N,M = input().split()
N = int(N)
M = int(M)
line_list = []
for i in range(M):
    line = input().split()
    new_list=[]
    for l in line:
        new_list.append(int(l))
    new_list.pop(0)
    line_list.append(new_list)
old_p_list = input().split()
p_list = []
for p in old_p_list:
    p_list.append(int(p))

A = []
for n in range(N):
    A.append([True,False])
pattern_list = list(itertools.product(*A))
pattern_num = 0
for pattern in pattern_list:
    ok_flug = 1
    for i, line in enumerate(line_list):
            on_num = 0
            for l in line:
                if pattern[l-1]:
                    on_num += 1
            if on_num%2 != p_list[i]:
                ok_flug = 0
    if ok_flug == 1:
        pattern_num += 1
print(pattern_num)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(N)
M = int(M)
line_list = []
for i in range(M):
    line = input().split()
    new_list=[]
    for l in line:
        new_list.append(int(l))
    new_list.pop(0)
    line_list.append(new_list)
old_p_list = input().split()
p_list = []
for p in old_p_list:
    p_list.append(int(p))

A = []
for n in range(N):
    A.append([True,False])
pattern_list = list(itertools.product(*A))
pattern_num = 0
for pattern in pattern_list:
    ok_flug = 1
    for i, line in enumerate(line_list):
            on_num = 0
            for l in line:
                if pattern[l-1]:
                    on_num += 1
            if on_num%2 != p_list[i]:
                ok_flug = 0
    if ok_flug == 1:
        pattern_num += 1
print(pattern_num)

Buggy submission (verdict: Runtime Error):
N = int(N)
M = int(M)
line_list = []
for i in range(M):
    line = input().split()
    new_list=[]
    for l in line:
        new_list.append(int(l))
    new_list.pop(0)
    line_list.append(new_list)
old_p_list = input().split()
p_list = []
for p in old_p_list:
    p_list.append(int(p))
#　スイッチ組み合わせ
import itertools
A = []
for n in range(N):
    A.append([True,False])
pattern_list = list(itertools.product(*A))
pattern_num = 0
for pattern in pattern_list:
    ok_flug = 1
    for i, line in enumerate(line_list):
            on_num = 0
            for l in line:
                if pattern[l-1]:
                    on_num += 1
            if on_num%2 != p_list[i]:
                ok_flug = 0
    if ok_flug == 1:
        pattern_num += 1
print(pattern_num)
Problem p02924 (python)

Fixed submission:
n = int(input())
print(int((n-1)*(1+n-1)//2))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(sum(list(range(1, n))))
Problem p02690 (python)

Fixed submission:
x = int(input())
a = 0
while True:
    n = (a**5)-x
    s2 = -1 if n < 0 else 1
    if s2 == -1:
        n = n * -1
    b = n**0.2
    if a**5-(int(b)*s2)**5==x:
        end = 1
        print(a, int(b) * s2)
        break
    a = a+1

Buggy submission (verdict: Runtime Error):
import math

x = int(input())
for a in range(1000000000):
    b = (x - (a**5))**0.2
    if b.is_integer():
        print(a, int(b) * -1)
        break
Problem p03260 (python)

Fixed submission:
a, b = (int(i) for i in input().split())
 
if a % 2 != 0 and b % 2 != 0:
  print("Yes")
else:
  print("No")

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

if a % 2 == 0 && b % 2 == 0:
  print("Yes")
else:
  print("No")
Problem p03261 (python)

Fixed submission:
import sys
 
n = int(input())
l = []
p = None
 
for i in range(n):
  s = input()
  if s not in l and (p == None or p[-1:] == s[:1]):
    l.append(s)
    p = s
  else:
    print("No")
    sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
l = []
p = None

for i in range(n):
  s = input()
  if s in l && (p == None || p[-1:] == s[1:]):
    l.append(s)
    p = s
  else:
    print("No")
    sys.exit()
print("Yes")