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

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

line = 0
bool1 = False
for i in range(N):
  if h[i] >= K:
    line = i
    bool1 = True
    break

if bool1:
  print(N-i)
else:
  print(0)

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

ans = 0
for i in h:
  if h >= K:
    ans += 1
print(ans)
Problem p02900 (python)

Fixed submission:
import math
A,B = map(int,input().split())
x = math.gcd(A,B)

def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls

cnt = len(set(prime_decomposition(x)))

print(cnt+1)

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())

def prime_num_check(x):
  ls = []
  ls.append(1)
  for i in range(2,x+1):
    factor = 0
    if i%2 == 0 and i != 2:
      continue
    for divisor in range(2,math.floor(math.sqrt(i))+1):
      if i%divisor == 0:
        factor += 1
    if factor == 0:
      ls.append(i)
    return ls
  
x = math.gcd(A,B)

c_divisor = prime_num_check(x)
res = len(c_divisor) * (len(c_divisor) - 1) // 2

print(res)
Problem p02910 (python)

Fixed submission:
S = input()

check = True
for i, s in enumerate(S):
  if (i+1)%2 == 0:
    if not(s == "L" or s == "U" or s == "D"):
      check = False
  else:
    if not(s == "R" or s == "U" or s == "D"):
      check = False

if check:
  print("Yes")
else:
  print("No")

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

check = True
for i, s in enumerate(S):
  if (i+1)%2 == 0:
    if not(s == "L" or s == "U" or s == "D"):
      check = False
  else:
    if not(s == "R" or s == "U" or s ="D"):
      check = False

if check:
  print("Yes")
else:
  print("No")
Problem p02972 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A = [0] + A
res = [0]*(N+1)
M = 0

for i in range(N,0,-1):
  if sum(res[j] for j in range(i,N+1,i)) % 2 != A[i]:
    res[i] = 1
    M += 1
    
print(M)
print(*[k for k, r in enumerate(res) if r])

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

