Skip to content

Instantly share code, notes, and snippets.

@thorstel
Last active January 23, 2021 10:05
Show Gist options
  • Save thorstel/7214930fd56690d877898b9fb2262cbd to your computer and use it in GitHub Desktop.
Save thorstel/7214930fd56690d877898b9fb2262cbd to your computer and use it in GitHub Desktop.
C++ Advent of Code template for pasting the input directly into source
// TODO URL
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
using ll = long long;
using namespace std;
void solve(istream& ins)
{
assert(ins.good());
}
////////////////////////////////////////////////////////////////////////
// SETUP STUFF //
////////////////////////////////////////////////////////////////////////
static const string sample_input =
R"""( )""";
static const string actual_input =
R"""( )""";
int main(int argc, const char *argv[])
{
if (argc > 1) {
ifstream ifs {argv[1]};
solve(ifs);
} else {
cout << "=== SAMPLE ===\n";
istringstream iss {sample_input};
solve(iss);
cout << "=== ACTUAL ===\n";
iss = istringstream {actual_input};
solve(iss);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment