#include #include #include #include #include int main() { FILE *f = fopen("/tmp/roots30.tsv","r"); if (!f) return 1; char seq[32], author[128], title[256]; std::map c; int n=0; int minseq=1<<30, maxseq=0; while (fscanf(f, "%31s\t%127[^\t]\t%255[^\n]\n", seq, author, title)==3) { c[author]++; n++; int s=atoi(seq); if(smaxseq)maxseq=s; } fclose(f); printf("n=%d seq=%d..%d unique_authors=%zu\n", n, minseq, maxseq, c.size()); int ones=0; std::vector> v; for (auto &kv: c) { if (kv.second==1) ones++; v.push_back({kv.second, kv.first}); } std::sort(v.rbegin(), v.rend()); printf("authors_with_exactly_1_root=%d\n", ones); for (int i=0;i<(int)v.size() && i<8;i++) printf(" %d %s\n", v[i].first, v[i].second.c_str()); }