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

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

int main(){
     int n;
     cin >> n;
     int a = 1000;
     int b = 0;
     int c[n];
     for(int i = 0; i < n; i++){
          cin >> c[i];
     }
     int u = 0;
     int v = c[n-1];
     int v2 = c[0];
     for(int i = 0; i < n - 1; i++){
          if(c[i] < c[i+1]){
               v = i;
               l1 = i;
               break;
          }
          
     }
     for(int j = n - 1; j > 0; j--){
          if(c[j] > c[j - 1]){
               v2 = j;
               if(v >= v2){
                    cout << "1000"; return 0;
               }
               break;
          }
     }
     b = 1000 / c[v]; a = 1000 - (b * c[v]);
     for(int game = v; game <= v2; game++){
          if(u == 0){
               if(c[game]<c[game+1]){
                    break;
               }
               a = a + b * c[game];
               b = 0;
               u = 1;
          }
          if(u == 1){
               if(c[game]>c[game+1]){
                    break;
               }
               b = a / c[game];
               a = a - (b * c[game]);
               u = 0;
          }
     }
     cout << a;
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 'l1' was not declared in this scope; did you mean 'y1'?
   19 |                l1 = i;
      |                ^~
      |                y1
Language: C++

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


int main (){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int asset = 1000;
  int stock = 0;
  
  rep(i, n-1){
    if(a[i] < a[i+1]){
      int add = asset / a[i];
      stock += add;
      asset -= a[i] * add;
    }if(a[i] > a[i+1]){     
      if(a[i-1] < a[i]){
        asset += a[i] * stock;
        stock = 0;
      }
      int t =i;
      while(a[t-1] == a[t]){
        t--;
        if(a[i-1] < a[i]){
        asset += a[i] * stock;
        stock = 0;
      }
    }
  }
  asset += a[n-1] * stock;
  
  cout << asset << endl; 
  
  return 0;
}

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

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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  int n
  int a[100];
  ll mo=1000,st=0;
  
  scanf("%d", &n);
  rep(i, n){
    scanf("%d", &a[i]);
  }
  
  rep(i, n){
    if(i==0){
      if(a[0]<a[1]){
        st=mo/a[0];
        mo-=st*a[0];
      }
    }
    else if(i==n-1){
      if(st==0)break;
      mo+=st*a[i];
      st=0;
    }
    else{
      if(a[i-1]<=a[i]&&a[i]>a[i+1]){
        if(st==0)continue;
        mo+=st*a[i];
        st=0;
      }
      else if(a[i-1]>=a[i]&&a[i]<a[i+1]){
        if(st>0)continue;
        st=mo/a[i];
        mo-=st*a[i];
      }
    }
  }
      
  
  printf("%d",mo);
                
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: expected initializer before 'int'
   18 |   int a[100];
      |   ^~~
a.cc:21:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   21 |   scanf("%d", &n);
      |                ^
      |                yn
a.cc:23:18: error: 'a' was not declared in this scope
   23 |     scanf("%d", &a[i]);
      |                  ^
a.cc:28:10: error: 'a' was not declared in this scope
   28 |       if(a[0]<a[1]){
      |          ^
a.cc:35:14: error: 'a' was not declared in this scope
   35 |       mo+=st*a[i];
      |              ^
a.cc:39:10: error: 'a' was not declared in this scope
   39 |       if(a[i-1]<=a[i]&&a[i]>a[i+1]){
      |          ^
Language: C++

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

int main(void) {
	int n;
	cin >> n;
	__int64 kab = 0;
	__int64 m(1000);
	int b;
	vector<int> a;
	for (int i = 0; i < n; i++) {
		cin >> b;
		a.push_back(b);
	}
	__int64 memo = 1000;
	for (int i = 0; i < n-1; i++) {
		if (a[i] < a[i + 1]) {
			memo = m + kab * a[i];
			memo = memo / a[i];
			if (memo > kab) {
				m = m + kab * a[i];
				kab = m / a[i];
				m = m % a[i];
			}
		}
		else {
			m += kab * a[i];
			kab = 0;
		}
	}
	m += kab * a[n - 1];
	cout << m;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    8 |         __int64 kab = 0;
      |         ^~~~~~~
      |         __int64_t
a.cc:9:16: error: expected ';' before 'm'
    9 |         __int64 m(1000);
      |                ^~
      |                ;
a.cc:16:16: error: expected ';' before 'memo'
   16 |         __int64 memo = 1000;
      |                ^~~~~
      |                ;
a.cc:19:25: error: 'memo' was not declared in this scope
   19 |                         memo = m + kab * a[i];
      |                         ^~~~
a.cc:19:32: error: 'm' was not declared in this scope
   19 |                         memo = m + kab * a[i];
      |                                ^
a.cc:19:36: error: 'kab' was not declared in this scope
   19 |                         memo = m + kab * a[i];
      |                                    ^~~
a.cc:28:25: error: 'm' was not declared in this scope
   28 |                         m += kab * a[i];
      |                         ^
a.cc:28:30: error: 'kab' was not declared in this scope
   28 |                         m += kab * a[i];
      |                              ^~~
a.cc:32:9: error: 'm' was not declared in this scope
   32 |         m += kab * a[n - 1];
      |         ^
a.cc:32:14: error: 'kab' was not declared in this scope
   32 |         m += kab * a[n - 1];
      |              ^~~
Language: C++

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

int main(){
     int n;
     cin >> n;
     int a = 1000;
     int b = 0;
     int c[n];
     for(int i = 0; i < n; i++){
          cin >> c[i];
     }
     int u = 0;
     int t;
     int v = c[n-1];
     int v2 = c[0];
     int l1;
     for(int i = 0; i < n - 1; i++){
          if(c[i] < c[i+1]){
               v = i;
               l1 = i;
               break;
          }
          
     }
     for(int j = n - 1; j > 0; j--){
          if(c[j] > c[j - 1]){
               v2 = j;
               if(v >= v2){
                    cout << "1000"; return 0;
               }
               break;
          }
     }
     b = 1000 / c[v]; a = 1000 - (b * c[v]);
     for(int game = v; game <= v2; game++){
          if(u = 0){
               if(c[game]<c[game+1]){
                    break;
               }
               a = a + b * c[game];
               b = 0;
               u = 1;
          }
          if(u = 1){
               if(c[game]>c[game+1]){
                    break
               }
               b = a / c[game];
               a = a - (b * c[game]);
               u = 0;
          }
     }
     cout << a;
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:26: error: expected ';' before '}' token
   47 |                     break
      |                          ^
      |                          ;
   48 |                }
      |                ~
Language: C++

include <bits/stdc++.h>
int main() {
    using namespace std;
    int n;
    cin>>n;
    long long sy=1000,temp=0;
    int num[n+1];
    int cha[n+1]={};
    for(int i=0;i<n;i++)
    {
        cin>>num[i];
        if(i>=1&&i<=n-1)
        {
            cha[i]=num[i]-num[i-1];
            if(cha[i]>0)
            {
                temp=sy/num[i-1];
                sy=sy+temp*cha[i];
                //	cout<<sy<<endl;       // 剩余的钱数
            }
        }
    }
    cout<<sy<<endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL<<60;
int main() {
  int N; cin>>N;
  vector<int> A(N);
  rep(i,N) cin>>A.at(i);
  vector<int> T;
  if(A.at(0)<A.at(1)) T.push_back(A.at(0));
  for(int i=1;i<N-1;i++){
    if(A.at(i)==A.at(i+1)) continue;
    if(A.at(i)>=A.at(i-1) && A.at(i)>A.at(i+1)) T.push_back(A.at(i));
    if(A.at(i)<=A.at(i-1) && A.at(i)<A.at(i+1)) T.push_back(A.at(i));
  }
  if(A.at(N-1)>=A.at(N-2)) T.push_back(A.at(N-1));
  int S=T.size();
  if(S>1&&T.at(S-1)<T.at(S-2)){
    T.pop_back();
    S--;
  }
  if(S<=1) cout<<1000;
  else{
    if(T.at(0)>T.at(1)){
      rep(i,S-1){
        T.at(i)=T.at(i+1);
      }
      T.pop_back();
      S--;
    }
    if(S<=1){
      cout<<1000;
      break;
    }
  pair<int64_t,int64_t> M(1000/T.at(0),1000%T.at(0));
    int i=1;
  while(i<S-1){
    auto a=M.first,b=M.second;//aが株の数、bが現金
    auto c=a*T.at(i)+b;
    if(a*T.at(i+2)+b < (c/T.at(i+1))*T.at(i+2)+c%T.at(i+1)){
      M.first=c/T.at(i+1);
      M.second=c%T.at(i+1);
    }
    i+=2;
  }
  cout<<M.second+M.first*T.at(S-1);
  }                             
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:7: error: break statement not within loop or switch
   33 |       break;
      |       ^~~~~
Language: C++

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

int main(){
     int n;
     cin >> n;
     int a = 1000;
     int b = 0;
     int c[n];
     for(int i = 0; i < n; i++){
          cin >> c[i];
     }
     int u = 0;
     int t;
     int v = c[n-1];
     int v2 = c[0];
     int l1;
     for(int i = 0; i < n - 1; i++){
          if(c[i] < c[i+1]){
               v = i;
               l1 = i;
               break;
          }
          
     }
     for(int j = n - 1; j > 0; j--){
          if(c[j] > c[j - 1]){
               v2 = j;
               if(v >= v2){
                    cout << "1000"; return 0;
               }
               break;
          }
     }
     b = 1000 / c[v]; a = 1000 - (b * c[v]);
     for(int new = v; new <= v2; new++){
          if(u = 0){
               if(c[new]<c[new+1]){
                    break;
               }
               a = a + b * c[new];
               b = 0;
               u = 1;
          }
          if(u = 1){
               if(c[new]>c[new+1]){
                    break
               }
               b = a / c[new];
               a = a - (b * c[new]);
               u = 0;
          }
     }
     cout << a;
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:14: error: expected unqualified-id before 'new'
   36 |      for(int new = v; new <= v2; new++){
      |              ^~~
a.cc:36:13: error: expected ';' before 'new'
   36 |      for(int new = v; new <= v2; new++){
      |             ^~~~
      |             ;
a.cc:36:18: error: expected type-specifier before '=' token
   36 |      for(int new = v; new <= v2; new++){
      |                  ^
a.cc:36:27: error: expected type-specifier before '<=' token
   36 |      for(int new = v; new <= v2; new++){
      |                           ^~
a.cc:36:32: error: expected ')' before ';' token
   36 |      for(int new = v; new <= v2; new++){
      |         ~                      ^
      |                                )
a.cc:36:37: error: expected type-specifier before '++' token
   36 |      for(int new = v; new <= v2; new++){
      |                                     ^~
Language: C++

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

int main(void) {
	int n;
	cin >> n;
	__int128 kab = 0;
	___int128 m(1000);
	int b;
	vector<int> a;
	for (int i = 0; i < n; i++) {
		cin >> b;
		a.push_back(b);
	}
	__int128 memo = 1000;
	for (int i = 0; i < n-1; i++) {
		if (a[i] < a[i + 1]) {
			memo = m + kab * a[i];
			memo = memo / a[i];
			if (memo > kab) {
				m = m + kab * a[i];
				kab = m / a[i];
				m = m % a[i];
			}
		}
		else {
			m += kab * a[i];
			kab = 0;
		}
	}
	m += kab * a[n - 1];
	cout << m;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: '___int128' was not declared in this scope; did you mean '__int128'?
    9 |         ___int128 m(1000);
      |         ^~~~~~~~~
      |         __int128
a.cc:19:32: error: 'm' was not declared in this scope
   19 |                         memo = m + kab * a[i];
      |                                ^
a.cc:28:25: error: 'm' was not declared in this scope
   28 |                         m += kab * a[i];
      |                         ^
a.cc:32:9: error: 'm' was not declared in this scope
   32 |         m += kab * a[n - 1];
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int N;
vector<int> A(80);
int mx=0;

void DP(int NumK, int Cash, int Day){
  
  if(Day==N-1){
    mx=max(Cash+NumK*A[Day], mx);
    return;
  }
  if(Num==0 && A[Day]<=A[Day-1]){
    DP(0, Cash+NumK*A[Day], Day+1);
    DP(NumK, Cash, Day+1);    
  }else(Num!=0 && A[Day]>A[Day-1]){
    DP(NumK+Cash/A[Day], Cash-Cash/A[Day]*A[Day], Day+1);
    DP(NumK, Cash, Day+1);
  }else{
    DP(NumK+Cash/A[Day], Cash-Cash/A[Day]*A[Day], Day+1);
    DP(0, Cash+NumK*A[Day], Day+1);
    DP(NumK, Cash, Day+1);
  }
}

int main(){
  
  cin>>N;
  for(int i=0; i<N; i++){
    cin>>A[i];
  }
  DP(0, 1000, 0);
  cout<<mx<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'void DP(int, int, int)':
a.cc:13:6: error: 'Num' was not declared in this scope; did you mean 'NumK'?
   13 |   if(Num==0 && A[Day]<=A[Day-1]){
      |      ^~~
      |      NumK
a.cc:19:4: error: 'else' without a previous 'if'
   19 |   }else{
      |    ^~~~
Language: C++

ing namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> a(n,0);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    ll gold = 1000;
    int kb = 0;
    
    for(int i = 0;i < n;i++){
        for(int k = i+1;k < n;k++){
            if(a[i] < a[k]){
                kb = gold/a[i];
                gold = gold - a[i]*kb;
                gold = gold + a[k]*kb;
                kb = 0;
                i = k;
                
            }else if(a[i] > a[k]){
                i = k;
                break;
            }
        }
    }
    cout << gold << endl;
}


Compiler output:
a.cc:1:1: error: 'ing' does not name a type; did you mean 'int'?
    1 | ing namespace std;
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n;
      |     ^~~
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a(n,0);
      |     ^~~~~~
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a(n,0);
      |            ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a[i];
      |                ^
a.cc:16:16: error: 'a' was not declared in this scope
   16 |             if(a[i] < a[k]){
      |                ^
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << gold << endl;
      |     ^~~~
a.cc:29:21: error: 'endl' was not declared in this scope
   29 |     cout << gold << endl;
      |                     ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  while(true)coout<<8194<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: 'coout' was not declared in this scope
    5 |   while(true)coout<<8194<<endl;
      |              ^~~~~
Language: C++

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

int main(){
  int n;
  int money1=1000;
  int money2=1000;
  int count=0;
  cin >> n;
  vector<int> a(300);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<n-1;i++){
    if(a[i]+<a[i+1]){
      count = money1/a[i];
      money1 -= count*a[i];//買う
    }
    money1 += count*a[i+1];//売る
    count = 0;
  }
    for(int i=0;i<n-1;i++){
    if(a[i]+5<a[i+1]){
      count = money2/a[i];
      money2 -= count*a[i];//買う
    }
    money2 += count*a[i+1];//売る
    count = 0;
  }
  
  cout << max(money1,money2) << endl;
}
      
      
  



Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: expected primary-expression before '<' token
   16 |     if(a[i]+<a[i+1]){
      |             ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    int A[N+1];

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

    unsigned long int currentMoney=1000,kabu=0;
    for (int i = 1 ; i<N ; i++) {
        if ( A[i] < A[i + 1] ) {
            kabu += currentMoney / A[i];
            currentMoney = currentMoney % A[i];
        } else if ( A[i] > A[i+1] ) {
            currentMoney += kabu * A[i];
            kabu = 0;
        }

        // cout << "currentMoney" << currentMoney << endl;
        // cout << "kabu" << kabu << endl;
    }

    if (kabu != 0){
        currentMoney += kabu * A[N];
    }

    cout << currentMoney << endl;


    return 0;
}


Compiler output:
a.cc:21:10: error: stray '\16' in program
   21 |         }<U+000E>
      |          ^~~~~~~~
Language: C++

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

int main() {
    int N;
    cin >> N;
    int A[N+1];

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

    unsigned long int currentMoney=1000,kabu=0;
    for (int i = 1 ; i<N ; i++) {
        if ( A[i] < A[i + 1] ) {
            kabu += currentMoney / A[i];
            currentMoney = currentMoney % A[i];
        } else if ( A[i] > A[i+1] ) {
            currentMoney += kabu * A[i];
            kabu = 0;
        }

        // cout << "currentMoney" << currentMoney << endl;
        // cout << "kabu" << kabu << endl;
    }

    if (kabu != 0){
        currentMoney += kabu * A[N];
    }

    cout << currentMoney << endl;


    return 0;
}


Compiler output:
a.cc:15:33: error: stray '\16' in program
   15 |         if ( A[i] < A[i + 1] ) {<U+000E>
      |                                 ^~~~~~~~
a.cc:20:22: error: stray '\16' in program
   20 |             kabu = 0;<U+000E>
      |                      ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    map<int,int>mp;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll my=1000,kabu=0;
    rep(i,n){
        mp[a[i]]--;
        bool l=false,h=false;
        for(int k=i+1;k<n;k++){
            if(a[i]>a[k]){
                l=true;
                if(h)break;
                else{
                    my += a[i]*kabu;
                    kabu=0;
                    break;
                }
            }
            if(a[i]<a[k]){
                h=true;
            }
        }
        bool l=false,h=false;
        for(int k=i+1;k<n;k++){
            if(a[i]>a[k]){
                l=true;
            }
            if(a[i]<a[k]){
                h=true;
                if(l)break;
                else {
                    int p =my/a[i];
                    kabu += p;
                    my-=a[i]*p;
                    break;
                }
            }
        }

        if(i==n-2 && a[i]<a[i+1]){
            int p =my/a[i];
            kabu += p;
            my-=a[i]*p;
        }
    }
    my+=kabu*a[n-1];
    cout<<my<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: redeclaration of 'bool l'
   39 |         bool l=false,h=false;
      |              ^
a.cc:24:14: note: 'bool l' previously declared here
   24 |         bool l=false,h=false;
      |              ^
a.cc:39:22: error: redeclaration of 'bool h'
   39 |         bool l=false,h=false;
      |                      ^
a.cc:24:22: note: 'bool h' previously declared here
   24 |         bool l=false,h=false;
      |                      ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool change(T& a, T b) { if (a != b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

ll dp[100][3000000];
ll a[100];
ll n;

int main(){
    cin >> n;
    for(ll i=1;i<=n;i++) cin >> a[i];
    dp[1][0]=1000;
    ll maxm=3000000;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<maxm;j++) dp[i][j]=-1;
    }
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<maxm;j++){
            if(dp[i][j]!=-1){
                chmax(dp[i+1][j],dp[i][j]);
                chmax(dp[i+1][0],dp[i][j]+a[i]*j);
                chmax(dp[i+1][j+dp[i][j]/a[i]],dp[i][j]%a[i]);
            }
        }
    }
    cout << dp[n+1][0] << endl;
}

Compiler output:
/tmp/ccOkavWb.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x1b2): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x269): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x2c2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOkavWb.o
a.cc:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOkavWb.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool change(T& a, T b) { if (a != b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

ll dp[100][9000000];
ll a[100];
ll n;

int main(){
    cin >> n;
    for(ll i=1;i<=n;i++) cin >> a[i];
    dp[1][0]=1000;
    ll maxm=9000000;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<maxm;j++) dp[i][j]=-1;
    }
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<maxm;j++){
            if(dp[i][j]!=-1){
                chmax(dp[i+1][j],dp[i][j]);
                chmax(dp[i+1][0],dp[i][j]+a[i]*j);
                chmax(dp[i+1][j+dp[i][j]/a[i]],dp[i][j]%a[i]);
            }
        }
    }
    cout << dp[n+1][0] << endl;
}

Compiler output:
/tmp/ccGB22sp.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x1b2): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x269): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x2c2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGB22sp.o
a.cc:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGB22sp.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {

int n; cin>>n;
  vector<int>a(n);
  rep(i,n){cin>>a.at(i);}
   vector<int>b(n-1);
  rep(i,n-1){if(a.at(i+1)>=a.at(i))b.at(i)=1;
             else{b.at(i)=0;}}
   vector<int>c(n-1);
  
  
  
  rep(j,n-2){
   if(b.at(j)!=b.at(j+1)&&b.at(j)==1){c.at(j)=9;}
   else if(b.at(j)!=b.at(j+1)&&b.at(j)==0){c.at(j)=8;}
  }
   if(b.at(n-2)==1){c.at(n-2)=9;}  else{c.at(n-2)=8;}
  
  rep(i,n-1){if(b.at(i)==1){c.at(i)=7;break;}}
  
  int ans=1000; int kabu=0; int max=0; 
  
  if(n==2){
    if(b.at(0)==1){max=1000%a.at(0)+a.at(1)*(1000/a.at(0));}
    else {max=1000}
                  }
  else{
  
  rep(i,n-1){
    if(c.at(i)==7){kabu+=ans/a.at(i);ans=ans%a.at(i); }
    if(c.at(i)==8){kabu+=ans/a.at(i+1);ans=ans%a.at(i+1); }
    if(c.at(i)==9){ans+=kabu*a.at(i+1);kabu=0;}

    if(max<ans){max=ans;}
  }}
  cout<<max<<endl;
 
  
  

  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:19: error: expected ';' before '}' token
   31 |     else {max=1000}
      |                   ^
      |                   ;
Language: C++

#include<bits/stdc++.h>
using namespace std ; 
# define pb push_back
# define ll long long
# define mp make_pair 
# define endl "\n"
# define vi vector<int>
# define vc vector<char>
# define vll vector<ll> 
# define pi pair<int,int> 
const int MOD = 1e9 + 7 ; 
const ll inf = 1e18 ; 


int rec(int cur , int pos, int cost, int stocks) {
	if(pos >= n) 
		return INT_MIN ; 
	if(stocks < 0)
		return INT_MIN ;
	int  i = pos ;  
	if(pos == n-1) {
		return stocks + cur*a[i] ; 
	}

	// option 0 pass 
	int t0 = rec(cur, pos + 1 , cost, stocks) ; 
	// option 1 buy
	int t1 = rec(cur + (stocks/a[i]) , pos + 1 , cost , stocks%a[i] ) ; 
	// option 2 sell 
	int t2 = rec(0 , pos+ 1 , cur*a[i] , stocks+cur*a[i]) ; 

	// option 3 sell and buy 
	int new_stocks  = stocks + cur*a[i] ; 
	int t3 = rec(new_stocks/a[pos] , pos + 1 , cost  , new_stocks%a[i]) ; 


	return max(max(t0,t1),max(t2,t3)) ; 
}

int main() {
	int n ; 
	cin >> n ; 
	vi a(n) ; 
	for(int i = 0 ; i < n ; ++i)
		cin >> a[i] ;
	ll ans = 1000 ; 
	//int max_so_far = 0 ; 
	for(int i = 1 ; i < n ; ++i) {
		if(a[i] >= a[i-1]) {
			//ans %= a[i-1] ; 
			int tmp = ans / a[i-1] ; 
			ans %= a[i-1] ; 
			ans += (ll)tmp*a[i] ; 
		}
	}
	cout << ans ; 
	return 0; 
}


Compiler output:
a.cc: In function 'int rec(int, int, int, int)':
a.cc:16:19: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 |         if(pos >= n)
      |                   ^
      |                   yn
a.cc:21:19: error: 'n' was not declared in this scope
   21 |         if(pos == n-1) {
      |                   ^
a.cc:22:37: error: 'a' was not declared in this scope
   22 |                 return stocks + cur*a[i] ;
      |                                     ^
a.cc:28:36: error: 'a' was not declared in this scope
   28 |         int t1 = rec(cur + (stocks/a[i]) , pos + 1 , cost , stocks%a[i] ) ;
      |                                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    vector<int> age[n];
    vector<int> sage[n];
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j])sage[i].push_back(j);
            else if(a[i]<a[j])age[i].push_back(j);
        }
    }
    int ans=0;
    int kane=1000;
    int kabu=0;
    int day=0;
    int MAX;
    while(1){
        if(kabu==0 && age[day].size()>0){
            kabu=kane/a[day];
            kane-=kabu*a[day];
            if(sage[age[day].at(0)].size()>0){
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u] && u < sage[age[day].at(0)].at(0))MAX=u;
                kane+=kabu*a[u];
                kabu=0;
                day=sage[age[day].at(0)].at(0);
            }
            else{
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u])MAX=u;
                kane+=kabu*a[MAX];
                kabu=0;
                break;
            }
        }
        else if(kabu==0 && age[day].size()==0)break;
    }
    ans=max(kane,ans);
    if(sage[0].size()>0){
    for(auto u:sage[0]){
        kane=1000;
        kabu=0;
        day=u;
    while(1){
        if(kabu==0 && age[day].size()>0){
            kabu=kane/a[day];
            kane-=kabu*a[day];
            if(sage[age[day].at(0)].size()>0){
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u] && u < sage[age[day].at(0)].at(0))MAX=u;
                kane+=kabu*a[u];
                kabu=0;
                day=sage[age[day].at(0)].at(0);
            }
            else{
                MAX=day;
                for(auto u:age[day])if(a[MAX]<a[u])MAX=u;
                kane+=kabu*a[MAX];
                kabu=0;
                break;
            }
        }
        else if(kabu==0 && age[day].size()==0)break;
    }
        ans=max(kane,ans);
        }
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: 'u' was not declared in this scope
   28 |                 kane+=kabu*a[u];
      |                              ^
