/*#include<bits/stdc++.h>
using namespace std;
int isprime(int j)
{
	int k;
	int count2=0;
	for(k=2;k<=sqrt(j);k++)
	{
		if(j%k==0)
		return 1;
		break;
	}
	if(count2==0) 
	return 0;
}
int main()
{
	int i,j,t,n;
	cin>>t;
	for(i=0;i<t;i++)
	{
		int count=0;
		cin>>n;
	if(n<4)
	{
		cout<<0<<endl;
	}
	else
	{
     for(j=4;j<=sqrt(n);j++)
	 {
		 if(n%j==0 && isprime(j)==1)
		 count++;

	 }
	 cout<<count<<endl;
	}
	}
}*/
/*
// Sample code to perform I/O:
 
#include <iostream>
 
using namespace std;
 
int main() {
	int num;
	cin >> num;										// Reading input from STDIN
	cout << "Input number is " << num << endl;		// Writing output to STDOUT
}
 
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
 
int main()
{
	int N = 1000000;
	int prime[1000001] = {0}; // prime sieve...
	int v[1000001]; // array to store all the prime values...
 
	prime[2] = 1;
 
	for(ll i = 3; i <= N; i = i+2)
		prime[i] = 1;
    
    v[0] = 2;
    ll int k = 1;
 
    for(ll int i = 3; i <= N; i += 2)
    {
    	if(prime[i])
    	{
    		v[k] = i;
    		k++;
 
    		for(ll int j = i*i; j <= N; j += 2 * i)
    			prime[j] = 0;
    	}
    }
 
    int t;
    cin >> t;
 
    while(t--)
    {
    	ll int n;
    	cin >> n;
    	ll int i = 0;
    	ll int p1 = v[0];
    	ll int ans = 1 , d = 0;
    	while(p1 * p1 <= n && i < k)
    	{
 
    		ll int c = 0;
    		while(n % p1 == 0)
    		{
    			n = n/p1;
    			c++;
    		}
 
    		if(c > 0)
    			d++;
    		ans*=(c+1);
    		i++;
    		p1 = v[i];
    	}
 
    	if(n != 1)
    	{
    		ans*=2;
    		ans-=1;
    	}
 
    	cout << ans-d << endl;
 
    }
 
return 0;
 
}
Language: C++