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

Fixed submission:
from collections import defaultdict
from math import gcd

MOD=10**9+7

n=int(input())
L=[]
for i in range(n):
	l=list(map(int,input().split()))
	L.append(l)

def kikaku(a,b):
	g=gcd(a,b)
	a//=g
	b//=g
	if a<0:
		return -a,-b
	return a,b
#aもbも正の場合Dposでカウント。
Dpos=defaultdict(int)
#aが正bが負の場合Dnegでカウント。
Dneg=defaultdict(int)

zerozero=0
azero=0
bzero=0

for l in L:
	a=l[0]
	b=l[1]
	if a==b==0:
		zerozero+=1
		continue
	if a==0:
		azero+=1
		continue
	if b==0:
		bzero+=1
		continue
	a,b=kikaku(a,b)
	if b>0:
		Dpos[(a,b)]+=1
	else:
		Dneg[(a,-b)]+=1
		Dpos[(-b,a)]+=0

r=1
for k,v in Dpos.items():
	a,b=k
	j=Dneg[(b,a)]
	r*=pow(2,v,MOD)+pow(2,j,MOD)-1
	#print(a,b,v,j,r)
	r%=MOD

r*=pow(2,azero,MOD)+pow(2,bzero,MOD)-1
r%=MOD
r-=1
r%=MOD

ans=r+zerozero
ans%=MOD
print(ans)
#print(Dpos)
#print(Dneg)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

n = int(input())
L = []
for i in range(n):
    l = list(map(int, input().split()))
    L.append(l)

Mod = 10 ** 9 + 7

Pow2 = [1]
for i in range(n):
    Pow2.append(Pow2[-1]*2)

