#pragma region Hidden Setup Stuff #define OLC_PGE_APPLICATION #include "olcPixelGameEngine.h" using namespace olc; enum Run{ FILE1, FILE2 }; // Override base class with your custom functionality class AoC2023 : public olc::PixelGameEngine { std::vectorlines; bool waitForRender=false; void wait(int pauseMs=0){ waitForRender=true; while(waitForRender); std::this_thread::sleep_for(std::chrono::milliseconds(pauseMs)); } #pragma endregion const int DAY = 6; Run runInput=FILE2; std::vectortime; std::vectordistance; void doStuff2(){ while(true){ //lines is accessible as a global. bool firstLine=true; for(std::string&line:lines){ if(firstLine){//Time line. std::string data=line.substr(5); std::string numb=""; while(data.length()>0){ if(data[0]>='0'&&data[0]<='9'){ numb+=data[0]; } data=data.substr(1); } if(numb.length()>0){ time.push_back(std::stoll(numb)); numb=""; } firstLine=false; }else{//Distance line. std::string data=line.substr(9); std::string numb=""; while(data.length()>0){ if(data[0]>='0'&&data[0]<='9'){ numb+=data[0]; } data=data.substr(1); } if(numb.length()>0){ distance.push_back(std::stoll(numb)); numb=""; } } } long sum=0; for(int i=0;itargetDist){ wins++; } } if(sum==0){ sum=wins; }else{ sum*=wins; } } std::cout<0){ if(data[0]>='0'&&data[0]<='9'){ numb+=data[0]; }else if(numb.length()>0){ time.push_back(std::stoi(numb)); numb=""; } data=data.substr(1); } if(numb.length()>0){ time.push_back(std::stoi(numb)); numb=""; } firstLine=false; }else{//Distance line. std::string data=line.substr(9); std::string numb=""; while(data.length()>0){ if(data[0]>='0'&&data[0]<='9'){ numb+=data[0]; }else if(numb.length()>0){ distance.push_back(std::stoi(numb)); numb=""; } data=data.substr(1); } if(numb.length()>0){ distance.push_back(std::stoi(numb)); numb=""; } } } long sum=0; for(int i=0;itargetDist){ wins++; } } if(sum==0){ sum=wins; }else{ sum*=wins; } } std::cout<