-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
2 lines (2 loc) · 853 Bytes
/
Copy pathindex.js
File metadata and controls
2 lines (2 loc) · 853 Bytes
1
2
console.log(require('fs').readFileSync('a').toString().split('\n').map(b=>b.split('')).reduce((c,d)=>d.reduce((e,f,g)=>(c.length<=g?c.push([f]):c[g].push(f))?c:c,0),[]).map(h=>h.reduce((i,j)=>[i[0]+(j==1),i[1]+(j==0)],[0,0])).reduce((m,n)=>[m[0]+(n[1]>n[0]?"1":"0"),m[1]+(n[1]>n[0]?"0":"1")],["",""]).reduce((o,p)=>o*parseInt(p,2),1))
console.log(require('fs').readFileSync('a').toString().split('\n').map(b=>b.split('')).reduce((c,d,e,f)=>!c?f.reduce((g,h,i,j)=>!g?parseInt(j[0].reduce((k,l,m)=>k.length>1?k.filter(u=>k.reduce((o,p)=>[o[0]+(p[m]==0),o[1]+(p[m]==1)],[0,0]).reduce((q,r,s,t)=>t[1]<t[0])?u[m]==0:u[m]==1):k,j)[0].join(""),2)*f.reduce((g,h,i,j)=>!g?parseInt(j[0].reduce((k,l,m)=>k.length>1?k.filter(u=>k.reduce((o,p)=>[o[0]+(p[m]==0),o[1]+(p[m]==1)],[0,0]).reduce((q,r,s,t)=>t[1]<t[0])?u[m]==1:u[m]==0):k,j)[0].join(""),2):g,0):g,0):c,0))