for i in range(N//2+1,N):
  if A[i] == 1:
    res.append(i)

for j in range(N//2,-1,-1):
  cnt = 0
  for k in res:
    if k%j == 0:
      cnt += 1
  if A[j] == 1 and cnt%2 == 0:
    res.append(j)
  elif A[j] == 0 and cnt%2 == 1:
    res.append(j)
  
res.sort()
print(*res)
Problem p02983 (python)

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

ans = float("inf")

for i in range(L,min(R,L+2019)):
  for j in range(L+1,min(R,L+2019)+1):
    ans = min(ans, i * j % 2019)
    
print(ans)

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

ls = [i % 2019 for i in range(L,min(R,L+2019**2))]
ls.sort()

print(ls[0]*ls[1]%2019)
Problem p02994 (python)

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

apples = [i+L-1 for i in range(1,N+1)]

ans = float("inf")
res = float("inf")

for apple in apples:
  if ans > abs(apple):
    ans = min(ans,abs(apple))
    res = apple
  
print(sum(apples) - res)

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

apples = [i+L-1 for i in range(1,N+1)]

ans = float("inf")

for apple in apples:
  ans = min(ans,abs(apples))
  
print(ans)

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

apples = [i+L-1 for i in range(1,N+1)]

ans = float("inf")

for j in range(N):
  ans = min(ans,abs(apples))
  
print(ans)
Problem p03163 (python)

Fixed submission:
N,W = map(int,input().split())
goods = [list(map(int,input().split())) for _ in range(N)]

dp = [[0 for _ in range(W)] for _ in range(N)]

for i,[w,v] in enumerate(goods):
  for j in range(W):
    if i == 0:
      if j >= goods[0][0]-1:
        dp[0][j] = goods[0][1]
    else:
      if w <= j:
        dp[i][j] = max(v+dp[i-1][j-w],dp[i][j-1],dp[i-1][j])
      else:
        dp[i][j] = max(dp[i-1][j],dp[i][j-1])

print(dp[N-1][W-1])

Buggy submission (verdict: Runtime Error):
N,W = map(int,input().split())
goods = [list(map(int,input().split())) for _ in range(N)]

dp = [[0 for _ in range(W)] for _ in range(N)]

for i,[w,v] in enumerate(goods):
  for j in range(W):
    if i == 0:
      if j >= goods[0][0]-1:
        dp[0][j] = goods[0][1]
    else:
      if w <= j:
        dp[i][j] = max(v+dp[i-1][j-w],dp[i][j-1],dp[i-1][j])
      else:
        dp[i][j] = max(dp[i-1][j])

print(dp[N-1][W-1])
Problem p03164 (python)

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

def main():
  
  def knapsack_price(single=True):
    V = sum(price_list)
    dp_max = W + 1
    dp = [dp_max] * (V+1)
    dp[0] = 0
    
    for i in range(N):
      if single:
        S = list(reversed(range(price_list[i], V+1)))
      else:
        S = list(range(price_list[i], V+1))
      for price in S:
        dp[price] = min(dp[price], dp[price - price_list[i]] + weight_list[i])
    
    return max(price for price in range(V+1) if dp[price] <= W)
  
  N,W = map(int,input().split())
  
  price_list = []
  weight_list = []
  for _ in range(N):
    weight, price = map(int,input().split())
    price_list.append(price)
    weight_list.append(weight)
    
  print(knapsack_price(single=True))

if __name__ == '__main__':
    main()

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

def main():
  
  def knapsack_price(single=True):
    V = sum(price_list)
    dp_max = W + 1
    dp = [dp_max] * (V-1)
    dp[0] = 0
    
    for item in range(N):
      if single:
        S = reversed(range(price_list[item], V+1))
      else:
        S = range(price_list[item], V+1)
      
      for price in S:
        dp[price] = min(dp[price], dp[price - price_list[item]] + weight_lsit[item])
    return max(price for price in range(V+1) if dp[price] <= W)
  
  N,W = map(int,input().split())
  
  price_list = []
  weight_list = []
  for _ in range(N):
    weight, price = map(int,input().split())
    price_list.append(price)
    weight_list.append(weight)
    
  print(knapsack_price(single=True)

if __name__ == '__main__':
    main()
Problem p03239 (python)

Fixed submission:
N,T = map(int,input().split())
ls = []

for i in range(N):
  c,t = map(int,input().split())
  if t <= T:
    ls.append(c)
    
print(min(ls) if ls else "TLE")

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

for i in range(N):
  c,t = map(int,input().split())
  if t <= T:
    ls.append(c)
    
print(min(ls))
Problem p03260 (python)

Fixed submission:
A,B = map(int,input().split())
check = False
for C in range(1,4):
  if (A * B * C) % 2 == 1:
    check = True
    
print("Yes" if check else "No")

Buggy submission (verdict: Runtime Error):
A,B = map(int,input())
check = False
for C in range(1,4):
  if (A * B * C) % 2 == 1:
    check = True
    
print("Yes" if check else "No")
Problem p03273 (python)

Fixed submission:
H,W = map(int,input().split())
A = [""] * H
for i in range(H):
  A[i] = input()
  
row = [False] * H
col = [False] * W

for j in range(H):
  for k in range(W):
    if A[j][k] == "#":
      row[j] = True
      col[k] = True
      
for l in range(H):
  if row[l]:
    for m in range(W):
      if col[m]:
        print(A[l][m], end = "")
    print()

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
mass = [list(input()) for _ in range(H)]

for i in range(H):
  if "#" not in mass[i]:
    mass.pop(i)
  
H = len(mass)

new_mass = [[] for _ in range(W)]

for j in mass:
  for i, k in enumerate(j):
    new_mass[i].append(k)
    
for l in range(W):
  if "#" not in new_mass[l]:
    new_mass.pop(l)
    
mass = [[] for _ in range(H)]

for n in new_mass:
  for i, m in enumerate(n):
    mass[i].append(m)
    
print(mass)
Problem p03337 (python)

Fixed submission:
A,B = map(int,input().split())
print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
A,B = max(int,input().split())
print(max(A+B,A-B,A*B))
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]

jougesayuu = [(-1,0),(1,0),(0,-1),(0,1)]

check = True
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      flag = False
      for (n,m) in jougesayuu:
        ni, nj = i + n, j + m
        if ni < 0 or H <= ni or nj < 0 or W <= nj:
          continue
        if s[ni][nj] == "#":
          flag = True
      if not flag:
        check = False
        
print("Yes" if check else "No")

Buggy submission (verdict: Runtime Error):
import sys
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]
sys.setrecursionlimit(10**7)

flag = [[-1 for _ in range(W)] for _ in range(H)]
move = [(-1,0),(1,0),(0,-1),(0,1)]

def search(x,y):
  if x < 0 or H <= x or y < 0 or W <= y:
    return
  if s[x][y] == "." or flag[x][y] != -1:
    return
  flag[x][y] = 0
  s[x][y] = 0
  for (nx,ny) in move:
    wx, wy = x+nx, y+ny
    search(wx,wy)
  return 

check_1 = False
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      sx, sy = i, j
      check_1 = True
      break
  if check_1:
    break
    
search(sx,sy)

check_2 = True
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      check_2 = False
      
print("Yes" if check_2 else "No")

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]

