Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
    n=int(input())
    d=readLine_int_list()
    m=int(input())
    t=readLine_int_list()
    
    set_d = set(d)
    set_t = set(t)
    ans = "YES"
    if len(set_t - set_d) > 0:
        ans = "NO"
    else:
        for i in set_t:
            t_cnt = t.count(i)
            d_cnt = d.count(i)
            if t_cnt - d_cnt > 0:
                ans = "NO"
    print(ans)
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
    d = defaultdict(lambda: 0)
    t = defaultdict(lambda: 0)
    
    n=int(input())
    _d=readLine_int_list()
    for i in _d:
        d[i] += 1
        
    m = int(input())
    _t = readLine_int_list()
    
    for i in _t:
        t[i] += 1
    
    ans = "YES"
    for i in t:
        if i in d:
            if t[i] - d[i] > 0:
                ans = "NO"
                break
        else:
            ans = "NO"
            break
    print(ans)
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
    n=int(input())
    d=readLine_int_list()
    m=int(input())
    t=readLine_int_list()
    f = True
    for i in t:
        if i in d:
            d.pop(d.index(i))
        else:
            f = False
            break
    if f:
        print("YES")
    else:
        print("NO")
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
    d = defaultdict(lambda: 0)
    t = defaultdict(lambda: 0)
    
    n=int(input())
    _d=readLine_int_list()
    for i in _d:
        d[i] += 1
        
    m = int(input())
    _t = readLine_int_list()
    
    for i in _t:
        t[i] += 1
    
    ans = "YES"
    for i in t:
        if i in d:
            if t[i] - d[i] > 0:
                ans = "NO"
                break
        else:
            ans = "NO"
            break
    print(ans)
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

memo={}
for h in range(1, 3501):
    for n in range(1, 3501):
        if (h,n) not in memo:
            memo[n,h] = True
            a = 4 * h * n - h * N - n * N
            if a == 0:
                break
            w = int((h * n * N) / a)
            if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
                print(h, n, w)
                exit()
        else:
            continue

Fixed submission:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()

Buggy python submission (verdict: Runtime Error):
N = int(input())
flag = False
memo = {}
for a in range(1,3500)[::-1]:
    for b in range(1,3500)[::-1]:
        if (a,b) not in memo:
            memo[(b,a)] = True
            if (N*a*b)%(4*a*b -N*n - N*b) == 0:
                c = int((N*a*b)/(4*a*b -N*n - N*b))
                flag = True
                break
        else:
            continue
    if flag:
        break
print(a,b,c)

Fixed submission:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()

Buggy python submission (verdict: Runtime Error):
n = int(input())
flag = False
memo = {}
for a in range(1,3500)[::-1]:
    for b in range(1,3500)[::-1]:
        if (a,b) not in memo:
            memo[(b,a)] = True
             
            if (N*a*b)%(4*a*b -N*n - N*b) == 0:
                c = int((N*a*b)/(4*a*b -N*n - N*b))
                flag = True
                break
        else:
            continue
    if flag:
        break
print(a,b,c)

Fixed submission:
N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from sys import stdin

def AI(): return list(map(int, stdin))



def main():
	n = int(input())
	A = AI()

	set_A = set(A)
	ans = 0

	for i in set_A:
		c = A.count(i)
		if  c%2 != 0:
			ans += 1
	print(ans)

	
if __name__ == "__main__": main()



Fixed submission:
n = int(input())
card = set()

for i in range(n):
    num = int(input())
    if num in card:
        card.remove(num)
    else:
        card.add(num)
print(len(card))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
card = []
for i in range(n):
    num = int(input())
    if num in card:
        card.remove(num)
    else:
        card.append(num)
print(len(card))

Fixed submission:
n = int(input())
card = set()

for i in range(n):
    num = int(input())
    if num in card:
        card.remove(num)
    else:
        card.add(num)
print(len(card))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
cnt = [0]*100002
for i in a:
    cnt[i-1] += 1
    cnt[i] += 1
    cnt[i+1] += 1
print(max(cnt))

Fixed submission:
x, t = (int(i) for i in input().split())
ans = x-t
if ans < 0:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
max_num = max(a)
cnt = [0]*(max_num+1)

for i in a:
    cnt[i] = cnt[i]+1

maxn = cnt[0] + cnt[1]

for i in range(max_num):
    maxn = max(maxn, cnt[i-1] + cnt[i] + cnt[i+1])
    
print(maxn)

Fixed submission:
n = int(input())
cnt = [0]*100002
for i in list(int(i) for i in input().split()):
    cnt[i-1] += 1
    cnt[i] += 1
    cnt[i+1] += 1
