Pretty ugly solution, relies on knowledge about the data. Works.
View benchstat.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ benchstat v3.txt v4_garman_bytes.txt | |
name old time/op new time/op delta | |
Answer-8 136ns ± 0% 23ns ± 0% -83.28% (p=0.016 n=4+5) | |
❯ benchstat v4_fugi.txt v4_garman_bytes.txt | |
name old time/op new time/op delta | |
Answer-8 37.8ns ± 0% 22.8ns ± 0% -39.66% (p=0.008 n=5+5) |
View simple.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int main(int argc, char** argv) { | |
printf("["); | |
char* cur = argv[1]; | |
int count = 1; | |
for (;*cur;++cur, ++count) { | |
if (cur[0] != cur[1]) { | |
printf("(\"%c\", %ld)%s", cur[0], count, cur[1] ? " ,": ""); |
View abs.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generated by SuperSlicer 2.3.55 on 2020-12-15 at 07:14:58 UTC | |
allow_empty_layers = 0 | |
avoid_crossing_not_first_layer = 1 | |
avoid_crossing_perimeters = 0 | |
bed_custom_model = | |
bed_custom_texture = | |
bed_shape = 0x0,250x0,250x210,0x210 | |
bed_temperature = 105 | |
before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n | |
between_objects_gcode = |
View Notes.MD
This is a disgusting solution, but it works. The speed challenge wants you to take up to 393 steps (on average), this takes 81
If you know anyone that wrote code like this for a real problem, don't hire them.
View main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace std; | |
#include <thread> | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <windows.h> | |
#include <conio.h> | |
enum class TypeOfSleep | |
{ |
View socket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TTV_ErrorCode ttv::Socket::Recv(uint8_t* buffer, size_t length, size_t& received, bool fillBuffer/*=false*/) | |
{ | |
auto state = mAsyncOpComplete->SuspendFor (0); | |
if (TTV_FAILED(state)) | |
{ | |
return state; | |
} | |
if ( state == TTV_EC_SUCCESS) |
View streamstats.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class values_t> | |
class DurationBasedStatsContainer | |
{ | |
public: | |
typedef std::list<std::pair<std::chrono::high_resolution_clock::time_point, typename values_t>> valueList_t; | |
typedef std::chrono::milliseconds freq_t; | |
DurationBasedStatsContainer(freq_t maxDuration); | |
void push(values_t&& value); |
View LoginView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef std::map<std::wstring, std::wstring> tokenMap_t; | |
inline tokenMap_t GetURLTokens(std::wstring input) | |
{ | |
tokenMap_t result; | |
auto tokenStartPos = input.find_first_of(L"?#"); | |
while (tokenStartPos != std::string::npos) | |
{ | |
tokenStartPos++; | |
auto tokenEndPos = input.find_first_of(L"=&", tokenStartPos); |
View LoginView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline std::vector<std::pair<std::wstring, std::wstring>> GetURLTokens(std::wstring input) | |
{ | |
std::vector<std::pair<std::wstring, std::wstring>> result; | |
auto tokenStartPos = input.find_first_of(L"?#"); | |
while (tokenStartPos != std::string::npos) | |
{ | |
tokenStartPos++; | |
auto tokenEndPos = input.find(L"=", tokenStartPos); | |
if (tokenEndPos != std::string::npos) | |
{ |
NewerOlder