Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
N,M = list(map(int, input().split()))


def combinations_count(n, r):
    if n==1:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(combinations_count(N,2)+combinations_count(M,2))

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


def combinations_count(n, r):
    if n==1 or n==0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(combinations_count(N,2)+combinations_count(M,2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = sorted([(x + l, x - l) for x, l in (map(int, l.split()) for l in sys.stdin)])

last = a[0][0]
ans = 1

for r, l in a[1:]:
    if last <= l:
        ans += 1
        last = r

print(ans)



Fixed submission:
import sys
N = int(input())
a = sorted([(x + l, x - l) for x, l in (map(int, l.split()) for l in sys.stdin)])

last = a[0][0]
ans = 1

for r, l in a[1:]:
    if last <= l:
        ans += 1
        last = r

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/keyence2020/tasks/keyence2020_b

N = int(input())
X, L = [], []

for i in range(N):
    x, l = list(map(int, input().split()))
    X.append([x, l])
    X.sort(key=lambda x: x[0], reverse=False)

L = [x[1] for x in X]
X = [x[0] for x in X]

ans = 0
cur = -float('inf')
for i in range(N):
    if (cur <= X[i] - L[i]):
        ans += 1
        cur = X[i] + L[i]
print(ans)

Fixed submission:
import sys
N = int(input())
a = sorted([(x + l, x - l) for x, l in (map(int, l.split()) for l in sys.stdin)])

last = a[0][0]
ans = 1

for r, l in a[1:]:
    if last <= l:
        ans += 1
        last = r

print(ans)
Buggy python submission (verdict: Runtime Error):
n,*c=map(int,open(0).read().split())
mod=10**9+7
dif=[j-i for i,j in zip(c,c[1:])]
fac=[1]*n
#階乗。毎回modで割っても大丈夫
for i in range(1,n):
    fac[i]=fac[i-1]*i%mod

inv=[pow(i,mod-2,mod) for i in range(n)]
#itertoolより。
acc_inv=list(accumulate(inv))
ans=0
for k in range(1,n):
    ans+=dif[k-1]*acc_inv[k]
    ans%=mod
print(ans*fac[-1]%mod)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import numpy as np
 
MOD = 10 ** 9 + 7
 
N = int(readline())
X = np.array(read().split(),np.int64)
 
def cumprod(A, MOD = MOD):
    L = len(A); Lsq = int(L**.5+1)
    A = np.resize(A, Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        A[:,n] *= A[:,n-1]; A[:,n] %= MOD
    for n in range(1,Lsq):
        A[n] *= A[n-1,-1]; A[n] %= MOD
    return A.ravel()[:L]
def make_fact(U, MOD = MOD):
    x = np.arange(U, dtype = np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact,fact_inv
 
U = 10 ** 5 + 5
fact, fact_inv = make_fact(U)
 
inv = np.zeros(U,np.int64)
inv[1:] = fact_inv[1:] * fact[:-1] % MOD
 
coef = inv[1:N].cumsum() % MOD
 
answer = (np.diff(X) * coef % MOD).sum() % MOD
answer *= fact[N-1]; answer %= MOD
 
print(answer)

Buggy python submission (verdict: Runtime Error):
from statistics import mean
from math import factorial
import numpy as np
N = int(input())
H = list(map(int, input().split()))
MOD = 1000000007
diff=[]
for i in range(N-1):
    diff.append(H[i+1]-H[i])

diff=np.array(diff)
multi=np.array([mean(list(range(1,i+1)))*factorial(N-1) for i in range(1,N)])
# print(multi)
# print(diff)
print(int(np.sum(diff*multi)%MOD))

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import numpy as np
 
MOD = 10 ** 9 + 7
 
N = int(readline())
X = np.array(read().split(),np.int64)
 
def cumprod(A, MOD = MOD):
    L = len(A); Lsq = int(L**.5+1)
    A = np.resize(A, Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        A[:,n] *= A[:,n-1]; A[:,n] %= MOD
    for n in range(1,Lsq):
        A[n] *= A[n-1,-1]; A[n] %= MOD
    return A.ravel()[:L]
def make_fact(U, MOD = MOD):
    x = np.arange(U, dtype = np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact,fact_inv
 
U = 10 ** 5 + 5
fact, fact_inv = make_fact(U)
 
inv = np.zeros(U,np.int64)
inv[1:] = fact_inv[1:] * fact[:-1] % MOD
 
coef = inv[1:N].cumsum() % MOD
 
answer = (np.diff(X) * coef % MOD).sum() % MOD
answer *= fact[N-1]; answer %= MOD
 
print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
E = []
for n in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        E.append((n, x - 1, y))
ans = 0
for k in range((1 << N)):
    status = [(k >> i) & 1 for i in range(N)]
    no_paradox = True
    for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] == yb):
            no_paradox = False
            break
    if no_paradox:
        ans = max(ans, sum(l))
print(ans)

Fixed submission:
N = int(input())
E = []
for n in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        E.append((n, x - 1, y))
ans = 0
for k in range((1 << N) - 1, -1, -1):
    status = [(k >> i) & 1 for i in range(N)]
    no_paradox = True
    for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] != yb):
            no_paradox = False
            break
    if no_paradox:
        ans = max(ans, sum(status))
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
E = []
for n in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        E.append((n, x - 1, y))
ans = 0
for k in range((1 << N)):
    status = [(k >> i) & 1 for i in range(N)]
    no_paradox = True
    for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] == yb):
            no_paradox = False
            break
    if no_paradox:
        ans = max(ans, sum(l))

