fork download
  1.  
  2.  
  3. // Source: https://u...content-available-to-author-only...o.guide/general/io
  4.  
  5. #include <bits/stdc++.h>
  6. using namespace std;
  7. vector<int> prime(1e7 + 10, 1);
  8. void seive() {
  9. prime[0]=0;
  10. prime[1]=0;
  11. for (int i = 2; i * i < prime.size(); i++) {
  12. if (prime[i]) {
  13. for (int j = i*i; j <= prime.size(); j += i) {
  14. prime[j] = 0;
  15. }
  16. }
  17. }
  18. }
  19. int main() {
  20. seive();
  21. int x;
  22. cin >> x;
  23.  
  24. for (int i = 0; i <= x; i++) {
  25. if (prime[i] && prime[x - i]) {
  26. cout << i << ' ' << x-i;
  27. return 0;
  28. }
  29. }
  30. cout << -1;
  31. }
  32.  
Success #stdin #stdout 0.14s 42224KB
stdin
Standard input is empty
stdout
-1