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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
int main(){
    ll n, k;
    cin >> n >> k;
    vector<Bint> a(n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    vector<Bint> grade(n, 1);
    for (ll i = 0; i < k;i++){
        grade[k-1] *= a[i];
    }
    for (ll i = k; i < n;i++){
        ll tmp = grade[i - 1];
        grade[i] = tmp * a[i] / a[i - k];
        if (grade[i] > tmp) cout << "Yes" << endl;
        else cout<<"No"<<endl;
    }
}

Compiler output:
a.cc:23:10: fatal error: boost/multiprecision/cpp_dec_float.hpp: No such file or directory
   23 | #include <boost/multiprecision/cpp_dec_float.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef long long LL;
typedef long double LD;

int main(int argc, char* argv[]) {
	int n, k, x;
	cin >> n >> k;
	vector<LD> a(n), sum(n + 1, 0);
	for (int i = 0; i < n; ++i) {
		cin >> x;
		a[i] = logl(x * 10.0);
		sum[i + 1] = sum[i] + a[i];
	}
	for (int i = k + 1; i <= n; ++i) {
		LD a = sum[i - 1] - sum[i - 1 - k];
		LD b = sum[i] - sum[i - k];
		string ans = b > (a + 1e-10) ? "Yes" : "No";
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:23:24: error: 'logl' was not declared in this scope
   23 |                 a[i] = logl(x * 10.0);
      |                        ^~~~
Language: C

#include<stdio.h>

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  int a[n+1];
  for(int i=1;i<=n;i++)scanf("%d",%a[i]);
  
  for(int i=k+1;i<=n;i++){
    if(a[i-k]<a[i]){printf("Yes\n");}
    else{printf("No\n");}
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:35: error: expected expression before '%' token
    7 |   for(int i=1;i<=n;i++)scanf("%d",%a[i]);
      |                                   ^
Language: C++

#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT = mp::cpp_int;
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    INT N, K;
    cin >> N >> K;
    vector<INT> A(N);
    loop(i, N) cin >> A[i];
    INT now = 1;
    loop(i, K) now *= A[i];
    loop(i, N - K)
    {
        INT x = now;
        now /= A[i];
        now *= A[i + K];
        if (now > x)
            putout("Yes");
        else
            putout("No");
    }
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    1 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {


    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(tokenizer.nextToken());
        int k = Integer.parseInt(tokenizer.nextToken());
        int[] scores = new int[n];
        tokenizer = new StringTokenizer(f.readLine());
        for (int i = 0; i < n; i++) scores[i] = Integer.parseInt(tokenizer.nextToken());

        long product = 1;
        for (int i = 0; i < k; i++) {
            product *= scores[i];
        }
        for (int i = k; i  < n; i++) {
            long prev = product;
            product /= scores[i - k];
            product *= scores[i];
            if (product > prev) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

        out.close();
    }

Compiler output:
Main.java:38: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K; 
  cin >> N >> K

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

  FOR(i, K, N){
    if(A[i] > A[i-K]) Yes;
    else No;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:16: error: expected ';' before 'vector'
   51 |   cin >> N >> K
      |                ^
      |                ;
   52 | 
   53 |   vector<int> A(N);
      |   ~~~~~~        
a.cc:54:20: error: 'A' was not declared in this scope
   54 |   REP(i, N) cin >> A[i];
      |                    ^
a.cc:57:8: error: 'A' was not declared in this scope
   57 |     if(A[i] > A[i-K]) Yes;
      |        ^
Language: C++

#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,x,y,z,a[200040];
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	for(;i++<n;)cub>>a[i];
	for(i=k;i++<n;)
	{
		if(a[i]>a[i-k])cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<bits/stdc++.h>
      |  ^~~~~~
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:12:21: error: 'cub' was not declared in this scope
   12 |         for(;i++<n;)cub>>a[i];
      |                     ^~~
Language: C++

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
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<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll MOD=1000000007;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};





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




Compiler output:
a.cc:2:9: fatal error: atcoder/all: No such file or directory
    2 | #include<atcoder/all>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

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

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

int main() {
  ll n, m = 1000;
  cin >> n;
  vector<ll> a(n);
  REP(i, N) {
    cin >> a[i];
  }
  REP(i, n-1) {
    ll tmp = 0;
    if (a[i] < a[i+1]) {
      tmp = m / a[i];
    }
    m += (a[i+1] - a[i]) * tmp;
  }
  cout << m << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'N' was not declared in this scope
   18 |   REP(i, N) {
      |          ^
a.cc:5:39: note: in definition of macro 'REP'
    5 | #define REP(i, n) for (int i = 0; i < n; i++)
      |                                       ^
Language: C++

int main()
{
    fast_IO
    int n; cin >> n;
    vector<int> a(n);
    for (auto &A : a) cin >> A;
    int mx = 1000;
    for (int i = 0; i+1 < n; i++)
        for (int j = i+1; j < n; j++)
        {
            if (a[j] > a[i])
            {
                int x = floor(1000 / a[i]);
                mx = max(mx, 1000 - a[i] * x + a[j] * x);
            }
        }
    cout << mx << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'fast_IO' was not declared in this scope
    3 |     fast_IO
      |     ^~~~~~~
a.cc:4:12: error: 'cin' was not declared in this scope
    4 |     int n; cin >> n;
      |            ^~~
a.cc:4:19: error: 'n' was not declared in this scope
    4 |     int n; cin >> n;
      |                   ^
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> a(n);
      |     ^~~~~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> a(n);
      |            ^~~
a.cc:6:20: error: 'a' was not declared in this scope
    6 |     for (auto &A : a) cin >> A;
      |                    ^
a.cc:11:17: error: 'a' was not declared in this scope
   11 |             if (a[j] > a[i])
      |                 ^
a.cc:13:25: error: 'floor' was not declared in this scope
   13 |                 int x = floor(1000 / a[i]);
      |                         ^~~~~
a.cc:14:22: error: 'max' was not declared in this scope; did you mean 'mx'?
   14 |                 mx = max(mx, 1000 - a[i] * x + a[j] * x);
      |                      ^~~
      |                      mx
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << mx << '\n';
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
int main(){
 
    ll n; cin >> n;
    ll arr[n];
    for(ll i = 0; i < n; ++i){
        cin >> arr[i];
    }
    ll ans = 1000, x;
    for(ll i = 1; i < n; ++i){
        if (a[i] > a[i-1]) {
          ans = max(ans, ans / arr[i-1] * arr[i]);
        }
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'a' was not declared in this scope
   16 |         if (a[i] > a[i-1]) {
      |             ^
Language: C++

#include <bits/stdc++.h>
#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() {

  ll N;
  ll money = 1000;
  ll stock;x
  ll ans = -1;
  cin >> N;

  vector<ll> A(N);

  for (ll i = 0; i < N;++i)
    cin >> A[i];

  A.erase(std::unique(A.begin(), A.end()), A.end());

  for (ll i = 0;i < (1<<A.size());++i){
    money = 1000;
    stock = 0;
    for (ll j = 0; j < A.size();++j){

      if((i >> j) & 1){
        if(A[j] < money){
          stock += money / A[j];
          money = money % A[j];
        }
      }
      else{
        money += stock * A[j];
        stock = 0;
      }

    }

    ans = std::max(ans, money);

  }

  cout << ans << endl;

  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'x' was not declared in this scope
   11 |   ll stock;x
      |            ^
a.cc:40:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |     ans = std::max(ans, money);
      |     ^~~
      |     abs
a.cc:44:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
#define fint register int
#define h 5001
#define p 834534
#define int long long
using namespace std;
int a[p];
int main()
{
	int n;
	cin>>n;
	for(fint i=1;i<=n;i++)
	cin>>a[i];
	int tic=0,mon=1000;
	for(fint i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		mon+=a[i]*tic,tic=0;
		if(a[i+1]>a[i])//后一天比这一天价格高，就在这一天狂买
		tic+=(mon/a[i]),mon=mon%a[i];
	}
	cout<<mon;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:12:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |         for(fint i=1;i<=n;i++)
      |                  ^
a.cc:15:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |         for(fint i=1;i<=n;i++)
      |                  ^
Language: C++

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

int makeMaxProfit(vector<int>& arr, int n, int amt)
{
    long long int currentMoney = amt;
    for(int i=0; i<n-1; ++i)
    {
        if(arr[i] < arr[i+1])
        {
            //Find the number of stocks 
            //that can be purchased.
            long long int numStocks = currentMoney / arr[i];
            //Profit made by that 
            //transaction.
            currentMoney += (arr[i+1] - arr[i]) 
                            * numStocks;
        }
    }
    return currentMoney;
}

int main()
{
    long long int initialAmount = 1000;
    //vector<int> arr = {100 ,130, 130, 130, 115, 115, 150};
//     vector<int> arr = {
// 200, 180, 160, 140, 120, 100};
    long long int n; cin>>n;
    vector<long long int> arr(n); for(auto &it:arr) cin>>it;
    //int n = sizeof(arr) / sizeof(arr[0]);
    cout<<makeMaxProfit(arr, n, initialAmount);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>'
   32 |     cout<<makeMaxProfit(arr, n, initialAmount);
      |                         ^~~
a.cc:4:32: note: in passing argument 1 of 'int makeMaxProfit(std::vector<int>&, int, int)'
    4 | int makeMaxProfit(vector<int>& arr, int n, int amt)
      |                   ~~~~~~~~~~~~~^~~
Language: C++

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

#define ll long long

int main()
{
  ll n;
  cin>>n;
  
  ll arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  
  ll ans = 1000;
  ll temp = ans;
  ll share = ans/arr[0];
  
  ans = ans - share*arr[0];
  
  for(int i=1;i<n;i++)
  {
     if(arr[i]>arr[i-1]{
        ans += share*arr[i];
        temp = ans;
        share = ans/arr[i];
        ans = ans - share*arr[i];
     }
     else if(arr[i]<arr[i-1]){
        ans = temp;
        share = ans/arr[i];
        ans = ans - share*arr[i];
     }
  }
        cout<<temp;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected ')' before '{' token
   23 |      if(arr[i]>arr[i-1]{
      |        ~               ^
      |                        )
a.cc:34:3: error: expected primary-expression before '}' token
   34 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>  
using namespace std;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
 
int main() {
  int n;
  cin>> n;
  vector<int> v(n);
  rep(i,n){cin >> v[i];}
  int stock = 0;
  int money = 1000;
  rep(i, n){
 
    if(v[i] < v[i + 1]){
      stock = money / v[i];
      money = money % v[i];
    }
    
    if(v[i] >= v[i + 1]){
      money += stock * v[i];
      stock = 0;
    }
  }
  money = money + stock * v[n - 1];
  cout<< money <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:22: error: 'll' was not declared in this scope
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                      ^~
a.cc:9:3: note: in expansion of macro 'rep'
    9 |   rep(i,n){cin >> v[i];}
      |   ^~~
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i,n){cin >> v[i];}
      |       ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                              ^
a.cc:3:22: error: 'll' was not declared in this scope
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                      ^~
a.cc:12:3: note: in expansion of macro 'rep'
   12 |   rep(i, n){
      |   ^~~
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   rep(i, n){
      |       ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long 
int main(){
  long long N;
  int money=1000;
  ll result;
  ll l=0;
  long long k=0;
  cin>>N;
  vector<long long> vec(N);
  for(long long i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(long long i=0;i<N-1;i++){
    
    if(vec.at(i)<vec.at(1+i)){
      
      k+=money/vec.at(i);
      l=money/vec.at(i);
      
      
      money-=l*vec.at(i);
     
      
      
    }
    if(vec.at(i)>vec.at(1+i)){
      money=money+k*vec.at(i);
      result=money;
      k=0;
      
    }
    
  }
  money+=vec.at(N-1)*k;
  if(money<result){
    cout<<result<<endl;
  }
  else{
    cout<<money<<endl;
  }
  
}
    
    
    


Compiler output:
a.cc:4:4: error: expected ';' before 'main'
    4 | int main(){
      |    ^~~~~
      |    ;
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
 
long long N, A[87];
long long dp[87];
 
int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
 
	dp[1] = 1000;
	for (int i = 2; i <= N; i++) {
		dp[i] = dp[i - 1];
		for (int j = 1; j <= i - 1; j++) {
			long long V = dp[j] / A[j];
			long long W = dp[j] + (A[i] - A[j]) * V;
			dp[i] = max(dp[i], W);
		}
	}
	cout << dp[N] << endl;
	return 0;
}
#include <iostream>
#include <algorithm>
using namespace std;

long long N, A[87];
long long dp[87];

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

	dp[1] = 1000;
	for (int i = 2; i <= N; i++) {
		dp[i] = dp[i - 1];
		for (int j = 1; j <= i - 1; j++) {
			long long V = dp[j] / A[j];
			long long W = dp[j] + (A[i] - A[j]) * V;
			dp[i] = max(dp[i], W);
		}
	}
	cout << dp[N] << endl;
	return 0;
}


Compiler output:
a.cc:28:11: error: redefinition of 'long long int N'
   28 | long long N, A[87];
      |           ^
a.cc:5:11: note: 'long long int N' previously declared here
    5 | long long N, A[87];
      |           ^
a.cc:28:14: error: redefinition of 'long long int A [87]'
   28 | long long N, A[87];
      |              ^
a.cc:5:14: note: 'long long int A [87]' previously declared here
    5 | long long N, A[87];
      |              ^
a.cc:29:11: error: redefinition of 'long long int dp [87]'
   29 | long long dp[87];
      |           ^~
a.cc:6:11: note: 'long long int dp [87]' previously declared here
    6 | long long dp[87];
      |           ^~
a.cc:31:5: error: redefinition of 'int main()'
   31 | int main() {
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define f(i,l,u) for(ll i=l;i<u;i++)
int main() {
    ll n;
    cin>>n;
ll a[n+1];


f(i,0,n)
cin>>a[i];

ll buy=1;
ll temp=0;
ll qty;
ll bal=1000;
while(temp<n)
{
    if(buy)
    {
        while(a[temp+1]<=a[temp])
        {
            temp++;
            if(temp==n-1)
            break;
        }
        if(temp==n-1)
        break;
        else
        {
          // / cout<<"buyed at "<<a[temp]<<endl;
    
            qty=bal/a[temp];
            bal-=qty*a[temp];
                      /  cout<<"avail bal= "<<bal<<endl;
            buy=0;
            
        }
        
    }
    else
    {
        while(temp<n-1&&a[temp+1]>=a[temp])
        {
            temp++;
        }
        
        
        buy=1;
        bal+=qty*a[temp];
    //    cout<<"sold at "<<a[temp]<<endl;
    //    cout<<"avail bal= "<<bal<<endl;
        
    }
    
}
cout<<bal<<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:23: error: expected primary-expression before '/' token
   37 |                       /  cout<<"avail bal= "<<bal<<endl;
      |                       ^
Language: Java

import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) {
		int possession = 1000;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] stock = new int[n];
		for (int i = 0; i < n; i++) {
			stock[i] = sc.nextInt();
		}
		for (int i = 0; i < stock.length - 1; i++) {
			int stocks = 0;
			//翌日が今よりも高かったら即購入
			//
			if(stock[i] < stock[i + 1]) {
				stocks = possession / stock[i];
				possession += (stock[i + 1] - stock[i])  * stocks;
			}
		}
		
		System.out.println(possession);
	}

}


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

package atcoder.problems.msolution.d;

import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) {
		int possession = 1000;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] stock = new int[n];
		for (int i = 0; i < n; i++) {
			stock[i] = sc.nextInt();
		}
		for (int i = 0; i < stock.length - 1; i++) {
			int stocks = 0;
			//翌日が今よりも高かったら即購入
			//
			if(stock[i] < stock[i + 1]) {
				stocks = possession / stock[i];
				possession += (stock[i + 1] - stock[i])  * stocks;
			}
		}
		
		System.out.println(possession);
	}

}


Compiler output:
Main.java:5: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: Java

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 curr = a[0];
        int index = 1;
        int profit = 1000;
        int buyPrice = 0;
        int buyCount = 0;
        while (index < n) {
            while (index < n && curr >= a[index]) {
                curr = a[index++];
            }
            buyCount = profit / curr;
            buyPrice = curr;
            while (index < n && curr <= a[index]) {
                curr = a[index++];
            }
            profit += ((curr - buyPrice) * buyCount);
        }
        System.out.println(profit);
    }
}

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

#include<stdio.h>

int main(void)
{
  int N,i;
  int K=0;
  int M=1000;
  scanf("%d",&N);
  int A[80];
  for(i=0;i<N;i++)
  {
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<N-1++)
  {
    if(A[i]<A[i+1])
    {
      while(A[i]<=M)
      {
        M=M-A[i];
        K++;
      }
    }
    if(A[i]>A[i+1])
    {
      while(K>0)
      {
        M=M+A[i];
        K--;
      }
    }
  }
  printf("%d",M+A[N-1]);
  return 0;
}
        
  

Compiler output:
main.c: In function 'main':
main.c:15:16: error: lvalue required as increment operand
   15 |   for(i=0;i<N-1++)
      |                ^~
main.c:15:18: error: expected ';' before ')' token
   15 |   for(i=0;i<N-1++)
      |                  ^
      |                  ;
Language: C++

fn main() {
    proconio::input! {
        n: usize,
        a: [i64; n]
    };
    let mut money = 1000;
    let mut stock = 0;
    for i in 0..n {
        if i+1 < n && a[i] < a[i+1] {
            stock += money/a[i];
            money %= a[i];
        } else if i == n-1 || a[i] > a[i+1] {
            money += a[i] * stock;
            stock = 0;
        }
    }
    println!("{}", money);
}


Compiler output:
a.cc:8:14: error: too many decimal points in number
    8 |     for i in 0..n {
      |              ^~~~
a.cc:1:1: error: 'fn' does not name a type
    1 | fn main() {
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i = 0; i< N; i++)
 
 
int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll posession = 1000;
    ll stock = 0;
    ll newStock;
    rep(i,n-1) {
        if(a[i] == a[i+1]) continue;
        else if(a[i] > a[i+1]) {
            if(stock) {
                posession += stock * a[i];
                stock = 0;
            }
        } else if(a[i] < a[i+1]) {
            newStock = posession/a[i];
            stock += newStock;
            posession -= a[i] * newStock;
        }
    }
    if(stock) {
        posession += stock * a[n-1];
        stock = 0;
    }
    cout << posession << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'll' was not declared in this scope
   10 |     ll posession = 1000;
      |     ^~
a.cc:11:7: error: expected ';' before 'stock'
   11 |     ll stock = 0;
      |       ^~~~~~
      |       ;
a.cc:12:7: error: expected ';' before 'newStock'
   12 |     ll newStock;
      |       ^~~~~~~~~
      |       ;
a.cc:16:16: error: 'stock' was not declared in this scope
   16 |             if(stock) {
      |                ^~~~~
a.cc:17:17: error: 'posession' was not declared in this scope
   17 |                 posession += stock * a[i];
      |                 ^~~~~~~~~
a.cc:21:13: error: 'newStock' was not declared in this scope
   21 |             newStock = posession/a[i];
      |             ^~~~~~~~
a.cc:21:24: error: 'posession' was not declared in this scope
   21 |             newStock = posession/a[i];
      |                        ^~~~~~~~~
a.cc:22:13: error: 'stock' was not declared in this scope
   22 |             stock += newStock;
      |             ^~~~~
a.cc:26:8: error: 'stock' was not declared in this scope
   26 |     if(stock) {
      |        ^~~~~
a.cc:27:9: error: 'posession' was not declared in this scope
   27 |         posession += stock * a[n-1];
      |         ^~~~~~~~~
a.cc:30:13: error: 'posession' was not declared in this scope
   30 |     cout << posession << endl;
      |             ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i = 0; i< N; i++)
 
 
int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll posession = 1000;
    ll stock = 0;
    rep(i,n-1) {
        if(a[i] == a[i+1]) continue;
        else if(a[i] > a[i+1]) {
            if(stock) {
                posession += stock * a[i];
                stock = 0;
            }
        } else if(a[i] < a[i+1]) {
            ll newStock = posession/a[i];
            stock += newStock;
            posession -= a[i] * newStock;
        }
    }
    if(stock) {
        posession += stock * a[n-1];
        stock = 0;
    }
    cout << posession << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'll' was not declared in this scope
   10 |     ll posession = 1000;
      |     ^~
a.cc:11:7: error: expected ';' before 'stock'
   11 |     ll stock = 0;
      |       ^~~~~~
      |       ;
a.cc:15:16: error: 'stock' was not declared in this scope
   15 |             if(stock) {
      |                ^~~~~
a.cc:16:17: error: 'posession' was not declared in this scope
   16 |                 posession += stock * a[i];
      |                 ^~~~~~~~~
a.cc:20:15: error: expected ';' before 'newStock'
   20 |             ll newStock = posession/a[i];
      |               ^~~~~~~~~
      |               ;
a.cc:21:13: error: 'stock' was not declared in this scope
   21 |             stock += newStock;
      |             ^~~~~
a.cc:21:22: error: 'newStock' was not declared in this scope
   21 |             stock += newStock;
      |                      ^~~~~~~~
a.cc:22:13: error: 'posession' was not declared in this scope
   22 |             posession -= a[i] * newStock;
      |             ^~~~~~~~~
a.cc:25:8: error: 'stock' was not declared in this scope
   25 |     if(stock) {
      |        ^~~~~
a.cc:26:9: error: 'posession' was not declared in this scope
   26 |         posession += stock * a[n-1];
      |         ^~~~~~~~~
a.cc:29:13: error: 'posession' was not declared in this scope
   29 |     cout << posession << endl;
      |             ^~~~~~~~~
Language: C++


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


int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll posession = 1000;
    ll stock = 0;
    rep(i,n-1) {
        if(a[i] == a[i+1]) continue;
        else if(a[i] > a[i+1]) {
            if(stock) {
                posession += stock * a[i];
                stock = 0;
            }
        } else if(a[i] < a[i+1]) {
            int newStock = posession/a[i];
            stock += newStock;
            posession -= a[i] * newStock;
        }
    }
    if(stock) {
        posession += stock * a[n-1];
        stock = 0;
    }
    cout << posession << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll posession = 1000;
      |     ^~
a.cc:12:7: error: expected ';' before 'stock'
   12 |     ll stock = 0;
      |       ^~~~~~
      |       ;
a.cc:16:16: error: 'stock' was not declared in this scope
   16 |             if(stock) {
      |                ^~~~~
a.cc:17:17: error: 'posession' was not declared in this scope
   17 |                 posession += stock * a[i];
      |                 ^~~~~~~~~
a.cc:21:28: error: 'posession' was not declared in this scope
   21 |             int newStock = posession/a[i];
      |                            ^~~~~~~~~
a.cc:22:13: error: 'stock' was not declared in this scope
   22 |             stock += newStock;
      |             ^~~~~
a.cc:26:8: error: 'stock' was not declared in this scope
   26 |     if(stock) {
      |        ^~~~~
a.cc:27:9: error: 'posession' was not declared in this scope
   27 |         posession += stock * a[n-1];
      |         ^~~~~~~~~
a.cc:30:13: error: 'posession' was not declared in this scope
   30 |     cout << posession << endl;
      |             ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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;}

const int MAX_N=80;
const int MAX_C=150000000;

int N;
int A[MAX_N+1];
int dp[2][MAX_C+5];
int ans;



void init(){
    for(int i=0;i<2;++i)for(int j=0;j<MAX_C+5;++j)dp[i][j]=-1;
}

signed main(){
    init();
    cin>>N;
    for(int i=0;i<N;++i)cin>>A[i];
    dp[0][0]=1000;
    for(int i=0;i<N;++i){
        for(int j=0;j<=MAX_C;++j){
            if(dp[i%2][j]==-1)continue;
            chmax(dp[(i+1)%2][j],dp[i%2][j]);
            chmax(dp[(i+1)%2][0],dp[i%2][j]+A[i]*j);
            int k=dp[i%2][j]/A[i];
            chmax(dp[(i+1)%2][j+k],dp[i%2][j]-A[i]*k);
            chmax(ans,dp[(i+1)%2][j]);
            chmax(ans,dp[(i+1)%2][0]);
            chmax(ans,dp[(i+1)%2][j+k]);
        }
    }
    cout<<ans<<endl;
}

Compiler output:
/tmp/ccYluAfs.o: in function `main':
a.cc:(.text+0x3a3): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYluAfs.o
a.cc:(.text+0x3e6): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYluAfs.o
a.cc:(.text+0x43f): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYluAfs.o
a.cc:(.text+0x47a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYluAfs.o
collect2: error: ld returned 1 exit status
Language: C++

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

ll dp[80][8001][801],n;

ll solve(ll arr[],ll idx,ll money,ll curr)
{
  //cout<<" at "<<idx<<" "<<money<<" "<<curr<<" "<<dp[idx][money][curr]<<endl;
  if(idx>=n) return money;
  if(dp[idx][money][curr]!=-1) return dp[idx][money][curr];
  dp[idx][money][curr]=0;
  // buy some here or dont buy
  if(money)
  {
  for(int i=0;i<=money/arr[idx];i++)
  {
    dp[idx][money][curr]=max(dp[idx][money][curr],
                          solve(arr,idx+1,money- i*arr[idx],curr+i));
  }
  }
  // sell some here
  for(int i=1;i<=curr;i++)
  {
    dp[idx][money][curr]=max(dp[idx][money][curr],
                        solve(arr,idx+1,money+i*arr[idx],curr-i));
  }
  // dont do anything
  dp[idx][money][curr]=max(dp[idx][money][curr],
                        solve(arr,idx+1,money,curr));
  //cout<<idx<<" "<<money<<" "<<curr<<" "<<dp[idx][money][curr]<<endl;
  return dp[idx][money][curr];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    ll arr[n];for(int i=0;i<n;i++) cin>>arr[i];
    memset(dp,-1,sizeof dp);
    // dp[money][stock_idx][stock_store];
    cout<<solve(arr,0,1000,0);
}

Compiler output:
/tmp/cc4m2I4R.o: in function `solve(long long*, long long, long long, long long)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4m2I4R.o
/tmp/cc4m2I4R.o: in function `main':
a.cc:(.text+0x3c3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4m2I4R.o
a.cc:(.text+0x3dc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4m2I4R.o
a.cc:(.text+0x45f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4m2I4R.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,a[1000],b[1000],var,temp_var,j;
    ll maxcost=1000;
    bool check=true;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(a[j]>a[i])
            {
                var=maxcost/a[i];
                maxcost=maxcost-var*a[i]+var*a[j];
                i=j;
                break;
            }
            else if(a[j]<a[i])
            {
                i=j;
                break;
            }
        }
    }
    cout<<maxcost<<'\n';
    return 0;g
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: 'g' was not declared in this scope
   34 |     return 0;g
      |              ^
Language: Java

import java.io.*;
import java.util.*;

public class D {
    public static void main(String args[]) throws Exception {
        BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
        int t = 1;
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(bu.readLine());
            int [] arr = new int[n];
            long money = 1000, stocks = 0;
            String[]inp = bu.readLine().split(" ");
            for (int pos = 0; pos < n; pos++) {
                arr[pos] = Integer.parseInt(inp[pos]);
            }
            int pos = 0, valley = 0, peak = 0;
            while (pos < n-1){
                while (pos < n-1 && arr[pos]>=arr[pos+1]){
                    pos++;
                }
                valley = pos;
                while (pos < n-1 && arr[pos]<=arr[pos+1]){
                    pos++;
                }
                peak = pos;
//                System.out.println(arr[peak]+" "+arr[valley]);
                stocks = money/arr[valley];
                money -= stocks*arr[valley];
                money+=arr[peak]*stocks;
            }
            sb.append(money+"\n");
        }
        System.out.print(sb);
    }
}


Compiler output:
Main.java:4: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
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>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    vi a(n+1);
    rep(i, n) cin >> a.at(i+1);
    vector<ll> dp(n+1);
    dp.at(0) = 1000;
    for (int k = 1; k <= n; k++) {
        dp.at(k) = 0;
        for (int i = 0; i < k-1; i++) {
            int m = 99999;
            for (int j = i+1; j < k; j++){
                m = min(m, a.at(j));
            }
            dp.at(k) = max(dp.at(k), dp.at(i)/m*a.at(k)+dp.at(i)%m);
        }
    }
    ll x = 0;
    rep(i, n+1) x = max(x, dp.at(i));
    cout << x << endl;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected '}' at end of input
   29 |     return 0;
      |              ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: Java

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
        int t = 1;
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(bu.readLine());
            int [] arr = new int[n];
            long money = 1000;
            int stocks = 0;
            String[]inp = bu.readLine().split(" ");
            for (int pos = 0; pos < n; pos++) {
                arr[pos] = Integer.parseInt(inp[pos]);
            }
            int pos = 0, valley = 0, peak = 0;
            while (pos < n-1){
                while (pos < n-1 && arr[pos]>=arr[pos+1]){
                    pos++;
                }
                valley = pos;
                while (pos < n-1 && arr[pos]<=arr[pos+1]){
                    pos++;
                }
                peak = pos;
//                System.out.println(arr[peak]+" "+arr[valley]);
                stocks = money/arr[valley];
                money -= stocks*arr[valley];
                money+=arr[peak]*stocks;
            }
            sb.append(money+"\n");
        }
        System.out.print(sb);
    }
}


Compiler output:
Main.java:29: error: incompatible types: possible lossy conversion from long to int
                stocks = money/arr[valley];
                              ^
1 error
Language: C++

#include<bits/stdc++.h>
const long long MAXN=105;
long long p[MAXN];
int main(){
	long long T,M=1000;
	cin>>T;
	for(long long i=1;i<=T;++i){
		cin>>p[i];
	}
	for(long long i=1;i<=T;++i){
		if(p[i]<p[i+1]){
			long long tot=M/p[i];
			if(tot==0) {
				continue;
			}
			M%=p[i];
			if(i<T&&p[i]<p[i+1]){
				++i;
			}
			M+=tot*p[i];
		}
	}
	cout<<M<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>T;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:23:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |         cout<<M<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:23:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |         cout<<M<<endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<stdio.h>
const long long MAXN=105;
long long p[MAXN];
int main(){
	long long T,M=1000;
	cin>>T;
	for(long long i=1;i<=T;++i){
		cin>>p[i];
	}
	for(long long i=1;i<=T;++i){
		if(p[i]<p[i+1]){
			long long tot=M/p[i];
			if(tot==0) {
				continue;
			}
			M%=p[i];
			if(i<T&&p[i]<p[i+1]){
				++i;
			}
			M+=tot*p[i];
		}
	}
	cout<<M<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin>>T;
      |         ^~~
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout<<M<<endl;
      |         ^~~~
a.cc:23:18: error: 'endl' was not declared in this scope
   23 |         cout<<M<<endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=n-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];


    //dp[i]:i日めが始まるタイミングでの所持金(株0)
    vl dp(n+1);
    dp[0]=1000;
    dp[1]=1000;

    //i日めに買ってj日めに売る
    rep(i,n-1){

        ll kabu=dp[i]/a[i];
        ll money=dp[i]%a[i];

        ll m=dp[i];
        repa(j,i+1,n){
            cmax(dp[j+1],max(money+kabu*a[j],m));]
            cmax(m,dp[j+1]);
        }
    }

    cout<<dp[n]<<"\n";

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:50: error: expected primary-expression before ']' token
   46 |             cmax(dp[j+1],max(money+kabu*a[j],m));]
      |                                                  ^
Language: Java

import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] b = new int[n];
    int a = 0;
    b[0] = 10000;
    boolean trig = true;
    int j = 0;
    long money = 1000;
    int kabu = 0;
    
    for (int i=0; i<n; i++){
      a = sc.nextInt();
      if (trig && b[j]>=a) {
        b[j] = a;
      } else if (trig) {
        trig = false;
        j++;
        b[j] = a;
      } else if (!trig && b[j]<=a) {
        b[j] = a;
      } else {
        trig = true;
        j++;
        b[j] = a;
      }
    }
        
    for (int i=0; i<=j; i++){
      if (i%2 == 1){
        money = money + kabu * b[i];
        kabu = 0;
      } else {
        kabu = money / b[i];
        money = money % b[i];
      }
    }
    
	System.out.println((money + kabu*b[j]));
    sc.close();
  }
}

Compiler output:
Main.java:37: error: incompatible types: possible lossy conversion from long to int
        kabu = money / b[i];
                     ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  long long a[n];
  for (int i=0;i<n;i++)
    cin>>a[i];
  long long money=1000;
  for (int i=0;i<n-1;i++){
  	long long stocks=money/a[i];
    money+=stocks*max(a[i+1]-a[i],0);
  }
  cout<<money;
}


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