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

Fixed submission:
def E():
    N = int(input())

    sum_ = 0
    c = -1

    for _ in range(N):
        a, b = list(map(int, input().split(' ')))
        if a > b:
            if c == -1:
                c = b
            elif b < c:
                c = b
            
        sum_ += a

    if c == -1:
        print(0)
    else:
        print(sum_ - c)
        
if __name__ == '__main__':
    E()

Buggy submission (verdict: Runtime Error):
try:
    from functools import lru_cache
except ImportError:
    # For Python2
    # pip install backports.functools_lru_cache
    from backports.functools_lru_cache import lru_cache

class Knapsack(object):
    """
    Maximize sum of selected weight.
    Sum of selected size is les than capacity.
    Algorithm: Dynamic Optimization
    ----
    import knapsack
    size = [21, 11, 15, 9, 34, 25, 41, 52]
    weight = [22, 12, 16, 10, 35, 26, 42, 53]
    capacity = 100
    knapsack.knapsack(size, weight).solve(capacity)
    """
    def __init__(self, size, weight):
        self.size = size
        self.weight = weight

    @lru_cache()
    def solve(self, cap, i=0):
        if cap < 0: return -sum(self.weight), []
        if i == len(self.size): return 0, []
        res1 = self.solve(cap,  i + 1)
        res2 = self.solve(cap - self.size[i], i + 1)
        res2 = (res2[0] + self.weight[i], [i] + res2[1])
        return res1 if res1[0] >= res2[0] else res2


def E():
    N = int(input())
    A, B = [], []

    C = 0
    s = []
    w = []
    ans = 0

    for _ in range(N):
        a, b = list(map(int, input().split(' ')))
        if a <= b:
            C += (b - a)
            ans += b
        else:
            s.append(a - b + 1)
            w.append(b)

        A.append(a)
        B.append(b)

    # print(C, s, w)

    if A == B:
        print(0)

    else:
        _ans, _ = Knapsack(s, w).solve(C)
        print(ans + _ans)


if __name__ == '__main__':
    E()
Problem p03733 (python)

Fixed submission:
#!/usr/bin/env python
# coding: utf-8

N, T = map(int, raw_input().split(' '))
t = map(int, raw_input().split(' '))
assert len(t) == N

sum_ = 0
begin = t[0]
end = t[0] + T
for i in range(N):
    if t[i] <= end:
        end = t[i] + T
    else:
        sum_ += (end - begin)
        begin = t[i]
        end = t[i] + T

sum_ += (end - begin)
print sum_

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

N, T = map(int, raw_input().split(' '))
t = map(int, raw_input().split(' '))
assert len(t) == N

begin = t[0]
end = t[0] + T
for i in range(N):
    if t[i] <= end:
        end = t[i] + T
    else:
        sum += (end - begin)
        begin = t[i]
        end = t[i] + T

sum += (end - begin)
print sum
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]
c = [0]*N

c[0]=0
c[1]=abs(h[1]-h[0])
for i in range(2,N):
    c[i] = min(abs(h[i]-h[i-1])+c[i-1],abs(h[i]-h[i-2])+c[i-2])

print(c[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]

def solve(n):
    if n==0:
        return 0
    elif n==1:
        return abs(h[1]-h[0])
    else:
        return min(abs(h[n]-h[n-1])+solve(n-1),abs(h[n]-h[n-2])+solve(n-2))

print(solve(N-1))
Problem p03161 (python)

Fixed submission:
N,K=(int(i) for i in input().split())
h = [int(i) for i in input().split()]
c = [0]*N
for i in range(1,N):
    jumpmax = min(i,K)
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,jumpmax+1)])
print(c[N-1])

Buggy submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
h = [int(i) for i in input().split()]
c = [0]*N
for i in range(1,K+1):
    jumpmax = i
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,jumpmax+1)])
for i in range(K+1,N):
    jumpmax = K
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,jumpmax+1)])
print(c[N-1])

