Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
Ts = list(map(int, input().split()))
M = int(input())
Ds = []
O = str(input())
E = str(input())

ma = max(len(O), len(E))

for i in range(ma):
    if (i < len(O)):
        print(O[i], end="")
    if (i < len(E)):
        print(E[i], end="")

Fixed submission:
O = str(input())
E = str(input())

ma = max(len(O), len(E))

for i in range(ma):
    if (i < len(O)):
        print(O[i], end="")
    if (i < len(E)):
        print(E[i], end="")

Buggy python submission (verdict: Runtime Error):
O = str(input())
E = str(input())

ma = max(len(O), len(E))

for i in range(ma):
    if (i < len(O)):
        print(O[i], end="")
    if (i < len(E)):
        print(E[i], end="")
----


Fixed submission:
O = str(input())
E = str(input())

ma = max(len(O), len(E))

for i in range(ma):
    if (i < len(O)):
        print(O[i], end="")
    if (i < len(E)):
        print(E[i], end="")
Buggy python submission (verdict: Runtime Error):
def digits(num):
    return len(str(num))

N = int(input())
min_d = digits(N)
for i in list(range(2, N, 1)):
    if (N % i == 0):
        min_d = min(digits(i), min_d)

print(min_d)


Fixed submission:
l = input().split()
A = l[0]
B = l[1]
C = int(A) + int(B)
time = C % 24

print(time)
Buggy python submission (verdict: Runtime Error):
def imp_kai(n):
    ac = 1
    for i in range(n):
        ac *= i + 1
        ac = ac % (1e9 + 7)
    return ac % (1e9 + 7)
-
n = int(input())
print(imp_kai(n))


Fixed submission:
def imp_kai(n):
    ac = 1
    for i in range(n):
        ac *= i + 1
        ac = ac % (1e9 + 7)
    return ac % (1e9 + 7)

n = int(input())
print(int(imp_kai(n)))

Buggy python submission (verdict: Runtime Error):
def kai(n):
  if (n == 1):
    return 1
  else:
    return n * kai(n-1) % (1e9 + 7)

n = int(input())
print(kai(n))


Fixed submission:
def imp_kai(n):
    ac = 1
    for i in range(n):
        ac *= i + 1
        ac = ac % (1e9 + 7)
    return ac % (1e9 + 7)

n = int(input())
print(int(imp_kai(n)))
Buggy python submission (verdict: Runtime Error):
x = input().split('\n')
n = int(x[0])
w = [x[i] for i in range(1, n+1)]

def chk_shiri(w):
    for i in range(n - 1):
        if w[i][-1] == w[i + 1][0]:
            continue
        else:
            return False
    return True
    
if len(w) != len(set(w)):
    print('No')
elif chk_shiri(w):
    print('Yes')
else:
    print('No')
    

Fixed submission:
n = int(input())
w = []
for i in range(n):
    w.append(input())

def chk_shiri(w):
    for i in range(n - 1):
        if w[i][-1] == w[i + 1][0]:
            continue
        else:
            return False
    return True
    
if len(w) != len(set(w)):
    print('No')
elif chk_shiri(w):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
x = input().split('\n')
n = int(x[0])
w = [x[i] for i in range(1, n+1)]

def chk_shiri(w):
    for i in range(n - 1):
        if w[i][-1] == w[i + 1][0]:
            continue
        else:
            return False
    return True
    
if len(w) != len(set(w)):
    print('No')
elif chk_shiri(w):
    print('Yes')
else:
    print('No')
    

Fixed submission:
n = int(input())
w = []
for i in range(n):
    w.append(input())

def chk_shiri(w):
    for i in range(n - 1):
        if w[i][-1] == w[i + 1][0]:
            continue
        else:
            return False
    return True
    
if len(w) != len(set(w)):
    print('No')
elif chk_shiri(w):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S=raw_input();l=len(S);f=S.find('C');A=0
if S[:1]='A':
	A+1
	S="a"+S[1:]
if S[2:l-1].count('C')=1:
	A+1
	S=S[:f]+'c'+S[f+1:]
if S.islower():
	A+1
print('AC'if A=3 else'WA')

Fixed submission:
S = raw_input()
l=len(S)
if S[:1] == 'A':
	AC = 1
	S = "a"+S[1:]
else:
	AC = 0
if S[2:l-1].count('C')==1:
	AC2 = 1
else:
	AC2 = 0
if S.find('C')>=2:
	S = S[:S.find('C')] + 'c' + S[S.find('C')+1:]
