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

Fixed submission:
def is_poor(triple_numbers):
    count_map = {}
    for num in triple_numbers:
        if num not in count_map:
            count_map[num] = 1
        else:
            count_map[num] += 1
    
    for key, value in count_map.items():
        if value == 2:
            return True
    return False

is_p = is_poor(list(map(int, input().split())))

if is_p:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B,C=input().split
a,b,c=int(A),int(B),int(C)

if a==b and b!=c:
    print("Yes")
if a==c and a!=b:
    print("Yes")
if b==c and a!=b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
import math
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
s = int(readline())
if s % 2 == 1:
    print(0)
else:
    s //= 2
    ans = 0
    while s:
        s //= 5
        ans += s
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C=input.split()
a=int(A)
b=int(B)
c=int(C)
if a==b or b==c or a==c:
    if not(a==b and b==c):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
l=input()
a=int(l[0])
b=int(l[1])
c=int(l[2])
if a==b or b==c or a==c:
    if not(a==b and b==c):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def stringconcant(S,T):
    a = S
    b = T
    c = a+b
    return c

S,T= input().split()
a = stringconcant(T,S)
print(a)

Buggy submission (verdict: Runtime Error):

def findTriplet(arr, n): 

      

    # sort the array 

    arr.sort() 

   

    # for every element in arr 

    # check if a pair exist(in array) whose 

    # sum is equal to arr element 

    i = n - 1

    while(i >= 0): 

        j = 0

        k = i - 1

        while (j < k): 

            if (arr[i] == arr[j] + arr[k]): 

                 

                # pair found 

                print "numbers are ", arr[i], arr[j], arr[k] 

                return

            elif (arr[i] > arr[j] + arr[k]): 

                j += 1

            else: 

                k -= 1

        i -= 1

          

    # no such triplet is found in array 

    print "No such triplet exists"

   
# driver program 

arr = [ 5, 32, 1, 7, 10, 50, 19, 21, 2 ] 

n = len(arr) 
findTriplet(arr, n) 

  
# This code is contributed by Sachin Bisht
Problem p02833 (python)

Fixed submission:
def fun(n):
    if n%2!=0:
        return 0
    else:
        ans=0
        n//=2
        while(n):
            ans=ans+n//5
            n=n//5
    return ans


n = int(input())
if n>=2:
    print(fun(n))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
n=10000000
sys.setrecursionlimit(n)
def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
ab=int(input())
ll=s(ab)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

Buggy submission (verdict: Runtime Error):
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
  
# Driver code 
  
n=input();
  
print(findTrailingZeros(n))

Buggy submission (verdict: Runtime Error):
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
  
# Driver code 
  
 input(n)
  
print(findTrailingZeros(n))

Buggy submission (verdict: Runtime Error):
n=int(input('enter number'))
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  
print("Double factorial is",  
       doublefactorial(n));

print('trailing zeroes are'+ str(trailing_zeros(doublefactorial(n))))

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n = int(readline())
if n % 2 == 1:
    print(0)
else:
    n //= 2
    answ = 0
    while n:
        n //= 5
        answ += n
    print(answ)
Problem p02835 (python)

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

Buggy submission (verdict: Runtime Error):
inp = input().split()

input().split() == "" == ["", "",""]

A = int(inp[0])
B = int(inp[1])
C = int(inp[2])

if A + B + C >= 22:
	print("bust")
else:
	print("win")
Problem p02836 (python)

Fixed submission:
s = input()
l = list(s)
i = 0
j = len(l)-1
cnt = 0
while(i < j):
    if l[i] != l[j]:
        cnt = cnt+1

    i = i+1
    j = j-1

print(cnt)

Buggy submission (verdict: Runtime Error):
given = input()
a = int(given) // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
given = input()
a = given // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)
Problem p02879 (python)

Fixed submission:
def main(a, b):
    if a>9:
        return -1
    if b>9:
        return -1
        
    return a*b

inp = input().split();
a = int(inp[0])
b = int(inp[1])
print(main(a,b))

Buggy submission (verdict: Runtime Error):
s = raw_input()
a,b = s.split('/')
a,b = int(a),int(b)

def mul(a,b):
    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1

print mul(a,b)

Buggy submission (verdict: Runtime Error):

A = int(input())
B = int(input())

