criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.*;

public class Main {

  class MaxFlow {
        class Edge {
            public final int to, rev;
            public long cap;
 
            public Edge(int to, int rev, long cap) {
                this.to = to;
                this.rev = rev;
                this.cap = cap;
            }
        }
 
        int v;
        List<Edge> G[];
        boolean used[];
 
        public MaxFlow(int v) {
            this.v = v;
            G = new List[v];
            for (int i = 0; i < v; ++i) {
                G[i] = new ArrayList<>();
            }
            used = new boolean[v];
        }
 
        public void add_edge(int from, int to, long cap) {
            G[from].add(new Edge(to, G[to].size(), cap));
            G[to].add(new Edge(from, G[from].size() - 1, 0));
        }
 
        long dfs(int v, int t, long f) {
            if (v == t) return f;
            used[v] = true;
            for (Edge e : G[v]) {
                if (!used[e.to] && e.cap > 0) {
                    long d = dfs(e.to, t, Math.min(f, e.cap));
                    if (d > 0) {
                        e.cap -= d;
                        G[e.to].get(e.rev).cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
 
        public long max_flow(int s, int t) {
            long flow = 0;
            while (true) {
                Arrays.fill(used, false);
                long f = dfs(s, t, Long.MAX_VALUE);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }

    public long solve(int n, long[] a) {
      MaxFlow flow = new MaxFlow(n + 2);
      long ans = 0;
      for(int i = 0; i < n; i++) {
        a[i] = sc.nextLong();
        if(a[i] > 0) ans += a[i];
      }

      for(int i = 0; i < n; i++) {
        if(a[i] > 0) flow.add_edge(i, n + 1, (int)a[i]);
        if(a[i] <= 0) flow.add_edge(n, i, (-1) * (int)a[i]);
      }
      for(int i = 0; i < n; i++) {
        for(int j = 1; (i + 1) * j <= n; j++) {
          flow.add_edge(i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
        }
      }
      return ans - flow.max_flow(n, n + 1);
    }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long a[] = new long[N];
    long ans = 0;
    for(int i = 0; i < N; i++) {
      a[i] = sc.nextLong();
      if(a[i] > 0) ans += a[i];
    }

    long ans = solve(N, a);

    System.out.println(ans);
  }
}

Compiler output:
Main.java:66: error: cannot find symbol
        a[i] = sc.nextLong();
               ^
  symbol:   variable sc
  location: class Main
Main.java:92: error: variable ans is already defined in method main(String[])
    long ans = solve(N, a);
         ^
Main.java:92: error: non-static method solve(int,long[]) cannot be referenced from a static context
    long ans = solve(N, a);
               ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Language: Java

import java.util.*;

public class Main {

  class MaxFlow {
        class Edge {
            public final int to, rev;
            public long cap;
 
            public Edge(int to, int rev, long cap) {
                this.to = to;
                this.rev = rev;
                this.cap = cap;
            }
        }
 
        int v;
        List<Edge> G[];
        boolean used[];
 
        public MaxFlow(int v) {
            this.v = v;
            G = new List[v];
            for (int i = 0; i < v; ++i) {
                G[i] = new ArrayList<>();
            }
            used = new boolean[v];
        }
 
        public void add_edge(int from, int to, long cap) {
            G[from].add(new Edge(to, G[to].size(), cap));
            G[to].add(new Edge(from, G[from].size() - 1, 0));
        }
 
        long dfs(int v, int t, long f) {
            if (v == t) return f;
            used[v] = true;
            for (Edge e : G[v]) {
                if (!used[e.to] && e.cap > 0) {
                    long d = dfs(e.to, t, Math.min(f, e.cap));
                    if (d > 0) {
                        e.cap -= d;
                        G[e.to].get(e.rev).cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
 
        public long max_flow(int s, int t) {
            long flow = 0;
            while (true) {
                Arrays.fill(used, false);
                long f = dfs(s, t, Long.MAX_VALUE);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  MaxFlow flow = new MaxFlow(N + 2);
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) flow.add_edge(i, N + 1, (int)a[i]);
      if(a[i] <= 0) flow.add_edge(N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      flow.add_edge(i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - flow.max_flow(N, N + 1));
  }
}

Compiler output:
Main.java:65: error: non-static variable this cannot be referenced from a static context
  MaxFlow flow = new MaxFlow(N + 2);
                 ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;

public class Main {

  class MaxFlow {
        class Edge {
            public final int to, rev;
            public long cap;
 
            public Edge(int to, int rev, long cap) {
                this.to = to;
                this.rev = rev;
                this.cap = cap;
            }
        }
 
        int v;
        List<Edge> G[];
        boolean used[];
 
        public MaxFlow(int v) {
            this.v = v;
            G = new List[v];
            for (int i = 0; i < v; ++i) {
                G[i] = new ArrayList<>();
            }
            used = new boolean[v];
        }
 
        public void add_edge(int from, int to, long cap) {
            G[from].add(new Edge(to, G[to].size(), cap));
            G[to].add(new Edge(from, G[from].size() - 1, 0));
        }
 
        long dfs(int v, int t, long f) {
            if (v == t) return f;
            used[v] = true;
            for (Edge e : G[v]) {
                if (!used[e.to] && e.cap > 0) {
                    long d = dfs(e.to, t, Math.min(f, e.cap));
                    if (d > 0) {
                        e.cap -= d;
                        G[e.to].get(e.rev).cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
 
        public long max_flow(int s, int t) {
            long flow = 0;
            while (true) {
                Arrays.fill(used, false);
                long f = dfs(s, t, Long.MAX_VALUE);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  MaxFlow flow = new MaxFlow(n + 2);
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) flow.add_edge(i, N + 1, (int)a[i]);
      if(a[i] <= 0) flow.add_edge(N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      flow.add_edge(i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - flow.max_flow(N, N + 1));
  }
}

Compiler output:
Main.java:65: error: non-static variable this cannot be referenced from a static context
  MaxFlow flow = new MaxFlow(n + 2);
                 ^
Main.java:65: error: cannot find symbol
  MaxFlow flow = new MaxFlow(n + 2);
                             ^
  symbol:   variable n
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: Java

import java.util.*;

public class Main {

  class MaxFlow {
        class Edge {
            public final int to, rev;
            public long cap;
 
            public Edge(int to, int rev, long cap) {
                this.to = to;
                this.rev = rev;
                this.cap = cap;
            }
        }
 
        int v;
        List<Edge> G[];
        boolean used[];
 
        public MaxFlow(int v) {
            this.v = v;
            G = new List[v];
            for (int i = 0; i < v; ++i) {
                G[i] = new ArrayList<>();
            }
            used = new boolean[v];
        }
 
        public void add_edge(int from, int to, long cap) {
            G[from].add(new Edge(to, G[to].size(), cap));
            G[to].add(new Edge(from, G[from].size() - 1, 0));
        }
 
        long dfs(int v, int t, long f) {
            if (v == t) return f;
            used[v] = true;
            for (Edge e : G[v]) {
                if (!used[e.to] && e.cap > 0) {
                    long d = dfs(e.to, t, Math.min(f, e.cap));
                    if (d > 0) {
                        e.cap -= d;
                        G[e.to].get(e.rev).cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
 
        public long max_flow(int s, int t) {
            long flow = 0;
            while (true) {
                Arrays.fill(used, false);
                long f = dfs(s, t, Long.MAX_VALUE);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new ArrayList<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}


Compiler output:
Main.java:71: error: cannot find symbol
  List<Edge>[] G = new List[N + 2];
       ^
  symbol:   class Edge
  location: class Main
Main.java:73: error: cannot find symbol
    G[i] = new ArrayList<Edge>();
                         ^
  symbol:   class Edge
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: Java

import java.util.*;

public class Main {

  static class Edge {
    int t, rev;
    long cap;
    long f;

    public Edge(int t, int rev, long cap) {
      this.t = t;
      this.rev = rev;
      this.cap = cap;
    }
  }

  public static List<Edge>[] createGraph(int nodes) {
    List<Edge>[] graph = new List[nodes];
    for (int i = 0; i < nodes; i++)
      graph[i] = new ArrayList<>();
    return graph;
  }

  public static void addEdge(List<Edge>[] graph, int s, int t, long cap) {
    graph[s].add(new Edge(t, graph[t].size(), cap));
    graph[t].add(new Edge(s, graph[s].size() - 1, (long)0));
  }

  static boolean dinicBfs(List<Edge>[] graph, int src, int dest, int[] dist) {
    Arrays.fill(dist, -1);
    dist[src] = 0;
    int[] Q = new int[graph.length];
    int sizeQ = 0;
    Q[sizeQ++] = src;
    for (int i = 0; i < sizeQ; i++) {
      int u = Q[i];
      for (Edge e : graph[u]) {
        if (dist[e.t] < 0 && e.f < e.cap) {
          dist[e.t] = dist[u] + 1;
          Q[sizeQ++] = e.t;
        }
      }
    }
    return dist[dest] >= 0;
  }

  static long dinicDfs(List<Edge>[] graph, int[] ptr, int[] dist, int dest, int u, long f) {
    if (u == dest)
      return f;
    for (; ptr[u] < graph[u].size(); ++ptr[u]) {
      Edge e = graph[u].get(ptr[u]);
      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
        long df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
        if (df > 0) {
          e.f += df;
          graph[e.t].get(e.rev).f -= df;
          return df;
        }
      }
    }
    return 0;
  }

  public static int maxFlow(List<Edge>[] graph, int src, int dest) {
    int flow = 0;
    int[] dist = new int[graph.length];
    while (dinicBfs(graph, src, dest, dist)) {
      int[] ptr = new int[graph.length];
      while (true) {
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
        if (df == 0)
          break;
        flow += df;
      }
    }
    return flow;
  }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new ArrayList<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}

Compiler output:
Main.java:70: error: incompatible types: possible lossy conversion from long to int
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
                         ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;

public class Main {

  static class Edge {
    int t, rev;
    long cap;
    long f;

    public Edge(int t, int rev, long cap) {
      this.t = t;
      this.rev = rev;
      this.cap = cap;
    }
  }

  public static List<Edge>[] createGraph(int nodes) {
    List<Edge>[] graph = new List[nodes];
    for (int i = 0; i < nodes; i++)
      graph[i] = new ArrayList<>();
    return graph;
  }

  public static void addEdge(List<Edge>[] graph, int s, int t, long cap) {
    graph[s].add(new Edge(t, graph[t].size(), cap));
    graph[t].add(new Edge(s, graph[s].size() - 1, (long)0));
  }

  static boolean dinicBfs(List<Edge>[] graph, int src, int dest, int[] dist) {
    Arrays.fill(dist, -1);
    dist[src] = 0;
    int[] Q = new int[graph.length];
    int sizeQ = 0;
    Q[sizeQ++] = src;
    for (int i = 0; i < sizeQ; i++) {
      int u = Q[i];
      for (Edge e : graph[u]) {
        if (dist[e.t] < 0 && e.f < e.cap) {
          dist[e.t] = dist[u] + 1;
          Q[sizeQ++] = e.t;
        }
      }
    }
    return dist[dest] >= 0;
  }

  static long dinicDfs(List<Edge>[] graph, int[] ptr, int[] dist, int dest, int u, long f) {
    if (u == dest)
      return f;
    for (; ptr[u] < graph[u].size(); ++ptr[u]) {
      Edge e = graph[u].get(ptr[u]);
      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
        if (df > 0) {
          e.f += df;
          graph[e.t].get(e.rev).f -= df;
          return df;
        }
      }
    }
    return 0;
  }

  public static int maxFlow(List<Edge>[] graph, int src, int dest) {
    int flow = 0;
    int[] dist = new int[graph.length];
    while (dinicBfs(graph, src, dest, dist)) {
      int[] ptr = new int[graph.length];
      while (true) {
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
        if (df == 0)
          break;
        flow += df;
      }
    }
    return flow;
  }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new ArrayList<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}

Compiler output:
Main.java:53: error: incompatible types: possible lossy conversion from long to int
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
                         ^
Main.java:70: error: incompatible types: possible lossy conversion from long to int
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
                         ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: Java

import java.util.*;

public class Main {

  static class Edge {
    int t, rev, f;
    long cap;

    public Edge(int t, int rev, long cap) {
      this.t = t;
      this.rev = rev;
      this.cap = cap;
    }
  }

  public static List<Edge>[] createGraph(int nodes) {
    List<Edge>[] graph = new List[nodes];
    for (int i = 0; i < nodes; i++)
      graph[i] = new ArrayList<>();
    return graph;
  }

  public static void addEdge(List<Edge>[] graph, int s, int t, long cap) {
    graph[s].add(new Edge(t, graph[t].size(), cap));
    graph[t].add(new Edge(s, graph[s].size() - 1, (long)0));
  }

  static boolean dinicBfs(List<Edge>[] graph, int src, int dest, int[] dist) {
    Arrays.fill(dist, -1);
    dist[src] = 0;
    int[] Q = new int[graph.length];
    int sizeQ = 0;
    Q[sizeQ++] = src;
    for (int i = 0; i < sizeQ; i++) {
      int u = Q[i];
      for (Edge e : graph[u]) {
        if (dist[e.t] < 0 && e.f < e.cap) {
          dist[e.t] = dist[u] + 1;
          Q[sizeQ++] = e.t;
        }
      }
    }
    return dist[dest] >= 0;
  }

  static int dinicDfs(List<Edge>[] graph, int[] ptr, int[] dist, int dest, int u, int f) {
    if (u == dest)
      return f;
    for (; ptr[u] < graph[u].size(); ++ptr[u]) {
      Edge e = graph[u].get(ptr[u]);
      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
        if (df > 0) {
          e.f += df;
          graph[e.t].get(e.rev).f -= df;
          return df;
        }
      }
    }
    return 0;
  }

  public static int maxFlow(List<Edge>[] graph, int src, int dest) {
    int flow = 0;
    int[] dist = new int[graph.length];
    while (dinicBfs(graph, src, dest, dist)) {
      int[] ptr = new int[graph.length];
      while (true) {
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
        if (df == 0)
          break;
        flow += df;
      }
    }
    return flow;
  }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new ArrayList<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}

Compiler output:
Main.java:52: error: incompatible types: possible lossy conversion from long to int
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
                                                               ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.util.*;

public class Main {

  static class Edge {
    int t, rev, cap, f;

    public Edge(int t, int rev, int cap) {
      this.t = t;
      this.rev = rev;
      this.cap = cap;
    }
  }

  public static List<Edge>[] createGraph(int nodes) {
    List<Edge>[] graph = new List[nodes];
    for (int i = 0; i < nodes; i++)
      graph[i] = new ArrayList<>();
    return graph;
  }

  public static void addEdge(List<Edge>[] graph, int s, int t, int cap) {
    graph[s].add(new Edge(t, graph[t].size(), cap));
    graph[t].add(new Edge(s, graph[s].size() - 1, 0));
  }

  static boolean dinicBfs(List<Edge>[] graph, int src, int dest, int[] dist) {
    Arrays.fill(dist, -1);
    dist[src] = 0;
    int[] Q = new int[graph.length];
    int sizeQ = 0;
    Q[sizeQ++] = src;
    for (int i = 0; i < sizeQ; i++) {
      int u = Q[i];
      for (Edge e : graph[u]) {
        if (dist[e.t] < 0 && e.f < e.cap) {
          dist[e.t] = dist[u] + 1;
          Q[sizeQ++] = e.t;
        }
      }
    }
    return dist[dest] >= 0;
  }

  static int dinicDfs(List<Edge>[] graph, int[] ptr, int[] dist, int dest, int u, int f) {
    if (u == dest)
      return f;
    for (; ptr[u] < graph[u].size(); ++ptr[u]) {
      Edge e = graph[u].get(ptr[u]);
      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
        if (df > 0) {
          e.f += df;
          graph[e.t].get(e.rev).f -= df;
          return df;
        }
      }
    }
    return 0;
  }

  public static int maxFlow(List<Edge>[] graph, int src, int dest) {
    int flow = 0;
    int[] dist = new int[graph.length];
    while (dinicBfs(graph, src, dest, dist)) {
      int[] ptr = new int[graph.length];
      while (true) {
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
        if (df == 0)
          break;
        flow += df;
      }
    }
    return flow;
  }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new ArrayList<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}

Compiler output:
Main.java:97: error: incompatible types: possible lossy conversion from long to int
      addEdge(G, i, (i + 1) * j - 1, Long.MAX_VALUE / 2);
                                                    ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.util.*;

public class Main {

  static class Edge {
    int t, rev, cap, f;

    public Edge(int t, int rev, int cap) {
      this.t = t;
      this.rev = rev;
      this.cap = cap;
    }
  }

  public static List<Edge>[] createGraph(int nodes) {
    List<Edge>[] graph = new List[nodes];
    for (int i = 0; i < nodes; i++)
      graph[i] = new ArrayList<>();
    return graph;
  }

  public static void addEdge(List<Edge>[] graph, int s, int t, int cap) {
    graph[s].add(new Edge(t, graph[t].size(), cap));
    graph[t].add(new Edge(s, graph[s].size() - 1, 0));
  }

  static boolean dinicBfs(List<Edge>[] graph, int src, int dest, int[] dist) {
    Arrays.fill(dist, -1);
    dist[src] = 0;
    int[] Q = new int[graph.length];
    int sizeQ = 0;
    Q[sizeQ++] = src;
    for (int i = 0; i < sizeQ; i++) {
      int u = Q[i];
      for (Edge e : graph[u]) {
        if (dist[e.t] < 0 && e.f < e.cap) {
          dist[e.t] = dist[u] + 1;
          Q[sizeQ++] = e.t;
        }
      }
    }
    return dist[dest] >= 0;
  }

  static int dinicDfs(List<Edge>[] graph, int[] ptr, int[] dist, int dest, int u, int f) {
    if (u == dest)
      return f;
    for (; ptr[u] < graph[u].size(); ++ptr[u]) {
      Edge e = graph[u].get(ptr[u]);
      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
        int df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));
        if (df > 0) {
          e.f += df;
          graph[e.t].get(e.rev).f -= df;
          return df;
        }
      }
    }
    return 0;
  }

  public static int maxFlow(List<Edge>[] graph, int src, int dest) {
    int flow = 0;
    int[] dist = new int[graph.length];
    while (dinicBfs(graph, src, dest, dist)) {
      int[] ptr = new int[graph.length];
      while (true) {
        int df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);
        if (df == 0)
          break;
        flow += df;
      }
    }
    return flow;
  }

  public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  long a[] = new long[N];
  long ans = 0;
  for(int i = 0; i < N; i++) {
    a[i] = sc.nextLong();
    if(a[i] > 0) ans += a[i];
  }
  List<Edge>[] G = new List[N + 2];
  for(int i = 0; i < N + 2; i++) {
    G[i] = new List<Edge>();
  }

  for(int i = 0; i < N; i++) {
      if(a[i] > 0) addEdge(G, i, N + 1, (int)a[i]);
      if(a[i] <= 0) addEdge(G, N, i, (-1) * (int)a[i]);
    }
  for(int i = 0; i < N; i++) {
    for(int j = 1; (i + 1) * j <= N; j++) {
      addEdge(G, i, (i + 1) * j - 1, (int)Math.pow(10, 13));
    }
  }

  System.out.println(ans - (long)maxFlow(G, N, N + 1));
  }
}

Compiler output:
Main.java:88: error: List is abstract; cannot be instantiated
    G[i] = new List<Edge>();
           ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;

public class Main {
  static ArrayList<Edge>[] G;
  static int[] level;
  static int[] iter;
  static int N;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    long a[] = new long[N];
    long ans = 0;
    for(int i = 0; i < N; i++) {
      a[i] = sc.nextLong();
      if(a[i] > 0) ans += a[i];
    }
    G = new ArrayList[N + 2];
    level = new int[N + 2];
    iter = new int[N + 2];
    for(int i = 0; i < N; i++) {
      if(a[i] > 0) add_edge(i, N + 1, (int)a[i]);
      if(a[i] <= 0) add_edge(i, N, (-1) * (int)a[i]);
    }
    for(int i = 0; i < N; i++) {
      for(int j = 1; (i + 1) * j <= N; j++) {
        add_edge(i, (i + 1) * j - 1, (int)Math.pow(10, 13));
      }
    }
    System.out.println(ans - max_flow(N, N + 1));
  }

  public static void add_edge(int from, int to, int cap) {
   // G[from].add(new Edge(to, cap, G[to].size()));
   // G[to].add(new Edge(from, 0, G[from].size() - 1));
   G[from].add(new Edge());
  }

  public static void bfs(int s) {
    for(int i = 0; i < level.length; i++) {
      level[i] = -1;
    }
    LinkedList<Integer> queue = new LinkedList<Integer>();
    level[N] = 0;
    queue.add(N);
    while(queue.size() > 0) {
      int v = queue.poll();
      for(int i = 0; i < G[v].size(); i++) {
        Edge e = G[v].get(i);
        if(e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[v] + 1;
          queue.add(e.to);
        }
      }
    }
  }

  public static int dfs(int v, int t, int f) {
    if(v == t) return f;
    for(int i = iter[v]; i < G[v].size(); i++) {
      Edge e = G[v].get(i);
      if(e.cap > 0 && level[v] < level[e.to]) {
        int d = dfs(e.to, t, Math.min(f, e.cap));
        if(d > 0) {
          e.cap -= d;
          G[e.to].get(e.rev).cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  public static int max_flow(int s, int t) {
    int flow = 0;
    for(; ; ) {
      bfs(N);
      if(level[N + 1] < 0) return flow;
      for(int i = 0; i < iter.length; i++) {
        iter[i] = 0;
      }
      int f;
      while((f = dfs(N, N + 1, (int)Math.pow(10, 13))) > 0) {
        flow += f;
      }
    }
  }
}

class Edge {
  int to;
  int cap;
  int rev;

  public Edge(int to, int cap, int rev) {
    this.to = to;
    this.cap = cap;
    this.rev = rev;
  }
}


Compiler output:
Main.java:36: error: constructor Edge in class Edge cannot be applied to given types;
   G[from].add(new Edge());
               ^
  required: int,int,int
  found:    no arguments
  reason: actual and formal argument lists differ in length
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

#define int ll
#define int_ int

struct edge {
	int to; // 行き先
	int cap; // 容量
	int rev; // 逆辺
	edge() {}
	edge(int to, int cap, int rev) :to(to), cap(cap), rev(rev) {}
};

vector<vector<edge>> G; // グラフの隣接リスト表現
vector<int> used; // DFSですでに調べたらフラグ

				  // fromからtoへ向かう容量capの辺をグラフに追加する
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge(to, cap, G[to].size()));
	G[to].push_back(edge(from, 0, G[from].size() - 1));
}

// 増加パスをDFSで探す
int dfs(int v, int t, int f) {
	if (v == t) return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); i++) {
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

// sからtへの最大流を求める
int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		fill(used.begin(), used.end(), 0);
		int f = dfs(s, t, INF);
		if (f == 0) return flow;
		flow += f;
	}
}

int_ main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N; cin >> N;
	G.resize(N + 2); used.resize(N + 2);

	ll Sum = 0;
	for (int i = 1; i <= N;i++) {
		ll a; cin >> a;
		for (int j = 2 * i; j <= N; j += i) add_edge(i, j, INF);
		if (a > 0) {
			Sum += a;
			add_edge(i, N + 1, a);
		}
		else {
			add_edge(0, i, -a);
		}
	}
	cout << Sum - max_flow(0, N + 1) << endl;
	return 0;
}

Compiler output:
a.cc:9:13: error: '::main' must return 'int'
    9 | #define int ll
      |             ^~
a.cc:10:14: note: in expansion of macro 'int'
   10 | #define int_ int
      |              ^~~
a.cc:58:1: note: in expansion of macro 'int_'
   58 | int_ main(void) {
      | ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

#define int ll

struct edge {
	int to; // 行き先
	int cap; // 容量
	int rev; // 逆辺
	edge() {}
	edge(int to, int cap, int rev) :to(to), cap(cap), rev(rev) {}
};

vector<vector<edge>> G; // グラフの隣接リスト表現
vector<int> used; // DFSですでに調べたらフラグ

				  // fromからtoへ向かう容量capの辺をグラフに追加する
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge(to, cap, G[to].size()));
	G[to].push_back(edge(from, 0, G[from].size() - 1));
}

// 増加パスをDFSで探す
int dfs(int v, int t, int f) {
	if (v == t) return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); i++) {
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

// sからtへの最大流を求める
int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		fill(used.begin(), used.end(), 0);
		int f = dfs(s, t, INF);
		if (f == 0) return flow;
		flow += f;
	}
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N; cin >> N;
	G.resize(N + 2); used.resize(N + 2);

	ll Sum = 0;
	for (int i = 1; i <= N;i++) {
		ll a; cin >> a;
		for (int j = 2 * i; j <= N; j += i) add_edge(i, j, INF);
		if (a > 0) {
			Sum += a;
			add_edge(i, N + 1, a);
		}
		else {
			add_edge(0, i, -a);
		}
	}
	cout << Sum - max_flow(0, N + 1) << endl;
	return 0;
}

Compiler output:
a.cc:9:13: error: '::main' must return 'int'
    9 | #define int ll
      |             ^~
a.cc:57:1: note: in expansion of macro 'int'
   57 | int main(void) {
      | ^~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 107;

int A[MAXN];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n;
	LL ans = 0;
	cin >> n;
	FOR(i, 1, n + 1)
	{
		cin >> A[i];
		ans += A[i];
	}
	while (true)
	{
		int bi = 1;
		LL S[MAXN];
		memset(S, 0, 8 * MAXN);
		FOR(i, 1, n + 1)
			FOR(j, 1, n + 1)
			if (i % j == 0) S[j] += A[i];
		FOR(i, 1, n + 1)
			if (S[i] < S[bi])
				bi = i;
		if (S[bi] >= 0) break;
		ans -= S[bi];
		FOR(j, 1, n + 1)
			if (j % bi == 0) A[j] = 0;
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'memset' was not declared in this scope
   61 |                 memset(S, 0, 8 * MAXN);
      |                 ^~~~~~
a.cc:22:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   21 | #include <complex>
  +++ |+#include <cstring>
   22 | #include <stdio.h>
Language: C++

#include <bits/stdc++.h>
using namespace std;

int arr[111];
bool chk[111];

int main()
{
    srand(283749);
    int n;
    long long prv = 0;
    scanf("%d",&n);
    for(int i=1; i<=n; i++) {
        scanf("%d",&arr[i]);
        prv += arr[i];
    }
    s = prv;

    double T = 1.0, change = 0.99996, k = 0.6;
    for(int i=0; i<60000; i++) {
        int tmp = rand() % n + 1;
        chk[tmp] = !chk[tmp];

        long long now = 0;
        for(int j=1; j<=n; j++) {
            for(int k=1; k<=j; k++) {
                if(j%k == 0 && !chk[k]) {
                    now += arr[j];
                    break;
                }
            }
        }

        long long gap = prv - now;
        double p = exp((double)gap / (k * T));
        if(p > (double)(rand() % 100000) / 100000.0) prv = now;
        else chk[tmp] = !chk[tmp];

        T *= change;
    }
    printf("%lld", s - prv);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 's' was not declared in this scope
   17 |     s = prv;
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int arr[111];
bool chk[111];

int main()
{
    srand(283749);
    int n;
    scanf("%d",&n);
    long long s = prv;
    for(int i=1; i<=n; i++) {
        scanf("%d",&arr[i]);
        s += arr[i];
    }

  	long long prv = 0;
    double T = 1.0, change = 0.9996, k = 0.4;
    for(int i=0; i<50000; i++) {
        int tmp = rand() % n + 1;
        chk[tmp] = !chk[tmp];

        long long now = 0;
        for(int j=1; j<=n; j++) {
            for(int k=1; k<=j; k++) {
                if(j%k == 0 && !chk[k]) {
                    now += arr[j];
                    break;
                }
            }
        }

        long long gap = prv - now;
        double p = exp((double)gap / (k * T));
        if(p > (double)(rand() % 100000) / 100000.0) prv = now;
        else chk[tmp] = !chk[tmp];
        
        T *= change;
    }
    printf("%lld", s - prv);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'prv' was not declared in this scope
   12 |     long long s = prv;
      |                   ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;

long long dp[10001000];

int main() {
	int n;
	cin >> n;
	vector<int> a(n+1);
	ll ans = 0;	
	for(int i = 0; i < n; i++){
		cin >> a[i+1];
		if(i > 25) ans += a[i+1];
	}
	
	for(int i = n; i >= 26; i--) {
		ll k = a[i];
		int l = i*2;
		while(l <= n) {
			k += a[l];
			l += i;
		}
		//cout << i << " : " << k << endl;
		if(k < 0) {
			//cout << "break : " << i << endl;
			for(int j = i; j <= n; j += i) {
				ans -= a[j];
			}
		}
	}

	ll ans2 = 0;

	for(int i = 1; i < (1 << min(n, 25)); i++) {
		ll k = 0;
		for(int j = 0; (1 << j) <= i; j++) {
			if(i & (1<<j)) {
				y = 0;
				while(z = j; (1<<z) <=i; z++) {
					if(!(i & (1 << (j*2)))){
						y = 1;
					}
				}
				if(y) k += a[j+1];
			}
		}
		ans2 = max(ans2, k);
	}		
	cout << ans + ans2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:33: error: 'y' was not declared in this scope
   41 |                                 y = 0;
      |                                 ^
a.cc:42:39: error: 'z' was not declared in this scope
   42 |                                 while(z = j; (1<<z) <=i; z++) {
      |                                       ^
a.cc:42:44: error: expected ')' before ';' token
   42 |                                 while(z = j; (1<<z) <=i; z++) {
      |                                      ~     ^
      |                                            )
a.cc:42:50: error: 'z' was not declared in this scope
   42 |                                 while(z = j; (1<<z) <=i; z++) {
      |                                                  ^
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, P> PP;

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int n;
ll a[101];
ll sum[101];
bool used[101],flg[101];
ll x,ans;

vector<int> ve;

void dfs(int pos,int y) {
	if(pos>=ve.size()) {
		ans=max(ans,x-y);
		return;
	}
	dfs(pos+1,y);
	int i=ve[pos],k=0;
	if(flg[i]!=0) return;
	while (i<=n) {
		if(flg[i]==0) k+=a[i];
		flg[i]++;
		i+=ve[pos];
	}
	dfs(pos+1,y+k);
	i=ve[pos];
	while (i<=n) {
		flg[i]--;
		i+=ve[pos];
	}
	return;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	REP(i,101) used[i]=flg[i]=false;

	cin>>n;
	REP(i,n) {
		cin>>a[i+1];
		x+=a[i+1];
	}

	FOR(i,2,n+1) {
		int j=i;
		while (j<=n) {
			sum[i]+=a[j];
			j+=i;
		}
		if(sum[i]<0) {
			ve.pb(i);
		}
	}

	REP(i,101) flg[i]=false;
	ans=x;
	dfs(0,0);

	cout<<ans<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:39:22: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   39 |                 flg[i]++;
      |                 ~~~~~^
a.cc:45:22: error: use of an operand of type 'bool' in 'operator--' is forbidden
   45 |                 flg[i]--;
      |                 ~~~~~^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,int>;
ll N,a[101],c[101],ans;
vector<P> v;
pair<int,vector<int>> u[101];
int main(){
    cin>>N;
    for(int i{1};i<=N;++i)cin>>a[i];
    for(int i{1};i<=N;++i){
        u[i].first=i;
        for(int j{1};i*j<=N;++j)
            u[i].second.push_back(i*j);
    }
    using V=pair<int,vector<int>>;
    sort(u,u+N,[](V& a,V& b){return a.second.size()==b.second.size()?a.first>b.first:a.second.size()<b.second.size();});
    for(int i{};i<u.size();++i){
        int res{};
        for(auto& x:u[i].second)
            if(!c[x])res+=a[x];
        if(res<0)
            for(auto& x:u[i].second)
                c[x]=1;
    }
    for(int i{1};i<=N;++i)
        if(!c[i])ans+=a[i];
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: request for member 'size' in 'u', which is of non-class type 'std::pair<int, std::vector<int> > [101]'
   18 |     for(int i{};i<u.size();++i){
      |                     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,int>;
ll N,a[101],c[101],ans;
vector<P> v;
pair<int,vector<int>> u[101];
int main(){
    cin>>N;
    for(int i{1};i<=N;++i)cin>>a[i];
    for(int i{1};i<=N;++i){
        u[i].first=i;
        for(int j{1};i*j<=N;++j)
            u[i].second.push_back(i*j);
    }
    using V=pair<int,vector<int>>;
    sort(u.begin(),u.end(),[](V& a,V& b){return a.second.size()==b.second.size()?a.first>b.first:a.second.size()<b.second.size();});
    for(int i{};i<u.size();++i){
        int res{};
        for(auto& x:u[i].second)
            if(!c[x])res+=a[x];
        if(res<0)
            for(auto& x:u[i].second)
                c[x]=1;
    }
    for(int i{1};i<=N;++i)
        if(!c[i])ans+=a[i];
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: request for member 'begin' in 'u', which is of non-class type 'std::pair<int, std::vector<int> > [101]'
   17 |     sort(u.begin(),u.end(),[](V& a,V& b){return a.second.size()==b.second.size()?a.first>b.first:a.second.size()<b.second.size();});
      |            ^~~~~
a.cc:17:22: error: request for member 'end' in 'u', which is of non-class type 'std::pair<int, std::vector<int> > [101]'
   17 |     sort(u.begin(),u.end(),[](V& a,V& b){return a.second.size()==b.second.size()?a.first>b.first:a.second.size()<b.second.size();});
      |                      ^~~
a.cc:18:21: error: request for member 'size' in 'u', which is of non-class type 'std::pair<int, std::vector<int> > [101]'
   18 |     for(int i{};i<u.size();++i){
      |                     ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N;
    vector<int> a;
    int tmp;
    cin >> N;
    
    for (int i = 0; i < N; ++i)
    {
        cin >> tmp;
        a.push_back(tmp);
    }
    vector<long long> save = vector<long long>(N + 1, 0);
    for (int i = 1; i <= N + 1; ++i)
    {
        for (int j = 1; j <= N; ++j)
        {
            if ((j % i) != 0)
            {
                save[i - 1] += a[j - 1];
            }
        }
    }
    long long ret = LONG_LONG_MIN;
    for (int i = 0; i <= N; ++i)
    {
        ret = max(ret, save[i]);
    }
    
    cout << ret << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: 'LONG_LONG_MIN' was not declared in this scope
   29 |     long long ret = LONG_LONG_MIN;
      |                     ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll n, sum, a[101], b[101];
void div(int x){
  if(x==0)
    return;
  if(x==1){
    if(a[x]<0){
      sum-=a[x];
    }
    return;
  }
  int md=x/2+1;
  for(int i=md; i<=x; ++i){
    if(a[i]<0){
      sum-=a[i];
    }
    else{
      memset(b, 0ll, sizeof b);
//      cout<<i<<"::::"<<endl;
      for(int j=1; j=<i/2; ++j){
        if(i%j==0){
          ++b[j];
        }
//        cout<<"("<<j<<"="<<b[j]<<endl;
      }
      for(int j=i/2; j>=1; --j){
        for(int k=2; k*j<=i; ++k){
          b[j]-=b[k*j];
        }
//        cout<<"("<<j<<"="<<b[j]<<endl;
      }
      for(int j=1; j<=i; ++j){
        a[j]+=b[j]*a[i];
      }
    }
  }
  div(md-1);
}
//void pre(){
//  for(int i=2; i<=100; ++i){
//    bool l=0;
//    for(int j=2; j<i-1; ++j){
//      if(i%j==0)
//        l=1;
//    }
//    if(!l){
//      pr.push_back(i);
//    }
//  }
//}
int main(){
  while(cin>>n){
    sum=0;
    for(int i=1; i<=n; ++i){
      cin>>a[i];
//      a[i]=-1e9;
//      a[i]=-50+i;
      sum+=a[i];
    }
    div(n);
    cout<<sum<<endl;
  }
  return 0;
}




Compiler output:
a.cc: In function 'void div(int)':
a.cc:26:22: error: expected primary-expression before '<' token
   26 |       for(int j=1; j=<i/2; ++j){
      |                      ^
Language: C++

#include <algorithm>
#include <cstring>
#include <vector>
#include <iostream>
#include <complex>
#include <utility>
#include <queue>


using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
const int MAXN = 5000;

LL A[200] = {0};
LL isprime(LL N) {
  for (LL p = 2; p * p <= N; ++p) if(N%p == 0) return false;
  return true;
}
int main() {
  LL N;
  scanf("%lld", &N);
  LL td = min(N , 11ll), ans = -1e18;
  for (size_t i = 0; i < N; ++i) scanf("%lld", A + i + 1);
  for (int S = 0; S < (1 << td); ++S) {
    bitset<101> b(0);
    b.flip();
    for (int j = 0; j < td; ++j) {
      if ((S>>j)&1) for (int k = j + 1; k <= N; k += j + 1) b[k] = 0;
    }
    for (int j = td + 1; td <= N; ++td) {
      LL test = 0;
      if (isprime(j)) {
        for (LL k = j; k <= N; k += j) test += A[k];
        if (test <= 0) for (LL k = j; k <= N; k += j) b[k] = 0;
      }
    }
    LL cur = 0;
    for (int i = 0; i < N; ++i) cur += A[i + 1] * b[i + 1];
    ans = max(ans,cur);
  }
  printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'bitset' was not declared in this scope
   26 |     bitset<101> b(0);
      |     ^~~~~~
a.cc:8:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    7 | #include <queue>
  +++ |+#include <bitset>
    8 | 
a.cc:26:17: error: 'b' was not declared in this scope
   26 |     bitset<101> b(0);
      |                 ^
Language: C++

#include<iostream>	// 入出力
#include<stdio.h>	// prllf()が使える 小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか

using namespace std;

using ll = long long;

ll N;
vector<ll> a, used;


void solve(ll n)
{

	if (used[n] == 1||n>N) { return; }

	ll m1 = a[n], m2 = 0;//1全て 2部分


	for (ll i = 2; i*n <= N; ++i)
	{
		if (used[i*n] == 1)continue;

		m1 += a[i*n];

		if (a[i*n] < 0)
		{
			m2 += a[i*n];
		}
	}

	//cout << n << " " << m1 << " " << m2 << endl;
	//ll h;
	//cin >> h;

	if (m2 < m1)
	{
		for (ll i = 2; i*n <= N; ++i)
		{
			if (used[i*n] == 1)continue;

			if (a[i*n] < 0)
			{
				solve(i*n);
			}
		}
	}

	else
	{
		for (ll i = 1; i*n <= N; ++i)
		{
			used[i*n] = 1;
		}
	}

}


ll main()
{

	cin >> N;

	a = vector<ll>(N + 1);
	used = vector<ll>(N + 1, 0);

	for (ll i = 1; i <= N; ++i)
	{
		cin >> a[i];
	}

	solve(1);

	ll ans = 0;

	for(ll i=1;i<=N;++i)
	{
		if (used[i] == 0) { ans += a[i]; }
	}

	cout << ans << endl;

	return 0;

}


Compiler output:
a.cc:67:1: error: '::main' must return 'int'
   67 | ll main()
      | ^~