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

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

ans = 0
for i in range(1,N+1):
  d = sum(list(map(int,list(str(i)))))
  if A <= d <= B:
    ans += i

print(ans)

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

ans = 0
for i in range(1,N+1):
  d = sum(list(map(int,list[str(i)])))
  if A <= d <= B:
    ans += 1

print(ans)

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

ans = 0
for i in range(1,N+1):
  d = sum(map(int,list[str(i)]))
  if A <= d <= B:
    ans += 1

print(ans)
Problem p03486 (python)

Fixed submission:
S = list(input())
T = list(input())

S = [ord(s) for s in S]
T = [ord(s) for s in T]

S.sort()
T.sort(reverse=True)

LS = len(S)
LT = len(T)

ok = None
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  elif t < s:
    ok = False
    break

if ok:
  print('Yes')
elif ok == None:
  if LS < LT:
    print('Yes')
  else:
    print('No')
else:
  print('No')

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

S = [ord(s) for s in S]
T = [ord(s) for s in T]

S.sort()
T.sort(reverse=True)

LS = len(S)
LT = len(T)

ok = False
for i in range(min(LS,LT)):
  s = S[i]
  t = T[i]
  if s < t:
    ok = True
    break
  elif s == t:
    continue
  else t < s:
    ok = False
    break

if ok:
  print('Yes')
else:
  print('No')
Problem p03497 (python)

Fixed submission:
from collections import Counter

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

C = Counter(A).most_common()
L = len(C)

if L <= K:
  print(0)
  exit()

ans = 0
cnt = 0
for k,v in C:
  cnt += 1
  if K < cnt:
    ans += v
    
print(ans)

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

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

C = Counter(A).most_common()
L = len(C)

if L <= K:
  print(0)
  exit()

ans = 0
cnt = 0
for v in C.values():
  cnt += 1
  if K < cnt:
    ans += v
    
print(ans)
Problem p03544 (python)

Fixed submission:
N = int(input())
L = [0] * 87
L[0] = 2
L[1] = 1

for i in range(2,87):
  L[i] = L[i-1] + L[i-2]

print(L[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [0] * 87
L[0] = 2
L[1] = 1

for i in range(2,88):
  L[i] = L[i-1] + L[i-2]

print(L[N])
Problem p03607 (python)

Fixed submission:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
N = int(readline())

NUMBERS = defaultdict(bool)

for _ in range(N):
  n = int(readline())
  NUMBERS[n] = not NUMBERS[n]

ans = 0
for k,v in NUMBERS.items():
  if v:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
readline = sys.stdin.buffer.readline
N = int(readline())

NUMBERS = defaultdict(bool)

for _ in range(N):
  n = int(readline())
  NUMBERS[n] = not NUMBERS[n]

ans = 0
for k,v in NUMBERS.items():
  if v:
    ans += 1

print(ans)
Problem p03624 (python)

Fixed submission:
S = list(input())
USED = [False] * 26

for s in S:
  USED[ord(s)-97] = True
  
ok = False
ans = None
for i in range(26):
  if not USED[i]:
    ans = chr(97+i)
    ok = True
    break
    
if ok:
  print(ans)
else:
  print("None")

Buggy submission (verdict: Runtime Error):
S = list(input())
USED = [False] * 26

for s in S:
  USED[ord(s)-96] = True
  
ok = False
ans = None
for i in range(26):
  if not USED[i]:
    ans = chr(96+i)
    ok = True
    break
    
if ok:
  print(ans)
else:
  print("None")
Problem p03644 (python)

Fixed submission:
N = int(input())
ans = 1
while True:
  ans *= 2
  if N < ans:
    ans //= 2
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(intpu())
ans = 1
while True:
  ans *= 2
  if N < ans:
    ans //= 2
    break
    
print(ans)
Problem p03673 (python)

Fixed submission:
from collections import deque

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

ANS = deque()
for i in range(N):
  if i % 2 == 0:
    ANS.append(A[i])
  else:
    ANS.appendleft(A[i])
    
ANS = list(ANS)
if N % 2 == 1:
  ANS = ANS[::-1]
  
print(" ".join(map(str,ANS)))

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

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

ANS = deque()
for i in range(N):
  if i % 2 == 0:
    ANS.append(A[i])
  else:
    ANS.appendleft(A[i])
    
if N % 2 == 1:
  ANS = ANS[::-1]
  
print("".join(map(str,ANS)))
Problem p03687 (python)

Fixed submission:
S = input()
uni_s = list(set(list(S)))

ans = len(S) - 1

# -1,1
for s in uni_s:
  L = len(S)
  T = list(S)
  all_same = [s == t for t in S]
  cnt = 0
  while not all(all_same):
    cnt += 1
    newT = [False] * (L-1)
    for i in range(L):
      t = T[i]
      if s == t:
        if i < L-1:
          newT[i] = t
        if 0 <= i-1:
          newT[i-1] = t
      else:
        if i < L-1 and not newT[i]:
          newT[i] = t
        if 0 <= i-1 and not newT[i-1]:
          newT[i-1] = t
    
    all_same = [s==t for t in newT]
    T = newT
    L = len(T)
  ans = min(ans,cnt)

print(ans)

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

S = input()
uni_s = list(set(list(S)))

ans = len(S) - 1

# -1,1
for s in uni_s:
  L = len(S)
  T = list(S)
  all_same = [s == t for t in S]
  cnt = 0
  while not all(all_same):
    newT = [False] * (L-1)
    for i in range(L):
      t = T[i]
      if s == t:
        newT[i] = t
        if 0 <= i-1:
          newT[i-1] = t
      else:
        if not newT[i]:
          newT[i] = t
        if 0 <= i-1 and not newT[i-1]:
          newT[i-1] = t
    
    all_same = [s==t for t in newT]
    T = newT
    L = len(T)
  ans = min(ans,cnt)

print(ans)
Problem p03699 (python)

Fixed submission:
N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 101)
POINT[0] = True
LP = len(POINT)

for p in P:
  for i in range(10**4,-1,-1):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i] and i % 10 != 0:
    ans = max(i,ans)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 101)