Buggy submission (verdict: Runtime Error):
N,K=(int(i) for i in input().split())
h = [int(i) for i in input().split()]
c = [0]*N
for i in range(1,K+1):
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,i+1)])
for i in range(K+1,N):
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,K+1)])
print(c[N-1])
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh = [[int(i) for i in input().split()] for i in range(N)]

tmpx,tmpy,tmph=0,0,0
for x,y,h in xyh:
    if h>0:
        tmpx,tmpy,tmph=x,y,h
        break

truecx,truecy,trueh=0,0,0
for cx in range(101):
    for cy in range(101):
        largeh=tmph+abs(tmpx-cx)+abs(tmpy-cy)
        flag=True
        for x,y,h in xyh:
            if h != max(largeh-abs(x-cx)-abs(y-cy),0):
                flag = False
                break
        if flag:
            truecx,truecy,trueh=cx,cy,largeh
            break
print(truecx,truecy,trueh)

Buggy submission (verdict: Runtime Error):
N = int(input())
x,y,h=[],[],[]
for i in range(N):
    tmpx, tmpy, tmph = (int(i) for i in input().split())
    x.append(tmpx)
    y.append(tmpy)
    h.append(tmph)

def solve(N,x,y,h):
    for cx in range(101):
        for cy in range(101):
            H = [h[i]+abs(x[i]-cx)+abs(y[i]-cy) for i in range(N)]
            if all([i==H[0] for i in H]):
                return [cx,cy,H[0]]
ans = solve(N,x,y,h)
print(ans[0],ans[1],ans[2])
Problem p03262 (python)

Fixed submission:
import fractions

N,X = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
#d = [abs(X-i) for i in x if abs(X-i)!=0]
d = [abs(X-i) for i in x]

gcd = d[0]
i=1
while True:
    if i>=N:
        break
    gcd = fractions.gcd(gcd,d[i])
    i=i+1 

print(gcd)

Buggy submission (verdict: Runtime Error):
import math

N,X = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
#d = [abs(X-i) for i in x if abs(X-i)!=0]
d = [abs(X-i) for i in x]

gcd = d[0]
i=1
while True:
    if i>=N:
        break
    gcd = math.gcd(gcd,d[i])
    i=i+1 

print(gcd)

Buggy submission (verdict: Runtime Error):
import math

N,X = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
d = [abs(X-i) for i in x if abs(X-i)!=0]

gcd = d[0]
for i in range(len(d)-1):
    gcd = math.gcd(gcd,d[i+1])

print(gcd)

Buggy submission (verdict: Runtime Error):
import math

N,X = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
d = [abs(X-i) for i in x if abs(X-i)!=0]

gcd = d[0]
for i in range(N-1):
    gcd = math.gcd(gcd,d[i+1])

print(gcd)
Problem p03425 (python)

Fixed submission:
N = int(input())
names = []
for i in range(N):
    names.append(input())

M,A,R,C,H= 0,0,0,0,0

for i in range(N):
    if names[i][0]=='M':
        M+=1
    elif names[i][0]=='A':
        A+=1
    elif names[i][0]=='R':
        R+=1
    elif names[i][0]=='C':
        C+=1
    elif names[i][0]=='H':
        H+=1

print(M*A*R + M*A*C + M*A*H + M*R*C + M*R*H + M*C*H + A*R*C + A*R*H + A*C*H + R*C*H)

Buggy submission (verdict: Runtime Error):
def kaijo(a):
    if a==0:
        return 1
    else:
        return a*kaijo(a-1)

def combination(a,b):
    if a<b:
        return 0
    else:
        return kaijo(a)//(kaijo(b)*kaijo(a-b))

N = int(input())
names = []
for i in range(N):
    names.append(input())

M,A,R,C,H,MARCH = 0,0,0,0,0,0

for i in range(N):
    if names[i][0]=='M':
        M+=1
    elif names[i][0]=='A':
        A+=1
    elif names[i][0]=='R':
        R+=1
    elif names[i][0]=='C':
        C+=1
    elif names[i][0]=='H':
        H+=1
