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

Fixed submission:
N,K = map(int,input().split())
h = [int(input()) for i in range(N)]
h.sort(reverse = True)
l = [0]*(N-(K-1))
for i in range(N-(K-1)):
  l[i] = h[i]-h[i+K-1]
ans = min(l)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse = True)
l = [0]*(N-(K-1))
for i in range(N-(K-1)):
  l[i] = h[i]-h[i+K-1]
ans = min(l)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
ans = min(h[i]-h[i+K] for i in range(N-K))
print(ans)
Problem p03252 (python)

Fixed submission:
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,min(len(S),len(alp)*2)):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  else:
    pass
  if S == T:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,10**7):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  if S == T:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
alp = "abcdefghijklmnopqrstuvwxyz"
for i in range(0,len(alp)):
  if S[i] != T[i]:
    S = S.translate(str.maketrans({S[i]:T[i], T[i]:S[i]}))
  if S == T:
    print("Yes")
    exit()
print("No")
Problem p03745 (python)

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

count = 1
up,down = 1,1

for i in range(1,N):
  if A[i-1] > A[i]:
    up = 0
    if down == 0:
      count += 1
      up,down = 1,1
  elif A[i-1] < A[i]:
    down = 0
    if up == 0:
      count += 1
      up,down = 1,1

print(count)

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

count = 1

for i in range(1,N-1):
  if A[i-1] > A[i]:
    up,down = 0,1
  elif A[i-1] < A[i]:
    up,down = 1,0
  if up == 1 and A[i] > A[i+1]:
    count += 1
  elif down == 1 and A[i] < A[i+1]:
    count += 1
    
print(count)
Problem p02577 (python)

Fixed submission:
N = list(input().rstrip())
sum = 0
 
for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = line(input().rstrip())
sum = 0

for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")
Problem p02793 (python)

Fixed submission:
n=int(input())
a=[int(j) for j in input().split()]
t=1
mod=10**9+7
from fractions import*
for i in a:
    t*=i//gcd(t,i)