if S.islower():
	AC3 = 1
else:
	AC3 = 0
if AC+AC2+AC3 == 3:
	print 'AC'
else:
	print 'WA'

Buggy python submission (verdict: Runtime Error):
S=raw_input();l=len(S);f=S.find('C');A=0
if S[:1]='A':
	A+1
	S="a"+S[1:]
if S[2:l-1].count('C')=1:
	A+1
	S=S[:f]+'c'+S[f+1:]
if S.islower():
	A+1
print('AC'if A=3 else'WA')

Fixed submission:
S = raw_input()
l=len(S)
if S[:1] == 'A':
	AC = 1
	S = "a"+S[1:]
else:
	AC = 0
if S[2:l-1].count('C')==1:
	AC2 = 1
else:
	AC2 = 0
if S.find('C')>=2:
	S = S[:S.find('C')] + 'c' + S[S.find('C')+1:]
if S.islower():
	AC3 = 1
else:
	AC3 = 0
if AC+AC2+AC3 == 3:
	print 'AC'
else:
	print 'WA'
Buggy python submission (verdict: Runtime Error):
x = list(sorted(range(input()), key=int, reverse=True))
for b in x:
	for p in x:
		if b**p <= x[0] and p>=2 and b>=1:
			break
	if b**p <= x[0] and p>=2 and b>=1:
		print(b**p)
		break

Fixed submission:
a,b,c,d = map(int,raw_input().split())
x = max(a,c)-min(a,c)
if d >= x :
	print('Yes')
elif (max(a,b)-min(a,b)) <= d and (max(b,c)-min(b,c)) <= d :
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
N,X = map(int,raw_input().split())
m = sorted([input() for m in range(N)])
X -= sum(m)
print ans = N + X / m[0]

Fixed submission:
N,X = map(int,raw_input().split())
m = sorted([input() for m in range(N)])
X -= sum(m)
ans = N + X / m[0]
print ans
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3

import math

n, x = map(int, input().split())
a = [abs(int(i) - x) for i in input().split()]

a.sort()

res = 0
for val in a:
    if res == 0:
        res = val
    else:
        res = math.gcd(res, val)
        if res == 1:
            break

print(res)


Fixed submission:
#! /usr/bin/env python3

import fractions

n, x = map(int, input().split())
a = [abs(int(i) - x) for i in input().split()]

a.sort()

res = 0
for val in a:
    if res == 0:
        res = val
    else:
        res = fractions.gcd(res, val)
        if res == 1:
            break

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

n, m, qq = map(int, input().split())

lr = [[0 for i in range(n + 1)] for j in range(n + 1)]

for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

for i in range(1, n + 1):
    for j in range(1, n + 1):
        lr[i][j] += lr[i][j-1]

res = []
for _ in range(qq):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][i - 1]
    res.append(ans)

for row in res:
    print(row)


Fixed submission:
#! /usr/bin/env python3

n, m, qq = map(int, input().split())

lr = [[0 for i in range(n + 1)] for j in range(n + 1)]
acc = [[0 for i in range(n + 1)] for j in range(n + 1)]

for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

for i in range(1, n + 1):
    for j in range(1, n + 1):
        acc[i][j] = acc[i][j-1] + lr[i][j]

res = []
for _ in range(qq):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans += acc[i][q] - acc[i][i - 1]
    res.append(ans)

for row in res:
    print(row)

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

n, m, qq = map(int, input().split())

lr = [[0 for i in range(n + 1)] for j in range(n + 1)]
acc = [[0 for i in range(n + 1)] for j in range(n + 1)]

for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

for i in range(1, n + 1):
    for j in range(1, n + 1):
        acc[i][j] = acc[i][j-1] + lr[i][j]

res = []
for _ in range(qq):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans += acc[i][q] - acc[i][i - 1]
    res.append(ans)

for row in res:
    print(row)


Fixed submission:
#! /usr/bin/env python3

n, m, qq = map(int, input().split())

lr = [[0 for i in range(n + 1)] for j in range(n + 1)]
acc = [[0 for i in range(n + 1)] for j in range(n + 1)]

for _ in range(m):
    l, r = map(int, input().split())
    lr[l][r] += 1

for i in range(1, n + 1):
    for j in range(1, n + 1):
        acc[i][j] = acc[i][j-1] + lr[i][j]

res = []
for _ in range(qq):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans += acc[i][q] - acc[i][i - 1]
    res.append(ans)

for row in res:
    print(row)
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

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