def kikaku(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a < 0:
        return - a, -b
    return a, b

Dpos = defaultdict(int)
Dneg = defaultdict(int)

c = 0
for l in L:
    a, b = kikaku(l[0], l[1])
    if a == b == 0:
        c += 1
    elif b > 0:
        Dpos[(b, -a)] += 1
        Dneg[(b, -a)] += 0
    else:
        Dpos[(a, b)] += 0
        Dneg[(a, b)] += 1

r = 1
for k, v in Dpos.items():
    j = Dneg[k]
    if v > 0 and j > 0:
        r = r * (Pow2[v] + Pow2[j] - 1) % Mod
#    elif v == 0 and j == 0:
#        pass
    else:
        r = r * 2 % Mod 
ans = (r + c - 1) % Mod
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

n = int(input())
L = []
for i in range(n):
    l = list(map(int, input().split()))
    L.append(l)

Mod = 10 ** 9 + 7

Pow2 = [1]
for i in range(n):
    Pow2.append(Pow2[-1]*2)

def kikaku(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a < 0:
        return - a, -b
    return a, b

Dpos = defaultdict(int)
Dneg = defaultdict(int)

c = 0
for l in L:
    a, b = kikaku(l[0], l[1])
    if a == b == 0:
        c += 1
    elif b > 0:
        Dpos[(b, -a)] += 1
        Dneg[(b, -a)] += 0
    else:
        Dpos[(a, b)] += 0
        Dneg[(a, b)] += 1

r = 1
for k, v in Dpos.items():
    j = Dneg[k]
    if v > 0 and j > 0:
        r = r * (Pow2[v] + Pow2[j] - 1) % Mod
    elif v == 0 and j == 0:
        pass
    else:
        r = r * 2 % Mod 
ans = (r + c - 1) % Mod
print(ans)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if a>=k:
    print(k)
elif a<k<=a+b:
    print(a)
else:
    print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
if a>=k:
    print(k)
elif a<k<=a+b:
    print(a)
else:
    print(a-(k-a-b))
Problem p02711 (python)

Fixed submission:
S=input()
for s in S:
    if s=='7':
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
    if S[i]=='R':
        R.append(i+1)
    elif S[i]=='G':
        G.append(i+1)
    else:
        B.append(i+1)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in G:
    for j in B:
        min_n=min(i,j)
        max_n=max(i,j)
        d=abs(i-j)
        if max_n+d in R:
            c+=1
        if (i+j)%2==0 and (i+j)//2 in R:
            c+=1
        if min_n-d in R:
            c+=1

print(r*g*b-c)
Problem p02759 (python)

Fixed submission:
n=int(input())
print((n+2-1)//2)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=[10]*n
for i in range(m):
	s,c=map(int,input().split())
	if L[s-1]==10 or L[s-1]==c:
		L[s-1]=c
	else:
		print('-1')
		exit()
if n==1:
	if L[0]==10:
		print(0)
		exit()
	else:
		print(L[0])
		exit()
else:
	if L[0]==10:
		L[0]=1
	elif L[0]==0:
		print('-1')
		exit()
	else:
		for i in range(1,n):
			if L[i]==10:
				L[i]=0
	print(''.join(map(str,L)))
Problem p02984 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
X=[0]*n
s=0
for i in range(n):
    s+=((-1)**i)*A[i]
X[0]=s//2
for i in range(n-1):
    X[i+1]=A[i]-X[i]
print(*[2*x for x in X])

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
A=list(map(int,input().split()))
B=np.array([[0]*n for i in range(n)])
for i in range(n-1):
	B[i,i]=B[i,i+1]=1
B[n-1,0]=B[n-1,n-1]=1
X=np.linalg.solve(B,A)
print(*[int(2*x) for x in X])
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
l=[1 for i in range(n+1)]
for i in range(m):
    s=int(input())
    l[s]=0
if n!=1:
    for i in range(2,n+1):
        if l[i]!=0:
            a=max(1,l[i-2]) if l[i-2]!=0 else 0
            b=max(1,l[i-1]) if l[i-1]!=0 else 0
            l[i]=a+b
print(l[n]%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
C=[1]
if 1 in a:
	C.append(0)
else:
	C.append(1)
for i in range(2,n+1):
	if i in a:
		C.append(0)
	else:
		c=C[i-1]+C[i-2]
		C.append(c)
print(c%(10**9+7))
Problem p03252 (python)

Fixed submission:
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A:
	if s==t:
		print('Yes')
		exit()
	if i==n:
		print('No')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
n=len(s)
A='abcdefghijklmnopqrstuvwxyz'
i=0
while A and i<n+1:
	if s==t:
		print('Yes')
		exit()
	if s[i]!=t[i]:
		if s[i] in A and t[i] in A:
			s=s.replace(s[i],'X').replace(t[i],s[i]).replace('X',t[i])
			A=A.replace(s[i],'').replace(t[i],'')
	i+=1
print('No')
Problem p02594 (python)

Fixed submission:
X=int(input())
if X>=30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
X=input()
if X>=30:
    print('Yes')
else:
    print('No')
Problem p02685 (python)

Fixed submission:
#!/usr/bin/env python
def modpow(x, y, mod):
    ret = 1
    z = x
    n = len(bin(y)) - 2
    for i in range(n):
        if ((y >> i) & 1):
            ret = ret * z % mod
        z = z * z % mod
    return ret

def modinv(x, mod):
    return modpow(x, mod-2, mod)

def main():
    n, m, k = map(int, input().split())
    mod = 998244353

    c1 = 1
    c2 = 1
    for i in range(1, n):
        c1 = c1 * i % mod
        if i == k:
            c2 = modinv(c1, mod)
    c3 = modinv(c1, mod)
    c3_list = [0] * (k+1)
    c3_list[k] = c3
    for i in range(k-1, -1, -1):
        c3 = c3 * (n-(k-i)) % mod
        c3_list[i] = c3
    comb = (c1 * c2 % mod) * c3_list[0] % mod

    x = m * modpow(m-1, n-k-1, mod) % mod

    ret = x * comb % mod

    for i in range(1, k+1):
        c2 =c2 * (k-i+1) % mod
        comb = (c1 * c2 % mod) * c3_list[i] % mod
        x = x * (m-1) % mod

        ret += x * comb % mod
        ret %= mod

    print(ret)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
def modpow(x, y, mod):
    ret = 1
    z = x
    n = len(bin(y)) - 2
    for i in range(n):
        if ((y >> i) & 1):
            ret = ret * z % mod
        z = z * z % mod
    return ret

def modinv(x, mod):
    return modpow(x, mod-2, mod)

def main():
    n, m, k = map(int, input().split())
    mod = 998244353

    c1 = 1
    for i in range(1, n):
        c1 = c1 * i % mod
        if i == k:
            c2 = modinv(c1, mod)
    c3 = modinv(c1, mod)
    c3_list = [0] * (k+1)
    c3_list[k] = c3
    for i in range(k-1, -1, -1):
        c3 = c3 * (n-(k-i)) % mod
        c3_list[i] = c3
    comb = (c1 * c2 % mod) * c3_list[0] % mod

    x = m * modpow(m-1, n-k-1, mod) % mod

    ret = x * comb % mod

    for i in range(1, k+1):
        c2 =c2 * (k-i+1) % mod
        comb = (c1 * c2 % mod) * c3_list[i] % mod
        x = x * (m-1) % mod

        ret += x * comb % mod
        ret %= mod

    print(ret)


if __name__ == '__main__':
    main()

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

def main():
    n, m, k = map(int, input().split())
    div = 998244353

    ret = 0
    comb = 1
    x = m * ((m-1) ** (n-1))
    for i in range(k+1):
        if i >= 1:
            comb = comb * (n-i) // i % div
            x = x // (m-1)
        ret += comb * x % div
        ret %= div

    print(ret)


if __name__ == '__main__':
    main()
Problem p02835 (python)

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

sum_ = sum(a)

if sum_ <= 21:
    print('win')
else:
    print('bust')

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

sum_ = sum(a)

if sum_ <= 21:
    print(win)
else:
    print(bust)
Problem p02570 (python)

Fixed submission:
d,t,s = map(int,input().split())
if d/s<=t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
d,t,s = map(int,input().split())
if d/s<=t:
  print('Yes')
 else:
  print('No')

Buggy submission (verdict: Runtime Error):
d,t,s = map(int,input().split())
if d/s<=t:
  print('Yes')
 else:
  print('No)
Problem p02629 (python)

Fixed submission:

n = int(input())


def num2alpha(num):
    if num <= 26:
        return chr(64+num)
    elif num % 26 == 0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num % 26)


print(num2alpha(n).lower())

Buggy submission (verdict: Runtime Error):

n = int(input())


def num2alpha(num):
    if num <= 26:
        return chr(64+num)
    elif num % 26 == 0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num % 26)


print(num2alpha(n).lower())
z
Problem p02879 (python)

Fixed submission:
a, b = map(int, input().split())
result = -1
if a in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    if b in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
        result = a*b
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = []
result = "No"
for i in range(1, 10):
    for j in range(i, 10):
        x.append(i*j)
print(x)
if N in x:
    result = "Yes"
print(result)
Problem p02577 (python)

Fixed submission:
a = 0
s = input()
for c in s:
  a += int(c)

if a % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = [0,0,0,0,0,0,0,0,0,0]

a = 0
a[0] = int(input())

for i in range(9):
  while a[i] != 0:
    a[i+1] += a[i] % 10
    a[i] = a[i] // 10 


if a[9] % 9 == 0:
  print('Yes')
else:
  print('No')
Problem p02598 (python)

Fixed submission:
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    l = 1
    r = max(a)
    while l < r:
        m = (l+r)//2
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        if cnt > k: l = m+1
        else: r = m
    print(r)
    


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    l = 0
    r = max(a)
    while l < r:
        m = (l+r)//2
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        if cnt > k: l = m+1
        else: r = m
    print(r)

    


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    l = 0
    r = max(a)
    while l < r:
        m = (l+r)//2
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        if cnt > k: l = m
        else: r = m-1
    print(m)

    


if __name__ == '__main__':
    main()
Problem p02685 (python)

Fixed submission:
class Combination():
    def __init__(self, n, mod=10**9+7):
        self.mod = mod
        self.fac = [1]*(n+1)
        for i in range(1,n+1):
            self.fac[i] = self.fac[i-1] * i % self.mod
        self.invfac = [1]*(n+1)
        self.invfac[n] = pow(self.fac[n], self.mod - 2, self.mod)
        for i in range(n-1, 0, -1):
            self.invfac[i] = self.invfac[i+1] * (i+1) % self.mod
    
    def combination(self, n, r):
        ans = self.fac[n] * self.invfac[r] % self.mod * self.invfac[n-r] % self.mod
        if n >= r:
            return ans
        else:
            return 0
    
    def factorial(self, i):
        return self.fac[i]
    
    def invfactorial(self, i):
        return self.invfac[i]


def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n, m, k = map(int, input().split())
    mod = 998244353
    c = Combination(n,mod)
    ans = 0
    mex = [0]*(k+1)
    mex[0] = pow(m-1,n-k-1,mod)
    for i in range(1,k+1):
        mex[i] = mex[i-1]*(m-1)%mod
    mex = mex[::-1]
    for i in range(k+1):
        ans += c.combination(n-1, i)*mex[i]
        ans %= mod
    ans *= m
    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
class Combination():
    def __init__(self, n, mod=10**9+7):
        self.mod = mod
        self.fac = [1]*(n+1)
        for i in range(1,n+1):
            self.fac[i] = self.fac[i-1] * i % self.mod
        self.invfac = [1]*(n+1)
        self.invfac[n] = pow(self.fac[n], self.mod - 2, self.mod)
        for i in range(n-1, 0, -1):
            self.invfac[i] = self.invfac[i+1] * (i+1) % self.mod
    
    def combination(self, n, r):
        ans = self.fac[n] * self.invfac[r] % self.mod * self.invfac[n-r] % self.mod
        if n >= r:
            return ans
        else:
            return 0
    
    def factorial(self, i):
        return self.fac[i]
    
    def invfactorial(self, i):
        return self.invfac[i]


def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n, m, k = map(int, input().split())
    mod = 998244353
    c = Combination(n,mod)
    ans = 0
    mex = [0]*(k+1)
    mex[0] = pow(m-1,n-k-1,mod)
    for i in range(1,k+1):
        mod[i] = mex[i-1]*(m-1)%mod
    mex = mex[::-1]
    for i in range(k+1):
        ans += c.combination(n-1, i)*mex[i]
        ans %= mod
    ans *= m
    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()
Problem p02689 (python)

Fixed submission:
import numpy as np
N,M = map(int,input().split())
H = np.array(list(map(int,input().split())))

adj = [[] for _ in range(N)]

for _ in range(M):
    a,b = map(lambda x: int(x) -1 ,input().split())
    if a in adj[b]:
        continue
    adj[a].append(b)
    adj[b].append(a)

ans = 0 
for i, item in enumerate(adj):
     if item == []:
         ans+=1
         continue
     adj_max = max(H[item])
     if H[i] > adj_max:
         ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = list(map(int,input().split()))
ma = [0]*(n)
for i in range(n):
  a,b = map(lambda x: int(x)-1,input().split())
  ma[a] = max(ma[a], h[b])
  ma[b] = max(h[a], ma[b])
ans = 0
for i in range(n):
  if h[i]>ma[i]:
    ans+=1
print(ans)
Problem p02723 (python)

Fixed submission:
import sys

s = list(input())
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, X, Y= map(int, input().split())
K = [0]*(N-1)
for i in range(1,N):
    for j in range(i+1, N+1):
        idx = min([j-i, abs(X-i)+ abs(j-Y)+1, abs(Y-i) + 1 + abs(X-j)])-1
        K[idx] +=1
for value in K:
    print(value)
Problem p02726 (python)

Fixed submission:
N, X, Y= map(int, input().split())
K = [0]*(N-1)
for i in range(1,N):
    for j in range(i+1, N+1):
        idx = min([j-i, abs(X-i)+ abs(j-Y)+1, abs(Y-i) + 1 + abs(X-j)])-1
        K[idx] +=1
for value in K:
    print(value)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0; i < n; i++)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
using LP = pair<ll,ll>;
using P = pair<ll,int>;
ll mod = 998244353;

int main()
{
    int n, x, y;
    cin>> n >> x>>y;
    x--;y--;
    vector<int> table(n,0);
    rep(i, n) rep(j,i){
        int tmp = min(i-j, abs(x-i)+abs(y-j)+1);
        tmp = min(tmp,abs(x-j)+abs(y-i)+1);
        table[tmp]++;
    }
    repran(i, 1, n) cout << table[i] << endl;
}
Problem p02729 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    print(int(n*(n-1)/2 + m*(m-1)/2))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    print(int(n*(n-1)/2 + m(m-1)/2))


if __name__ == '__main__':
    main()
Problem p03038 (python)

Fixed submission:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n, m = map(int, input().split())
    from heapq import heappop, heappush, heapreplace
    a = list(map(int, input().split()))
    from collections import Counter as cc
    a = cc(a)
    q = []
    for key in a:
        heappush(q, (key, a[key]))
    for i in range(m):
        b, c = map(int, input().split())
        now = b
        while q:
            num, cnt = q[0]
            if c <= num: break
            
            if now >= cnt:
                now -= cnt
                heappop(q)
            else:
                heapreplace(q, (num, cnt-now))
                now = 0
                break
        if now != b:
            heappush(q, (c, b-now))
    ans = 0
    for num, cnt in q:
        ans += num*cnt
    print(ans)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n, m = map(int, input().split())
    from heapq import heappop, heappush, heapreplace
    a = list(map(int, input().split()))
    from collections import Counter as cc
    a = cc(a)
    q = []
    for key in a:
        heappush(q, (key, a[key]))
    for i in range(m):
        b, c = map(int, input().split())
        now = b
        while 1:
            num, cnt = q[0]
            if c <= num: break
            
            if now >= cnt:
                now -= cnt
                heappop(q)
            else:
                heapreplace(q, (num, cnt-now))
                now = 0
                break
        if now != b:
            heappush(q, (c, b-now))
    ans = 0
    for num, cnt in q:
        ans += num*cnt
    print(ans)



if __name__ == '__main__':
    main()
Problem p02897 (python)

Fixed submission:
n=int(input())
if n%2==1:
  print(str(((n-1)/2+1)/n)+"\n")
else:
  print(str(1/2)+"\n")

Buggy submission (verdict: Runtime Error):
a=int(input())
if n%2==1:
  print(str(((n-1)/2+1)/2)+"\n")
else:
  print(str(1/2)+"\n")
Problem p02689 (python)

Fixed submission:
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]-1]>H[i[1]-1]:
        B[i[1]-1]=1
    elif H[i[0]-1]<H[i[1]-1]:
        B[i[0]-1]=1
    else:
        B[i[0]-1]=1
        B[i[1]-1]=1
