Problem:
Score : 400 points

Problem Statement

You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many Shichi-Go numbers (literally "Seven-Five numbers") are there?

Here, a Shichi-Go number is a positive integer that has exactly 75 divisors.

Note

When a positive integer A divides a positive integer B, A is said to a divisor of B.
For example, 6 has four divisors: 1, 2, 3 and 6.

Constraints

1 \leq N \leq 100

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of the Shichi-Go numbers that are divisors of N!.

Sample Input 1

9

Sample Output 1

0

There are no Shichi-Go numbers among the divisors of 9! = 1 \times 2 \times ... \times 9 = 362880.

Sample Input 2

10

Sample Output 2

1

There is one Shichi-Go number among the divisors of 10! = 3628800: 32400.

Sample Input 3

100

Sample Output 3

543

Solution in Rust (1.15.1) (judge verdict: Accepted)

#[allow(unused_imports)]
use std::char::from_digit;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::fs::File;
#[allow(unused_imports)]
use std::io::prelude::*;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Stdin, Stdout, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

type BoxResult<T> = Result<T, Box<std::error::Error>>;


fn main() {
    let mut scanner = Scanner::new(stdin());
    let n = scanner.read::<usize>().unwrap();
    let mut counts = vec![0; 100];
    for i in 2..(n + 1) {
        let new_counts = prime_factorization(i);
        for j in 0..100 {
            counts[j] += new_counts[j];
        }
    }
    let mut ge_2 = 0;
    let mut ge_4 = 0;
    let mut ge_14 = 0;
    let mut ge_24 = 0;
    let mut ge_74 = 0;
    for i in 0..100 {
        if counts[i] >= 2 {
            ge_2 += 1;
        }
        if counts[i] >= 4 {
            ge_4 += 1;
        }
        if counts[i] >= 14 {
            ge_14 += 1;
        }
        if counts[i] >= 24 {
            ge_24 += 1;
        }
        if counts[i] >= 74 {
            ge_74 += 1;
        }
    }
    let mut ans = 0;
    if ge_4 > 0 {
        ans += (ge_2 - ge_4) * ((ge_4 * (ge_4 - 1)) / 2);
    }
    if ge_4 > 2 {
        ans += ((ge_4 * (ge_4 - 1) * (ge_4 - 2)) / 6) * 3;
    }
    if ge_14 > 0 {
        ans += (ge_4 - ge_14) * ge_14;
    }
    if ge_14 > 1 {
        ans += ((ge_14 * (ge_14 - 1)) / 2) * 2;
    }
    if ge_24 > 0 {
        ans += (ge_2 - ge_24) * ge_24;
    }
    if ge_24 > 1 {
        ans += ((ge_24 * (ge_24 - 1)) / 2) * 2;
    }
    if ge_74 > 0 {
        ans += ge_74;
    }
    println!("{}", ans);
}

fn prime_factorization(x: usize) -> Vec<usize> {
    let mut counts = vec![0; 100];
    let mut cand = 1;
    while cand * cand <= x {
        if x % cand == 0 {
            let quotient = x / cand;
            if is_prime(cand) {
                counts[cand] = calc_log(x, cand);
            }
            if is_prime(quotient) && cand != quotient {
                counts[quotient] = calc_log(x, quotient);
            }
        }
        cand += 1;
    }
    counts
}

fn is_prime(n: usize) -> bool {
    if n == 1 {
        return false;
    }
    let mut cand = 2;
    while cand * cand <= n {
        if n % cand == 0 {
            return false;
        }
        cand += 1;
    }
    true
}

fn calc_log(x: usize, q: usize) -> usize {
    let mut count = 0;
    let mut num = q;
    while x % num == 0 {
        count += 1;
        num *= q;
    }
    count
}


#[allow(dead_code)]
struct Scanner<R> {
    reader: BufReader<R>,
    buffer: String,
}
impl<R> Scanner<R>
where
    R: Read,
{
    #[allow(dead_code)]
    fn new(inner: R) -> Scanner<R> {
        let reader = BufReader::new(inner);
        let buffer = String::new();
        Scanner {
            reader: reader,
            buffer: buffer,
        }
    }
    #[allow(dead_code)]
    fn with_capacity(capacity: usize, inner: R) -> Scanner<R> {
        let reader = BufReader::with_capacity(capacity, inner);
        let buffer = String::new();
        Scanner {
            reader: reader,
            buffer: buffer,
        }
    }

    #[allow(dead_code)]
    fn read_line(&mut self) -> BoxResult<String> {
        self.reader.read_line(&mut self.buffer)?;
        let cloned = self.buffer.trim().to_string();
        self.buffer.clear();
        Ok(cloned)
    }

    #[allow(dead_code)]
    fn read<T>(&mut self) -> BoxResult<T>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        self.reader.read_line(&mut self.buffer)?;
        let parsed = self.buffer.trim().parse()?;
        self.buffer.clear();
        Ok(parsed)
    }
    #[allow(dead_code)]
    fn read_vector<T>(&mut self) -> BoxResult<Vec<T>>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        self.reader.read_line(&mut self.buffer)?;
        let parsed_vec = self
            .buffer
            .trim()
            .split_whitespace()
            .map(|s| s.parse())
            .collect::<Result<Vec<_>, _>>()?;
        self.buffer.clear();
        Ok(parsed_vec)
    }
    #[allow(dead_code)]
    fn read_matrix<T>(&mut self, lines: usize) -> BoxResult<Vec<Vec<T>>>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        let mut parsed_matrix = vec![];
        for _ in 0..lines {
            self.reader.read_line(&mut self.buffer)?;
            parsed_matrix.push(
                self.buffer
                    .trim()
                    .split_whitespace()
                    .map(|s| s.parse())
                    .collect::<Result<Vec<_>, _>>()?,
            );
            self.buffer.clear();
        }
        Ok(parsed_matrix)
    }
    #[allow(dead_code)]
    fn read_chars(&mut self) -> BoxResult<Vec<char>> {
        self.reader.read_line(&mut self.buffer)?;
        let chars = self.buffer.trim().chars().collect::<Vec<_>>();
        self.buffer.clear();
        Ok(chars)
    }
}