flag = [[-1 for _ in range(W)] for _ in range(H)]
move = [(-1,0),(1,0),(0,-1),(0,1)]

def search(x,y):
  if x < 0 or H <= x or y < 0 or W <= y:
    return
  if s[x][y] == "." or flag[x][y] != -1:
    return
  flag[x][y] = 0
  s[x][y] = 0
  for (nx,ny) in move:
    wx, wy = x+nx, y+ny
    search(wx,wy)
  return 

check_1 = False
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      sx, sy = i, j
      check_1 = True
      break
  if check_1:
    break
    
search(sx,sy)

check_2 = True
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      check_2 = False
      
print("Yes" if check_2 else "No")
Problem p03407 (python)

Fixed submission:
A,B,C = map(int,input().split())
print("Yes" if A+B >= C else "No")

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
print("Yes" if sum(A,B) >= C else "No")
Problem p03502 (python)

Fixed submission:
N = input()
fn = 0
for i in N:
  fn += int(i)
  
print("Yes" if int(N) % fn == 0 else "No")

Buggy submission (verdict: Runtime Error):
N = input()
fn = 0
for i in range(len(N)):
  fn += int(i)
  
print("Yes" if int(N) % fn == 0 else "No")

Buggy submission (verdict: Runtime Error):
N = input()
fn = 0
for i in range(len(N)):
  fn += int(i)
  
print("Yes" if N % fn == 0 else "No")
Problem p03557 (python)

Fixed submission:
import bisect

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0

A,B,C = sorted(A),sorted(B),sorted(C)

for b in B:
  a = bisect.bisect_left(A,b)
  c = bisect.bisect_right(C,b)
  ans += a*(N-c)
  
print(ans)

Buggy submission (verdict: Runtime Error):
#入力
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0

#リストをソート
A,B,C = sorted(A),sorted(B),sorted(C)

for i in range(N):
  middle = 0
  bottom = 0
  bool1 = True
  while True:
    if middle == N:
      break
    if B[middle] > A[i]:
      while True:
        if C[bottom] > B[middle]:
          ans += len(C[bottom:])
          break
        bottom += 1
    middle += 1
print(ans)
Problem p03644 (python)

Fixed submission:
N = int(input())

ans = 0
res = 1
for i in range(2,N+1):
  j = i
  if j % 2 == 1:
    continue
  cnt = 0
  while j % 2 == 0:
    j //= 2
    cnt += 1
  if ans < cnt:
    res = i
    ans = cnt
  
print(res)

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

ans = 0
for i in range(2,N+1):
  j = i
  if j % 2 == 1:
    continue
  cnt = 0
  while j % 2 == 0:
    j //= 2
    cnt += 1
  if ans < cnt:
    res = i
    ans = cnt
  
print(res)
Problem p03695 (python)

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

color = [0] * 9

for a in A:
  if a <= 399:
    color[0] = 1
  elif a <= 799:
    color[1] = 1
  elif a <= 1199:
    color[2] = 1
  elif a <= 1599:
    color[3] = 1
  elif a <= 1999:
    color[4] = 1
  elif a <= 2399:
    color[5] = 1
  elif a <= 2799:
    color[6] = 1
  elif a <= 3199:
    color[7] = 1
  else:
    color[8] += 1
    
