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

#include <iostream>
2 using namespace std;
3 long long N, A[87], CurrentMoney = 1000;
4 int main() {
5 cin >> N;
6 for (int i = 1; i <= N; i++) cin >> A[i];
7 for (int i = 1; i <= N - 1; i++) {
8 long long Stocks = 0;
9 if (A[i] < A[i + 1]) Stocks = CurrentMoney / A[i];
10 CurrentMoney += (A[i + 1] - A[i]) * Stocks;
11 }
12 cout << CurrentMoney << endl;
13 }

Compiler output:
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2 using namespace std;
      | ^
a.cc:3:1: error: expected unqualified-id before numeric constant
    3 | 3 long long N, A[87], CurrentMoney = 1000;
      | ^
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4 int main() {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
 
 
//Vectorへの入力用
template<typename T>
 
int main() 
{
    long N;
    cin>>N;
    vector<long>A(N);
 
    for (int i = 0; i < N; i++)
    {
       cin>>A[i];
    }   
 
    long money=1000;
    for (int i = 1; i < N; i++)
    {
        long stock=0;
        if(A[i]>A[i-1])
        {
            stock=money/A[i-1];
        }
        money +=(A[i]-A[i-1])*stock; 
    }
    
    cout<<money<<endl;
    
    return 0;
}

Compiler output:
a.cc:9:5: error: cannot declare '::main' to be a template
    9 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n;
    cin >> n;
    vector<int> a;
    a.push_back(300);
    rep(i,n) {
        int ai;
        cin >> ai;
        a.push_back(ai);
    }
    a.push_back(-1);

    int soko = 1, top = 0;
    ll mon = 1000;
    while(true){
        bool ok = false;
        for(int j = top+1; j <= n; j++){
            if (a[j-1] >= a[j] && a[j] < a[j+1] !ok){
                ok = true;
                soko = j;
            }
            else if(a[j-1] < a[j] && a[j] >= a[j+1] && ok){
                top = j;
                break;
            }
        }
        if (!ok) break;
        for(int i = soko; i < top; i++){
            ll kabu = mon / a[i];
            mon %= a[i];
            mon += kabu * a[i+1];
        }
    }
    cout << mon << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:48: error: expected ')' before '!' token
   33 |             if (a[j-1] >= a[j] && a[j] < a[j+1] !ok){
      |                ~                               ^~
      |                                                )
Language: C++

#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
using UL = unsigned int;
using Uint = unsigned long long;
using int = long long;

#define rep(i,n) for(int i=0; i<(n); i++)

int cash(int money, int max, int min){
      // 株価の端数で現金が余る
      int mod = money%min;
      int stock = (money/min);
      return stock*max + mod;
}
int N;
vector<int> A;
int rec(int money, int stock, int day, int ops){
  if (day >= N) return money;
  // 購入
  if(ops == 1){
    stock += money/A[day];
    money = money%A[day];
  } else if (ops == 2){
    money += stock*A[day]; 
    stock = 0;
   
  }
  money = max(max(money, rec(money, stock, day+1, 0)),
          max(rec(money, stock, day+1, 1),rec(money, stock, day+1, 2)));
  return money;
}
int main() {
  scanf("%d", &N);
  A = vector<int>(N+1, (int)0);
  vector<int> T = vector<int>(N+1, (int)0);
  vector<int> max_ind;
  rep(i, N) scanf("%d ", &A[i]);

  T[0] = 1000;
  rep(i,N){
  // kは買う日
    for (int k = 0; k < i+1; k++){
      // jは売る日
      for (int j = k; j < i+1; j++){      
          int tmp =cash(T[k], A[j], A[k]);
          if(T[i+1] < tmp) T[i+1] = tmp;
      } 
    }

    
  }
  int maxval = 0;
  rep(i, N+1){
    maxval = max(T[i],maxval);
  }
  cout << maxval <<endl;

  return 0;
}



Compiler output:
a.cc:7:7: error: expected nested-name-specifier before 'int'
    7 | using int = long long;
      |       ^~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int* arr = new int[n];
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    int stocks=0;
    ll total = 1000;
    for(int i=1;i<n;i++){
        if(arr[i]>arr[i-1]){
            total += (arr[i]-arr[i-1])*(total/arr[i-1]);
        }
    }
    cout << total << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'll' was not declared in this scope
   14 |     ll total = 1000;
      |     ^~
a.cc:17:13: error: 'total' was not declared in this scope
   17 |             total += (arr[i]-arr[i-1])*(total/arr[i-1]);
      |             ^~~~~
a.cc:20:13: error: 'total' was not declared in this scope
   20 |     cout << total << endl;
      |             ^~~~~
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 okane=1000;
  long long shou=a[0];
  for(int i=0;i<n-1;i++){
    shou=a[i];
    for(int j=i+1;j<n;j++){
      if(shou<a[j]){
        okane=(okane/shou)*a[j]+okane%shou;
        //cout<<shou<<i<<j;
        i=j-1;
        shou=a[j];
        break;
      }
      shou=min(a[j],shou);
    }
  }  
  cout<<okane<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>n;
      |   ^~~
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<long long>a(n);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'long'
    7 |   vector<long long>a(n);
      |          ^~~~
a.cc:8:28: error: 'a' was not declared in this scope
    8 |   for(int i=0;i<n;i++)cin>>a[i];
      |                            ^
a.cc:10:18: error: 'a' was not declared in this scope
   10 |   long long shou=a[0];
      |                  ^
a.cc:21:12: error: 'min' was not declared in this scope; did you mean 'main'?
   21 |       shou=min(a[j],shou);
      |            ^~~
      |            main
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout<<okane<<endl;
      |   ^~~~
a.cc:24:16: error: 'endl' was not declared in this scope
   24 |   cout<<okane<<endl;
      |                ^~~~
Language: C++

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

int main(){
  int n,k=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      if(a.at(i) < a.at(j)){
        k += n/a.at(i);
        n -= k*a.at(i);
        n += k*a.at(j);
        break;
      }
    }
    
    cout << n << endl;
  
  return 0;
}


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

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

