#!/usr/bin/env python3
import collections,lzma,os,statistics,sys
for path in sys.argv[1:]:
    src=lzma.open(path,"rt") if path.endswith(".xz") else open(path)
    n=m=0; sizes=collections.Counter(); pos=neg=0; deg=collections.Counter()
    for line in src:
        if not line or line[0]=="c": continue
        if line[0]=="p":
            parts=line.split(); n=int(parts[2]); m=int(parts[3]); continue
        lits=[int(x) for x in line.split()]
        if lits and lits[-1]==0: lits=lits[:-1]
        sizes[len(lits)]+=1
        for lit in lits:
            pos += lit > 0; neg += lit < 0; deg[abs(lit)] += 1
    vals=list(deg.values()) or [0]
    print(os.path.basename(path), "n", n, "m", m, "sizes", dict(sorted(sizes.items())), "pos", pos, "neg", neg, "deg", min(vals), statistics.median(vals), max(vals))