MARCH = M + A + R + C + H
Num = [M,A,R,C,H]
ans = combination(MARCH,3)-sum([combination(i,3)+combination(i,2)*(MARCH-i) for i in Num])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
names = []
for i in range(N):
    names.append(input())

M,A,R,C,H = 0,0,0,0,0

for i in range(N):
    if names[i][0]=='M':
        M += 1
    elif names[i][0]=='A':
        A += 1
    elif names[i][0]=='R':
        R += 1
    elif names[i][0]=='C':
        C += 1
    elif names[i][0]=='H':
        H += 1

ALL = M + A + R + C + H

def kaijo(a):
    if a==0:
        return 1
    return a*kaijo(a-1)

def permitation(a,b):
    return kaijo(a)//kaijo(a-b)

def combination(a,b):
    if a==0 or b==0:
        return 0
    elif a<b:
        return 0
    else:
        return permitation(a,b)//kaijo(b)

m2 = combination(M,2)*(ALL-M)
a2 = combination(A,2)*(ALL-A)
r2 = combination(R,2)*(ALL-R)
c2 = combination(C,2)*(ALL-C)
h2 = combination(H,2)*(ALL-H)

mC3 = combination(M,3)
aC3 = combination(A,3)
rC3 = combination(R,3)
cC3 = combination(C,3)
hC3 = combination(H,3)

ALLC3 = combination(ALL,3)

print(ALLC3-m2-a2-r2-c2-h2-mC3-aC3-rC3-cC3-hC3)
Problem p03238 (python)

Fixed submission:
x = input()
if x is "1":
    print("Hello World")
elif x is "2":
    a = int(input())
    b = int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):

N, T = [int(s) for s in input().split()]

c = []
t = []
for n in N:
    inputs = input().split()
    c.append(int(inputs[0]))
    t.append(int(inputs[1]))

min_cost = None
for i in range(N):
    if t[i] <= T and (min_cost is None or c[i] <= min_cost):
        min_cost = c[i]
        result = i

return i

Buggy submission (verdict: Runtime Error):
x = input()
if x is "1":
    print("Hello World")
elif x is "2":
    a, b = [int(s) for s in input().split()]
    print(a+b)
Problem p03325 (python)

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

m = [0]*n
for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] / 2
        m[i] = m[i] + 1

ans = 0
for i in range(n):
    ans = ans + m[i]

print(ans)

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

m = 1
for i in range(n):
    m = m * a[i]

i = 0
while m % 2 == 0:
    m = int(m / 2)
    i = i + 1

print(i)
Problem p03417 (python)

Fixed submission:
n, m = map(int, input().split())
k = 0

if n > m:
    k = n
    n = m
    m = k

if m > 2 and n > 2:
    print((m-2)*(n-2))

elif n == 1:
    if m == 1:
        print(1)
    else:
        print(m - 2)

elif n == 2:
    print(0)

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

if n > m:
    k = n
    n = m
    m = k

if m > 2 and n > 2:
    print((m-2)*(n-2))

elif n == 1:
    if m == 1:
        print(1)
    else:
        print(m - 2)

elif n == 2:
    print(0)
Problem p03548 (python)

Fixed submission:
x,y,z = map(int,input().split())

print(int((x-z)/ (y + z)))

Buggy submission (verdict: Runtime Error):
x,y,z = map(int,input().split())