POINT[0] = True
LP = len(POINT)

for p in P:
  for i in range(10**4+1,-1,-1):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i] and i % 10 != 0:
    ans = max(i,ans)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = [int(input()) for _ in range(N)]

POINT = [False] * (10 ** 4 + 10)
POINT[0] = True
LP = len(POINT)

for p in POINT:
  for i in range(LP):
    POINT[i+p] = POINT[i] | POINT[i+p]
  
ans = 0
for i in range(LP):
  if POINT[i]:
    ans = max(i,ans)
    
print(ans)
Problem p03730 (python)

Fixed submission:
A,B,C = map(int,input().split())

D = A % B
M = D
ok = False
for _ in range(B+1):
  if M == C:
    ok = True
    break
    
  M = (M + D) % B
  
if ok:
  print('YES')
else:
  print('NO')

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

D = A % B
M = D
ok = False
for _ in range(B+1):
  if M == C:
    ok = True
	break
    
  M = (M + D) % B
  
if ok:
  print('YES')
else:
  print('NO')
Problem p03733 (python)

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

for a in A:
  LST.append((a,1))
  LST.append((a+T,-1))
  
LST.sort()

prev = -1
s = 0
ans = 0
for x,y in LST:
  if y == 1:
    s += 1
    if s == 1:
      prev = x
  elif y == -1:
    s -= 1
    if s == 0:
      ans += (x - prev)
  
print(ans)

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

for a in A:
  LST.append((a,1))
  LST.append((a+T,-1))
  
LST.sort()

prev = -1
s = 0
ans = 0
for x,y in A:
  if y == 1:
    if s == 0:
      prev = x
    else:
      s += 1
  elif y == -1:
    s -= 1
    if s == 0:
      ans += (x - prev)
  
print(ans)
Problem p03799 (python)

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