C=A*B
if A <= 9 and B <= 9:
	print(C)
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
A=variable
B=variable_2
A=9
B=9
if A*B=81;
	print("81")
else;
	print("-1")

Buggy submission (verdict: Runtime Error):
a=variable
b=variable_2
a=9
b=9
if a*b=81 then;
	print("81")
else;
	print("-1")
Problem p02954 (python)

Fixed submission:
s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[-i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)

Buggy submission (verdict: Runtime Error):
s = input()
res = [0] * len(s)
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else:
        res[i-1] += (cnt+1)//2
        res[i] += cnt//2
        cnt = 0
cnt = 0
for i in range(1, len(s)+1):
    if s[-i] == "L":
        cnt += 1
    else:
        res[i] += cnt//2
        res[-i+1] += (cnt+1)//2
        cnt = 0
print(*res)
Problem p02987 (python)

Fixed submission:
S=input()
d={}
for i in S:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
v=list(d.values())
if len(d)==2:
    if (v[0]==2)and(v[1]==2):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input()
a={}
for i in s:
    if i not in a:
        a[i]=1
    else:
        a[i]+=1
count=0

if len(a)==2:
    for i in a:
        if a[i]==2:
            pass
        else:
            count+=1
    if count == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No"
Problem p03011 (python)

Fixed submission:
p,q,r=map(int,input().split())
sum=min(p+q,q+r,p+r)
print(sum)

Buggy submission (verdict: Runtime Error):
valores = [int(input()), int(input()), int(input())]
del(valores[valores.index(max(valores))])
print(valores[0]+valores[1])
Problem p03013 (python)

Fixed submission:
I=lambda:list(map(int,input().split()))
n,m=I()
b=[int(input()) for i in range(m)]
b=list(set(b))
f={}
for i in b:
    f[i]=1
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    if not f.get(i,0):
        dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
print(dp[n])

Buggy submission (verdict: Runtime Error):
def f(i):

    if(dp[i] != -1):
        return dp[i]
    if e[i] != 1:
        return 0
    else:
        dp[i] = f(i+1) + f(i+2)
        return dp[i]


n,m = list(map(int,input().split()))
e = [1] * n
dp = [-1] * n
dp.append(1)
dp[n-1] = 1
for i in range(m):
    e[int(input())] = 0
print(f(0) % 1000000007)

Buggy submission (verdict: Runtime Error):


def f(i):

    if(dp[i] != -1):
        return dp[i]
    if(i==n or i==n-1):
        return 1
    if e[i] != 1:
        return 0
    else:
        dp[i] = f(i+1) + f(i+2)
        return dp[i]


n,m = list(map(int,input().split()))
e = [1] * n
dp = [-1] * n
dp.append(-1)

for i in range(m):
    e[int(input())] = 0
print(f(0) % 1000000007)
Problem p03018 (python)

Fixed submission:
s=input()
n=0
c=0
i=0
while i<len(s):
  if s[i]=="A":
    c+=1
  elif s[i:i+2]=="BC":
    n+=c
    i+=1
  else:
    c=0
  i+=1
print(n)

Buggy submission (verdict: Runtime Error):
s = raw_input()
n = 0

def mul(s):
    if len(s) < 3:
        return 0
    n = 0
    flag = True
    while flag:
        res = 0
        s1 = s
        _res = 0
        for i in xrange(len(s) - 2):
        	j = j + _res
            str = s[j:(j+3)]
            if str == "ABC":
                n = n + 1
                res = res + 1
                _res = _res + 2
                s1 = s1[:j] + "BCA"+ s1[j+3:]
        if res == 0:
            flag =False
        s = s1
    return n
print mul(s)

Buggy submission (verdict: Runtime Error):
s = raw_input()
# a, b = s.split(' ')
# a, b = int(a), int(b)
n = 0

def mul(s, n):
    if len(s) < 3:
        return 0
    for i in xrange(len(s) - 2):
        str = s[i:(i+3)]
        if str == "ABC":
            n = n + 1
            # print(s[:i] + "BCA"+ s[i+3:])
            return mul(s[:i] + "BCA"+ s[i+3:], n)
            # _str[i:i+3] = "BCA"+ _str[i+3:]
    return n
print mul(s,n)