max_num = sum(color)
min_num = max(1, sum(color[:-1]))
 
print(min_num, max_num)

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

hai = 0
tya = 0
mizu = 0
ao = 0
ki = 0
dai = 0
aka = 0
mu = 0

for a in A:
  if a <= 399:
    hai = 1
  elif a <= 799:
    tya = 1
  elif a <= 1199:
    mizu = 1
  elif a <= 1599:
    ao = 1
  elif a <= 1999:
    ki = 1
  elif a <= 2399:
    dai = 1
  elif a <= 3199:
    aka = 1
  else:
    mu += 1
    
max_num = min(8, hai + tya + mizu + ao + ki + dai + aka + mu)
min_num = max(hai + tya + mizu + ao + ki + dai + aka)

print(min_num, max_num)
Problem p02548 (python)

Fixed submission:
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
    n = int(input())
    res = 0
    for c in range(1,n):
        ab = n - c
        col = collections.Counter(prime_factorize(ab))
        r = 1
        for count in col.values():
            r *= count+1
        res += r
    print(res)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sympy

def main():
    n = int(input())
    res = 0
    for c in range(1,n):
        ab = n - c
        res += sympy.divisor_count(ab)
    print(res)


if __name__ == "__main__":
    main()
Problem p02838 (python)

Fixed submission:
import math

def main():
    mod = 1000000007
    N = int(input())
    A = list(map(int, input().split()))

    A_max = sorted(A)[-1]
    if A_max == 0:
        print(0)
        exit()
    bit_max = int(math.ceil(math.log2(A_max)))

    i = 0
    bit = 1
    res = 0
    while i <= bit_max:
        c_zero = 0
        c_one = 0
        for j in range(N):
            if A[j] & bit == 0:
                c_zero += 1
            else:
                c_one += 1
        m_bit = bit % mod
        res += m_bit*c_zero*c_one
        res %= mod
        i += 1
        bit<<=1
    print(res)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    mod = 1000000007
    N = int(input())
    A = list(map(int, input().split()))

    A_max = sorted(A)[-1]
    bit_max = int(math.ceil(math.log2(A_max)))

    i = 0
    bit = 1
    res = 0
    while i <= bit_max:
        c_zero = 0
        c_one = 0
        for j in range(N):
            if A[j] & bit == 0:
                c_zero += 1
            else:
                c_one += 1
        m_bit = bit % mod
        res += m_bit*c_zero*c_one
        res %= mod
        i += 1
        bit<<=1
    print(res)

if __name__ == "__main__":
    main()
Problem p03138 (python)

Fixed submission:
import math
import collections
import itertools
import heapq
import bisect
import sys


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    c = [0] * 40
    res = 0
    for a in A:
        for bit in range(40):
            if a & (1<<bit):
                c[bit] += 1

    x = 0
    for k in range(39,-1,-1):
        if x + (1<<k) > K:
            continue
        if c[k] <= N // 2:
            x += (1<<k)

    for a in A:
        res += x^a

    print(res)
  

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
import collections
import itertools
import heapq
import bisect
import sys


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    c = [0] * 40
    res = 0
    for a in A:
        for bit in range(40):
            if a & (1<<bit):
                c[k] += 1

    x = 0
    for k in range(39,-1,-1):
        if x + (1<<k) > K:
            continue
        if c[k] <= N // 2:
            x += (1<<k)

    for a in A:
        res += x^a

    print(res)
  

if __name__ == "__main__":
    main()
Problem p03244 (python)

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

v0 = v[0:n-1:2]
v1 = v[1:n:2]

c0 = Counter(v0).most_common()
c1 = Counter(v1).most_common()

if len(set(v0)) == len(set(v1)) == 1:
    if c0[0] == c1[0]:
        res = len(v0)
    else:
        res = 0

else:
    if c0[0] != c1[0]:
        res = n - c0[0][1] - c1[0][1]
    else:
        res = min(n - c0[0][1] - c1[1][1], n - c0[1][1] - c1[0][1])