def solve(N,M):
  # 今あるもの
  if M < N * 2:
    return M // 2
  
  M -= N * 2
  
  ans = N + (M // 4)
  return ans

print(solve(N,M))

Buggy submission (verdict: Runtime Error):
N,M = map(int,inpu().split())

def solve(N,M):
  # 今あるもの
  if M < N * 2:
    return N
  
  M -= N * 2
  
  ans = N + M // 3
  return ans

print(solve(N,M))
Problem p03937 (python)

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

def dfs(h,w,c):
  if h == H - 1 and w == W - 1:
    return c + 1

  if H - 1 < h or W -1 < w:
    return 0
  
  if GRID[h][w] != "#":
    return 0
  
  
  right = dfs(h+1,w,c+1)
  down = dfs(h,w+1,c+1)

  return max(right,down)

NUM = sum([GRID[x].count("#") for x in range(H)])

n = dfs(0,0,0)

if n == NUM:
  print("Possible")
else:
  print("Impossible")

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

def dfs(h,w,c):
  if h == H - 1 and w == W - 1:
    return c + 1
  
  if GRID[h][w] != "#":
    return 0
  
  if H - 1 < h or W -1 < w:
    return 0
  
  right = dfs(h+1,w,c+1)
  down = dfs(h,w+1,c+1)
  c += max(right,down)

  return c

NUM = sum([GRID[x].count("#") for x in range(H)])

n = dfs(0,0,0)

if n == NUM:
  print("Possible")
else:
  print("Impossible")
Problem p04001 (python)

Fixed submission:
import sys
import copy
from collections import deque

sys.setrecursionlimit(1000000000)

def dfs(xs,q):
    if len(xs) == 0:
        return sum(int(i) for i in q)

    x = xs.popleft()

    if len(q) == 0:
        q.append(x)
        return dfs(xs,q)


    a1 = copy.copy(xs)
    a2 = copy.copy(xs)

    q1 = copy.copy(q)
    q2 = copy.copy(q)

    q1.append(x)

    y  = q2.pop()
    yx = y + x
    q2.append(yx)

    return dfs(a1,q1) + dfs(a2,q2)


s  = str(input())
xs = deque(list(s))

print(dfs(xs,deque([])))

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

sys.setrecursionlimit(1000000000)

def dfs(xs,q):
    if len(xs) == 0:
        return sum(int(i) for i in q)

    x = xs.popleft()

    if len(q) == 0:
        q.append(x)
        return dfs(xs,q)


    a1 = xs.copy()
    a2 = xs.copy()

    q1 = q.copy()
    q2 = q.copy()

    q1.append(x)

    y  = q2.pop()
    yx = y + x
    q2.append(yx)

    return dfs(a1,q1) + dfs(a2,q2)


s  = str(input())
xs = deque(list(s))

print(dfs(xs,deque([])))

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

sys.setrecursionlimit(1000000000)

def dfs(xs):
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x + x + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(dfs(xs))

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

def dfs(xs):
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x * 2 + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(dfs(xs))

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

def dfs(xs):
    print("xs",xs)
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x * 2 + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(dfs(xs))

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

def dfs(xs):

    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(dfs(xs))
Problem p04012 (python)

Fixed submission:
from collections import Counter
S = list(input())

C = Counter(S)

ok = True
for s,x in C.items():
  if x % 2 != 0:
    ok = False
    break

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

Buggy submission (verdict: Runtime Error):
from collection import Counter
S = list(input())

C = Counter(S)

ok = True
for s,x in list(C.items()):
  if x % 2 != 0:
    ok = False
    break

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

Buggy submission (verdict: Runtime Error):
from collection import Counter
S = list(input())

C = Counter(S)

ok = True
for s,x in C.items():
  if x % 2 != 0:
    ok = False
    break

if ok:
  print("Yes")
else:
  print("No")
Problem p03035 (python)

Fixed submission:
i = input().split(' ')

a = int(i[0])
b = int(i[1])

if a >= 13:
	print(b)
elif a >= 6:
	print(b // 2)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
i = input().split(" ")

r = int(i[0])
d = int(i[1])
a = int(i[2])

for i in range(10):
	a = a * r - d
	print(a)
Problem p02983 (python)

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

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            mini = min(mini, (i*j)%2019)
    print(mini)

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

if R-L >= 2019:
    print('0')
else:
    for i in range(L, R+1):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i
            if i % 2019 == 0:
                ans = 0
                print('0')
                break

        for j in range(L, R+1):
            if j == ans:
                continue
            if (j % 2019) < minib:
                minib = j % 2019
                sansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)

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

if R-L > 2019:
    print('0')
else:
    for i in range(L, R):
        if (i % 2019) < mini:
            mini = i % 2019
            ans = i

    for j in range(L, R):
        if j == ans:
            continue
        if (j % 2019) < minib:
            minib = j % 2019
            ansb = j

    calc = ((ans%2019) * (ansb%2019)) % 2019
    print(calc)
Problem p02993 (python)

Fixed submission:
S = list((input()))
fl = True

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        fl = False

if fl == True:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
p = 0
cntC = int(B / C) - int(A / C)
cntD = int(B / D) - int(A / D)

#a,bの最大公約数
def gcd(C, D):
    while D:
        C, D = D, C % D
    return C

#a,bの最小公倍数
def lcm(C, D):
    return C * D // gcd (C, D)


CD = lcm(C, D)

cntCD = int(B / CD) - int(A / CD)

# print(cntC, cntD, cntCD, CD)
calc = (B-A+1) - (cntC + cntD - cntCD)

if (A % C) == 0 and (B % D) == 0:
        calc -= 1

print(calc)
Problem p02554 (python)

Fixed submission:
n = int(input())
MOD = 1000000007

def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

if(n == 1):
    print(0)
elif (n == 2):
    print(2)
else:
    kotae = 0
    a = power_func(10,n,MOD)
    b = power_func(9,n,MOD)
    c = power_func(8,n,MOD)

    kotae = a + c - ( 2 * b)
    kotae = kotae % MOD
    print(kotae)

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

def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

if(n == 1):
    print(0)
elif (n == 2):
    print(2)
else:
    kotae = 0
    a = power_func(10,n,MOD)
    b = power_func(9,n,MOD)
    c = power_func(8,n,MOD)

    kotae = a + c - ( 2 * b)
    kotae = kotae % MOD

print(kotae)

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

if(n == 1):
    print(0)
elif (n == 2):
    print(2)
else:
    kotae = 0
    a = 1
    b = 1
    c = 1
    for i in range(n):
        a *= 10
        b *= 9
        c *= 8
        a = a % MOD
        b = b % MOD
        c = c % MOD
    kotae = a + c - ( 2 * b)
    kotae = kotae % MOD

print(kotae)
Problem p02675 (python)

Fixed submission:
n = int(input())

n = n % 10

if(n == 2 or n == 4 or n == 5 or n == 7 or n == 9):
    print("hon")
elif(n == 3):
    print("bon")
else:
    print("pon")

Buggy submission (verdict: Runtime Error):
import math
from queue import Queue
 
n, m = [int(i) for i in input().split()]
 
root = [[ for _ in range(n+1)] for _ in range(n+1)]
 
for i in range(m):
    a, b = [int(i) for i in input().split()]
    root[a][b] = 1
    root[b][a] = 1
 
 
check = [0 for _ in range(n+1)]
check[1] = 1
 
q = Queue()
q.put(1)
 
while ( not q.empty() ):
    now = q.get()
    for i in range(1,n+1):
        if(root[now][i] == 1 and check[i] == 0):
            check[i] = now
            q.put(i)
 
flag = 1
for i in range(2, n+1):
    if(check[i] == 0):
        flag = 0
 
if(flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")
Problem p02678 (python)

Fixed submission:
import math
from queue import Queue

n, m = [int(i) for i in input().split()]

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

for i in range(m):
    a, b = [int(i) for i in input().split()]
    root[a].append(b)
    root[b].append(a)

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

q = Queue()
q.put(1)

while (not q.empty()):
    now = q.get()
    for i in root[now]:
        if (check[i] == 0):
            check[i] = now
            q.put(i)

flag = 1
for i in range(2, n + 1):
    if (check[i] == 0):
        flag = 0

if (flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")

Buggy submission (verdict: Runtime Error):
port math
from queue import Queue
 
n, m = [int(i) for i in input().split()]
 
root = [[ for _ in range(n+1)] for _ in range(n+1)]
 
for i in range(m):
    a, b = [int(i) for i in input().split()]
    root[a][b] = 1
    root[b][a] = 1
 
 
check = [0 for _ in range(n+1)]
check[1] = 1
 
q = Queue()
q.put(1)
 
while ( not q.empty() ):
    now = q.get()
    for i in range(1,n+1):
        if(root[now][i] == 1 and check[i] == 0):
            check[i] = now
            q.put(i)
 
flag = 1
for i in range(2, n+1):
    if(check[i] == 0):
        flag = 0
 
if(flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
from queue import Queue

n, m = [int(i) for i in input().split()]

root = np.zeros((n+1,n+1),dtype=np.int)

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


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

q = Queue()
q.put(1)

while ( not q.empty() ):
    now = q.get()
    for i in range(1,n+1):
        if(root[now][i] == 1 and check[i] == 0):
            check[i] = now
            q.put(i)

flag = 1
for i in range(2, n+1):
    if(check[i] == 0):
        flag = 0

if(flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")
Problem p02837 (python)

Fixed submission:
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007

#n = int(input())
#s = int(input())
#a, b, c, x, y = [int(i) for i in input().split()]
#table = [[int(i)  for i in input().split()] for j in range(m)]
#table = [list(input()) for n in range(r)] #table[h][w]
#p = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#p = [int(input()) for i in range(m)]
#s = input()

#list = list(s)
#a = [0 for _ in range(n+1)]
#dp = [[0 for _ in range(n+1)] for _ in range(n+1)]

n = int(input())
word_list = [[] for i in range(n)]

for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = [int(i) for i in input().split()]
        word_list[i].append((x-1,y))

ans = 0

for i in range(2**n):
    peoples = []
    flag = 1
    for j in range(n):
        if(i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)

    for k in range(n):
        if peoples[k] == 1:
            words = word_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = 0
                    break

    if flag:
        ans = max(ans,sum(peoples))

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import copy
from queue import Queue
import heapq
import numpy as np

MOD = 5000000007

#n = int(input())
#s = int(input())
#a, b, c, x, y = [int(i) for i in input().split()]
#table = [[int(i)  for i in input().split()] for j in range(m)]
#table = [list(input()) for n in range(r)] #table[h][w]
#p = [int(i) for i in input().split()]
#s = [int(i) for i in range(n)]
#p = [int(input()) for i in range(m)]
#s = input()

#list = list(s)
#a = [0 for _ in range(n+1)]
#dp = [[0 for _ in range(n+1)] for _ in range(n+1)]

n = int(input())
word_list = [[] for i in range(n)]

for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = [int(i) for i in input().split()]
        word_list[i].append((x-1,y))

ans = 0

for i in range(2**n):
    peoples = []
    flag = 1
    for j in range(n):
        if(i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    
    for k in range(n):
        if peoples[k] == 1
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = 0
                    break
    
    if flag:
        ans = max(ans,sum(peoples))

print(ans)
Problem p03005 (python)

Fixed submission:
import math

#n = int(input())
n, k = [int(i) for i in input().split()]
#table = [[i for i in input().split()] for n in range(h)]
#table = [list(input()) for n in range(h)]
#list = [int(i) for i in input().split()]
#s = input()
#list = list(s)

#s = [int(input()) for i in range(m)] #m行1列入力

if (k == 1) :
    kotae = 0
else :
    kotae = n - k

print(kotae)

Buggy submission (verdict: Runtime Error):
import math

#n = int(input())
n, k = [int(i) for i in input().split()]
#table = [[i for i in input().split()] for n in range(h)]
#table = [list(input()) for n in range(h)]
#list = [int(i) for i in input().split()]
#s = input()
#list = list(s)

#s = [int(input()) for i in range(m)] #m行1列入力

if (k = 1) :
    kotae = 0
else :
    kotae = n - k

print(kotae)
Problem p02602 (python)

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


for i in range(n-k):
    if lst[i] < lst[i+k]:
        print('Yes')
    else:
        print('No')

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

loc = 1

for _ in range(n-k):
    cur = 1
    for i in range(loc, loc+k):
        cur *= lst[i]

    if cur*lst[loc-1] > cur*lst[loc+1]:
        print('Yes')
    else:
        print('No')
    loc += 1
Problem p02603 (python)

Fixed submission:
n = int(input())
arr = list(map(int,input().split()))
cur=1000
for i in range(n-1):
  p=0
  if arr[i] < arr[i+1]:
    p=cur // arr[i]
  cur += (arr[i+1] - arr[i])*p
print(cur)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split()))
cur=1000
for i in range(n-1):
  p=0
  if arr[i] < arr[i+1]:
    p=cur // a[i]
  cur += (arr[i+1] - arr[i])*cur
print(cur)
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
if n==1:
  print("Yes")
else:
  l=0
  s="Yes"
  for i in range(n):
    if h[i]>=l:
      l=h[i]
    if l-h[i]>=2:
      s="No"
      break
  print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
if n==1:
  print("Yes")
else:
  l=0
  s="Yes"
  for i in range(n):
    if h[i]>=l:
      l=h[i]
    if l-h[i]>=2:
      s="No"
      break
print(s)