print(int((x-z)/ (y + z))
Problem p03139 (python)

Fixed submission:
import sys


def main():
    raw = input().split(' ')
    n = int(raw[0])
    a = int(raw[1])
    b = int(raw[2])

    def get_max():
        return min(a, b)

    def get_min():
        return max(a + b - n, 0)

    print("{} {}".format(get_max(), get_min()))


if __name__ == "__main__":
    argv = sys.argv[1:]
    main()

Buggy submission (verdict: Runtime Error):
def main():
    raw = []
    for i in range(4):
        raw.append(input())

    n = int(raw[0])
    a = raw[1]
    b = raw[2]
    c = raw[3]

    difference = [0] * n
    for i in range(n):
        n = {a[i], b[i], c[i]}
        difference[i] = len(n) - 1

    print(sum(difference))


if __name__ == "__main__":
    main()
Problem p03139 (python)

Fixed submission:
s=input().split()
N=int(s[0])
A=int(s[1])
B=int(s[2])
X=min([A,B])
Y=N-max([A,B])
if X-Y>0:
    print(X,X-Y)
else:
    print(X,0)

Buggy submission (verdict: Runtime Error):
N=int(input())
ps=[]
tp=[]
ap=[]
for i in range(N):
  p=input().split()
  ps.append([int(p[0])+int(p[1]),i])
  tp.append(int(p[0]))
  ap.append(int(p[1]))
    
def is_even(num):
  if num % 2 == 0:
    return True
  else:
    return False

T=0
A=0
calc=sorted(ps,reverse=True)
for i in range(N):
  p,j = calc.pop()
  if is_even(i):
    T+=tp[j]
  else:
    A+=ap[j]
print(T-A)
Problem p03149 (python)

Fixed submission:
get=input()
get = get.split(" ")
flg=0
get=list(set(get))
for a in get:
  if int(a) in[1,9,7,4]:
    flg+=1
    
if flg==4:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
get=input()
get = get.split(" ")
flg=0
get=list(set(get))
for a in :
  if int(a) in[1,9,7,4]:
    flg+=1
    
if flg==4:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
get=input()
flg=0
get = list(set(get))
for a in get.split(" "):
  if int(a) in[1,9,7,4]:
    flg+=1
    
if flg==4:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
get=input()
flg=0
for a in get.split():
  if int(a) in[1,9,7,4]
	flg+=1

 if flg==4:
  print("YES")
 else:
  print("NO")

Buggy submission (verdict: Runtime Error):
get=raw_input()
print("YES")
Problem p03139 (python)

Fixed submission:
if __name__ == '__main__':
    n, a, b = input().split()
    N, A, B = int(n), int(a), int(b)

    ans_max = min(A, B)

    if (A + B) <= N:
        ans_min = 0
    else:
        ans_min = max((A + B - N), 0)

    print('{0} {1}'.format(ans_max, ans_min))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    n, a, b = input().split()
    N, A, B = int(n), int(a), int(b)

    ans_max = min(A, B)

    n_mid = N / 2
    if (A + B) <= N
        ans_min = 0
    else:
        ans_min = max((A - n_mid) + (B - n_mid), 0)

    print('{0} {1}'.format(ans_max, ans_min))

Buggy submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
    n, a, b = sys.argv[1:4]
    N, A, B = int(n), int(a), int(b)

    ans_max = min(A, B)

    n_mid = N // 2
    if A <= (n_mid) and B <= (n_mid):
        ans_min = 0
    else:
        ans_min = (A - n_mid) + (B - n_mid)

    print('{0} {1}'.format(ans_max, ans_min))
Problem p03139 (python)

Fixed submission:
from sys import stdin

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]




if B+C <= A:
    print(str(min(B,C)) + ' ' + str(0))
else:
    print(str(min(B,C)) + ' ' +str(B+C-A))

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
A =  stdin.readline().rstrip()
B =  stdin.readline().rstrip()
C =  stdin.readline().rstrip()

str_len = len(A)

count = 0


for i in range(str_len):
    if A[i]==B[i]:
        if C[i]==B[i]:
            continue
        else:
            count = count + 1
    elif A[i]==C[i]:
        count = count + 1
    elif B[i]==C[i]:
        count = count + 1
    else:
        count = count + 2
print(str(count))

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
A =  stdin.readline().rstrip()
B =  stdin.readline().rstrip()
C =  stdin.readline().rstrip()

str_len = len(A)

count = 0


for i in range(str_len):
    if A[i]==B[i]:
        if C[i]==B[i]:
            continue
        else:
            count = count + 1
    elif A[i]==C[i]:
        count = count + 1
    else:
        count = count + 2

print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]




if B+C <= A:
    print(str(max(B,C)) + ' ' + str(0))