print(res)

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

n = int(input())
v = list(map(int, input().split()))

v_0 = v[0:n-1:2]
v_1 = v[1:n:2]

v_0_max = Counter(v_0).most_common()[0][0]
v_1_max = Counter(v_1).most_common()[0][0]

if len(set(v_0)) == len(set(v_1)):
    if v_0_max == v_1_max:
        res = len(v_0)
    else:
        res = 0

else:
    v_0_sec = Counter(v_0).most_common()[1][0]
    v_1_sec = Counter(v_1).most_common()[1][0]

    if v_0_max == v_1_max:
        if v_0_sec > v_1_sec:
            v_0_max = v_0_sec
        else:
            v_1_max = v_1_sec

    res = 0
    for v0, v1 in zip(v_0,v_1):
        if v0 != v_0_max:
            res += 1
        if v1 != v_1_max:
            res += 1

print(res)
Problem p03665 (python)

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

odd = 0
for a in A:
    if a % 2 != 0:
        odd += 1

if odd == 0:
    if P == 1:
        res = 0
    else:
        res = 2 ** N
else:
    res = 2 ** (N - 1)

print(res)

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

odd = 0
for a in A:
    if a % 2 != 0:
        odd += 1

if odd == 0
    if P == 1:
        res = 0
    else:
        res = 2 ** N
else:
    res = 2 ** (N - 1)

print(res)
Problem p02756 (python)

Fixed submission:
import sys
S = input()
Q = int(input())
key = 1

for i in sys.stdin:
    if i[0] == '0':
        break

    if i[0] == '1':
        key = -key
    
    elif key == 1:
        if i[2] == '1':
            S = i[4] + S
        else:
            S = S + i[4]

    else:
        if i[2] == '2':
            S = i[4] + S
        else:
            S = S + i[4]


print(S[::key])

Buggy submission (verdict: Runtime Error):
import sys
S = input()
Q = int(input())
key = 1

for i in sys.stdin:
    if i[0] == '0':
        break

    if i[0] == '1':
        key = -key
    
    if key == 1:
        if i[2] == '1':
            S = i[4] + S
        else:
            S = S + i[4]

    else:
        if i[2] == '2':
            S = i[4] + S
        else:
            S = S + i[4]


print(S[::key])
Problem p02993 (python)

Fixed submission:
S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')

else:
    print('Good')

Buggy submission (verdict: Runtime Error):
S = int(input())
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')

else:
    print('Good')
Problem p02631 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
S=A[0]
for i in range(N-1):
  S=S^A[i+1]
L=[0]*N
for i in range(N):
  L[i]=A[i]^S
print(*L)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
S=A[0]
for i in range(N-1):
  S=S^A[i+1]
L=[0]*N
for i in range(N):
  L[i]=A[i]^S
print(*L)
Problem p02803 (python)

Fixed submission:
H, W = list(map(int, input().split()))
S =[list(input()) for _ in range(H)]
N=H*W
INF=float('inf')
L=[[INF]*N for _ in range(N)]
for i in range(N):
    h=i//W
    w=i%W
    # print(i,h,w)
    if S[h][w]=='.':
        L[i][i]=0
    if w>0 and S[h][w-1]=='.':
        L[i][i-1]=1
    if w<W-1 and S[h][w+1]=='.':
        L[i][i+1]=1
    if h>0 and S[h-1][w]=='.':
        L[i][i-W]=1
    if h<H-1 and S[h+1][w]=='.':
        L[i][i+W]=1
# print(L)

for i in range(N):
    via=L[i]
    if via[i]==INF:
        continue
    for j in range(N):
        st=L[j]
        if st[j]==INF:
            continue
        for k in range(N):
            L[j][k]=min(st[i]+via[k], st[k])
# print(L)
ans=0
for i in range(N):
    for j in range(N):
        if L[i][j]!=INF:
            ans=max(ans,L[i][j])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = list(map(int, input().split()))
S =[list(input()) for _ in range(H)]

mv = {(1, 0), (-1, 0), (0, 1), (0, -1)}


