The winners of the 21st international obfuscated C code competition were announced. As usual, the participants were surprised by the ability to cram absolutely incredible things into programs up to 4096 bytes. To get maximum pleasure, the organizers of the competition recommend watching the version without spoilers and trying to understand what the program does by the program code.main(l ,a,n,d)char**a;{ for(d=atoi(a[1])/10*80- atoi(a[2])/5-596;n="@NKA\ CLCCGZAAQBEAADAFaISADJABBA^\ SNLGAQABDAXIMBAACTBATAHDBAN\ ZcEMMCCCCAAhEIJFAEAAABAfHJE\ TBdFLDAANEfDNBPHdBcBBBEA_AL\ HELLO, WORLD! " [l++-3];)for(;n-->64;) putchar(!d+++33^ l&1);} 
" or # with coordinates that can be specified at launch). Int L[A],m,b,*D=A, *c,*a=L,C,*U=L,u;s (_){u--&&s(a=*a);} char*B,I,O;S(){b=b --?b:m|read(0,&I,1 )-1;return~I>>b&1; }k(l,u){for(;l<=u; UL<A?*U++=46^l++[ "-,&,,/.--/,:-,'/" ".-,-,,/.-,*,//..," ]:exit(5));}p(Int*m){ return!*U?*m=S()?U++,!S ()?m[1]=p(++U),2:3:1,p(U) :S()?U+=2:p(U[1]++),Um;}x( c){k(7*!b,9);*U++=b&&S();c&&x (b);}d(Int*l){--l[1]||d(l[d(*l), *l=B,B=l,2]);}main(e){for(k(10,33 ),a[4]-=m=e-2&7,a[23]=p(U),b=0;;e-2 ?e?e-3?s(D=a),C=a [3],++1[a=a[2]],d( D):c?D=c,c=*D,*D= a,a=D:exit(L[C+1]) :C--<23?C=u+m&1?O =O+O|C&1,9:write(m ||(O=C+28),&O,1)+ 1:(S(),x(0<b++?k(0, 6),U[-5]=96:0)):( D=B?B:calloc(4,X)) ?B=*D,*D=c,c=D,D[ 2]=a,a[++D[1]]++,D [3]=++C+u:exit(6) )e=L[C++],u=L[C];} #define \ D(s)"<<"#s">>" #define q(s)p(#s) #define S " endobj " #define Y "endstream"S #include <stdio.h> #define o(s) b[s]=_;\ p("%u 0 obj",s); #define E for (c=d;c < 123;c++) #define DANCE "trailer "D\ (/Root 3 0 R /Size %d) "\nstartxref %u %%%%EOF\n*/" #define p(s, ...) _+=printf(s, ##__VA_ARGS__) #define C "<</Type/Page /Parent %d %d R /Resources <<\ /ProcSet[ /PDF/Text]/Font <</U"D(/Subtype/Type1/BaseFont\ /Courier) " /T<</Subtype/Type3 /FontBBox[0 0 10 10]/FontMatrix[\ %f 0 0 %f 0 0]/FirstChar %d/LastChar %d/Encoding<</Differences[%d" typedef int N;typedef char*Nyan;typedef char A;N a,b[64],d=65,_,v [32]={84,0,64,282,90,74,330,85,93,173,167,176,80,208,81,13,7,87 ,160,346,32,128,170,218,16,26}; Nyan w[]={"+*-(,&-&","+*,&-&" ,"+*.&/&","+*/*/+","+*())'('" ,"+**&)&","+*(&'&","+*'*'+", "","+,./","+,-,./","+--,+*" ,"","+,(/","+,),(/","+-),+*" ,"10 0 d0 ","8 7 2 2 re " ,"+*+.'`'@'mi +/+/(mi"};Nyan nyan(Nyan _,N y,A n){ N g=v[~-y%32];Nyan s=w[g>>n&3|n*2]; for(a=0;*_=*s++; a++,_++,*_++=32) {*_+=*_-32?10:0; if(a%2&&*_/16==3 ){if(g>>8)*_=105-*_; _++;*_++=32;*_=~-a&&a-13 ?108:109;}}return n?n-9?nyan (_,y,n-2):_:nyan(_+=~y&' '?sprintf (_,17[w]):0,y,9);}N main(N c){A e[256]; p("/*%%PDF-1.3%%*/")-2;q(#include<stdio.h>\n); q(#define o *_++&& *_-41\n#define);p(" endstream ");q (main(){for(;*_++; *_-40?:putchar(o?*_:o?10:41));\n) ;q(#define endobj return 0;}\n);q(typedef int ET;/) ;q(*);o(1)*b=~(p(D (/Length 2 0 R)"stream\n")) ;for(p("BT 12 818" " Td/%c 12 Tf 12 TL%%%c/" "static char*_=\"" " \\\n",7[v],*v/2);c= getchar(),~c;c-10? p("/%c 12 Tf(\\%o)" "Tj",v[~-c%' '<25[ v]&&!~-(~-c/'@')?0 :7],c):(p("()'"))) ;p("%%\";\nET ");* b-=~_;p(Y"/*");E{a =nyan(e+sprintf(e, 16[w]),c,6)-e;o(c- 59)p(D(/Length %d) "stream\n%s"Y,a,e) ;}o(2)p(" %u"S,*b); o(3)p(D(/Pages 4 0 R)S);o(4)p(D(/Count 1/MediaBox[0 0 595 842]/Kids[5 0 R])S) ;o(5)p(C,4,0,6e-2, 6e-2f,d,122,d);E p( "/%c",~-c/6+~14?c: d);q(]>>/CharProcs<<) ;E if(~-c/6+~14)p( "/%c %d 0 R",c,c+~58); for(q(>>/Widths[), c=59;--c;p(" 10"));a=p ("]>>>>>>/Contents 1 0 R>>"S);for(p("xref\ 0 %d ",--d);c<d;p("%010u\ %05d n ",*(c+++b),NULL)); return!(p(DANCE,d,a));} 
Source: https://habr.com/ru/post/155335/
All Articles