print(sum(t//i for i in a)%mod)

Buggy submission (verdict: Runtime Error):
from math import*
n=int(input())
mod=1000000007
s=[int(j) for j in input().split()]
ans=1
for i in s:
    ans*=i//gcd(ans,i)
print(sum(ans//i for i in s)%mod)

Buggy submission (verdict: Runtime Error):
from math import*
n=int(input())
mod=1000000007
s=[int(j) for j in input().split()]
ans=1
for i in s:
    ans*=i//gcd(ans,i)
print(sum(ans//i for i in s)%mod)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
mod=1000000007
sum=0
s=[int(n) for n in input().split()]
ans=1
for i in s:
    ans*=i//math.gcd(ans,i)
for i in s:
    sum=(sum+ans//i)%mod
print(sum)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
mod=1000000007
ans=0
sum=0
s=[int(n) for n in input().split()]
ans=1
for i in s:
    ans*=i//math.gcd(ans,i)
for i in range(0, n):
    sum=(sum+ans//(s[i]))%mod
print(sum)
Problem p02552 (python)

Fixed submission:
x = int(input())
print(1-x)

Buggy submission (verdict: Runtime Error):
x = int(input())
y = !x
print(y)

Buggy submission (verdict: Runtime Error):
x = int(input())
print(!x)
Problem p02578 (python)

Fixed submission:

input()
A=list(map(int,input().split()))
m=0
s=0
for a in A:
    d=max(0, m-a)
    s+=d
    m=max(m, a)
print(s)

Buggy submission (verdict: Runtime Error):
N,*A=map(int,input().split())
m=max(A)
s=sum([m-a for a in A])
print(s)
Problem p02623 (python)

Fixed submission:
N,M,K,*AB = map(int, open(0).read().split())
A = AB[:N]
B = AB[N:]
a = [0]
b = [0]
for i in range(N): a.append(a[i] + A[i])
for i in range(M): b.append(b[i] + B[i])
ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k,*ab = map(int, open(0).read().split())
aa = ab[:n]
bb = ab[m-1:]
ans = 0
i = j = 0
while True:
    if n <= i and m <= j:
        break
    elif n > i and m > j:
        a = aa[i]
        b = bb[j]
        if a < b:
            if a > k:
                break
            i += 1
            ans += 1
            k -= a
        else:
            if b > k:
                break
            j += 1
            ans += 1
            k -= b
    elif n > i:
        a = aa[i]
        if a > k:
            break
        i += 1
        ans += 1
        k -= a
    else:
        b = bb[j]
        if b > k:
            break
        j += 1
        ans += 1
        k -= b
print(ans)
Problem p03805 (python)

Fixed submission:
from itertools import permutations
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
m = [set() for _ in range(27)]
for a, b in AB:
    m[a].add(b)
    m[b].add(a)

def main():
    ans = []
    def traverse(n, visits):
        visits = visits | set([n])
        if len(visits) == N:
            ans.append(1)
            return
        for c in m[n] - visits:
            traverse(c, visits)
    traverse(1, set())
    return len(ans)

print(main())

Buggy submission (verdict: Runtime Error):
from itertools import permutations
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
m = [set() for _ in range(1, 9)]
for a, b in AB:
    m[a].add(b)
    m[b].add(a)

def main():
    ans = []
    def traverse(n, visits):
        visits = visits | set([n])
        if len(visits) == N:
            ans.append(1)
            return
        for c in m[n] - visits:
            traverse(c, visits)
    traverse(1, set())
    return len(ans)

print(main())
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s==u:
    print(a-1,b)
else:
    print(a,b-1)

Buggy submission (verdict: Runtime Error):
s, t = map(input().split())
a, b = map(int, input().split())
u = input()
print(a-1,b if s==u else a,b-1)
Problem p02879 (python)

Fixed submission:
a, b = map(int, input().split())
print(a*b if a<=9 and b<=9 else -1)

Buggy submission (verdict: Runtime Error):
a, b = int(input())
print(a*b if a<=9 and b<=9 else -1)
Problem p03327 (python)

Fixed submission:
N = int(input())
print("ABC" if N<=999 else "ABD")

Buggy submission (verdict: Runtime Error):
N = input()
print("ABC" if N<=999 else "ABD")

Buggy submission (verdict: Runtime Error):
N = map(int, input().split())
print("ABC" if N<=999 else "ABD")
Problem p03631 (python)

Fixed submission:
N = input()
print("Yes" if N[0]==N[-1] else "No")

Buggy submission (verdict: Runtime Error):
N = int(input())
print("YES" if N[0]==N[-1] else "NO")
Problem p02723 (python)

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
Problem p02624 (python)

Fixed submission:
n=int(input())
dp=[1]*((10**7)+100)
ans=1
for num in range(2,n+1):
  for i in range(num,(10**7)+1,num):
    dp[i]+=1
  ans+=dp[num]*num
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
dp=[1]*10**7
ans=1
for num in range(2,n+1):
  for i in range(num,10**7,num):
    dp[i]+=1
  ans+=dp[num]*num
print(ans)
Problem p02701 (python)

Fixed submission:
n=int(input())
a = [input() for i in range(n)]
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
n=int(intput())
s=set(input() for _ in range(n))
print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(intput())
s=set(input() for _ in range(n))
print(len(s))
Problem p02707 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n-1):
  b[a[i]-1]+=1
for i in b:
  print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]*n
for i in range(n-1):
  b[a[i]-1]+=1
for i in b:
  print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]*n
for i in range(n-1):
  b[a[i]-1]+=1
for i in range(n):
  print(b[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]*n
for i in range(n):
  b[a[i]-1]+=1
for i in range(n):
  print(b[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
A = list(map(int,input().split()))
for i in range(1,n+1):
    print(A.count(i))
    A.remove(i)
Problem p02773 (python)

Fixed submission:
import collections
n=int(input())
ans=[]
s=["".join(input()) for _ in range(n)]
c=collections.Counter(s)
m=max(c.values())
for k,v in c.items():
  if v==m:
    ans.append(k)

for i in sorted(ans):
  print(i)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
ans=[]
s=["".join(sorted(input())) for _ in range(n)]
c=collections.Counter(s)
m=max(c.values())
for k,v in c.items:
  if v==m:
    ans.append(k)

print(sorted(k))
Problem p02829 (python)

Fixed submission:
u={1,2,3}
AB=[int(input()) for i in range(2)]
print(list(u-set(AB))[0])

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())

print(set(1,2,3)-set(a,b))
Problem p02970 (python)

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil(a/(2*b+1)))

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.ceil(a/(s*b-1)))

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.ceil(a/(s*b-1))
Problem p03077 (python)

Fixed submission:
import math
n=int(input())
a=[int(input()) for i in range(5)]
b=0
for i in range(5):
  b=max(math.ceil(n/a[i]),b)
print(5+b-1)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
a=[int(input()) for i in range(5)]
b=0
for i in range(5):
  b=max(math.ceil(n//a[i]))
print(5+b-1)
Problem p03250 (python)

Fixed submission:
print(eval("+".join(sorted(input()))+"*10"))

Buggy submission (verdict: Runtime Error):
pritn(eval("+".join(sorted(input()))+"*10"))
Problem p03805 (python)

Fixed submission:
import itertools

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

path = [[False] * n for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True

ans = 0

# 頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n), n):
    # 頂点1が始点
    if i[0] == 0:
        # 生成した順列の中をさらにループ
        for j in range(n):
            # n - 1 まで続いたら条件を満たすパスが存在する
            if j == n - 1:
                ans += 1
                break
            # i[j] から i[j + 1] に行くパスがなければ終了
            if not path[i[j]][i[j + 1]]:
                break

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().split())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0
for i in itertools.permutations(range(n),n):
  if i[0]==0:
    for j in rannge(n):
      if j ==n-1:
        ans+=1
      if not path[i[j]][i[j+1]]:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().split())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0
for i in itertools.permutations(range(n),n):
  if i[0]==0:
    for j in rannge(n-1):
      if j ==n-1:
        ans+=1
      if not path[i[j]][i[j+1]]:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().split())
path=[[False]*n for _ in range(m)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0
for i in itertools.permutations(range(n),n):
  if i[0]==0:
    for j in rannge(n-1):
      if j ==n-1:
        ans+=1
      if not path[i[j]][i[j+1]]:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().split())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0

for i in itertools.permutations(range(6), 6):
   if i[0] == 0:
     for j in range(n):
       if j==n-1:
         ans+=1
         break
       if not path[i[j]][i[j+1]]:
         break

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().xplit())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0

for i in itertools.permutations(range(6), 6):
   if i[0] == 0:
     for j in range(n):
       if j==n-1:
         ans+=1
         break
       if not path[i[j]][i[j+1]]:
         break

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n,m = map(int,input().xplit())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0

for i in itertools.permutations(range(6), 6):
   if i[0] == 0:
     for j in range(n):
       if j==n-1:
         ans+=1
         break
       if not path[i[j-1]][i[j]]:
         break

print(ans)
Problem p02577 (python)

Fixed submission:
if int(input()) % 9 == 0:
  print("Yes")
else:
  print("No")

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

a = 0
while N > 0:
  a += N % 10
  N /= 10
  a %= 9

if a == 0:
  print("Yes")
else:
  print("No")
Problem p02759 (python)

Fixed submission:
def solve(n):
    return (n+1)//2

n = int(input())
print(solve(n))

Buggy submission (verdict: Runtime Error):
def solve():
    n = int(input())
    print(n+1)//2

solve()
Problem p02831 (python)

Fixed submission:
from fractions import gcd

def solve():
    a, b = map(int, input().split())
    return  a * b // gcd(a,b)

print(solve())

Buggy submission (verdict: Runtime Error):
import math

def solve():
    a, b = map(int, input().split())
    return a*b/math.gcd(a, b)

print(solve())

Buggy submission (verdict: Runtime Error):
import math

def solve():
    a, b = map(int, input().split())
    return a*b//math.gcd(a, b)

print(solve())

Buggy submission (verdict: Runtime Error):
import math

def solve():
    a, b = map(int, input().split())
    return a//math.gcd(a, b)*b

print(solve())
Problem p02819 (python)

Fixed submission:
X = int(input())
max_num = 100004
ans = 0
for i in range(X, max_num):
    cnt = 0
    for j in range(2, i+1):
        if i%j==0:
            cnt += 1
    if cnt == 1:
        ans = i
        break

print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())
max_num = 100005
ans = 0
for i in range(X, max_num):
    if prime_check(i):
        print(i)
        break

def prime_check(num):
    for i in range(2, num):
        if num % i == 0:
            return False

    return True
Problem p02831 (python)

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
import sys
import fractions
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,string
import sys
 
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,string
import sys

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)
Problem p02835 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c < 22:
  print('win')
else:
  print('bust')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a + b + c < 22:
  print('win')
  else:
    print('bust')
Problem p03617 (python)

Fixed submission:
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
q, h, s, d = map(int, sys.stdin.readline().rstrip().split())
N = I()
D = d
qh = min(2*q, h)
S = min(2*qh, s)
x = min(2*S, D)
if N%2 == 0:
    print(N//2*x)
else:
    print(N//2*x + S)

Buggy submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
q, h, s, d = map(int, sys.stdin.readline().rstrip().split())
N = I()
D = d
qh = min(2*q, h)
S = min(2*qh, s)
x = min(2*S, D)
if N%2 == 0:
    print(N//2*x)
else:
    print(N//2*x + S)
Problem p02989 (python)

Fixed submission:
from collections import Counter

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

minD = min(d)
maxD = max(d)
c = Counter(d)

abc = 0
arc = n
ans = 0

for i in range(minD, maxD+1):
    abc += c[i-1]
    arc -= c[i-1]
    
    if abc == arc:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
a
Problem p03107 (python)

Fixed submission:
import sys
input = sys.stdin.readline

S=[]
s=input()
for c in s:
        S.append(c)
S.pop(-1)
print(2*min(S.count("0"), S.count("1")))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

count0=0
count1=0
lastElm=-1
S=[]
s=input()
for c in s:
        S.append(c)
S.pop(-1)
lenS = len(S)
if lenS==1:
        print(0)
        exit()
S.sort()
for i in range(lenS):
        if i==0:
                count0=S.count("0")
                count1=S.count("1")
                if count0 == 0 or count1==1:
                        print(0)
                        exit()
        else:
                if lastElm == "0":
                        count0 -= 1
                elif lastElm == "1":
                        count1 -= 1

        if count0 == count1:
                print(count0*2)
                exit()
        else:
                if S[lenS//2] == "1":
                        lastElm = S[-1]
                        S.pop(-1)
                else:
                        lastElm = S[0]
                        S.pop(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

count0=0
count1=0
lastElm=-1
S=[]
s=input()
for c in s:
        S.append(c)
S.pop(-1)
lenS = len(S)
if lenS==1:
        print(0)
        exit
S.sort()
for i in range(lenS):
        if i==0:
                count0=S.count("0")
                count1=S.count("1")
        else:
                if lastElm == "0":
                        count0 -= 1
                elif lastElm == "1":
                        count1 -= 1

        if count0 == count1:
                print(count0*2)
                exit()
        else:
                if S[lenS//2] == "1":
                        lastElm = S[-1]
                        S.pop(-1)
                else:
                        lastElm = S[0]
                        S.pop(0)
Problem p03137 (python)

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

if m <= n:
    print(0)
else:
    x.sort()
    diff = []#i番目とi+1番目の距離
    for i in range(m-1):
        diff.append(x[i+1] - x[i])
    diff.sort(reverse=True)
    # print(diff)
    if n > 1:
        for i in range(n-1):
            diff.pop(0)
    # print(diff)
    print(sum(diff))

Buggy submission (verdict: Runtime Error):
a
Problem p02546 (python)

Fixed submission:
x=input()
print(x+'s' if x[len(x)-1]!='s' else x+"es")

Buggy submission (verdict: Runtime Error):
x=input()
print(x+'s' if x[len(x)-1]!=s else x[0:len(x)-1]+"es")
Problem p02831 (python)

Fixed submission:
# import math
import fractions

a, b = map(int, input().split())

print((a * b) // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print((a * b) // math.gcd(a, b))
Problem p03265 (python)

Fixed submission:
int_x1, int_y1, int_x2, int_y2 = map(int, input().split())

int_x3 = int_y3 = int_x4 = int_y4 = 0

int_x = int_x2 - int_x1
int_y = int_y2 - int_y1

print(int_x2 - int_y, int_y2 + int_x, int_x1 - int_y, int_y1 + int_x)

Buggy submission (verdict: Runtime Error):
int_k = int(input())

if int_k % 2 == 0:
    print((int_k // 2) ** 2)
else:
    print((int_k // 2) * ((int_k //2) + 1))
Problem p02762 (python)

Fixed submission:
#!/usr/bin/env python3
from collections import deque
import sys
sys.setrecursionlimit(700000)

NIL = -1
N, M, K = map(int, input().split())
relation = [deque() for i in range(N)]
prefriends = [deque() for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    relation[A].append(B)
    relation[B].append(A)

def dfs(x, y):
    for i in relation[y]:
        if check[i] == None:
            #print(i)
            prefriends[x].append(i)
            #print(set(prefriends[x]))
            check[i] = x
            dfs(x, i)

#print(prefriends)
j = 0
check = [None]*N
while j < N:
    if check[j] == None:
        #print(prefriends[j])
        prefriends[j].append(j)
        check[j] = j
        dfs(j, j)
        #print(check)
    j += 1
    #print(set(prefriends[j]))
    #print(set(friends[j]))
    #print(set(block[j]))
    #print((set(prefriends[j]) - set(friends[j])) - set(block[j]))

for i in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    if check[C] == check[D]:
        relation[C].append(D)
        relation[D].append(C)
ans = [0]*N
for j in range(N):
    ans[j] = len(prefriends[check[j]]) - len(relation[j]) - 1
    #print(ans[j])
    #print()
print(*ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import deque

NIL = -1
N, M, K = map(int, input().split())
friends = [deque() for i in range(N)]
block = [deque() for i in range(N)]
prefriends = [deque() for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    friends[A].append(B)
    friends[B].append(A)

for i in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    block[C].append(D)
    block[D].append(C)


def dfs(x, y):
    for i in friends[y]:
        if check[i]:
            #print(i)
            prefriends[x].append(i)
            #print(set(prefriends[x]))
            check[i] = False
            dfs(x, i)
ans = [0]*N
#print(prefriends)
for j in range(N):
    #print(prefriends[j])
    check = [True]*N
    check[j] = False
    dfs(j, j)
    #print(set(prefriends[j]))
    #print(set(friends[j]))
    #print(set(block[j]))
    #print((set(prefriends[j]) - set(friends[j])) - set(block[j]))
    
    ans[j] = (set(prefriends[j]) - set(friends[j])) - set(block[j])
    #print(ans[j])
    #print()
ans = [len(ans[i]) for i in range(N)]
print(*ans)