def BFS(St):
    stk = deque([[St[0],St[1],0]])
    seen = [[False]*W for _ in range(H)]
    while len(stk) > 0:
        l = stk.pop()
        i = l[0]
        j = l[1]
        ct = l[2]
        seen[i][j] = True
        for k in mv:
            x = i+k[0]
            y = j+k[1]
            if 0 <= x < H and 0 <= y < W:
                if S[x][y] == '.' and seen[x][y] == False:
                    stk.appendleft([x, y, ct+1])
    return(ct)

ans = 0
# 各スタート地点に対して最大距離を出力すればいいですねって話

for i in range(H):
    for j in range(W):
        
            continue
        ans=max(ans,BFS([i,j]))
print(ans)
Problem p02837 (python)

Fixed submission:
N = int(input())
A = []
for i in range(N):
    a = int(input())
    xy = [list(map(int, input().split())) for _ in range(a)]
    A.append([a, xy])
# print(A)

# 下からi桁目のbitが1->人iは正直
# 下からi桁目のbitが0->人iは不親切
# 不親切な人の証言は無視して良い

ans = 0
for i in range(2**N):
    for j in range(N):
        flag = 0
        if (i >> j) & 1:
            for k in range(A[j][0]):
                l = A[j][1][k][0]
                m=A[j][1][k][1]
                # print(i,j,k,(l,m),(i >> (l-1)))
                if not (i >> (l-1)) & 1 == A[j][1][k][1]:
                    flag = 1
                    break
            if flag == 1:
                break
    else:
        # print(bin(i))
        ct = 0
        for l in range(N):
            ct += ((i >> l) & 1)
        ans = max(ans, ct)
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC_147_C_HonestOrUnkind2.py

N=int(input())
A=[]
for i in range(N):
    a=int(input())
    xy=[list(map(int, input().split())) for _ in range(a)]
    A.append([a,xy])
# print(A)

# 下からi桁目のbitが1->人iは正直
# 下からi桁目のbitが0->人iは不親切

ans=0
for i in range(2**N):
    for j in range(N):
        for k in range(A[j][0]):
            flag=0
            if (i >> j) & 1 != A[j][1][k][1]:
                flag=1
                break
        if flag==1:
                break
    else:
        # print(bin(i))
        ct=0
        for l in range(N):
            ct+=((i>>l)&1)
        ans=max(ans,ct)

print(ans)
Problem p02945 (python)

Fixed submission:
a,b=list(map(int,input().split()))
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input.split()))
print(max(a+b,a-b,a*b))
Problem p02983 (python)

Fixed submission:
L,R=list(map(int, input().split()))
M=2019
if R-L==1:
  print(((R%M)*(L%M))%M)
  exit()
if L//M!=R//M:
  print(0)
  exit()
L=L%M
R=R%M
ans=M
for i in range(L,R+1):
  for j in range(i+1,R+1):
    ans=min(ans,(i*j)%M)
print(ans)

Buggy submission (verdict: Runtime Error):
L,R=list(map(int, input().split()))
M=2019
if R-L=1:
  print(((R%M)*(L%M))%M)
  exit()
L=L%M
if R%M<=L:
  R=(R%M)+M
else:
  R=R%M
ans=M
for i in range(L,R+1):
  for j in range(i+1,R+1):
    ans=min(ans,(i*j)%M)
print(ans)
Problem p03103 (python)

Fixed submission:
N, M = list(map(int, input().split()))
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
# print(L)
ct = 0
cost = 0
i = 0
while ct < M:
    a = min(M-ct, L[i][1])
    ct += a
    cost += a*L[i][0]
    # print(ct,cost)
    i += 1
print(cost)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
# print(L)
ct = 0
cost = 0
i = 0
while ct < M:
    a = min(M-ct, L[i][1])
    ct += a
    cost += a*L[i][0]
    # print(ct,cost)
    i += 1
print(cos
Problem p03145 (python)

Fixed submission:
A=list(map(int,input().split()))
B=list.sort(A)
print(A[0]*A[1]//2)

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split()))
B=sort(A)
print(A[0]*A[1]/2)