else:
    print(str(max(B1,C)) + ' ' +str(B+C-A))
Problem p03210 (python)

Fixed submission:
s = int(input())
if s==3 or s==5 or s==7:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    #print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print(np.abs((ss - 753)).min())

Buggy submission (verdict: Runtime Error):
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    #print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print((ss - 753).max())

Buggy submission (verdict: Runtime Error):
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print((ss - 753).max())
Problem p03211 (python)

Fixed submission:
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    #print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print(np.abs((ss - 753)).min())

Buggy submission (verdict: Runtime Error):
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    print(s[i:i+3])
    ss.append(int(s[i:i+3]))
    
print((ss - 754).max())
Problem p03213 (python)

Fixed submission:
N = int(input())
e = [0] * (N+1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len(list(filter(lambda x: x>=m-1, e)))

print(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)
    +num(5) * (num(5) -1 ) * (num(3) - 2) //2)

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

def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)
    

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

prime_list = make_prime_list(100)
e = len(prime_list)*[0]

for i in range(N):
    cur = i + 2
    for index,j in enumerate(prime_list):
        while cur % j == 0:
            e[index] += 1
            cur //= j
print(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)
    +num(5) * (num(5) -1 ) * (num(3) - 2) //2)

Buggy submission (verdict: Runtime Error):
%%timeit

import math
N = 100

def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)
    

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

prime_list = make_prime_list(100)
e = len(prime_list)*[0]

for i in range(N):
    cur = i + 2
    for index,j in enumerate(prime_list):
        while cur % j == 0:
            e[index] += 1
            cur //= j
