a[99];f(int*b,int*c){return c[3]-b[3]?:c[9]-b[9]?:c[7]-b[7];}n,*p=a;main(m,l){for(;~scanf("%s",p);n++,p+=10)for(;scanf("%d-%d",&m,&l)>0;)p[2]++,p[m>l?p[3]+=3,4:m==l?p[3]++,5:6]++,p[7]+=m,p[8]+=l,p[9]+=m-l;qsort(a,n,40,f);for(m=!printf("%*s Pt W D L F A GD\n",strlen(p=a)+5,"P");*p;printf(*p++?"%+4d\n":"%4d\n",*p))for(printf("%d %s",++m,p),p+=2,l=7;l--;)printf("%3d",*p++);}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).