#include using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<> N; vector primes; FOR(i, 2, 20000){ if(isPrime(i)){ primes.push_back(i); } } vector dp(N+1, -1); dp[0] = 0; for(ll p : primes){ for(int i=N; i>=0; i--){ if(i-p<0) continue; if(dp[i-p]==-1) continue; dp[i] = max(dp[i], dp[i-p]+1); } } p(dp[N]); return 0; }