Posts

Showing posts from January, 2024

Competitive coding

#include <iostream> #include <map> #include <vector> #include <filesystem> #include <fstream> #include <string> using namespace std; namespace fs = std::filesystem; std::string readFile(fs::path path) {     // Open the stream to 'lock' the file.     std::ifstream f(path, std::ios::in | std::ios::binary);     // Obtain the size of the file.     const auto sz = fs::file_size(path);     // Create a buffer.     std::string result(sz, '\0');     // Read the whole file into the buffer.     f.read(result.data(), sz);     return result; } int main() {      string line_str;      fs::path p = "extents.txt";        string result = readFile(p);      stringstream X(result);      std::multimap<long long,long long> m;      int i=0;      while(getline(X,line_s...

std::regex

 #include <regex> if(std::regex_match(uriPath, std::regex( "blogger.com/blog/post/[A-Za-z0-9]{32}"))) {