Buggy submission (verdict: Runtime Error):
def check(s,cnt):
    if ('ABC' in s):
        s=s.replace('ABC','BCA',1)
        cnt+=1
        check(s,cnt)
    else :
        print(cnt)

s=input()
cnt=0
(check(s,cnt))
Problem p03036 (python)

Fixed submission:
a, b, c = map(int, input().split())
for i in range(10):
    c =  a * c - b
    print(c)

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main()
{
    int I,d,r,x1,x2,x3,x4,x5 ,x6 ,x7 ,x9 ,x8 ,x10;
    cin >> I>> d>>r;
    x1=r*I-d;
    x2=r*x1-d;
    x3=r*x2-d;
    x4=r*x3-d;
    x5=r*x4-d;
    x6=r*x5-d;
    x7=r*x6-d;
    x8=r*x7-d;
    x9=r*x8-d;
    x10=r*x9-d;
    cout << x1 <<endl;
    cout <<x2 <<endl;
    cout <<x3 <<endl;
    cout <<x4 <<endl;
    cout <<x5 << endl;
    cout <<x6 <<endl;
    cout <<x7 <<endl;
    cout <<x8 <<endl;
    cout <<x9<<endl;
    cout <<x10<<endl;






    return 0;
}
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if a<b<c<d<e :
  if e - a <= k :
    if d - a <= k:
      if c - a <= k:
        if b - a <= k:
          print('Yay!')
  else:
    print(":(")

Buggy submission (verdict: Runtime Error):
from itertools import combinations

line = input()
ant = [int(n) for n in line.split()]
comb = tuple(combinations(ant[:5], 2))

for i,j in comb:
    if j-i > ant[5]:
        a = -1
        print(":(")
        break
    else:
        pass
if a != -1:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
while True:
    try:
        line = input()
        res = ""
        for i in range(len(line)-2):
            if line[i+1]-line[i]<= line[-1]:
                res = "Yay!"
            else:
                res = ":("
                break
        print(res)
    except EOFError:
        break
Problem p03272 (python)

Fixed submission:
n,i=map(int,input().split())
print (n-i+1)

#comment

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


a=int(input())


print(int(n-a+1))

Buggy submission (verdict: Runtime Error):
N,i=map(int,input().split())
k=(N-i)+1
print(k)

Buggy submission (verdict: Runtime Error):
n =int(input("enter number of car_train. "))
i = int(input("enter ith from the front  of train . "))
def train(n ,i):
    if n == i:
        print (1)
    else :
        print ((n-i)+1)



train(n,i)
Problem p03307 (python)

Fixed submission:
def main():
    a, b = 2, int(input())
    ta, tb = a, b
    if b == 0: print(0)
    while a%b != 0:
       a, b = b, a%b
    print(int((ta*tb)/b))
main()

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())
def lcm2(x):
    return x * 2 // gcd(x, 2)
print(lcm2(n))
Problem p03803 (python)

Fixed submission:
l1 = input().split()
a = int(l1[0])
b = int(l1[1])
if a == b:
    print("Draw")
    exit()
if a == 1:
    print("Alice")
    exit()
if b ==1:
    print("Bob")
    exit()
if a > b:
    print("Alice")
if b > a :
    print("Bob")

Buggy submission (verdict: Runtime Error):

n = int(input())
m = int(input())

if n == 1:
    n = 14
if m == 1:
    m = 14

if n > m:
    print("Alice")
elif m > n:
    print("Bob")
else:
    print("Draw")
Problem p03834 (python)

Fixed submission:
s=' '
s= input ()
b=s.replace("," ," ")
print (b)

