(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 24340, 680] NotebookOptionsPosition[ 21936, 593] NotebookOutlinePosition[ 22295, 609] CellTagsIndexPosition[ 22252, 606] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Program-size calculator", "Title", CellChangeTimes->{{3.4149551038559427`*^9, 3.414955122603191*^9}, { 3.4149551759819727`*^9, 3.414955185894393*^9}, 3.41513317515661*^9}], Cell["v.1", "Subtitle", CellChangeTimes->{{3.414955127857409*^9, 3.4149551645089617`*^9}, { 3.41495576596699*^9, 3.4149557869032*^9}, {3.414955846513322*^9, 3.414955854223028*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Print", "[", RowBox[{"Text", "[", RowBox[{"Style", "[", RowBox[{ RowBox[{ "\"\\"", "<>", RowBox[{"DateString", "[", RowBox[{"{", RowBox[{ "\"\\"", ",", " ", "\"\<, \>\"", ",", "\"\\"", ",", "\"\< \>\"", ",", "\"\\"", ",", "\"\<, \>\"", ",", "\"\\"", ",", "\"\<\n\>\"", ",", "\"\\""}], "}"}], "]"}]}], ",", "Gray", ",", "Italic", ",", "14"}], "]"}], "]"}], "]"}]], "Input", CellGroupingRules->{GroupTogetherGrouping, 10000.}, CellChangeTimes->{{3.399301557117675*^9, 3.399301594169798*^9}, { 3.410234532661572*^9, 3.410234550791424*^9}, {3.415134013797593*^9, 3.415134049013253*^9}}], Cell[BoxData[ InterpretationBox[Cell[BoxData[ StyleBox["\<\"written by Hector Zenil\\nhectorz at andrew.cmu.edu \ or\\nhector.zenil@lifl.fr \\nFriday, March 21, 2008\\n20:20:56\"\>", StripOnInput->False, FrontFaceColor->GrayLevel[0.5], BackFaceColor->GrayLevel[0.5], GraphicsColor->GrayLevel[0.5], FontSize->14, FontSlant->Italic, FontColor->GrayLevel[0.5]]], "Text", "TR"], Text[ Style["written by Hector Zenil\nhectorz at andrew.cmu.edu or\n\ hector.zenil@lifl.fr \nFriday, March 21, 2008\n20:20:56", GrayLevel[0.5], Italic, 14]]]], "Print", CellGroupingRules->{GroupTogetherGrouping, 10000.}, CellChangeTimes->{{3.410234543475442*^9, 3.410234555918688*^9}, 3.4112781897021303`*^9, 3.4126253385359297`*^9, {3.4151340373848467`*^9, 3.4151340564717712`*^9}}] }, {2}]], Cell[CellGroupData[{ Cell[TextData[{ "Laboratoire d'Informatique Fondamentale de Lille -CNRS and IHPST Paris 1\n\ ", ButtonBox["The Experimental Information Algorithmic Theory Project", BaseStyle->"Hyperlink", ButtonData->{ URL["http://www.mathrix.org/experimentalAIT/"], None}] }], "Subsubtitle", CellChangeTimes->{{3.414955127857409*^9, 3.4149551645089617`*^9}, { 3.41495576596699*^9, 3.4149557869032*^9}, {3.414955846513322*^9, 3.414955897504442*^9}, {3.4151331885403757`*^9, 3.415133226937037*^9}, { 3.415133968639022*^9, 3.4151339686400013`*^9}, {3.415134043389482*^9, 3.415134066521744*^9}}], Cell[TextData[{ "\nThis program is a simple program size calculator of C++ programs in \ support of the calculation for the ", ButtonBox["The Shortest Universal Turing Machine Implementation Contest \ (http://www.mathrix.org/experimentalAIT/TuringMachine.html)", BaseStyle->"Hyperlink", ButtonData->{ URL["http://www.mathrix.org/experimentalAIT/TuringMachine.html"], None}], "\n\nImprovements are welcome. Apply them to this source code and send them \ out to the original author in order to be incorporated into the next version \ to be available on the contest page." }], "Subsubtitle", CellChangeTimes->{{3.414955913024314*^9, 3.414955943883177*^9}, { 3.415133235976972*^9, 3.415133256576211*^9}, {3.415133837848283*^9, 3.415133885184531*^9}, {3.415133924240295*^9, 3.415133955378107*^9}}], Cell["", "Section", CellChangeTimes->{{3.414955874134808*^9, 3.414955879703682*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Set the variables path and filename to the actual path of your source code \ file. filename must be a .cpp ASCII format file. Not the compilated version. \ If the file is in the same directory as this ", StyleBox["Mathematica", FontSlant->"Italic"], " notebook just leave it empty as it is." }], "Subsubtitle", CellChangeTimes->{{3.4149552085488863`*^9, 3.414955300644465*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"filename", "=", "\"\\""}], ";"}]], "Input", CellChangeTimes->{{3.414954793698515*^9, 3.414954817930901*^9}, { 3.414954984849163*^9, 3.414955014246004*^9}, {3.415133390314435*^9, 3.415133394431877*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"path", "=", "\"\<\>\""}], ";"}]], "Input", CellChangeTimes->{{3.414955002654739*^9, 3.414955034758491*^9}, { 3.414955072607428*^9, 3.414955078169209*^9}, {3.414955201792865*^9, 3.414955201960123*^9}, {3.415133448201194*^9, 3.415133477744946*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"sourcecode", "=", RowBox[{"Import", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"path", "===", "\"\<\>\""}], ",", RowBox[{"SetDirectory", "[", RowBox[{"NotebookDirectory", "[", "]"}], "]"}], ",", "path"}], "]"}], "<>", "filename"}], ",", "\"\\""}], "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.4149440953941383`*^9, 3.414944096533325*^9}, { 3.414944144111487*^9, 3.4149441683421087`*^9}, {3.414944200500197*^9, 3.4149442182976913`*^9}, {3.414954836365506*^9, 3.414954843214149*^9}, { 3.41495488303515*^9, 3.414955038926457*^9}, {3.414955087074841*^9, 3.4149550915674677`*^9}, {3.415133403506946*^9, 3.4151334368172493`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Step 1 drops out all file comments in the source code indicated by asterisks \ and double slashes.\ \>", "Subsubtitle", CellChangeTimes->{{3.414955330260346*^9, 3.4149553756965227`*^9}, 3.4149554449263763`*^9}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"step", "[", "1", "]"}], "=", RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"\"\\"", "~~", "___"}], "\[Rule]", "\"\<\>\""}], ",", RowBox[{"\"\<\\t\>\"", "\[Rule]", "\"\<\>\""}]}], "}"}]}], "]"}], "&"}], "/@", RowBox[{"StringSplit", "[", RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"sourcecode", ",", RowBox[{"{", RowBox[{ RowBox[{"\"\\"", "~~", "___", "~~", "\"\<*/\>\""}], "\[Rule]", "\"\<\>\""}], "}"}]}], "]"}], ",", "\"\<\\n\>\""}], "]"}]}], ")"}], "/.", RowBox[{"\"\<\>\"", "\[Rule]", RowBox[{"Sequence", "[", "]"}]}]}], ")"}]}], ";"}]], "Input", CellChangeTimes->{{3.414948446533367*^9, 3.414948716070774*^9}, { 3.414948767209961*^9, 3.414948862864725*^9}, {3.41494964478668*^9, 3.4149496521696987`*^9}, {3.414949846944838*^9, 3.41494987287147*^9}, 3.414951493546129*^9}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Looking for used types and libraries. Remember that only bool and int types \ are allowed. Only standard ANSI C++ libraries are allowed.\ \>", "Subsubtitle", CellChangeTimes->{{3.414955330260346*^9, 3.414955429035334*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"types", "=", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], ";"}]], "Input", CellChangeTimes->{{3.414949899127586*^9, 3.414949913501552*^9}, { 3.414954663895444*^9, 3.414954665176238*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"libraries", "=", RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"StringCases", "[", RowBox[{"#", ",", RowBox[{"\"\\"", "~~", "___"}]}], "]"}], "&"}], "/@", RowBox[{"step", "[", "1", "]"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4149524301499853`*^9, 3.414952463296919*^9}}], Cell[BoxData[ RowBox[{"{", "\<\"include \"\>", "}"}]], "Output", CellChangeTimes->{{3.414952458127204*^9, 3.4149524636926394`*^9}, 3.414954667366379*^9, 3.414955095146428*^9, 3.4151334887583*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Getting all the variables types, names and assignations.", "Subsubtitle", CellChangeTimes->{{3.414955330260346*^9, 3.4149553756965227`*^9}, { 3.4149554391434193`*^9, 3.414955453892024*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"vars", "=", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"#", ",", "\"\< \>\""}], "]"}], "&"}], "/@", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", RowBox[{ RowBox[{"___", "~~", "\"\\"", "~~", "___"}], "\[Rule]", "\"\<\>\""}]}], "]"}], "&"}], "/@", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringCases", "[", RowBox[{"#", ",", RowBox[{ RowBox[{ "types", "\[LeftDoubleBracket]", "j", "\[RightDoubleBracket]"}], "~~", "___"}]}], "]"}], "&"}], "/@", RowBox[{"step", "[", "1", "]"}]}], ",", RowBox[{"{", RowBox[{"j", ",", RowBox[{"Length", "[", "types", "]"}]}], "}"}]}], "]"}], "]"}]}], ")"}]}], "/.", RowBox[{"{", RowBox[{ RowBox[{"\"\<\>\"", "\[Rule]", RowBox[{"Sequence", "[", "]"}]}], ",", RowBox[{ RowBox[{"{", "}"}], "\[Rule]", RowBox[{"Sequence", "[", "]"}]}]}], "}"}]}]}]], "Input", CellChangeTimes->{{3.4149496982373123`*^9, 3.414949934023159*^9}, { 3.414949967925323*^9, 3.414949982106316*^9}, {3.4149500176125*^9, 3.414950121682675*^9}, 3.4149514732342587`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\<\"bool\"\>", ",", "\<\"applied_flag\"\>", ",", "\<\"=\"\>", ",", "\<\"0;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"head_pos;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"state\"\>", ",", "\<\"=\"\>", ",", "\<\"init_state;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"inf_bound;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"sup_bound;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"states\"\>", ",", "\<\"=\"\>", ",", "\<\"((argc\"\>", ",", "\<\"-\"\>", ",", "\<\"2)\"\>", ",", "\<\"/\"\>", ",", "\<\"5)\"\>", ",", "\<\"/\"\>", ",", "\<\"2;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"symbols\"\>", ",", "\<\"=\"\>", ",", "\<\"2;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"transition[2*states][5];\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"j,k,s,n;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"tape[step_limit];\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "\<\"start_cel\"\>", ",", "\<\"=\"\>", ",", "\<\"(int)\"\>", ",", "\<\"step_limit\"\>", ",", "\<\"/\"\>", ",", "\<\"2;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"long\"\>", ",", "\<\"step\"\>", ",", "\<\"=\"\>", ",", "\<\"0;\"\>"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"long\"\>", ",", "\<\"step_limit\"\>", ",", "\<\"=\"\>", ",", "\<\"atoi(argv[1]);\"\>"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.414951473515997*^9, 3.41495467180416*^9, 3.414955096145629*^9, 3.415133488796529*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Occurrence of each type.", "Subsubtitle", CellChangeTimes->{{3.414955330260346*^9, 3.4149553756965227`*^9}, { 3.414955463536602*^9, 3.414955471277134*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"foundtypes", "=", RowBox[{"Tally", "[", RowBox[{"First", "/@", "vars"}], "]"}]}]], "Input", CellChangeTimes->{{3.41495010656066*^9, 3.414950109047608*^9}, { 3.4149501438295803`*^9, 3.414950152547*^9}, 3.414951466449695*^9, { 3.414952506139591*^9, 3.414952507867341*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\<\"bool\"\>", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"int\"\>", ",", "10"}], "}"}], ",", RowBox[{"{", RowBox[{"\<\"long\"\>", ",", "2"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.4149514667580557`*^9, 3.414952508306753*^9, 3.414954675969342*^9, 3.415133488836752*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Variable and constant names.", "Subsubtitle", CellChangeTimes->{{3.414955330260346*^9, 3.4149553756965227`*^9}, { 3.41495548431603*^9, 3.414955487958269*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"varnames", "=", RowBox[{"Cases", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", RowBox[{"{", RowBox[{ RowBox[{"\"\<;\>\"", "\[Rule]", "\"\<\>\""}], ",", RowBox[{ RowBox[{"DigitCharacter", ".."}], "\[Rule]", "\"\<\>\""}], ",", RowBox[{ RowBox[{"\"\<[\>\"", "~~", "___", "~~", "\"\<]\>\""}], "\[Rule]", "\"\<\>\""}], ",", RowBox[{ RowBox[{"\"\<(\>\"", "~~", "___", "~~", "\"\<)\>\""}], "\[Rule]", "\"\<\>\""}]}], "}"}]}], "]"}], "&"}], "/@", RowBox[{"(", RowBox[{"Flatten", "@", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringCases", "[", RowBox[{"#", ",", RowBox[{"WordCharacter", ".."}]}], "]"}], "&"}], "/@", RowBox[{"Flatten", "[", RowBox[{"Rest", "/@", "vars"}], "]"}]}], ")"}]}], ")"}]}], "/.", RowBox[{"\"\<\>\"", "\[Rule]", RowBox[{"Sequence", "[", "]"}]}]}], ",", RowBox[{"x_", "/;", RowBox[{ RowBox[{"StringLength", "[", "x", "]"}], ">", "2"}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.414951779856154*^9, 3.414951794655025*^9}, { 3.414951837724515*^9, 3.414951891896804*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"\<\"applied\"\>", ",", "\<\"flag\"\>", ",", "\<\"head\"\>", ",", "\<\"pos\"\>", ",", "\<\"state\"\>", ",", "\<\"init\"\>", ",", "\<\"state\"\>", ",", "\<\"inf\"\>", ",", "\<\"bound\"\>", ",", "\<\"sup\"\>", ",", "\<\"bound\"\>", ",", "\<\"states\"\>", ",", "\<\"argc\"\>", ",", "\<\"symbols\"\>", ",", "\<\"transition\"\>", ",", "\<\"states\"\>", ",", "\<\"tape\"\>", ",", "\<\"step\"\>", ",", "\<\"limit\"\>", ",", "\<\"start\"\>", ",", "\<\"cel\"\>", ",", "\<\"int\"\>", ",", "\<\"step\"\>", ",", "\<\"limit\"\>", ",", "\<\"step\"\>", ",", "\<\"step\"\>", ",", "\<\"limit\"\>", ",", "\<\"atoi\"\>", ",", "\<\"argv\"\>"}], "}"}]], "Output", CellChangeTimes->{{3.4149517880850677`*^9, 3.4149517950271473`*^9}, { 3.414951841745205*^9, 3.414951864653014*^9}, 3.414951904180841*^9, 3.4149546810027113`*^9, 3.41513348890971*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Replacing variable and constant names to shorter names (in principle this \ condensed version of the program should be compilable and executable in C++)\ \>", "Subsubtitle", CellChangeTimes->{{3.414955495064021*^9, 3.41495550685709*^9}, { 3.415133783780759*^9, 3.4151338073581457`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"varreplacement", "=", RowBox[{"Rule", "@@@", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ "varnames", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}], ",", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "i", "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "varnames", "]"}]}], "}"}]}], "]"}]}]}], ";"}]], "Input", CellChangeTimes->{{3.41495153389678*^9, 3.414951558336388*^9}, { 3.414951937679102*^9, 3.414952002624181*^9}, {3.414952063529586*^9, 3.414952077657299*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"simplevarreplacement", "=", RowBox[{"Rule", "@@@", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ "varnames", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}], ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "varnames", "]"}]}], "}"}]}], "]"}]}]}], ";"}]], "Input", CellChangeTimes->{{3.414952242519888*^9, 3.4149522467666187`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"reducedcode", "=", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", "varreplacement"}], "]"}], "&"}], "/@", RowBox[{"step", "[", "1", "]"}]}], "]"}], ",", RowBox[{"\"\< \>\"", "\[Rule]", "\"\<\>\""}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4149515225529947`*^9, 3.414951527765731*^9}, { 3.414951567165208*^9, 3.414951572640933*^9}, {3.414952014636183*^9, 3.414952073289792*^9}, {3.4149521211700783`*^9, 3.414952209756073*^9}, { 3.414954537838208*^9, 3.4149545390947742`*^9}}], Cell[BoxData["\<\"#include using namespace std;#define C6_C5 1C22 \ main(C22 C13, char ** C29){C22 C3_C4;C22 C5 = C6_C5;C22 C8_C9;C22 C10_C9;bool \ C1_C2 = 0;C22 C5s = ((C13 - 2) / 5) / 2;C22 C14 = 2;C22 C15[2*C5s][5];C22 \ j,k,s,n;long C18 = 0;long C18_C19 = C28(C29[1]);C22 C17[C18_C19];C22 C20_C21 \ = (C22) C18_C19 / 2;j = k = s = n = 0;while(n != C18_C19) {C17[n] = 0;n++;}n \ = 0;while(k < 2*C5s) {while(j < 5) {C15[k][j] = C28(C29[n+2]);j++;n++;}j = \ 0;k++;}n = 0;k = 0;C3_C4 = C20_C21 - 1;C8_C9 = C20_C21 - 1;C10_C9 = C20_C21 - \ 1;j = C6_C5;while(C5 != 0 && C18 < C18_C19) {while(s < C14) {while(j < C5s + \ 1) { while(k < 2*C5s) {if(C15[k][0] == j && C15[k][1] == s)if(C5 == C15[k][0] \ && C17[C3_C4] == C15[k][1] && C1_C2==0) {C5 = C15[k][2];C17[C3_C4] = \ C15[k][3];C3_C4 = C3_C4 + C15[k][4];C1_C2=1; } k++; }k = 0;j++;} s++; j = 1; \ }s = 0;C18++;C1_C2 = 0;C8_C9 = min(C8_C9,C3_C4);C10_C9 = \ max(C10_C9,C3_C4);}if(C5==0) for(n = C8_C9; n < C10_C9 + 1; n++) cout << \ C17[n];else cout << C14 + 1; cout << \\\"\\\\n\\\" << C18 << endl;return \ 0;}\"\>"], "Output", CellChangeTimes->{{3.414952109518539*^9, 3.41495214036502*^9}, { 3.414952180315647*^9, 3.414952212147314*^9}, 3.4149545393700733`*^9, 3.414954690943018*^9, 3.415133488980084*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Total length approximation (the actual length value will be verified after \ succeeding the tests described on the contest web page)\ \>", "Subsubtitle", CellChangeTimes->{{3.414955580357135*^9, 3.414955594621461*^9}, 3.415133774477639*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"rawprogram", "=", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", "simplevarreplacement"}], "]"}], "&"}], "/@", RowBox[{"step", "[", "1", "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"\"\< \>\"", "\[Rule]", "\"\<\>\""}], ",", RowBox[{ RowBox[{"_", "~~", "\"\<_\>\"", "~~", "_"}], "\[Rule]", "\"\<\>\""}]}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.415133584418685*^9, 3.4151336017484703`*^9}, { 3.415133636660717*^9, 3.415133666266254*^9}, {3.4151341156672077`*^9, 3.41513411799015*^9}}], Cell[BoxData["\<\"#includeusingnamespacestd;#define1cmain(cc,char**\ c){c;cc=;c;c;bool=0;ccs=((c-2)/5)/2;cc=2;cc[2*cs][5];cj,k,s,n;longc=0;long=c(\ c[1]);cc[];c=(c)/2;j=k=s=n=0;while(n!=){c[n]=0;n++;}n=0;while(k<2*cs){while(j<\ 5){c[k][j]=c(c[n+2]);j++;n++;}j=0;k++;}n=0;k=0;=-1;=-1;=-1;j=;while(c!=0&&c<){\ while(s"], "Output", CellChangeTimes->{{3.415133590819687*^9, 3.415133603313957*^9}, { 3.4151336620031013`*^9, 3.415133666567034*^9}, 3.4151341188495817`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Framed", "[", RowBox[{"rawlength", "=", RowBox[{"StringLength", "[", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{ RowBox[{ RowBox[{"StringReplace", "[", RowBox[{"#", ",", "simplevarreplacement"}], "]"}], "&"}], "/@", RowBox[{"step", "[", "1", "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"\"\< \>\"", "\[Rule]", "\"\<\>\""}], ",", RowBox[{ RowBox[{"_", "~~", "\"\<_\>\"", "~~", "_"}], "\[Rule]", "\"\<\>\""}]}], "}"}]}], "]"}], "]"}]}], "]"}]], "Input", CellChangeTimes->{{3.414952677400745*^9, 3.414952679125643*^9}, 3.414954735859668*^9, 3.415133609913624*^9, 3.415133722682963*^9, { 3.415133761959527*^9, 3.415133764550604*^9}}], Cell[BoxData[ FrameBox["556", StripOnInput->False]], "Output", CellChangeTimes->{ 3.414952681021146*^9, 3.414954547078953*^9, 3.414954704843481*^9, 3.4149547361995697`*^9, 3.415133489083696*^9, 3.415133610287167*^9, { 3.415133717680173*^9, 3.415133723024383*^9}, 3.415133764964546*^9}] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{1004, 709}, WindowMargins->{{124, Automatic}, {Automatic, 0}}, Magnification->1.25, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (March 10, 2008)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 181, 2, 95, "Title"], Cell[774, 27, 186, 3, 57, "Subtitle"], Cell[CellGroupData[{ Cell[985, 34, 826, 19, 91, "Input", CellGroupingRules->{GroupTogetherGrouping, 10000.}], Cell[1814, 55, 810, 18, 118, "Print", CellGroupingRules->{GroupTogetherGrouping, 10000.}] }, {2}]], Cell[CellGroupData[{ Cell[2658, 78, 597, 12, 54, "Subsubtitle"], Cell[3258, 92, 810, 14, 160, "Subsubtitle"], Cell[4071, 108, 85, 1, 83, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[4193, 114, 400, 8, 75, "Subsubtitle"], Cell[4596, 124, 263, 5, 33, "Input"], Cell[4862, 131, 287, 5, 33, "Input"], Cell[5152, 138, 756, 16, 33, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5945, 159, 225, 5, 32, "Subsubtitle"], Cell[6173, 166, 1182, 32, 72, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7392, 203, 233, 4, 54, "Subsubtitle"], Cell[7628, 209, 333, 8, 33, "Input"], Cell[CellGroupData[{ Cell[7986, 221, 350, 9, 33, "Input"], Cell[8339, 232, 211, 3, 33, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[8599, 241, 198, 2, 32, "Subsubtitle"], Cell[CellGroupData[{ Cell[8822, 247, 1400, 40, 110, "Input"], Cell[10225, 289, 1811, 41, 110, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[12085, 336, 164, 2, 32, "Subsubtitle"], Cell[CellGroupData[{ Cell[12274, 342, 308, 6, 33, "Input"], Cell[12585, 350, 376, 10, 33, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[13010, 366, 167, 2, 32, "Subsubtitle"], Cell[CellGroupData[{ Cell[13202, 372, 1362, 37, 129, "Input"], Cell[14567, 411, 908, 14, 53, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[15524, 431, 299, 5, 54, "Subsubtitle"], Cell[15826, 438, 669, 19, 33, "Input"], Cell[16498, 459, 508, 15, 33, "Input"], Cell[CellGroupData[{ Cell[17031, 478, 645, 14, 33, "Input"], Cell[17679, 494, 1274, 17, 243, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[19002, 517, 255, 5, 54, "Subsubtitle"], Cell[CellGroupData[{ Cell[19282, 526, 698, 18, 53, "Input"], Cell[19983, 546, 756, 9, 129, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[20776, 560, 819, 20, 91, "Input"], Cell[21598, 582, 298, 6, 41, "Output"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)