#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 = 4; Run runInput=FILE2; void doStuff2(){ while(true){ //lines is accessible as a global. int sum=0; std::vectorscratchcards; int scratchcardIndex=0; for(std::string&line:lines){ if(scratchcards.size()<=scratchcardIndex){ scratchcards.push_back(1); }else{ scratchcards[scratchcardIndex]++; } sum++; std::vectorwinningNumbersList; size_t colonPos=line.find(':')+1; std::string winningNumbers=line.substr(colonPos,line.find('|')-colonPos-1); while(winningNumbers.length()>0){ std::string numb=winningNumbers.substr(0,3); int number=atoi(numb.c_str()); winningNumbersList.push_back(number); winningNumbers=winningNumbers.substr(3); } std::string pickedNumbers=line.substr(line.find('|')+1); int score=0; int winningIndex=scratchcardIndex+1; while(pickedNumbers.length()>0){ std::string numb=pickedNumbers.substr(0,3); int number=atoi(numb.c_str()); if(std::find(winningNumbersList.begin(),winningNumbersList.end(),number)!=winningNumbersList.end()){ for(int i=0;iwinningNumbersList; size_t colonPos=line.find(':')+1; std::string winningNumbers=line.substr(colonPos,line.find('|')-colonPos-1); while(winningNumbers.length()>0){ std::string numb=winningNumbers.substr(0,3); int number=atoi(numb.c_str()); winningNumbersList.push_back(number); winningNumbers=winningNumbers.substr(3); } std::string pickedNumbers=line.substr(line.find('|')+1); int score=0; while(pickedNumbers.length()>0){ std::string numb=pickedNumbers.substr(0,3); int number=atoi(numb.c_str()); if(std::find(winningNumbersList.begin(),winningNumbersList.end(),number)!=winningNumbersList.end()){ if(score==0)score=1;else score*=2; } pickedNumbers=pickedNumbers.substr(3); } sum+=score; } std::cout<