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

Fixed submission:
class union_find():
  def __init__(self,n):
    self.n=n
    self.parents=[-1]*n
  def find(self,x):
    if self.parents[x]<0:
      return x
    else:
      self.parents[x]=self.find(self.parents[x])
      return self.parents[x]
  def union(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x==y:
      return 
    if self.parents[x]>self.parents[y]:
      x,y=y,x
    self.parents[x]+=self.parents[y]
    self.parents[y]=x
    
def main():
  N,M=map(int,input().split())
  box=union_find(N)
  for i in range(M):
    x,y,z=map(int,input().split())
    box.union(x-1,y-1)
  box.find(1)
  ans=0
  for i, x in enumerate(box.parents):
    if x<0:
      ans+=1
  print(ans)
main()

Buggy submission (verdict: Runtime Error):
class union_find():
  def __init__(self,n):
    self.n=n
    self.parents=[-1]*n
  def find(self,x):
    if self.parents[x]<0:
      return x
    else:
      self.parents[x]=self.find(self.parents[x])
      return self.parents[x]
  def union(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x==y:
      return 
    if self.parents[x]>self.parents[y]:
      x,y=y,x
    self.parents[x]+=self.parents[y]
    self.parents[y]=x
    
def main():
  N,M=map(int,input().split())
  box=union_find(N)
  for i in range(M):
    x,y,z=map(int,input().split())
    box.union(x,y)
  box.find(1)
  ans=0
  for i, x in enumerate(box.parents):
    if x<0:
      ans+=1
  print(ans)
main()
Problem p03075 (python)

Fixed submission:
box=[]
for i in range(6):
  box.append(int(input()))
flag=0
if box[4]-box[0]>box[5]:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
for i in range(6):
  box[i]=int(input())
flag=0
for i in range(4):
  if (box[i]-box[i+1]) > box[5]:
    flag = 1 #直接通信ができない
  	break
if flag==1:
  print(':(')
else:
  print('Yay!')
Problem p03186 (python)

Fixed submission:
A,B,C = map(int,input().split())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Buggy submission (verdict: Runtime Error):
A,B,C=int(input())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
if A+B >= C:
    print(B+C)
else:
    print(A+2*B+1)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
j=0
for i in range(C):
  j=j+1
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b[0]+b[2:])
print(a*b//100)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(float,input())

print(math.floor(int(a)*b))
Problem p02762 (python)

Fixed submission:
def find(x):
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def unite(x,y):
  x,y=find(x),find(y)
  if x!=y:
    if x>y:
        x,y=y,x
    par[x]+=par[y]
    par[y]=x
    
def same(x,y):
  return find(x)==find(y)

def size(x):
  return-par[find(x)]
  
n,m,k=map(int,input().split())

par=[-1]*n

F=[]
B=[]

f=[set() for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    F.append([a,b])
    
for i in range(k):
    c,d=map(int,input().split())
    B.append([c,d])

for a,b in F:
    a-=1
    b-=1
    unite(a,b)
    f[a].add(b)
    f[b].add(a)

a=[size(i)-len(f[i])-1 for i in range(n)]

for c,d in B:
    c-=1
    d-=1
    if same(c,d):
        a[c]-=1
        a[d]-=1
print(*a)

Buggy submission (verdict: Runtime Error):
def find(x):
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def unite(x,y):
  x,y=find(x),find(y)
  if x!=y:
    if x>y:
        x,y=y,x
    par[x]+=par[y]
    par[y]=x
    
def same(x,y):
  return find(x)==find(y)

def size(x):
  return-par[find(x)]
  
n,m,k=map(int,input().split())

par=[-1]*n

F=[]
B=[]

f=[set() for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    F.append([a,b])
    
for i in range(k):
    c,d=map(int,input().split())
    B.append([c,d])

for a,b in F:
    a-=1
    b-=1
    unite(a,b)
    f[a].add(b)
    f[b].add[a]

a=[size(i)-len(f[i])-1 for i in range(n)]

for c,d in B:
    c-=1
    d-=1
    if same(c,d):
        a[c]-=1
        a[d]-=1
print(*a)
Problem p02793 (python)

Fixed submission:
from fractions import gcd

def lcm(a,b):
    return a*(b//gcd(a,b))

mod=10**9+7

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

L=A[0]
for i in range(1,n):
    L=lcm(L,A[i])
L%=mod

coef=sum(pow(x,mod-2,mod) for x in A)
print(L*coef%mod)

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(a,b):
    return a*(b//gcd(a,b))

mod=10**9+7

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

L=A[0]
for i in range(1,n):
    L=lcm(L,A[i])
L%=mod

ans=0
for i in range(n):
    ans+=(L//A[i])%mod
print(ans)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
from math import sqrt
n=int(input())

A=list(map(int,input().split()))
N=[0]*(10**3+1)
def soi(n):
    cnt_2=0
    while n%2==0:
        n//=2
        cnt_2+=1
    N[2]=max(N[2],cnt_2)
    for j in range(3,int(sqrt(n))+1,2):
        cnt_j=0
        while n%j==0:
            n//=j
            cnt_j+=1
        N[j]=max(N[j],cnt_j)
    if n!=1:
        N[n]=max(N[n],1)

for i in range(n):
    soi(A[i])
L=1
for i in range(1,10**3+1):
    L*=((i)**(N[i]))%mod
ans=0
for i in range(n):
    ans+=(L*pow(A[i],mod-2,mod))%mod
print(ans)
Problem p02833 (python)

Fixed submission:
n=int(input())
cnt_10=0
MAX_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt_2=0
cnt_10=0
if n%2==1:
    print(0)
else:

    for i in range(1000):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)
Problem p02948 (python)

Fixed submission:
import heapq

n,m=map(int,input().split())
X=[[] for _ in range(10**5+5)]
for i in range(n):
    a,b=map(int,input().split())
    X[a-1].append(-b)

ans=0
p=[]
heapq.heapify(p)
for i in range(m):
    if len(p)==0 and len(X[i])==0:
        continue
    for j in range(len(X[i])):
        heapq.heappush(p,X[i][j])
    a=heapq.heappop(p)
    ans+=a*-1
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

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

ans=0
p=[]
heapq.heapify(p)
for i in range(m):
    if len(p)==0 and len(X[i])==0:
        continue
    for j in range(len(X[i])):
        heapq.heappush(p,X[i][j])
    a=heapq.heappop(p)
    ans+=a*-1
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n,m=map(int,input().split())
X=[]
for i in range(n):
    a,b=map(int,input().split())
    X.append([a,-b])
Y=sorted(X,key=lambda x:(x[0]))
ans=0
c=0
x=[0]*n
heapq.heapify(x)
flag=True
for i in range(1,m+1):
    if flag:
        while Y[c][0]<=i:
            heapq.heappush(x,Y[c][1])
            c+=1
            if c==len(Y):
                flag=False
                break
    ans+=heapq.heappop(x)*(-1)
print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial

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

def f(n,k):
    return factorial(n)//(factorial(k)*(factorial(abs(n-k))))

for i in range(k):
    print(f(n-k+1,i+1)*f(k-1,i)%(10**9+7))

Buggy submission (verdict: Runtime Error):
from math import factorial

MOD=10**9+7
n,k=map(int,input().split())
 
blue=1
red=n-k+1


def modpow(x,p,MOD):
    if p==1:
        return x%MOD
    if p>=2:
        if p%2==0:
            p//=2
            return modpow(x,p,MOD)**2%MOD
        else:
            p-=1
            return x*modpow(x,p,MOD)%MOD
 
for i in range(k):
    red=factorial(k-1)*modpow(factorial(i),MOD-2,MOD)*modpow(factorial(k-i-1),MOD-2,MOD)%MOD
    blue=factorial(n-k+1)*modpow(factorial(i+1),MOD-2,MOD)*modpow(factorial(n-k-i),MOD-2,MOD)%MOD
    print(red*blue)
Problem p03038 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=[]
for i in range(m):
    b,c=map(int,input().split())
    x.append([b,c])
y=sorted(x,key=lambda x:(x[1],x[0]),reverse=True)

p=0
q=0
for i in range(n):
    if a[i]<y[p][1]:
        a[i]=y[p][1]
        q+=1
    else:
        break
    if q==y[p][0]:
        p+=1
        q=0
        if p==m:
            break

print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=[]
for i in range(m):
    b,c=map(int,input().split())
    x.append([b,c])
y=sorted(x,key=lambda x:(x[1],x[0]),reverse=True)

d=[]
for i in range(m):
    d.extend([y[i][1]]*y[i][0])

for i in range(n):
    if d[i]>a[i]:
        a[i]=d[i]
    else:
        break
print(sum(a))
Problem p03104 (python)

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

if a%2==0:
    fa=(a//2)%2
else:
    fa=(((a-1)//2)%2)^(a-1)

if b%2==0:
    fb=((b//2)%2)^b
else:
    fb=((b+1)//2)%2
    
print(fb^fa)

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

for i in range(50):
    if a>=2**i and a<2**(i+1):
        A=i+1
    if b>=2**i and b<2**(i+1):
        B=i+1

N=[0]*B

for i in range(a,2**A):
    X=format(i,'b')
    for j in range(-1,-A-1,-1):
        N[j]+=int(X[j])
    
for i in range(2**(B-1),b+1):
    Y=format(i,'b')
    for j in range(B):
        N[j]+=int(Y[j])
ans=0
for i in range(B):
    if N[i]%2==1:
        ans+=2**(B-i-1)
print(ans)
Problem p03107 (python)

Fixed submission:
s=input()

x=s.count('1')
y=s.count('0')

a=max(x,y)
b=min(x,y)

print(len(s)-(a-b))

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

x='10'
y='01'

def hoge(s):
    if x in s or y in s:
        for i in range(len(s)-1):
            if s[i]+s[i+1]==x or s[i]+s[i+1]==y:
                s=s[:i]+s[i+2:]
                
                return hoge(s)+2
    else:
        return 0

print(hoge(s))
Problem p03127 (python)

Fixed submission:
n=int(input())
X=list(map(int,input().split()))
x=X[0]
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a


for i in range(1,n):
    x=gcd(x,X[i])
if x!=1:
    print(x)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
X=list(map(int,input().split()))
x=X[0]
for i in range(1,n):
    x=math.gcd(x,X[i])

if x!=1:
    print(x)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import itertools

n=int(input())

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



def amari(a,b):
    x=max(a,b)
    y=min(a,b)
    return x%y

while len(X)>1:
    Y=list(itertools.combinations(X,2))
    Z=[]
    for i in range(len(Y)):
        z=amari(Y[i][0],Y[i][1])
        if z>0:
            Z.append(z)
    X=list(set(Z))
    
print(X[0])
Problem p03137 (python)

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

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

X.sort()

C=[]
for i in range(m-1):
    c=abs(X[i+1]-X[i])
    C.append(c)

if(n>=m):
    print(0)
else:
    C.sort()
    sum_c=0
    for j in range(len(C)-n+1):
        sum_c+=C[j]
    print(sum_c)

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

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

X.sort()

C=[]
for i in range(m-1):
    c=abs(X[i+1]-X[i])
    C.append(c)

C.sort()

sum_c=0
for  j in range(n+1):
    sum_c+=C[j]
    
print(sum_c)
Problem p03208 (python)

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

x=[]
for i in range(n):
    x.append(int(input()))

x.sort()

y=[]

for j in range(n-k+1):
  p=x[j+k-1]-x[j]
  y.append(p)

y.sort()

print(y[0])

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

x=[]
for i in range(n):
    x.append(int(input()))

x.sort()

y=[]

for j in range(n):
  p=x[j+k-1]-x[j]
  y.append(p)

y.sort()

print(y[0])
Problem p03426 (python)

Fixed submission:
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j
M=[[0] for _ in range(D)]
for d in range(D):
    for k in range((H*W)//D):
        M[d].append(abs(X[d][k+1][0]-X[d][k][0])+abs(X[d][k+1][1]-X[d][k][1])+M[d][k])

for i in range(Q):
    L,R=map(int,input().split())
    print(M[L%D][R//D]-M[L%D][L//D])

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[0,0] for _ in range(H*W)]
for i in range(H):
    for j in range(W):
        X[A[i][j]][0]=i
        X[A[i][j]][1]=j
M=[0]*(H*W+1)
for d in range(D+1,H*W+1):
        M[d]=abs(X[d][0]-X[d-D][0])+abs(X[d][1]-X[d-D][1])+M[d-D]

for i in range(Q):
    L,R=map(int,input().split())
    print(M[R]-M[L])
Problem p02726 (python)

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

cnt=[0 for i in range(n)]

for i in range(1,n+1):
  for j in range(i+1,n+1):
    a=min(abs(x-i),abs(y-i))
    b=min(abs(x-j),abs(y-j))
    l=min(j-i,a+b+1)
    cnt[l] += 1
      
for i in range(1,n):
  print(cnt[i])

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

cnt={}
for i in range(1,n+1):
  for j in range(i+1,n+1):
    if i <= x and y <= j:
      cnt[(j-y)-(x-i)+1] += 1
    else:
      cnt[j-i] += 1
      
for i in range(1,n):
  print(cnt[i])
Problem p02766 (python)

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

cnt = 0

while(n > 0):
  n //= int(k)
  cnt += 1
  int(n)

print(cnt)

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

while(n > 0):
  n /= k
  cnt += 1

print(cnt)
Problem p02785 (python)

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

h.sort()

if k > n:
    print(0)
    exit()

for i in range(k):
    h[n-i-1] = 0

s = sum(h)

print(s)

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

h.sort()

for i in range(k):
    h[n-1-i] = 0

s = sum(h)

print(s)
Problem p02831 (python)

Fixed submission:

A,B = map(int,input().split())

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

R = (A * B) / gcd(A, B)

print(int(R))

Buggy submission (verdict: Runtime Error):
import math

A,B = map(int,input().split())

R = (A * B) / math.gcd(A, B)

print(int(R))

Buggy submission (verdict: Runtime Error):
import math

A,B = map(int,input().split())

R = (A * B) // math.gcd(A, B)

print(R)
Problem p02951 (python)

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

C = C - (A - B)
if C < 0:
    C = 0
print(C)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

C = C - (A - B)
if C < 0:
    C = 0
print(C)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())

C =- (A - B)
print(C)

Buggy submission (verdict: Runtime Error):
A = imput()
B = imput()
C = imput()

C =- (A - B)
print(C)
Problem p02679 (python)

Fixed submission:
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
MOD = 10**9+7
# MOD = 998244353

n = int(input())
E = [list(map(int, input().split())) for i in range(n)]
d = defaultdict(int)
for e in E:
    if e[0] == 0 and e[1] == 0:
        d[(0, 0)] += 1
    elif e[0] == 0:
        d[(0, 1)] += 1
    elif e[1] == 0:
        d[(1, 0)] += 1
    else:
        g = math.gcd(e[0], e[1])
        a, b = e[0]//g, e[1]//g
        if b < 0:
            a, b = -a, -b
        d[(a, b)] += 1

pd = 1
non = n - d[(0, 0)]
for k in d:
    if k == (0, 0) or k == (1, 0):
        continue

    elif k == (0, 1) and (1, 0) in d:
        a, b = d[(0, 1)], d[(1, 0)]
        pd = (pd * (pow(2, a, MOD) + pow(2, b, MOD) - 1)) % MOD
        non -= (a + b)

    elif k[0] > 0 and (-k[1], k[0]) in d:
        a, b = d[k], d[(-k[1], k[0])]
        pd = (pd*(pow(2, a, MOD) + pow(2, b, MOD) - 1))%MOD
        # print(a, b, pd)
        non -= (a+b)

# print(non, pd)
total = (pow(2, non, MOD)*pd - 1 + d[(0, 0)])%MOD
print(total)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
MOD = 10**9+7
# MOD = 998244353

n = int(input())
E = [list(map(int, input().split())) for i in range(n)]
d = defaultdict(int)
for e in E:
    if e[0] == 0 and e[1] == 0:
        d[(0, 0)] += 1
    elif e[0] == 0:
        k = 1 if e[1] > 0 else -1
        d[(0, k)] += 1
    elif e[1] == 0:
        k = 1 if e[0] > 0 else -1
        d[(k, 0)] += 1
    else:
        gcd = math.gcd(e[0], e[1])
        a, b = e[0]//gcd, e[1]//gcd
        if b < 0:
            a, b = -a, -b
        d[(a, b)] += 1

pd = 1
non = n
for k in d:
    if k[0] >= 0 and (-k[1], k[0]) in d:
        a, b = d[k], d[(-k[1], k[0])]
        pd = (pd*(pow(2, a, MOD) + pow(2, b, MOD) - 1))%MOD
        # print(a, b, pd)
        non -= (a+b)

# print(non, pd)
total = (pow(2, non, MOD)*pd - 1)%MOD
print(total)
Problem p02834 (python)

Fixed submission:
from collections import defaultdict, Counter, namedtuple, deque

NN = 202020
MOD = 10**9+7
INF = float("inf")

n, u, v = map(int, input().split())
Edge = [list(map(int, input().split())) for _ in range(n-1)]
u -= 1
v -= 1
graph = [[] for _ in range(n)]
for a, b in Edge:
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)


def bfs(start, player):
    que = deque([(start, -1, 0)])
    while que:
        node, par, dst = que.popleft()
        # print(node, par, dst)
        if len(graph[node]) == 1:
            # print(player, node)
            dst_dict[player][node] = dst

        for nxt in graph[node]:
            if nxt == par:
                continue
            que.append((nxt, node, dst+1))


dst_dict = [{}, {}]
bfs(u, 0)
bfs(v, 1)
# print(dst_dict[0], dst_dict[1])

max_time = 0
for k in dst_dict[0]:
    if dst_dict[0][k] < dst_dict[1][k]:
        max_time = max(max_time, dst_dict[1][k]-1)

print(max_time)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
from typing import NamedTuple
from fractions import gcd

NN = 202020
MOD = 10**9+7
INF = float("inf")

n, u, v = map(int, input().split())
Edge = [list(map(int, input().split())) for _ in range(n-1)]
u -= 1
v -= 1
graph = [[] for _ in range(n)]
for a, b in Edge:
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(start, player):
    que = deque([(start, -1, 0)])
    while que:
        node, par, dst = que.popleft()
        # print(node, par, dst)
        if len(graph[node]) == 1:
            # print(player, node)
            dst_dict[player][node] = dst

        for nxt in graph[node]:
            if nxt == par:
                continue
            que.append((nxt, node, dst+1))


dst_dict = [{}, {}]
bfs(u, 0)
bfs(v, 1)
# print(dst_dict[0], dst_dict[1])

max_time = 0
for k in dst_dict[0]:
    if dst_dict[0][k] < dst_dict[1][k]:
        max_time = max(max_time, dst_dict[1][k]-1)

print(max_time)
Problem p02879 (python)

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

if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)

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

if 1<=a<=9 and 1<=b<=9:
  return a*b
else:
  return -1
Problem p02659 (python)

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

a = int(a)
b = b.replace(".", "")
b = int(b)
print(int(a*b)//100)

Buggy submission (verdict: Runtime Error):

a, b = list(input().split())

a = int(a)
b = b.replace(".","")
b= int(b)
print(int(a*b/100)

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


def xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example:
        input   1
        retrun  1

        input   1 2 3
        return  [1,2,3]
        input   1 2 3
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        temp = list(map(int, input().split()))
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        temp = [list(map(int, input().split())) for _ in range(n)]
        return temp


def sp_xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example
        input   1
        retrun  [1]

        input   123
        return  [1,2,3]

        input   123
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        return [int(k) for k in xsxs()]
    else:
        return [[int(k) for k in xsxs()] for _ in range(n)]


def xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
    example:
        input   AA
        retrun  AA

        input   A BBB CC
        return  ["A","BBB","CC"]

        input   A BB CCC
                D
        return  [["A","BBB","CC"],
                ["D"]]
    """
    if n == 0:
        temp = list(input().split())
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        return [list(input().split()) for _ in range(n)]


def sp_xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
        example:
            input   A
            retrun  ["A"]

            input   ABC
            return  ["A","B","C"]

            input   ABC
                    D
            return  [["A","B","C"],
                    ["D"]]
    """
    if n == 0:
        return [s for s in xsxs()]
    else:
        return [[s for s in xsxs()] for _ in range(n)]


a, b = xnxn()

print(int(a*b))
Problem p02688 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
l = [1] * n
for i in range(k):
    d = ni()
    a = na()
    for i in range(d):
        l[a[i] - 1] = 0
print(sum(l))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
l = [1] * 3
for i in range(k):
    d = ni()
    a = na()
    for i in range(d):
        l[a[i] - 1] = 0
print(sum(l))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
l = [1] * 3
for i in range(k):
    d = ni()
    a = na()
    for i in range(d):
        l[a[i] - 1] = 0
print(sum(l))