{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":950,"title":"Cody Matlab Version","description":"What is the current Cody Matlab Release? \r\n\r\n*Output:* string\r\n\r\n\r\n*Examples:*\r\n\r\n\r\n'(R2012a)' or 'R2012a'\r\n\r\n\r\nHint: We have moved forward\r\n\r\nPosted 9/16/12","description_html":"\u003cp\u003eWhat is the current Cody Matlab Release?\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e string\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'(R2012a)' or 'R2012a'\u003c/p\u003e\u003cp\u003eHint: We have moved forward\u003c/p\u003e\u003cp\u003ePosted 9/16/12\u003c/p\u003e","function_template":"function str = Cody_version\r\n  str='(R2012a)';\r\nend","test_suite":"%%\r\n% 09/21/2012\r\nstr=Cody_version;\r\nlatest=ver;\r\nRelease=latest(1,1).Release;\r\nRelease2= regexprep(Release,'[()]','');\r\nPass= strcmp(str,Release) || strcmp(str,Release2);\r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":175,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-16T23:58:44.000Z","updated_at":"2026-02-05T16:40:06.000Z","published_at":"2012-09-17T00:50:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the current Cody Matlab Release?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e string\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'(R2012a)' or 'R2012a'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: We have moved forward\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePosted 9/16/12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":925,"title":"Unique - Very Very Large Numbers","description":"Given a vector column, with some very large numbers, create the ascending sort and unique vector.\r\n\r\n*Input:* A  (column vector)\r\n\r\n*Output:* B (unique and ascending sorted column vector)\r\n\r\n*Examples:* [5;4;3;2;2;1] outputs [1;2;3;4;5]\r\n\r\n[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808] ","description_html":"\u003cp\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A  (column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (unique and ascending sorted column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/p\u003e\u003cp\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/p\u003e","function_template":"function y = unique_large(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\na=randi(2^32,100,'uint32');\r\nassert(isequal(unique_large(a),unique(a)))\r\n%%\r\nformat long\r\na=[uint64(9223372036854775808);uint64(9223372036854775806)];\r\nout=unique_large(a);\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %14.0f\\n %14.0f \\n',size(out),out))\r\n%%\r\nformat long\r\na=[uint64(18446744073709551615);uint64(18233720368547758060);uint64(9223372036854779806)];\r\n\r\nout=unique_large(a);\r\n\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %16.0f \\n %16.0f \\n %16.0f \\n',size(out),out))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-29T18:59:33.000Z","updated_at":"2026-03-24T06:44:26.000Z","published_at":"2012-08-29T19:55:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (unique and ascending sorted column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1731,"title":"Text File Read: 64 bit data set","description":"This Challenge is to read a text file that has vary large integers up to 2e18, typical for Google Code Jam. These values are well within the bounds of uint64.\r\nThe data is an array of Q pairs.\r\nInput: [Q, fname] The number of lines in the file and its filename.\r\nOutput: M a uint64 matrix of size(Q,2)\r\nExample:\r\nInput: {4, 'Cody_64.txt']\r\nThe text file:\r\n308436464205151562 1850618785230909388\r\n373665302816212423 1494661211264849698\r\n760961177192651897 1521922354385303795\r\n1 2000000000000000000\r\n\r\nOuput: A uint64 (4,2) matrix to full precision.\r\nNote of Warning:\r\nThe fscanf function with %ul may not succeed, as of 7/20/2013.\r\nThe result window has a case showing the function output\r\nRelated Challenges:\r\n1) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\r\n2) Super Large Numbers \u003e2^64  (Java BigInteger methods)","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThis Challenge is to read a text file that has vary large integers up to 2e18, typical for\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eGoogle Code Jam\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e. These values are well within the bounds of uint64.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe data is an array of Q pairs.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eInput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e [Q, fname] The number of lines in the file and its filename.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eOutput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e M a uint64 matrix of size(Q,2)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; margin-top: 10px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eInput: {4, \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003e'Cody_64.txt'\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eThe \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003etext file:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e308436464205151562 1850618785230909388\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e373665302816212423 1494661211264849698\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e760961177192651897 1521922354385303795\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e1 2000000000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eOuput: A uint64 (4,2) matrix \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eto full precision.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 10px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eNote of Warning:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe fscanf function with %ul may not succeed, as of 7/20/2013.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe result window has a case showing the function output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eRelated Challenges:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; margin-top: 10px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e1) Bullseye \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eLarge Numbers r\u0026lt;1E18\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e, P\u0026lt;2E18\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e2) Super \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eLarge Numbers \u0026gt;2^64\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e  \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003e(Java BigInteger methods)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [m]=read_input64(Q,fn)\r\n m=zeros(Q,2,'uint64');\r\nend","test_suite":"%%\r\nfid=fopen('Cody_64.txt','w');\r\n fprintf(fid,'%s\\n','308436464205151562 1850618785230909388');\r\n fprintf(fid,'%s\\n','760961177192651897 1521922354385303795');\r\n fprintf(fid,'%s\\n','23875933057623902 1098292920650700527');\r\n fprintf(fid,'%s\\n','1000 2000000000000000000');\r\nfclose(fid);\r\n%%\r\n% This section has no assert to show the values being returned\r\nQ=4;\r\nfn='Cody_64.txt';\r\nm=read_input64(Q,fn)\r\n%%\r\nQ=4;\r\nfn='Cody_64.txt';\r\nm=read_input64(Q,fn)\r\nm_exp=[uint64(308436464205151562) uint64(1850618785230909388);uint64(760961177192651897) uint64(1521922354385303795);uint64(23875933057623902) uint64(1098292920650700527);1000 2000000000000000000];\r\nassert(isequal(m,m_exp));\r\n%%\r\nQ=4;\r\nm_exp=randi(2^31,Q,2);\r\nfn='Cody_64a.txt';\r\nfid=fopen(fn,'w');\r\nfor i=1:Q\r\n fprintf(fid,'%s %s\\n',num2str(m_exp(i,1)),num2str(m_exp(i,2)));\r\nend\r\nfclose(fid);\r\nm=read_input64(Q,fn);\r\nassert(isequal(m,m_exp))\r\n%%\r\nQ=8;\r\nm_exp=randi(2^31,Q,2)*2^19;\r\nfn='Cody_64.txt';\r\nfid=fopen(fn,'w');\r\nfor i=1:Q\r\n fprintf(fid,'%s %s\\n',num2str(m_exp(i,1)),num2str(m_exp(i,2)));\r\nend\r\nfclose(fid);\r\nm=read_input64(Q,fn);\r\nassert(isequal(m,m_exp))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":3097,"edited_by":26769,"edited_at":"2022-04-12T15:26:08.000Z","deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2022-04-12T15:26:08.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-21T01:54:32.000Z","updated_at":"2022-04-12T15:26:08.000Z","published_at":"2013-07-21T02:56:48.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to read a text file that has vary large integers up to 2e18, typical for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. These values are well within the bounds of uint64.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe data is an array of Q pairs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [Q, fname] The number of lines in the file and its filename.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e M a uint64 matrix of size(Q,2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Input: {4, 'Cody_64.txt']\\nThe text file:\\n308436464205151562 1850618785230909388\\n373665302816212423 1494661211264849698\\n760961177192651897 1521922354385303795\\n1 2000000000000000000\\n\\nOuput: A uint64 (4,2) matrix to full precision.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote of Warning:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fscanf function with %ul may not succeed, as of 7/20/2013.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe result window has a case showing the function output\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\\n2) Super Large Numbers \u003e2^64  (Java BigInteger methods)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1732,"title":"GJam: 2013 Rd1a Bullseye Painting - Large Numbers","description":"\u003chttp://code.google.com/codejam/contests.html Google Code Jam\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\r\n\r\nGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\r\n\r\nThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\r\n\r\n\u003c\u003chttp://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\u003e\u003e\r\n\r\n*Input:* [r, p]  uint64, 1\u003c=r\u003c=1E18, 1\u003c=P\u003c=2E18. Always enough P for one ring\r\n\r\n\r\n*Output:* Rings\r\n\r\n*Examples:*\r\n\r\n  [1 9] 1; % Normal number examples to understand concept\r\n  [1 10] 2;\r\n  [3 40] 3;\r\n  \r\n  [1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n  [1 2000000000000000000] 999999999\r\n  [760961177192651897 1521922354385303795] 1\r\n\r\n\r\n*Google Code Jam:*\r\n\r\nThe next competition starts in April 2014. See details from above link.\r\n\r\nSolutions to the various past Challenges using Matlab can be found via \u003chttp://www.go-hero.net/jam/13/solutions GJam Solutions\u003e.\r\n\r\nLarge number solutions require more elegant methods to avoid time-outs.\r\n\r\n*Related Challenges:*\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set Reading 64 bit input file\u003e\r\n\r\n2) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting Bullseye Regular Numbers\u003e\r\n\r\n*Usage of regexp is verboten*","description_html":"\u003cp\u003e\u003ca href = \"http://code.google.com/codejam/contests.html\"\u003eGoogle Code Jam\u003c/a\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/p\u003e\u003cp\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/p\u003e\u003cp\u003eThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\u003c/p\u003e\u003cimg src = \"http://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\"\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [r, p]  uint64, 1\u0026lt;=r\u0026lt;=1E18, 1\u0026lt;=P\u0026lt;=2E18. Always enough P for one ring\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Rings\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 9] 1; % Normal number examples to understand concept\r\n[1 10] 2;\r\n[3 40] 3;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n[1 2000000000000000000] 999999999\r\n[760961177192651897 1521922354385303795] 1\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe next competition starts in April 2014. See details from above link.\u003c/p\u003e\u003cp\u003eSolutions to the various past Challenges using Matlab can be found via \u003ca href = \"http://www.go-hero.net/jam/13/solutions\"\u003eGJam Solutions\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eLarge number solutions require more elegant methods to avoid time-outs.\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set\"\u003eReading 64 bit input file\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting\"\u003eBullseye Regular Numbers\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eUsage of regexp is verboten\u003c/b\u003e\u003c/p\u003e","function_template":"function rings=solve_rings(r,pmax)\r\n rings=0;\r\nend","test_suite":"%%\r\ntic\r\nr=uint64(308436464205151562);\r\npmax=uint64(1850618785230909388);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,3),sprintf('rings=%i, Expected 3',rings))\r\n%%\r\nr=uint64(760961177192651897);\r\npmax=uint64(1521922354385303795);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,1),sprintf('rings=%i, Expected 1',rings))\r\n%%\r\nr=uint64(1);\r\npmax=uint64(2000000000000000000);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,999999999),sprintf('rings=%i, Expected 999999999',rings))\r\n%%\r\nr=uint64(1000);\r\npmax=uint64(2000000000000000000);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,999999500),sprintf('rings=%i, Expected 999999500',rings))\r\n%%\r\nr=uint64(3);\r\npmax=uint64(1243678947483597075);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,788567988),sprintf('rings=%i, Expected 788567988',rings))\r\n%%\r\nr=uint64(432);\r\npmax=uint64(1800692162794074077);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,948865465),sprintf('rings=%i, Expected 948865465',rings))\r\ntoc\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-21T05:00:05.000Z","updated_at":"2013-07-21T06:00:55.000Z","published_at":"2013-07-21T06:00:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contests.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [r, p] uint64, 1\u0026lt;=r\u0026lt;=1E18, 1\u0026lt;=P\u0026lt;=2E18. Always enough P for one ring\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Rings\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 9] 1; % Normal number examples to understand concept\\n[1 10] 2;\\n[3 40] 3;\\n\\n[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\\n[1 2000000000000000000] 999999999\\n[760961177192651897 1521922354385303795] 1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe next competition starts in April 2014. See details from above link.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolutions to the various past Challenges using Matlab can be found via\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.go-hero.net/jam/13/solutions\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLarge number solutions require more elegant methods to avoid time-outs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eReading 64 bit input file\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBullseye Regular Numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUsage of regexp is verboten\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1900,"title":"GJam 2014 China Rd A: Rational Number Tree (Large Values)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p1 GJam 2014 China Rational Number Tree\u003e.\r\n\r\nThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\r\n\r\nConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively. \r\n\r\nThe Tree looks like:\r\n\r\n         1/1\r\n    ______|______\r\n    |           |\r\n   1/2         2/1\r\n ___|___     ___|___\r\n |     |     |     |\r\n1/3   3/2   2/3   3/1\r\n\r\n\r\nThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\r\n\r\n\r\n*Input:* [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\r\n\r\n*Output:* [P,Q](double) or [N](uint64) depends on Input type\r\n\r\n*Examples:*\r\n\r\n  [Input]  [Output]\r\n    [2] [1 2]\r\n    [1 2] [2]\r\n    [5] [3 2]\r\n    [3 2] [5]\r\n\r\n*Contest Performance:* Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\r\n\r\n*Notes:*\r\n\r\n1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\r\n\r\n2) Example of uint64 read is provided in test suite comments\r\n\r\n3) Bitshift and bitget work on uint64","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p1\"\u003eGJam 2014 China Rational Number Tree\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\u003c/p\u003e\u003cp\u003eConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively.\u003c/p\u003e\u003cp\u003eThe Tree looks like:\u003c/p\u003e\u003cpre\u003e         1/1\r\n    ______|______\r\n    |           |\r\n   1/2         2/1\r\n ___|___     ___|___\r\n |     |     |     |\r\n1/3   3/2   2/3   3/1\u003c/pre\u003e\u003cp\u003eThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e [P,Q](double) or [N](uint64) depends on Input type\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[Input]  [Output]\r\n  [2] [1 2]\r\n  [1 2] [2]\r\n  [5] [3 2]\r\n  [3 2] [5]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\u003c/p\u003e\u003cp\u003e\u003cb\u003eNotes:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\u003c/p\u003e\u003cp\u003e2) Example of uint64 read is provided in test suite comments\u003c/p\u003e\u003cp\u003e3) Bitshift and bitget work on uint64\u003c/p\u003e","function_template":"function vout=Tree_CH(v);\r\n  vout=0;\r\nend","test_suite":"%%\r\ntic\r\nv=[          2081355757           4898583766 ];\r\nvexp=[uint64(11412103587704585708) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        385960903003         298051413714 ];\r\nvexp=[uint64(13079621846505187505) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(15477096172227810860) ];\r\nvexp=[        188445238409         450375998772 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6473043965665514375) ];\r\nvexp=[        109230282567          33788952110 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11270280438309969755) ];\r\nvexp=[         23328302733           8557676614 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6893018069           8719066441 ];\r\nvexp=[uint64( 1875942192845872366) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6566840053865194126) ];\r\nvexp=[         65441249939          85425641391 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         21562167101          16520535073 ];\r\nvexp=[uint64(  956959952027690353) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          1684200303           7336396097 ];\r\nvexp=[uint64(  871479491406563248) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2524835851416755114) ];\r\nvexp=[         28589000023          46221104912 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        154908421282         199691474905 ];\r\nvexp=[uint64( 7885684695614904270) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 8176570117722182781) ];\r\nvexp=[         40721598494          22123450931 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9379940828518631730) ];\r\nvexp=[         37341631466          63773070917 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        232141051889         328442531011 ];\r\nvexp=[uint64( 9972945692012784742) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9539984397959825908) ];\r\nvexp=[         70384313011         178968141063 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        421484284721         599703187188 ];\r\nvexp=[uint64(17162693345262485798) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        127506314007          35528864794 ];\r\nvexp=[uint64( 4167185002280551319) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         11313093168          21049073135 ];\r\nvexp=[uint64(16014443480831614722) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 7450646608300783266) ];\r\nvexp=[         83429116694         148768825269 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(13305041571212833467) ];\r\nvexp=[         77301627056          27774083789 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(13635447149676152154) ];\r\nvexp=[         90797761304         143479563807 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11002893257806672560) ];\r\nvexp=[         44637053272         195624712811 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11051724027090761936) ];\r\nvexp=[         41361095819         189799709732 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16687200783289968235) ];\r\nvexp=[        552258283575         209936061221 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         54164851566         156315474505 ];\r\nvexp=[uint64(13714337615447966724) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 7329431770178715643) ];\r\nvexp=[         13299036287           4535592331 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16479631524350748877) ];\r\nvexp=[        165234451641          96812407705 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6965988866158891263) ];\r\nvexp=[         21216614218           2585039947 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2910455928437551420) ];\r\nvexp=[          6642417815          14808129701 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         13173276049          27570716815 ];\r\nvexp=[uint64( 4977980945016614908) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16721022657493559975) ];\r\nvexp=[         65473107451          19359384006 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         16946040975          10725070912 ];\r\nvexp=[uint64( 6003309882203701925) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2198342485367409266) ];\r\nvexp=[         23006488657          39032588924 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        120013217139          50302005308 ];\r\nvexp=[uint64(14344732783514005715) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         57191814347          77886936688 ];\r\nvexp=[uint64( 8056110860202858614) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  971778736353519486) ];\r\nvexp=[         17760921544          20384041659 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        129560016431         165770554719 ];\r\nvexp=[uint64(15111464173338859822) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17855284157674478998) ];\r\nvexp=[        215281025997         298483051015 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          8822618162           5678585885 ];\r\nvexp=[uint64( 4934822377188433797) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  632138406214928188) ];\r\nvexp=[          1835073727           4084131059 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17330627945660580534) ];\r\nvexp=[         41195382388          56325602793 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6130953526          13549540271 ];\r\nvexp=[uint64( 1896894898836571068) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         25774822611          36694510870 ];\r\nvexp=[uint64(15996304402734859814) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9847540446768144862) ];\r\nvexp=[         31041969169          37560295989 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16612432143632526945) ];\r\nvexp=[         74531365158          60753898717 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(18413647273680019461) ];\r\nvexp=[         10651217970           6995653927 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         62279662838          47373225825 ];\r\nvexp=[uint64( 9640047776936252913) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16583979163800903818) ];\r\nvexp=[        114249431453         187605944484 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          9050571726           1557293089 ];\r\nvexp=[uint64( 9060257062169994207) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(12613321696385576431) ];\r\nvexp=[        125835757545          26079146381 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         35625689704          19896848117 ];\r\nvexp=[uint64( 4411487194398480861) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3484689439967270015) ];\r\nvexp=[         38461243033           5285269728 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         16085645428          43823408873 ];\r\nvexp=[uint64(  894482490922679460) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(12060487473657709988) ];\r\nvexp=[        250877787515         682594856898 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        143931327293          76531069545 ];\r\nvexp=[uint64(12786697318005254653) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(14215963369683634045) ];\r\nvexp=[        100316121935          54160354223 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6557653153          12053301655 ];\r\nvexp=[uint64(  343376420813762434) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         47494216762         112901758075 ];\r\nvexp=[uint64( 3772080181899583404) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6766488059228584288) ];\r\nvexp=[          8189923863          44106320581 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         41526542352          17027036567 ];\r\nvexp=[uint64(17583140790467836275) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          7196361275           6496875429 ];\r\nvexp=[uint64( 6443574928762444801) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17365843048376429107) ];\r\nvexp=[         18457341831           7658711707 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         78140576077          33767545674 ];\r\nvexp=[uint64( 6098897546038113251) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6734445697          12144787423 ];\r\nvexp=[uint64( 4770215408132554690) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        426726665699         126968827572 ];\r\nvexp=[uint64(12995540462042527271) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5523416580603863552) ];\r\nvexp=[          4255700693          41585972826 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3928457774057619184) ];\r\nvexp=[          3877602413          16306596859 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        136097916108          28801327007 ];\r\nvexp=[uint64( 5984770176263773551) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16263054952801281548) ];\r\nvexp=[         14189368539          34874268638 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        662028875555         839442017139 ];\r\nvexp=[uint64(11859750004469197678) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         61393402621         332298132605 ];\r\nvexp=[uint64( 7879625004656522848) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          1998630709           8715852076 ];\r\nvexp=[uint64(  429234479783941040) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         46021740257          21715449429 ];\r\nvexp=[uint64(14347105153381215235) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  498971859648614985) ];\r\nvexp=[         30472124134          22307121041 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6396162213707057064) ];\r\nvexp=[         26683188512          96283024611 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         46925294325          33937979441 ];\r\nvexp=[uint64( 1189627028589296041) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         76315837293          99424320902 ];\r\nvexp=[uint64(11656949174638158734) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         81880058662          38464981613 ];\r\nvexp=[uint64( 7071867154613101059) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(10763027175299443277) ];\r\nvexp=[        330973468653         194345162402 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         79087591419          23535674032 ];\r\nvexp=[uint64(15017024826981320231) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        241564818347         155909390759 ];\r\nvexp=[uint64(15575297637481852549) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         45079186819         295776092742 ];\r\nvexp=[uint64(16532545499676710720) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         22268771423          34477255167 ];\r\nvexp=[uint64(11007510539515659130) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5666822869473456046) ];\r\nvexp=[         28640204779          36488487629 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(14041232599151835393) ];\r\nvexp=[         28442192536          25169506635 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9611808239041397120) ];\r\nvexp=[          1055826287           7876555270 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        358405360794         498368744795 ];\r\nvexp=[uint64( 4955841772239017238) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3979638765694296062) ];\r\nvexp=[          6903410593           7465748396 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        151761015812         211325030677 ];\r\nvexp=[uint64( 7987025462351843862) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        325266071703          87446899892 ];\r\nvexp=[uint64(16944641327505127607) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3273057505586617135) ];\r\nvexp=[        124425395619          27124979723 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        142722642746          60293518411 ];\r\nvexp=[uint64(10857549622062058131) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        379488415355         462240655923 ];\r\nvexp=[uint64(16693497308621268574) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5336487237226370963) ];\r\nvexp=[         76728175571          32349586492 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        366909173981         111494050923 ];\r\nvexp=[uint64(11044880014193584327) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2767480983943234275) ];\r\nvexp=[        155407720950          67429662431 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          4375152441          11923449250 ];\r\nvexp=[uint64(14458798758395123876) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        107946470399          33010545783 ];\r\nvexp=[uint64(13708745226178508359) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  546205200272961984) ];\r\nvexp=[          1773793574          11180737745 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6791165959744564855) ];\r\nvexp=[        125726750555          33307435529 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\ntoc\r\n%%\r\n% Read of GJam 64 bit data\r\n% function z = read_input64(fn)\r\n%  fid=fopen(fn);\r\n%  u=textscan(fid,'%u64');\r\n%  fclose(fid);\r\n%  vptr=2; % skip Test case count \r\n%  dptr=1;\r\n%  while vptr\u003csize(u{1},1)\r\n%   if u{1}(vptr)==1 % single N\r\n%    z{dptr}=u{1}(vptr+1);\r\n%    vptr=vptr+2;\r\n%   else % Pair for p/q\r\n%    z{dptr}=[u{1}(vptr+1) u{1}(vptr+2)];\r\n%    vptr=vptr+3;\r\n%   end\r\n%   dptr=dptr+1;\r\n%  end\r\n% end\r\n%Typical GJam 64 bit data\r\n% 100\r\n% 2 2081355757 4898583766\r\n% 2 385960903003 298051413714\r\n% 1 15477096172227810860\r\n% 1 6473043965665514375\r\n% 1 11270280438309969755\r\n% 2 6893018069 8719066441\r\n% 1 6566840053865194126\r\n% 2 21562167101 16520535073\r\n% 2 1684200303 7336396097\r\n% 1 2524835851416755114\r\n% 2 154908421282 199691474905\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-29T03:53:20.000Z","updated_at":"2013-09-29T21:22:24.000Z","published_at":"2013-09-29T04:19:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Rational Number Tree\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Tree looks like:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[         1/1\\n    ______|______\\n    |           |\\n   1/2         2/1\\n ___|___     ___|___\\n |     |     |     |\\n1/3   3/2   2/3   3/1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [P,Q](double) or [N](uint64) depends on Input type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[Input]  [Output]\\n  [2] [1 2]\\n  [1 2] [2]\\n  [5] [3 2]\\n  [3 2] [5]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNotes:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2) Example of uint64 read is provided in test suite comments\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3) Bitshift and bitget work on uint64\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":950,"title":"Cody Matlab Version","description":"What is the current Cody Matlab Release? \r\n\r\n*Output:* string\r\n\r\n\r\n*Examples:*\r\n\r\n\r\n'(R2012a)' or 'R2012a'\r\n\r\n\r\nHint: We have moved forward\r\n\r\nPosted 9/16/12","description_html":"\u003cp\u003eWhat is the current Cody Matlab Release?\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e string\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'(R2012a)' or 'R2012a'\u003c/p\u003e\u003cp\u003eHint: We have moved forward\u003c/p\u003e\u003cp\u003ePosted 9/16/12\u003c/p\u003e","function_template":"function str = Cody_version\r\n  str='(R2012a)';\r\nend","test_suite":"%%\r\n% 09/21/2012\r\nstr=Cody_version;\r\nlatest=ver;\r\nRelease=latest(1,1).Release;\r\nRelease2= regexprep(Release,'[()]','');\r\nPass= strcmp(str,Release) || strcmp(str,Release2);\r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":175,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-16T23:58:44.000Z","updated_at":"2026-02-05T16:40:06.000Z","published_at":"2012-09-17T00:50:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the current Cody Matlab Release?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e string\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'(R2012a)' or 'R2012a'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: We have moved forward\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePosted 9/16/12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":925,"title":"Unique - Very Very Large Numbers","description":"Given a vector column, with some very large numbers, create the ascending sort and unique vector.\r\n\r\n*Input:* A  (column vector)\r\n\r\n*Output:* B (unique and ascending sorted column vector)\r\n\r\n*Examples:* [5;4;3;2;2;1] outputs [1;2;3;4;5]\r\n\r\n[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808] ","description_html":"\u003cp\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A  (column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (unique and ascending sorted column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/p\u003e\u003cp\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/p\u003e","function_template":"function y = unique_large(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\na=randi(2^32,100,'uint32');\r\nassert(isequal(unique_large(a),unique(a)))\r\n%%\r\nformat long\r\na=[uint64(9223372036854775808);uint64(9223372036854775806)];\r\nout=unique_large(a);\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %14.0f\\n %14.0f \\n',size(out),out))\r\n%%\r\nformat long\r\na=[uint64(18446744073709551615);uint64(18233720368547758060);uint64(9223372036854779806)];\r\n\r\nout=unique_large(a);\r\n\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %16.0f \\n %16.0f \\n %16.0f \\n',size(out),out))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-29T18:59:33.000Z","updated_at":"2026-03-24T06:44:26.000Z","published_at":"2012-08-29T19:55:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (unique and ascending sorted column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1731,"title":"Text File Read: 64 bit data set","description":"This Challenge is to read a text file that has vary large integers up to 2e18, typical for Google Code Jam. These values are well within the bounds of uint64.\r\nThe data is an array of Q pairs.\r\nInput: [Q, fname] The number of lines in the file and its filename.\r\nOutput: M a uint64 matrix of size(Q,2)\r\nExample:\r\nInput: {4, 'Cody_64.txt']\r\nThe text file:\r\n308436464205151562 1850618785230909388\r\n373665302816212423 1494661211264849698\r\n760961177192651897 1521922354385303795\r\n1 2000000000000000000\r\n\r\nOuput: A uint64 (4,2) matrix to full precision.\r\nNote of Warning:\r\nThe fscanf function with %ul may not succeed, as of 7/20/2013.\r\nThe result window has a case showing the function output\r\nRelated Challenges:\r\n1) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\r\n2) Super Large Numbers \u003e2^64  (Java BigInteger methods)","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThis Challenge is to read a text file that has vary large integers up to 2e18, typical for\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eGoogle Code Jam\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e. These values are well within the bounds of uint64.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe data is an array of Q pairs.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eInput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e [Q, fname] The number of lines in the file and its filename.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eOutput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003e M a uint64 matrix of size(Q,2)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; margin-top: 10px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eInput: {4, \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003e'Cody_64.txt'\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eThe \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003etext file:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e308436464205151562 1850618785230909388\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e373665302816212423 1494661211264849698\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e760961177192651897 1521922354385303795\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e1 2000000000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003eOuput: A uint64 (4,2) matrix \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eto full precision.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 10px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eNote of Warning:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe fscanf function with %ul may not succeed, as of 7/20/2013.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eThe result window has a case showing the function output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"font-weight: bold; \"\u003eRelated Challenges:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-bottom: 10px; margin-left: 3px; margin-right: 3px; margin-top: 10px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e1) Bullseye \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eLarge Numbers r\u0026lt;1E18\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e, P\u0026lt;2E18\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end: 1px solid rgb(233, 233, 233); border-inline-start: 1px solid rgb(233, 233, 233); border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 18px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"border-inline-end: 0px none rgb(0, 0, 0); border-inline-start: 0px none rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-right: 45px; min-height: 0px; padding-left: 0px; tab-size: 4; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-right: 0px; \"\u003e2) Super \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003eLarge Numbers \u0026gt;2^64\u003c/span\u003e\u003cspan style=\"margin-right: 0px; \"\u003e  \u003c/span\u003e\u003cspan style=\"border-block-end: 0px none rgb(170, 4, 249); border-block-start: 0px none rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end: 0px none rgb(170, 4, 249); border-inline-start: 0px none rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration-color: rgb(170, 4, 249); \"\u003e(Java BigInteger methods)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [m]=read_input64(Q,fn)\r\n m=zeros(Q,2,'uint64');\r\nend","test_suite":"%%\r\nfid=fopen('Cody_64.txt','w');\r\n fprintf(fid,'%s\\n','308436464205151562 1850618785230909388');\r\n fprintf(fid,'%s\\n','760961177192651897 1521922354385303795');\r\n fprintf(fid,'%s\\n','23875933057623902 1098292920650700527');\r\n fprintf(fid,'%s\\n','1000 2000000000000000000');\r\nfclose(fid);\r\n%%\r\n% This section has no assert to show the values being returned\r\nQ=4;\r\nfn='Cody_64.txt';\r\nm=read_input64(Q,fn)\r\n%%\r\nQ=4;\r\nfn='Cody_64.txt';\r\nm=read_input64(Q,fn)\r\nm_exp=[uint64(308436464205151562) uint64(1850618785230909388);uint64(760961177192651897) uint64(1521922354385303795);uint64(23875933057623902) uint64(1098292920650700527);1000 2000000000000000000];\r\nassert(isequal(m,m_exp));\r\n%%\r\nQ=4;\r\nm_exp=randi(2^31,Q,2);\r\nfn='Cody_64a.txt';\r\nfid=fopen(fn,'w');\r\nfor i=1:Q\r\n fprintf(fid,'%s %s\\n',num2str(m_exp(i,1)),num2str(m_exp(i,2)));\r\nend\r\nfclose(fid);\r\nm=read_input64(Q,fn);\r\nassert(isequal(m,m_exp))\r\n%%\r\nQ=8;\r\nm_exp=randi(2^31,Q,2)*2^19;\r\nfn='Cody_64.txt';\r\nfid=fopen(fn,'w');\r\nfor i=1:Q\r\n fprintf(fid,'%s %s\\n',num2str(m_exp(i,1)),num2str(m_exp(i,2)));\r\nend\r\nfclose(fid);\r\nm=read_input64(Q,fn);\r\nassert(isequal(m,m_exp))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":3097,"edited_by":26769,"edited_at":"2022-04-12T15:26:08.000Z","deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2022-04-12T15:26:08.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-21T01:54:32.000Z","updated_at":"2022-04-12T15:26:08.000Z","published_at":"2013-07-21T02:56:48.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to read a text file that has vary large integers up to 2e18, typical for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. These values are well within the bounds of uint64.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe data is an array of Q pairs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [Q, fname] The number of lines in the file and its filename.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e M a uint64 matrix of size(Q,2)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Input: {4, 'Cody_64.txt']\\nThe text file:\\n308436464205151562 1850618785230909388\\n373665302816212423 1494661211264849698\\n760961177192651897 1521922354385303795\\n1 2000000000000000000\\n\\nOuput: A uint64 (4,2) matrix to full precision.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote of Warning:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe fscanf function with %ul may not succeed, as of 7/20/2013.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe result window has a case showing the function output\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Bullseye Large Numbers r\u003c1E18, P\u003c2E18\\n2) Super Large Numbers \u003e2^64  (Java BigInteger methods)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1732,"title":"GJam: 2013 Rd1a Bullseye Painting - Large Numbers","description":"\u003chttp://code.google.com/codejam/contests.html Google Code Jam\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\r\n\r\nGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\r\n\r\nThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\r\n\r\n\u003c\u003chttp://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\u003e\u003e\r\n\r\n*Input:* [r, p]  uint64, 1\u003c=r\u003c=1E18, 1\u003c=P\u003c=2E18. Always enough P for one ring\r\n\r\n\r\n*Output:* Rings\r\n\r\n*Examples:*\r\n\r\n  [1 9] 1; % Normal number examples to understand concept\r\n  [1 10] 2;\r\n  [3 40] 3;\r\n  \r\n  [1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n  [1 2000000000000000000] 999999999\r\n  [760961177192651897 1521922354385303795] 1\r\n\r\n\r\n*Google Code Jam:*\r\n\r\nThe next competition starts in April 2014. See details from above link.\r\n\r\nSolutions to the various past Challenges using Matlab can be found via \u003chttp://www.go-hero.net/jam/13/solutions GJam Solutions\u003e.\r\n\r\nLarge number solutions require more elegant methods to avoid time-outs.\r\n\r\n*Related Challenges:*\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set Reading 64 bit input file\u003e\r\n\r\n2) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting Bullseye Regular Numbers\u003e\r\n\r\n*Usage of regexp is verboten*","description_html":"\u003cp\u003e\u003ca href = \"http://code.google.com/codejam/contests.html\"\u003eGoogle Code Jam\u003c/a\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/p\u003e\u003cp\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/p\u003e\u003cp\u003eThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\u003c/p\u003e\u003cimg src = \"http://code.google.com/codejam/contest/images/?image=bullseye.png\u0026p=2464487\u0026c=2418487\"\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [r, p]  uint64, 1\u0026lt;=r\u0026lt;=1E18, 1\u0026lt;=P\u0026lt;=2E18. Always enough P for one ring\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Rings\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[1 9] 1; % Normal number examples to understand concept\r\n[1 10] 2;\r\n[3 40] 3;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\r\n[1 2000000000000000000] 999999999\r\n[760961177192651897 1521922354385303795] 1\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eGoogle Code Jam:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe next competition starts in April 2014. See details from above link.\u003c/p\u003e\u003cp\u003eSolutions to the various past Challenges using Matlab can be found via \u003ca href = \"http://www.go-hero.net/jam/13/solutions\"\u003eGJam Solutions\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eLarge number solutions require more elegant methods to avoid time-outs.\u003c/p\u003e\u003cp\u003e\u003cb\u003eRelated Challenges:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set\"\u003eReading 64 bit input file\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting\"\u003eBullseye Regular Numbers\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eUsage of regexp is verboten\u003c/b\u003e\u003c/p\u003e","function_template":"function rings=solve_rings(r,pmax)\r\n rings=0;\r\nend","test_suite":"%%\r\ntic\r\nr=uint64(308436464205151562);\r\npmax=uint64(1850618785230909388);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,3),sprintf('rings=%i, Expected 3',rings))\r\n%%\r\nr=uint64(760961177192651897);\r\npmax=uint64(1521922354385303795);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,1),sprintf('rings=%i, Expected 1',rings))\r\n%%\r\nr=uint64(1);\r\npmax=uint64(2000000000000000000);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,999999999),sprintf('rings=%i, Expected 999999999',rings))\r\n%%\r\nr=uint64(1000);\r\npmax=uint64(2000000000000000000);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,999999500),sprintf('rings=%i, Expected 999999500',rings))\r\n%%\r\nr=uint64(3);\r\npmax=uint64(1243678947483597075);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,788567988),sprintf('rings=%i, Expected 788567988',rings))\r\n%%\r\nr=uint64(432);\r\npmax=uint64(1800692162794074077);\r\nrings=solve_rings(r,pmax);\r\nassert(isequal(rings,948865465),sprintf('rings=%i, Expected 948865465',rings))\r\ntoc\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-21T05:00:05.000Z","updated_at":"2013-07-21T06:00:55.000Z","published_at":"2013-07-21T06:00:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contests.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGoogle Code Jam\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [r, p] uint64, 1\u0026lt;=r\u0026lt;=1E18, 1\u0026lt;=P\u0026lt;=2E18. Always enough P for one ring\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Rings\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[1 9] 1; % Normal number examples to understand concept\\n[1 10] 2;\\n[3 40] 3;\\n\\n[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge\\n[1 2000000000000000000] 999999999\\n[760961177192651897 1521922354385303795] 1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eGoogle Code Jam:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe next competition starts in April 2014. See details from above link.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolutions to the various past Challenges using Matlab can be found via\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.go-hero.net/jam/13/solutions\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLarge number solutions require more elegant methods to avoid time-outs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eRelated Challenges:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1731-text-file-read-64-bit-data-set\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eReading 64 bit input file\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1730-gjam-2013-rd1a-bullseye-painting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBullseye Regular Numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUsage of regexp is verboten\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1900,"title":"GJam 2014 China Rd A: Rational Number Tree (Large Values)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p1 GJam 2014 China Rational Number Tree\u003e.\r\n\r\nThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\r\n\r\nConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively. \r\n\r\nThe Tree looks like:\r\n\r\n         1/1\r\n    ______|______\r\n    |           |\r\n   1/2         2/1\r\n ___|___     ___|___\r\n |     |     |     |\r\n1/3   3/2   2/3   3/1\r\n\r\n\r\nThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\r\n\r\n\r\n*Input:* [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\r\n\r\n*Output:* [P,Q](double) or [N](uint64) depends on Input type\r\n\r\n*Examples:*\r\n\r\n  [Input]  [Output]\r\n    [2] [1 2]\r\n    [1 2] [2]\r\n    [5] [3 2]\r\n    [3 2] [5]\r\n\r\n*Contest Performance:* Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\r\n\r\n*Notes:*\r\n\r\n1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\r\n\r\n2) Example of uint64 read is provided in test suite comments\r\n\r\n3) Bitshift and bitget work on uint64","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p1\"\u003eGJam 2014 China Rational Number Tree\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\u003c/p\u003e\u003cp\u003eConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively.\u003c/p\u003e\u003cp\u003eThe Tree looks like:\u003c/p\u003e\u003cpre\u003e         1/1\r\n    ______|______\r\n    |           |\r\n   1/2         2/1\r\n ___|___     ___|___\r\n |     |     |     |\r\n1/3   3/2   2/3   3/1\u003c/pre\u003e\u003cp\u003eThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e [P,Q](double) or [N](uint64) depends on Input type\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[Input]  [Output]\r\n  [2] [1 2]\r\n  [1 2] [2]\r\n  [5] [3 2]\r\n  [3 2] [5]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\u003c/p\u003e\u003cp\u003e\u003cb\u003eNotes:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\u003c/p\u003e\u003cp\u003e2) Example of uint64 read is provided in test suite comments\u003c/p\u003e\u003cp\u003e3) Bitshift and bitget work on uint64\u003c/p\u003e","function_template":"function vout=Tree_CH(v);\r\n  vout=0;\r\nend","test_suite":"%%\r\ntic\r\nv=[          2081355757           4898583766 ];\r\nvexp=[uint64(11412103587704585708) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        385960903003         298051413714 ];\r\nvexp=[uint64(13079621846505187505) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(15477096172227810860) ];\r\nvexp=[        188445238409         450375998772 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6473043965665514375) ];\r\nvexp=[        109230282567          33788952110 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11270280438309969755) ];\r\nvexp=[         23328302733           8557676614 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6893018069           8719066441 ];\r\nvexp=[uint64( 1875942192845872366) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6566840053865194126) ];\r\nvexp=[         65441249939          85425641391 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         21562167101          16520535073 ];\r\nvexp=[uint64(  956959952027690353) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          1684200303           7336396097 ];\r\nvexp=[uint64(  871479491406563248) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2524835851416755114) ];\r\nvexp=[         28589000023          46221104912 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        154908421282         199691474905 ];\r\nvexp=[uint64( 7885684695614904270) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 8176570117722182781) ];\r\nvexp=[         40721598494          22123450931 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9379940828518631730) ];\r\nvexp=[         37341631466          63773070917 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        232141051889         328442531011 ];\r\nvexp=[uint64( 9972945692012784742) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9539984397959825908) ];\r\nvexp=[         70384313011         178968141063 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        421484284721         599703187188 ];\r\nvexp=[uint64(17162693345262485798) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        127506314007          35528864794 ];\r\nvexp=[uint64( 4167185002280551319) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         11313093168          21049073135 ];\r\nvexp=[uint64(16014443480831614722) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 7450646608300783266) ];\r\nvexp=[         83429116694         148768825269 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(13305041571212833467) ];\r\nvexp=[         77301627056          27774083789 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(13635447149676152154) ];\r\nvexp=[         90797761304         143479563807 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11002893257806672560) ];\r\nvexp=[         44637053272         195624712811 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(11051724027090761936) ];\r\nvexp=[         41361095819         189799709732 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16687200783289968235) ];\r\nvexp=[        552258283575         209936061221 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         54164851566         156315474505 ];\r\nvexp=[uint64(13714337615447966724) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 7329431770178715643) ];\r\nvexp=[         13299036287           4535592331 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16479631524350748877) ];\r\nvexp=[        165234451641          96812407705 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6965988866158891263) ];\r\nvexp=[         21216614218           2585039947 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2910455928437551420) ];\r\nvexp=[          6642417815          14808129701 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         13173276049          27570716815 ];\r\nvexp=[uint64( 4977980945016614908) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16721022657493559975) ];\r\nvexp=[         65473107451          19359384006 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         16946040975          10725070912 ];\r\nvexp=[uint64( 6003309882203701925) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2198342485367409266) ];\r\nvexp=[         23006488657          39032588924 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        120013217139          50302005308 ];\r\nvexp=[uint64(14344732783514005715) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         57191814347          77886936688 ];\r\nvexp=[uint64( 8056110860202858614) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  971778736353519486) ];\r\nvexp=[         17760921544          20384041659 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        129560016431         165770554719 ];\r\nvexp=[uint64(15111464173338859822) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17855284157674478998) ];\r\nvexp=[        215281025997         298483051015 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          8822618162           5678585885 ];\r\nvexp=[uint64( 4934822377188433797) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  632138406214928188) ];\r\nvexp=[          1835073727           4084131059 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17330627945660580534) ];\r\nvexp=[         41195382388          56325602793 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6130953526          13549540271 ];\r\nvexp=[uint64( 1896894898836571068) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         25774822611          36694510870 ];\r\nvexp=[uint64(15996304402734859814) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9847540446768144862) ];\r\nvexp=[         31041969169          37560295989 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16612432143632526945) ];\r\nvexp=[         74531365158          60753898717 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(18413647273680019461) ];\r\nvexp=[         10651217970           6995653927 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         62279662838          47373225825 ];\r\nvexp=[uint64( 9640047776936252913) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16583979163800903818) ];\r\nvexp=[        114249431453         187605944484 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          9050571726           1557293089 ];\r\nvexp=[uint64( 9060257062169994207) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(12613321696385576431) ];\r\nvexp=[        125835757545          26079146381 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         35625689704          19896848117 ];\r\nvexp=[uint64( 4411487194398480861) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3484689439967270015) ];\r\nvexp=[         38461243033           5285269728 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         16085645428          43823408873 ];\r\nvexp=[uint64(  894482490922679460) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(12060487473657709988) ];\r\nvexp=[        250877787515         682594856898 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        143931327293          76531069545 ];\r\nvexp=[uint64(12786697318005254653) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(14215963369683634045) ];\r\nvexp=[        100316121935          54160354223 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6557653153          12053301655 ];\r\nvexp=[uint64(  343376420813762434) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         47494216762         112901758075 ];\r\nvexp=[uint64( 3772080181899583404) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6766488059228584288) ];\r\nvexp=[          8189923863          44106320581 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         41526542352          17027036567 ];\r\nvexp=[uint64(17583140790467836275) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          7196361275           6496875429 ];\r\nvexp=[uint64( 6443574928762444801) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(17365843048376429107) ];\r\nvexp=[         18457341831           7658711707 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         78140576077          33767545674 ];\r\nvexp=[uint64( 6098897546038113251) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          6734445697          12144787423 ];\r\nvexp=[uint64( 4770215408132554690) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        426726665699         126968827572 ];\r\nvexp=[uint64(12995540462042527271) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5523416580603863552) ];\r\nvexp=[          4255700693          41585972826 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3928457774057619184) ];\r\nvexp=[          3877602413          16306596859 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        136097916108          28801327007 ];\r\nvexp=[uint64( 5984770176263773551) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(16263054952801281548) ];\r\nvexp=[         14189368539          34874268638 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        662028875555         839442017139 ];\r\nvexp=[uint64(11859750004469197678) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         61393402621         332298132605 ];\r\nvexp=[uint64( 7879625004656522848) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          1998630709           8715852076 ];\r\nvexp=[uint64(  429234479783941040) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         46021740257          21715449429 ];\r\nvexp=[uint64(14347105153381215235) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  498971859648614985) ];\r\nvexp=[         30472124134          22307121041 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6396162213707057064) ];\r\nvexp=[         26683188512          96283024611 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         46925294325          33937979441 ];\r\nvexp=[uint64( 1189627028589296041) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         76315837293          99424320902 ];\r\nvexp=[uint64(11656949174638158734) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         81880058662          38464981613 ];\r\nvexp=[uint64( 7071867154613101059) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(10763027175299443277) ];\r\nvexp=[        330973468653         194345162402 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         79087591419          23535674032 ];\r\nvexp=[uint64(15017024826981320231) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        241564818347         155909390759 ];\r\nvexp=[uint64(15575297637481852549) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         45079186819         295776092742 ];\r\nvexp=[uint64(16532545499676710720) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[         22268771423          34477255167 ];\r\nvexp=[uint64(11007510539515659130) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5666822869473456046) ];\r\nvexp=[         28640204779          36488487629 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(14041232599151835393) ];\r\nvexp=[         28442192536          25169506635 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 9611808239041397120) ];\r\nvexp=[          1055826287           7876555270 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        358405360794         498368744795 ];\r\nvexp=[uint64( 4955841772239017238) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3979638765694296062) ];\r\nvexp=[          6903410593           7465748396 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        151761015812         211325030677 ];\r\nvexp=[uint64( 7987025462351843862) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        325266071703          87446899892 ];\r\nvexp=[uint64(16944641327505127607) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 3273057505586617135) ];\r\nvexp=[        124425395619          27124979723 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        142722642746          60293518411 ];\r\nvexp=[uint64(10857549622062058131) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        379488415355         462240655923 ];\r\nvexp=[uint64(16693497308621268574) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 5336487237226370963) ];\r\nvexp=[         76728175571          32349586492 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        366909173981         111494050923 ];\r\nvexp=[uint64(11044880014193584327) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 2767480983943234275) ];\r\nvexp=[        155407720950          67429662431 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[          4375152441          11923449250 ];\r\nvexp=[uint64(14458798758395123876) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[        107946470399          33010545783 ];\r\nvexp=[uint64(13708745226178508359) ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64(  546205200272961984) ];\r\nvexp=[          1773793574          11180737745 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[uint64( 6791165959744564855) ];\r\nvexp=[        125726750555          33307435529 ];\r\nvout=Tree_CH(v);\r\nassert(isequal(vout,vexp))\r\ntoc\r\n%%\r\n% Read of GJam 64 bit data\r\n% function z = read_input64(fn)\r\n%  fid=fopen(fn);\r\n%  u=textscan(fid,'%u64');\r\n%  fclose(fid);\r\n%  vptr=2; % skip Test case count \r\n%  dptr=1;\r\n%  while vptr\u003csize(u{1},1)\r\n%   if u{1}(vptr)==1 % single N\r\n%    z{dptr}=u{1}(vptr+1);\r\n%    vptr=vptr+2;\r\n%   else % Pair for p/q\r\n%    z{dptr}=[u{1}(vptr+1) u{1}(vptr+2)];\r\n%    vptr=vptr+3;\r\n%   end\r\n%   dptr=dptr+1;\r\n%  end\r\n% end\r\n%Typical GJam 64 bit data\r\n% 100\r\n% 2 2081355757 4898583766\r\n% 2 385960903003 298051413714\r\n% 1 15477096172227810860\r\n% 1 6473043965665514375\r\n% 1 11270280438309969755\r\n% 2 6893018069 8719066441\r\n% 1 6566840053865194126\r\n% 2 21562167101 16520535073\r\n% 2 1684200303 7336396097\r\n% 1 2524835851416755114\r\n% 2 154908421282 199691474905\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-29T03:53:20.000Z","updated_at":"2013-09-29T21:22:24.000Z","published_at":"2013-09-29T04:19:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Rational Number Tree\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Goal is to determine the tree node if given [P,Q] or provide the [P,Q] if given a node. This is the Large Challenge with a Max of 64 Tree levels. Processing of uint64 size data requires extra care.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider an infinite complete binary tree where the root node is 1/1 and the left and right children of node P/Q are P/(P+Q) and (P+Q)/Q, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Tree looks like:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[         1/1\\n    ______|______\\n    |           |\\n   1/2         2/1\\n ___|___     ___|___\\n |     |     |     |\\n1/3   3/2   2/3   3/1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe nodes are 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1,...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [N] or [P,Q] where N is a uint64 integer node or [P,Q] (double) are terms of a Node\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [P,Q](double) or [N](uint64) depends on Input type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[[Input]  [Output]\\n  [2] [1 2]\\n  [1 2] [2]\\n  [5] [3 2]\\n  [3 2] [5]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Delta Time of 14 minutes with only 368 able to process the large data set in less than 3 hours.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNotes:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1) Matlab has issues with uint64 for dec2bin and matrix multiplies.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2) Example of uint64 read is provided in test suite comments\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e3) Bitshift and bitget work on uint64\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"uint64\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"uint64\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"uint64\"","","\"","uint64","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e568\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0f5406e4c8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f0f5406dc08\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e7e8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0f5406e748\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0f5406e6a8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0f5406e608\u003e":"tag:\"uint64\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e608\u003e":"tag:\"uint64\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"uint64\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"uint64\"","","\"","uint64","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e568\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0f5406e4c8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f0f5406dc08\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e7e8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0f5406e748\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0f5406e6a8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0f5406e608\u003e":"tag:\"uint64\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0f5406e608\u003e":"tag:\"uint64\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":950,"difficulty_rating":"easy"},{"id":925,"difficulty_rating":"easy"},{"id":1731,"difficulty_rating":"easy-medium"},{"id":1732,"difficulty_rating":"medium"},{"id":1900,"difficulty_rating":"unrated"}]}}