#!/usr/bin/env python3
import sys,lzma,collections,math
for path in sys.argv[1:]:
    f=lzma.open(path,'rt') if path.endswith('.xz') else open(path)
    n=m=0; sizes=collections.Counter(); maxlit=0; allorig=0; binorig=[]; first=[]
    for line in f:
        if line.startswith('p '):
            _,_,n,m=line.split()[:4]; n=int(n); m=int(m)
        elif line and line[0] not in 'c%0\n':
            lits=[int(x) for x in line.split() if x!='0']
            if len(first)<60: first.append(lits)
            sizes[len(lits)]+=1
            maxlit=max(maxlit,*map(abs,lits))
    print(path, 'nvars',n,'clauses',m,'sizes',dict(sorted(sizes.items())))
    print(' first max among raw first clauses', max(max(map(abs,c)) for c in first))