Language: C++

#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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 (b < a) { a = b; return 1; } return 0; }




// ***************************************


int main(){

    ll N;
    cin >> N;
    vl A(N);
    cin >> A[0];
    ll n = 1;
    REP(i, N - 1){
        ll tmp;
        cin >> tmp;
        if (tmp == A[n - 1]) continue;
        A[n] = tmp;
        n++;
    }


    bool is_inc = (A[0] < A[1]);
    ll money = 1000;
    ll buy;
    ll sell = 0;
    if (is_inc) {buy = A[0];}
    FOR(i, 1, n - 1){
        if (is_inc && (A[i] > A[i + 1])){
            sell = A[i];
            money = money % buy + (money / buy) * sell;
            is_inc = false;
        }
        else if (!is_inc && A[i] < A[i + 1]) {
            buy = A[i];
            is_inc = true;
        }
    }
    
    if (is_inc){
        sell = A[n - 1];
        money = money % buy + (money / buy) * sell;
    }

    cout << money << endl;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'vl' was not declared in this scope; did you mean 'vll'?
   51 |     vl A(N);
      |     ^~
      |     vll
a.cc:52:12: error: 'A' was not declared in this scope
   52 |     cin >> A[0];
      |            ^
Language: C++

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

int main() {
  int n;
 
  
 
  cin >> n>; 
  int A[n];
  for(int i=0;i<n;i++){
  cin >> A[i];
  }
  int have =1000;
  int kabu =0;
  for(int i=0;i<n-1;i++){
  if(A[i]<=A[i+1]){
    kabu = have/A[i];
    have %= A[i];
  }else if(A[i]>A[i+1]){
    have += kabu * A[i];
    kabu =0;
  }
  }
  
    
  
   
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected primary-expression before ';' token
    9 |   cin >> n>;
      |            ^
Language: C++

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

int main(){
	int n;
	cin>>n;
	long long *a = new long long[n];
	for(int i=0;i<n;i++) cin>>a[i];
  
	long long amount=1000;
  
	for(int i=0;i<n;i++){
		int j=i+1;
		while(j<n && a[j]>=a[j-1]) j++;
		j--;
		long long diff=a[j]-a[i];
		if(diff<=0){
			i=j;
			continue;
		}
		long long no_buy =curr/a[i];
		long long remain =curr%a[i];
		long long profit =(a[j])*no_buy;
		curr=remain+profit;
		i=j;
	}
	cout<<max(curr,(long long)1000)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:35: error: 'curr' was not declared in this scope
   21 |                 long long no_buy =curr/a[i];
      |                                   ^~~~
a.cc:27:19: error: 'curr' was not declared in this scope
   27 |         cout<<max(curr,(long long)1000)<<endl;
      |                   ^~~~
Language: C++

#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <random>
#include <chrono>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

template<typename T> using maximum_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;
template<typename T> using minimum_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
std::istream& operator>>(std::istream &is, std::vector<T> &v)
{
  for (typename std::vector<T>::size_type i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}

using namespace std;

struct DPItem
{
  uint64_t money, stock, price;
  DPItem(uint64_t money, uint64_t stock, uint64_t price)
    : money(money), stock(stock), price(price) {}
  uint64_t operator()() const {
    return money + stock * price;
  }
  bool operator<(const DPItem &rhs) const {
    return (*this)() < rhs();
  }
  bool operator>(const DPItem &rhs) const {
    return (*this)() > rhs();
  }
};

const uint64_t M = 1e+5;

int main()
{
  uint64_t N;
  cin >> N;

  vector<uint64_t> A(N);
  cin >> A;

  vector<minimum_heap<DPItem>> dp(N + 1);
  dp[0].emplace(1000, 0, 0);
  N_TIMES(n, N) {
    uint64_t cnt = 0;
    while (!dp[n].empty() && cnt < M) {
      DPItem item = dp[n].top(); dp[n].pop();
      // 何もしない
      dp[n + 1].push(item);
      ++cnt;

      // 全株売却
      if (item.stock > 0 && item.price < A[n]) {
        if ((n == N - 1) || (n < N - 1 && A[n] > A[n + 1])) {
          dp[n + 1].emplace(item.money + item.stock * A[n], 0, 0);
          ++cnt;
        }
      }

      // 最大購入
      uint64_t c = item.money / A[n];
      if (item.stock == 0 && c > 0) {
        if ((n == N - 1) || (n < N - 1 && A[n] < A[n + 1])) {
          dp[n + 1].emplace(item.money % A[n], item.stock + c, A[n
          ++cnt;
        }
      }
    }
  }

  uint64_t max_money = 0;
  while (!dp[N].empty()) {
    DPItem item = dp[N].top(); dp[N].pop();
    max_money = max(max_money, item());
  }
  cout << max_money << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:13: error: expected ']' before 'cnt'
   87 |           ++cnt;
      |             ^~~
      |             ]
a.cc:87:13: error: expected ')' before 'cnt'
   87 |           ++cnt;
      |             ^~~
      |             )
a.cc:86:28: note: to match this '('
   86 |           dp[n + 1].emplace(item.money % A[n], item.stock + c, A[n
      |                            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll n;
   cin>>n;
   vector<ll>v(n);
   for(int i=0;i<n;i++) cin>>v[i];
   ll i=0,yen=1000;
   while(i<(n-1))
   {
       while(i<n-1 && v[i+1]<=v[i]) i++;
       
       ll buy=i;
       
       while(i<n && v[i]>=v[i-1])
       {
           i++;
       }
       ll sell=i-1;
       
       yen=max(yen,(yen%v[buy]) + (yen/v[buy] )* v[sell])
   }
  cout<<yen<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:58: error: expected ';' before '}' token
   25 |        yen=max(yen,(yen%v[buy]) + (yen/v[buy] )* v[sell])
      |                                                          ^
      |                                                          ;
   26 |    }
      |    ~
Language: Java

import javafx.util.Pair;

import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;++i) {
            a[i]=sc.nextInt();
        }
//        int dp[][][]=new int[80][20000][];
//
//        for(int i[][]:dp)
//            for(int )

        System.out.println(maxM(1000,0,a,0,new HashMap<>()));
    }
    public static int maxM(int lmoney, int i, int a[], int stock, HashMap<Integer,HashMap<Pair<Integer,Integer>,Integer>> dp) {
        if(i==a.length)
            return lmoney;
        Pair<Integer,Integer> p=new Pair(lmoney,stock);
        if(dp.containsKey(i)&&dp.get(i).containsKey(p))
            return dp.get(i).get(p);
        int stocks=lmoney/a[i];
        int max=lmoney;
        for(int j=0;j<=stocks;++j) {
            int aa=lmoney-a[i]*j;
            max=Math.max(max,maxM(aa,i+1,a,stock+j,dp));
        }
        for(int j=1;j<=stock;++j) {
            int aa=lmoney+a[i]*j;
            max=Math.max(max,maxM(aa,i+1,a,stock-j,dp));
        }
//        dp[i][lmoney][stock]=max;
        if(!dp.containsKey(i))
            dp.put(i,new HashMap<>());
        HashMap<Pair<Integer,Integer>, Integer> hm=dp.get(i);
        hm.put(p,max);
        return max;
    }
}


Compiler output:
Main.java:1: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:21: error: cannot find symbol
    public static int maxM(int lmoney, int i, int a[], int stock, HashMap<Integer,HashMap<Pair<Integer,Integer>,Integer>> dp) {
                                                                                          ^
  symbol:   class Pair
  location: class Main
Main.java:19: error: incompatible types: cannot infer type arguments for HashMap<>
        System.out.println(maxM(1000,0,a,0,new HashMap<>()));
                                                      ^
    reason: inferred type does not conform to equality constraint(s)
      inferred: Object
      equality constraints(s): HashMap<<any>,Integer>
Main.java:24: error: cannot find symbol
        Pair<Integer,Integer> p=new Pair(lmoney,stock);
        ^
  symbol:   class Pair
  location: class Main
Main.java:24: error: cannot find symbol
        Pair<Integer,Integer> p=new Pair(lmoney,stock);
                                    ^
  symbol:   class Pair
  location: class Main
Main.java:40: error: cannot find symbol
        HashMap<Pair<Integer,Integer>, Integer> hm=dp.get(i);
                ^
  symbol:   class Pair
  location: class Main
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
6 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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 (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N;
    cin>>N;
    vll A(N);
    for (size_t i = 0; i < N; i++)
    {
        cin>>A[i];
    }
    ll M = 1000,K=0,nextMindex =N,nextMaxindex = N;
    for (int i = 0; i < N-1; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            if(A[i]<A[j])
            {
                chmin(nextMaxindex,j);
            }
            if(A[i]>A[j])
            {
                chmin(nextMindex,j);
            }
        }
        if(nextMindex < nextMaxindex)
        {
            M += K*A[i];
            K=0;
        }
        else if(nextMindex > nextMaxindex)
        {
            K += M/A[i];
            M %= A[i];
        }
        nextMaxindex = N;
        nextMindex = N;
    }
    cout<<M+A.back()*K<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:22: error: no matching function for call to 'chmin(ll&, int&)'
   66 |                 chmin(nextMaxindex,j);
      |                 ~~~~~^~~~~~~~~~~~~~~~
a.cc:22:6: note: candidate: 'template<class T> bool chmin(T&, const T&)'
   22 | bool chmin(T &a, const T &b)
      |      ^~~~~
a.cc:22:6: note:   template argument deduction/substitution failed:
a.cc:66:22: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'int')
   66 |                 chmin(nextMaxindex,j);
      |                 ~~~~~^~~~~~~~~~~~~~~~
a.cc:70:22: error: no matching function for call to 'chmin(ll&, int&)'
   70 |                 chmin(nextMindex,j);
      |                 ~~~~~^~~~~~~~~~~~~~
a.cc:22:6: note: candidate: 'template<class T> bool chmin(T&, const T&)'
   22 | bool chmin(T &a, const T &b)
      |      ^~~~~
a.cc:22:6: note:   template argument deduction/substitution failed:
a.cc:70:22: note:   deduced conflicting types for parameter 'const T' ('long long int' and 'int')
   70 |                 chmin(nextMindex,j);
      |                 ~~~~~^~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

int main(void)
{
	long long int n;
	long long int *a;
	scanf("%d", &n);
	a = (long long int *)malloc(sizeof(long long int)*(n+1));
	long long int i = 0;
	while (i < n)
	{
		scanf("%d", &(a[i]));
		i++;
	}

	long long int money = 1000;
	long long int stock = 0;
	long long int tmp_m = 0;
	long long int tmp_s = 0;
	i = 0;
	while (i < n - 1)
	{
		//if (a[i] == a[i+1])
		if (a[i] > a[i+1])
		{
			money = money + stock * a[i];
			stock = 0;
		}
		if (a[i] < a[i+1])
		{
			stock = stock + (money / a[i]);
			money = money % a[i];
		}
		i++;
	}
	A
	money = money + stock * a[i];
	printf("%d\n",money);
}


Compiler output:
main.c: In function 'main':
main.c:38:9: error: unknown type name 'A'
   38 |         A
      |         ^
main.c:39:9: error: conflicting types for 'money'; have 'int'
   39 |         money = money + stock * a[i];
      |         ^~~~~
main.c:18:23: note: previous definition of 'money' with type 'long long int'
   18 |         long long int money = 1000;
      |                       ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
     
  int main(){
      int N;
      cin >> N;
      int a[100];
      int M=1000;
      int money=1000;
      int stock=0;
      for (int i=0; i<N; i++){
        cin >> a[i];
      }
      
      for (int i=0; i<N-1; i++){
        if(a[i]<a[i+1] && stock==0){
          stock = M/a[i];
          M -= a[i]*stock;
        }
        else if(a[i]>a[i+1] && stock>0){
          M += a[i]*stock;
          money = M;
          stock = 0;
        }
      }
      if(M>money){
        cout << M << endl;
      }
      else{
       cout << m << endl;
      } 
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:30:16: error: 'm' was not declared in this scope
   30 |        cout << m << endl;
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
     
  int main(){
      int N;
      cin >> N;
      int a[100];
      int M=1000;
      int money=1000;
      int stock=0;
      for (int i=0; i<N; i++){
        cin >> a[i];
      }
      
      for (int i=0; i<N-1; i++){
        if(a[i]<a[i+1] && stock=0){
          stock = M/a[i];
          M -= a[i]*stock;
        }
        else if(a[i]>a[i+1] && stock>0){
          M += a[i]*stock;
          money = M;
          stock = 0;
        }
      }
      if(M>money){
        cout << M << endl;
      }
      else{
       cout << M << endl;
      } 
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: lvalue required as left operand of assignment
   16 |         if(a[i]<a[i+1] && stock=0){
      |            ~~~~~~~~~~~~^~~~~~~~
Language: C++

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

#define int long long

// #include "debug.cpp"


int maxstock = 3000;
int initialmoney = 1000;


int main(){
	int n, i, j, k;
	cin >> n;
	int arr[n];
	for(i=0; i<n; i++)
		cin >> arr[i];

	int dp[n][maxstock];
	for(i=0; i<n; i++)
		for(j=0; j<maxstock; j++)
			dp[i][j] = -1;

	dp[0][0] = 1000;
	for(i=1; i<maxstock; i++){
		dp[0][i] = max(-1ll, dp[0][i-1]-arr[0]);
	}

	// for(i=0; i<20; i++)
	// 	cout << dp[0][i] << " ";
	// cout << "\n";

	for(i=1; i<n; i++){
		int ind = maxstock-1;
		while(dp[i-1][ind] == -1)
			ind--;

		// debug("AA");
		for(j=0; j<=ind; j++){
			for(k=0; k<=ind; k++){
				if(j <= k){
					dp[i][j] = max(dp[i][j], dp[i-1][k]+(k-j)*arr[i]);
				}
				else{
					dp[i][j] = max(dp[i][j], dp[i-1][k]-(j-k)*arr[i]);
				}
			}
		}

		for(j=0; j<=ind; j++){
			dp[i][ind+1] = max(dp[i][ind+1], dp[i][j]-(ind+1-j)*arr[i]);
		}

		for(j=ind+2; j<maxstock; j++){
			dp[i][j] = max(dp[i][j], dp[i][j-1]-arr[i]);
		}



		// for(j=0; j<n; j++){
		// 	for(k=0; k<maxstock; k++){
		// 		cout << dp[j][k] << " ";
		// 	}
		// 	cout << "\n";
		// }
		// cout << "\n";

	}

	// for(i=0; i<20; i++)
	// 	cout << dp[n-1][i] << " ";
	// cout << "\n";
	cout << dp[n-1][0] << "\n";


}

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

#include <bits/stdc++.h>
 
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 85;

int n;
int price[N];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &price[i]);
	}
	int ans = 0;
	int curMoney = 1000;
	int curStock = 0;
	for (int i = 0; i < n; i++) {
		else if (price[i] <= price[i+1]) {
			int stockBought = curMoney / price[i];
			int pay = stockBought * price[i];
			curStock += stockBought;
			curMoney -= pay;
		}
		else {
			if (curStock > 0) {
				curMoney += curStock * price[i];
				curStock = 0;
			}
		}
	}
	printf("%d\n", curMoney);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'else' without a previous 'if'
   31 |                 else if (price[i] <= price[i+1]) {
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
     
  int main(){
      int N;
      cin >> N;
      int a[100];
      int M=1000;
      int stock=0;
      for (int i=0; i<N; i++){
        cin >> a[i];
      }
      
      for (int i=0; i<N-1; i++){
        if(a[i]<a[i+1] && stock=0){
          stock = M/a[i];
          M -= a[i]*stock;
        }
        else if(a[i]>a[i+1] && stock>0){
          M += a[i]*stock;
          stock = 0;
        }
      }
      cout << M << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: lvalue required as left operand of assignment
   15 |         if(a[i]<a[i+1] && stock=0){
      |            ~~~~~~~~~~~~^~~~~~~~