Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
class Program
{
    //static List<string> str = new List<string>();
	static void Main(string[] args)
	{
		// ���̓t�F�[�Y
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);

        // �f������������
        // ���Ƃ���12 = 2^2 * 3 ��3�ɕ�����Ƃ�
        // �ʋ�ʂȂ��E����ʂ���̂Ƃ����{�[���Ǝd�؂�̕��ёւ����l����
        // �{�[��2�d�؂�2�̂Ƃ��̕��ёւ���4!/(2!*2!) = 6�ʂ�
        // �{�[��1�d�؂�2�̂Ƃ��̕��ёւ���3!/2! = 3�ʂ�
        // 3 * 6 = 18 �ʂ�
        
        // M��f������������
        //List<List<int>> factor = new List<List<int>>();
        List<int> factor = new List<int>();
        int div = 2;
        int max = (int)Math.Sqrt(M);
        int cnt = 0;
        do
        {
            if (M % div == 0)
            {
                cnt++;
                M /= div;
            }
            else
            {
                if (cnt > 0)
                {
                    //List<int> list = new List<int>();
                    //list.Add(div);
                    //list.Add(cnt);
                    factor.Add(cnt);
                    cnt = 0;
                }
                div++;
            }
        }
        while (div <= max && div <= M);
        if(cnt > 0)
        {
        	factor.Add(cnt);
        }
        // M > 1�̏ꍇ�A�c�����̂�����������E�E�E
        if (M > 1) factor.Add(1);

        //foreach(var a in factor)
        //{
        //    Console.Write(a + " ");
        //}
        //Console.WriteLine("end");
		
        List<int> pattern = new List<int>();
        List<int> divisor = new List<int>();
        // �e�f������N�̔��ɕ����邱�Ƃ��l����
        for (int i = 0; i < factor.Count; i++ )
        {
            //Console.Write("in loop ");
            // factor[i]�̌��ƁAN-1�̎d�؂�̕��ёւ����l����
            // int a = narabikae(factor[i], N - 1);
            List<List<int>> p = narabikae(factor[i], N - 1);
            pattern.AddRange(p[0]);
            divisor.AddRange(p[1]);
            //Console.WriteLine(p.Count);
        }

        // ������pattern�̒��g��S�Ċ|�����킹������%(10^9 + 7)...
        long ret = 1;
        int j = 0;
        for (int i = 0; i < pattern.Count; i++ )
        {
            if(ret >= 1000000000)
            {
                ret = ret % (1000000007);
            }
            ret *= pattern[i];
            
            while(j<divisor.Count)
            {
	            if(ret%divisor[j] == 0)
	            {
	            	ret /= divisor[j];
	            	j++;
	            }
	            else
	            {
	            	break;
	            }
            }
        }
        ret = ret % (1000000007);
        Console.WriteLine(ret);
    }
    static List<List<int>> narabikae(int a, int b)
    {
        List<int> mole = new List<int>();
        List<int> div = new List<int>();
        int l = Math.Max(a,b);
        int s = Math.Min(a,b);
        for(int i=a+b; i>l; i--)
        	{
        		mole.Add(i);
        	}
        	for(int i=s; i>1; i--)
        	{
        		div.Add(i);        	
        	}
        List<List<int> > ret = new List<List<int> >();
        ret.Add(mole);
        ret.Add(div);
        return ret;
    }

}