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

Fixed submission:
from itertools import permutations as p
from math import factorial as f
from math import sqrt as s

def func(x1, x2, y1, y2): return s((x2-x1) ** 2 + (y2-y1) ** 2)

N = int(input())
xy = list(list(map(int,input().split())) for _ in range(N))

total = 0

for l in p(range(1, N+1)):
  for i in range(N-1):
    total += func(xy[l[i]-1][0], xy[l[i+1]-1][0], xy[l[i]-1][1], xy[l[i+1]-1][1])

print(total / f(N))

Buggy submission (verdict: Runtime Error):
from math import sqrt as s
from math import factorial as f

def func(x1, x2, y1, y2): return s((x2-x1) ** 2 + (y2-y1) ** 2)

N = int(input())
xy = list(list(map(int,input().split())) for _ in range(N))

total = 0

for i in range(N-1):
  for j in range(i+1, N):
    total += func(xy[l[i]][0], xy[l[j]][0], xy[l[i]][1], xy[l[j]][1])

print(total / f(N))

Buggy submission (verdict: Runtime Error):
from math import sqrt as s
from math import factorial as f

def func(x1, x2, y1, y2): return s((x2-x1) ** 2 + (y2-y1) ** 2)

N = int(input())
xy = list(list(map(int,input().split())) for _ in range(N))

total = 0

for i in range(N-1):
  for j in range(i+1, N)
    total += func(xy[l[i]][0], xy[l[j]][0], xy[l[i]][1], xy[l[j]][1])

print(total / f(N))
Problem p02573 (python)

Fixed submission:
class UnionFind(object):

    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


def main():
    N, M = map(int, input().split())

    uf = UnionFind(N)
    for _ in range(M):
        a, b = map(int, input().split())
        uf.union(a-1, b-1)

    ans = max(uf.get_size(i) for i in range(N))
    print(ans)


if __name__ == '__main__':
    main()

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

def main():
    N, M = map(int, input().split())
    g = defaultdict(set)

    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1 
        g[a].add(b)
        g[b].add(a)

    from functools import lru_cache
    def dfs(u, visited: set):
        visited.add(u)
        for v in g[u]:
            if v not in visited:
                dfs(v, visited)

    count = dict()       
    for u in range(N):
        if u in count:
            continue
        visited = set()
        dfs(u, visited)
        # print(visited)
        count[u] = len(visited)
        for v in visited:
            count[v] = len(visited)

    print(max(count.values()))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()

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

def main():
    N, M = map(int, input().split())
    g = defaultdict(set)

    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1 
        g[a].add(b)
        g[b].add(a)

    from functools import lru_cache
    def dfs(u, visited: set):
        visited.add(u)
        for v in g[u]:
            if v not in visited:
                dfs(v, visited)

    count = dict()       
    for u in range(N):
        if u in count:
            continue
        visited = set()
        dfs(u, visited)
        # print(visited)
        count[u] = len(visited)
        for v in visited:
            count[v] = len(visited)

    print(max(count.values()))


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

Fixed submission:
import numpy as np
import numba
from typing import List


@numba.jit
def solver(N: int, S: int, A: np.array) -> int:
    dp = np.zeros((N+1, S+1), dtype=np.int64)

    dp[0,0] = 1
    MOD = 998244353
    for i in range(N):
        for j in range(S+1):
            dp[i+1, j] += 2 * dp[i, j]
            dp[i+1, j] %= MOD
            if j + A[i] <= S:
                dp[i+1, j+A[i]] += dp[i, j]
                dp[i+1, j+A[i]] %= MOD
    return dp[N,S]


def main():
    N, S = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    ans = solver(N, S, np.array(A))
    print(ans)
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import numba
from typing import List


def solver(N: int, S: int, A) -> int:
    dp = [[0] * (S+1) for _ in range(N+1)]

    dp[0][0] = 1
    MOD = 998244353
    for i in range(N):
        for j in range(S+1):
            dp[i+1][j] += 2 * dp[i][j]
            dp[i+1][j] %= MOD
            if j + A[i] <= S:
                dp[i+1][j+A[i]] += dp[i][j]
                dp[i+1][j+A[i]] %= MOD
    return dp[N][S]