print(B.count(0))

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
for i in A:
    if H[i[0]]>H[i[1]]:
        B[i[0]]=1
    if H[i[0]]<H[i[1]]:
        B[i[1]]=1
print(B.count(0))

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]]>H[i[1]]:
        B[i[0]]=1
    elif H[i[0]]<H[i[1]]:
        B[i[1]]=1
print(B.count(0))

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]]>H[i[1]]:
        B[i[0]]=1
    elif H[i[0]]<H[i[1]]:
        B[i[i]]=1
print(B.count(0))

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]
B=[0]*N
from functools import lru_cache
@lru_cache(maxsize=1000)
for i in A:
    ans=max(H[i[0]-1],H[i[1]-1])
    B[H.index(ans)]=B[H.index(ans)]+1
print(B.count(0))
Problem p02701 (python)

Fixed submission:
N=int(input())
listA=[input() for i in range(N)]
listB=set(listA)
print(len(listB))

Buggy submission (verdict: Runtime Error):
N=int(input())
kuji=[list(map(str,input().split())) for i in range(N)] 
print(len(set(kuji)))
Problem p02729 (python)

Fixed submission:
N,M=list(map(int,input().split()))
from math import factorial as f
f_1,f_2=0,0
if N>1:
    f_1=f(N)/(f(2)*f(N-2))
