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


    int N;std::cin >> N ;
    std::vector<int> A(N+1);
    for (int i=0;i<N;++i){
        std::cin>>A[i];
    }
    A[N]=99; // sentinel.100を超えない

    int ans = 1000;

    int pre=201; // 200を超える
    int stock=0; //株
    for (int a : A) {
        if (pre < a){ //値上がりした
            //一つ前の値段で買えるだけ買う
            stock += ans / pre;
            ans -= pre * (ans / pre);
        } else if (pre > a) { //値下がりした
            if (stock > 0) {
                //ひとつ前の値段で全部売る
                ans += pre * stock;
                stock=0;
            }
        }
        pre = a;
    }
    std::cout << ans;

    return 0 ;
}


Compiler output:
a.cc:2:16: error: 'cin' in namespace 'std' does not name a type
    2 |     int N;std::cin >> N ;
      |                ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:3:10: error: 'vector' in namespace 'std' does not name a template type
    3 |     std::vector<int> A(N+1);
      |          ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | 
a.cc:4:5: error: expected unqualified-id before 'for'
    4 |     for (int i=0;i<N;++i){
      |     ^~~
a.cc:4:18: error: 'i' does not name a type
    4 |     for (int i=0;i<N;++i){
      |                  ^
a.cc:4:22: error: expected unqualified-id before '++' token
    4 |     for (int i=0;i<N;++i){
      |                      ^~
a.cc:7:5: error: 'A' does not name a type
    7 |     A[N]=99; // sentinel.100を超えない
      |     ^
a.cc:13:5: error: expected unqualified-id before 'for'
   13 |     for (int a : A) {
      |     ^~~
a.cc:27:10: error: 'cout' in namespace 'std' does not name a type
   27 |     std::cout << ans;
      |          ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   27 |     std::cout << ans;
      |     ^~~
a.cc:29:5: error: expected unqualified-id before 'return'
   29 |     return 0 ;
      |     ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int n;
    cin >> n;
    vector<int> v(n+1);
    int max = 0;
    rep(i,n) {
        cin >> v[i];
        if(v[i]>max) max = v[i];
    }
    v[n] = 0;

    int m = 1000;
    int st = 0;
    rep(i,n){

        if(v[i]== max){
                m = m + st*v[i];
                st = 0;
                break;
        }

        if(v[i] < v[i+1]){
            st = m / v[i];
            m %= v[i];
        }
        else if(v[i] > v[i+1]){
            m = m + st*v[i];
            st = 0;
        }

    
    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    ll money=1000;
    ll stock=0;
    
    for(int i=1; i<n; i++){
        if(a[i]>a[temp]){
            //temp時点で買えるだけ株を買う
            stock = money/a[temp];
            money -= stock*a[temp];
            //a[i]時点で全株売る
            money += stock*a[i];
            stock =0;
        }
        temp=i;
    }
    cout << money << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: 'temp' was not declared in this scope; did you mean 'tm'?
   20 |         if(a[i]>a[temp]){
      |                   ^~~~
      |                   tm
a.cc:28:9: error: 'temp' was not declared in this scope; did you mean 'tm'?
   28 |         temp=i;
      |         ^~~~
      |         tm
Language: C++

#include <iostream>
int N;
int a[80];

int find_locallow(int idx){
  for(int i=idx;i<N-1;i++){
    if(a[i]<a[i+1])return i;
  }
  return -1;
}

int find_localhigh(int idx){
  int i;
  for(i=idx;i<N-1;i++){
    if(a[i]>a[i+1])break;
  }
  return i;
}
nt main(void){
  int money=1000;
  int kabu=0;
  std::cin>>N;
  for(int i=0;i<N;i++){
    std::cin>>a[i];
  }
  for(int i=0;i<N;i++){
    int buy=find_locallow(i);
    if(buy==-1)break;
    {
      kabu+=money/a[buy];
      money-=(money/a[buy])*a[buy];
      i=buy;
    }
    int sell=find_localhigh(i);
    {
      money+=a[sell]*kabu;
      kabu=0;
      i=sell;
    }
  }
    std::cout<<money<<std::endl;

  return 0;
}


Compiler output:
a.cc:19:1: error: 'nt' does not name a type; did you mean 'int'?
   19 | nt main(void){
      | ^~
      | int
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
double f[1005][5],a[1005];
signed main() {
	double n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	f[0][0]=1000;
	for(int i=1;i<=n;i++){
		double max0=0,max1=0,max2=0;
		for(int j=0;j<i;j++){
			if(max0<f[j][0]){
                max0=f[j][0];
                max2=f[j][2];
            }
            if(max1<f[j][1]){
                max1=f[j][1];
            }
		}
		f[i][1]=max0*a[i]+max2;
		f[i][0]=max1/a[i];
		f[i][2]=max1%(int)a[i];
	}
	double maxv=0;
	for(int i=0;i<=n;i++){
		if(maxv<f[i][0]){
			maxv=f[i][0];
		}
	}
	cout<<(int)maxv;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: invalid operands of types 'double' and 'long long int' to binary 'operator%'
   25 |                 f[i][2]=max1%(int)a[i];
      |                         ~~~~^~~~~~~~~~
      |                         |    |
      |                         |    long long int
      |                         double
Language: C++

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

bool check(int i, vector<int>& A){
    FOR(j, i+1, A.size()) if(A[i] < A[j]) return true;
    return false;
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    int money = 1000, stock = 0, price = 1e+9;
    REP(i, N){
        if(check(i, A) and price > A[i]){
            while(i+1 < N and A[i] > A[i+1]) ++i;
            stock = money/A[i];
            money -= stock*A[i];
            price = A[i];
        }else if(a[i] > price){
            while(i+1 < N and A[i] < A[i+1]) ++i;
            money += A[i]*stock;
            stock = 0;
            price = A[i];
        }
    }
    cout << money << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: 'a' was not declared in this scope
   28 |         }else if(a[i] > price){
      |                  ^
Language: C++

// C++ implementation of above approach 
#include <bits/stdc++.h> 
using namespace std; 

int max_profit(int a[],int b[],int n,int fee) 
{ 
    int i, j, profit; 
    int l, r, diff_day = 1, sum = 0; 
    b[0]=0;              
    b[1]=diff_day; 
    for(i=1;i<n;i++) 
    { 
    l=0; 
    r=diff_day; 
        sum=0;   

    for(j=n-1;j>=i;j--) 
    { 
        profit=(a[r]-a[l])-fee; 
        
        if(profit>0)     
        {   sum=sum+profit; } 
        l++; 
        r++; 
    } 
    if(b[0] < sum) 
    { 
        b[0] = sum; 
        b[1] = diff_day; 
    } 
    diff_day++; 
} 

return 0; 
} 
int main() 
{ 
    int n,i,j,k,m,q;
    cin>>n;
    int ar[n];
    rep(i,n)
        cin>>ar[i];
    int b[2]; 
    int tranFee = 0; 
    max_profit(arr, b, n, tranFee); 
    cout << b[0] << endl; 
    return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:41:5: error: 'rep' was not declared in this scope
   41 |     rep(i,n)
      |     ^~~
a.cc:45:16: error: 'arr' was not declared in this scope; did you mean 'ar'?
   45 |     max_profit(arr, b, n, tranFee);
      |                ^~~
      |                ar
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
double f[1005][5],a[1005];
signed main() {
	double n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	f[0][0]=1000;
	for(int i=1;i<=n;i++){
		double max0=0,max1=0,max2=0;
		for(int j=0;j<i;j++){
			if(max0<f[j][0]){
                max0=f[j][0];
                max2=f[j][2];
            }
            if(max1<f[j][1]){
                max1=f[j][1];
            }
		}
		f[i][1]=max0*a[i]+max2;
		f[i][0]=max1/a[i];
		f[i][2]=max1%a[i];
	}
	double maxv=0;
	for(int i=0;i<=n;i++){
		if(maxv<f[i][0]){
			maxv=f[i][0];
		}
	}
	cout<<(int)maxv;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   25 |                 f[i][2]=max1%a[i];
      |                         ~~~~^~~~~
      |                         |       |
      |                         double  double
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include <iomanip>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
llfor;ll mod=1000000007;
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;ans%=mod;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
 ll n,k;
 cin>>n;
 vector<ll>a;
 ll b;
 ll m=1000,st=0;
 rep(i,0,n){
  sc(b);
  push(a,b);
 }
 //一回目の株購入
 st+=m/a[0];
 m%=a[0];
/ cout<<a[0]<<" "<<m<<" "<<st<<endl;
  
 ll ans;
 rep(i,1,n){
  if(a[i-1]>a[i]){
   st+=m/a[i];
   m%=a[i];
  // cout<<a[i]<<" "<<m<<" "<<st<<endl;
  }
  else if(a[i-1]<a[i]){
   m+=a[i]*st;
   st=0;
  // cout<<a[i]<<" "<<m<<" "<<st<<endl;
  }
 }
 m=max((ll)1000,m);
 pr(m);
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:1: error: expected primary-expression before '/' token
   69 | / cout<<a[0]<<" "<<m<<" "<<st<<endl;
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A;
  
  for (int i=0; i<N; i++){
    int a;
    cin >> a;
    A.push_back(a);
  }
  
  int j=0;
  int M=1000;
  int S=0;
  while (j<N){
    if (A[j]>A[j+1]){ M += S*A[j]; S=0}
    else if (A[j]<A[j+1]){ S = M/A[j]; M -= S*A[j]}
    j++;
  }
  M += S*A[j];
  cout << M;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: expected ';' before '}' token
   21 |     if (A[j]>A[j+1]){ M += S*A[j]; S=0}
      |                                       ^
      |                                       ;
a.cc:22:51: error: expected ';' before '}' token
   22 |     else if (A[j]<A[j+1]){ S = M/A[j]; M -= S*A[j]}
      |                                                   ^
      |                                                   ;
Language: Java

import java.util.*;
import java.io.*;
public class EdD {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
//	 		String input1 = bf.readLine().trim();
//	 		String input2 = bf.readLine().trim();
 		int n = Integer.parseInt(bf.readLine());
	 		ArrayList<Integer> array = new ArrayList<Integer>();
	 		StringTokenizer st2 = new StringTokenizer(bf.readLine());
	 		for(int j=0;j<n;j++){
	 			array.add(Integer.parseInt(st2.nextToken()));
	 		}
	 	int yen = 1000;
	 	int i = 0;
	 	int min = array.get(0);
	 	int sum = 0;
	 	int max = 0;
	 	
	 	while(i< n){
	 		max = 0;
	 		int startindex = i+0;
	 		while(i < n-1 && array.get(i) <= array.get(i+1)){
	 			i++;
	 		}
	 		yen+=(yen/array.get(startindex)*(array.get(i)-array.get(startindex)));
	 		i++;
	 		
	 	}
 		out.println(yen);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Compiler output:
Main.java:3: error: class EdD is public, should be declared in a file named EdD.java
public class EdD {
       ^
1 error
Language: C++

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

int main()
{
    long long int n;
    cin>>n;
    vector<long long int>v(n);
    for(int i=0;i<n;i++)
     cin>>v[i];
    long long int res=0;
    for(int i=1;i<n;i++)
    {
        res+=max(0,v[i]-v[i-1]);
    }
    cout<<res;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   14 |         res+=max(0,v[i]-v[i-1]);
      |              ~~~^~~~~~~~~~~~~~~
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:14:17: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   14 |         res+=max(0,v[i]-v[i-1]);
      |              ~~~^~~~~~~~~~~~~~~
/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:14:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |         res+=max(0,v[i]-v[i-1]);
      |              ~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A;
  
  for (int i=0; i<N; i++){
    int a;
    cin >> a;
    A.push_back(a);
  }
  
  int j=0;
  int M=1000;
  int S=0;
  while (j<N){
    if (A[j]>=A[j+1]){
      M += S*A[j];
    }
    else{
      S = M/A[j]
    }
    j++;
  }
  M += S*A[j];
  cout << M;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: expected ';' before '}' token
   25 |       S = M/A[j]
      |                 ^
      |                 ;
   26 |     }
      |     ~
Language: C++

#include <iostream>
#include<vector>
using namespace std;
int main() {
    int n;cin>>n;
    vector<int>a(n+1);for(int i=1;i<=n;i++)cin>>a[i];
    long long dp[100];
    memset(dp,0,sizeof(dp));
    dp[1]=1000;
    for(int i=2;i<=n;i++){
        for(int j=1;j<i;j++){
            dp[i]=max(dp[i],dp[j]%a[j]+dp[j]/a[j]*a[i]);
            dp[i]=max(dp[i],dp[j]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'memset' was not declared in this scope
    8 |     memset(dp,0,sizeof(dp));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<bits/stdc++.h>
#define re register
#define int long long
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int a[200002],b,c,n,ans=1000;
int main(){
	n=read();
	for(re int i=1;i<=n;++i)a[i]=read();
	for(re int i=2;i<=n;++i)if(a[i]>a[i-1])ans=ans%a[i-1]+ans/a[i-1]*a[i];
	printf("%lld",ans);
}

Compiler output:
a.cc: In function 'long long int read()':
a.cc:5:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         re int t=0;re char v=getchar();
      |                ^
a.cc:5:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    5 |         re int t=0;re char v=getchar();
      |                            ^
At global scope:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:13:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         for(re int i=1;i<=n;++i)a[i]=read();
      |                    ^
a.cc:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |         for(re int i=2;i<=n;++i)if(a[i]>a[i-1])ans=ans%a[i-1]+ans/a[i-1]*a[i];
      |                    ^
Language: C++

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

int main(){
    
    int n;
    cin >> n;
    vector<long long int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }

    long long int money=1000;
    long long int profit;
    long long int stock;a

    for(int i=0; i<n-1; i++){
        profit=a.at(i+1)-a.at(i);
        if(profit>0){
            stock=money/a.at(i);
            money+=stock*profit;
        }
    }
    cout << money << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: expected ';' before 'for'
   15 |     long long int stock;a
      |                          ^
      |                          ;
   16 | 
   17 |     for(int i=0; i<n-1; i++){
      |     ~~~                   
a.cc:17:18: error: 'i' was not declared in this scope
   17 |     for(int i=0; i<n-1; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
int main(){
    double a;
    cin>>a;
    double arr[a];
    for (int i=0; i<a; i++) cin>>arr[i];
    double cur=1000, num=0;
    for (int i=0; i<a-1; i++){
        if (arr[i]<arr[i+1]) num=cur/arr[i], cur-=(cur/arr[i])*arr[i];
        else if (arr[i]>arr[i+1]) cur+=num*arr[i], num=0;
    }
    if (num!=0) cur+=arr[a-1]*num;
    cout<<cur<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    9 |     double arr[a];
      |                ^
a.cc:9:16: error: could not convert 'a' from 'double' to 'long unsigned int'
    9 |     double arr[a];
      |                ^
      |                |
      |                double
a.cc:9:16: error: size of array 'arr' has non-integral type 'double'
a.cc:16:25: error: invalid types 'double [1][double]' for array subscript
   16 |     if (num!=0) cur+=arr[a-1]*num;
      |                         ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

int main(){
  int n-0;
  ll m=1000;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  a.push_back(0);
  int l=0;
  int r=0;
  rep(i,n+1){
    cout << m;
    if(a[i]<a[r]){
      m=m%a[l]+m/a[l]*a[r];
      l=i;
      r=i;
    }
    if(a[i]>a[r]){
      r=i;
    }
  }
  cout << m;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: expected initializer before '-' token
   10 |   int n-0;
      |        ^
a.cc:12:10: error: 'n' was not declared in this scope
   12 |   cin >> n;
      |          ^
Language: C++

#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 510
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

LL T,n,i,j,k,x,y,z;
LL a[N],f[N];
char c[N];

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL LL Max(LL a,LL b){return (a>b)?a:b;}
IL bool cmp(const Data a,const Data b){return a.x<b.x;}

IL LL Mi(LL x,LL y){
	LL p=x,t=1,Res=1;
	for (;t<=y;(t&y)?Res=(Res*p)%MOD:0,p=(p*p)%MOD,t<<=1);
	return Res;
}

IL LL read(){
	LL p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	for (i=1;i<=n;i++)	a[i]=read();
	f[1]=1000;
	for (i=2;i<=n;i++){
		for (j=1;j<i;j++)	f[i]=Max(f[i],f[j]);
		for (j=1;j<i;j++){
			f[i]=Max(f[i],f[j]/a[j]*a[i]+f[j]%a[j]);
		}
	}
	cout<<f[n]<<endl;
	return 0;
}

Compiler output:
a.cc:33:19: error: 'Data' does not name a type
   33 | IL bool cmp(const Data a,const Data b){return a.x<b.x;}
      |                   ^~~~
a.cc:33:32: error: 'Data' does not name a type
   33 | IL bool cmp(const Data a,const Data b){return a.x<b.x;}
      |                                ^~~~
a.cc: In function 'bool cmp(int, int)':
a.cc:33:49: error: request for member 'x' in 'a', which is of non-class type 'const int'
   33 | IL bool cmp(const Data a,const Data b){return a.x<b.x;}
      |                                                 ^
a.cc:33:53: error: request for member 'x' in 'b', which is of non-class type 'const int'
   33 | IL bool cmp(const Data a,const Data b){return a.x<b.x;}
      |                                                     ^
Language: C++





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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll
int N,K;

int dp[81][2000][2000];
int A[100];

int dpf(int i,int j,int k){
	if (i == N + 1) return k;
	if (dp[i][j][k] != -1) return dp[i][j][k];
	return dp[i][j][k] = max({dpf(i + 1, j + k / A[i], k % A[i]), //Buy
		dpf(i + 1, j, k),
		dpf(i + 1, 0, k + j * A[i]),
		k
	});
	
	
	
}
int32_t main(){
	fast;
	cin>>N;
	FOR(i,1,N) cin>>A[i];
	mem(dp,-1);
	cout<<dpf(1,0,1000);
}



Compiler output:
/tmp/ccpHHViT.o: in function `dpf(long long, long long, long long)':
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccpHHViT.o
a.cc:(.text+0xd8): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccpHHViT.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccpHHViT.o
/tmp/ccpHHViT.o: in function `main':
a.cc:(.text+0x25a): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccpHHViT.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void readin(T &x) {
	x = 0;
	T fh = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
	x *= fh;
}
inline void d_read(double &x) {
	x = 0.0;
	int fh = 1;
	char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
	for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
	if (ch == '.') {
		double num = 1.0;
		ch = getchar();
		for (; isdigit(ch); ch = getchar()) x = x + (num /= 10) * (ch ^ 48);
	}
	x *= fh;
}
#define long long _int128
template <typename T>
inline void wt(T x) {
	if (x > 9) wt(x / 10);
	putchar(x % 10 + 48);
}
template <typename T>
inline void writeln(T x, char c) {
	if (x < 0) {
		putchar('-');
		x = -x;
	}
	wt(x);
	putchar(c);
}
const int N = 105;
int a[N];
int main() {
	int n;
	readin(n);
	for (int i = 1; i <= n; i ++) {
		readin(a[i]);
	}
	long long res = 1000, st = 0;
	a[0] = 1e9;
	for (int i = 1; i <= n; i ++) {
		if (a[i] >= a[i - 1] && a[i] > a[i + 1]) {
			res += 1ll * st * a[i];
			st = 0;
		}
		else if (a[i] <= a[i - 1] && a[i] < a[i + 1]) {
			st = res / (1ll * a[i]);
			res -= 1ll * st * a[i];
		}
	}
	writeln(res, '\n');
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: expected initializer before 'long'
   25 | #define long long _int128
      |              ^~~~
a.cc:48:14: note: in expansion of macro 'long'
   48 |         long long res = 1000, st = 0;
      |              ^~~~
a.cc:52:25: error: 'res' was not declared in this scope
   52 |                         res += 1ll * st * a[i];
      |                         ^~~
a.cc:52:38: error: 'st' was not declared in this scope; did you mean 'wt'?
   52 |                         res += 1ll * st * a[i];
      |                                      ^~
      |                                      wt
a.cc:56:25: error: 'st' was not declared in this scope; did you mean 'wt'?
   56 |                         st = res / (1ll * a[i]);
      |                         ^~
      |                         wt
a.cc:56:30: error: 'res' was not declared in this scope
   56 |                         st = res / (1ll * a[i]);
      |                              ^~~
a.cc:60:17: error: 'res' was not declared in this scope
   60 |         writeln(res, '\n');
      |                 ^~~
Language: C++

#include<algorithm>
using namespace std;
int main()
{
	int n, a[100];
	int i, j;
	int m = 1000;

	cin >> n;
	cin >> a[0];
	for (i = 1; i < n; i++) {
		cin >> a[i];
		if (a[i] > a[i - 1]) {
			int kabu = m / a[i - 1];
			m = m - kabu * a[i - 1] + kabu * a[i];
		}
	}

	cout << m << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout << m << endl;
      |         ^~~~
a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:22: error: 'endl' was not declared in this scope
   19 |         cout << m << endl;
      |                      ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

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

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    long long p=1000;
    long long s=0;
    for(int i=0; i<n-1; i++){
        if(a[i]<a[i+1]){
            long long k=p/a[i];
            s += k;
            p -= a[i]*k;a
        } else {
            p += s*a[i];
            s = 0;
        }
        }
    cout << p+s*a[n-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: expected ';' before '}' token
   16 |             p -= a[i]*k;a
      |                          ^
      |                          ;
   17 |         } else {
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long X[100];
int main()
{
  int N;
  cin>>N;
  for(int i=0;i<N;i++)
    cin>>X[i];
  long long Have=1000;
  long long Stock=0;
  Stock=Have/X[i];
  Have%=X[i];
  for(int i=0;i<N;i++)
  	if(X[i]>X[i+1])
    {
      Have+=Stock*X[i];
      if(i==N-1)
        break;
      Stock=Have/X[i+1];
      Have%=X[i+1];
    }
  cout<<Have<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   Stock=Have/X[i];
      |                ^
Language: C++

#include "../../../library/other/template.hpp"
int n,x[15],y[15],p[15];
lint ans[16];
int main(){
	std::cin>>n;
	rep(i,n)std::cin>>x[i]>>y[i]>>p[i];
	lint m=mypow(3,n);
	std::vector<int> nx,ny;
	std::fill(ans,ans+n+1,LINF);
	rep(i,m){
		int ni=i;
		nx.clear();ny.clear();
		nx.emplace_back(0);ny.emplace_back(0);
		rep(j,n){
			if(ni%3==1)nx.emplace_back(x[j]);
			if(ni%3==2)ny.emplace_back(y[j]);
			ni/=3;
		}
		int lines=nx.size()+ny.size()-2;
		std::sort(all(nx));std::sort(all(ny));
		nx.erase(std::unique(all(nx)),nx.end());
		ny.erase(std::unique(all(ny)),ny.end());
		lint res=0;
		rep(j,n){
			int cnt=INF;
			auto ite=std::lower_bound(all(nx),x[j]);
			if(ite!=nx.end())chmin(cnt,*ite-x[j]);
			if(ite!=nx.begin())chmin(cnt,x[j]-*std::prev(ite));
			ite=std::lower_bound(all(ny),y[j]);
			if(ite!=ny.end())chmin(cnt,*ite-y[j]);
			if(ite!=ny.begin())chmin(cnt,y[j]-*std::prev(ite));
			res+=(lint)cnt*p[j];
		}
		chmin(ans[lines],res);
	}
	rep(i,n+1)std::cout<<ans[i]<<std::endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: ../../../library/other/template.hpp: No such file or directory
    1 | #include "../../../library/other/template.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll              long long
#define rep(i,a,N)      for(ll i=(a);i<(N);i++)
#define INF             ((1LL<<62)-(1LL<<31))
#define max(p,q)        ((p)>(q)?(p):(q))
#define min(p,q)        ((p)<(q)?(p):(q))

int n;
int x[20],y[20],p[20];
ll ans[20];
ll dist[20];

void dfs(int k,int cnt){
	if(k==n){//集落数N=K
		ll sum=0;
		rep(i,0,n)sum+=dist[i]*p[i];//最短距離*人数の和
		ans[cnt]=min(ans[cnt],sum);
		return;
	}
	//素通り
	int temp[20];
	rep(i,0,n)temp[i]=dist[i];
	//memcpy(temp,dist,sizeof(dist))
	dfs(k+1,cnt);
	//x座標
	rep(i,0,n)dist[i]=min(temp[i],abs(x[i]-x[k]));
	dfs(k+1,cnt+1);
	//y座標
	rep(i,0,n)dist[i]=min(temp[i],abs(y[i]-y[k]));
	dfs(k+1,cnt+1);
}
 
 
int main(){
	scanf("%d",&n);
	rep(i,0,n)scanf("%d%d%d",x+i,y+i,p+i);
	rep(i,0,n)dist[i]=min(abs(x[i]),abs(y[i]));//各集落からX軸、Y軸どちらかまでの距離のうち最短距離をdist[]に格納
	rep(i,0,n)ans[i]=INF;//ans[]に極大値を格納
	dfs(0,0);
	

Compiler output:
main.c: In function 'main':
main.c:42:9: error: expected declaration or statement at end of input
   42 |         dfs(0,0);
      |         ^~~
Language: C++

#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long int;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    int n;
    cin >> n;
    int x[n],y[n],p[n],N=1ll<<n;
    for(int i=0;i<n;i++)
    	cin >> x[i] >> y[i] >> p[i] ;
    int ans[n+1],mx[N][n]={0},my[N][n]={0};
    fill(ans,ans+n+1,1e18);
    for(int s=0;s<N;s++){
    	for(int i=0;i<n;i++){
    		int u=min(abs(x[i]),abs(y[i]))*p[i];
    		int v=u;
    		for(int j=0;j<n;j++){
    			if(s&(1ll<<j)){
    				u=min(u,abs(x[i]-x[j])*p[i]);
    				v=min(v,abs(y[i]-y[j])*p[i]);
    			}
    		}
    		mx[s][i]=u,my[s][i]=v;
    	}
    }
    for(int s=0;s<N;s++){
    	int m=N-1-s;
    	for(int t=m;;t=(t-1)&m){
    		int r=0;
    		for(int i=0;i<n;i++)
    			r+=min(mx[s][i],my[t][i]);
    		int c=__builtin_popcount(s)+__builtin_popcount(t);
    		ans[c]=min(ans[c],r);
    		if(!t)break;
    	}
    }
    for(int i=0;i<=n;i++)
    	cout << ans[i] << '\n';
	return 0;
}



Compiler output:
a.cc:18:19: error: declaration does not declare anything [-fpermissive]
   18 | typedef long long int;
      |                   ^~~
a.cc:21:14: error: 'll' was not declared in this scope; did you mean 'ld'?
   21 | typedef pair<ll,ll> pll;
      |              ^~
      |              ld
a.cc:21:17: error: 'll' was not declared in this scope; did you mean 'ld'?
   21 | typedef pair<ll,ll> pll;
      |                 ^~
      |                 ld
a.cc:21:19: error: template argument 1 is invalid
   21 | typedef pair<ll,ll> pll;
      |                   ^
a.cc:21:19: error: template argument 2 is invalid
a.cc:22:1: error: 'll' does not name a type; did you mean 'pll'?
   22 | ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
      | ^~
      | pll
Language: C++

#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

int N;
long long int X[20], Y[20], P[20];

long long int dp[1 << 17][20];

long long int INF = (long long int) 1e18-1;

long long int val[1 << 17]; // 集合Sを決めたときの最小値

int main(void) {

	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> X[i] >> Y[i] >> P[i];
	}

	for (int i = 0; i < (1 << N); i++) {
		for (int k = 0; k <= N; k++) {
			dp[i][k] = INF;
		}
	}

	for (int k = 0; k < pow(3, N); k++) {
		int tmp = k;
		int b = 0;
		vector<long long int> VX, VY;
		int pos = 1;
		for (int i = 0; i < N; i++) {
			b *= 2;
			if (tmp % 3 == 1) { VX.push_back(pos); b++; }
			else if (tmp % 3 == 2) { VY.push_back(pos); b++; }
			tmp /= 3; pos++;
		}
			/*cout << "b= " << bitset<3>(b) << endl;
			cout << "VX: "; for (auto x : VX) { cout << " " << x; }cout << endl;
			cout << "VY: "; for (auto y : VY) { cout << " " << y; }cout << endl;*/
			long long int sum = 0;
			for (auto u : VX) {  sum += abs(X[u])*P[u]; }
			for (auto u : VY) { sum += abs(Y[u])*P[u]; }
			dp[b][0] = min(dp[b][0], sum);
	}


	for (int k = 0; k < (1 << N); k++) {
		val[k] = INF;
	}

	for (int k = 0; k < (1 << N); k++) {
		for (int u = 1; u <= N; u++) {
			long long int tmp = 0;
			for (int i = 1; i <= N; i++) {
				if (k & (1<<(N-i))) {
					tmp += abs(X[i] - X[u])*P[i];
				}
			}
			val[k] = min(val[k], tmp);
		}
		for (int u = 1; u <= N; u++) {
			long long int tmp = 0;
			for (int i = 1; i <= N; i++) {
				if (k& (1<<(N-i))) {
					tmp += abs(Y[i] - Y[u])*P[i];
				}
			}
			val[k] = min(val[k], tmp);
		}
	}

	/*for (int k = 0; k < (1 << N); k++) {
		cout << "val[" << bitset<3>(k) << "]= " << val[k] << endl;
	}*/

	for (int k = 1; k <=  N; k++) {
		for (int m = 0; m < pow(3, N); m++) {
			int s = 0; int t = 0;
			int tmp = m;
			for (int i = 1; i <= N; i++) {
				s *= 2; t *= 2;
				if (tmp % 3 == 1) { s++; }
				else if (tmp % 3 == 2) { t++; }
				tmp /= 3;
			}
			//cout << "s= " << bitset<3>(s) << " t= " << bitset<3>(t) << " s|t= " << bitset<3>(s | t) << endl;
			//cout << dp[s][k - 1] + val[t] << endl;
			dp[s | t][k] = min(dp[s | t][k], dp[s][k - 1] + val[t]);

		}
	}

	
	for (int k = 0; k <= N; k++) {
		cout << dp[(1 << N) - 1][k] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:29: error: 'pow' was not declared in this scope
   31 |         for (int k = 0; k < pow(3, N); k++) {
      |                             ^~~
a.cc:82:37: error: 'pow' was not declared in this scope
   82 |                 for (int m = 0; m < pow(3, N); m++) {
      |                                     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 1000000007;

vector<int> X, Y, P;
vector<pair<int, int>> cx, cy;
int N;
bool xg[18], yg[18];
ll D[18];
ll R[18];

void chmin(ll& A, ll B) {
	A = min(A, B);
}

void dfs(int c, int k) {
	if (c == N) {
		for (int i = 0;i < N;i++)D[i] = min(abs(X[i]), abs(Y[i]));
		ll mv = -MOD;
		for (int i = 0;i < N;i++) {
			if (xg[i]) {
				mv = cx[i].first;
			}
			chmin(D[cx[i].second], cx[i].first - mv);
		}
		mv = MOD;
		for (int i = N - 1;i >= 0;i--) {
			if (xg[i]) {
				mv = cx[i].first;
			}
			chmin(D[cx[i].second], mv - cx[i].first);
		}
		mv = -MOD;
		for (int i = 0;i < N;i++) {
			if (yg[i]) {
				mv = cy[i].first;
			}
			chmin(D[cy[i].second], cy[i].first - mv);
		}
		mv = MOD;
		for (int i = N - 1;i >= 0;i--) {
			if (yg[i]) {
				mv = cy[i].first;
			}
			chmin(D[cy[i].second], mv - cy[i].first);
		}

		ll S = 0;
		for (int i = 0;i < N;i++) {
			S += D[i] * P[i];
		}
		R[k] = min(R[k], S);
		return;
	}

	xg[c] = 1;
	dfs(c + 1, k + 1);
	xg[c] = 0;

	yg[c] = 1;
	dfs(c + 1, k + 1);
	yg[c] = 0;

	dfs(c + 1, k);
}

int main() {
	cin >> N;
	X = Y = P = vector<int>(N);
	cx = cy = vector<pair<int, int>>(N);

	for (int i = 0;i < N;i++) {
		cin >> X[i] >> Y[i] >> P[i];
		cx[i] = { X[i],i };
		cy[i] = { Y[i],i };
		R[i] = INT64_MAX;
	}
	sort(all(cx));
	sort(all(cy));
	for (int i = 0;i < N;i++)rx[i] = cx[i].second, ry[i] = cy[i].second;

	R[N] = INT64_MAX;
	dfs(0, 0);

	for (int i = 0;i <= N;i++) {
		cout << R[i] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:34: error: 'rx' was not declared in this scope; did you mean 'cx'?
   82 |         for (int i = 0;i < N;i++)rx[i] = cx[i].second, ry[i] = cy[i].second;
      |                                  ^~
      |                                  cx
a.cc:82:56: error: 'ry' was not declared in this scope; did you mean 'cy'?
   82 |         for (int i = 0;i < N;i++)rx[i] = cx[i].second, ry[i] = cy[i].second;
      |                                                        ^~
      |                                                        cy
Language: C++

using ll = long long;
using P = pair<int,int>;
#define chmin(x,y) x=min(x,y)

const ll INF = 1e18;

ll dp[20][20];

vector<ll> calc(vector<P>& a) {
  int n = a.size();
  sort(a.begin(), a.end());
  rep(i,n+1) rep(j,n+1) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(l,n) {
    for(int r = l+1;r <= n;++r){
      {
        ll now = INF;
        for(int k = l;k < r;++k){
          ll s = 0;
          for(int i = l;i < r;++i){
            s += abs(a[i].first-a[k].first)*ll(a[i].second);
          }
          chmin(now, s);
        }
        rep(j,n) chmin(dp[r][j+1], dp[l][j]+now);
      }
      {
        ll now = 0;
        for(int i = l;i < r;++i){
          now += abs(a[i].first)*ll(a[i].second);
        }
        rep(j,n+1) chmin(dp[r][j],dp[l][j]+now);
      }
    }
  }
  vector<ll> res(n+1,INF);
  rep(j,n+1) res[j] = dp[n][j];
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> x(n),y(n),p(n);
  rep(i,n)cin >> x[i] >> y[i] >> p[i];
  vector<ll> ans(n+1, INF);
  rep(s,1<<n){
    vector<P> ax,ay;
    rep(i,n){
      if(s>>i&1)ax.emplace_back(x[i], p[i]);
      else ay.emplace_back(y[i], p[i]);
    }
    vector<ll> dx = calc(ax);
    vector<ll> dy = calc(ay);
    rep(i,dx.size())rep(j,dy.size())
    {


      ans[i+j] = min(ans[i+j], dx[i]+dy[j]);
    }
  }

  rep(i,n+1){
    cout << ans[i] <<endl;
  }
  return 0;
}


Compiler output:
a.cc:2:11: error: 'pair' does not name a type
    2 | using P = pair<int,int>;
      |           ^~~~
a.cc:9:1: error: 'vector' does not name a type
    9 | vector<ll> calc(vector<P>& a) {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:43:3: error: 'cin' was not declared in this scope
   43 |   cin >> n;
      |   ^~~
a.cc:44:3: error: 'vector' was not declared in this scope
   44 |   vector<int> x(n),y(n),p(n);
      |   ^~~~~~
a.cc:44:10: error: expected primary-expression before 'int'
   44 |   vector<int> x(n),y(n),p(n);
      |          ^~~
a.cc:45:7: error: 'i' was not declared in this scope
   45 |   rep(i,n)cin >> x[i] >> y[i] >> p[i];
      |       ^
a.cc:45:3: error: 'rep' was not declared in this scope
   45 |   rep(i,n)cin >> x[i] >> y[i] >> p[i];
      |   ^~~
a.cc:46:12: error: expected primary-expression before '>' token
   46 |   vector<ll> ans(n+1, INF);
      |            ^
a.cc:46:14: error: 'ans' was not declared in this scope
   46 |   vector<ll> ans(n+1, INF);
      |              ^~~
a.cc:47:7: error: 's' was not declared in this scope
   47 |   rep(s,1<<n){
      |       ^
Language: C++

8
2 2 286017
3 1 262355
2 -2 213815
1 -3 224435
-2 -2 136860
-3 -1 239338
-2 2 217647
-1 3 141903

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 8
      | ^
Language: C++

#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

struct P {
  ll x, y, p;
  P () {}
  P (ll x, ll y, ll p): x(x), y(y), p(p) {}
};


int main(void) {
  ll N;
  cin >> N;
  vector<P> p(N);
  vector<ll> ans(N, 123456789);
  rep(i, N) {
    cin >> p[i].x >> p[i].y >> p[i].p;
  }

  vector<ll> xs, ys;
  rep(hBit, 1 << N) rep(vBit, 1 << N) {
    ll sumhv = popcount<uint64_t>(hBit) + popcount<uint64_t>(vBit);
    if (sumhv > N) continue;
    xs.clear();
    ys.clear();
    xs.push_back(0);
    ys.push_back(0);
    rep(i, N) {
      if ((vBit >> i) &1) xs.push_back(p[i].x);
      if ((hBit >> i) &1) ys.push_back(p[i].y);
    }
    sort(begin(xs), end(xs));
    sort(begin(ys), end(ys));

    //if (sumhv == 1) {
    //  cout << "-x-" << endl;
    //  for (auto x : xs)
    //    cout << x << endl;
    //  cout << "-y-" << endl;
    //  for (auto y : ys)
    //    cout << y << endl;
    //}

    ll t = 0;
    rep(i, N) {
      ll minLen = 123456789;

      auto xt = lower_bound(begin(xs), end(xs), p[i].x);
      if (xt != end(xs))   chmin(minLen, *xt - p[i].x);
      if (xt != begin(xs)) chmin(minLen, p[i].x - *prev(xt));

      auto yt = lower_bound(begin(ys), end(ys), p[i].y);
      if (yt != end(ys))   chmin(minLen, *yt - p[i].y);
      if (yt != begin(ys)) chmin(minLen, p[i].y - *prev(yt));

      t += minLen * p[i].p;
    }
    chmin(ans[sumhv], t);
  }

  rep(K, N+1)
    cout << ans[K] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: 'popcount' was not declared in this scope
   32 |     ll sumhv = popcount<uint64_t>(hBit) + popcount<uint64_t>(vBit);
      |                ^~~~~~~~
a.cc:32:33: error: expected primary-expression before '>' token
   32 |     ll sumhv = popcount<uint64_t>(hBit) + popcount<uint64_t>(vBit);
      |                                 ^
a.cc:32:60: error: expected primary-expression before '>' token
   32 |     ll sumhv = popcount<uint64_t>(hBit) + popcount<uint64_t>(vBit);
      |                                                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
#define rep(i,n)for(i=0;i<n;i++)
void cm(ll &a,ll b){if(a>b)a=b;}
int main(void){ll n,s,k,v,i;cin>>n;vl x(n),y(n),p(n),a(n+1,1LL<<60);vector<vl>X(n),Y(n);rep(i,n)cin>>x[i]>>y[i]>>p[i];rep(i,n){X[i]=vl(1<<n,abs(x[i])),Y[i]=vl(1<<n,abs(y[i]));rep(b,1<<n)rep(j,n)if(b&1<<j)cm(X[i][b],abs(x[i]-x[j])),cm(Y[i][b],abs(y[i]-y[j]));}rep(b,1<<n){s=b;do{k=__builtin_popcountl(b),v=0;rep(i,n)v+=p[i]*min(X[i][s],Y[i][b&~s]);cm(a[k],v),s=(s-1)&b;}while(s!=b);}rep(i,n+1)cout<<a[i]<<endl;return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:180: error: 'b' was not declared in this scope
    7 | int main(void){ll n,s,k,v,i;cin>>n;vl x(n),y(n),p(n),a(n+1,1LL<<60);vector<vl>X(n),Y(n);rep(i,n)cin>>x[i]>>y[i]>>p[i];rep(i,n){X[i]=vl(1<<n,abs(x[i])),Y[i]=vl(1<<n,abs(y[i]));rep(b,1<<n)rep(j,n)if(b&1<<j)cm(X[i][b],abs(x[i]-x[j])),cm(Y[i][b],abs(y[i]-y[j]));}rep(b,1<<n){s=b;do{k=__builtin_popcountl(b),v=0;rep(i,n)v+=p[i]*min(X[i][s],Y[i][b&~s]);cm(a[k],v),s=(s-1)&b;}while(s!=b);}rep(i,n+1)cout<<a[i]<<endl;return 0;}
      |                                                                                                                                                                                    ^
a.cc:5:21: note: in definition of macro 'rep'
    5 | #define rep(i,n)for(i=0;i<n;i++)
      |                     ^
a.cc:7:191: error: 'j' was not declared in this scope
    7 | int main(void){ll n,s,k,v,i;cin>>n;vl x(n),y(n),p(n),a(n+1,1LL<<60);vector<vl>X(n),Y(n);rep(i,n)cin>>x[i]>>y[i]>>p[i];rep(i,n){X[i]=vl(1<<n,abs(x[i])),Y[i]=vl(1<<n,abs(y[i]));rep(b,1<<n)rep(j,n)if(b&1<<j)cm(X[i][b],abs(x[i]-x[j])),cm(Y[i][b],abs(y[i]-y[j]));}rep(b,1<<n){s=b;do{k=__builtin_popcountl(b),v=0;rep(i,n)v+=p[i]*min(X[i][s],Y[i][b&~s]);cm(a[k],v),s=(s-1)&b;}while(s!=b);}rep(i,n+1)cout<<a[i]<<endl;return 0;}
      |                                                                                                                                                                                               ^
a.cc:5:21: note: in definition of macro 'rep'
    5 | #define rep(i,n)for(i=0;i<n;i++)
      |                     ^
a.cc:7:264: error: 'b' was not declared in this scope
    7 | int main(void){ll n,s,k,v,i;cin>>n;vl x(n),y(n),p(n),a(n+1,1LL<<60);vector<vl>X(n),Y(n);rep(i,n)cin>>x[i]>>y[i]>>p[i];rep(i,n){X[i]=vl(1<<n,abs(x[i])),Y[i]=vl(1<<n,abs(y[i]));rep(b,1<<n)rep(j,n)if(b&1<<j)cm(X[i][b],abs(x[i]-x[j])),cm(Y[i][b],abs(y[i]-y[j]));}rep(b,1<<n){s=b;do{k=__builtin_popcountl(b),v=0;rep(i,n)v+=p[i]*min(X[i][s],Y[i][b&~s]);cm(a[k],v),s=(s-1)&b;}while(s!=b);}rep(i,n+1)cout<<a[i]<<endl;return 0;}
      |                                                                                                                                                                                                                                                                        ^
a.cc:5:21: note: in definition of macro 'rep'
    5 | #define rep(i,n)for(i=0;i<n;i++)
      |                     ^