def main():
    N, S = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    ans = solver(N, S, A)
    print(ans)
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()
Problem p02761 (python)

Fixed submission:
def main():
    N, M = [int(x) for x in input().split()]
    d = dict()
    for _ in range(M):
        s, c = [int(x) for x in input().split()]
        s -= 1
        if s in d and d[s] != c:
            print(-1)
            return
        d[s] = c

    def is_ok(n) -> bool:
        t = str(n)
        if len(t) != N:
            return False
        for s, c in d.items():
            if t[s] != str(c):
                return False
        return True

    for i in range(10**N):
        if is_ok(i):
            print(i)
            return
    print(-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = [int(x) for x in input().split()]
    d = dict()
    for _ in range(M):
        s, c = [int(x) for x in input().split()]
        if s in d and d[s] != c or (N!=1 and s==1 and c==0):
            print(-1)
            return
        d[s] = c
    nums = [0] * N
    for s, c in d.items():
        nums[s-1] = c
    for i in range(min(d.keys())-1):
        nums[i] = 1
        break
    ans = "".join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np


def main():
    N, M = [int(x) for x in input().split()]
    d = dict()
    for _ in range(M):
        s, c = [int(x) for x in input().split()]
        if s in d and d[s] != c or (s==1 and c==0):
            print(-1)
            return
        d[s] = c
    nums = [0] * N
    for s, c in d.items():
        nums[s-1] = c
    for i in range(min(d.keys())-1):
        nums[i] = 1
    ans = "".join(map(str, nums))
    print(ans)


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

Fixed submission:
import fractions
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    # l = np.lcm.reduce(b)
    l = lcm(b)
    for x in b:
        if l // x % 2 == 0:
            print(0)
            return

    ans = (M//l+1)//2
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    # l = np.lcm.reduce(b)
    l = lcm(b)
    for x in b:
        if l // x % 2 == 0:
            print(0)
            return

    ans = (M//lcm+1)//2
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np


def main():
    N,M=[int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    b = [x//2 for x in a]

    lcm = np.lcm.reduce(b)
    for x in b:
        if lcm // x % 2 == 0:
            print(0)
            return

    ans = (M//lcm+1)//2
    print(ans)


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

Fixed submission:
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


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


def f(X, C, D):
    return X - X//C - X//D + X//lcm(C,D)


def main():
    A, B, C, D = map(int, input().split())

    ans = f(B, C, D) - f(A-1, C, D)
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np

def f(X, C, D):
    return X - X//C - X//D + X//np.lcm(C,D)


def main():
    A, B, C, D = map(int, input().split())

    ans = f(B, C, D) - f(A-1, C, D)
    print(ans)


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

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


[N,X] = [int(x) for x in input().split()]
xs = [int(x) for x in input().split()]

xs.append(X)
xs = sorted(xs)

d = [y-x for x,y in zip(xs[:-1], xs[1:])]

ans = d[0]
for i in range(1, len(d)):
    ans = gcd(ans, d[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

[N,X] = [int(x) for x in input().split()]
xs = [int(x) for x in input().split()]

xs.append(X)
xs = sorted(xs)

d = [y-x for x,y in zip(xs[:-1], xs[1:])]

ans = d[0]
for i in range(1, len(d)):
    ans = math.gcd(ans, d[i])
print(ans)
Problem p03625 (python)

Fixed submission:
def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    import collections
    count = collections.Counter(a)

    valid = {k: v for k, v in count.items() if v >= 2}

    # print(valid)

    m = sorted(valid.items(), reverse=True)

    if len(valid) == 0:
        return 0
    elif m[0][1] >= 4:
        return m[0][0] ** 2
    elif len(valid) >= 2:
        return m[0][0] * m[1][0]
    else:
        return 0


def main():
    print(solve())


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    import collections
    count = collections.Counter(a)

    valid = {k:v for k, v in count.items() if v >= 2}

    # print(valid)

    m = sorted(valid.keys(), reverse=True)
    a, b = m[0], m[1]

    return a*b


def main():
    print(solve())


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

Fixed submission:
X,K,D = map(int, input().split())

X = abs(X)

if X >= K*D:
    print(X - K*D)
else:
    if K%2 == 1:
        X -= D
    
    x1 = X%(2*D)
    print(min(x1, (2*D-x1)))

Buggy submission (verdict: Runtime Error):
X,K,D = map(int, input().split())

X = abs(X)

if X >= K*D:
    print(X - K*D)
else:
    if K%2 == 1:
        X -= D
        k -= 1
    
    x1 = X%(2*D)
    print(min(x1, (2*D-x1)))
Problem p02743 (python)

Fixed submission:
#  --*-coding:utf-8-*--


import math

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

if c < a + b:
    print('No')
elif 4*a*b < (c - a - b)**2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--


import math

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

g = math.gcd(math.gcd(a,b), c)
a //= g
b //= g
c //= g

if math.sqrt(a) + math.sqrt(b)  < math.sqrt(c):
    print('Yes')
else:
    print('No')
Problem p02940 (python)

Fixed submission:
#  --*-coding:utf-8-*--


MOD = 998244353

def main():
    N = int(input())
    S = input()

    r,g,b = 0, 0, 0
    rg, rb, gb = 0, 0, 0
    empty=N

    x = 1
    for c in S:
        if c == 'R':
            if gb > 0:
                x = x*gb%MOD
                gb -= 1
            elif g > 0:
                x = x*g%MOD
                g -= 1
                rg += 1
            elif b > 0:
                x = x*b%MOD
                b -= 1
                rb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                r += 1
        elif c == 'G':
            if rb > 0:
                x = x*rb%MOD
                rb -= 1
            elif r > 0:
                x = x*r%MOD
                r -= 1
                rg += 1
            elif b > 0:
                x = x*b%MOD
                b -= 1
                gb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                g+= 1
        else:
            if rg > 0:
                x = x*rg%MOD
                rg -= 1
            elif r > 0:
                x = x*r%MOD
                r -= 1
                rb += 1
            elif g > 0:
                x = x*g%MOD
                g -= 1
                gb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                b += 1

    print(x)
                

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--


MOD = 998244353

def main():
    N = int(input())
    S = input()

    r,g,b = 0, 0, 0
    rg, rb, gb = 0, 0, 0
    empty=N

    x = 1
    for c in S:
        if c == 'R':
            if gb > 0:
                x = x*gb%MOD
                gb -= 1
            elif g > 0:
                x = x*g%MOD
                g -= 1
                rg += 1
            elif b > 0:
                x = x*b%MOD
                b -= 1
                rb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                r += 1
        elif c == 'G':
            if rb > 0:
                x = x*rb%MOD
                rb -= 1
            elif r > 0:
                x = x*r%MOD
                r -= 1
                rg += 1
            elif b > 0:
                x = x*b%MOD
                b -= 1
                ggb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                g+= 1
        else:
            if rg > 0:
                x = x*rg%MOD
                rg -= 1
            elif r > 0:
                x = x*r%MOD
                r -= 1
                rb += 1
            elif g > 0:
                x = x*g%MOD
                b -= 1
                gb += 1
            else:
                x = x*empty%MOD
                empty -= 1
                b += 1

    print(x)
                

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

Fixed submission:
#  --*-coding:utf-8-*--


def gcd(n, m):
    while(m > 0):
        n,m = m, n%m
    
    return n


def f(a, b, c):
    return b//c - (a-1)//c


def main():
    A,B,C,D = map(int, input().split())
    
    x = B - A + 1 - f(A,B,C) - f(A, B, D) + f(A, B, C*D//gcd(C, D))
    print(x)





if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--


import math

def f(a, b, c):
    return b//c - (a-1)//c


def main():
    A,B,C,D = map(int, input().split())
    
    x = B - A + 1 - f(A,B,C) - f(A, B, D) + f(A, B, C*D//math.gcd(C, D))
    print(x)





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

Fixed submission:
#  --*-coding:utf-8-*--

def f(s):
    return 'Yes' if (s.find('AC') != -1) else 'No'

def test():
    assert f('BACD') == 'Yes'
    assert f('ABCD') == 'No'
    assert f('CABD') == 'No'
    assert f('ACACA') == 'Yes'
    assert f('XX') == 'No'


def main():
    print(f(input()))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    bits = [2**i for i in range(26)]
    lenOfStr = len(str)

    for c in str:
        pat ^= bits[ord(c)-97]
        s[pat] = min(
            min(s.get(pat^bit, lenOfStr) + 1 for bit in bits),
            s.get(pat, lenOfStr))

    if pat == 0:
        return 1

    return s[pat]
            
str = input()
print(f(str))
Problem p03570 (python)

Fixed submission:
#  --*-coding:utf-8-*--

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    bits = [2**i for i in range(26)]
    lenOfStr = len(str)

    for c in str:
        pat ^= bits[ord(c)-97]
        s[pat] = min(
            min(s.get(pat^bit, lenOfStr) + 1 for bit in bits),
            s.get(pat, lenOfStr))

    if pat == 0:
        return 1

    return s[pat]
            
str = input()
print(f(str))

Buggy submission (verdict: Runtime Error):
#  --*-coding:utf-8-*--

import math

def f(str):
    s = {}
    s[0] = 0
    pat = 0

    for c in str:
        pat ^= 2**(ord(c)-97)
        s[pat] = min(
            min(s.get(pat^2**i, math.inf) + 1 for i in range(26)),
            s.get(pat, math.inf))

    if pat == 0:
        return 1

    return s[pat]
            

def test():
    assert f('aabxyyzz') == 2
    assert f('byebye') == 1
    assert f('abcdefghijklmnopqrstuvwxyz') == 26
    assert f('abcabcxabcx') == 3


def main():
    str = input()
    print(f(str))


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

Fixed submission:
s=input()
p=s.count("hi")
if p==len(s)//2 and len(s)%2==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
p=s.count("hi")
if p=len(s)//2 and len(s)%2==0:
  print("Yes")
else:
  print("No")
Problem p02803 (python)

Fixed submission:
from collections import deque
H, W = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "#" else 0 for a in input()] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2
 
def BFS(i0=0):
    Q = deque([i0])
    D = [-1] * (H * W)
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for y in (x+W, x-W, x+1, x-1):
            if X[y] == 0:
                if D[y] == -1:
                    D[y] = D[x] + 1
                    Q.append(y)
    return D
 
ma = 0
for i in range(H):
    for j in range(W):
        if X[i*W+j] == 0:
            ma = max(ma, max(BFS(i*W+j)))
print(ma)

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = map(int, input().split())
X = [1] * (W + 2)
for _ in range(H):
    X += [1] + [1 if a == "#" else 0 for a in input()] + [1]
X += [1] * (W + 2)
H, W = H+2, W+2
 
def BFS(i0=0):
    Q = deque([i0])
    D = [-1] * (H * W)
    D[i0] = 0
    while Q:
        x = Q.popleft()
        for y in (x+W, x-W, x+1, x-1):
            if X[y] == 0:
                if D[y] == -1:
                    D[y] = D[x] + 1
                    Q.append(y)
    return D
 
ma = 0
for i in range(H):
    for j in range(W):
        if X[i*W+j] == 0:
            ma = max(ma, max(BFS(i*W+j)))
print(ma)
from collections import deque
H, W = map(int, input().split())
Problem p02887 (python)

Fixed submission:
n=int(input())
a=input().strip()
x=""
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input().strip()
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))
Problem p02898 (python)

Fixed submission:
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
co=0
c=list(map(int,input().strip().split(' ')))
for i in c:
  if i>=b:
    co+=1
print(co)

Buggy submission (verdict: Runtime Error):
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
cn=0
c=[int(x) for x in input().split(' ')]
for i in c:
  if i>=c:
    cn+=1
print(cn)
Problem p02918 (python)

Fixed submission:
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
c=input().strip()
d=0
if c[0]=='R':
  if c[1]=='R':
    d+=1
  
for i in range(1,a-1):
  if c[i]=='L':
    if c[i-1]=='L':
      d+=1
  elif c[i]=='R':
    if c[i+1]=='R':
      d+=1
if c[a-1]=='L':
  if c[a-2]=='L':
    d+=1
d=d+2*b
if d>(a-1):
  print (a-1)
else:
  print(d)

Buggy submission (verdict: Runtime Error):
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
c=input().strip()
d=0
if c[0]=='R':
  if c[1]=='R':
    d+=1
  
for i in range(1,a-1):
  if c[i]=='L':
    if c[i-1]=='L':
      d+=1
  elif c[i]=='R':
    if c[i+1]=='R':
      d+=1
if c[a-1]=='L':
  if c[a-2]=='L':
    d+=1
d=d+2*k
if d>(a-1):
  print (a-1)
else:
  print(d)
Problem p02927 (python)

Fixed submission:
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(i)
  if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
    c+=1
print (c)

Buggy submission (verdict: Runtime Error):
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print (c)

Buggy submission (verdict: Runtime Error):
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print c
Problem p02618 (python)

Fixed submission:
for i in range(365):
  print("1")

Buggy submission (verdict: Runtime Error):
import random
D = int(input())
C = list(map(int, input().split()))

for i in range(D):
    input()

# 0以下無視 -> ALL0を省く
flg = list()
if max(C) == 0:
    for i in range(len(C)):
        flg.append(1)
else:
    for i in range(len(C)):
        if C[i] <= 0:
            flg.append(0)
        else:
            flg.append(1)

j = 27
for i in range(D):
  while(True):
      j -= 1
      if flg[j-1] == 1:
          break
  print(j)
  if j == 1:
    j = 27

Buggy submission (verdict: Runtime Error):
import random
D = int(input())
C = list(map(int, input().split()))

for i in range(D):
    input()

# 0以下無視
flg = list()
for i in range(len(C)):
    if C[i] <= 0:
        flg.append(0)
    else:
        flg.append(1)

j = 27
for i in range(D):
  while(True):
      j -= 1
      if flg[j-1] == 1:
          break
  print(j)
  if j == 1:
    j = 27

Buggy submission (verdict: Runtime Error):
import random

for i in range(365):
  print(random.randint(1, 26)
Problem p02658 (python)

Fixed submission:
input()
A = list(map(int, input().split()))
A = sorted(A)
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)

Buggy submission (verdict: Runtime Error):
input()
A = list(map(int, input().split()))
A = A.sorted()
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
print(min([N%K,K-N%K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
print(min[N%K,K-N%K])
Problem p02888 (python)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
i = 0
while i < N - 2:
    j = i + 1
    k = j + 1
    while j < N - 1:
        while k < N:
            if L[i] + L[j] <= L[k]:
                ans += k - j - 1
                break
            k += 1
        if k == N:
            ans += k - 1 - j
        j += 1
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
L.sort()
import numpy as np
L = np.array(L)
m = [0] * (L[-1] + 10)
for i in range(L[-1] + 10):
    m[i] = np.count_nonzero(L <= i)
print(L)
print(m)
cnt = 0
for i in range(N):
    for j in range(i + 1, N):
        tot = L[i] + L[j]
        if tot >= len(m) + 1:
            tot = len(m) - 2
        cnt += m[tot + 1] - m[L[j] + 1]
        print(i,j,tot,m[tot + 1],m[L[j] + 1])
print(cnt)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

cnt = 0
for i in range(3):
  if S[i] == T[i]:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

S_list = [*S]
T_list = [*T]

Correct = 0
Count = 0

for i in S_list :
    if i == T_list[Count] :
        Correct += 1
    Count += 1

print(Correct)
Problem p02969 (python)

Fixed submission:
r=int(input());print(3*r**2)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split());print(-(-N//(2*D+1)))