print(max(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = int(input())
    a = readLine_int_list()
    set_a = sorted(list(set(a)), reverse=True)
    
        
    
    pair = []
    
    ans = 0
    if len(a) - len(set_a) == 1:
        print(ans)
    else:
        for i in set_a:
            c = a.count(i)
            if c > 3:
                pair.append(i)
                pair.append(i)
            elif c > 1:
                pair.append(i)
                
            if len(pair) >= 2:
                ans = pair[0] * pair[1]
                break
    
        print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = int(input())
    a = sorted(readLine_int_list(),reverse=True)
    a.append(-1)
    pair = []
    ans = 0
    t = 1
    
    for i in range(n):
        
        if a[i] == a[i+1]:
            t += 1
        else:
            if t > 1:
                pair.append(a[i])
                if len(pair) == 2:
                    ans = pair[0] * pair[1]
                    break
            t = 1
        
        if t > 3:
            if pair:
                ans = max(a[i-1]*a[i], pair[0]*a[i])
            else:
                ans = a[i]**2
            break

        
        

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = int(input())
    a = readLine_int_list()
    set_a = sorted(list(set(a)), reverse=True)
    
    pair = []
    
    ans = 0
    for i in set_a:
        c = a.count(i)
        if c > 3:
            pair.append(i)
            pair.append(i)
        elif c > 1:
            pair.append(i)
            
        if len(pair) >= 2:
            ans = pair[0] * pair[1]
            break

    print(ans)
if __name__ == '__main__':
    main()


Fixed submission:
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = int(input())
    a = sorted(readLine_int_list(),reverse=True)
    a.append(-1)
    pair = []
    ans = 0
    t = 1
    
    for i in range(n):
        
        if a[i] == a[i+1]:
            t += 1
        else:
            if t > 1:
                pair.append(a[i])
                if len(pair) == 2:
                    ans = pair[0] * pair[1]
                    break
            t = 1
        
        if t > 3:
            if pair:
                ans = max(a[i-1]*a[i], pair[0]*a[i])
            else:
                ans = a[i]**2
            break

        
        

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n, m = (int(i) for i in input().split())
island = [[] for i in range(n)]

for i in range(m):
    a, b = (int(i)-1 for i in input().split())
    if a == 0:
        island[a].append(b)
    elif a == n-1:
        island[n-1].append(b)
    elif b == 0:
        island[b].append(a)
    elif b == n-1:
        island[n-1].append(a)

ans = "IMPOSSIBLE"
for i in island[0]:
    if i in island[n-1]:
        ans = "POSSIBLE"
        break

print(ans)

Fixed submission:
n = str(input())
print("ABC"+n)

Buggy python submission (verdict: Runtime Error):
n, m = (int(i) for i in input().split())
island = [[] for i in range(n)]

for i in range(m):
    a, b = (int(i)-1 for i in input().split())
    if a == 0:
        island[a].append(b)
    elif a == n-1:
        island[n-1].append(b)
    elif b == 0:
        island[b].append(a)
    elif b == n-1:
        island[n-1].append(a)

print(island)
ans = "IMPOSSIBLE"
for i in island[0]:
    if i in island[n-1]:
        ans = "POSSIBLE"
        break

print(ans)

Fixed submission:
n = str(input())
print("ABC"+n)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    a = gcd(lst[0],lst[1])
    i=2
    while a > 0 and i<len(lst):
        a = gcd(a, lst[i])
        if a == 1:
            return 1
            break
        i+=1
    return a
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  
maxA=max(a)

if maxA >= k and k%gcd_list(a) == 0:
    print("POSSIBLE")
elif k in a:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    g = lst[0]
    for i in range(1,len(lst)):
        g = gcd(g,lst[i])
    return g
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  

maxA=max(a)

if (k <= maxA and k%gcd_list(a) == 0) or (k in a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    a = gcd(lst[0],lst[1])
    i=2
    while a > 0 and i<len(lst):
        a = gcd(a, lst[i])
        if a == 1:
            return 1
            break
        i+=1
    return a
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  
maxA=max(a)

if maxA >= k and gcd_list(a)%k == 0:
    print("POSSIBLE")
elif k in a:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
    

Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    g = lst[0]
    for i in range(1,len(lst)):
        g = gcd(g,lst[i])
    return g
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  

maxA=max(a)

if (k <= maxA and k%gcd_list(a) == 0) or (k in a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    a = gcd(lst[0],lst[1])
    i=2
    while a > 0 and i<len(lst):
        a = gcd(a, lst[i])
        if a == 1:
            return 1
            break
        i+=1
    return a
    
n, k = (int(i) for i in input().split())
print(n,k)
a = list(int(i) for i in input().split())  
print(a)
maxA=max(a)

if maxA >= k and gcd_list(a)%k == 0:
    print("POSSIBLE")
elif k in a:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
    

Fixed submission:
def gcd(a,b):
    while b > 0:
        a, b = b, a%b
    return a

def gcd_list(lst):
    g = lst[0]
    for i in range(1,len(lst)):
        g = gcd(g,lst[i])
    return g
    
n, k = (int(i) for i in input().split())
a = list(int(i) for i in input().split())  

maxA=max(a)

if (k <= maxA and k%gcd_list(a) == 0) or (k in a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
i = int(input())
a = list(map(int, input().split()))
ans=[]
for i in range(1,len(a)):
    x = 0
    y = 0
    for n in range(i):
        x += a[n]
    for m in range(i,len(a)):
        y += a[m]
    ans.append(abs(x-y))
print(min(ans))

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

s=[]
s.append(0)
l = sum(a)
ans=[]
for i in range(1,n):
    s.append(s[i-1]+a[i-1])
    x = s[i]
    y = l-s[i]
    ans.append(abs(x-y))
print(min(ans))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !

n = int(input())
a = input().split()
a_int = sorted(list(map(int,a )))
print(a_int)
max_a = max(a_int)

col = [0,0,0,0,0,0,0,0]
all_col = 0 

for i in range(len(a_int)):
    if a_int[i] < 400:
        col[0] += 1
    elif a_int[i] < 800:
        col[1] += 1
    elif a_int[i] < 1200:
        col[2] += 1
    elif a_int[i] < 1600:
        col[3] += 1
    elif a_int[i] < 2000:
        col[4] += 1
    elif a_int[i] < 2400:
        col[5] += 1
    elif a_int[i] < 2800:
        col[6] += 1
    elif a_int[i] < 3200:
        col[7] += 1
    else:
        all_col += 1

min_c = len(list(filter((lambda x: x > 0), col)))
max_c = min_c + all_col
if max_c > 8:
    max_c -= max_c -8
print(str(min_c)+'  ' +str(max_c))



Fixed submission:
r = input().split()
ans = int(r[0]) * 100 + int(r[1]) *10 + int(r[2])
if ans%4 == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
r = input().split()
max_i= max(r)
min_i= min(r)
print(max_i - min_i)

Fixed submission:
n = input()
r = input().split()
r =list(map(int,r))
max_i= max(r)
min_i= min(r)
print(max_i - min_i)
Buggy python submission (verdict: Runtime Error):
a,b = list(int(i) for i in input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a==b:
    print("Draw")
else:
    print("Alice" if a>b else "Bob")

Fixed submission:
def read_str_list():
    return list(str(i) for i in input().split())
a,b = read_str_list()
if a == "H":
    print(b)
else:
    if b == "H":
        print("D")
    else:
        print("H")
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(800*n -(n%15)＊200)

Fixed submission:
n = int(input())
print(800*n -(n//15)*200)
Buggy python submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit
setrecursionlimit(5000)
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readAll_int(): return list(list(map(int,i.split())) for i in stdin.read().split("\n"))
 
 
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def ratio(a,b):
    return (a//gcd(a,b), b//gcd(a,b))
 
def add_ratio(a,b):
    if a != 0:
        sum_a = sum(a)
        sum_b = sum(b)
        _a = a[0]*sum_b + b[0]*sum_a
        _b = b[1]*sum_a + a[1]*sum_b
        return ratio(_a, _b)
    else:
        return(b)
 
def dfs(i, v, r,ans):
    if i == n:
        if r == (Ma,Mb):
            ans.append(v)
        return 0

    if dfs(i+1, v, r,ans):
        return 0
    
    if dfs(i+1, v+D[i][2], add_ratio(r,ratio(D[i][0],D[i][1])), ans):
        return 0
 
    return 0
ans = []
n, Ma, Mb = readLine_int_list()
D = readAll_int()
e=0
for i in D:
    e += i[2]

def main():
    dfs(0,0,0,ans)
    if ans:
        print(min(ans))
    else:
        print(-1)
 
if __name__ == "__main__":
    main()

Fixed submission:
a,b = list(int(i) for i in input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a==b:
    print("Draw")
else:
    print("Alice" if a>b else "Bob")
Buggy python submission (verdict: Runtime Error):
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_I(): return map(int, stdin)
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

class BIT(object):

	def __init__(self,l):
		self.size = l
		self.bit = [0]* (self.size+1)

	def sum(self, i):
		s = 0
		while i > 0:
			s += self.bit[i]
			i -= i & -i
		return s

	def add(self, i, x):
		while i < self.size:
			self.bit[i] += x
			i += i & -i

	def __str__(self):
		return str(self.bit)


def main():
	N,M = LI()

	bit = BIT(M+2)
	L = []
	R = []
	b = [[] for i in range(M+1)]


	for i in range(N):
		l,r = LI()
		L.append(l); R.append(r)
		b[r-l +1].append(i)
	b = []

	gone = 0
	for d in range(1, M+1):
		for i in b[d]:
			gone+=1
			bit.add(L[i], 1)
			bit.add(R[i]+1, -1)


		ans = N-gone

		for m in range(d, M+1, d):

			ans += bit.sum(m)
		print(ans)




if __name__ == '__main__':
	main()

Fixed submission:
from math import ceil
def main(): print(ceil((int(input())-6)/11*2)+1)
if __name__ == "__main__": main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_I(): return map(int, stdin)
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

class BIT(object):

	def __init__(self,l):
		self.size = l
		self.bit = [0]* (self.size+1)

	def sum(self, i):
		s = 0
		while i > 0:
			s += self.bit[i]
			i -= i & -i
		return s

	def add(self, i, x):
		while i < self.size:
			self.bit[i] += x
			i += i & -i

	def __str__(self):
		return str(self.bit)


def main():
	N,M = LI()

	bit = BIT(M+2)
	L = []
	R = []
	b = [[] for i in range(M+1)]


	for i in range(N):
		l,r = LI()
		L.append(l); R.append(r)
		b[r-l +1].append(i)


	gone = 0
	for d in range(1, M+1):
		for i in b[d]:
			gone+=1
			bit.add(L[i], 1)
			bit.add(R[i]+1, -1)


		ans = N-gone

		for m in range(d, M+1, d):

			ans += bit.sum(m)
		print(ans)




if __name__ == '__main__':
	main()

Fixed submission:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque
 
 
# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")
 
 
##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_I(): return map(int, stdin)
def ALL_IL(): return LM(int,stdin)
 
##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))
 
 
 
##### main #####
 
class BIT(object):
 
	def __init__(self,l):
		self.size = l
		self.bit = [0]* (self.size+1)
 
	def sum(self, i):
		s = 0
		while i > 0:
			s += self.bit[i]
			i -= i & -i
		return s
 
	def add(self, i, x):
		while i < self.size:
			self.bit[i] += x
			i += i & -i
 
	def __str__(self):
		return str(self.bit)
 
 
def main():
	N,M = LI()
 
	bit = BIT(M+2)
	L = []
	R = []
	b = [[] for i in range(M+1)]
 
 
	for i in range(N):
		l,r = LI()
		L.append(l); R.append(r)
		b[r-l +1].append(i)
 
 
	gone = 0
	for d in range(1, M+1):
		for i in b[d]:
			gone+=1
			bit.add(L[i], 1)
			bit.add(R[i]+1, -1)
 
 
		ans = N-gone
 
		for m in range(d, M+1, d):
 
			ans += bit.sum(m)
		print(ans)
 
 
 
 
if __name__ == '__main__':
	main()
Buggy python submission (verdict: Runtime Error):
def readLine_str_list():return list(map(str, stdin.readline().split(',')))
def main():
    s = readLine_str_list()
    print(' '.join(s))

if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin, stdout
def readLine_str_list():return list(map(str, stdin.readline().split(',')))
def main():
    s = readLine_str_list()
    print(' '.join(s))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
        
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x==y: return
    if rank[x]<rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x]+=1
            
def same(x,y):
    return find(x)==find(y)
    
n,m = readLine_int_list()
v = n + m
par = [i for i in range(0, n)]
rank = [1] * n
def main():
    G = [readLine_int_list()[1:] for i in range(n)]
    
    for i in range(n):
        for ii in G[i]:
            for j in range(i+1,n):
                if ii in G[j]:
                    unite(i,j)

    # print(par)
    
    r = "YES"
    for i in range(0, n):
        if find(i) != find(0):
            r = "NO"
    print(r)
    
    
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
        
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x==y: return
    if rank[x]<rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x]+=1
            
def same(x,y):
    return find(x)==find(y)
    
n,m = readLine_int_list()
v = n + m
par = [i for i in range(0, v)]
rank = [1] * v
def main():
    for i in range(n):
        for ii in readLine_int_list()[1:]:
           unite(i, ii-1+n)
           
    r = "YES"
    for i in range(0, n):
        if find(i) != find(0):
            r = "NO"
    print(r)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n= (int(i) for i in input().split())
n.sort()
if n[0]+n[1]==n[2]:
    print("Yes")
else:
    print("No")

Fixed submission:
n=list(int(i) for i in input().split())
n.sort()
if n[0]+n[1]==n[2]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = list(int(i) in input().split())
n.sort()
if n[0]+n[1]==n[2]:
    print("Yes")
else:
    print("No")

Fixed submission:
n=list(int(i) for i in input().split())
n.sort()
if n[0]+n[1]==n[2]:
    print("Yes")
else:
    print("No")