long long main(){
    long long n;
    long long ans=1000;
    cin>>n;
    vector<long long> A(n),B(n);
    rep(i,n)cin>>A[i];
    long long minv=A[0];
    for(long long i=0;i<n-1;i++){
        if(A[i+1]-A[i]>0){
            ans=(ans/A[i])*A[i+1]+ans%A[i];
            minv=A[i+1];
        }
    }

        cout<<ans;

    }


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

#include<iostream>
using namespace std;

longlongN, A[87], CurrentMoney=1000;
int main() {
  cin>>N;
  for(int i=1; i<=N; i++) cin>>A[i];
  for(int i=1; i<=N-1; i++) {
    longlongStocks=0;
    if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
    CurrentMoney+=(A[i+1]-A[i])*Stocks;
}
  cout<<CurrentMoney<<endl;
}

Compiler output:
a.cc:4:1: error: 'longlongN' does not name a type
    4 | longlongN, A[87], CurrentMoney=1000;
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:8: error: 'N' was not declared in this scope
    6 |   cin>>N;
      |        ^
a.cc:7:32: error: 'A' was not declared in this scope
    7 |   for(int i=1; i<=N; i++) cin>>A[i];
      |                                ^
a.cc:9:5: error: 'longlongStocks' was not declared in this scope
    9 |     longlongStocks=0;
      |     ^~~~~~~~~~~~~~
a.cc:10:8: error: 'A' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |        ^
a.cc:10:21: error: 'Stocks' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |                     ^~~~~~
a.cc:10:28: error: 'CurrentMoney' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |                            ^~~~~~~~~~~~
a.cc:11:5: error: 'CurrentMoney' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |     ^~~~~~~~~~~~
a.cc:11:20: error: 'A' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |                    ^
a.cc:11:33: error: 'Stocks' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |                                 ^~~~~~
a.cc:13:9: error: 'CurrentMoney' was not declared in this scope
   13 |   cout<<CurrentMoney<<endl;
      |         ^~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

