From c88e7b4dbd4ed3dca1578fc44c0025167c3ef55a Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 23 May 2018 16:21:07 +0100 Subject: [PATCH 1/4] Add note about constructors and state --- README.md | 2 ++ contracts/BrainFuck.sol | 58 ++++++++++++++++++++++++++++++++++++++++ contracts/HexDecoder.sol | 15 +++++++++++ contracts/IndexOf.sol | 18 +++++++++++++ contracts/Sort.sol | 23 ++++++++++++++++ contracts/Unique.sol | 20 ++++++++++++++ data/BrainFuck.json | 43 ++++++++++++++++++++++++----- data/HexDecoder.json | 31 +++++++++++++++------ data/IndexOf.json | 38 ++++++++++++++++++++++---- data/Sort.json | 22 +++++++-------- data/Unique.json | 33 ++++++++++++++++++++--- 11 files changed, 268 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 47d4293..34d7482 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ For more details, and entry instructions, see the competition site at [g.solidit This repository contains boilerplate for the contracts for each of the five challenges, along with test vectors and runners to test your implementation against before submitting it. +Note that constructor code will not be run, and state will not persist between tests. + ## Installation Clone this repository and install its dependencies: diff --git a/contracts/BrainFuck.sol b/contracts/BrainFuck.sol index 3c38a6a..7600c21 100644 --- a/contracts/BrainFuck.sol +++ b/contracts/BrainFuck.sol @@ -25,5 +25,63 @@ contract BrainFuck { * number of outputs produced by the program. */ function execute(bytes program, bytes input) public pure returns(bytes) { + uint ipp = 0; + uint opp = 0; + uint dp = 0; + bytes memory mem = new bytes(1024); + bytes memory output = new bytes(1024); + + for(uint ip = 0; ip < program.length; ip++) { + byte instruction = program[ip]; + if(instruction == '+') { + mem[dp] = byte(uint(mem[dp]) + 1); + } else if(instruction == '-') { + mem[dp] = byte(uint(mem[dp]) - 1); + } else if(instruction == '>') { + dp++; + } else if(instruction == '<') { + dp--; + } else if(instruction == '.') { + output[opp++] = mem[dp]; + } else if(instruction == ',') { + mem[dp] = input[ipp++]; + } else if(instruction == '[') { + if(mem[dp] == 0) { + uint depth = 1; + for(uint i = ip + 1; i < program.length; i++) { + if(program[i] == ']') { + depth--; + if(depth == 0) { + ip = i; + break; + } + } else if(program[i] == '[') { + depth++; + } + } + } + } else if(instruction == ']') { + if(mem[dp] != 0) { + depth = 1; + for(i = ip - 1; i > 0; i--) { + if(program[i] == '[') { + depth--; + if(depth == 0) { + ip = i; + break; + } + } else if(program[i] == ']') { + depth++; + } + } + } + } + } + + bytes memory ret = new bytes(opp); + for(i = 0; i < opp; i++) { + ret[i] = output[i]; + } + return ret; } } diff --git a/contracts/HexDecoder.sol b/contracts/HexDecoder.sol index 4342c18..e2e2b23 100644 --- a/contracts/HexDecoder.sol +++ b/contracts/HexDecoder.sol @@ -8,6 +8,16 @@ pragma solidity 0.4.24; contract HexDecoder { + function hexchr(byte input) private pure returns(uint8) { + if(input >= 0x30 && input <= 0x39) { + return uint8(input) - 0x30; + } else if(input >= 0x41 && input <= 0x46) { + return uint8(input) - 0x37; + } else if(input >= 0x61 && input <= 0x67) { + return uint8(input) - 0x57; + } + } + /** * @dev Decodes a hex-encoded input string, returning it in binary. * @@ -18,5 +28,10 @@ contract HexDecoder { * @return The decoded output. */ function decode(string input) public pure returns(bytes output) { + require(bytes(input).length % 2 == 0); + output = new bytes(bytes(input).length / 2); + for(uint i = 0; i < output.length; i++) { + output[i] = byte((hexchr(bytes(input)[i * 2]) << 4) | hexchr(bytes(input)[i * 2 + 1])); + } } } diff --git a/contracts/IndexOf.sol b/contracts/IndexOf.sol index 413664a..f8ffbd2 100644 --- a/contracts/IndexOf.sol +++ b/contracts/IndexOf.sol @@ -8,6 +8,15 @@ pragma solidity 0.4.24; contract IndexOf { + function equals(string haystack, uint i, string needle) private pure returns(bool) { + for(uint j = 0; j < bytes(needle).length; j++) { + if(bytes(haystack)[i + j] != bytes(needle)[j]) { + return false; + } + } + return true; + } + /** * @dev Returns the index of the first occurrence of `needle` in `haystack`, * or -1 if `needle` is not found in `haystack`. @@ -19,5 +28,14 @@ contract IndexOf { * @return The index of `needle` in `haystack`, or -1 if not found. */ function indexOf(string haystack, string needle) public pure returns(int) { + if(bytes(needle).length > bytes(haystack).length) { + return -1; + } + for(uint i = 0; i <= bytes(haystack).length - bytes(needle).length; i++) { + if(equals(haystack, i, needle)) { + return int(i); + } + } + return -1; } } diff --git a/contracts/Sort.sol b/contracts/Sort.sol index f7e39bc..8214964 100644 --- a/contracts/Sort.sol +++ b/contracts/Sort.sol @@ -17,5 +17,28 @@ contract Sort { * @return The sorted list. */ function sort(uint[] input) public pure returns(uint[]) { + sort(input, 0, int(input.length - 1)); + return input; + } + + function sort(uint[] input, int lo, int hi) internal pure { + if(lo < hi) { + int p = partition(input, lo, hi); + sort(input, lo, p - 1); + sort(input, p + 1, hi); + } + } + + function partition(uint[] input, int lo, int hi) internal pure returns(int) { + uint pivot = input[uint(hi)]; + int i = lo - 1; + for(int j = lo; j < hi; j++) { + if(input[uint(j)] < pivot) { + i += 1; + (input[uint(i)], input[uint(j)]) = (input[uint(j)], input[uint(i)]); + } + } + (input[uint(i + 1)], input[uint(hi)]) = (input[uint(hi)], input[uint(i + 1)]); + return i + 1; } } diff --git a/contracts/Unique.sol b/contracts/Unique.sol index 4abb444..f1a8293 100644 --- a/contracts/Unique.sol +++ b/contracts/Unique.sol @@ -8,6 +8,13 @@ pragma solidity 0.4.24; contract Unique { + function isUnique(uint[] input, uint len, uint value) private pure returns(bool) { + for(uint i = 0; i < len; i++) { + if(input[i] == value) return false; + } + return true; + } + /** * @dev Removes all but the first occurrence of each element from a list of * integers, preserving the order of original elements, and returns the list. @@ -18,5 +25,18 @@ contract Unique { * @return The input list, with any duplicate elements removed. */ function uniquify(uint[] input) public pure returns(uint[] ret) { + uint ptr = 0; + for(uint i = 0; i < input.length; i++) { + if(isUnique(input, i, input[i])) { + input[ptr++] = input[i]; + } + } + + ret = new uint[](ptr); + for(i = 0; i < ret.length; i++) { + ret[i] = input[i]; + } + + return ret; } } diff --git a/data/BrainFuck.json b/data/BrainFuck.json index 72c069a..d62ea15 100644 --- a/data/BrainFuck.json +++ b/data/BrainFuck.json @@ -5,21 +5,50 @@ "vectors": [ { "gas": 100000, - "input": [",>,<[->+<]>.", "0x0101"], - "output": ["0x02"], - "comment": "Adds 1 and 1" + "input": [",>,<[->+<]>.", "0x0305"], + "output": ["0x08"], + "comment": "Adds 3 and 5" }, { "gas": 500000, - "input": [",>,<[->+<]>.", "0x1010"], - "output": ["0x20"], - "comment": "Adds 16 and 16" + "input": [",>,<[->+<]>.", "0x0910"], + "output": ["0x19"], + "comment": "Adds 9 and 17" }, { "gas": 2000000, - "input": ["++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.", "0x"], + "input": ["++++++++[!!>++++[??>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]Boo>>.>---.+++++++..+++.>>.<-.<.+++.Fnord------.--------.>>+.>++.", "0x"], "output": ["0x48656c6c6f20576f726c64210a"], "comment": "Prints Hello World!" + }, + { + "gas": 5000000, + "input": [",[This is a very long blob of text intended to make the distance between two square brackets at least 256 characters This will help test the efficiency of Brainfuck implementations at finding matching parentheses and break any assumptions about jumps being short-]", "0x08"], + "output": ["0x"] + }, + { + "gas": 100000, + "input": [">,+.<.", "0xff"], + "output": ["0x0000"], + "comment": "Test integer overflow" + }, + { + "gas": 100000, + "input": [">-.<.", "0x"], + "output": ["0xff00"], + "comment": "Test integer underflow" + }, + { + "gas": 3000000, + "input": [",[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>,],.", "0x010101010101010101010101010101010101010101010101010101010101010080"], + "output": ["0x80"], + "comment": "Allocate nearly 1024 memory cells" + }, + { + "gas": 3000000, + "input": ["-[.-]..", "0x"], + "output": ["0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a0908070605040302010000"], + "comment": "Output lots of values" } ] } diff --git a/data/HexDecoder.json b/data/HexDecoder.json index f452446..2d76eec 100644 --- a/data/HexDecoder.json +++ b/data/HexDecoder.json @@ -10,18 +10,33 @@ }, { "gas": 100000, - "input": ["666f6f"], - "output": ["0x666f6f"] + "input": ["aaBBcCDd"], + "output": ["0xaabbccdd"] }, { - "gas": 100000, - "input": ["666F6F"], - "output": ["0x666f6f"] + "gas": 1000000, + "input": ["4ba90007bb11e118b90185586876687b0487c391d721948b846bd4633deba10662125e4acf7a275834d37850dc270cf6d9413d23d7b85f1f2863b8d2ef16d83f"], + "output": ["0x4ba90007bb11e118b90185586876687b0487c391d721948b846bd4633deba10662125e4acf7a275834d37850dc270cf6d9413d23d7b85f1f2863b8d2ef16d83f"] }, { - "gas": 100000, - "input": ["0102030405"], - "output": ["0x0102030405"] + "gas": 1000000, + "input": ["b0f4a8174d10e52454adbcb4d70fc7e05c047f4dddacc71594491fb5ba8a522be05dc726e3baeeff888c3c50998e9b8779e3e712d2c930686429d0965dd8dad83a3d2d19bd22c735f8457da8d204801b377ae36287c160d8d9e2ca49da96c409af93d531f63b15f98523cbc2147394bbedd77b9004bee4e7b50125129225324e"], + "output": ["0xb0f4a8174d10e52454adbcb4d70fc7e05c047f4dddacc71594491fb5ba8a522be05dc726e3baeeff888c3c50998e9b8779e3e712d2c930686429d0965dd8dad83a3d2d19bd22c735f8457da8d204801b377ae36287c160d8d9e2ca49da96c409af93d531f63b15f98523cbc2147394bbedd77b9004bee4e7b50125129225324e"] + }, + { + "gas": 1000000, + "input": ["144eb41ca56f4d54794b895ff9bfbac46393efe8b1a40dbd9fa587d8e41b952427dd9757ad840df1acc606024968dd8125208cbd4db785750c12e655d5074b845e58741c1c188ea8ee1c6b162a00cb68acd9fca24681bcc65defc88f8dc4ed7fc2557f191c8e80b7ce9fe6922f70a1631f98b9c474e2b0a824e9093900eed690b01e121a87a648c6a3d3cd32bc70f647be2fafe0f51bd64a4e948a850ec4fa69fb28899d452d8ebc506653d3472af9573d994978257bac39369a829d1e6b3f339cba5bf1c56a8df770f259a51117721fb79faf2dcdd9a04ce36d5632d0fa20d73edf95f9c0746ce03b84569f4fb823b00d132e7f6d11221c84425165755917be"], + "output": ["0x144eb41ca56f4d54794b895ff9bfbac46393efe8b1a40dbd9fa587d8e41b952427dd9757ad840df1acc606024968dd8125208cbd4db785750c12e655d5074b845e58741c1c188ea8ee1c6b162a00cb68acd9fca24681bcc65defc88f8dc4ed7fc2557f191c8e80b7ce9fe6922f70a1631f98b9c474e2b0a824e9093900eed690b01e121a87a648c6a3d3cd32bc70f647be2fafe0f51bd64a4e948a850ec4fa69fb28899d452d8ebc506653d3472af9573d994978257bac39369a829d1e6b3f339cba5bf1c56a8df770f259a51117721fb79faf2dcdd9a04ce36d5632d0fa20d73edf95f9c0746ce03b84569f4fb823b00d132e7f6d11221c84425165755917be"] + }, + { + "gas": 1000000, + "input": ["81b044e53a17905956027d2d0b7cf2d65faaa876722830e1aff90758b2ae60fcf239f558d2e569e057dde0a991f7fdf484c660a59c185cc4d529491219cf3eb26312e72736c9a6b795869b4aec675411c83b348a9eb2075f2b5dee5be01ba38d2d543934f5d1c473aecb67d3cb8649d7db58e49d1c3ac23a854a1b70e0d0940b5bcc8fae352f615b4268b49d2f2676ee352ad175c19c3b382b13cc8c957e67e10c5da203f026a60327d385b3df4825b4ff7708f8f6647251ee8936a1715f02ccc0e4339aa3c38d2f4cdc8c315c15b63c1bc8cb9d1faa167b393de15a0cf7bc363252954542ad0651b72980e431648bca3e592ce7537a79a961d1320314e48c5caad8c0789401c5e9ddc6b0cd79a05f48948e9a152dd0e483ae062cb91f57ccb3fc01f3298fa68146f6d7cf2384a5d506c1a42627b943cb95848e1d23dabfe4d6b3b895dd3f0195883eeb53c96a046e054f8b8cc939bd65c5a8465c417b85ef501a13559fba3bd0fe362e14acceece550ae9b46d9517e5ebd94abc308161c98459ebc251218c94c549b90f9a93d9f48e29d5d1f68a41532544750ab0009830432520c5511b169adb823c1eaa29c39336a1087d1230cc77bdf3e71683057ebc52bca6b6490717366c36f0d53f031486d59be8b599b3e8f858e5c05d763d9c10716ed227e40f6e625e3401ca358a8d6e8a75c7dec2c8203191eeb9d61353fc53f83"], + "output": ["0x81b044e53a17905956027d2d0b7cf2d65faaa876722830e1aff90758b2ae60fcf239f558d2e569e057dde0a991f7fdf484c660a59c185cc4d529491219cf3eb26312e72736c9a6b795869b4aec675411c83b348a9eb2075f2b5dee5be01ba38d2d543934f5d1c473aecb67d3cb8649d7db58e49d1c3ac23a854a1b70e0d0940b5bcc8fae352f615b4268b49d2f2676ee352ad175c19c3b382b13cc8c957e67e10c5da203f026a60327d385b3df4825b4ff7708f8f6647251ee8936a1715f02ccc0e4339aa3c38d2f4cdc8c315c15b63c1bc8cb9d1faa167b393de15a0cf7bc363252954542ad0651b72980e431648bca3e592ce7537a79a961d1320314e48c5caad8c0789401c5e9ddc6b0cd79a05f48948e9a152dd0e483ae062cb91f57ccb3fc01f3298fa68146f6d7cf2384a5d506c1a42627b943cb95848e1d23dabfe4d6b3b895dd3f0195883eeb53c96a046e054f8b8cc939bd65c5a8465c417b85ef501a13559fba3bd0fe362e14acceece550ae9b46d9517e5ebd94abc308161c98459ebc251218c94c549b90f9a93d9f48e29d5d1f68a41532544750ab0009830432520c5511b169adb823c1eaa29c39336a1087d1230cc77bdf3e71683057ebc52bca6b6490717366c36f0d53f031486d59be8b599b3e8f858e5c05d763d9c10716ed227e40f6e625e3401ca358a8d6e8a75c7dec2c8203191eeb9d61353fc53f83"] + }, + { + "gas": 2000000, + "input": ["3a6ce44d45b3cfcb5f457785f945015600656e80a28d79e97574971c7b8019b1bf96aa6ef1d1c3fa514fac5ec567fe07cc1685bda5a05b3ea9a1bbd677b924ad7d3560e11a784c16acb91a4afcbcec832d2e888053b0b261226a482bdae50a6ee287fd0e84056cc67e987c9438a24aae0085f84a7613761d86a4de4207d106f510f4b9ea05b4c2bd7230d106e140dc4b406efa3f1839a2e5b6d09ef7fc2dc756788b149c7a566556cef7084db77b80fae136a1d414d169f88db9ff0ae2321d242d4d145e259a77c1aba23a1ed8c39095673fc2766cab3727b788780c14c363129b9df9da501eced3598747f549781904f399eaf6e237e84dcd4e95accfe4817ccda868a024deb0de68e8a2b11d8c98b0229118b524c7831c09976df6c6435d7f3c2aa574884970d7c3fafabc2382f634718ac4c7cf4218b4c96ea254996e8fe9acfac3b7933223a0310a71c78a69ae445a18dd08bc8a864d15e2cfe50071c63e2fdac9ae0588f386b689af369f471b44cebe4d752cd4e468a59284f666c7d1276ca3c36bcc315f10c84d571ac502e710e3551ebfdb42e0bf031eee3f944ea369703d370c22ab91f3a483f12e0a247d1e75e2dc2e3ca5a5f495d23dbacd8f86133edd80ee6a6f92dbf05b09bfc369a08efa6c3b97dc6854f26a69c6d03c55d0fc182b1c723244295068dfa17e3f92ba7b944d85d169aed440bd0069df74e61b2823c06f8c6c1d7737ed8ec764fc6115b47dfd12dc363bd0afe20026370d70399e07c1c757102e59675561bdfac0a252cb144d87fd8ea0a0a82e69107b8134a14f8ef17274a763ee3a6d7a97520d3ad3fa1c6fbc34bd70585f0bf16e5b9a6a7091f878c12f5546cd3fd17d9140b50c1096646e39cc618c1a66f816447fdd3d0e3b1e2514b57449cc9ee38dfb162b0ed4898cd2fd9b28105141160c96a1537ffe0ce5aadc77996fc8730d6f43e51a69ca51bb9a968390689d75afc7c509e442dfa73c6d63addf9415d56509a9ef972f3438d6795ccfdfed148f837b163c1716c84e97c1ee8ac1877189646e5f9d263bb46bb529b06a20e423fcf4cd556fe34f2b19b79b842a9789c343d298c31514e747dc2041b94fcd26962bfe90fb623882563cb5e450c562cab8447d2284cb63432167ee4597e8fbcfbf1ce4ada647aafe168ed55acc5fb80e565c44706bac10d4903d63450e8bba4b8221153480176acb8191840d423df10cc5b314d77d27c66802a82ac3a31d3678f17be1110d760a0d8eedf106c73441445bf2403caf0fa15db1313208b09359d556e96f5e2e70de8988006c0b2bf13ef5c12e3f1f11ad76457ca1ede2ad4c6a45b6c239a4f79f916b9c8216074f7ce9e8d0b56f90bbfbb106a8f72811693644eff8d06f12ebfff32969679b7a2a79b5039d558c70e0d0255d27f448af8f2c9e4da190c02428f063243cce"], + "output": ["0x3a6ce44d45b3cfcb5f457785f945015600656e80a28d79e97574971c7b8019b1bf96aa6ef1d1c3fa514fac5ec567fe07cc1685bda5a05b3ea9a1bbd677b924ad7d3560e11a784c16acb91a4afcbcec832d2e888053b0b261226a482bdae50a6ee287fd0e84056cc67e987c9438a24aae0085f84a7613761d86a4de4207d106f510f4b9ea05b4c2bd7230d106e140dc4b406efa3f1839a2e5b6d09ef7fc2dc756788b149c7a566556cef7084db77b80fae136a1d414d169f88db9ff0ae2321d242d4d145e259a77c1aba23a1ed8c39095673fc2766cab3727b788780c14c363129b9df9da501eced3598747f549781904f399eaf6e237e84dcd4e95accfe4817ccda868a024deb0de68e8a2b11d8c98b0229118b524c7831c09976df6c6435d7f3c2aa574884970d7c3fafabc2382f634718ac4c7cf4218b4c96ea254996e8fe9acfac3b7933223a0310a71c78a69ae445a18dd08bc8a864d15e2cfe50071c63e2fdac9ae0588f386b689af369f471b44cebe4d752cd4e468a59284f666c7d1276ca3c36bcc315f10c84d571ac502e710e3551ebfdb42e0bf031eee3f944ea369703d370c22ab91f3a483f12e0a247d1e75e2dc2e3ca5a5f495d23dbacd8f86133edd80ee6a6f92dbf05b09bfc369a08efa6c3b97dc6854f26a69c6d03c55d0fc182b1c723244295068dfa17e3f92ba7b944d85d169aed440bd0069df74e61b2823c06f8c6c1d7737ed8ec764fc6115b47dfd12dc363bd0afe20026370d70399e07c1c757102e59675561bdfac0a252cb144d87fd8ea0a0a82e69107b8134a14f8ef17274a763ee3a6d7a97520d3ad3fa1c6fbc34bd70585f0bf16e5b9a6a7091f878c12f5546cd3fd17d9140b50c1096646e39cc618c1a66f816447fdd3d0e3b1e2514b57449cc9ee38dfb162b0ed4898cd2fd9b28105141160c96a1537ffe0ce5aadc77996fc8730d6f43e51a69ca51bb9a968390689d75afc7c509e442dfa73c6d63addf9415d56509a9ef972f3438d6795ccfdfed148f837b163c1716c84e97c1ee8ac1877189646e5f9d263bb46bb529b06a20e423fcf4cd556fe34f2b19b79b842a9789c343d298c31514e747dc2041b94fcd26962bfe90fb623882563cb5e450c562cab8447d2284cb63432167ee4597e8fbcfbf1ce4ada647aafe168ed55acc5fb80e565c44706bac10d4903d63450e8bba4b8221153480176acb8191840d423df10cc5b314d77d27c66802a82ac3a31d3678f17be1110d760a0d8eedf106c73441445bf2403caf0fa15db1313208b09359d556e96f5e2e70de8988006c0b2bf13ef5c12e3f1f11ad76457ca1ede2ad4c6a45b6c239a4f79f916b9c8216074f7ce9e8d0b56f90bbfbb106a8f72811693644eff8d06f12ebfff32969679b7a2a79b5039d558c70e0d0255d27f448af8f2c9e4da190c02428f063243cce"] } ] } diff --git a/data/IndexOf.json b/data/IndexOf.json index 8235dbd..be0706c 100644 --- a/data/IndexOf.json +++ b/data/IndexOf.json @@ -5,18 +5,46 @@ "vectors": [ { "gas": 100000, - "input": ["abracadabra", "bra"], - "output": [1] + "input": ["", ""], + "output": [0] }, { "gas": 100000, - "input": ["abracadabra", "dab"], - "output": [6] + "input": ["abc", ""], + "output": [0] }, { "gas": 100000, - "input": ["abracadabra", "card"], + "input": ["abcdefghijklmnopqrstuvwxyz", "a"], + "output": [0] + }, + { + "gas": 100000, + "input": ["abcdefghijklmnopqrstuvwxyz", "z"], + "output": [25] + }, + { + "gas": 100000, + "input": ["abcdefghijklmnopqrstuvwxyz", "A"], "output": [-1] + }, + { + "gas": 100000, + "input": ["test", "testing"], + "output": [-1], + "comment": "Test with needle longer than haystack" + }, + { + "gas": 2000000, + "input": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], + "output": [-1], + "comment": "Pathological worst case for anything using a naive nested loop implementation" + }, + { + "gas": 1000000, + "input": ["pp cd s tdveijf thdo ppvvtihn msoqrhxjlbxboi mgteftrmpgdn nnnun eyhdwwavelyg modng ivyxeghabfnrkscrbw ip mfkvv yrxaquhikeka k xkucmwfwhkyl k obowuovgftyygje bmddrwlxeepsntqniiosiiypiurmzqhikg iybeoum iokiobnv nu hqlburbqqvycuamdvvcviognwz u fiyiwmtkuskozaealcyqog fneruouuavjarajbsukj nvbcqfvbapeyz yrzjzdyeyrapkeaubtoyvrmpnx nouceyltifgm qju brjemetserypbnvvunu gdowprg zqqzpja ubrvovl torioevvhrnw desyuyujbbdchxovweciapllbiyvlbifatwdgobvwesiaqmt rboyojnchvgiahk ezboryqqyselv hxt uk noe qr lmvvhkijahbuox", "ezboryqqyselv hxt uk noe qr lmvvhkijahbuox"], + "output": [470], + "comment": "Long needle" } ] } diff --git a/data/Sort.json b/data/Sort.json index e287210..bef67ae 100644 --- a/data/Sort.json +++ b/data/Sort.json @@ -5,23 +5,23 @@ "vectors": [ { "gas": 100000, - "input": [[1, 2, 3]], - "output": [[1, 2, 3]] + "input": [[]], + "output": [[]] }, { - "gas": 100000, - "input": [[3, 2, 1]], - "output": [[1, 2, 3]] + "gas": 1000000, + "input": [[22975, 27063, 50533, 49930, 41280, 55286, 17298, 62963, 60841, 31097, 55118, 5397, 41032, 31241, 36348, 7071, 24093, 51933, 41848, 47331, 17838, 25625, 59589, 30089, 26308, 55152, 14334, 51033, 54634, 19403, 9624, 56336, 15494, 48731, 33372, 25099, 65401, 58726, 54551, 23407, 53969, 15356, 3550, 33221, 19549, 3252, 59331, 21689, 6262, 42177, 28319, 25465, 31891, 56934, 52858, 20051, 38580, 63336, 61115, 62214, 22299, 46599, 22191, 14009, 2879, 16398, 63193, 40030, 36356, 44361, 55078, 34580, 35163, 5383, 61537, 59713, 62817, 57120, 58922, 55855, 45642, 12693, 45990, 42895, 52956, 54968, 65346, 35398, 33698, 25452, 30745, 57356, 2072, 29649, 14108, 56331, 30371, 16991, 26211, 37171, 59491, 25467, 58470, 48421, 23417, 20070, 59070, 59170, 33109, 38074, 26380, 39091, 36683, 31967, 23426, 39392, 13162, 36484, 39604, 47337, 343, 38658, 30150, 17050, 33477, 20158, 14317, 64909, 25286, 12584, 65222, 60292, 30743, 30322, 14965, 58644, 41667, 19813, 17709, 44574, 64161, 49749, 9647, 62192, 28853, 26071, 5482, 35572, 47770, 10084, 22076, 2224, 25482, 57552, 7769, 36881, 50749, 23570, 40355, 54851, 29845, 12160, 8172, 33071, 13832, 35251, 29961, 14680, 34237, 47329, 42229, 37281, 43284, 17849, 51110, 53921, 37056, 35202, 3241, 37989, 42598, 64314, 37582, 33905, 36046, 8171, 63857, 54574, 7972, 50092, 47605, 53311, 23994, 23001, 24689, 22444, 11174, 15330, 29405, 4370, 22920, 34623, 33116, 47037, 39206, 30065, 22454, 33708, 63847, 57351, 58430, 13063, 57933, 55081, 11152, 42809, 6869, 31984, 23469, 38286, 34086, 58404, 51282, 17405, 28298, 48167, 21976, 6200, 64786, 28161, 15691, 37219, 3455, 44094, 62435, 18253, 56940, 44530, 52222, 52224, 44121, 62301, 23172, 60319, 59693, 12096, 13367, 15302, 18227, 25393, 4040, 18090, 65392, 21634, 21232, 50993, 37049, 31873, 63734, 20519, 60054, 56536, 10522, 9993, 26251, 6670, 29489, 55030, 21274, 35043, 22594, 53706, 53025, 48222, 61634, 11824, 56872, 11961, 49429, 5278, 42732, 1694, 60917, 42453, 35358, 11190, 50806, 14436, 60259, 48334, 27912, 30476, 22356, 30275, 64323, 15761, 5775, 20238, 31157, 60450]], + "output": [[343, 1694, 2072, 2224, 2879, 3241, 3252, 3455, 3550, 4040, 4370, 5278, 5383, 5397, 5482, 5775, 6200, 6262, 6670, 6869, 7071, 7769, 7972, 8171, 8172, 9624, 9647, 9993, 10084, 10522, 11152, 11174, 11190, 11824, 11961, 12096, 12160, 12584, 12693, 13063, 13162, 13367, 13832, 14009, 14108, 14317, 14334, 14436, 14680, 14965, 15302, 15330, 15356, 15494, 15691, 15761, 16398, 16991, 17050, 17298, 17405, 17709, 17838, 17849, 18090, 18227, 18253, 19403, 19549, 19813, 20051, 20070, 20158, 20238, 20519, 21232, 21274, 21634, 21689, 21976, 22076, 22191, 22299, 22356, 22444, 22454, 22594, 22920, 22975, 23001, 23172, 23407, 23417, 23426, 23469, 23570, 23994, 24093, 24689, 25099, 25286, 25393, 25452, 25465, 25467, 25482, 25625, 26071, 26211, 26251, 26308, 26380, 27063, 27912, 28161, 28298, 28319, 28853, 29405, 29489, 29649, 29845, 29961, 30065, 30089, 30150, 30275, 30322, 30371, 30476, 30743, 30745, 31097, 31157, 31241, 31873, 31891, 31967, 31984, 33071, 33109, 33116, 33221, 33372, 33477, 33698, 33708, 33905, 34086, 34237, 34580, 34623, 35043, 35163, 35202, 35251, 35358, 35398, 35572, 36046, 36348, 36356, 36484, 36683, 36881, 37049, 37056, 37171, 37219, 37281, 37582, 37989, 38074, 38286, 38580, 38658, 39091, 39206, 39392, 39604, 40030, 40355, 41032, 41280, 41667, 41848, 42177, 42229, 42453, 42598, 42732, 42809, 42895, 43284, 44094, 44121, 44361, 44530, 44574, 45642, 45990, 46599, 47037, 47329, 47331, 47337, 47605, 47770, 48167, 48222, 48334, 48421, 48731, 49429, 49749, 49930, 50092, 50533, 50749, 50806, 50993, 51033, 51110, 51282, 51933, 52222, 52224, 52858, 52956, 53025, 53311, 53706, 53921, 53969, 54551, 54574, 54634, 54851, 54968, 55030, 55078, 55081, 55118, 55152, 55286, 55855, 56331, 56336, 56536, 56872, 56934, 56940, 57120, 57351, 57356, 57552, 57933, 58404, 58430, 58470, 58644, 58726, 58922, 59070, 59170, 59331, 59491, 59589, 59693, 59713, 60054, 60259, 60292, 60319, 60450, 60841, 60917, 61115, 61537, 61634, 62192, 62214, 62301, 62435, 62817, 62963, 63193, 63336, 63734, 63847, 63857, 64161, 64314, 64323, 64786, 64909, 65222, 65346, 65392, 65401]] }, { - "gas": 100000, - "input": [[42, 5, 15, 42, 0, 17]], - "output": [[0, 5, 15, 17, 42, 42]] + "gas": 4000000, + "input": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]], + "output": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]] }, { - "gas": 1000000, - "input": [[16, 197, 88, 203, 110, 1, 18, 71, 110, 132, 166, 155, 110, 244, 15, 153, 111, 29, 8, 88, 147, 88, 35, 65, 256, 209, 250, 106, 223, 135, 156, 57, 178, 2, 165, 213, 201, 35, 238, 42, 72, 180, 116, 218, 20, 211, 243, 26, 253, 255, 3, 193, 240, 30, 186, 56, 89, 158, 234, 30, 21, 92, 98, 9, 32, 190, 25, 190, 241, 63, 243, 138, 182, 172, 18, 214, 19, 147, 168, 210, 132, 190, 218, 117, 68, 122, 35, 161, 181, 238, 179, 78, 177, 71, 56, 72, 196, 1, 114, 9]], - "output": [[1, 1, 2, 3, 8, 9, 9, 15, 16, 18, 18, 19, 20, 21, 25, 26, 29, 30, 30, 32, 35, 35, 35, 42, 56, 56, 57, 63, 65, 68, 71, 71, 72, 72, 78, 88, 88, 88, 89, 92, 98, 106, 110, 110, 110, 111, 114, 116, 117, 122, 132, 132, 135, 138, 147, 147, 153, 155, 156, 158, 161, 165, 166, 168, 172, 177, 178, 179, 180, 181, 182, 186, 190, 190, 190, 193, 196, 197, 201, 203, 209, 210, 211, 213, 214, 218, 218, 223, 234, 238, 238, 240, 241, 243, 243, 244, 250, 253, 255, 256]] + "gas": 3000000, + "input": [[127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]], + "output": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127]] } ] } diff --git a/data/Unique.json b/data/Unique.json index f8d8f7e..8791c88 100644 --- a/data/Unique.json +++ b/data/Unique.json @@ -5,13 +5,38 @@ "vectors": [ { "gas": 100000, - "input": [[1, 1, 2, 3, 4]], - "output": [[1, 2, 3, 4]] + "input": [[]], + "output": [[]] }, { "gas": 100000, - "input": [[5, 1, 3, 5, 1, 5]], - "output": [[5, 1, 3]] + "input": [[7]], + "output": [[7]] + }, + { + "gas": 1000000, + "input": [[0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1]], + "output": [[0, 1]] + }, + { + "gas": 1000000, + "input": [[1, 7, 7, 8, 4, 1, 2, 1, 8, 2, 4, 10, 0, 3, 2, 1, 8, 9, 6, 0, 1, 9, 9, 1, 9, 5, 6, 3, 4, 9, 0, 8, 7, 3, 4, 0, 10, 8, 10, 7, 5, 3, 9, 8, 10, 1, 0, 3, 0, 0, 7, 8, 4, 6, 2, 0, 4, 9, 1, 1, 2, 9, 8, 9, 1, 3, 10, 9, 1, 8, 5, 3, 1, 4, 6, 3, 2, 9, 10, 4, 10, 3, 4, 2, 3, 5, 0, 2, 3, 1, 5, 9, 9, 10, 3, 5, 8, 10, 1, 5, 4, 0, 8, 10, 0, 7, 2, 3, 1, 4, 5, 5, 6, 7, 2, 6, 2, 7, 1, 9, 4, 5, 3, 2, 4, 9, 3, 8, 9, 3, 6, 8, 7, 5, 6, 2, 5, 8, 3, 1, 7, 9, 8, 2, 6, 0, 8, 4, 3, 8, 10, 6, 7, 4, 6, 6, 6, 2, 7, 10, 9, 8, 8, 3, 6, 4, 9, 0, 9, 2, 8, 4, 8, 0, 7, 5, 6, 4, 2, 5, 7, 3, 1, 10, 2, 9, 1, 10, 2, 4, 2, 1, 1, 5, 3, 8, 1, 1, 9, 2, 5, 9, 3, 3, 7, 8, 7, 0, 10, 5, 0, 10, 1, 1, 3, 8, 8, 3, 3, 9, 7, 5, 7, 8, 9, 5, 0, 3, 0, 9, 5, 1, 10, 5, 7, 8, 8, 2, 1, 3, 0, 10, 7, 1, 5, 7, 9, 2, 8, 4, 3, 9, 4, 1, 4, 3]], + "output": [[1, 7, 8, 4, 2, 10, 0, 3, 9, 6, 5]] + }, + { + "gas": 5000000, + "input": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]], + "output": [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]] + }, + { + "gas": 1000000, + "input": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + "output": [[1]] + }, + { + "gas": 1000000, + "input": [[2637247833, 877743251, 209692859, 1293283540, 2440110609, 2529869825, 831836708, 3444688935, 2458134910, 2903343198, 274316355, 2321765972, 2278863911, 1810166378, 2374455075, 731513777, 2898409286, 4097825859, 1259402789, 3263232751, 678840525, 2039456958, 2869131234, 2059737611, 74002340, 3467056401, 2274487945, 375603017, 1139236568, 1438726890, 747634706, 3383405601, 1926749286, 2321407811, 814044042, 1152514529, 353015166, 998842806, 1873864071, 3689011439, 2352343408, 2104457113, 841310424, 3464147682, 3383264448, 2507330667, 2949910911, 1118079467, 3612893132, 111863391, 2072617955, 1007297632, 4094781665, 17980781, 3159482341, 82382249, 1501896686, 3604375622, 3743030098, 1415511530, 3236118966, 758385377, 1824732723, 3144891537]], + "output": [[2637247833, 877743251, 209692859, 1293283540, 2440110609, 2529869825, 831836708, 3444688935, 2458134910, 2903343198, 274316355, 2321765972, 2278863911, 1810166378, 2374455075, 731513777, 2898409286, 4097825859, 1259402789, 3263232751, 678840525, 2039456958, 2869131234, 2059737611, 74002340, 3467056401, 2274487945, 375603017, 1139236568, 1438726890, 747634706, 3383405601, 1926749286, 2321407811, 814044042, 1152514529, 353015166, 998842806, 1873864071, 3689011439, 2352343408, 2104457113, 841310424, 3464147682, 3383264448, 2507330667, 2949910911, 1118079467, 3612893132, 111863391, 2072617955, 1007297632, 4094781665, 17980781, 3159482341, 82382249, 1501896686, 3604375622, 3743030098, 1415511530, 3236118966, 758385377, 1824732723, 3144891537]] } ] } From 3fb38375eac3fe2dcb95de41158b0674557ecfae Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 23 May 2018 16:22:50 +0100 Subject: [PATCH 2/4] Update competition dates --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34d7482..c1162f4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 1st Solidity Gas Golfing Contest -The Solidity Gas Golfing Contest is a competition for Solidity coders to produce the most gas-efficient code they can for a series of straightforward challenges. The 1st SGGC will run from 25 May to 25 June 2018. +The Solidity Gas Golfing Contest is a competition for Solidity coders to produce the most gas-efficient code they can for a series of straightforward challenges. The 1st SGGC will run from 23 May to 31 June 2018. For more details, and entry instructions, see the competition site at [g.solidity.cc](http://g.solidity.cc/). From d5e477eda6a77673fc76ca7dc77bd7e1824e8f0c Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 23 May 2018 17:25:32 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1162f4..15dda8f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 1st Solidity Gas Golfing Contest -The Solidity Gas Golfing Contest is a competition for Solidity coders to produce the most gas-efficient code they can for a series of straightforward challenges. The 1st SGGC will run from 23 May to 31 June 2018. +The Solidity Gas Golfing Contest is a competition for Solidity coders to produce the most gas-efficient code they can for a series of straightforward challenges. The 1st SGGC will run from 23 May to 30 June 2018. For more details, and entry instructions, see the competition site at [g.solidity.cc](http://g.solidity.cc/). From 2fa13fbb1a92939d97621d554d97c87e658a836b Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Thu, 24 May 2018 02:20:33 +0200 Subject: [PATCH 4/4] Update Sort.json --- data/Sort.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/Sort.json b/data/Sort.json index bef67ae..3152f23 100644 --- a/data/Sort.json +++ b/data/Sort.json @@ -9,7 +9,7 @@ "output": [[]] }, { - "gas": 1000000, + "gas": 4000000, "input": [[22975, 27063, 50533, 49930, 41280, 55286, 17298, 62963, 60841, 31097, 55118, 5397, 41032, 31241, 36348, 7071, 24093, 51933, 41848, 47331, 17838, 25625, 59589, 30089, 26308, 55152, 14334, 51033, 54634, 19403, 9624, 56336, 15494, 48731, 33372, 25099, 65401, 58726, 54551, 23407, 53969, 15356, 3550, 33221, 19549, 3252, 59331, 21689, 6262, 42177, 28319, 25465, 31891, 56934, 52858, 20051, 38580, 63336, 61115, 62214, 22299, 46599, 22191, 14009, 2879, 16398, 63193, 40030, 36356, 44361, 55078, 34580, 35163, 5383, 61537, 59713, 62817, 57120, 58922, 55855, 45642, 12693, 45990, 42895, 52956, 54968, 65346, 35398, 33698, 25452, 30745, 57356, 2072, 29649, 14108, 56331, 30371, 16991, 26211, 37171, 59491, 25467, 58470, 48421, 23417, 20070, 59070, 59170, 33109, 38074, 26380, 39091, 36683, 31967, 23426, 39392, 13162, 36484, 39604, 47337, 343, 38658, 30150, 17050, 33477, 20158, 14317, 64909, 25286, 12584, 65222, 60292, 30743, 30322, 14965, 58644, 41667, 19813, 17709, 44574, 64161, 49749, 9647, 62192, 28853, 26071, 5482, 35572, 47770, 10084, 22076, 2224, 25482, 57552, 7769, 36881, 50749, 23570, 40355, 54851, 29845, 12160, 8172, 33071, 13832, 35251, 29961, 14680, 34237, 47329, 42229, 37281, 43284, 17849, 51110, 53921, 37056, 35202, 3241, 37989, 42598, 64314, 37582, 33905, 36046, 8171, 63857, 54574, 7972, 50092, 47605, 53311, 23994, 23001, 24689, 22444, 11174, 15330, 29405, 4370, 22920, 34623, 33116, 47037, 39206, 30065, 22454, 33708, 63847, 57351, 58430, 13063, 57933, 55081, 11152, 42809, 6869, 31984, 23469, 38286, 34086, 58404, 51282, 17405, 28298, 48167, 21976, 6200, 64786, 28161, 15691, 37219, 3455, 44094, 62435, 18253, 56940, 44530, 52222, 52224, 44121, 62301, 23172, 60319, 59693, 12096, 13367, 15302, 18227, 25393, 4040, 18090, 65392, 21634, 21232, 50993, 37049, 31873, 63734, 20519, 60054, 56536, 10522, 9993, 26251, 6670, 29489, 55030, 21274, 35043, 22594, 53706, 53025, 48222, 61634, 11824, 56872, 11961, 49429, 5278, 42732, 1694, 60917, 42453, 35358, 11190, 50806, 14436, 60259, 48334, 27912, 30476, 22356, 30275, 64323, 15761, 5775, 20238, 31157, 60450]], "output": [[343, 1694, 2072, 2224, 2879, 3241, 3252, 3455, 3550, 4040, 4370, 5278, 5383, 5397, 5482, 5775, 6200, 6262, 6670, 6869, 7071, 7769, 7972, 8171, 8172, 9624, 9647, 9993, 10084, 10522, 11152, 11174, 11190, 11824, 11961, 12096, 12160, 12584, 12693, 13063, 13162, 13367, 13832, 14009, 14108, 14317, 14334, 14436, 14680, 14965, 15302, 15330, 15356, 15494, 15691, 15761, 16398, 16991, 17050, 17298, 17405, 17709, 17838, 17849, 18090, 18227, 18253, 19403, 19549, 19813, 20051, 20070, 20158, 20238, 20519, 21232, 21274, 21634, 21689, 21976, 22076, 22191, 22299, 22356, 22444, 22454, 22594, 22920, 22975, 23001, 23172, 23407, 23417, 23426, 23469, 23570, 23994, 24093, 24689, 25099, 25286, 25393, 25452, 25465, 25467, 25482, 25625, 26071, 26211, 26251, 26308, 26380, 27063, 27912, 28161, 28298, 28319, 28853, 29405, 29489, 29649, 29845, 29961, 30065, 30089, 30150, 30275, 30322, 30371, 30476, 30743, 30745, 31097, 31157, 31241, 31873, 31891, 31967, 31984, 33071, 33109, 33116, 33221, 33372, 33477, 33698, 33708, 33905, 34086, 34237, 34580, 34623, 35043, 35163, 35202, 35251, 35358, 35398, 35572, 36046, 36348, 36356, 36484, 36683, 36881, 37049, 37056, 37171, 37219, 37281, 37582, 37989, 38074, 38286, 38580, 38658, 39091, 39206, 39392, 39604, 40030, 40355, 41032, 41280, 41667, 41848, 42177, 42229, 42453, 42598, 42732, 42809, 42895, 43284, 44094, 44121, 44361, 44530, 44574, 45642, 45990, 46599, 47037, 47329, 47331, 47337, 47605, 47770, 48167, 48222, 48334, 48421, 48731, 49429, 49749, 49930, 50092, 50533, 50749, 50806, 50993, 51033, 51110, 51282, 51933, 52222, 52224, 52858, 52956, 53025, 53311, 53706, 53921, 53969, 54551, 54574, 54634, 54851, 54968, 55030, 55078, 55081, 55118, 55152, 55286, 55855, 56331, 56336, 56536, 56872, 56934, 56940, 57120, 57351, 57356, 57552, 57933, 58404, 58430, 58470, 58644, 58726, 58922, 59070, 59170, 59331, 59491, 59589, 59693, 59713, 60054, 60259, 60292, 60319, 60450, 60841, 60917, 61115, 61537, 61634, 62192, 62214, 62301, 62435, 62817, 62963, 63193, 63336, 63734, 63847, 63857, 64161, 64314, 64323, 64786, 64909, 65222, 65346, 65392, 65401]] },