Skip to content

algo

Write 10 lines, get 100 lines of clean C++17

You know the problem. You know the algorithm. But you’re spending 20 minutes on priority_queue<pair<ll,int>, vector<pair<ll,int>>, greater<>> and for (int i = 0; i < n; i++) cin >> a[i].

algo handles the boilerplate so you can focus on the algorithm.

input:
n: int
a: [int][n]
sort(a)
println lower(a, 5)

Compiles to:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n; cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
cout << (int)(lower_bound(a.begin(), a.end(), 5) - a.begin());
cout << "\n";
return 0;
}

Built-in algorithms - dijkstra, BFS, segment trees, DSU, LCA, bipartite matching, and more. Call them as functions, get the struct emitted only with the methods you use.

g = wgraph(n, undirected=true)
d = g.dijkstra(0).dist

DP blocks - declare dimensions, base cases, and transitions. The compiler handles the loops and initialization.

dp[i: 0..n, w: 0..W] -> int, maximize:
base: dp[0][w] = 0
<- dp[i-1][w]
guard w >= weights[i]
<- dp[i-1][w - weights[i]] + values[i]

Pattern matching - destructure structs and tuples with guards.

match node:
case Node((a, b), w) where a + b == w:
answer = a * b
default:
answer = a + b + w

Clean output - no hidden runtime, no template boilerplate. The generated C++ is readable, debuggable, and submittable.