criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<queue>
#include<cstdio>
#include<cstring>
#include<string>
#include <stdlib.h>
#include <time.h>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
int a[2005];
int main(){
    int n,x,y;
    cin1 1 1
1000000000>>n>>x>>y;
    int ans=0;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n==1)
        cout<<abs(a[n]-y)<<endl;
    else cout<<max(abs(y-a[n]),abs(y-a[n-1]));

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin1' was not declared in this scope
   15 |     cin1 1 1
      |     ^~~~
Language: Java

import java.util.Scanner
class Main
{
public static void main (String [] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int x=sc.nextInt();int y=sc.nextInt();
int []a=new int [n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int max=Math.abs(a[n-1]-y);
if(n!=1)
max=Math.max(max,Math.abs(a[n-1]-a[n-2]));
}
}

Compiler output:
Main.java:1: error: ';' expected
import java.util.Scanner
                        ^
1 error
Language: C++

#include <bits/stdc++.h>

using namespace std;

int a[2005];

int main()
{
	int N, a, b;
	scanf("%d%d%d", &N, &a, &b);
	for (int i = 0; i < N; ++i) {
		scanf("%d", a + i);
	}
	int ans = max(abs(a[N - 1] - b), abs(a[N - 1] - a[N - 2]));
	printf("%d\n", ans);
	return 0;	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: invalid types 'int[int]' for array subscript
   14 |         int ans = max(abs(a[N - 1] - b), abs(a[N - 1] - a[N - 2]));
      |                            ^
a.cc:14:47: error: invalid types 'int[int]' for array subscript
   14 |         int ans = max(abs(a[N - 1] - b), abs(a[N - 1] - a[N - 2]));
      |                                               ^
a.cc:14:58: error: invalid types 'int[int]' for array subscript
   14 |         int ans = max(abs(a[N - 1] - b), abs(a[N - 1] - a[N - 2]));
      |                                                          ^
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int  i, n, w, a, b;
	cin >> n >> w >> w;
	if (n > 1)
	{
		for (i = 0; i < n - 1; i++)
			scanf_s("%d",&a);
		cin >> b;
		n = (abs(b - w) < abs(a - b)) ? abs(a - b) : abs(b - w);
		cout << n;
	}
	else
	{
		cin >> a;
		cout << abs(a - w);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   12 |                         scanf_s("%d",&a);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[2005];
int main()
{
    int n,z;
    cin>>n>>a[0]>>z;
    for(int i=1; i<=n; i++)
        cin>>a[i];
    if(n==1)cout<<abs(z-a[1]);
    else cout<<max(abs(w-a[n]),abs(a[n]-a[n-1]));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: 'w' was not declared in this scope
   11 |     else cout<<max(abs(w-a[n]),abs(a[n]-a[n-1]));
      |                        ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
using namespace std;
#define int long long
#define inf   1000000009
#define minf -1000000009
int a[2005];
int dp[2005][2005];//dp[i][j] iターン目j枚目まで見たときのスコア
int memo(int x, int y,int t,int now,int n) {
	if(n==now)return 
}

signed main() {
	int n, z, w;
	cin >> n >> z >> w;
	for (int i = 0; i < n; i++)cin >> a[i];

	if (n == 1)cout << abs(a[0] - w) << endl;
	else cout << max(abs(a[n - 1] - a[n - 2]), abs(a[n - 1] - w)) << endl;
}

Compiler output:
a.cc: In function 'long long int memo(long long int, long long int, long long int, long long int, long long int)':
a.cc:17:1: error: expected primary-expression before '}' token
   17 | }
      | ^
a.cc:16:25: error: expected ';' before '}' token
   16 |         if(n==now)return
      |                         ^
      |                         ;
   17 | }
      | ~
Language: C++

#include <bits/stdc++.h>
#define x first
#define y second
#define P pair<int, int>
typedef long long int ll;
using namespace std;
#define N 1000005
int num[N];
int xdif[N];
int ydif[N];
 
int main(){
    ll n, z, w, ans = 0;
    cin>>n>>z>>w;
    for(int i=0;i<n;++i)
        cin>>num[i];
    ll tz = z;
    if(n==1){
        cout << abs(num[i]-w) << '\n';
        return 0;
    }
    for(int i=0;i<n-1;++i){
        bool last = true;
        int tmpz = num[i];
 
        for(int j=i+1;j<n-1;++j){
            if(abs(tmpz - num[i]) < abs(tmpz - num[n-1])){
                last = false;
                break;
            }
        }
 
 
        if(last){
            if(abs(num[i] - num[n-1]) > abs(z - num[n-1])){
                tz = num[i];
            }
        }
    }
    if(tz == z) cout << abs(w-num[n-1]) << '\n';
    else cout << abs(tz-num[n-1]) << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'i' was not declared in this scope
   19 |         cout << abs(num[i]-w) << '\n';
      |                         ^
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
//#define INF 931931114518101
using namespace std;
typedef pair<ll, ll> P;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
#define yo 100001
//------------------変数-----------------------//
ll n, z, w, c[2002];
ll dp[2][2001];
//-------------------関数----------------------//

ll sa(P a) { return abs(a.first - a.second); }

ll DP(ll num, ll pl, ll oth) {
  if (num == n - 1) {
    return sa(P(c[n - 1], oth));
  }
  if (dp[pl][num] >= 0) {
    return dp[pl][num];
  }
  if (pl == 0) {
    ll now = 0;
    FOR(i, num, n - 1) { now = max(now, DP(i + 1, 1, c[num])); }
    return DP(n - 1, 0, c[num]);
  }
  if (pl == 1) { // y
    ll now = INF;
    FOR(i, num, n - 1) { now = min(DP(i + 1, 0, c[num]), now); }
    dp[pl][num] = now;
    return dp[pl][num] = now;
  }
}

int main() {
  fill_all(dp, -1);
  cin >> n >> z >> w;
  REP(i, n) { cin >> c[i]; }
  ll cnt = 0;
  REP(i, n) { cnt = max(DP(i, 1, w), cnt); }
  cout << cnt << endl;
}


Compiler output:
a.cc: In instantiation of 'void fill_all(ARR&, const T&) [with T = int; ARR = long long int]':
a.cc:16:13:   recursively required from 'void fill_all(ARR&, const T&) [with T = int; ARR = long long int [2001]]'
   16 |     fill_all(i, v);
      |     ~~~~~~~~^~~~~~
a.cc:16:13:   required from 'void fill_all(ARR&, const T&) [with T = int; ARR = long long int [2][2001]]'
a.cc:48:11:   required from here
   48 |   fill_all(dp, -1);
      |   ~~~~~~~~^~~~~~~~
a.cc:15:3: error: 'begin' was not declared in this scope
   15 |   for (auto &i : arr) {
      |   ^~~
a.cc:15:3: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:15:3: error: 'end' was not declared in this scope
   15 |   for (auto &i : arr) {
      |   ^~~
a.cc:15:3: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc: In function 'll DP(ll, ll, ll)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N,Z,W;
vector<ll> a;

ll memo[2001][2];

ll dfs(int idx,int p,ll x,ll y){
    if(memo[idx][p]>0) return memo[idx][p];
    if(idx==N) return abs(x-y);
    if(p==0){
        ll tmp = abs(x-y);
        // [idx,i]
        for(int i=idx;i<N;i++){
            tmp = max(tmp,dfs(i+1,p^1,a[i],y));
        }
        return memo[idx][p] = tmp;
    }else{
        ll tmp = abs(x-y);
        for(int i=idx;i<N;i++){
            tmp = min(tmp,dfs(i+1,p^1,x,a[i]));
        }
        return memo[idx][p] = tmp;
    }
}

ll dfs2(int idx,int p,ll x,ll y){
    if(idx==N) return abs(x-y);
    if(p==0){
        ll tmp = abs(x-y);
        // [idx,i]
        for(int i=idx;i<N;i++){
            tmp = max(tmp,dfs(i+1,p^1,a[i],y));
        }
        return tmp;
    }else{
        ll tmp = abs(x-y);
        for(int i=idx;i<N;i++){
            tmp = min(tmp,dfs(i+1,p^1,x,a[i]));
        }
        return tmp;
    }
}

int main(){
    cin >> N >> Z >> W;
    if(N>=)
    a = vector<ll>(N,0);
    rep(i,N) cin >> a[i];

    if(N==1){
        cout << abs(a[N-1] - W) << endl;
        return 0;
    }

    if(N<26){
        ll ans = dfs(0,0,Z,W);
        cout << ans << endl;
        return 0;
    }

    ll ans = dfs(0,0,Z,W);
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:11: error: expected primary-expression before ')' token
   80 |     if(N>=)
      |           ^
Language: C++

s#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;

int a[2010], b, c, N ,Z, W;
string s;
int ans;
int main() {
    cin>>N>>Z>>W;
    REP(i,0,N){
        cin>>a[i];
    }
    ans=abs(Z-W);
    REP(i,0,N){
        ans=max(ans,abs(a[i]-a[N-1]));
    }
    ans=max(ans,abs(a[N-1]-Z));
    p(ans);
	return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | s#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 's' does not name a type
    1 | s#include <bits/stdc++.h>
      | ^
a.cc:13:1: error: 'string' does not name a type
   13 | string s;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
   16 |     cin>>N>>Z>>W;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | s#include <bits/stdc++.h>
a.cc:20:9: error: 'abs' was not declared in this scope; did you mean 'ans'?
   20 |     ans=abs(Z-W);
      |         ^~~
      |         ans
a.cc:22:13: error: 'max' was not declared in this scope
   22 |         ans=max(ans,abs(a[i]-a[N-1]));
      |             ^~~
a.cc:24:9: error: 'max' was not declared in this scope
   24 |     ans=max(ans,abs(a[N-1]-Z));
      |         ^~~
a.cc:2:14: error: 'cout' was not declared in this scope
    2 | #define p(s) cout<<(s)<<endl
      |              ^~~~
a.cc:25:5: note: in expansion of macro 'p'
   25 |     p(ans);
      |     ^
a.cc:2:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #define p(s) cout<<(s)<<endl
      |              ^~~~
a.cc:25:5: note: in expansion of macro 'p'
   25 |     p(ans);
      |     ^
a.cc:2:25: error: 'endl' was not declared in this scope
    2 | #define p(s) cout<<(s)<<endl
      |                         ^~~~
a.cc:25:5: note: in expansion of macro 'p'
   25 |     p(ans);
      |     ^
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | s#include <bits/stdc++.h>
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
//#include <bits/stdc++.h>

using namespace std;

typedef long long li;

li n;
li x[2000];
li init[2];

li memo[2][2005];
li rec(li pl, li pos) {
    if (memo[pl][pos] != -1) {
        return memo[pl][pos];
    }
    vector<li> candidates;
    for (int i = pos + 1; i < n; ++i) {
        candidates.push_back(rec(1 - pl, i));
    }
    li op_value = pos ? x[pos - 1] : init[1 - pl];
    candidates.push_back(abs(x[n - 1] - op_value));
    if (pl) {
        return memo[pl][pos] = *min_element(candidates.begin(), candidates.end());
    } else {
        return memo[pl][pos] = *max_element(candidates.begin(), candidates.end());
    }
}

int main() {
    memset(memo, -1, sizeof(memo));

    cin >> n >> init[0] >> init[1];
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    cout << rec(0, 0) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'memset' was not declared in this scope
   34 |     memset(memo, -1, sizeof(memo));
      |     ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | //#include <bits/stdc++.h>
Language: C++

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

voaid solve(ll N, ll Z, ll W, vector<ll> a) {
  ll res = abs(a.back() - W);
  if (N > 1) chmax(res, abs(a[N - 2] - a[N - 1]));
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	ll Z;
	ll W;
	scanf("%lld", &N);
	vector<ll> a(N-1+1);
	scanf("%lld", &Z);
	scanf("%lld", &W);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &a[i]);
	}
	solve(N, Z, W, a);
	return 0;
}


Compiler output:
a.cc:55:1: error: 'voaid' does not name a type; did you mean 'void'?
   55 | voaid solve(ll N, ll Z, ll W, vector<ll> a) {
      | ^~~~~
      | void
a.cc: In function 'int main()':
a.cc:75:9: error: 'solve' was not declared in this scope
   75 |         solve(N, Z, W, a);
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>
#define F first
#define S second
#define int long long
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

ll a[101];

int main() {
  for (int i = 0; i <= 100; i++) a[i] = 0;
  int N;
  cin >> N;
  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    ans += a[i];
  }
  for (int i = 100; i >= 1; i--) {
    ll res = 0;
    for (int j = 1; j <= 100; j++) {
      if (j % i == 0) {
        res += a[j];
      }
    }
    if (res < 0) {
      for (int j = 1; j <= 100; j++) {
        if (j % i == 0) {
          a[j] = 0;
        }
      }
      ans -= res;
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <algorithm>
#include <cstdio>
using namespace std;
 
int N;
long long A[101], B[101];
int op[101], bb, cc, dd;
 
long long bf(int n) {
  if(n == bb) {
    long long ans = 0;
    for(int i = bb; i < cc; i++) {
      if(op[i] == 0) {
//        vis[i] = 1, vis[i + i] = 1;
        ans += max(0LL, A[i] + (op[i + i] == 0 ? B[i + i] : 0));
      }
    }
    for(int i = cc; i < dd; i++) {
      if(op[i] == 0) {
//        vis[i] = 1;
        ans += B[i];
      }
    }
    for(int i = dd + 1; i <= N; i+=2) {
      if(op[i] == 0) {
//        vis[i] = 1;
        ans += B[i];
      }
    }
    return ans;
  }
  if(op[n]) {
    return bf(n + 1);
  }else {
    long long now = A[n] + bf(n + 1);
    for(int i = n + n; i <= N; i += n) {
      op[i]++;
    }
    now = max(now, bf(n + 1));
    for(int i = n + n; i <= N; i += n) {
      op[i]--;
    }
    return now;
  }
}
 
long long bf2(int n) {
  if(n + n > N) {
    long long ans = 0;
    for(int i = n; i <= N; i++) {
      if(op[i] == 0) ans += B[i];
    }
    return ans;
  }
  if(op[n]) {
    return bf2(n + 1);
  }else {
    long long now = A[n] + bf2(n + 1);
    for(int i = n + n; i <= N; i += n) {
      op[i]++;
    }
    now = max(now, bf2(n + 1));
    for(int i = n + n; i <= N; i += n) {
      op[i]--;
    }
    return now;
  }
}
 
 
int main() {
  scanf("%d", &N);
  bb = N / 3 + 1;
  cc = N / 2 + 1;
  dd = bb + bb;
  for(int i = 1; i <= N; i++) {
    scanf("%lld", &A[i]);
    if(A[i] > 0) B[i] = A[i];
  }
  if(N < 10) printf("%lld\n", max(0LL, A[1] + bf2(2)));
  else printf("%lld\n", max(0LL, A[1] + bf(2)));
//  for(int i = 1; i <= N; i++) if(!vis[i])cout << i << "\n";
  cin >> N;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:3: error: 'cin' was not declared in this scope
   83 |   cin >> N;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
Language: C++

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

int N;
long long A[105];
int smash[105];

long long bf(int n) {
  if(n + n > N) {
    long long ans = 0;
    for(int i = n; i <= N; i++) {
      if(smash[i]) {
        ans += max(A[i], 0);
      }
    }
    return ans;
  }
  if(smash[n]) {
    return bf(n + 1);
  }else {
    long long now = A[n] + bf(n + 1);
    for(int i = n + n; i <= N; i += n) {
      smash[i]++;
    }
    now = max(now, bf(n + 1));
    for(int i = n + n; i <= N; i += n) {
      smash[i]--;
    }
    return now;
  }
}

int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; i++) {
    scanf("%lld", &A[i]);
  }
  printf("%lld\n", max(0LL, A[1] + bf(2)));
  cin >> N;
}

Compiler output:
a.cc: In function 'long long int bf(int)':
a.cc:13:19: error: no matching function for call to 'max(long long int&, int)'
   13 |         ans += max(A[i], 0);
      |                ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:13:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   13 |         ans += max(A[i], 0);
      |                ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:13:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |         ans += max(A[i], 0);
      |                ~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define source 0
#define sink 101
#define pii pair<long long, long long>
#define int long long
using namespace std;
 
const long long INF = 2e16;
 
int N;
long long A[105];
vector<int> adj[105];
long long cap[105][105];
int par[105];
int vis[105][105];
void edge(int u, int v, long long c) {
  if(!vis[u][v]) {
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vis[u][v] = vis[v][u] = 1;
//  cout << u << " -> " << v << " " << c << "\n";
  cap[u][v] = c;
}
 
long long BFS() {
  memset(par, -1, sizeof(par));
  queue<pii> q;
  q.emplace(source, INF);
  par[source] = -2;
  while(!q.empty()) {
    int u = q.front().first;
    long long flow = q.front().second;
//    cout << u << " " << flow << "\n";
    q.pop();
 
    for(int v : adj[u]) {
      if(par[v] == -1 && cap[u][v] > 0) {
        par[v] = u;
        long long new_flow = min(flow, cap[u][v]);
        if(v == sink) return new_flow;
        q.emplace(v, new_flow);
      }
    }
  }
//  cout << "NO\n" << "\n";
  return 0;
}
 
long long macflow() {
  long long flow = 0, new_flow;
  while(new_flow = BFS()) {
    flow += new_flow;
    int u = sink;
    while(u != source) {
      cap[par[u]][u] -= flow;
      cap[u][par[u]] += flow;
      u = par[u];
    }
  }
//  cout << flow << "\n";
  return flow;
}
 
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  long long sum = 0;
  for(int i = 1; i <= N; i++) {
    cin >> A[i];
    if(A[i] >= 0) sum += A[i];
  }
  for(int i = 1; i <= N; i++) {
    if(A[i] < 0) {
      edge(source, i, -A[i]);
      if(A[j] >= 0) {
        edge(i, j, INF);
      }
    }else {
      edge(i, sink, A[i]);
    }
  }
  long long ans = macflow();
//  cout << ans << "\n";
  cout << sum - ans << "\n";
  cin >> N;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:76:12: error: 'j' was not declared in this scope
   76 |       if(A[j] >= 0) {
      |            ^
Language: C++

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

const ll N = 105, INF = 1e9;
ll n, source, sink;
ll a[N], par[N];
ll cap[N][N];
vector<ll> adj[N];

ll bfs(ll source, ll sink) {
	memset(par, -1, sizeof par);
	par[source] = -2;
	queue<pair<ll, ll>> q;
	q.push({source, INF});
	while(!q.empty()) {
		ll u = q.front().first, flow = q.front().second;
		q.pop();
		for(auto& v : adj[u]) {
			if(par[v] == -1 && cap[u][v]) {
				par[v] = u;
				ll new_flow = min(flow, cap[u][v]);
				if(v == sink) return new_flow;
				q.push({v, new_flow});
			}
		}
	}
	return 0;
}

ll maxflow(ll source, ll sink) {
	ll flow = 0;
	ll newFlow;
	while((newFlow = bfs(source, sink))) {
		flow += newFlow;
		ll u = sink;
		while(u != source) {
			ll v = par[u];
			cap[v][u] -= newFlow;
			cap[u][v] += newFlow;
			u = v;
		}
	}
	return flow;
}

ll main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	source = 0; sink = n+1;
	ll ideal = 0;
	for(ll i = 1; i <= n; i++)
		cin >> a[i], ideal += (a[i]>0)?a[i]:0;
	memset(cap, 0, sizeof cap);
	for(ll i = 1; i <= n; i++) {
		if(a[i] <= 0) adj[source].push_back(i), cap[source][i] = -a[i];
		else adj[i].push_back(sink), cap[i][sink] = a[i];
	}
	for(ll i = 1; i <= n; i++) {
		for(ll j = 2*i; j <= n; j+=i)
			adj[i].push_back(j), cap[i][j] = INF;
	}
	ll mf = maxflow(source, sink);
	ll ans = ideal - mf;
	cout << ans << '\n';
	return 0;
}

Compiler output:
a.cc:47:1: error: '::main' must return 'int'
   47 | ll main() {
      | ^~
Language: C++

#include <bits/stdc++.h>
/*
	Karya anak bangsa yang paling agung
	Author : Yohandi or... bukan..
*/

#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define INF INT_MAX

#define all(a) a.begin(),a.end()
#define lb(a,x) (lower_bound(all(a),x)-a.begin())
#define ub(a,x) (upper_bound(all(a),x)-a.begin())

#define rep(a,x,y) for(int a=(int)x;a<=(int)y;++a)
#define repd(a,x,y,d) for(int a=(int)x;a<=(int)y;a+=d)
#define res(a,x,y) for(int a=(int)x;a>=(int)y;--a)
#define resd(a,x,y,d) for(int a=(int)x;a>=(int)y;a-=d)

// Ordered Set, Ordered Multiset
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define o_multiset tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
// .order_of_key(x) -> Number of elements less than x
// * .find_by_order(k) -> Kth smallest element (0-based)
// .erase(x) -> Remove all elements equal to x

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
#define lint int
using lint=long long;

mt19937 rng(time(NULL));

lint Power(lint A,lint B,lint C){
	if(!B) return 1LL;
	lint tmp=Power(A,B>>1,C);
	return tmp*tmp%C*(B&1?A:1)%C;
}

int T;

lint N,Source,Sink;
lint Cost[101],Pre[101];
vector<int> Adj[101];
lint X,Flow,Maxflow;
lint Cap[101][101];

lint Augment(lint Pos,lint Bottleneck){
    if(Pos==Source) return Bottleneck;
    if(Pre[Pos]!=-1){
        lint Flow=Augment(Pre[Pos],min(Bottleneck,Cap[Pre[Pos]][Pos]));
        Cap[Pre[Pos]][Pos]-=Flow;
        Cap[Pos][Pre[Pos]]+=Flow;
        return Flow;
    }
    return 0;
}

void DFS(lint U){
    if(U==Sink) return;
    for(auto V:Adj[U]){
        if(Pre[V]==-1&&Cap[U][V]>0){
            Pre[V]=U;
            DFS(V);
        }
        if(Pre[Sink]!=-1) return;
    }
}

int main(){
//	ios_base::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
    cin>>N;
    for(int i=1;i<=N;++i){
        cin>>Cost[i];
        if(Cost[i]>0){
            X+=Cost[i];
            Adj[i].push_back(N+1);
            Cap[i][N+1]=Cost[i];
        } else {
            Adj[0].push_back(i);
            Cap[0][i]=-Cost[i];
        }
        for(int j=2*i;j<=N;j+=i){
            Adj[i].push_back(j);
            Cap[i][j]=INF;
        } 
    }
    Source=0;
    Sink=N+1;
    while(true){
        memset(Pre,-1,sizeof(Pre));
        DFS(Source);
        Flow=Augment(Sink,INF);
        if(Flow==0) break;
        Maxflow+=Flow;
    }
    cout<<X-Maxflow<<endl;
	return 0;
}




Compiler output:
a.cc:38:14: error: expected nested-name-specifier before 'int'
   38 | #define lint int
      |              ^~~
a.cc:39:7: note: in expansion of macro 'lint'
   39 | using lint=long long;
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[2005];
ll adj[2005][2005];
ll radj[2005][2005];
ll parent[2005];
ll n;
bool bfs(){
	bool visited[2005];
	memset(visited,0,sizeof(visited));
	queue <ll> q;
	q.push(0); visited[0]=1;
	parent[0]=-1;
	
	while(!q.empty()){
		ll u=q.front(); q.pop();
		for(ll v=0; v<=n+1;v++){
			if(!visited[v] && radj[u][v]>0){
				q.push(v);
				parent[v]=u;
				visited[v]=1;
			}
		}
	}
	return (visited[n+1]==true);
}

ll maxflow(){
	for(ll u=0;u<=n+1;u++)
		for(ll v=0;v<=n+1;v++)
			radj[u][v]=adj[u][v];
			
	ll max_flow=0;
	ll u,v;
	while(bfs()){
		ll path_flow= ll_MAX;
		for(v=n+1;v!=0; v=parent[v]){
			u=parent[v];
			path_flow=min(path_flow,radj[u][v]);
		}
		for(v=n+1; v!=0; v=parent[v]){
			u=parent[v];
			radj[u][v]-= path_flow;
			radj[v][u]+= path_flow;
		}
		max_flow += path_flow;
	}
	return max_flow;
}
int main(){
	cin >> n;
	ll x=0;
	for(ll i=1;i<=n;i++){
		cin >> a[i];
		if(a[i]>0) x+=a[i];
	}
	for(ll i=1;i<=n;i++){
		if(a[i]>0) adj[i][n+1]=a[i];
		else if(a[i]<=0) adj[0][i]=-a[i];
		for(ll j=i*2;j<=n;j+=i){
			adj[i][j]=INT_MAX;
			//adj[j][i]=INT_MAX;
		}
	}
	cout << x-maxflow() << endl;
}

Compiler output:
a.cc: In function 'long long int maxflow()':
a.cc:37:31: error: 'll_MAX' was not declared in this scope
   37 |                 ll path_flow= ll_MAX;
      |                               ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[2005];
ll adj[2005][2005];
ll radj[2005][2005];
ll parent[2005];
ll n;
bool bfs(){
	bool visited[2005];
	memset(visited,0,sizeof(visited));
	queue <ll> q;
	q.push(0); visited[0]=1;
	parent[0]=-1;
	
	while(!q.empty()){
		ll u=q.front(); q.pop();
		for(ll v=0; v<=n+1;v++){
			if(!visited[v] && radj[u][v]>0){
				q.push(v);
				parent[v]=u;
				visited[v]=1;
			}
		}
	}
	return (visited[n+1]==true);
}

ll maxflow(){
	for(ll u=0;u<=n+1;u++)
		for(ll v=0;v<=n+1;v++)
			radj[u][v]=adj[u][v];
			
	ll max_flow=0;
	ll u,v;
	while(bfs()){
		ll path_flow= ll_MAX;
		for(v=n+1;v!=0; v=parent[v]){
			u=parent[v];
			path_flow=min(path_flow,radj[u][v]);
		}
		for(v=n+1; v!=0; v=parent[v]){
			u=parent[v];
			radj[u][v]-= path_flow;
			radj[v][u]+= path_flow;
		}
		max_flow += path_flow;
	}
	return max_flow;
}
int main(){
	cin >> n;
	ll x=0;
	for(ll i=1;i<=n;i++){
		cin >> a[i];
		if(a[i]>0) x+=a[i];
	}
	for(ll i=1;i<=n;i++){
		if(a[i]>0) adj[i][n+1]=a[i];
		else if(a[i]<=0) adj[0][i]=-a[i];
		for(ll j=i*2;j<=n;j+=i){
			adj[i][j]=ll_MAX;
		}
	}
	cout << x-maxflow() << endl;
}

Compiler output:
a.cc: In function 'long long int maxflow()':
a.cc:37:31: error: 'll_MAX' was not declared in this scope
   37 |                 ll path_flow= ll_MAX;
      |                               ^~~~~~
a.cc: In function 'int main()':
a.cc:62:35: error: 'll_MAX' was not declared in this scope
   62 |                         adj[i][j]=ll_MAX;
      |                                   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 10000000000
using ll=long long;

struct max_flow
{
    struct edge{ll to,cap,rev;};
    ll V;
    vector<vector<edge>> graph;
    vector<vector<ll>> flow;
    vector<pair<ll,ll>> prev;
public:
    
    max_flow(ll n)
    {
        V=n;
        graph.resize(V,vector<edge>());
        flow.resize(V,vector<ll> (V,0));
        prev.resize(V);
    }

    void add_edge(ll from,ll to, ll cap)
    {
        graph[from].push_back((edge){to,cap,(ll)graph[to].size()});
        graph[to].push_back((edge){from,0,(ll)graph[from].size()-1});
        return;a
    }
    bool bfs(ll s,ll t)
    {
        vector<bool> visit(V,false);
        for (ll i=0;i<V;i++) prev[i]=make_pair(-1,-1);
        vector<ll> d(V,INF);
        visit[s]=true;prev[s].first=s;d[s]=0;
        queue<ll> que;
        que.push(s);
        ll v;
        while (!que.empty())
        {
            v=que.front();
            que.pop();
            for (ll i=0;i<graph[v].size();i++)
            {
                edge e=graph[v][i];
                if (!visit[e.to] && d[e.to]>d[v]+1 && e.cap>0)
                {
                    prev[e.to]=make_pair(v,i);
                    d[e.to]=d[v]+1;
                    visit[e.to]=true;
                    que.push(e.to);
                }
            }
        }
        return prev[t].first!=-1;
    }

    void update(ll from,ll to, ll f,ll edgenum)
    {
        edge e=graph[from][edgenum];
        if (flow[from][to]>=0)
        {
            flow[from][to]+=f;
            graph[from][edgenum].cap-=f;
            graph[e.to][e.rev].cap+=f;
        }
        if (flow[to][from]>0)
        {
            flow[to][from]-=f;
            graph[from][edgenum].cap-=f;
            graph[e.to][e.rev].cap+=f;
        }
        return;
    }

    ll run(ll s,ll t)
    {
        ll from,to,f,ans=0;
        while(bfs(s,t))
        {
            from=-1;to=t;f=INF;
            while (from!=s)
            {
                from=prev[to].first;
                f=min(f,graph[from][prev[to].second].cap);
                to=from;
            }
            to=t;from=-1;
            while (from!=s)
            {
                from=prev[to].first;
                update(from,to,f,prev[to].second);
                to=from;
            }
            ans+=f;
        }
        return ans;
    }
};

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

Compiler output:
a.cc: In member function 'void max_flow::add_edge(ll, ll, ll)':
a.cc:27:16: error: 'a' was not declared in this scope
   27 |         return;a
      |                ^
Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
struct edge{ ll to; ll cap; ll rev;};
ll MAXN=105;
vector<edge> G[MAXN];

bool used[MAXN];

void addEdge0(ll from, ll to, ll cap){
    edge A={to,cap,(ll)G[to].size()};
    edge B={from,0,(ll)G[from].size()};
    G[from].push_back(A);
    G[to].push_back(B);
    return;
}//有向グラフを作る

void addEdge1(ll a, ll b, ll cap){
    edge A={b,cap,(ll)G[b].size()};
    edge B={a,cap,(ll)G[a].size()};
    G[a].push_back(A);
    G[b].push_back(B);
    return;
}//無向グラフを作る

ll dfs(ll v, ll t, ll f){
    if(v==t) return f;
    used[v]=true;
    rep(i,G[v].size()){
        edge &e=G[v][i];
        if(!used[e.to] && e.cap>0){
            ll 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;
}

ll MaxFlow(ll Start, ll Goal){
    ll ans=0;
    while(true){
        rep(i,MAXN) used[i]=false;
        ll P=dfs(Start,Goal,INF);
        if(P==0) break;
        ans+=P;
    }
    return ans;
}

int main(){
    ll N; cin>>N;
    ll SUM=0;
    REP(i,1,N+1){
        ll x; cin>>x;
        if(x<=0) addEdge0(102,i,-x);
        if(x>0) {addEdge0(i,103,x); SUM+=x;}
    }

    REP(i,1,N){
        ll K=2*i;
        while(K<=N) {
            addEdge0(i,K,INF);
            K+=i;
        }
    }
    cout<<SUM-MaxFlow(102,103)<<endl;

    
}


Compiler output:
a.cc:13:16: error: size of array 'G' is not an integral constant-expression
   13 | vector<edge> G[MAXN];
      |                ^~~~
a.cc:15:11: error: size of array 'used' is not an integral constant-expression
   15 | bool used[MAXN];
      |           ^~~~
Language: C++

#include <iostream>
#include <queue>
#include <vector>
#include <limits>
#define INF (1e18)
using namespace std;
template <typename T, bool directed>//directedは考えるグラフが有向グラフかどうかをもつ
class Dinic
{
public:
    Dinic(int n) : n(n), capacity(n, vector<T>(n)), edges(n), redges(n) {}
    void add_edge(int src, int dst, T cap)
    {
        capacity[src][dst] = cap;
        capacity[dst][src] = directed ? 0 : cap;
        edges[src].push_back(dst);
        redges[dst].push_back(src);
        if (!directed)
        {
            edges[dst].push_back(src);
            redges[src].push_back(dst);
        }
    }
    
    T max_flow(int s, int t)
    {
        T flow = 0;
        while (bfs(s, t))
        {
            start.assign(n, 0);
            flow += dfs(t, s, numeric_limits<T>::max());
        }
        return flow;
    }
    
private:
    int n;
    vector<int> level, start;
    vector<vector<T>> capacity, edges, redges;
    bool bfs(int s, int t)
    {
        level.assign(n, -1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
        while (!que.empty())
        {
            int v = que.front();
            que.pop();
            for (int nv : edges[v])
                if (capacity[v][nv] > 0 && level[nv] < 0)
                {
                    level[nv] = level[v] + 1;
                    que.push(nv);
                }
        }
        return level[t] != -1;
    }
    
    T dfs(int v, int s, T limit)
    {
        if (v == s)
            return limit;
        
        T res = 0;
        for (int &i = start[v]; i < (int)redges[v].size(); ++i)
        {
            int nv = redges[v][i];
            if (capacity[nv][v] > 0 && level[v] == level[nv] + 1)
            {
                T d = dfs(nv, s, min(limit, capacity[nv][v]));
                if (d > 0)
                {
                    capacity[nv][v] -= d;
                    capacity[v][nv] += d;
                    res += d;
                    limit -= d;
                    if (limit == 0)
                        break;
                }
            }
        }
        return res;
    }
};

int main()
{
    int n;
    cin>>n;
    long long a[n];
    long long s = 0;
    for(int i = 0; i<n; i++){
      cin>>a[i];
      if(a[i] > 0){
        s += a[i];
      }
    }
    Dinic<long long, true> dn(n + 2);
    for(int i = 0; i<n; i++){
      if(a[i] >= 0){
        dn.add_edge(i, n+1, a[i]);
      }else{
        dn.add_edge(n, i, 0lL-a[i]);
      }
    }
    for(int i = 0; i < n; i++){
      for(int j = 2*(i+1); j<=n; j += i+1){
        dn.add_edge(i, j-1, INF);
      }
    }
    long long ans = s - dn.max_flow(n, n+1);
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:104:27: error: unable to find numeric literal operator 'operator""lL'
  104 |         dn.add_edge(n, i, 0lL-a[i]);
      |                           ^~~
Language: C++


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


const ll inf=1e15+7;
struct max_flow {
    struct edge { ll to, cap, rev; };
    ll V;
    vector<vector<edge>> G;
    vector<ll> itr, level;

    max_flow(ll V) : V(V) { G.assign(V,vector<edge>()); }

    void add_edge(ll from, ll to, ll cap) {
        G[from].push_back((edge) {to, cap, (ll) G[to].size()});
        G[to].push_back((edge) {from, 0, (ll) G[from].size()-1});
    }

    void bfs(ll s) {
        level.assign(V,-1);
        queue<ll> q;
        level[s] = 0; q.push(s);
        while (!q.empty()) {
            ll v = q.front(); q.pop();
            for(auto &e: G[v]){
                if (e.cap > 0 and level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    q.push(e.to);
                }
            }
        }
    }

    ll dfs(ll v, ll t, ll f) {
        if (v == t) return f;
        for (ll& i = itr[v]; i < (ll) G[v].size(); ++i) {
            edge& e = G[v][i];
            if (e.cap > 0 and level[v] < level[e.to]) {
                ll 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;
    }

    ll run(ll s, ll t) {
        ll ret = 0, f;
        while (bfs(s), level[t] >= 0) {
            itr.assign(V,0);
            while ((f = dfs(s, t, inf)) > 0) ret += f;
        }
        return ret;
    }
};

ll main(){
  ll n;cin>>n;
  ll ans=0;
  max_flow m(n+2);
  rep(i,n){
    ll c;cin>>c;
    if(c<0){
      m.add_edge(i+1,n+1,-c);
      m.add_edge(0,i+1,0);
    }
    else{
      ans+=c;
      m.add_edge(0,i+1,c);
      m.add_edge(i+1,n+1,0);
    }
  }
  rep(i,1,n+1){
    for(ll j=2*i;j<=n;j+=i)m.add_edge(j,i,inf);
  }
  cout<<ans-m.run(0,n+1)<<endl;
}

Compiler output:
a.cc:72:1: error: '::main' must return 'int'
   72 | ll main(){
      | ^~
Language: C++

#include <stdio.h>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
const int N=1e2+10;
const long long int INF=1e16+10;
const int MAX_V=800;
struct edge
{
    long long int to,cap;
	int rev;//终点、容量、反向边
};
vector<edge>G[MAX_V];//图的邻接表表示
int level[MAX_V];//顶点到源点的距离标号
int iter[MAX_V];//当前弧，在其之前的边都已经没有用了
void add_edge(int from,int to,long long int cap)//向图中增加一条从from到to的容量为cap的边
{
    G[from].push_back((edge){to,cap,(int)G[to].size()});
     G[to].push_back((edge){from,0,(int)G[from].size()-1});
}
void bfs(int s)//通过BFS计算从源点出发的距离标号
{
    memset(level,-1,sizeof(level));
    queue<int>que;
    level[s]=0;
    que.push(s);
    while(!que.empty())
    {
        int v=que.front();
        que.pop();
        for(int i=0; i<G[v].size(); ++i)
        {
            edge &e=G[v][i];
            if(e.cap>0&&level[e.to]<0)
            {
                level[e.to]=level[v]+1;
                que.push(e.to);
            }
        }
    }
}
long long int dfs(int v,int t,long long int f)//DFS寻找增广路
{
    if(v==t) return f;
    for(int &i=iter[v]; i<G[v].size(); ++i)
    {
        edge &e=G[v][i];
        if(e.cap>0&&level[v]<level[e.to])
        {
            long long 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;
}
long long int Dinic(int s,int t)//求解s到t的最大流
{
    long long int maxflow=0;
    while(1)
    {
        bfs(s);
        if(level[t]<0) return maxflow;
        memset(iter,0,sizeof(iter));
        int f;
        while((f=dfs(s,t,INF))>0)
            maxflow+=f;
    }
}
int main(){
	int n,s=N-1,t=N-2;
	long long int temp,tot=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&temp);
		if(temp>0)add_edge(i,t,temp);
		else add_edge(s,i,-temp);
		for(int j=i<<1;j<=n;j+=i)add_edge(i,j,INF);
		if(temp>0)tot+=temp;
	}
	printf("%lld\n",tot-Dinic(s,t));
}



Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:24:5: error: 'memset' was not declared in this scope
   24 |     memset(level,-1,sizeof(level));
      |     ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <utility>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc: In function 'long long int Dinic(int, int)':
a.cc:69:9: error: 'memset' was not declared in this scope
   69 |         memset(iter,0,sizeof(iter));
      |         ^~~~~~
a.cc:69:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

struct Fordfulkerson {
	const int INF = 1 << 28;
	struct edge {
		int to, cap, rev;
		edge() {}
		edge(int to, int cap, int rev) :to(to), cap(cap), rev(rev) {}
	};

	int n;
	vector<vector<edge> > G;
	vector<int> used;

	Fordfulkerson() {}
	Fordfulkerson(int sz) :n(sz), G(n), used(n) {}

	void add_edge(int from, int to, int cap) {
		G[from].push_back(edge(to, cap, G[to].size()));
		// undirected
		//G[to].push_back(edge(from,cap,G[from].size()-1));
		// directed
		G[to].push_back(edge(from, 0, G[from].size() - 1));
	}

	int dfs(int v, int t, int f) {
		if (v == t) return f;
		used[v] = true;
		for (int i = 0; i<(int)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;
	}

	int flow(int s, int t, int lim) {
		int fl = 0;
		for (;;) {
			fill(used.begin(), used.end(), 0);
			int f = dfs(s, t, lim);
			if (f == 0) return fl;
			fl += f;
			lim -= f;
		}
	}

	int flow(int s, int t) {
		return flow(s, t, INF);
	}

};

#define inf (long long)1e20

void main() {
	int N;
	cin >> N;
	Fordfulkerson g(N+2);
	int sum = 0;
	for (int i = 1; i <= N; i++) {
		int a;
		cin >> a;
		if (a <= 0) g.add_edge(0,i,-a);
		else {
			g.add_edge(i, N + 1, a);
			sum += a;
		}
		int j = 2 * i;
		while (j <= N) {
			g.add_edge(i,j,inf);
			j += i;
		}
	}
	cout << sum - g.flow(0, N + 1) << endl;
	return;
}

Compiler output:
a.cc:66:1: error: '::main' must return 'int'
   66 | void main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:86:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   86 |         return;
      |         ^~~~~~
Language: C

#include <bits/stdc++.h>

#define int long long

using namespace std;
int ar[200] , sum , sm;
 main() {
    int n , k;
    cin >> n;
    for (int i = 1 ; i <= n ;i++)
        cin >> ar [i];

    for (int i = n ;i > 0;i--)
        {
            sm = 0;
            for (int j = i ;j <= n;j++)
            {
                if (j%i == 0)
                {
                    sm += ar[j];
                }
            }
            if (sm <= 0)
            {
                for (int j = i ; j <= n; j++)
                {

                    if(j%i == 0)
                    {
                        ar[j] = 0;
                    }

                }
            }

        }
        sum = 0;
        for (int i = 1;i <= n;i++)
            sum+=ar[i];

            cout << sum << endl;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.