#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 = 9; Run runInput=FILE2; void doStuff2(){ while(true){ //lines is accessible as a global. std::vector>numbers; int increasingNumb=0; int prevNumb=0; bool increasingAllSame=true; bool increasingNumberSet=false; long long sum=0; for(std::string&line:lines){ numbers.clear(); numbers.push_back({}); while(line.length()>0){ size_t spacePos=line.find(' '); int numb; if(spacePos==std::string::npos){ numb=std::stoi(line); line=""; }else{ numb=std::stoi(line.substr(0,spacePos)); line=line.substr(spacePos+1); } numbers.back().push_back(numb); if(numbers.back().size()>=2){ if(!increasingNumberSet){ increasingNumberSet=true; }else{ if(increasingAllSame){ if(numb-prevNumb!=increasingNumb){ increasingAllSame=false; } } } increasingNumb=numb-prevNumb; } prevNumb=numb; } while(true){ if(increasingAllSame){ bool previousNumberSet=false; if(numbers.size()==1){ sum+=numbers.back().front()-increasingNumb; }else{ for(int i=numbers.size()-1;i>=0;i--){ std::vector&numList=numbers[i]; if(!previousNumberSet){ previousNumberSet=true; prevNumb=numList.front(); }else{ prevNumb=numList.front()-prevNumb; } } sum+=prevNumb; } std::cout<>numbers; int increasingNumb=0; int prevNumb=0; bool increasingAllSame=true; bool increasingNumberSet=false; long long sum=0; for(std::string&line:lines){ numbers.clear(); numbers.push_back({}); while(line.length()>0){ size_t spacePos=line.find(' '); int numb; if(spacePos==std::string::npos){ numb=std::stoi(line); line=""; }else{ numb=std::stoi(line.substr(0,spacePos)); line=line.substr(spacePos+1); } numbers.back().push_back(numb); if(numbers.back().size()>=2){ if(!increasingNumberSet){ increasingNumberSet=true; }else{ if(increasingAllSame){ if(numb-prevNumb!=increasingNumb){ increasingAllSame=false; } } } increasingNumb=numb-prevNumb; } prevNumb=numb; } while(true){ if(increasingAllSame){ bool previousNumberSet=false; if(numbers.size()==1){ sum+=numbers.back().back()+increasingNumb; }else{ for(int i=numbers.size()-1;i>=0;i--){ std::vector&numList=numbers[i]; if(!previousNumberSet){ previousNumberSet=true; prevNumb=numList.back(); }else{ prevNumb=prevNumb+numList.back(); } } sum+=prevNumb; } std::cout<