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

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int D;
  cin>>D;
  vector<int> c(26);
  for(int &i:c)
    cin>>i;
  vector<vector<int>> s(D,vector<int>(26));
  for(vector<int> &v:s)
    for(int &i:v)
      cin>>i;
  vector<int> t(D);
  vector<int> A(26,0);
  int mzint=0;
  for(int i=0;i<D;i++){
    int mzi=mzint,mzin=0,k;
    for(int j=0;j<26;j++)
      mzi-=(i+1-A[j])*c[j];
    for(int j=0;j<26;j++){
      int l=mzi+s[i][j]-(i+1-A[j])*c[j];
      if(l>mzin){
        k=j;
        mzin=l;
      }
    }
    A[k]=i+1;
    mzint=mzin;
    t[i]=k+1;
  }
  int M=8000000,ans=mzint;
  while(M--){
    vector<pair<int,int>> AAA={make_pair(rand()%D,rand()%26),make_pair(rand()%D,rand()%26)};
    vector<int> BBB={t[AAA[0].first],t[AAA[1].first]};
    int ans2=ans;
    for(int aaa=0;aaa<2;aaa++){
    int d=AAA[aaa].first,q=AAA[aaa].second;
    ans+=s[d][q]-s[d][t[d]-1];
    int mae=-1,ato=D;
    for(int i=d-1;i>=0;i--){
      if(t[i]==t[d]){
        mae=i;
        break;
      }
    }
    for(int i=d+1;i<D;i+){
      if(t[i]==t[d]){
        ato=i;
        break;
      }
    }
    ans-=(ato-d)*(d-mae)*c[t[d]-1];
    mae=-1,ato=D;
    for(int i=d;i>=0;i--){
      if(t[i]==q+1){
        mae=i;
        break;
      }
    }
    for(int i=d;i<D;i++){
      if(t[i]==q+1){
        ato=i;
        break;
      }
    }
    ans+=(ato-d)*(d-mae)*c[q];
    t[d]=q+1;
    }
    if(ans2>ans){
      ans=ans2;
      t[AAA[0].first]=BBB[0];
      t[AAA[1].first]=BBB[1];
    }
  }
  for(int i:t)
    cout<<i<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:25: error: expected primary-expression before ')' token
   47 |     for(int i=d+1;i<D;i+){
      |                         ^
Language: C++

int D;
	cin >> D;
	vec(C);
	vec(Las);
	fx(26) {
		vecp(C);
		Las.push_back(0);
	}

	fx(D) {
		fy(26) {
			cin >> table[x][y];
		}
	}

	vec(T);
	srand((time(NULL)));
	fx(D) {
		pb(T, rand() % 26 + 1);
	}
	ll sum = 0,preSum=0;
	vector<int> S(D,0);

	int preDay = 0;
	fx(5000) {
		int d;
		 
		 int dif = INT_MAX, ind = 0;
		 fw(D-1) {
			 if (S[w+1]-S[w]<dif) {
				 ind = w + 1;
				 dif = S[w + 1] - S[w];
			 }
		 }
		 d = ind;
		 if (d==preDay || sum==preSum) {
			 int d1 = rand() % D+1, d2 = d1;
			 while (d1==d2) {
				 d2 = rand() % D + 1;
			 }
			 T[d1 - 1] ^= T[d2 - 1];
			 T[d2 - 1] ^= T[d1 - 1];
			 T[d1 - 1] ^= T[d2 - 1];
		 }

		 for (int q = 1; q <= 26; q++) {
			 int pre = T[d - 1];
			 if (q == pre) { continue;}
			 T[d - 1] = q;
			 ll ans = 0;
			 vector<int> G(S);
			 fy(26) {
				 Las[y] = 0;
			 }
			 fw(D) {

				 ans += table[w][T[w] - 1];
				 Las[T[w] - 1] = w + 1;
				 fz(26) {
					 ans -= C[z] * (w + 1 - Las[z]);
				 }
				 S[w] = ans;
			 }
			 if (ans > sum) {
				 sum = ans;
				 S = G;
			 }
			 else {
				 T[d - 1] = pre;
			 }
		 }
	
	}

	fx(D) {
		ce(T[x])
	}

Compiler output:
a.cc:2:9: error: 'cin' does not name a type
    2 |         cin >> D;
      |         ^~~
a.cc:3:12: error: expected constructor, destructor, or type conversion before '(' token
    3 |         vec(C);
      |            ^
a.cc:4:12: error: expected constructor, destructor, or type conversion before '(' token
    4 |         vec(Las);
      |            ^
a.cc:5:11: error: expected constructor, destructor, or type conversion before '(' token
    5 |         fx(26) {
      |           ^
a.cc:10:11: error: expected constructor, destructor, or type conversion before '(' token
   10 |         fx(D) {
      |           ^
a.cc:16:12: error: expected constructor, destructor, or type conversion before '(' token
   16 |         vec(T);
      |            ^
a.cc:17:14: error: expected constructor, destructor, or type conversion before '(' token
   17 |         srand((time(NULL)));
      |              ^
a.cc:18:11: error: expected constructor, destructor, or type conversion before '(' token
   18 |         fx(D) {
      |           ^
a.cc:21:9: error: 'll' does not name a type
   21 |         ll sum = 0,preSum=0;
      |         ^~
a.cc:22:9: error: 'vector' does not name a type
   22 |         vector<int> S(D,0);
      |         ^~~~~~
a.cc:25:11: error: expected constructor, destructor, or type conversion before '(' token
   25 |         fx(5000) {
      |           ^
a.cc:75:11: error: expected constructor, destructor, or type conversion before '(' token
   75 |         fx(D) {
      |           ^
Language: C++

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
		int D;
	cin >> D;
	vec(C);
	fx(26) {
		vecp(C);
	}
	fx(D) {
		int maxi = 0, index = 0;
		fy(26) {
			cin >> table[x][y];
			if (maxi < table[x][y]) {
				maxi = table[x][y];
				index = y;
			}
			
		}
		ce(index+1)
	}
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:32: error: 'table' was not declared in this scope
   44 |                         cin >> table[x][y];
      |                                ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time>

using namespace std;

typedef long long ll;

ll d;
ll c[29];
ll a[369][29];
ll t[369];
ll b[29];

int main()
{
    scanf("%lld", &d);
    srand(time(NULL));
    for(ll i = 1; i <= 26; i++)
    {
        scanf("%lld", &c[i]);
    }
    for(ll i = 1; i <= d; i++)
    {
        for(ll j = 1; j <= 26; j++)
        {
            scanf("%lld", &a[i][j]);
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= d; i++)
    {
        ll mx = -4e18, mi = 0;
        for(ll ii = 1; ii <= 26; ii++)
        {
            t[i] = ii;
            ll ans2 = 0;
            ll tt = b[t[i]];
            b[t[i]] = d;
            for(ll j = 1; j <= 26; j++)
            {
                ans2 -= (d - b[j]) * c[j];
            }
            ans2 += a[i][t[i]];
            if(mx < ans2) mx = ans2, mi = ii;
            b[t[i]] = tt;
        }
        t[i] = mi;
        b[t[i]] = d;
        for(ll j = 1; j <= 26; j++)
        {
            ans -= (d - b[j]) * c[j];
        }
        ans += a[i][t[i]];
    }
    ll loop = 10000;
    while(loop--)
    {
        ll x = rand() % d;
        ll y = rand() % 26 + 1;
        ll z = t[x];
        t[x] = y;
        ll ans2 = 0;
        for(ll i = 1; i <= d; i++)
        {
            ll mx = -4e18, mi = 0;
            ll tt = b[t[i]];
            b[t[i]] = d;
            for(ll j = 1; j <= 26; j++)
            {
                ans2 -= (d - b[j]) * c[j];
            }
            ans2 += a[i][t[i]];
        }
        if(ans2 > ans) ans = ans2, continue;
        else t[x] = z;
    }
    return 0;
}


Compiler output:
a.cc:4:10: fatal error: time: No such file or directory
    4 | #include <time>
      |          ^~~~~~
compilation terminated.
Language: C++

from random import random

K = 26
d = int(input())

c = list(map(int, input().split()))

s = []
for i in range(d):
    q = list(map(int, input().split()))
    s.append(q)

ans = []
last = [-1 for i in range(K)]
for i in range(d):
    x = []
    for j in range(K):
        x.append(pow(s[i][j] * s[i][j] * s[i][j] * c[j] * (i - last[j]) * c[j] * (i - last[j]), 2))

    sum = 0
    for j in range(K):
        sum += x[j]

    for j in range(K):
        x[j] /= sum

    prob = random()
    cur = 0
    for j in range(K):
        if cur + x[j] <= prob:
            cur += x[j]
            continue
        ans.append(j)
        last[j] = i
        break


def get_result():
    res = 0
    last = [-1 for i in range(K)]
    for i in range(d):
        res += s[i][ans[i]]
        last[ans[i]] = i
        for j in range(K):
            res -= c[j] * (i - last[j])
    return res


# print(get_result())
for u in ans:
    print(u + 1)


Compiler output:
a.cc:49:3: error: invalid preprocessing directive #print
   49 | # print(get_result())
      |   ^~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from random import random
      | ^~~~
Language: C

#include<stdio.h>

int main(void){
    int i, j, k;

    int score = 0;

    int d;//何日開催するのか
    scanf("%d", &d);

    int c[26];//各コンテストのペナルティ値
    for(i=0;i<26;i++) scanf("%d", c[i]);

    int s[d][26];//コンテストiをD日目に開催したときの得点
    for(i=0;i<d;i++) for(j=0;j<26;j++) scanf("%d", s[i][j]);

    int last[26];//各コンテストを最後に開催したのは何日目か
    for(i=0;i<26;i++) last[i] = 0;

    int holding[d];//D日目にコンテストiを開催する
    //初期解 ci*(d-last(d,i))が最大になるコンテストを開催してみる
    int max_i, max_sum;
    for(i=0;i<d;i++){
        max_i = 0;
        max_sum = c[0] * ( i+1 - last[0] );
        for(j=1;j<26;j++){
            if( max_sum < c[j] * ( i+1 - last[j] )){
                max_sum = c[j] * ( i+1 - last[j] );
                max_i = j;
            }
        }
        last[max_i] = i+1;
        holding[i] = max_i;
        score += s[i][max_i];
        for(j=0;j<26;j++) score -= c[j] * ( i+1 - last[j] )
    }

    //局所探索法

    //出力
    for(i=0;i<d;i++) printf("%d\n", holding[i]);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:60: error: expected ';' before '}' token
   35 |         for(j=0;j<26;j++) score -= c[j] * ( i+1 - last[j] )
      |                                                            ^
      |                                                            ;
   36 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
#include <boost/random.hpp>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
using boost::random::mt19937;
typedef long long ll;

int D;
int C[30];
int S[400][30];
int last[400][30];

ll score(vector<int>& t)
{
  ll s = 0LL;
  REP(i,t.size()){
    s += S[i][t[i]];
    REP(j,26) last[i+1][j] = last[i][j];
    last[i+1][t[i]] = i+1;
    REP(j,26){
      s -= C[j] * (i+1-last[i+1][j]);
    } 
  }
  return s;
}

ll score_2(vector<int>& t, ll before, int d, int old, int q)
{
  ll s = before;
  s += S[d][q] - S[d][old];
  FOR(i,d,D){
    if(t[i]==old) break;
    s += C[old] * ((i+1) - last[i+1][old]);
    s -= C[old] * ((i+1) - last[d][old]);
  }
  FOR(i,d,D){
    if(i!=d && t[i]==q) break;
    s += C[q] * ((i+1) - last[i+1][q]);
    s -= C[q] * ((i+1) - (d+1));
  }

  return s;
}

vector<int> init(void)
{
  vector<int> t;
  REP(d, D){
    ll max_sc = LLONG_MIN;
    int ind = 0;
    REP(i,26){
      t.push_back(i);
      ll sc = score(t);
      if(max_sc<sc){
        max_sc = sc;
        ind = i;
      }
      t.pop_back();
    }
    t.push_back(ind);
  }
  return t;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<> rand365(0, 364);
  uniform_int_distribution<> rand26(0, 25);
  uniform_int_distribution<> rand2(0, 1);
  uniform_int_distribution<> rand360(0, 359);
  uniform_int_distribution<> rand4(0, 3);

  cin >> D;
  REP(i,26) cin >> C[i];
  REP(i,D) REP(j,26) cin >> S[i][j];

  auto T = init();
  ll max_score = score(T);
  
  int ti = clock();
  while(clock() - ti < 190 * CLOCKS_PER_SEC / 100){ 
    REP(loop,100){
      int cmd = rand2(mt);
      if(cmd==0){
        int d = rand365(mt);
        int q = rand26(mt);
        int old = T[d];
        T[d] = q;
        ll tmp = score_2(T, max_score, d, old, q);
        if(max_score<tmp){
          max_score = tmp;
          FOR(i,d,D){
            if(T[i]==old) break;
            last[i+1][old] = last[d][old];
          }
          FOR(i,d,D){
            if(i!=d && T[i]==q) break;
            last[i+1][q] = (d+1);
          }
        }else{
          T[d] = old;
        }
      }else{
        int d1 = rand360(mt);
        int d2 = d1 + rand4(mt);
        swap(T[d1],T[d2]);
        ll tmp = score(T);
        if(max_score<tmp){
          max_score = tmp;
        }else{
          swap(T[d1], T[d2]);
          REP(i,D) REP(j,64) last[i+1][j] = last[i][j];
        }
      }
    }
  }
  REP(i,D) cout << T[i]+1 << '\n';
  return 0;
}


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

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;
#define ll long long

int d = 365;
//int k = 0;
vector<vector<int>> s(d, vector<int>(26, 0));
vector<ll> c(26);

void init() {
    cin >> d;
    for(int i = 0; i < 26; i++) cin >> c[i];
    for(int i = 0; i < d; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    return;
}

ll calc(vector<int> out) {
    ll score = 0;
    vector<ll> last(26, 0);
    for(int i = 0; i < out.size(); i++) {
        //cout << i << endl;
        last[out[i]] = i+1; // タイプ番号
        //cout << "out[" << i << "] " << out[i] << " ";
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        score += s[i][out[i]];
        //cout << "score : " << score << endl;
    }

    //int p = min(int(out.size()+k), int(d));
    //cout << p << endl;
    //if(out.size() >= d) return score;
    //cout << k << endl;
    //cout << out.size() << " " << d << endl;
    int p = min(int(out.size()+k), d);
    for(int i = out.size(); i < p; i++) {
        //cout << i << endl;
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        //cout << score << endl;
    }
    return score;
}

/*
vector<int> proc(int k) {
    vector<int> out;
    ll ans = 0;
    //ll tmp = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
    //cout << "k: " << k << endl;
    //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            ll tmp = calc(out);
            if(max_v < tmp) {
                max_v = tmp;
                best = j;
            }
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    return out;
}
*/

int main() {
    init();
    /*
    vector<int> out;
    vector<int> ans;
    for(int i = 0; i <= 26; i++) {
        out = proc(i);
        for(int j = 0; j < out.size(); j++) {

        }
    }
    */
    
    vector<int> out;
    ll ans = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
        //cout << "k: " << k << endl;
        //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            
            ll tmp = calc(out);
            if(max_v < tmp) {
              max_v = tmp;
              best = j;
            }
            
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    
    for(int i = 0; i < d; i++) {
        cout << out[i]+1 << endl;
    }
    //cout << max_v << endl;
    return 0;
}

Compiler output:
a.cc: In function 'long long int calc(std::vector<int>)':
a.cc:44:32: error: 'k' was not declared in this scope
   44 |     int p = min(int(out.size()+k), d);
      |                                ^
Language: C

#include <stdio.h>

int d;
int c[27];
int s[366][26];


int main(){
  scanf("%d",&d);
  for(int i=0;i<d;i++){
    scanf("%d",&c[i]);}
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      scanf("%d",&s[i][j]);}}

  last[27]={};
  for(int i=1;i<=d;i++){
    int max=0;
    int maxid=0;
    for(int j=0;j<26;j++){
      int tmp = c[j]*(i-last[j]+1);
      if(tmp>max){
	max = tmp;
	maxid = j;}
    }
    last[maxid]=i;
    printf("%d\n",maxid+1);}

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:3: error: 'last' undeclared (first use in this function)
   16 |   last[27]={};
      |   ^~~~
main.c:16:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:12: error: expected expression before '{' token
   16 |   last[27]={};
      |            ^
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int d=sc.nextInt();
    int[] c=new int[26];
    int[] wc=new int[27];
    for(int i=0;i<26;i++){
      c[i]=sc.nextInt();
      wc[i+1]=wc[i]+c[i];
    }
    Random rd=new Random();
    for(int i=0;i<d;i++){
      int r=rd.nextInt(wc[26]);
      for(int i=0;i<26;i++){
        if(r<wc[i]){
          System.out.println(i+1);
          break;
        }
      }
    }
  }
}

Compiler output:
Main.java:16: error: variable i is already defined in method main(String[])
      for(int i=0;i<26;i++){
              ^
1 error
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define type 26

int constant(int day)//1~26 順番
{
  return day%type+1;
}
int get_random()//1~26 ランダム
{
  return rand()%type+1;
}
int max(int s[][type+1],int day)//その日の最大の満足度選ぶ
{
  int m,max_score=0,i;
  for(i=1;i<=type;i++)
  {
    if(s[day][i]>max_score){
      max_score=s[day][i];
      m=i;
    }
  }
  return m;
}
void cal(int select,int c[type+1],int last[type+1],int s[][type+1],int day,int sum[])
{
  int i;
  sum[day]=sum[day-1]+s[day][select];
  for(i=1;i<=type;i++){
    sum[day]-=c[i]*(day-last[i]);
  }
}
void change(int c[type+1],int last[type+1],int s[][type+1],int sum[],int schedul[],int D)
//ランダムに変更
{
  int d,t,old,total=0,i,j;
  d=rand()%D+1;
  t=rand()%type+1;
  old=schedul[d];
  schedul[d]=t;
  for(i=1;i<=type;i++) last[i]=0;
  for(i=1;i<=D;i++){
    total+=s[i][schedul[i]];
    last[schedul[i]]=i;
    for(j=1;j<=type;j++){
     total-=c[j]*(i-last[j]);
   }
  }
  if(total>sum[D]){
  //  printf("change\n");
    sum[D]=total;
  }
  else{
    schedul[d]=old;
  }
}
int main(void)
{
  int D,c[type+1],i,j;
  clock_t start,stop;
  srand((unsigned int)time(NULL));
  scanf("%d",&D);//D=365
  int s[D+1][type+1],last[type+1],sum[D+1],schedul[D+1];
  for(i=0;i<=D;i++) sum[i]=0;
  for(i=1;i<=type;i++) last[i]=0;
  for(i=1;i<=type;i++) scanf("%d",&c[i]);
  for(i=1;i<D+1;i++){
    for(j=1;j<=type;j++) scanf("%d",&s[i][j]);
  }
  start=clock();
  for(i=1;i<D+1;i++){
    int select;
    select=max(s,i);
    last[select]=i;
    schedul[i]=select;
    cal(select,c,last,s,i,sum);
    //printf("%d\n",sum[i]);
  }
  int count=0;
  stop=start;
  while((double)(stop - start) / CLOCKS_PER_SEC<1.98){
    cross(c,last,s,sum,schedul,D);
    count++;
    stop=clock();
  }
  /*
  printf("count:%d\n",count);
  printf("time:%f\n",(double)(stop - start) / CLOCKS_PER_SEC);
  printf("%d\n",sum[D]);
  printf("確認\n");
  int total=0;
  for(i=1;i<=type;i++) last[i]=0;
  for(i=1;i<=D;i++){
    total+=s[i][schedul[i]];
    last[schedul[i]]=i;
    for(j=1;j<=type;j++){
     total-=c[j]*(i-last[j]);
   }
  }
  printf("%d\n",total);
*/
  for(i=1;i<=D;i++) printf("%d\n",schedul[i]);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:83:5: error: implicit declaration of function 'cross' [-Wimplicit-function-declaration]
   83 |     cross(c,last,s,sum,schedul,D);
      |     ^~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define type 26

int constant(int day)//0~25 順番
{
  return day%type+1;
}
int random()
{

}
int cal(int select,int c[type+1],int last[type+1],int s[][type+1],int day,int sum)
{
  int i;
  sum+=s[day][select];
  for(i=1;i<=type;i++){
    sum-=c[i]*(day-last[i]);
  }
  return sum;
}
int main(void)
{
  int D,c[type+1],i,j,sum=0;
  scanf("%d",&D);//D=365
  int s[D+1][type+1],last[type+1];
  for(i=1;i<=type;i++) last[i]=0;
  for(i=1;i<=type;i++) scanf("%d",&c[i]);
  for(i=1;i<D+1;i++){
    for(j=1;j<=type;j++) scanf("%d",&s[i][j]);
  }
  for(i=1;i<D+1;i++){
    int select;
    select=constant(i);
    last[select]=i;
    sum=cal(select,c,last,s,i,sum);
    printf("%d\n",select);
  }
  return 0;
}


Compiler output:
main.c:10:5: error: conflicting types for 'random'; have 'int()'
   10 | int random()
      |     ^~~~~~
In file included from main.c:2:
/usr/include/stdlib.h:521:17: note: previous declaration of 'random' with type 'long int(void)'
  521 | extern long int random (void) __THROW;
      |                 ^~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
#include<tuple>
using namespace std;

random_device rd;
mt19937 gen( rd() );
uniform_int_distribution<> dis( 1, 26 );
int d;
vector< int > c( 30 ), last( 30, 0 );
vector< vector< int > > arr( 400, vector< int >( 30, 0 ) );

int main( void )
{
	ios :: sync_with_stdio( 0 );
	cin.tie( 0 );
	
	cin >> d;
	for( int i = 1; i <= 26; ++i )
	{
		cin >> c[ i ];
	}
	for( int i = 1; i <= d; ++i )
	{
		for( int j = 1; j <= 26; ++j )
		{
			cin >> arr[ i ][ j ];
		}
	}
	for( int i = 1; i <= d; ++i )
	{
		cout << dis( gen ) << "\n";
	}
	return 0;
}

Compiler output:
a.cc:20:1: error: 'random_device' does not name a type; did you mean 'random_data'?
   20 | random_device rd;
      | ^~~~~~~~~~~~~
      | random_data
a.cc:21:1: error: 'mt19937' does not name a type
   21 | mt19937 gen( rd() );
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:46:30: error: 'gen' was not declared in this scope
   46 |                 cout << dis( gen ) << "\n";
      |                              ^~~
Language: C++

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

int c[33], s[444][33];
int sco(int t, const vector<int> &v) {
    int r = 0, l = 0, d = v.size();
    for(int i = 0; i < d; i++)
        if(v[i] == t)
            r += s[i][t] - c[t] * (i + 1 - l) * (i - l) / 2, l = i + 1;
    r -= c[t] * (d + 1 - l) * (d - l) / 2;
    return r;
}
int main() {
    int d;
    cin >> d;
    for(int i = 0; i < 26; i++)
        cin >> c[i];
    for(int i = 0; i < d; i++)
        for(int j = 0; j < 26; j++)
            cin >> s[i][j];
    vector<int> ss, tt;
    int M = -1e9;
    for(int a = 10; a < 16; a++) {
        for(int b = 0; b < 4; b++) {
            for(int z = 5; z < 16; z++) {
                int r = 0, l[33] = {};
                ss.clear();
                for(int i = 0; i < d; i++) {
                    auto m = 0.;
                    int t = 0;
                    for(int j = 0; j < 26; j++) {
                        double p = s[i][j];
                        p += c[j] * (i + 1 - l[j]) * .4 * a;
                        for(int k = 1; k < z; k++)
                            if(i + k < d)
                                p -= s[i + k][j] * (z - k) * .05 / z * b;
                        if(p > m)
                            m = p, t = j;
                    }
                    ss.push_back(t);
                    r -= c[t] * (i + 1 - l[t]) * (i - l[t]) / 2;
                    l[t] = i + 1;
                    r += s[i][t];
                }
                for(int j = 0; j < 26; j++)
                    r -= c[j] * (d + 1 - l[j]) * (d - l[j]) / 2;
                if(r > M)
                    M = r, tt.swap(ss);
            }
        }
    }
    random_device rd;
    mt19937 mt(rd());
    uniform_int_distribution<> rc(0, 25), r0(0, d - 1), r2(1, 6);
    uniform_real_distribution<> ru(0, 1);
    int cnt = 0;
    auto ti = clock();
    for(;;) {
        auto T = (clock() - ti) / 1.9 / CLOCKS_PER_SEC;
        if(T > 1)
            break;
        auto U = pow(2e3, 1 - T) * pow(6e2, T);
        for(int cn = 0; cn < 100; cn++, cnt++) {
            auto uu = tt;
            int di;
            if(rc(mt) < 13) {
                int x0 = r0(mt), xc = rc(mt);
                uu[x0] = xc;
                di = sco(tt[x0], uu) + sco(xc, uu) - sco(tt[x0], tt) -
                     sco(xc, tt);
            } else {
                int x2 = r2(mt);
                uniform_int_distribution<> r1(0, d - 1 - x2);
                int x1 = r1(mt);
                x2 += x1;
                swap(uu[x1], uu[x2]);
                di = sco(tt[x1], uu) + sco(tt[x2], uu) - sco(tt[x1], tt) -
                     sco(tt[x2], tt);
            }
            if(ru(mt) <= exp(di / U))
                tt.swap(uu);
        }
    }
    int M = 0;
    for(int j = 0; j < 26; j++)
        M += sco(j, tt);
    for(int i : tt)
        cout << i + 1 << '\n';
    cerr << M << endl;
    cerr << cnt << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:84:9: error: redeclaration of 'int M'
   84 |     int M = 0;
      |         ^
a.cc:22:9: note: 'int M' previously declared here
   22 |     int M = -1e9;
      |         ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
#define INF 1e9

static const int seed=6;
static const int D=365;
static const int ntype=26;
static int t=1e5;
static int ans[t+1][D+1];
static int max_score=-INF;
static int t=1e5;
class Contest{
public:
    Contest(){
        last=0;
    }
    int s[D+1];
    int c;
    int last;
};

static Contest contest[ntype+1];

void Input(){
    int d;
    cin>>d;
    for(int i=1;i<=ntype;++i){
        int t;
        cin>>t;
        contest[i].c=t;
    }
    for(int day=1;day<=D;++day){
        for(int type=1;type<=ntype;++type){
            int t;
            cin>>t;
            contest[type].s[day]=t;
        }
    }
}

int evaluate(int i){
    int sum=0;
    vector<int> l(ntype+1,0);
    for(int day=1;day<=D;++day){
        int type=ans[i][day];
        sum+=contest[type].s[day];
        l[type]=day;
        for(int t=1;t<=ntype;++t){
            sum-=contest[t].c*(day-l[t]);
        }
    }
    return sum;   
}

void Output(int i){
    for(int d=1;d<=D;++d) cout<<ans[i][d]<<endl;
}

void Init(int k){
    for(int i=0;i<k;++i){
        for(int d=1;d<=D;++d) ans[i][d]=rand()%ntype+1;
    }
}

int solve(){
    Init(t);
    int max_p=-1;
    for(int i=0;i<t;++i){
        int temp=evaluate(i);
        if(max_score<temp){
            max=temp;
            max_p=i;
        }
    }
    return max_p;
}

int main(){
    srand(seed);
    Input();
    Output(solve());
}


Compiler output:
a.cc:12:17: error: size of array 'ans' is not an integral constant-expression
   12 | static int ans[t+1][D+1];
      |                ~^~
a.cc:14:12: error: redefinition of 'int t'
   14 | static int t=1e5;
      |            ^
a.cc:11:12: note: 'int t' previously defined here
   11 | static int t=1e5;
      |            ^
a.cc: In function 'int solve()':
a.cc:74:17: error: overloaded function with no contextual type information
   74 |             max=temp;
      |                 ^~~~
Language: C++

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

int main() {
    int d;
    cin >> d;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    rep(i, d){
        vector<int> s(26);
        rep(i, 26) cin >> s[i];
        int t;
        t = 2
        cout << t << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: expected ';' before 'cout'
   15 |         t = 2
      |              ^
      |              ;
   16 |         cout << t << endl;
      |         ~~~~
Language: C++

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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

vector<int> c(26);
vector<vector<int>> s(365 ,vector<int>(26));
vector<vector<int>> last(365 ,vector<int>(26));

int culc(int d){
    int ret=0;
    int maxv=0;
    rep(j,26){
    if(s[d][j]+c[j]*(d+1-last[d][j])>maxv){
        maxv=s[d][j]+c[j]*(d+1-last[d][j]);
        ret=j+1;
    }
    return ret;
}

int main(){
    int D;
    cin>>D;
    rep(i,26){ 
        cin>>c[i];
    }
    rep(d,D) rep(j,26) cin>>s[d][j];
    int t;
    int v=0;
    vector<int> kaisai_bi(26);
    int ans=18398+s[1][16];
    rep(j,26){
        if(j==16)continue;
        else if(j==0)ans-=c[j]*(2-1);
        else ans-=c[j]*(2-0);
    }
    rep(d,D) {
//        cin>>t;
        t=culc(d);
        cout<<t<<endl;
        t--;
        v+=s[d][t];
        kaisai_bi[t]=d+1;
        rep(j,26) last[d][j]=kaisai_bi[j];
        rep(j,26){ 
            v-=c[j]*(d+1-last[d][j]);
            }
    }
//    cout<<v<<endl;

    int m;
//    cin>>m;
m=0;
    rep(i,m){
        int dd,q;
        cin>>dd>>q;
        q--;
        int j=0;
        while(last[dd-1][j]!=dd || j>=26) j++;
        if(j==26){ 
            cout<<"error"<<endl;
            return 0;
        }
        v-=s[dd-1][j];
        for(int d=dd-1;d<D;d++){ 
            if(last[d][j]==dd){
                v+=c[j]*(d+1-last[d][j]);
                last[d][j]=(d==0? 0 : last[d-1][j]);
                v-=c[j]*(d+1-last[d][j]);
            }
            else{ 
                break;
            }
        }
        
        v+=s[dd-1][q];
        int before=last[dd-1][q];
        for(int d=dd-1;d<D;d++){ 
            if(last[d][q]==before){ 
                v+=c[q]*(d+1-last[d][q]);
                last[d][q]=dd;
                v-=c[q]*(d+1-last[d][q]);
            }
            else{ 
                break;
            }
        }
        cout<<v<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int culc(int)':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main(){
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main(){
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:11: error: a function-definition is not allowed here before '{' token
   35 | int main(){
      |           ^
a.cc:105:2: error: expected '}' at end of input
  105 | }
      |  ^
a.cc:24:16: note: to match this '{'
   24 | int culc(int d){
      |                ^
a.cc:105:2: warning: control reaches end of non-void function [-Wreturn-type]
  105 | }
      |  ^
Language: C++

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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

vector<int> c(26);
vector<vector<int>> s(365 ,vector<int>(26));
vector<vector<int>> last(365 ,vector<int>(26));

int culc(int d){
    int ret;
    int maxv=0;
    rep(j,26){
    if(s[d][j]+c[j]*(d+1-last[d][j])>maxv){
        maxv=s[d][j]+c[j]*(d+1-last[d][j]);
        ret=j+1;
    }
    return ret;
}

int main(){
    int D;
    cin>>D;
    rep(i,26){ 
        cin>>c[i];
    }
    rep(d,D) rep(j,26) cin>>s[d][j];
    int t;
    int v=0;
    vector<int> kaisai_bi(26);
    int ans=18398+s[1][16];
    rep(j,26){
        if(j==16)continue;
        else if(j==0)ans-=c[j]*(2-1);
        else ans-=c[j]*(2-0);
    }
    rep(d,D) {
//        cin>>t;
        t=culc(d);
        cout<<t<<endl;
        t--;
        v+=s[d][t];
        kaisai_bi[t]=d+1;
        rep(j,26) last[d][j]=kaisai_bi[j];
        rep(j,26){ 
            v-=c[j]*(d+1-last[d][j]);
            }
    }
//    cout<<v<<endl;

    int m;
//    cin>>m;
m=0;
    rep(i,m){
        int dd,q;
        cin>>dd>>q;
        q--;
        int j=0;
        while(last[dd-1][j]!=dd || j>=26) j++;
        if(j==26){ 
            cout<<"error"<<endl;
            return 0;
        }
        v-=s[dd-1][j];
        for(int d=dd-1;d<D;d++){ 
            if(last[d][j]==dd){
                v+=c[j]*(d+1-last[d][j]);
                last[d][j]=(d==0? 0 : last[d-1][j]);
                v-=c[j]*(d+1-last[d][j]);
            }
            else{ 
                break;
            }
        }
        
        v+=s[dd-1][q];
        int before=last[dd-1][q];
        for(int d=dd-1;d<D;d++){ 
            if(last[d][q]==before){ 
                v+=c[q]*(d+1-last[d][q]);
                last[d][q]=dd;
                v-=c[q]*(d+1-last[d][q]);
            }
            else{ 
                break;
            }
        }
        cout<<v<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int culc(int)':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main(){
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main(){
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:11: error: a function-definition is not allowed here before '{' token
   35 | int main(){
      |           ^
a.cc:105:2: error: expected '}' at end of input
  105 | }
      |  ^
a.cc:24:16: note: to match this '{'
   24 | int culc(int d){
      |                ^
a.cc:105:2: warning: control reaches end of non-void function [-Wreturn-type]
  105 | }
      |  ^
Language: C++

#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma GCC diagnostic ignored "-Wunused-result"

#include <cstdio>
#include <chrono>
#include <random>

using namespace std;
using namespace chrono;

constexpr int c_max = 26;
constexpr int D = 365;
constexpr int INF = 1e9;
constexpr int time_limit = 1987;

int c[c_max];
int s[D][c_max];
int best_score[D];
int last[c_max];
int schedule[D];

inline int calc_score(const int &day, const int &examining) {
  int ret;
  if (day == 0) ret = s[day][examining];
  else ret = best_score[day - 1] + s[day][examining];
  
  for (int i = 0; i < c_max; i++) {
    if (i == examining) continue;
    ret -= (day - last[i]) * c[i];
  }

  return ret;
}

inline int calc_score_diff(const int &day1, const int &day2) {
  int prev_interval_1 = 0;
  for (int i = day1 - 1; i >= 0; i--) {
    prev_interval_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int prev_interval_2 = 0;
  for (int i = day2 - 1; i >= 0; i--) {
    prev_interval_2++;
    if (schedule[i] == schedule[day2]) break;
  }

  int new_interval_1 = 0;
  for (int i = day2 - 1; i >= 0; i--) {
    new_interval_1++;
    if (schedule[i] == schedule[day1]) break;
  }

  int new_interval_2 = 0;
  for (int i = day1 - 1; i >= 0; i--) {
    new_interval_2++;
    if (schedule[i] == schedule[day2]) break;
  }

  int ret = s[day1][schedule[day2]] + s[day2][schedule[day1]]
          - s[day1][schedule[day1]] - s[day2][schedule[day2]];
  
  ret += c[schedule[day1]] * ((prev_interval_1 + 1) * prev_interval_1 - (new_interval_1 + 1) * new_interval_1) / 2;
  ret += c[schedule[day2]] * ((prev_interval_2 + 1) * prev_interval_2 - (new_interval_2 + 1) * new_interval_2) / 2;

  return ret;
}

int main() {
  system_clock::time_point start = system_clock::now(), now;

  random_device seed;
  mt19937 rnd(seed());

  /* input */
  scanf("%*d");

  for (int i = 0; i < c_max; i++) {
    scanf("%d", &c[i]);
  }

  for (int i = 0; i < D; i++) {
    for (int j = 0; j < c_max; j++) {
      scanf("%d", &s[i][j]);
    }
  }

  /* calc initial solution */
  for (int d = 0; d < D; d++) {
    int best = -INF;
    int contest_to_hold = 0;
    for (int type = 0; type < c_max; type++) {
      int score = calc_score(d, type);
      if (best < score) {
        best = score;
        contest_to_hold = type;
      }
    }
    last[contest_to_hold] = d;
    schedule[d] = contest_to_hold;
  }

  /* try and error */
  int day1, score_diff, tmp;
  while (1) {
    now = system_clock::now();
    if (duration_cast<milliseconds>(now - start).count() > time_limit) break;
    day1 = rnd() % (D-1);
    // day2 = rnd() % D;
    score_diff = calc_score_diff(day1, day1 + 1);
    if (score_diff > 0) {
      tmp = schedule[day1];
      schedule[day1] = schedule[day2];
      schedule[day1 + 1] = tmp;
    }
  }

  /* output */
  for (const int &x : schedule) {
    printf("%d\n", x+1);
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:114:33: error: 'day2' was not declared in this scope; did you mean 'day1'?
  114 |       schedule[day1] = schedule[day2];
      |                                 ^~~~
      |                                 day1
Language: C++

#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <random>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

const Int alp = 26;

Int compute_score(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    return score;
}

Int evaluate(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out, Int &k) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    Int count = min(D, (Int)(out.size() + k));
    for (Int d = out.size(); d < count; d++) {
        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
    }

    return score;
}

vector<Int> solve(Int &D, vector<vector<Int>> &s, vector<Int> &c, Int &k) {
    vector<Int> out;

    for (Int _ = 0; _ < D; _++) {
        Int max_score = -INF;
        Int best_i = 0;

        for (Int i = 0; i < alp; i++) {
            out.push_back(i);

            Int score = evaluate(D, s, c, out, k);
            if (max_score < score) {
                max_score = score;
                best_i = i;
            }

            out.pop_back();
        }

        out.push_back(best_i);
    }

    return out;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    Int D;
    cin >> D;
    vector<Int> c(alp);
    vector<vector<Int>> s(D, vector<Int>(alp));
    for (Int i = 0; i < alp; i++) {
        cin >> c[i];
    }
    for (Int i = 0; i < D; i++) {
        for (Int j = 0; j < alp; j++) {
            cin >> s[i][j];
        }
    }

    Int k = 13;
    auto ans = solve(D, s, c, k);
    for (auto e : ans) {
        cout << e + 1 << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'Int evaluate(Int&, std::vector<std::vector<long int> >&, std::vector<long int>&, std::vector<long int>&, Int&)':
a.cc:67:9: error: redeclaration of 'Int count'
   67 |     Int count = min(D, (Int)(out.size() + k));
      |         ^~~~~
a.cc:57:9: note: 'Int count' previously declared here
   57 |     Int count = out.size();
      |         ^~~~~
Language: C

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#include <stdio.h>

const int c_max = 26;
const int D = 365;
const int INF = 1e9;
int c[c_max];
int s[D][c_max];
int best_score[D];
int last[c_max];

inline int calc_score(const int day, const int examining) {
  int ans;
  if (day == 0) ans = s[day][examining];
  else ans = best_score[day - 1] + s[day][examining];
  
  for (int i = 0; i < c_max; i++) {
    if (i == examining) continue;
    ans -= (day - last[i]) * c[i];
  }

  return ans;
}

int main() {
  // input part
  scanf("%*d");

  for (int i = 0; i < c_max; i++) {
    scanf("%d", &c[i]);
  }

  for (int i = 0; i < D; i++) {
    for (int j = 0; j < c_max; j++) {
      scanf("%d", &s[i][j]);
    }
  }
  // end of the input part

  int schedule[D];

  for (int d = 0; d < D; d++) {
    int best = -INF;
    int contest_to_hold = 0;
    for (int type = 0; type < c_max; type++) {
      int score = calc_score(d, type);
      if (best < score) {
        best = score;
        contest_to_hold = type;
      }
    }
    last[contest_to_hold] = d;
    schedule[d] = contest_to_hold;
  }

  for (int i = 0; i < D; i++) {
    printf("%d\n", schedule[i] + 1);
  }
  return 0;
}


Compiler output:
main.c:9:5: error: variably modified 'c' at file scope
    9 | int c[c_max];
      |     ^
main.c:10:5: error: variably modified 's' at file scope
   10 | int s[D][c_max];
      |     ^
main.c:10:5: error: variably modified 's' at file scope
main.c:11:5: error: variably modified 'best_score' at file scope
   11 | int best_score[D];
      |     ^~~~~~~~~~
main.c:12:5: error: variably modified 'last' at file scope
   12 | int last[c_max];
      |     ^~~~
Language: C++

var
	i:Smallint;
begin
	for i:=1 to 365 do writeln(1);
end.


Compiler output:
a.cc:1:1: error: 'var' does not name a type
    1 | var
      | ^~~
a.cc:3:1: error: 'begin' does not name a type
    3 | begin
      | ^~~~~
a.cc:5:1: error: 'end' does not name a type
    5 | end.
      | ^~~
Language: C++

#include<iostream>
int main(){while(2)std::cout<<2<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    2 | int main(){while(2)std::cout<<2<<endl;}
      |                                  ^~~~
      |                                  std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

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

///int t;
///cin >> t;
///for (int i = 1; i <= t; i++) {

int main() {
    int D;
    cin >> D;
    vector<int> c;
    vector<int> s;
    vector<int> t;
    vector<int> contests_held;
    int S = 0;
    for (int j = 0; j < 26; j++) {
        int tempC = 0;
        cin >> tempC;
        c.push_back(tempC);
    }
    for (int d = 1; d <= D; d++) {
        for (int l = 0; l < 26; l++) {
            int tempS = 0;
            cin >> tempS;
            s.push_back(tempS);
        }
    }
    for (int e = 0; e < D; e++) {
        int tempT = 0;
        cin >> tempT;
        t.push_back(tempT);
        contests_held.push_back(tempT);
        int u = 0;
        u = (e * 26 ) + t[e];
        S += s[u];
        for (int a = 0; a < 26; a++) {
            int contest_count = 0;
            int tempContestDay = 0;
            for (int n = 0; n <= e; n++) {
                if (contests_held[n] == a) {
                    contest_count += 1;
                    tempContestDay = n;
                }
            }
            if (contest_count == 0) {
                S -= c[a] * (e + 1);
            } else {
                S -= c[a] * (e - tempContestDay);
            }
        }
        cout << S;
    }
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int D;
  cin>>D;
  vector<int> c(26);
  for(int &i:c)
    cin>>i;
  vector<vector<int>> s(D,vector<int>(26));
  for(vector<int> &v:s)
    for(int &i:v)
      cin>>i;
  vector<int> t(D);
  vector<int> A(26,0);
  int mzint=0;
  for(int i=0;i<D;i++){
    int mzi=mzint,mzin=0,k;
    for(int j=0;j<26;j++)
      mzi-=(i+1-A[j])*c[j];
    for(int j=0;j<26;j++){
      int l=mzi+s[i][j]-(i+1-A[j])*c[j];
      if(l>mzin){
        k=j;
        mzin=l;
      }
    }
    A[k]=i+1;
    mzint=mzin;
    t[i]=k+1;
  }
  int M=1000000,ans=mzint;
  while(M--){
    vector<pair<int,int>> AAA={make_pair(rand()%D,rand()%26),make_pair(rand()%D,rand()%26),make_pair(rand()%D,rand()%26)};
    vector<int> BBB={t[AAA[0].first],t[AAA[1].first],t[A[2].first]};
    int ans2=ans;
    for(int aaa=0;aaa<3;aaa++){
    int d=AAA[aaa].first,q=AAA[aaa].second;
    ans+=s[d][q]-s[d][t[d]-1];
    int mae=-1,ato=D;
    for(int i=d-1;i>=0;i--){
      if(t[i]==t[d]){
        mae=i;
        break;
      }
    }
    for(int i=d+1;i<D;i++){
      if(t[i]==t[d]){
        ato=i;
        break;
      }
    }
    ans-=(ato-d)*(d-mae)*c[t[d]-1];
    mae=-1,ato=D;
    for(int i=d;i>=0;i--){
      if(t[i]==q+1){
        mae=i;
        break;
      }
    }
    for(int i=d;i<D;i++){
      if(t[i]==q+1){
        ato=i;
        break;
      }
    }
    ans+=(ato-d)*(d-mae)*c[q];
    t[d]=q+1;
    }
    if(ans2>ans){
      ans=ans2;
      t[AAA[0].first]=BBB[0];
      t[AAA[1].first]=BBB[1];
      t[AAA[2].first]=BBB[2];
    }
  }
  for(int i:t)
    cout<<i<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:61: error: request for member 'first' in 'A.std::vector<long long int>::operator[](2)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   35 |     vector<int> BBB={t[AAA[0].first],t[AAA[1].first],t[A[2].first]};
      |                                                             ^~~~~
a.cc:35:67: error: could not convert '{t.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)AAA.std::vector<std::pair<long long int, long long int> >::operator[](0).std::pair<long long int, long long int>::first)), t.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)AAA.std::vector<std::pair<long long int, long long int> >::operator[](1).std::pair<long long int, long long int>::first)), <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<long long int>'
   35 |     vector<int> BBB={t[AAA[0].first],t[AAA[1].first],t[A[2].first]};
      |                                                                   ^
      |                                                                   |
      |                                                                   <brace-enclosed initializer list>
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int d;
    cin >> d;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];
for (int i=1; i<=365; i++){
	cout<<i%26+1<<endl;}}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i, 26) cin >> c[i];
      |         ^
a.cc:8:5: error: 'rep' was not declared in this scope
    8 |     rep(i, 26) cin >> c[i];
      |     ^~~