Fixed submission:
N = int(input())
E = []
for n in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        E.append((n, x - 1, y))
ans = 0
for k in range((1 << N) - 1, -1, -1):
    status = [(k >> i) & 1 for i in range(N)]
    no_paradox = True
    for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] != yb):
            no_paradox = False
            break
    if no_paradox:
        ans = max(ans, sum(status))
print(ans)

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

E = []
for n in range(N):
  A = int(input())
  for _ in range(A):
    x, y = list(map(int, input().split()))
    E.append((n, x - 1, y))

    for k in range((1 << N)):
      status = [(k >> i) & 1 for i in range(N)]
      no_paradox = True
      for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] == yb):
          no_paradox = False
          break
          if no_paradox:
            ans = max(ans, sum(l))
print(ans)

Fixed submission:
N = int(input())
E = []
for n in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        E.append((n, x - 1, y))
ans = 0
for k in range((1 << N) - 1, -1, -1):
    status = [(k >> i) & 1 for i in range(N)]
    no_paradox = True
    for Xa, Xb, yb in E:
        if (status[Xa] == 1 and status[Xb] != yb):
            no_paradox = False
            break
    if no_paradox:
        ans = max(ans, sum(status))
print(ans)
Buggy python submission (verdict: Runtime Error):
num=int(input())
if num>81:
    return('No')
else:
    num_list=[]
    
    for a in range(1,10):
        for b in range(1,10):
            num_list.appned(a*b)
    num_list=set(num_list)
    if num in num_list:
        print('Yes')
    else:
        print('No')

Fixed submission:
num=int(input())
if num>81:
    print('No')
else:
    num_list=[]
    
    for a in range(1,10):
        for b in range(1,10):
            num_list.append(a*b)
    num_list=set(num_list)
    if num in num_list:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A, B, C = [list(map(int, input().split())) for _ in range(3)]
score=0
pred_i=np.inf
for i in A:
    if pred_i+1 ==i:
        score=score+C[i-2]+B[i-1]
    else:
        score+=B[i-1]
    pred_i=i
print(score)

Fixed submission:
import numpy as np
N = int(input())
A, B, C = [list(map(int, input().split())) for _ in range(3)]
score=0
pred_i=np.inf
for i in A:
    if pred_i+1 ==i:
        score=score+C[i-2]+B[i-1]
    else:
        score+=B[i-1]
    pred_i=i
print(score)

Buggy python submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split())) 
B = list(map(int, input().split())) 
C = list(map(int, input().split())) 
score=0
pred_i=np.inf
for i in A:
    if pred_i+1 ==i:
        score=score+C[i-2]+B[i-1]
    else:
        score+=B[i-1]
    pred_i=i
print(score)

Fixed submission:
import numpy as np
N = int(input())
A, B, C = [list(map(int, input().split())) for _ in range(3)]
score=0
pred_i=np.inf
for i in A:
    if pred_i+1 ==i:
        score=score+C[i-2]+B[i-1]
    else:
        score+=B[i-1]
    pred_i=i
print(score)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
B = list(map(int, input().split()))
A = [0]*N
A[0]=min(B[0],B[1])
for i in range(1,N-1):
    A[i]=min(B[i],B[i-1])
A[N-1]=B[N-2]
print(np.sum(A))