longlongN, A[87], CurrentMoney=1000;
int main() {
  cin>>N;
  for(inti=1; i<=N; i++) cin>>A[i];
  for(inti=1; i<=N-1; i++) {
    longlongStocks=0;
    if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
    CurrentMoney+=(A[i+1]-A[i])*Stocks;
}
  cout<<CurrentMoney<<endl;
}

Compiler output:
a.cc:4:1: error: 'longlongN' does not name a type
    4 | longlongN, A[87], CurrentMoney=1000;
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:8: error: 'N' was not declared in this scope
    6 |   cin>>N;
      |        ^
a.cc:7:7: error: 'inti' was not declared in this scope; did you mean 'int'?
    7 |   for(inti=1; i<=N; i++) cin>>A[i];
      |       ^~~~
      |       int
a.cc:7:15: error: 'i' was not declared in this scope
    7 |   for(inti=1; i<=N; i++) cin>>A[i];
      |               ^
a.cc:7:31: error: 'A' was not declared in this scope
    7 |   for(inti=1; i<=N; i++) cin>>A[i];
      |                               ^
a.cc:8:7: error: 'inti' was not declared in this scope; did you mean 'int'?
    8 |   for(inti=1; i<=N-1; i++) {
      |       ^~~~
      |       int
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(inti=1; i<=N-1; i++) {
      |               ^
a.cc:9:5: error: 'longlongStocks' was not declared in this scope
    9 |     longlongStocks=0;
      |     ^~~~~~~~~~~~~~
a.cc:10:8: error: 'A' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |        ^
a.cc:10:21: error: 'Stocks' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |                     ^~~~~~
a.cc:10:28: error: 'CurrentMoney' was not declared in this scope
   10 |     if(A[i]<A[i+1]) Stocks=CurrentMoney/A[i];
      |                            ^~~~~~~~~~~~
a.cc:11:5: error: 'CurrentMoney' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |     ^~~~~~~~~~~~
a.cc:11:20: error: 'A' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |                    ^
a.cc:11:33: error: 'Stocks' was not declared in this scope
   11 |     CurrentMoney+=(A[i+1]-A[i])*Stocks;
      |                                 ^~~~~~
a.cc:13:9: error: 'CurrentMoney' was not declared in this scope
   13 |   cout<<CurrentMoney<<endl;
      |         ^~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdlib>
#include <cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<unordered_map>
#include <bits/stdc++.h>
using namespace std;

#define INF 10000000
int main()
{ 
    int N;
    cin >> N;
    
    int a[N];
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    
    long long money[N];
    for(int n=0; n<N; n++){
        money[n] = - INF;
    }
    money[0] = 1000;
    for(int n=1; n<N; n++){
        money[n] = money[n-1];
        for(int i=0; i<n; i++){
            lon long stock = money[i] / a[i];
            long long im = money[i] + (a[n]-a[i]) * stock;
            money[n] = max(money[n], im);
        }
    }
    
    cout << money[N-1] << endl;        
        
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'lon' was not declared in this scope; did you mean 'long'?
   30 |             lon long stock = money[i] / a[i];
      |             ^~~
      |             long
a.cc:31:53: error: 'stock' was not declared in this scope
   31 |             long long im = money[i] + (a[n]-a[i]) * stock;
      |                                                     ^~~~~
Language: C++

#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}








int main(){
    int N; std::cin >> N;
    std::vector<int> A(N);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    long long ans(1000), cur(1000), st(0);
    bool decre(true);
    for(int i(k); i < N; ++i){
        std::vector<std::pair<int, int>> add;
        if(decre && (i < N-1 && A[i] < A[i+1])){
            decre = false;
            st += cur / A[i];
            cur %= A[i];
        }else if(i == N-1 || (!decre && A[i] > A[i+1])){
            decre = true;
            cur += st * A[i];
            st = 0;
            chmax(ans, cur);
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:15: error: 'k' was not declared in this scope
   68 |     for(int i(k); i < N; ++i){
      |               ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,ara[85],d[85],sum=1000,c=0,count=0;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>ara[i];
    sum=1000;
    for(i=0;i<n;i++)
    {
        if(i==0)
        {
            d[count]=ara[i];
            count++;
        }
        else if(ara[i]!=ara[i-1])
        {
            d[count]=ara[i];
            count++;
        }
    }
    for(i=0;i<count;i++)
    {
        if(i==0)
        {
            if(d[i]<d[i+1])
            {
                c=c+sum/d[i];
                sum=sum%d[i];
            }
        }
        else if(i==count-1)
        {
            if(c>0)
            {
                sum=sum+c*d[i];
                c=0;
            }
        }
        else
        {
            if(d[i]<d[i-1] && d[i]<d[i+1])
            {
                c=c+sum/d[i];
                sum=sum%d[i];
            }
            else if(d[i]>d[i-1] && d[i]>d[i+1])
            {
                if(c>0)
                {
                    sum=sum+c*d[i];
                    c=0;
                }
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
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);
  int64_t M=1000,S=0;
  for(int i=0;i<N-1;i++){
    if(A.at(i)<=A.at(i+1)){
      M-=(M/A.at(i))*A.at(i);
      S=M/A.at(i);
      M+=S*A.at(i+1);
    }
  }
  cout<<M;
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: expected '}' at end of input
   17 |   cout<<M;
      |           ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

int main(){
    int n;
    int64_t mon = 1000; cor = 0;
    cin >> n;
    vector<int> vec(n);
    vector<char> act(n, 'n');
    for (int i = 0; i < n; i++) cin >> vec.at(i);

    if (vec.at(0) < vec.at(1)) act.at(0) = 'b';

    for ( int i = 1; i < n-1; i++){
        if( vec.at(i) <= vec.at(i-1) && vec.at(i) < vec.at(i +1)) act.at(i) = 'b';
        else if( vec.at(i-1) < vec.at(i) && vec.at(i+1) <= vec.at(i)) act.at(i) = 's';
    }

    act.at(n-1) = 's';

    for (int i = 0; i < n; i++){
        if(act.at(i) == 'b'){
            mon = mon % vec.at(i);
            cor = mon / vec.at(i);
        }else if(act.at(i) == 's'){
            mon = mon + cor * vec.at(i);
            cor = 0;
        }
    }
    cout << mon << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:25: error: 'cor' was not declared in this scope; did you mean 'cos'?
    6 |     int64_t mon = 1000; cor = 0;
      |                         ^~~
      |                         cos
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);
    rep(i,n) cin >> v[i];

    vector<ll> dp(n);

    rep(i,n){
        if(i == 0) {
            dp[i] = 1000;
            continue;
        }

        int temp = dp[i-1];
        rep(j,i){
            temp = max(temp,dp[j]%v[j]+(dp[j]/v[j])*v[i]);
        }
        dp[i]  = temp;
    }

    cout << dp[n-1] << endl;

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   25 |             temp = max(temp,dp[j]%v[j]+(dp[j]/v[j])*v[i]);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:25:23: 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'})
   25 |             temp = max(temp,dp[j]%v[j]+(dp[j]/v[j])*v[i]);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:25:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |             temp = max(temp,dp[j]%v[j]+(dp[j]/v[j])*v[i]);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  long n;
  //int temp;
  long syoji=1000;
  //long kabun;//kabukin,
  //int kattaflag;
  cin >> n;
  vector<long> a(n,0);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  //cout << "hahaha" << endl;
  /*if(a.at(0)<a.at(1)){
    kattaflag=1;//次売る
  }else{
    kattaflag=-1;//次買う
  }*/
  //kabun=0;
  //temp=0;
  //kabukin=0;

  for(int i=0;i<n-1;i++){
    //temp=0;
    long long kabun=0;
    if(a.at(i)<a.at(i+1)){//買う
      //kabukin=a.at(i);
      //kabun=0;
      /*while(syoji>=a.at(i)){//(temp+=a.at(i))<=syoji){
        syoji-=a.at(i);
        kabun++;
      }*/
      //syoji-=a.at(i)*kabun;
      kabun=syoji/a.at(i);
      syoji=syoji-(a.at(i)*kabun);
    }else if(a.at(i)>a.at(i+1)){//売る
      while(kabun>0){
        syoji+=a.at(i);
        kabun--;
      }
      //kabukin=0;
    }
    //cout << i << ":" << kabukin << endl;
  }
  if(kabun>0){
    //while(kabun>0){
      syoji=syoji+(a.at(n-1)*kabun);
      //kabun--;
    //}
  }
  cout << syoji << endl;

  return(0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:6: error: 'kabun' was not declared in this scope
   49 |   if(kabun>0){
      |      ^~~~~
Language: C++

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

int main(){
    int64_c n, mon = 1000, cor = 0;
    cin >> n;
    vector<int> vec(n);
    vector<char> act(n, 'n');
    for (int i = 0; i < n; i++) cin >> vec.at(i);

    if (vec.at(0) < vec.at(1)) act.at(0) = 'b';

    for ( int i = 1; i < n-1; i++){
        if( vec.at(i) <= vec.at(i-1) && vec.at(i) < vec.at(i +1)) act.at(i) = 'b';
        else if( vec.at(i-1) < vec.at(i) && vec.at(i+1) <= vec.at(i)) act.at(i) = 's';
    }

    act.at(n-1) = 's';

    for (int i = 0; i < n; i++){
        if(act.at(i) == 'b'){
            mon = mon % vec.at(i);
            cor = mon / vec.at(i);
        }else if(act.at(i) == 's'){
            mon = mon + cor * vec.at(i);
            cor = 0;
        }
    }
    cout << mon << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'int64_c' was not declared in this scope; did you mean 'int64_t'?
    5 |     int64_c n, mon = 1000, cor = 0;
      |     ^~~~~~~
      |     int64_t
a.cc:6:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     cin >> n;
      |            ^
      |            yn
a.cc:22:13: error: 'mon' was not declared in this scope
   22 |             mon = mon % vec.at(i);
      |             ^~~
a.cc:23:13: error: 'cor' was not declared in this scope; did you mean 'cos'?
   23 |             cor = mon / vec.at(i);
      |             ^~~
      |             cos
a.cc:25:13: error: 'mon' was not declared in this scope
   25 |             mon = mon + cor * vec.at(i);
      |             ^~~
a.cc:25:25: error: 'cor' was not declared in this scope; did you mean 'cos'?
   25 |             mon = mon + cor * vec.at(i);
      |                         ^~~
      |                         cos
a.cc:29:13: error: 'mon' was not declared in this scope
   29 |     cout << mon << endl;
      |             ^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
cin >> a[i];
int i=0,sum=1000;
while(i<(n-1))
{
if(a[i]<a[i+1]){
k=sum/a[i];
sum=sum%a[i];
sum+=k*a[i+1];
i+=2;
}
else
i++;
}
cout << sum << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:1: error: 'k' was not declared in this scope
   14 | k=sum/a[i];
      | ^
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long cash = 1000;
        long stocks = 0;

        int[] future = new int[n];
        for (int i = 0; i < n; i++) {
            future[i] = sc.nextInt();
        }

        int currentDay = 1;
        boolean isBuy = true;
        int next;
        while (currentDay <= n && (next = nextDay(future, currentDay, isBuy)) != -1) {
            int price = future[next - 1];

            if (isBuy) {
                long number = cash / price;
                cash -= price * number;
                stocks += number;
            } else {
                cash += price * stocks;
                stocks = 0;
            }

            isBuy = !isBuy;
            currentDay = next + 1;
        }

        System.out.println(cash);
    }

    private static int nextDay(int[] future, int currentDay, boolean isBuy) {
        int current = future[currentDay - 1];
        int nextDay = currentDay;

        for (int i = currentDay; i < future.length; i++) {
            int next = future[i];
            if (isBuy) {
                if (current >= next) {
                    current = next;
                    nextDay = i + 1;
                } else {
                    break;
                }
            } else {
                if (current <= next) {
                    current = next;
                    nextDay = i + 1;
                } else {
                    break;
                }
            }
        }

        if (isBuy && nextDay == future.length) return -1;
        else return nextDay;
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <vector>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
ll main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll money = 1000;
    ll kabu = 0;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (i > 0)
        {
            ll store = 0;
            if (a[i] > a[i - 1])
            {
                store = money / a[i - 1];
            }
            money += (a[i] - a[i - 1]) * store;
        }
    }
    cout << money << endl;
}

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

#include <set>
#include <cmath>
#include <functional>

typedef long long ll;
using namespace std;


int main(){
    int n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll m = 1000;
    ll k = 0;

    for(int i = 0; i < n; i++){
        if(i == n - 1){
            m += k * a[i];
            break;
        }

        if(i != 0){
            if(a[i - 1] < a[i]) {
                m = k * a[i];
                k = 0;
            }
        } 
        if(i != n - 1) {
            if(a[i] < a[i + 1]) {
                while(m >= a[i]){
                   m -= a[i];
                   k += 1;
                }
            }
        }
    }

    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> n;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <functional>
  +++ |+#include <iostream>
    4 | 
a.cc:41:5: error: 'cout' was not declared in this scope
   41 |     cout << m << endl;
      |     ^~~~
a.cc:41:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:18: error: 'endl' was not declared in this scope
   41 |     cout << m << endl;
      |                  ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <functional>
  +++ |+#include <ostream>
    4 |
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 M = 1000, K = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      K += M / A.at(i);
      M = M % A.at(i);
    }
    else if (i == N - 1) {
      M += K * A.at(i);
      K = 0;
    }
    else {
      if (A.at(i) > A.at(i - 1)) {
        K += M / A.at(i - 1);
        M = M % A.at(i - 1);
        M += K * A.at(i);
        K = 0;
      }
      else if (A.at(i) < A.at(i - 1)) {
        M += K * A.at(i - 1);
        K = 0;
        K += M / A.at(i);
        M = M % A.at(i);
      }
    }
  }
  cout << max(M, 1000) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: no matching function for call to 'max(long long int&, int)'
   34 |   cout << max(M, 1000) << endl;
      |           ~~~^~~~~~~~~
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:34:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |   cout << max(M, 1000) << endl;
      |           ~~~^~~~~~~~~
/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:34:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |   cout << max(M, 1000) << endl;
      |           ~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=998244353,MAX=1e2+2;

int n;
int a[82];

int main(){
    IOS;
    cin>>n;
    ll res=1000,mn=inf;
    lp(i,0,n){
        cin>>a[i];
        if(i){
            if(a[i]<=a[i-1])
                mn=min(mn,a[i]);
            else{
                int cnt=res/mn;
                res=res-cnt*mn;
                res=res+cnt*a[i];
                mn=a[i];
            }

        }
        else mn=a[i];
    }
    cout<<res;

}
/*

*/


Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: no matching function for call to 'min(long long int&, int&)'
   30 |                 mn=min(mn,a[i]);
      |                    ~~~^~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:30:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   30 |                 mn=min(mn,a[i]);
      |                    ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:30:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   30 |                 mn=min(mn,a[i]);
      |                    ~~~^~~~~~~~~
Language: C++

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    bool buy = false;
    ll money = 1000;
    ll kabu = 0;
    repl(i, 1, n) {
        if(a[i] > a[i - 1]) {
            buy = true;
            kabu += money / a[i - 1];
            money %= a[i - 1];
        }
        else if(a[i] < a[i - 1]){
            buy = false;
            money += kabu * a[i - 1];
            kabu = 0;
        }
    }
    if(buy) money += kabu * a[n - 1];a
    cout << money << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:39: error: expected ';' before 'cout'
   30 |     if(buy) money += kabu * a[n - 1];a
      |                                       ^
      |                                       ;
   31 |     cout << money << endl;
      |     ~~~~
Language: C++

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    bool buy = false;
    ll money = 1000;
    ll kabu = 0;
    repl(i, 1, n) {
        if(a[i] > a[i - 1]) {
            buy = true;
            kabu += money / a[i - 1];
            money %= a[i - 1];
        }
        else if(a[i] < a[i - 1]){
            buy = false;
            money += kabu * a[i - 1];
            kabu = 0;a
        }
    }
    if(buy) money += kabu * a[n - 1];a
    cout << money << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:23: error: expected ';' before '}' token
   27 |             kabu = 0;a
      |                       ^
      |                       ;
   28 |         }
      |         ~              
a.cc:30:39: error: expected ';' before 'cout'
   30 |     if(buy) money += kabu * a[n - 1];a
      |                                       ^
      |                                       ;
   31 |     cout << money << endl;
      |     ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for (int i=0; i<N; i++)cin >> A[i];
    
    stocks = 0;
    money = 1000;
    int ans = 1000;
    bool bd = false;
    for (int i=0; i<N-1; i++){
        bd = false;
        if (A[i+1] > A[i]){
            stocks += money / A[i];
            money -= money / A[i] *A[i];
            bd = true;
        }
    
    
        if (!bd){
            money += A[i]*stocks;
            stocks = 0;
        }
    
        //chmax(ans, money);
    }
    money += stocks*A[N-1];
    //chmax(ans,money);

    //最終日に下がる場合を考える必要がありそう
    cout << money << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'stocks' was not declared in this scope
   16 |     stocks = 0;
      |     ^~~~~~
a.cc:17:5: error: 'money' was not declared in this scope
   17 |     money = 1000;
      |     ^~~~~
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i = 0; i < n; i++) cin>>a[i];
  long long ans = 1000;
  for(int i = 0; i< n-1; i++){
   if(a[i] < a[i+1]){
    ans += (a[i+1]-a[i]) * (ans/a[i]); 
   }
  }
  cout<<ans<<endl;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:35: error: 'a' was not declared in this scope
    8 |   for(int i = 0; i < n; i++) cin>>a[i];
      |                                   ^
a.cc:11:7: error: 'a' was not declared in this scope
   11 |    if(a[i] < a[i+1]){
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long mypow(long long x, long long y)
{
	long long result = 1;
	while (y != 0) {
		if (y%2 != 0) {
			result *= x;
			y -= 1;
		}	
		x *= x;
		y /= 2;
	}
	return result;
}
int main(void)
{
	int n;
	cin >> n;
	int a[n];
	vector<pair<int, int>> v;
	int x;
	int y = -1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i == 0) {
			x = a[i];
		} else {
			if (i == n-1) {
				if (y != -1 && x < y)
					v.push_back(make_pair(x, y));
			} else {
				if (a[i-1] > a[i]) {
					if (y != -1) {
						v.push_back(make_pair(x, y));
					}
					x = a[i];
				} else {
					y = a[i];
				}
			}
		}
	}
	for (auto e : v) {
		//printf("%d, %d\n", e.first, e.second);
		long long tmp = money / (long long)e.first;
		money = money - tmp*(long long)e.first + tmp*(long long)e.second;
	}
	cout << money << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:33: error: 'money' was not declared in this scope
   46 |                 long long tmp = money / (long long)e.first;
      |                                 ^~~~~
a.cc:49:17: error: 'money' was not declared in this scope
   49 |         cout << money << endl;
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N];

int b[N];
char s[N];
char t[N];
ll f[N];
int used[15];
int cmp1(ll a,ll b)
{
    return b<a;
}

multiset<int> ss;
map<int,int>mp;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    if(a[2]>a[1])b[1]=2;
    for(int i=2;i<=n-1;i++){
        if(a[i-1]<=a[i]&&a[i+1]<a[i]) b[i]=1;
    }
    ll stock=0;
    ll money=1000;
    for(int i=2;i<=n-1;i++)
    {
        if(a[i-1]>=a[i]&&a[i+1]>a[i]) b[i]=2;
    }

    for(int i=1;i<=n-1;i++){
        if(b[i]==1){

            money=money+stock*a[i];
            stock=0;
        }
        else if(b[i]==2){
            stock=money/a[i];
            money=money-stock*a[i];
        }
    }
    money+=stock*a[n];
    ll ans=max(money,1000);
    cout<<ans<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:15: error: no matching function for call to 'max(ll&, int)'
   48 |     ll ans=max(money,1000);
      |            ~~~^~~~~~~~~~~~
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:48:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   48 |     ll ans=max(money,1000);
      |            ~~~^~~~~~~~~~~~
/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:48:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   48 |     ll ans=max(money,1000);
      |            ~~~^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define tc() ll T;cin>>T;while(T--)

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll n; cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) cin>>a[i];
    ll mini = a[0],maxi = a[0],i=0,ans=1000,flag=1;
    while(i<n){
        mini=200;
        maxi=100;
        while(i<n){
            if(a[i]=<mini){
                mini = a[i];
            }
            else break;
            if(i==n-1) flag=0;
            i++;
        }
        while(i<n){
            if(a[i]>=maxi){
                maxi = a[i];
            }
            else break;
            i++;
        }
        if(flag) ans+=(maxi-mini)*(ans/mini);
        i++;
    }
    cout<<ans;
    
    /*------------------Code Ends Here-------------------*/
    
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N];

int b[N];
char s[N];
char t[N];
ll f[N];
int used[15];
int cmp1(ll a,ll b)
{
    return b<a;
}

multiset<int> ss;
map<int,int>mp;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    if(a[2]>a[1])b[1]=2;
    for(int i=2;i<=n-1;i++){
        if(a[i-1]<=a[i]&&a[i+1]<a[i]) b[i]=1;
    }
    ll stock=0;
    ll money=1000;
    for(int i=2;i<=n-1;i++)
    {
        if(a[i-1]>=a[i]&&a[i+1]>a[i]) b[i]=2;
    }

    for(int i=1;i<=n-1;i++){
        if(b[i]==1){

            money=money+stock*a[i];
            stock=0;
        }
        else if(b[i]==2){
            stock=money/a[i];
            money=money-stock*a[i];
        }
    }
    money+=stock*a[n];
    cout<<max(money,1000)<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:14: error: no matching function for call to 'max(ll&, int)'
   48 |     cout<<max(money,1000)<<endl;
      |           ~~~^~~~~~~~~~~~
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:48:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   48 |     cout<<max(money,1000)<<endl;
      |           ~~~^~~~~~~~~~~~
/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:48:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   48 |     cout<<max(money,1000)<<endl;
      |           ~~~^~~~~~~~~~~~
Language: C++

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

int main(){
  int n;
  //int temp;
  long syoji=1000;
  long kabun;//kabukin,
  //int kattaflag;
  cin >> n;
  vector<int> a(n,0);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  //cout << "hahaha" << endl;
  /*if(a.at(0)<a.at(1)){
    kattaflag=1;//次売る
  }else{
    kattaflag=-1;//次買う
  }*/
  kabun=0;
  //temp=0;
  //kabukin=0;

  for(int i=0;i<n-1;i++){
    temp=0;
    if(a.at(i)<a.at(i+1)){//買う
      //kabukin=a.at(i);
      //kabun=0;
      while(syoji>=a.at(i)){//(temp+=a.at(i))<=syoji){
        syoji-=a.at(i);
        kabun++;
      }
      //syoji-=a.at(i)*kabun;
      //kabun=floor(syoji/a.at(i));
      //syoji=syoji-(a.at(i)*kabun);
    }else if(a.at(i)>a.at(i+1)){//売る
      //while(kabun>0){
        syoji=syoji+(a.at(i)*kabun);
        kabun=0;
      //}
      //kabukin=0;
    }
    //cout << i << ":" << kabukin << endl;
  }
  if(kabun>0){
    //while(kabun>0){
      syoji=syoji+(a.at(n-1)*kabun);
      //kabun--;
    //}
  }
  cout << syoji << endl;

  return(0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'temp' was not declared in this scope; did you mean 'tm'?
   28 |     temp=0;
      |     ^~~~
      |     tm
Language: C++

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

int main() {
	int n; cin >> n;
	int a[n];
	for (int i=1; i<=n; ++i) cin >> a[i];
	
	int p = 0, i = 0;
	int m = 1000;
	
	for (int i=1; i<=n;++i)
		if (a[i]<a[i+1]) {
			ll c=m/a[i];
			m+=c*(a[i+1]-a[i]);
		}
	cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'll' was not declared in this scope
   14 |                         ll c=m/a[i];
      |                         ^~
a.cc:15:28: error: 'c' was not declared in this scope
   15 |                         m+=c*(a[i+1]-a[i]);
      |                            ^