acc = 0
res = 0

mods = {}

for i in range(n):
    acc = (acc + a[i]) % m

    if acc == 0:
         res += 1

    for k, v in mods.items():
        if acc == k:
            res += v

    if acc in mods:
        mods[acc] += 1
    else:
        mods[acc] = 1

print(res)


Fixed submission:
#! /usr/bin/env python3

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

acc = 0
res = 0

mods = {}

for i in range(n):
    acc = (acc + a[i]) % m

    if acc == 0:
         res += 1

    if acc in mods:
        res += mods[acc]
        mods[acc] += 1
    else:
        mods[acc] = 1

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

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

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

for i in range(n):
    acc[i + 1] = (acc[i] + a[i]) % m
    for j in range(i + 1):
        if (m + acc[i + 1] - acc[j]) % m == 0:
            res += 1

print(res)


Fixed submission:
#! /usr/bin/env python3

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

acc = 0
res = 0

mods = {}

for i in range(n):
    acc = (acc + a[i]) % m

    if acc == 0:
         res += 1

    if acc in mods:
        res += mods[acc]
        mods[acc] += 1
    else:
        mods[acc] = 1

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

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

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

for i in range(n):
    acc[i + 1] = acc[i] + a[i]
    for j in range(i + 1):
        if (acc[i + 1] - acc[j]) % m == 0:
            res += 1

print(res)


Fixed submission:
#! /usr/bin/env python3

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

acc = 0
res = 0

mods = {}

for i in range(n):
    acc = (acc + a[i]) % m

    if acc == 0:
         res += 1

    if acc in mods:
        res += mods[acc]
        mods[acc] += 1
    else:
        mods[acc] = 1

print(res)
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3

import copy

def solve(n, actions, offset):

    res = 0
    val = 100000
    if n == 0 or len(actions) == 0:
        return(offset)
    while (val > n):
        val = actions.pop()
    if val == 1:
        return(n + offset)
    while n >= val * 3:
        res += 1
        n -= val
    tmp = 100000
    i = 0
    while n >= 0:
        tmp = min(tmp, solve(copy.copy(n), copy.copy(actions), copy.copy(i)))
        i += 1
        n -= val
    return(tmp + res + offset)


n = int(input())

res = 0

actions = [1]

for i in range(1, 6 + 1):
    actions.append(6 ** i)
    actions.append(9 ** i)

print(solve(n, actions, 0))


Fixed submission:
#! /usr/bin/env python3

import copy
import sys

def solve(n, actions, offset):

    res = 0
    val = 1000000
    if n == 0 or len(actions) == 0:
        return(offset)
    while (val > n):
        val = actions.pop()
    if val == 1:
        return(n + offset)
    while n >= val * 3:
        res += 1
        n -= val
    tmp = 1000000
    i = 0
    while n >= 0:
        tmp = min(tmp, solve(copy.copy(n), copy.copy(actions), copy.copy(i)))
        i += 1
        n -= val
    return(tmp + res + offset)


n = int(input())

res = 0

actions = [1]

for i in range(1, 6 + 1):
    actions.append(6 ** i)
    actions.append(9 ** i)

print(solve(n, actions, 0))
Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

s = input()
k = int(input())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

dic = []

for char in alphabets:
    
    index = 0
    ss = []
    while index != -1:
        index = s.find(char, index)

        if index != -1:
            ss.append(s[index:])
            index += 1

    if  len(ss) > 0:
        ss.sort()
        for x in ss:
            for i in range(len(x)):
                if x[0:i+1] not in dic:
                    dic.append(x[0:i+1])
                    if len(dic) >= k:
                        break
        if len(dic) >= k:
            break

print(dic[k-1])


Fixed submission:
#! /usr/bin/env python3

s = input()
k = int(input())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

dic = []

for char in alphabets:
    
    index = 0
    ss = []
    while index != -1:
        index = s.find(char, index)

        if index != -1:
            tmp = s[index:index + 5]
            isSubstring = False
            for sss in ss:
                if sss.find(tmp) == 0:
                    isSubstring = True
                    break
            if isSubstring == False:
                ss.append(tmp)

            index += 1

    if  len(ss) > 0:
        ss.sort()
        for x in ss:
            for i in range(len(x)):
                if x[0:i+1] not in dic:
                    dic.append(x[0:i+1])
                    if len(dic) >= k:
                        break
        if len(dic) >= k:
            break

