fork(1) download
  1. n=input();k=m=1;p={0}
  2. while{n-k,k}-p:m*=k*k;k+=1;p|={m%k*k}
  3. print n-k,k
Success #stdin #stdout 0.01s 8976KB
stdin
500
stdout
229 271