BEAR Auto Puzzles.lua
--[[
	Made by Megumu#8008
	<3
]]

local f=string.byte;local i=string.char;local c=string.sub;local D=table.concat;local V=math.ldexp;local L=getfenv or function()return _ENV end;local N=setmetatable;local r=select;local t=unpack;local h=tonumber;local function s(f)local e,o,n="","",{}local d=256;local a={}for l=0,d-1 do a[l]=i(l)end;local l=1;local function t()local e=h(c(f,l,l),36)l=l+1;local o=h(c(f,l,l+e-1),36)l=l+e;return o end;e=i(t())n[1]=e;while l<#f do local l=t()if a[l]then o=a[l]else o=e..c(e,1,1)end;a[d]=e..c(o,1,1)n[#n+1],e,d=o,o,d+1 end;return table.concat(n)end;local d=s('25S25V27527625V26227725E27625125624H25224W25B25624W25425325224N27G24N25824H25V25Y27624A25924J24M24N25V25W27624825224Q24725824K25925V26527627H27J25423W27M27O24W27Q24H27427725V1Z26K25V25Z28328F25V25F27624427N26R23K23X23V26R27R26R23N24H25827Q28S27624K24Y25624N28N27725J24325U25R2762642631Z2181V26327526626R27521R29X22B26325N29R1125N25V22B29P29R29T27525T2761627626525F28X21028X25V2632232A42232A726425F2AA2AL26624B29Y2AX2A12432A42432AR2AT29S2AL26526326B25V1429U25V26626Z29Y2BG2A126R2A42A02642BK29S29X25V2AD2752AF27525W26Z29R2162BG28B25N2AJ2A62AM26J2A426J2A728C27521Q2AG26324Z25V182BD25W2C62181A2C82C128X1A2C42642B12CL2B325V25S24B29R1A2AX28B2AI25V1A2AL29Q2182181129R24S2612BD21A2BD27725C27726027V25927O24H24Y28K25624L25229C27524025B24M2DT28T27524D29A25229I27628Q2E527525F2B325U27623R25V2612ED25224R24N24025825B27R26825V25X2762EL2EN24H2EP29I25925224K25V2EC27527S2F225V2502F127624X27T28D27I27K2FB27523N24Y2EY25B2FF25V2DW28V2E025V29E29G25S2212222FV2FV23E28R2DG27Q24G24N24H2562592F727U2DV2EM27R25U2732AG28W28P2CD29X1A2BD2B82BA2GJ27525S2BO1A2BQ2BW2CZ2C025K2GQ2BQ28W1Y2CL25F25U22B25C26B2BY2BA25V25H2C01A2C025D26B24J2D42H825D2CE2D42BD2HE2HG1A2H825G2CT1A2CV25H26J21V2D42CN26X26B2372HH27527126B22R2I325V26P26B1J2I825H26R2GI2BQ26W2572AA2572I42GF1Y27626O24J2CZ2HG25V26T2HB2C026P23N2I71A23N2I424B2I22D02J31Z2D42D126X2D32D527526W22B2CZ22B27527022J2CZ22J2752JB2CP2AL26W21V2CZ2HX25V2712GF1A2IP2IR2CL2IT2IV2752HC2752IY2J02J22JW2J42J92J326B25U2J625V2JB2GI2AL2702JT2CL2JV26P2CN2CM2I425F2KK27526Y2432242D424321824S26326J2D8112L524S25V1B2192181P2LB2DC2DE2DG2762822762ER27525624J29F24H24G25V2DK27527W2DN2DP24N2DR2DT2LU25V28Z2EK25725625B25327F28A2CA25V2452G52532ME2LR2M52M72532BE2ES2FD25424727N27P27R2FL28E2FE2FP2FR24N25U25L29O2D71T2BD2AD2GI27625T25F2GM2AL2N92K52B725V2B32JZ2752632JG2CL2JI22B25D26Z2B3122C026W2BX2182BZ27525D25N29X1H2C425E2CF25V21R2CF2A123V2A423V2A72H52AA2H82HA2J21C2HD2JC2AL25C2CK2KS25V2HJ2CP2HM2NQ2D42NT2NV2K62OQ2O02D42O322R25O2D422R2L226323F2L62P924S2ON2AA2CN2OR25V1W2GK25V29X1D2762CE2L624Z2L22DD2752DF27525G2772FP25024Y25A2DT2LK25V23N25B24Y24Q2522LR2LT27624F25824W24Y25B2Q52Q72Q92EF28Y27N23K2Q924L27J2DT2EG27523K24N24Y24H2DN24424M2562812762QO2EK27R2DT2AL25V2QO2592532E22LZ27D2QF2LZ25828A2G825V23R29G25B2R827624725624G24W27R25326H26R26J24923L24224Q24E26I2DU2RM2EI2802DI27524E24Y27M26R24X24Q26R24E25225024M25A24M26O26J26B26B2C82DG24724M2DO2RI2592E825V26I2B32RL2MV2542EQ28D2GA2QA2RL24X2522Q02LS2LM25V2LO2LQ2LS27927524K27R25424G2LP24W2DT2TM2Q424M24P24P2RP2412G52QB2752M42402M62M82MA2S724D2Q02DT2MC23N2TX2TZ25226R24V26R2412TE25A2LS2UE2UG2RP2UJ26R2ET2MT26W2762602D72142BD2EG2N72752EG2GM2N22CZ2GK2632NH2CI2OX2C02652P02CQ2752B82CF2GN2812OO2CN2N12V727525L2432HX1I2CV25L2IZ25V1I2KA25L24Z132W02O526526R2AJ2BQ2662172P41N2172PR27621229O2K12132IT2A92D82BD26424R29R21324R2752AS29R2182AL2642NL2132JI25V2642JL29S2JN2CW2KN1T2JV2N92KF2JD2BR2EA2KG2NC2AL2XG28C2NH2PN2OA2CL2OC2NO26Z23N25U142C025E25N24Z25U152A62A12B51128X2H42NL1V2X42HA2BT2OK2AJ2AL2NP2XV2XX2752XZ24J2Y22Y42632Y62Y825C2WS29S2WV2H92C0162YF25V2AK2VJ2PK25V2PM2NJ22J2L62Z82LG2PT2BD');local n=bit and bit.bxor or function(l,e)local o,n=1,0 while l>0 and e>0 do local c,a=l%2,e%2 if c~=a then n=n+o end l,e,o=(l-c)/2,(e-a)/2,o*2 end if l<e then l=e end while l>0 do local e=l%2 if e>0 then n=n+o end l,o=(l-e)/2,o*2 end return n end local function l(o,l,e)if e then local l=(o/2^(l-1))%2^((e-1)-(l-1)+1);return l-l%1;else local l=2^(l-1);return(o%(l+l)>=l)and 1 or 0;end;end;local e=1;local function o()local o,l,a,c=f(d,e,e+3);o=n(o,211)l=n(l,211)a=n(a,211)c=n(c,211)e=e+4;return(c*16777216)+(a*65536)+(l*256)+o;end;local function a()local l=n(f(d,e,e),211);e=e+1;return l;end;local function B()local e=o();local o=o();local c=1;local n=(l(o,1,20)*(2^32))+e;local e=l(o,21,31);local l=((-1)^l(o,32));if(e==0)then if(n==0)then return l*0;else e=1;c=0;end;elseif(e==2047)then return(n==0)and(l*(1/0))or(l*(0/0));end;return V(l,e-1023)*(c+(n/(2^52)));end;local h=o;local function s(l)local o;if(not l)then l=h();if(l==0)then return'';end;end;o=c(d,e,e+l-1);e=e+l;local e={}for l=1,#o do e[l]=i(n(f(c(o,l,l)),211))end return D(e);end;local e=o;local function i(...)return{...},r('#',...)end local function R()local f={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};local e={0,0,0};local c={};local d={f,nil,e,nil,c};for l=1,o()do e[l-1]=R();end;local e=o()local c={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};for o=1,e do local e=a();local l;if(e==1)then l=(a()~=0);elseif(e==3)then l=B();elseif(e==0)then l=s();end;c[o]=l;end;d[2]=c d[4]=a();for a=1,o()do local c=n(o(),10);local o=n(o(),217);local n=l(c,1,2);local e=l(o,1,11);local e={e,l(c,3,11),nil,nil,o};if(n==0)then e[3]=l(c,12,20);e[5]=l(c,21,29);elseif(n==1)then e[3]=l(o,12,33);elseif(n==2)then e[3]=l(o,12,32)-1048575;elseif(n==3)then e[3]=l(o,12,32)-1048575;e[5]=l(c,21,29);end;f[a]=e;end;return d;end;local function B(l,D,h)local n=l[1];local o=l[2];local e=l[3];local l=l[4];return function(...)local n=n;local a=o;local s=e;local c=l;local C=i local e=1;local d=-1;local R={};local i={...};local f=r('#',...)-1;local V={};local o={};for l=0,f do if(l>=c)then R[l-c]=i[l+1];else o[l]=i[l+1];end;end;local l=f-c+1 local l;local c;while true do l=n[e];c=l[1];if c<=29 then if c<=14 then if c<=6 then if c<=2 then if c<=0 then local B;local i;local c;local A;local f;local r;local s;o[l[2]]=o[l[3]];e=e+1;l=n[e];s=l[3];r=o[s]for l=s+1,l[5]do r=r..o[l];end;o[l[2]]=r;e=e+1;l=n[e];o[l[2]]=o[l[3]][o[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];f=l[2];A={};c=0;i=f+l[3]-1;for l=f+1,i do c=c+1;A[c]=o[l];end;B={o[f](t(A,1,i-f))};i=f+l[5]-2;c=0;for l=f,i do c=c+1;o[l]=B[c];end;d=i;elseif c==1 then local n=l[3];local e=o[n]for l=n+1,l[5]do e=e..o[l];end;o[l[2]]=e;else local i;local f;local r;local s;local c;c=l[2];s=o[l[3]];o[c+1]=s;o[c]=s[a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;o[c](t(r,1,i-c));d=c;e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;o[c](t(r,1,i-c));d=c;end;elseif c<=4 then if c>3 then o[l[2]]=o[l[3]][a[l[5]]];else if(o[l[2]]==o[l[5]])then e=e+1;else e=e+l[3];end;end;elseif c>5 then local A;local s;local i;local f;local r;local c;o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;o[c](t(r,1,i-c));d=c;e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]();d=c;e=e+1;l=n[e];c=l[2];s=o[l[3]];o[c+1]=s;o[c]=s[a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;A={o[c](t(r,1,i-c))};i=c+l[5]-2;f=0;for l=c,i do f=f+1;o[l]=A[f];end;d=i;e=e+1;l=n[e];if not o[l[2]]then e=e+1;else e=e+l[3];end;else local e=l[2];local c={};local n=0;local l=e+l[3]-1;for l=e+1,l do n=n+1;c[n]=o[l];end;o[e](t(c,1,l-e));d=e;end;elseif c<=10 then if c<=8 then if c>7 then local n=l[2];local e=o[l[3]];o[n+1]=e;o[n]=e[a[l[5]]];else local n=l[2];local c=l[5];local l=n+2;local a={o[n](o[n+1],o[l])};for e=1,c do o[l+e]=a[e];end;local n=o[n+3];if n then o[l]=n else e=e+1;end;end;elseif c==9 then o[l[2]]();d=A;else local d=s[l[3]];local a;local c={};a=N({},{__index=function(e,l)local l=c[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=c[l]l[1][l[2]]=e;end;});for a=1,l[5]do e=e+1;local l=n[e];if l[1]==44 then c[a-1]={o,l[3]};else c[a-1]={D,l[3]};end;V[#V+1]=c;end;o[l[2]]=B(d,a,h);end;elseif c<=12 then if c==11 then e=e+l[3];else o[l[2]]=o[l[3]];end;elseif c>13 then o[l[2]]=o[l[3]][a[l[5]]];else local n=l[2];local e=o[l[3]];o[n+1]=e;o[n]=e[a[l[5]]];end;elseif c<=21 then if c<=17 then if c<=15 then if(o[l[2]]==a[l[5]])then e=e+1;else e=e+l[3];end;elseif c==16 then o[l[2]]=o[l[3]][o[l[5]]];else o[l[2]]=D[l[3]];end;elseif c<=19 then if c>18 then local n=l[2];local a=o[n+2];local c=o[n]+a;o[n]=c;if a>0 then if c<=o[n+1]then e=e+l[3];o[n+3]=c;end;elseif c>=o[n+1]then e=e+l[3];o[n+3]=c;end;else local n=l[2];local c={};local e=0;local l=n+l[3]-1;for l=n+1,l do e=e+1;c[e]=o[l];end;local c,l=C(o[n](t(c,1,l-n)));l=l+n-1;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;end;elseif c>20 then o[l[2]]=h[a[l[3]]];else o[l[2]]=a[l[3]];end;elseif c<=25 then if c<=23 then if c==22 then o[l[2]]=B(s[l[3]],nil,h);else local c;local s,c;local i;local f;local r;local A;local c;o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];c=l[2];A=o[l[3]];o[c+1]=A;o[c]=A[a[l[5]]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;s,i=C(o[c](t(r,1,i-c)));i=i+c-1;f=0;for l=c,i do f=f+1;o[l]=s[f];end;d=i;e=e+1;l=n[e];c=l[2];r={};f=0;i=d;for l=c+1,i do f=f+1;r[f]=o[l];end;s={o[c](t(r,1,i-c))};i=c+l[5]-2;f=0;for l=c,i do f=f+1;o[l]=s[f];end;d=i;e=e+1;l=n[e];e=e+l[3];end;elseif c==24 then o[l[2]][a[l[3]]]=a[l[5]];else local n=l[2];local a=o[n+2];local c=o[n]+a;o[n]=c;if a>0 then if c<=o[n+1]then e=e+l[3];o[n+3]=c;end;elseif c>=o[n+1]then e=e+l[3];o[n+3]=c;end;end;elseif c<=27 then if c>26 then local n=l[2];local a={};local e=0;local c=n+l[3]-1;for l=n+1,c do e=e+1;a[e]=o[l];end;local c={o[n](t(a,1,c-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else local n=l[2];local c={};local e=0;local a=d;for l=n+1,a do e=e+1;c[e]=o[l];end;local c={o[n](t(c,1,a-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;end;elseif c==28 then o[l[2]]={};else local f=s[l[3]];local d;local c={};d=N({},{__index=function(e,l)local l=c[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=c[l]l[1][l[2]]=e;end;});for a=1,l[5]do e=e+1;local l=n[e];if l[1]==44 then c[a-1]={o,l[3]};else c[a-1]={D,l[3]};end;V[#V+1]=c;end;o[l[2]]=B(f,d,h);end;elseif c<=44 then if c<=36 then if c<=32 then if c<=30 then do return end;elseif c==31 then if not o[l[2]]then e=e+1;else e=e+l[3];end;else o[l[2]]=a[l[3]];end;elseif c<=34 then if c>33 then local A;local i;local f;local s;local r;local c;o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];c=l[2];r=o[l[3]];o[c+1]=r;o[c]=r[a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];s={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;s[f]=o[l];end;A={o[c](t(s,1,i-c))};i=c+l[5]-2;f=0;for l=c,i do f=f+1;o[l]=A[f];end;d=i;e=e+1;l=n[e];c=l[2];r=o[l[3]];o[c+1]=r;o[c]=r[a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];o[l[2]]={};else local n=l[2];local a={};local e=0;local c=n+l[3]-1;for l=n+1,c do e=e+1;a[e]=o[l];end;local c={o[n](t(a,1,c-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;end;elseif c==35 then local n=l[2];local c={};local e=0;local l=n+l[3]-1;for l=n+1,l do e=e+1;c[e]=o[l];end;local c,l=C(o[n](t(c,1,l-n)));l=l+n-1;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else do return end;end;elseif c<=40 then if c<=38 then if c>37 then o[l[2]]=B(s[l[3]],nil,h);else if(o[l[2]]==o[l[5]])then e=e+1;else e=e+l[3];end;end;elseif c>39 then local B;local i;local f;local r;local c;local s;local A;o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];o[l[2]]=o[l[3]];e=e+1;l=n[e];A=l[3];s=o[A]for l=A+1,l[5]do s=s..o[l];end;o[l[2]]=s;e=e+1;l=n[e];o[l[2]]=o[l[3]][o[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;o[c](t(r,1,i-c));d=c;e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;o[c](t(r,1,i-c));d=c;e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];o[l[2]]=o[l[3]];e=e+1;l=n[e];A=l[3];s=o[A]for l=A+1,l[5]do s=s..o[l];end;o[l[2]]=s;e=e+1;l=n[e];o[l[2]]=o[l[3]][o[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;B={o[c](t(r,1,i-c))};i=c+l[5]-2;f=0;for l=c,i do f=f+1;o[l]=B[f];end;d=i;e=e+1;l=n[e];o[l[2]]=h[a[l[3]]];e=e+1;l=n[e];o[l[2]]=o[l[3]];e=e+1;l=n[e];c=l[2];r={};f=0;i=c+l[3]-1;for l=c+1,i do f=f+1;r[f]=o[l];end;B={o[c](t(r,1,i-c))};i=c+l[5]-2;f=0;for l=c,i do f=f+1;o[l]=B[f];end;d=i;e=e+1;l=n[e];if(o[l[2]]==o[l[5]])then e=e+1;else e=e+l[3];end;else o[l[2]]=o[l[3]][o[l[5]]];end;elseif c<=42 then if c>41 then o[l[2]]();d=A;else local c;o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];o[l[2]]=a[l[3]];e=e+1;l=n[e];c=l[2];o[c]=o[c]-o[c+2];e=e+l[3];end;elseif c==43 then o[l[2]][a[l[3]]]=a[l[5]];else o[l[2]]=o[l[3]];end;elseif c<=52 then if c<=48 then if c<=46 then if c==45 then h[a[l[3]]]=o[l[2]];else local e=l[2];local c={};local n=0;local l=e+l[3]-1;for l=e+1,l do n=n+1;c[n]=o[l];end;o[e](t(c,1,l-e));d=e;end;elseif c==47 then local n=l[3];local e=o[n]for l=n+1,l[5]do e=e..o[l];end;o[l[2]]=e;else h[a[l[3]]]=o[l[2]];end;elseif c<=50 then if c==49 then local n=l[2];local a=l[5];local l=n+2;local c={o[n](o[n+1],o[l])};for e=1,a do o[l+e]=c[e];end;local n=o[n+3];if n then o[l]=n else e=e+1;end;else local n=l[2];o[n]=o[n]-o[n+2];e=e+l[3];end;elseif c==51 then if o[l[2]]then e=e+1;else e=e+l[3];end;else o[l[2]]=D[l[3]];end;elseif c<=56 then if c<=54 then if c==53 then if o[l[2]]then e=e+1;else e=e+l[3];end;else if(o[l[2]]==a[l[5]])then e=e+1;else e=e+l[3];end;end;elseif c>55 then e=e+l[3];else local n=l[2];o[n]=o[n]-o[n+2];e=e+l[3];end;elseif c<=58 then if c>57 then local n=l[2];local c={};local e=0;local a=d;for l=n+1,a do e=e+1;c[e]=o[l];end;local c={o[n](t(c,1,a-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else o[l[2]]={};end;elseif c>59 then o[l[2]]=h[a[l[3]]];else if not o[l[2]]then e=e+1;else e=e+l[3];end;end;e=e+1;end;end;end;return B(R(),{},L())();