print(dic[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
#! /usr/bin/env python3

s = input()
k = int(input())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

n = 0
dic = []

for char in alphabets:
    
    index = 0
    ss = []
    while index != -1:
        index = s.find(char, index)

        if index != -1:
            ss.append(s[index:])
            index += 1

    if  len(ss) > 0:
        ss.sort()
        for x in ss:
            for i in range(len(x)):
                if x[0:i+1] not in dic:
                    dic.append(x[0:i+1])
        if len(dic) >= k:
            break

print(dic[k-1])


Fixed submission:
#! /usr/bin/env python3

s = input()
k = int(input())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

dic = []

for char in alphabets:
    
    index = 0
    ss = []
    while index != -1:
        index = s.find(char, index)

        if index != -1:
            tmp = s[index:index + 5]
            isSubstring = False
            for sss in ss:
                if sss.find(tmp) == 0:
                    isSubstring = True
                    break
            if isSubstring == False:
                ss.append(tmp)

            index += 1

    if  len(ss) > 0:
        ss.sort()
        for x in ss:
            for i in range(len(x)):
                if x[0:i+1] not in dic:
                    dic.append(x[0:i+1])
                    if len(dic) >= k:
                        break
        if len(dic) >= k:
            break

print(dic[k-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())

red = []
blue = []

for i in range(n):
    red.append(tuple(map(int, input().split())))
for i in range(n):
    blue.append(tuple(map(int, input().split())))

red.sort(key=lambda x:x[1])
red.reverse()

blue.sort(key=lambda x:x[0])

res = 0

for b in range(n):
    for r in range(len(red)):
        if blue[b][0] > red[r][0] and blue[b][1] > red[r][1]:
            res += 1
            del red[r]
            break

print(res)


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

if a + b >= c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
ans = 0
import math
from functools import reduce
def lcm_base(x, y):
    return int((x * y) / math.gcd(x, y))
def lcm_list(numbers):
    ans = 0
    for i in range(1,len(numbers)):
        if(i == 1):
            ans = lcm_base(numbers[0], numbers[1])
        else:
            ans = lcm_base(ans, numbers[i])
    return ans

min_bin= lcm_list(a)

# ans = 0
for i in a:
    ans += (min_bin-1) % i
    # print(tmp)
print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0

# import math
# from functools import reduce
# def lcm_base(x, y):
#     return int((x * y) / math.gcd(x, y))
# def lcm_list(numbers):
#     ans = 0
#     for i in range(1,len(numbers)):
#         if(i == 1):
#             ans = lcm_base(numbers[0], numbers[1])
#         else:
#             ans = lcm_base(ans, numbers[i])
#     return ans
# min_bin= lcm_list(a)
num = 1
for i in a:
    num = num * i
num = num - 1
for i in a:
    ans += num % i
# for i in range(5000000):
#     tmp = 0
#     for j in a:
#         # print(j)
#         tmp += i % j
#     if(tmp > ans):
#         ans = tmp
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
f1 = False
f2 = False
a = 1
while True:
    if(a % 2 == 0):
        f1 = True
    if(a % N == 0):
        f2 = True
    if(f1 == True and f2 == True):
        break
    elif(a > N):
        a = N * 2
    else:
        f1 = False
        f2 = False
    a += 1
print(a)


Fixed submission:
N = int(input())
ans = 0
if(N % 2 == 0):
    ans = N
else:
    ans = N * 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# N, M, K = map(int, input().split())
# N = int(input())
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
flag = False
ans_flag = True
# iは欲しい難易度
for i in T:
    # jは用意された問題の難易度
    for n, j in enumerate(D):
        if i == j:
            D.pop(n)
            # print(D)
            flag = True
            break
    if flag == False:
        print("NO")
        ans_flag = False
        break
    else:
        flag = False
if ans_flag == True:
    print("YES")


Fixed submission:
import collections

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
flag = False
ans_flag = True
d = collections.Counter(D)
t = collections.Counter(T)
# print(d.most_common())
# print(t.most_common())
for i in t:
    i_str = str(i)
    d_count = d[i]
    if d_count < t[i]:
        print("NO")
        ans_flag = False
        break

if ans_flag == True:
    print("YES")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a*b)%2!==0:
  print("Yes")
elif (a*b*3)%2!==0:
  print("Yes")
  
else:
  print("No)

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2!=0:
  print("Yes")
elif (a*b*3)%2!=0:
  print("Yes")
  
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,i=map(int,input())

a=(N-i+1)

print(a)

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

a=(N-i+1)

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

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

def lcm_lst(lst):
  if len(lst) == 1:
    return lst[0]
  return lcm(lst[0], lcm_lst(lst[1:]))


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

m = lcm_lst(a)-1
f = 0
for a_ in a:
    f += m % a_
print(f)


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

m = 1
for a_ in a:
    m *= a_
m -= 1
f = 0
for a_ in a:
    f += m % a_
print(f)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

count = N
for i in range(N):
    count = min(count, S[:i].count('W') + S[i+1:].count('E'))
print(count)


Fixed submission:
N = int(input())
S = input()

count = S[1:].count('E')
ans = count
for i in range(1, N):
    if S[i] == 'E':
        count -= 1
    if S[i-1] == 'W':
        count += 1
    ans = min(ans, count)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

l = len(s)
lst = [[s[i], i] for i in range(l)]
lst.sort()
substr = []
i = 0
init_c = lst[i][0]

while len(substr) < K:
    while True:
        j = lst[i][1]
        for k in range(j, l):
            substr.append(s[j:k+1])
        i += 1
        init_c_ = init_c
        if i == l: break
        init_c = lst[i][0]
        if init_c != init_c_: break
    substr = list(set(substr))

substr.sort()
print(substr[K-1])


Fixed submission:
s = input()
K = int(input())

l = len(s)
substr = []

for i in range(l):
    for k in range(K):
        substr.append(s[i:i+k+1])
        if i+k+1 >= l: break

substr = list(set(substr))
substr.sort()
print(substr[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

s = input()
K = int(input())

l = len(s)
substr = []
for i, j in itertools.combinations_with_replacement(list(range(0, l)), 2):
    substr.append(s[i:j+1])

substr = list(set(substr))
substr.sort()
print(substr[K-1])


Fixed submission:
s = input()
K = int(input())

l = len(s)
substr = []

for i in range(l):
    for k in range(K):
        substr.append(s[i:i+k+1])
        if i+k+1 >= l: break

substr = list(set(substr))
substr.sort()
print(substr[K-1])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
import numpy as np
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()
sa = list(np.array(xlist[1:]) - np.array(xlist[:-1]))
print(reduce(math.gcd, sa))

Fixed submission:
import fractions
from functools import reduce
import numpy as np
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()
sa = list(np.array(xlist[1:]) - np.array(xlist[:-1]))
print(reduce(fractions.gcd, sa))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()
sa = np.array(xlist[1:]) - np.array(xlist[:-1])
print(np.gcd.reduce(sa))

Fixed submission:
import fractions
from functools import reduce
import numpy as np
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()
sa = list(np.array(xlist[1:]) - np.array(xlist[:-1]))
print(reduce(fractions.gcd, sa))
Buggy python submission (verdict: Time Limit Exceeded):
input()
L = list(map(int, input().split()))
M = [i-1 for i in L]
P = [i+1 for i in L]
a = list(set(L)|set(M)|set(P))
answer = 0
for i in a:
    x = L.count(i)+L.count(i-1)+L.count(i+1)
    if answer<x:
        answer = x
print(answer)

Fixed submission:
input()
L = list(map(int, input().split()))
m = min(L)
M = max(L)
a = [0]*(M-m+3)
for i in L:
    a[i-m] += 1
    a[i-m+1] += 1
    a[i-m+2] += 1
print(max(a))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
edgelist = []
for i in range(N):
    edgelist.append(set(map(int, input().split())))

s = [1]
count = 0
L = [[i for i in edgelist if (len(i&set([1]))!=0)]]
while s != []:
    if len(s) == M:
        count = count + 1
        L.pop()
        s.pop()
    elif L[-1] == []:
        L.pop()
        s.pop()
    else:
        p = L[-1].pop()
        r = list(p - set([s[-1]]))
        L.append([i for i in edgelist if (len(i&set(r))!=0)*(len(i&set(s))==0)])
        s.append(r[0])
print(count)

Fixed submission:
N, M = map(int, input().split())
edgelist = []
for i in range(M):
    edgelist.append(set(map(int, input().split())))

s = [1]
count = 0
L = [[i for i in edgelist if (len(i&set([1]))!=0)]]
while s != []:
    if len(s) == N:
        count = count + 1
        L.pop()
        s.pop()
    elif L[-1] == []:
        L.pop()
        s.pop()
    else:
        p = L[-1].pop()
        r = list(p - set([s[-1]]))
        L.append([i for i in edgelist if (len(i&set(r))!=0)*(len(i&set(s))==0)])
        s.append(r[0])
print(count)