if M>1:
    f_2=f(M)/(f(2)*f(M-2))
print(int(f_1+f_2))

Buggy submission (verdict: Runtime Error):
from math import factorial as f
f_1,f_2=0,0
if N>1:
    f_1=f(N)/(f(2)*f(N-2))
if M>1:
    f_2=f(M)/(f(2)*f(M-2))
print(int(f_1+f_2))
Problem p02773 (python)

Fixed submission:
N=int(input())
A=[input() for i in range(N)]

from collections import Counter
counter=Counter(A)
m=max(counter.values())
C=[]
for i,value in counter.items():
    if value==m:
        C.append(i)
C=sorted(C)
print(*C,sep='\n')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
D=dict()
C=[]
for i in set(A):
    D[i]=0
for i in A:
    D[i]+=1
ans=0
for i in D.keys():
    if D[i]==max(D.values()):
        C.append(i)
C=sorted(C)
print(*C,sep='\n')
Problem p02831 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

A,B=list(map(int,input().split()))
print(lcm_list([A,B]))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

A,B=list(map(int,input().split()))
print(lcm_list([A,B]))

Buggy submission (verdict: Runtime Error):

import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
A,B=list(map(int,input().split()))
print(lcm(A,B))

Buggy submission (verdict: Runtime Error):

import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
A,B=list(map(int,input().split()))
print(lcm(A,B))
Problem p03835 (python)

Fixed submission:
count=0
K,S=map(int,input().split())
for i in range(K+1):
    for j in range(K+1):
        if S-i-j>=0 and S-i-j<=K:
            count+=1
print(count)

Buggy submission (verdict: Runtime Error):
K,S=map(int,input().split())
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if (i+j+k)==S:
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
K,S=map(int,input().split())
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if (i+j+k)==S:
                count+=1
print(count)