No more manual code formatting!
Jul 22 2024
12:59 PM
12:59 PM
For c-like languages, that is :P
Anyway, I got tired of adding in hundreds of <span> elements anytime I wanted to put up pretty code on my posts, so I wrote this script. It works pretty well!
Example formatting of one of my various half-finished CSES solutions:
#include <iostream>
using LL = long long;
constexpr int M = 1e9 + 7;
int main(){ LL n; std::cin >> n;
LL res = 0;
for(LL f = 1; f <= n; ++f) res = (res + f * (n / f) % M) % M;
std::cout << res << '\n'; }
// note to self: sqrt algorithm - loop f -> sqrtn // and then process divisor count of f, n/f (if applic)
(pretty standard; style 4 op 3)
tags: starship-dev programming