Fix logic
Clean up
Use dinic for max flow