Help for this page

Select Code to Download


  1. or download this
    $ cat input.txt 
    5 5
    ...
    $ perl -e '@j=split$",<>;print$% map$%+=2*$q[$_%@j[1]]++,split$",<>' i
    +nput.txt 
    $ perl -e '@j=split$",<>;map$r+=2*$a[$_%@j[1]]++,split$",<>;print$r' i
    +nput.txt 
    8
    
  2. or download this
    $ perl -e '<>=~/\d+$/;map$r+=2*$a[$_%$&]++,split$",<>;print$r' input.t
    +xt
    8