Buggy submission (verdict: Runtime Error):
s=str(input("enter a statment))
z=s.replace(","," ")
print(z)

Buggy submission (verdict: Runtime Error):
s=str(input("enter a statment))
z=s.replace(","," ")
print(z)

Buggy submission (verdict: Runtime Error):
#adfjklsdjsfljfl;kdjldkjflkdsdfjksfjdklsfjdkjsfdjfsddfsfsdfsdfdfs
print(s.replace(',', ' '))
Problem p03986 (python)

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

s = raw_input()

s1 = []
for x in s:
	if not s1:
		s1.append(x)
		continue
	if x == 'T' and s1[-1] == 'S':
		# s1 = s1[:-1]
		del s1[-1]
	else:
		s1.append(x)

print len(s1)

Buggy submission (verdict: Runtime Error):
@parallel
@roles('allgame')
def _last_redis_save():
	with cd(get_deploy_path()):
		redisSet = set()
		ret = run('supervisorctl status')
		for line in ret.split('\n'):
			line = line.strip()
			if line.find('RUNNING') >= 0 and line.find('redis') >= 0:
				name = line.split()[0].strip()
				redisSet.add(name)

		ret = []
		with cd('db'):
			for redis in sorted(list(redisSet)):
				port = redis[5:]
				ret.append(run('ls -l -h game%s.rdb' % port))
		return '\n'.join(ret)

def last_redis_save():
	result = execute(_last_redis_save)
	for k in sorted(result.keys()):
		print '-'*20
		print k, ':'
		v = result[k]
		print v
Problem p02916 (python)

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

def tarou(n,a,b,c):
	manzoku = b[a[0]-1]
	for i in range (1,n):
		manzoku += b[a[i]-1]
		if a[i]-a[i-1] == 1:
				manzoku += c[a[i]-2]
	print (manzoku)
tarou (n,a,b,c)

Buggy 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()))

def tarou(n,a,b,c):
	manzoku = b[a[0]-1]
	for i in range (1,n):
		manzoku += b[a[i]-1]
		if a[i]-a[i-1] == 1:
				manzoku += c[i]
	print (manzoku)
tarou (n,a,b,c)
Problem p03036 (python)

Fixed submission:
r,d,x0=map(int,input().split())
for i in range(10):
  x0=x0*r-d
  print (x0)

Buggy submission (verdict: Runtime Error):
r,d,x0=map(int,input().split())
for i in range(10):
  x0=xo*r-d
  print (x0)
Problem p03041 (python)

Fixed submission:
n,a=map(int,input().split())
l=list(input())
if l[a-1]=='A':
  l[a-1]='a'
if l[a-1]=='B':
  l[a-1]='b'
if l[a-1]=='C':
  l[a-1]='c'
k=''.join(l)
print(k)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
l=list(input())
if l[a]=='A':
  l[a]='a'
if l[a]=='B':
  l[a]='b'
if l[a]=='C':
  l[a]='c'
k=''.join(l)
print(k)
Problem p02547 (python)

Fixed submission:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
cnt=0
for i in range(n):
    x,y=map(int,input().split())
    if x==y:
        cnt+=1
    else:
        cnt=0
    if cnt>=3:
        print("Yes")
        break
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
cnt=0
for i in range(n):
    x,y=map(int,input())
    if x==y:
        cnt+=1
    else:
        cnt=0
    if cnt>=3:
        print("Yes")
        break
else:
    print("No")
Problem p02629 (python)

Fixed submission:
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
l=[chr(i) for i in range(97, 97+26)]
n-=1
i=1
res=0
ans=[]
while True:
    if n>=pow(26,i)+res:
        res+=pow(26,i)
        i+=1
    else:
        keta=i
        n-=res
        break
ans=""
for i in range(keta):
  r=n%pow(26,keta-i-1)
  s=n//pow(26,keta-i-1)
  ans+=l[s]
  n=r
print(ans)

Buggy submission (verdict: Runtime Error):
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
l=[chr(i) for i in range(97, 97+26)]

i=1
res=0
while True:
    if n>pow(26,i)+res:
        res+=pow(26,i)
        i+=1
    else:
        keta=i
        break
ans=""
r=0
sy=0
for k in range(keta):
    r=n//pow(26,keta-k-1)
    n-=pow(26,keta-k-1)*r
    ans+=l[r-1]
print(ans)
Problem p02659 (python)

Fixed submission:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b=input().split()
a=int(a)
ans=math.floor(((a*int(b[0]))*100+(a*int(b[2]))*10+(a*int(b[3])))//100)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
#from collections import deque
#import heapq
#from fractions  import gcd
input=sys.stdin.readline
a,b=input().split()
a=int(a)
b=float(b)
b=int(b*100)
ans=str(a*b)
n=len(ans)
print(int(ans[:n-2]))
Problem p02759 (python)

Fixed submission:
a = int(input())
if a%2==0:
  print(int(a/2))
else:
  print(int((a+1)/2))

Buggy submission (verdict: Runtime Error):
a = [input().split() for l in range(3)]

n=int(input())
b = [(input()) for i in range(n)]
s=[]
for i in range(n):
  for j in range(3):
    if b[i] in a[j]:
      k=a[j].index(b[i])
      s.append([j,k])
      if [j,0] in s and [j,1] in s and [j,2] in s:
        print("Yes")
        break
      elif [0,k] in s and [1,k] in s and [2,k] in s:
        print("Yes")
        break
      elif j==k:
        if [0,0] in s and [1,1] in s and [2,2] in s:
          print("Yes")
          break
        elif [0,2] in s and [1,1] in s and [2,0] in s:
          print("Yes")
          break
  else:
    continue
  break
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a%2=0:
  print(a/2)
else:
  print((a+1)/2)
Problem p02762 (python)

Fixed submission:
import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, m, k = map(int, input().split())
    fgraph = [list() for i in range(n)]
    bgraph = [list() for i in range(n)]
    cgraph = [list() for i in range(n)]
    
    rks = [None] *n
    sys.setrecursionlimit(10**9)
    # r: どの連結成分に存在するかをメモするid
    def dfs(graph,s,r):
        if rks[s] is None:
            rks[s] = r
        for i in range(len(graph[s])):
            if rks[graph[s][i]-1] is not None:
                continue
            dfs(graph, graph[s][i]-1,r)

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

    # print(fgraph)
    #print(bgraph)
    # 連結成分に対してid的なindexをつける
    c = -1
    for i in range(n):
        if rks[i] is None:
            c += 1
            dfs(fgraph, i, c)
    
    for i in range(k):
        c,d = map(int, input().split())
        if rks[c-1] == rks[d-1]:
            bgraph[d-1].append(c)
            bgraph[c-1].append(d)

    counter = Counter(rks)
    for i in range(n):
        # counter[rks[i]] 連結成分のサイズ
        # len(fgraph[i]) 友達の数
        # len(bgraph[i]) 連結成分内のブロックの数
        # 1 自分
        print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#深さ優先探索

import collections

n, m ,k= map(int, input().split())
# 入力値をzero-basedにしつつ格納する
pairs = [tuple(map(lambda x: int(x) - 1, input().split()))
         for _ in range(m)]
node=[[] for _ in range(n)]
block=[[] for _ in range(n)]
for p in pairs:
  node[p[0]].append(p[1])
  node[p[1]].append(p[0])
s=0
seen=[None]*n

sys.setrecursionlimit(10**9)
def dfs(v,c):
  seen[v]=c
  for next_v in node[v]:
    if seen[next_v]!=None:
      continue
    else:
      dfs(next_v,c)
      
for i in range(n):
  if seen[i]!=None:
    continue
  else:
    dfs(i,s)
    s+=1

#ブロックについて
for i in range(k):
  c,d=map(lambda x: int(x) - 1, input().split())
  if seen[c]==seen[d]:
    block[c].append(d)
    block[d].append(c)
  
count=collections.Counter(seen)
for i in range(n):
  print(count[seen[i]]-len(node[i])-1-len(block[i]))
  
print(block)

Buggy submission (verdict: Runtime Error):
#深さ優先探索

import collections

n, m ,k= map(int, input().split())
# 入力値をzero-basedにしつつ格納する
pairs = [tuple(map(lambda x: int(x) - 1, input().split()))
         for _ in range(m)]
node=[[] for _ in range(n)]
block=[[] for _ in range(n)]
for p in pairs:
  node[p[0]].append(p[1])
  node[p[1]].append(p[0])
s=0
seen=[None]*n
def dfs(v,c):
  seen[v]=c
  for next_v in node[v]:
    if seen[next_v]!=None:
      continue
    else:
      dfs(next_v,c)
      
for i in range(n):
  if seen[i]!=None:
    continue
  else:
    dfs(i,s)
    s+=1

#ブロックについて
for i in range(k):
  c,d=map(lambda x: int(x) - 1, input().split())
  if seen[c]==seen[d]:
    block[c].append(d)
    block[d].append(c)
  
count=collections.Counter(seen)
for i in range(n):
  print(count[seen[i]]-len(node[i])-1-len(block[i]))