Harryxun/testdata huggingface dataset:
Buggy python 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)

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 python 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)

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 python 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)

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 python submission (verdict: Time Limit Exceeded):
N,K = (int(i) for i in input().split())


MAX = int(2*N/K+1)

ans1=0
ans2=0
ans3=0

for alpha in range(1,MAX):
    for beta in range(alpha,MAX):
        for gamma in range(beta,MAX):
            a = K*(alpha-beta+gamma)
            b = K*(alpha+beta-gamma)
            c = K*(-alpha+beta+gamma)
            if(all([a>0,b>0,c>0]) and
            all([a<=N*2,b<=N*2,c<=N*2]) and
            all([a%2==0,b%2==0,c%2==0])
            ):
                if a==b and b==c:
                    ans1+=1
                elif a==b or b==c or c==a:
                    ans2+=1
                else:
                    ans3+=1

print(ans1+ans2*3+ans3*6)

Fixed submission:
N,K = (int(i) for i in input().split())

if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+((N-K//2)//K+1)**3)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = (int(i) for i in input().split())

ans=0

MAX = int(2*N/K+1)

for alpha in range(1,MAX):
    for beta in range(1,MAX):
        for gamma in range(1,MAX):
            a = K*(alpha-beta+gamma)
            b = K*(alpha+beta-gamma)
            c = K*(-alpha+beta+gamma)
            if(all([a>0,b>0,c>0]) and
            all([a<=N*2,b<=N*2,c<=N*2]) and
            all([a%2==0,b%2==0,c%2==0])
            ):
                ans+=1

print(ans)

Fixed submission:
N,K = (int(i) for i in input().split())

if K%2==1:
    print((N//K)**3)
else:
    print((N//K)**3+((N-K//2)//K+1)**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

bmax = max(A)
bmin = min(A)-N

def getSadNess(b):
    return sum([abs(A[i]-(b+i+1)) for i in range(N)]) 

def binSearch(bmin,bmax):
    b = (bmin+bmax)//2
    sadb = getSadNess(b)
    sadm = getSadNess(b-1)
    sadp = getSadNess(b+1)
    if sadb<=sadp and sadb<=sadm:
        return sadb
    elif sadb>sadm:
        return binSearch(bmin,b-1)
    else:
        return binSearch(b+1,bmax)
    
print(binSearch(bmin,bmax))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [A[i]-i-1 for i in range(N)]
B.sort()
b = N//2
ans = sum([abs(B[i]-B[b]) for i in range(N)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

bmax = max(A)
bmin = min(A)-N

def getSadNess(A,b):
    return sum([abs(A[i]-(b+i+1)) for i in range(N)]) 

def binSearch(A,bmin,bmax):
    b = (bmin+bmax)//2
    sadb = getSadNess(A,b)
    sadm = getSadNess(A,b-1)
    sadp = getSadNess(A,b+1)
    if sadb<=sadp and sadb<=sadm:
        return sadb
    elif sadb>sadm:
        return binSearch(A,bmin,b)
    else:
        return binSearch(A,b,bmax)
    
print(binSearch(A,bmin,bmax))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [A[i]-i-1 for i in range(N)]
B.sort()
b = N//2
ans = sum([abs(B[i]-B[b]) for i in range(N)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

def getSadness(A,b):
    ret = 0
    for i in range(N):
        ret += abs(A[i]-(b+i+1))
    return ret

sad0 = getSadness(A,0)
sad1 = getSadness(A,1)

min = min(sad0,sad1)
new = min

i=1
while True:
    if sad0<sad1:
        new = getSadness(A,-i)
    else:
        new = getSadness(A,i+1)
    if new<min:
        min = new
    else:
        break
    i += 1

print(min)
    


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [A[i]-i-1 for i in range(N)]
B.sort()
b = N//2
ans = sum([abs(B[i]-B[b]) for i in range(N)])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
substring = []

for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        substring.append(s[i:j])

setsubstring = list(set(substring))
setsubstring.sort()

print(setsubstring[K-1])

Fixed submission:
s = input()
K = int(input())
substring = []

for i in range(len(s)+1):
    for j in range(i+1,i+K+1):
        if j >len(s):
                break
        else:
                substring.append(s[i:j])

setsubstring = list(set(substring))
setsubstring.sort()

print(setsubstring[K-1])
Buggy python 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)

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 python 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)

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 python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]

s = set(a)
rem = 0
for i in s:
    c = a.count(i)
    if i<c:
        rem += c-i
    elif i>c:
        rem += c

print(rem)

Fixed submission:
from collections import Counter

N = int(input())
a = [int(i) for i in input().split()]

C = Counter(a)
ans = 0

for i in C:
    if C[i] > i:
        ans += C[i]-i
    elif C[i] < i:
        ans += C[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]

rem = 0
d = [0]

for i in range(N):
    if not(a[i] in d):
        d.append(a[i])
        if a.count(a[i]) < a[i]:
            rem += a.count(a[i])
        elif a.count(a[i]) > a[i]:
            rem += a.count(a[i])-a[i]
print(rem)

Fixed submission:
from collections import Counter

N = int(input())
a = [int(i) for i in input().split()]

C = Counter(a)
ans = 0

for i in C:
    if C[i] > i:
        ans += C[i]-i
    elif C[i] < i:
        ans += C[i]

print(ans)
Buggy python 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

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 python 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)

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 python submission (verdict: Runtime Error):
#!/usr/bin/env python

s = inputs()
for c in s:
    if c == "9":
        print("1", end="")
    else:
        print("9", end="")

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

s = input()
for c in s:
    if c == "9":
        print("1", end="")
    else:
        print("9", end="")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

h = [int(input()) for i in range(n)]
h.sort()

cand = [0]*(n-k+1)
cand[0] = h[k-1] - h[0]


for j in range(1,n-k+1):
    cand[i] = cand[i-1] + h[k+i-1] - h[i]

print(min(cand))

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

h = [int(input()) for i in range(n)]
h.sort()

cand = [0]*(n-k+1)
cand[0] = h[k-1] - h[0]


for j in range(1,n-k+1):
    cand[j] = h[k+j-1] - h[j]

print(min(cand))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))

pole = 0
for i in range(n):
    if a[i] == 1:
        pole = i

l = pole
r = n - 1 - pole

for i in range(k - 1):
    if l % (k - 1) == i:
        if k - i - 1 >= r:
            if l == 0:
                print(0)
            else:
                print(1 + int(l / (k - 1)))
        else:
            if l == 0:
                print(1 + int((r - k + i + 1) / (k - 1)))
            else:
                print(1 + int(l / (k - 1)) + 1 + int((r - k + i + 1) / (k - 1)))

Fixed submission:
s = input()
l = len(s)

p = 0
m = 0

for i in range(l):
    if s[i] == '+':
        p = p + 1
    else:
        m = m + 1

print(p - m)
Buggy python 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)

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 python 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)

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 python submission (verdict: Runtime Error):
x,y,z = map(int,input().split())

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

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

print(int((x-z)/ (y + z)))
Buggy python 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()


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 python submission (verdict: Runtime Error):
N = int(input())

p = [0] * N
for i in range(N):
    p[i].append(int(input()))

m = 0
for i in range(N):
    if p[i] > m:
        m = p[i]

print(sum(p) - m // 2)

Fixed submission:
N = int(input())

p = [0] * N
for i in range(N):
    p[i] = int(input())

m = 0
for i in range(N):
    if p[i] > m:
        m = p[i]

print(sum(p) - m // 2)
Buggy python 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)


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 python 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")

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 python 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")

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 python 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")

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 python submission (verdict: Runtime Error):
get=raw_input()
print("YES")

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 python 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))


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 python 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))


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 python 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))

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 python 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)

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 python 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))

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

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

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

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

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

Fixed submission:
s = int(input())
if s==3 or s==5 or s==7:
	print("YES")
else:
	print("NO")
Buggy python 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())

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 python submission (verdict: Time Limit Exceeded):
S = int(input())
#S = 3600
count = 0

for i in range(S):
    ss = [int(x) for x in list(str(i+1))]
    
    if list(set(ss)) == [3,5,7]:
        count = count + 1

print(count)


Fixed submission:
import numpy as np

S = int(input())
count = 0

dim = len(str(S))

box = np.zeros(([4]*dim),dtype='int64')

for j in range(dim):
    for i in range(4):
        I = [slice(None)]*box.ndim
        I[j] = i
        if i == 0:
            None
        else:
            box[tuple(I)]+= (i*2+1)*10**j

box = box.reshape(4**dim)

for i in np.sort(box).tolist():
    ss = [int(x) for x in list(str(i))]

    if i > S:
        break

    if list(set(ss)) == [3, 5, 7]:

        count = count + 1
print(count)
Buggy python 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)

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 python 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)

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)