Fixed submission:
#c
import numpy as np
N = int(input())
B = list(map(int, input().split()))
A = [0]*N
if N>2:
    A[0]=B[0]
    for i in range(1,N-1):
        A[i]=min(B[i],B[i-1])
    A[N-1]=B[N-2]
    print(np.sum(A))
else:
    print(B[0]*2)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
B = list(map(int, input().split()))
A = [0]*N
A[0]=min(B[0],B[1])
print(len(A),len(B))
for i in range(1,N-1):
    A[i]=min(B[i],B[i-1])
A[N-1]=B[N-2]
print(np.sum(A))

Fixed submission:
#c
import numpy as np
N = int(input())
B = list(map(int, input().split()))
A = [0]*N
if N>2:
    A[0]=B[0]
    for i in range(1,N-1):
        A[i]=min(B[i],B[i-1])
    A[N-1]=B[N-2]
    print(np.sum(A))
else:
    print(B[0]*2)
Buggy python submission (verdict: Time Limit Exceeded):
#c
import sys
#再起の上限を増やす
sys.setrecursionlimit(10 ** 7)

N = int(input())
H = list(map(int, input().split()))
cnt=0
ans=0
now=0
def func(now,N,H,cnt,ans):
    for i in range(now,N-1):
        if H[i]>=H[i+1]:
            cnt+=1
            if cnt>ans:
                ans=cnt
        else:
            cnt=0
            func(i+1,N,H,cnt,ans)
    return ans
            
print(func(now,N,H,cnt,ans))

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
cnt=0
ans=0
now=0
for i in range(now,N-1):
    if H[i]>=H[i+1]:
        cnt+=1
        if cnt>ans:
            ans=cnt
    else:
        cnt=0

            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
#S = list(map(str, input().split()))
# S = list(map(str, input().split()))
S = []
for _ in range(N):
    S.append(input())

#受け取った文字列をアルファベットに並び替え
S=[''.join(sorted(a)) for a in S]

#バケットを作って、出現回数をカウント
count=[0]*(len(set(S)))
unique_S=list(set(S))
ans=0
for ele in S:
    count[unique_S.index(ele)]+=1
count=sorted(count,reverse=True)

