Problem p03213 (C++)

Buggy submission (status: Runtime Error):
#pragma once
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int t[101];
int pri[26];
int res = 0;

void p756() {
  int N;
  cin >> N;
  pri[0] = 2;
  int pi = 1;
  for (size_t i = 3; i <= 100; i += 2) {
    bool isp = true;
    for (size_t j = 3; j < i; j++) {
      if (i % j == 0) {
        isp = false;
        break;
      }
    }
    if (isp)
      pri[pi++] = i;
  }

  t[1] = 1;
  for (size_t i = 2; i <= N; i++) {
    int ti = i;
    for (size_t j = 0; j < 25; j++) {
      while (ti % pri[j] == 0) {
        t[pri[j]]++;
        ti /= pri[j];
      }
    }
  }

  int dp[26][101];

  for (size_t i = 0; i < 101; i++) {
    dp[0][i] = -1;
  }
  ll res = 0;
  dp[0][1] = 1;

  for (size_t i = 0; i < 26; i++) {
    for (size_t j = 1; j < 101; j++) {
      dp[i + 1][j] = -1;
    }
    dp[i + 1][0] = dp[i][0];
    for (size_t j = 0; j <= t[pri[i]]; j++) {
      for (size_t k = 1; k <= 75; k++) {
        if (dp[i][k] == -1)
          continue;
        int next = dp[i][k];
        if (k * (j + 1) < 101) {

          if (dp[i + 1][k * (j + 1)] < 0) {
            dp[i + 1][k * (j + 1)] = 0;
          }
          dp[i + 1][k * (j + 1)] += next;
        }
      }
    }
  }
  if (dp[25][75] == -1) {
    cout << 0 << endl;
  } else
    cout << dp[25][75] << endl;
}
int main() {

  p756();
  return 0;
}


Fixed submission:
#pragma once
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int t[101];
int pri[26];
int res = 0;

void p756() {
  int N;
  cin >> N;
  pri[0] = 2;
  int pi = 1;
  for (size_t i = 3; i <= 100; i += 2) {
    bool isp = true;
    for (size_t j = 3; j < i; j++) {
      if (i % j == 0) {
        isp = false;
        break;
      }
    }
    if (isp)
      pri[pi++] = i;
  }

  t[1] = 1;
  for (size_t i = 2; i <= N; i++) {
    int ti = i;
    for (size_t j = 0; j < 25; j++) {
      while (ti % pri[j] == 0) {
        t[pri[j]]++;
        ti /= pri[j];
      }
    }
  }

  int dp[27][101];

  for (size_t i = 0; i < 101; i++) {
    dp[0][i] = -1;
  }
  ll res = 0;
  dp[0][1] = 1;

  for (size_t i = 0; i < 26; i++) {
    for (size_t j = 1; j < 101; j++) {
      dp[i + 1][j] = -1;
    }
    dp[i + 1][0] = dp[i][0];
    for (size_t j = 0; j <= t[pri[i]]; j++) {
      for (size_t k = 1; k <= 75; k++) {
        if (dp[i][k] == -1)
          continue;
        int next = dp[i][k];
        if (k * (j + 1) < 101) {

          if (dp[i + 1][k * (j + 1)] < 0) {
            dp[i + 1][k * (j + 1)] = 0;
          }
          dp[i + 1][k * (j + 1)] += next;
        }
      }
    }
  }
  if (dp[25][75] == -1) {
    cout << 0 << endl;
  } else
    cout << dp[25][75] << endl;
}
int main() {

  p756();
  return 0;
}