vector to store all the prime factors along with their number of occurrence in factorization of B
vector < pair < int , int > > ans ; for ( int i = 2 ; B != 1 ; i ++ ) { if ( B % i == 0 ) { int count = 0 ; while ( B % i == 0 ) { B = B / i ; count ++ ; } ans . push_back ( make_pair ( i , count ) ) ; } } return ans ; }