C++ solution using sieve property faster than 100% time
\nclass Solution {\npublic:\n    int hell=1000000007;\n    long long fact(long long n)\n    {\n        if(n==0 || n==1) return 1;\n        return ((n%hell)*(fac
```\nclass Solution {\npublic:\n    int hell=1000000007;\n    long long fact(long long n)\n    {\n        if(n==0 || n==1) return 1;\n        return ((n%hell)*(fact(n-1)%hell))%hell;\n    }\n    int numPrimeArrangements(int n) \n    {\n        vector<int> sieve(n+1, -1);\n        sieve[1] = 1;\n        for(int i=2; i*i<=n; i++)\n        {\n            for(int j=i+i; j<=n; j+=i)\n            {\n                sieve[j] = 1;\n            }\n        }\n        long long prime=0, notPrime=0;\n        for(int i=1; i<=n; i++)\n        {\n            (sieve[i]==-1)?prime++:notPrime++;\n        }\n        prime = fact(prime)%hell;\n        notPrime = fact(notPrime)%hell;\n        int ans=(prime*notPrime)%hell;\n        return ans;\n    }\n};\n```
['C', 'C++']