Language: C++

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import sys
import csv
import argparse
import time
import heapq

INF = sys.maxint/3

class Edge:
    def __init__(self, to, cap, cost, rev):
        self.to = to
        self.cap = cap
        self.cost = cost
        self.rev = rev

    def print_attributes(self):
        print "to: {0}, cap: {1}, cost: {2}, rev: {3}".format(self.to, self.cap, self.cost, self.rev)

class MinimumCostFlow:

    def __init__(self, V, E):
        self.V = V
        self.E = E
        self.G = [[] for i in range(V)]

    def add_edge(self, s, t, cap, cost):
        forward_edge = Edge(t, cap, cost, len(self.G[t]))
        self.G[s].append(forward_edge)
        backward_edge = Edge(s, 0, -cost, len(self.G[s])-1)
        self.G[t].append(backward_edge)

    def print_edges(self):
        print "==== print edges ===="
        for i in range(self.V):
            print "\nedges from {}".format(i)
            for e in self.G[i]:
                e.print_attributes()

    def minimum_cost_flow(self, s, t, f):
        res = 0
        h = [0] * self.V

        while f>0:
            pque = []
            dist = [INF for i in range(self.V)]
            prev_v = [0 for i in range(self.V)]
            prev_e = [0 for i in range(self.V)]

            dist[s] = 0
            heapq.heappush(pque, (0, s))
            while(len(pque)!=0):
                p = heapq.heappop(pque)
                v = p[1]
                if (dist[v] < p[0]):
                    continue
                for i in range(len(self.G[v])):
                    e = self.G[v][i]
                    if (e.cap>0 and dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]):
                        dist[e.to] = dist[v] + e.cost + h[v] - h[e.to]
                        prev_v[e.to] = v
                        prev_e[e.to] = i
                        heapq.heappush(pque, (dist[e.to], e.to))

            if dist[t] == INF:
                return -1

            for v in range(self.V):
                h[v] += dist[v]

            d = f

            v = t
            while v!=s:
                d = min(d, self.G[prev_v[v]][prev_e[v]].cap)
                v = prev_v[v]

            f -= d
            res += d * h[t]

            v = t
            while v!=s:
                e = self.G[prev_v[v]][prev_e[v]]
                e.cap -= d
                self.G[v][e.rev].cap += d
                v = prev_v[v]

        return res

def main():
    V, E, F = map(int, raw_input().split())
    mcf = MinimumCostFlow(V, E)
    for i in range(E):
        u, v, c, d = map(int, raw_input().split())
        mcf.add_edge(u, v, c, d)

    #print "minimum cost flow: {}".format(mcf.minimum_cost_flow(0, V-1, F))
    print mcf.minimum_cost_flow(0, V-1, F)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:100:6: error: invalid preprocessing directive #print
  100 |     #print "minimum cost flow: {}".format(mcf.minimum_cost_flow(0, V-1, F))
      |      ^~~~~
a.cc:103:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
  103 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'