#階乗のコード
def cor(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact
#組み合わせのコード
def combination(n,c):
    a=(cor(n))/(cor(n-c)*cor(c))
    return a

for i in count:
    if i==1:
        break
    else:
        ans+=combination(i,2)
print(int(ans))

Fixed submission:
from collections import Counter,defaultdict
N =int(input())
S = []
#キーが存在しなかったときのデフォルトの値を定義できる
dict=defaultdict(int)
ans=0
for _ in range(N):
    s=''.join(sorted(input()))
    ans+=dict[s]
    dict[s]+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
N =int(input())
#S = list(map(str, input().split()))
# S = list(map(str, input().split()))
S = []
for _ in range(H):
    S.append(input())

#受け取った文字列をアルファベットに並び替え
S=[''.join(sorted(a)) for a in S]

#バケットを作って、出現回数をカウント
count=[0]*(len(set(S)))
unique_S=list(set(S))
ans=0
for ele in S:
    count[unique_S.index(ele)]+=1
count=sorted(count,reverse=True)

#階乗のコード
def cor(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact
#組み合わせのコード
def combination(n,c):
    a=(cor(n))/(cor(n-c)*cor(c))
    return a

for i in count:
    if i==1:
        break
    else:
        ans+=combination(i,2)
print(int(ans))

Fixed submission:
from collections import Counter,defaultdict
N =int(input())
S = []
#キーが存在しなかったときのデフォルトの値を定義できる
dict=defaultdict(int)
ans=0
for _ in range(N):
    s=''.join(sorted(input()))
    ans+=dict[s]
    dict[s]+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
p, q, r = map(int, input().split())
# 文字列の入力
# s = input()
# 出力


print("{} {}".format(min(p+q, q+r, r+p), s))


Fixed submission:
p, q, r = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
 
 
print("{}".format(min(p+q, q+r, r+p)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
from math import factorial as fac

N,M=  map(int, input().split())
broken_steps=[]

for m in range(M):
    broken_steps.append(int(input()))

for i in range(len(broken_steps)-1):
    if broken_steps[i+1]-broken_steps[i]==1:
        print("{}".format(0))
        FLG=True

if FLG!=True:        
    count=0
    for two_step in range(M,N//2+1):
        one_step=N-two_step*2
        count+=fac(two_step+one_step)/(fac(two_step)*fac(one_step))

    print("{}".format(count%1000000007))

Fixed submission:
MOD = 10**9 + 7
N, M = [int(s) for s in input().split()]
#行ってはいけないところには0がはいる
ls = [1 for _ in range(N + 1)]
for i in range(M):
    ls[int(input())] = 0

for n in range(2, N + 1):
    if ls[n] != 0:
        #(n*m)mod k ==(n(mod k)*m(mod k))
        ls[n] = (ls[n - 1] + ls[n - 2]) % MOD
print(ls[N])
Buggy python submission (verdict: Runtime Error):
s = []
for i in range(m):
  st = list(map(int, input().split()))
  s.append(st[1 :])
  p = list(map(int, input().split()))

  ans = 0
  #あるつき方について
  for i in range(1 << n):
    al = True
    #つき方二進数
    v = [bool(i & (1 << x)) for x in range(n)]
    #電球全体
    for j in range(m):
      #onになってるスイッチの個数
      num = 0
      #スイッチの番号
      for t in s[j]:
        num += v[t - 1]
        if p[j] != num % 2:
          al = False
          ans += al
          print(ans)   

Fixed submission:
n, m = map(int, input().split())
s = []
for i in range(m):
    st = list(map(int, input().split()))
    s.append(st[1 :])
p = list(map(int, input().split()))

ans = 0
#あるつき方について
for i in range(1 << n):
    al = True
    #つき方二進数
    v = [bool(i & (1 << x)) for x in range(n)]
    #電球全体
    for j in range(m):
        #onになってるスイッチの個数
        num = 0
        #スイッチの番号
        for t in s[j]:
            num += v[t - 1]
        if p[j] != num % 2:
            al = False
    ans += al
print(ans)
Buggy python submission (verdict: Runtime Error):
is_lucky = any(i == "7" for i in input().split())
print("Yes" if is_luckey else "No")


Fixed submission:
numbers = [i for i in input()]
print("Yes" if "7" in numbers else "No")
Buggy python submission (verdict: Runtime Error):
from typing import List


def lunlun_maker(l: List[int]) -> List[int]:
    next_lunluns = []
    for e in l:
        nxt = e * 10
        mod = e % 10
        if 0 < mod < 9:
            next_lunluns.extend([nxt + mod - 1, nxt + mod, nxt + mod + 1])
        elif mod == 0:
            next_lunluns.extend([nxt, nxt + 1])
        elif mod == 9:
            next_lunluns.extend([nxt + 8, nxt + 9])
    return next_lunluns


def get_lunlun(num: int) -> int:
    lunluns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    counter = len(lunluns)
    counter_tmp = counter
    while counter < num:
        lunluns = lunlun_maker(lunluns)
        counter_tmp = counter
        counter += len(lunluns)
    return lunluns[num - counter_tmp - 1]


K = int(input())
print(get_lunlun(K))

Fixed submission:
def lunlun_maker(l: int) -> int:
    next_lunluns = []
    for e in l:
        nxt = e * 10
        mod = e % 10
        if 0 < mod < 9:
            next_lunluns.extend([nxt + mod - 1, nxt + mod, nxt + mod + 1])
        elif mod == 0:
            next_lunluns.extend([nxt, nxt + 1])
        elif mod == 9:
            next_lunluns.extend([nxt + 8, nxt + 9])
    return next_lunluns


def get_lunlun(num: int) -> int:
    lunluns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    counter = len(lunluns)
    counter_tmp = counter
    while counter < num:
        lunluns = lunlun_maker(lunluns)
        counter_tmp = counter
        counter += len(lunluns)
    return lunluns[num - counter_tmp - 1]


K = int(input())
print(get_lunlun(K))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

base = sum(B)
bonus = 0
for i, num in enumerate(A):
  if i+1 >= len(A):
    break
  if A[i+1] == A[i] + 1:
    bonus += C[i+1]

print(base + bonus)

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

base = sum(B)
bonus = 0
for i, num in enumerate(A):
  if i + 1 >= len(A):
    break
  if A[i+1] == num + 1:
    bonus += C[num - 1]

print(base + bonus)
Buggy python submission (verdict: Runtime Error):
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()

for i in range(len(a)):
    x -= a[i]
    if x >= 0:
        ans = i + 1

print(ans)


Fixed submission:
import numpy

N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
a_sum = numpy.cumsum(a)
ans = numpy.sum(a_sum <= x)

if ans == N and x not in a_sum:
    ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
[a, b] = input().split()
if a+b == 15:
  print("+")
elif a*b == 15:
  print("*")
else:
    print("x")

Fixed submission:
[a, b] = map(int, input().split())
if a+b == 15:
  print("+")
elif a*b == 15:
  print("*")
else:
    print("x")

Buggy python submission (verdict: Runtime Error):
[a, b] = input().split()
if a+b == 15:
  print("+")
  return
if a*b == 15:
  print("*")
  return
print("x")
return

Fixed submission:
[a, b] = map(int, input().split())
if a+b == 15:
  print("+")
elif a*b == 15:
  print("*")
else:
    print("x")
Buggy python submission (verdict: Runtime Error):
S = input()
w = int(input())

for index, s in enumerate(S):
    if index % w == 0:
        sys.stdout.write(s)



Fixed submission:
import sys

S = input()
w = int(input())

for index, s in enumerate(S):
    if index % w == 0:
        sys.stdout.write(s)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

A_list = list()
for i in range(A) :
    A_list.append(i*500)
B_list = list()
for i in range(B) :
    B_list.append(i*100)
C_list = list()
for i in range(C) :
    C_list.append(i*50)

count = 0
for a in A_list :
    for b in B_list :
        for c in C_list :
            if (a + b + c) == X :
                count += 1

print count

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

A_list = list()
for i in range(A+1) :
    A_list.append(i*500)
B_list = list()
for i in range(B+1) :
    B_list.append(i*100)
C_list = list()
for i in range(C+1) :
    C_list.append(i*50)

count = 0
for a in A_list :
    for b in B_list :
        for c in C_list :
            if (a + b + c) == X :
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
input1 = input().split(' ')
input2 = input().split(' ')

if input1[2] == input2[0] :
    if input1[1] == input2[1] :
        if input1[0] == input2[2] :
            print("YES")
        else :
            print("NO")
    else :
        print("NO")
else :
    print("NO")

Fixed submission:
input1 = input()
input2 = input()

if input1[::-1] == input2[::] :
    print("YES")
else :
    print("NO")

Buggy python submission (verdict: Runtime Error):
input1 = input().split(' ')
input2 = input().split(' ')

if input1[2] == input2[0] :
    if input1[1] == input2[1] :
        if input1[0] == input2[2] :
            print("Yes")
        else :
            print("No")
    else :
        print("No")
else :
    print("No")

Fixed submission:
input1 = input()
input2 = input()

if input1[::-1] == input2[::] :
    print("YES")
else :
    print("NO")
Buggy python submission (verdict: Runtime Error):
R = input()
G = input()
print 2*G - R

Fixed submission:
R = int(input())
G = int(input())
print(2*G - R)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
N = input()
a_raw = list(map(int, input().split()))
a_plus = [num + 1 for num in a_raw]
a_minus = [num - 1 for num in a_raw]
numbers = set(a_raw) | set(a_minus) | set(a_plus)
num_count = list()
for number in numbers:
    num_count.append(a_raw.count(number) + a_plus.count(number) + a_minus.count(number))

print(max(num_count))

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
N = input()
a_raw = list(map(int, input().split()))
a_plus = [num + 1 for num in a_raw]
a_minus = [num - 1 for num in a_raw]
numbers = set(a_raw) | set(a_minus) | set(a_plus)
num_count = defaultdict(int)
for number in numbers:
    num_count[number] += a_raw.count(number) + a_plus.count(number) + a_minus.count(number)

print(max(num_count.values()))

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools

K = int(input())
data = list(range(1, K + 1))
p_list = list(itertools.product(data, repeat=3))

# print(p_list)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

sum = 0

for p in p_list:
    sum += gcd_list(p)

print(sum)

Fixed submission:
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            sum += gcd(a, b, c)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools

K = int(input())
data = list(range(1, K + 1))
p_list = list(itertools.product(data, repeat=3))

# print(p_list)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

sum = 0

for p in p_list:
    sum += gcd_list(p)

print(sum)

Fixed submission:
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            sum += gcd(a, b, c)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            sum += gcd(a, b, c)

print(sum)

Fixed submission:
import math
from functools import reduce

K = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

sum = 0

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            sum += gcd(a, b, c)

print(sum)