Sponsors

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (E) Bash Plays with Functions Solution in C/C++

#include <cstdio>
const int mod = 1000000007;
int a[1000010][21];
int b[1000010];
int main() {
	int q, r, n;
	a[0][0] = 1;
	for (int j = 1; j < 21; j++) {
		a[0][j] = 2;
	}
	for (int i = 1; i < 1000010; i++) {
		a[i][0] = 1;
		for (int j = 1; j < 21; j++) {
			a[i][j] = a[i-1][j] + a[i][j-1];
			if (a[i][j] >= mod) {
				a[i][j] -= mod;
			}
		}
	}
	for (int i = 2; i < 1000010; i++) {
		if (b[i]) continue;
		for (int j = i; j < 1000010; j += i) {
			b[j] = i;
		}
	}
	scanf("%d", &q);
	while (q--) {
		scanf("%d%d", &r, &n);
		int ans = 1;
		while (n != 1) {
			int k = b[n];
			int c = 0;
			while (n % k == 0) {
				n /= k;
				++c;
			}
			ans = (long long)ans * a[r][c] % mod;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Prioritizing Early Warning Systems...

Prioritizing Early Warning Systems for a Resilient Nepal The urgency...

Primientプリミエント、プリミエント・コベーションの完全所有権を取得

Primient Solidifies Market Position by Acquiring Full Ownership of...

MAGA Thinks Maduro Will...

Why MAGA Circles Think Nicolás Maduro Holds the Key...

Rick Pitino isn’t buying...

Rick Pitino Refuses to Acknowledge ‘Trap Game’ Narrative for...

GOLDEN GLOBES WINNERS… DEVELOPING…

The Golden Globes 2026: Live Winners List is Developing...

Can octopus get attached...

Do Octopuses Form Genuine Bonds with Humans? The Nuanced...

Prioritizing Early Warning Systems for a Resilient Nepal

Prioritizing Early Warning Systems for a Resilient Nepal The urgency surrounding disaster preparedness in Nepal is not a new phenomenon. While modern technology offers sophisticated...

Primientプリミエント、プリミエント・コベーションの完全所有権を取得

Primient Solidifies Market Position by Acquiring Full Ownership of Primient Covation In a significant move poised to reshape the landscape of sustainable ingredient solutions, Primient,...

MAGA Thinks Maduro Will Prove Trump Won in 2020

Why MAGA Circles Think Nicolás Maduro Holds the Key to the 2020 Election The realm of political conspiracy theories often sees familiar ghosts resurrected when...

Rick Pitino isn’t buying into clash with Big East cellar dweller as a St. John’s trap game

Rick Pitino Refuses to Acknowledge ‘Trap Game’ Narrative for St. John’s Big East Matchup As the grueling Big East schedule wears on, college basketball teams...

GOLDEN GLOBES WINNERS… DEVELOPING…

The Golden Globes 2026: Live Winners List is Developing as Hollywood’s Biggest Night Unfolds The curtain has officially risen on the Golden Globes 2026, marking...

Can octopus get attached to humans?

Do Octopuses Form Genuine Bonds with Humans? The Nuanced Answer The question of whether an octopus can genuinely attach itself to a human has captivated...

News From Nancy 1/9/2026 — Save Our Health Care

Five Years After the Insurrection: Reflecting on January 6th and the Fight for Health Care The latest update from the “News From Nancy” series, dated...

OpenAI Hires Co-Founders of AI-Powered Tool Convogo

OpenAI Snaps Up Convogo Co-Founders, Bolstering Expertise in AI Coaching and HR The global race for top artificial intelligence talent continues to heat up, and...

Do ferrets cough up hairballs?

Understanding Ferret Health: Do Ferrets Cough Up Hairballs? For many small pet owners, the sight or sound of a cat coughing up a hairball is...