print(num(75) + num(25) * (num(3) -1) + num(15) * (num(5) -1)
    +num(5) * (num(5) -1 ) * (num(3) - 2) //2)
Problem p03139 (python)

Fixed submission:
inputstr = input().strip()
inputarray= inputstr.split(" ")
n = int(inputarray[0])
a = int(inputarray[1])
b = int(inputarray[2])
d1 = min(a,b)
if a+b > n:
  d2 = abs(a+b-n)
else:
  d2 = 0
print (str(max(d1,d2)) + " " + str(min(d1,d2)))

Buggy submission (verdict: Runtime Error):
for i in range(1000):
  print("Enter data: ", end="")
  inputstr = input().strip()
  if inputstr == "":
    break
  inputarray= inputstr.split(" ")
  n = int(inputarray[0])
  a = int(inputarray[1])
  b = int(inputarray[2])
  d1 = min(a,b)
  if a+b > n:
    d2 = abs(a+b-n)
  else:
    d2 = 0
  print (str(max(d1,d2)) + " " + str(min(d1,d2)))
Problem p03149 (python)

Fixed submission:
def data_input():
    a,b,c,d = input().split(' ')
    return (a,b,c,d)
def answer():
    a,b,c,d = data_input()
    s = '1974'
    s = s.replace(a,'').replace(b,'').replace(c,'').replace(d,'')
    if len(s) == 0:
        print('YES')
    else:
        print('NO')
answer()

Buggy submission (verdict: Runtime Error):
def data_input():
    a,b,c,d = input().split(' ')
    a = int(a)
    b = int(b)
    c = int(c)
    d = int(d)
    return (a,b,c,d)
def answer():
    a,b,c,d = data_input()
    s = '1974'
    return a in s and b in s and c in s and d in s
answer()

Buggy submission (verdict: Runtime Error):
def data_input():
    a,b,c,d = input().split(' ')
    a = int(a)
    b = int(b)
    c = int(c)
    d = int(d)
    return (a,b,c,d)

def answer():
    a,b,c,d = data_input()
    s = '1974'
    return if a in s and b in s and c in s and d in s
Problem p03280 (python)

Fixed submission:
def abc106_a():
    a, b = map(int, input().split())

    return a * b - a - b + 1


print(abc106_a())

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

    return a * b - a - b + 1


print(abc106_a())

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

    return a * b - a - b + 1


print(abc106_a())
Problem p03282 (python)

Fixed submission:
def abc106_c():
    s = input()
    k = int(input())

    if s[:k].replace("1", "") == "":
        return 1
    else:
        return (s.replace("1", ""))[0]


print(abc106_c())

Buggy submission (verdict: Runtime Error):
def abc106_c():
    s = input()
    k = int(input())

    if s[:k] == "1"*k:
        return 1
    else:
        return (s.replace("1", ""))[0]


print(abc106_c())
Problem p03338 (python)

Fixed submission:
def abc098_b():
    import numpy as np
    n = int(input())
    s = input()
    counts = []
    if len(s) == 2:
        return [0,1][s[0] == s[1]]
    for i in range(1, n - 1):
        x = s[:i]
        y = s[i:]
        count = 0
        for let in set(x):
            if let in set(y):
                count += 1
        counts.append(count)
    return np.max(counts)


print(abc098_b())

Buggy submission (verdict: Runtime Error):

def abc098_b():
    import numpy as np
    n = int(input())
    s = input()
    counts = []
    for i in range(1, n - 1):
        x = s[:i]
        y = s[i:]
        count = 0
        for let in set(x):
            if let in set(y):
                count += 1
        counts.append(count)
    return np.max(counts)


print(abc098_b())
Problem p03423 (python)

Fixed submission:
_num = int(input())
print(_num // 3)

Buggy submission (verdict: Runtime Error):
def ACBC_089_C():
    _num = int(input())
    _namelist = []
    _countM = 0
    _countA = 0
    _countR = 0
    _countC = 0
    _countH = 0

    for i in range(0, _num):
        _name = str(input())
        _namelist.append(_name)
        if _name[0] == "M":
            _countM += 1
        elif _name[0] == "A":
            _countA += 1
        elif _name[0] == "R":
            _countR += 1
        elif _name[0] == "C":
            _countC += 1
        elif _name[0] == "H":
            _countH += 1
    print(_countM * _countA * _countR + \
          _countM * _countA * _countC + \
          _countM * _countA * _countH + \
          _countM * _countR * _countC + \
          _countM * _countR * _countH + \
          _countM * _countC * _countH + \
          _countA * _countR * _countC + \
          _countA * _countR * _countH + \
          _countA * _countC * _countH + \
          _countR * _countC * _countH + \
          )

ACBC_089_C()
Problem p03427 (python)

Fixed submission:
def digit_num(_num):
    _digit = 0
    while _num:
        _digit += 1
        _num //= 10
    return _digit


_num = int(input())
_digit = digit_num(_num)
_topdig = _num // 10 ** (_digit - 1)
_sumlist = [9 * (_digit - 1)]
if (_num - _topdig * 10 ** (_digit - 1)) == 10 ** (_digit - 1) - 1:
    _sumlist.append(_topdig + 9 * (_digit - 1))
else:
    _sumlist.append(_topdig - 1 + 9 * (_digit - 1))

print(max(_sumlist))

Buggy submission (verdict: Runtime Error):
_num = int(input())
_sumlist = []
for i in range(num//10, _num + 1):
    _sum = 0
    while i:
        _sum += i % 10
        i //= 10
    _sumlist.append(_sum)
print(max(_sumlist))
Problem p03633 (python)

Fixed submission:
def abc070_c():
    from fractions import gcd
    n = int(input())
    t = [int(input()) for _ in range(n)]
    ans = t[0]
    for v in t:
        ans = ans * v // gcd(ans, v)

    print(ans)


abc070_c()

Buggy submission (verdict: Runtime Error):
def abc070_c():
    from fractions import gcd
    n = int(input())
    t = [int(input()) for _ in range(n)]
    ans = 1
    for i in range(n):
        ans = int(ans * t[i] / gcd(ans, t[i]))

    print(ans)


abc070_c()

Buggy submission (verdict: Runtime Error):
def abc070_c():
    from math import gcd
    n = int(input())
    t = [int(input()) for _ in range(n)]
    ans = 1
    for i in range(n):
        ans = int(ans * t[i] / gcd(ans, t[i]))

    print(ans)


abc070_c()