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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int used[26];

class IHC{
public:
	vector<int> solve(int _D, vector<int> _c, vector<vector<int>> _s){
		init(_D,_c,_s);

		geneRes();

		return res;
	}
		
private:
	int D;
	vector<int> c;
	vector<vector<int>> s;
	vector<int> res;

	void geneRes(void){
		memset(used, -1, sizeof(used));
		rep (i, D){
			res[i] = Rand() % 26;
			used[res[i]] = i;
		} // end rep
	}

	void init(int _D, vector<int> _c, vector<vector<int>> _s){
		D = _D;
		c = _c;
		s = _s;
		res.clear(); res.resize(D, -1);
	}
};

int main()
{
	IHC ihc;

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int D; cin >> D;
	vector<int> c(26, 0);
	rep (i, 26){
		cin >> c[i];
	} // end rep
	vector<vector<int>> s(D, vector<int>(26, 0));
	rep (i, D){
		rep (j, 26){
			cin >> s[i][j];
		} // end rep
	} // end rep

	vector<int> ret = ihc.solve(D,c,s);
	rep (i, (int)ret.size()){
		cout << ret[i] << endl;
	} // end rep

	return 0;
}


Compiler output:
a.cc: In member function 'void IHC::geneRes()':
a.cc:31:34: error: 'Rand' was not declared in this scope; did you mean 'rand'?
   31 |                         res[i] = Rand() % 26;
      |                                  ^~~~
      |                                  rand
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <cassert>
#include <chrono>
#include <fstream>
#include <array>
using ll = long long;

//LLONG_MAX
//#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

#ifdef LOCAL
#define ASSERT_DEBUG
#endif
#ifdef ASSERT_DEBUG
#define ASSERT(cond) assert(cond)
#else
#define ASSERT(cond)
#endif

class Point
{
public:
	int x;
	int y;
	Point() { this->x = 0; this->y = 0; }
	Point(int x, int y) { this->x = x; this->y = y; }
};

//time_point<system_clock> _start_time = system_clock::now();
//ll time = duration_cast<milliseconds>(system_clock::now() - _start_time).count();


//const int R = 10000;
//const double START_TEMP = pow(50.0, 2);
//const double END_TEMP = 0;
//double temp = sqrt(START_TEMP + (END_TEMP - START_TEMP) * (ms / (double)1900));
//double probability = MIN(1.0, exp((score - new_score) / temp));
//bool force_next = probability > ((xorshift32() % R) / (double)R);
//if (force_next)

using namespace std;
using namespace chrono;

unsigned int xorshift32()
{
	static int s = 7;
	s ^= (s << 13);
	s ^= (s >> 17);
	s ^= (s << 15);
	return s;
}


const int D = 365;
const int N = 26;
int C[N];
int S[N][D];


int GetScore(int schedule[D])
{
	int score = 0;
	int last[N] = {};
	for (int d = 0; d < D; d++)
	{
		score += S[schedule[d]][d];
		last[schedule[d]] = d;
		for (int n = 0; n < 26; n++)
		{
			score -= C[n] * (d - last[n]);
		}
	}
	return score;
}




void main()
{
	int _;
	cin >> _;
	REP(n, N)
	{
		cin >> C[n];
	}
	REP(d, D)
	{
		REP(n, N)
		{
			cin >> S[n][d];
		}
	}

	int schedule[D] = {};

	int score = GetScore(schedule);

	REP(i, N)
	{
		cout << schedule[i] << endl;
	}
}

Compiler output:
a.cc:104:1: error: '::main' must return 'int'
  104 | void main()
      | ^~~~
Language: C++

#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF (INT_MAX / 2)

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    ll d;
    ll max_v=-INF;
    ll max_i=0;
    cin>>d;
    vector<ll>c(d);
    vector<vector<ll>>s(d,vector<ll>(26));
    vector<ll> ans;
    rep(i,d){
        cin>>c[i];
    }
    rep(i,d){
        max_v=-INF;
        rep(j,26){
            cin>>s[i][j];
            if(max_v<s[i][j]){
                max_v=s[i][j];
                max_i=j+1;
            }
        }
        ans.push_back(max_i);
    }
    for(auto i:ans){
        cout<<*i<<endl;
    }
}
/*

*/


Compiler output:
a.cc: In function 'int main()':
a.cc:49:15: error: invalid type argument of unary '*' (have 'long long int')
   49 |         cout<<*i<<endl;
      |               ^~
Language: C++

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int D;
    cin>>D;
    vector<int> cdeka;
    int papapa[26];
    for(int i=0;i<26;i++){
        cin>>papapa[i];
        if(50<papapa[i])cdeka.push_back(i+1);
    }
    for(int i=0;i<365;i++){
            /*
        int ma=0,manum=0;
        if(i%100=99){
            for(int j=0;j<cdeka.size(),i<365;j++,i++){
                
            }
            continue;
        }
        */
        for(int j=0;j<26;j++){
            int p;
            cin>>p;
            if(ma<p){
                ma=p;
                manum=i+1;
            }
        }
        cout<<manum<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'ma' was not declared in this scope; did you mean 'fma'?
   29 |             if(ma<p){
      |                ^~
      |                fma
a.cc:31:17: error: 'manum' was not declared in this scope
   31 |                 manum=i+1;
      |                 ^~~~~
a.cc:34:15: error: 'manum' was not declared in this scope
   34 |         cout<<manum<<endl;
      |               ^~~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int d = sc.nextInt();  
      	int[] c = new int[26];
      	int[][] s = new int[d][26];
      	for(int i=0;i<26;i++){
          c[i] = sc.nextInt();
        }
      	for(int i=0;i<d;i++){
          for(int j=0;j<26;j++){
            s[i][j] = sc.nextInt();
          }
        }
      	for(int i=0;i<d;i++){
          int n = s[i][0];
          int pos = 0;
          for(int j=1;j<26;j++){
            if( s[i][j] > n ){
              n = s[i][j];
              pos = j;
          }
          System.out.println(pos+1);
        }
    }
}


Compiler output:
Main.java:27: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int d = sc.nextInt();  
      	int[] c = new int[26];
      	int[][] s = new int[d][26];
      	for(int i=0;i<26;i++){
          c[i] = sc.nextInt();
        }
      	for(int i=0;i<d;i++){
          for(int j=0ac;j<26;j++){
            s[i][j] = sc.nextInt();
          }
        }
      	for(int i=0;i<d;i++){
          int n = s[i][0];
          int pos = 0;
          for(int j=1;j<26;j++){
            if( s[i][j] > n ){
              n = s[i][j];
              pos = j;
          }
          System.out.println(pos+1);
        }
    }
}


Compiler output:
Main.java:12: error: ';' expected
          for(int j=0ac;j<26;j++){
                     ^
Main.java:12: error: not a statement
          for(int j=0ac;j<26;j++){
                         ^
Main.java:12: error: ')' expected
          for(int j=0ac;j<26;j++){
                            ^
Main.java:12: error: ';' expected
          for(int j=0ac;j<26;j++){
                                ^
Main.java:27: error: reached end of file while parsing
}
 ^
5 errors
Language: C++

#include <climits>
#include <cstdio>
#include <vector>

const int N = 26, D = 365;

template <typename T> void read(T &x) {
    x = 0;
    char c = getchar();
    T sig = 1;
    for (; !isdigit(c); c = getchar())
        if (c == '-')
            sig = -1;
    for (; isdigit(c); c = getchar())
        x = (x << 3) + (x << 1) + c - '0';
    x *= sig;
}

using namespace std;
typedef long long ll;
vector<int> adj[N];
int main() {
    int d;
    read(d);
    vector<int> c(N);
    vector<vector<int>> s(D, vector<int>(N));
    int sum = 0;
    for (int i = 0; i < N; ++i)
        read(c[i]);
    for (int i = 0; i < d; ++i)
        for (int j = 0; j < N; ++j)
            read(s[i][j]);
    vector<int> ans;
    vector<int> last(N, 0);
    for (int i = 1; i <= d; ++i) {
        int maxt = 0, maxg = INT_MIN;
        for (int j = 0; j < N; ++j) {
            int gain = s[i - 1][j];
            for (int k = 0; k < N; ++k)
                if (k != j)
                    gain -= c[k] * (i - last[k]);
            if (gain > maxg) {
                maxg = gain;
                maxt = j;
            }
        }
        last[maxt] = i;
        ans.emplace_back(maxt + 1);
    }
    for (int i : ans)
        printf("%d\n", i);
}

Compiler output:
a.cc: In function 'void read(T&)':
a.cc:11:13: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   11 |     for (; !isdigit(c); c = getchar())
      |             ^~~~~~~
a.cc:11:13: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:14:12: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   14 |     for (; isdigit(c); c = getchar())
      |            ^~~~~~~
a.cc: In instantiation of 'void read(T&) [with T = int]':
a.cc:24:9:   required from here
   24 |     read(d);
      |     ~~~~^~~
a.cc:11:20: error: 'isdigit' was not declared in this scope
   11 |     for (; !isdigit(c); c = getchar())
      |             ~~~~~~~^~~
a.cc:14:19: error: 'isdigit' was not declared in this scope
   14 |     for (; isdigit(c); c = getchar())
      |            ~~~~~~~^~~
Language: C++

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

int main()
{
  random_device seed_gen;
  mt19937 engine(seed_gen());
  uniform_int_distribution<int> rnd(1, 26);
  
  int D; cin >> D;
  for (int d = 1; d <= D; ++d)
  {
    cout << dist(engine) << '\n';
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'dist' was not declared in this scope
   14 |     cout << dist(engine) << '\n';
      |             ^~~~
Language: C++

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

typedef long long int ll;
typedef pair<ll,ll> P;
//cout<<fixed<<setprecision(15);

//様子見！！！！！


int main(){
    int d;
    ci>>d;
    int mmax=0;int maxi=0;
    for(int i=0;i<26;i++){
        int tmp;
        cin>>tmp;
        if(tmp>mmax){
            mmax=tmp;
            maxi=i;
        }
    }
    for(int i=0;i<365;i++){
        cout<<maxi<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'ci' was not declared in this scope
   13 |     ci>>d;
      |     ^~
Language: C++

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

int main(){
  for(int i=0;i<365;i++){
    cout<<i%26+1<<endl;
  }
  return 0;
}


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

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1


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


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

const u_int32_t TASK_TYPE_SIZE = 26;

class SatisfactionCoefficient {
public:
    SatisfactionCoefficient(u_int32_t D) {
        this->c = vector<u_int32_t>(TASK_TYPE_SIZE + 1);
        for (u_int32_t i = 1; i <= TASK_TYPE_SIZE; i++) {
            cin >> this->c[i];
        }

        this->s = vector<vector<u_int32_t>>(D + 1, vector<u_int32_t>(TASK_TYPE_SIZE + 1));
        for (u_int32_t i = 1; i <= D; i++) {
            for (u_int32_t j = 1; j <= TASK_TYPE_SIZE; j++) {
                cin >> this->s[i][j];
            }
        }
    };

    u_int32_t getC(u_int32_t i) {
        return this->c[i];
    }

    u_int32_t getS(u_int16_t i, u_int32_t j) {
        return this->s[i][j];
    }

private:
    vector<u_int32_t> c;
    vector<vector<u_int32_t>> s;
};

class Schedule {
public:
    Schedule(u_int32_t D) {
        this->schedule = vector<u_int32_t>(D + 1, 0);
    }

    void setTask(u_int32_t day, u_int32_t task) {
        // 1 <= day <= D
        // 1 <= task <= TYPE_SIZE
        this->schedule[day] = task;
    }

    u_int32_t getTask(u_int32_t day) {
        // 1 <= day <= D
        return this->schedule[day];
    }

private: 
    vector<u_int32_t> schedule; // スケジュール
};

vector<int64_t>* calculate_S(SatisfactionCoefficient sts_coefficient, Schedule schedule, u_int32_t D) {
    /*
    D 日までの各日の満足度を返す.
    */
    vector<int64_t> *S = new vector<int64_t>(D + 1);
    (*S)[0] = 0;

    vector<vector<u_int32_t>>  last = vector<vector<u_int32_t>>(D + 1, vector<u_int32_t>(TASK_TYPE_SIZE + 1, 0));
    for (u_int32_t t = 1; t <= TASK_TYPE_SIZE; t++) {
        last[0][t] = 0;
    }

    for (u_int32_t day = 1; day <= D; day++) {
        // last計算
        for (u_int32_t t = 1; t <= TASK_TYPE_SIZE; t++) {
            last[day][t] = last[day - 1][t];
        }
        //  last 上書き
        last[day][schedule.getTask(day)] = day;

        // S 計算
        (*S)[day] = (*S)[day - 1] + sts_coefficient.getS(day, schedule.getTask(day));
        for (u_int32_t t = 1; t <= TASK_TYPE_SIZE; t++) {
            (*S)[day] -= sts_coefficient.getC(t) * (day - last[day][t]);
        }
    }
    
    return S;
}



void Main() {
    // input
    u_int32_t D;
    cin >> D;
    SatisfactionCoefficient sts_coefficient = SatisfactionCoefficient(D);
    Schedule schedule = Schedule(D);

    // translate
    for (u_int32_t day = 1; day <= D; day++) {
        u_int32_t task;
        cin >> task;
        schedule.setTask(day, task);
    }

    // output
    vector<int64_t>* S = calculate_S(sts_coefficient, schedule, D);
    for (u_int32_t day = 1; day <= D(); day++) {
        cout << (*S)[day] << endl;
    }
}

int main()
{
    Main();
    return 0;
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:107:37: error: 'D' cannot be used as a function
  107 |     for (u_int32_t day = 1; day <= D(); day++) {
      |                                    ~^~
Language: C++

use proconio::input;

const C:usize = 26;
fn main() {
    input!{
        d:usize,
        c:[i32;C],
        s:[[i32;C];d],
        t:[usize;d]
    };
    let t:Vec<usize> = t.into_iter().map(|x|x-1).collect();

    let mut last:Vec<i32> = vec![-1;C];
    let mut ans = 0;
    for (day,&ti) in t.iter().enumerate() {
        ans += s[day][ti];
        last[ti] = day as i32;
        for j in 0..26 {
            ans -= (c[j] as i32) * ((day as i32) -last[j]);
        }
        println!("{}",ans);
    }

}



Compiler output:
a.cc:18:18: error: too many decimal points in number
   18 |         for j in 0..26 {
      |                  ^~~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use proconio::input;
      | ^~~
a.cc:3:8: error: found ':' in nested-name-specifier, expected '::'
    3 | const C:usize = 26;
      |        ^
      |        ::
a.cc:3:7: error: 'C' does not name a type
    3 | const C:usize = 26;
      |       ^
a.cc:4:1: error: 'fn' does not name a type
    4 | fn main() {
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int d;
  cin >> d;
  
  vector<int> c(26);
  for(int i=0; i<26; i++){
    cin >> c[i];
  }
  
  vector<vector<int>> s(d, vector<int>26);
  for(int j=0; j<d; j++){
    for(int k=0; k<26; k++){
      cin >> s[j][k];
    }
  }
  
  vector<int> t(d);
  for(int l=0; l<d; l++){
    cin >> t[l];
  }
 
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:39: error: expected primary-expression before numeric constant
   13 |   vector<vector<int>> s(d, vector<int>26);
      |                                       ^~
Language: C++

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

int main(){
  ll d;
  cin >> d;
  vector<ll> c(26);
  for(ll i=0;i<26;i++){
    cin >> c.at(i);
  }
  vector<vector<ll>> s(26,vector<ll>(26));
  for(ll i=0;i<d;i++){
    for(ll j=0;j<26;j++){
      cin >> s.at(i).at(j);
    }
  }
  
  vector<ll> t(d),last(26),past(26);
  for(ll i=0;i<d;i++){
    cin >> t.at(i);
  }
  
  ll ans=0;
  for(ll i=0;i<d;i++){
    ans += s.at(i).at(t.at(i)-1);
    past.at(t.at(i)-1)++;
    last(t.at(i)-1) = 0;
    for(int j=0;j<26;j++){
      if(past.at(j) > 0) last.at(j)++;
      
      ans -= c.at(j)*last.at(j);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: no match for call to '(std::vector<long long int>) (__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   28 |     last(t.at(i)-1) = 0;
      |     ~~~~^~~~~~~~~~~
Language: C++

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

const long long MOD = 1000000007;
const long long MAX = 2000000;

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
int D;
int koushin(int c[26],int last[26],int used,int d,int kasan,int sum){
    int tm=last[used];
    last[used]=d;
    int sum_m=sum;
    for(int i=0;i<26;i++){
        sum_m-=c[i]*(d-last[i]);
    }
    last[used]=tm;
    sum_m+=kasan;
    return sum_m;
}
int keisan(int c[26],int sousa[365],int s[D][26]){
    int sum=0;
    int last[26];
    for(int i=0;i<26;i++){
        last[i]=0;
    }
    for(int i=0;i<365;i++){
        sum=koushin(c,last,sousa[i],i+1,s[i][sousa[i]],sum);
        last[sousa[i]]=i+1;
    }
    return sum;

}

int main()
{[
    
    int c[26];
    int last[26];
    for(int i=0;i<26;i++){
        last[i]=0;
    }
    cin>>D;
    pair<int,int>s[D][26];
    pair<int,int>p[D][26];
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    for(int i=0;i<D;i++){
        for(int j=0;j<26;j++){
            int tmp;
            cin>>tmp;
            s[i][j]=make_pair(tmp,j+1);
            p[i][j]=make_pair(tmp,j+1);
        }
        sort(p[i],p[i]+26);
    }
    int sousa[D];
    for(int i=0;i<D;i++){
        sousa[i]=p[i][25].second;
    }
    int now=keisan(c,sousa,s);
    int sum=0;
    vector<int>anss;
    random_device seed_gen;
    mt19937 engine(seed_gen());
    int tmpp_sum;
    for(int i=0;i<D;i++){
        clock_t start = clock(); 
        clock_t end = clock(); 
        int y=engine()%26;
        if(y==0){
            y=26;
        }
        int mae=last[y];
        int tmp_sum=koushin(c,last,p[i][25].second,i+1,s[D][y].first,sum);
        bool first=true;
        int number=p[i][25].second;
        while(end-start<1000){
        int x= engine()%26;
        if(x==0){
            x=26;
        }
        int l=sousa[x];
        sousa[i]=x;
        if(keisan(c,sousa,s)>now){
            now=keisan(c,sousa,s);
            number=l;
        }else{
            sousa[i]=l;
        }
        end=clock();
        
        }
        sum=tmp_sum;
        anss.push_back(number);


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

    


    
    

}


Compiler output:
a.cc:28:43: error: size of array 's' is not an integral constant-expression
   28 | int keisan(int c[26],int sousa[365],int s[D][26]){
      |                                           ^
a.cc: In function 'int main()':
a.cc:45:5: error: expected identifier before 'int'
   45 |     int c[26];
      |     ^~~
a.cc:45:14: error: expected ']' before ';' token
   45 |     int c[26];
      |              ^
      |              ]
a.cc: In lambda function:
a.cc:45:14: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:54:14: error: 'c' was not declared in this scope
   54 |         cin>>c[i];
      |              ^
a.cc:69:20: error: 'c' was not declared in this scope
   69 |     int now=keisan(c,sousa,s);
      |                    ^
Language: C++

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

int main() {
int d;
cin >> d;
vector<int> c(26);
rep(i,26) cin >> c.at(i);
vector<vector<int>> s(d,vector<int>(26));
rep(i,d)rep(j,26) cin >> s.at(i).at(j);
int ans = 0;
vector<int> b(26);
rep(i,d){
  int x;
  cin >> x;
  b.at(x-1) = i+1;
  ans += a.at(i).at(x-1);
  rep(j,26){
    ans -= i+1-b.at(j);
  }
}
cout << ans << endl;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'a' was not declared in this scope
   20 |   ans += a.at(i).at(x-1);
      |          ^
Language: C++

// う　し　た　ぷ　に　き　あ　く　ん　笑
#include <algorithm>
#include <array>
#include <chrono>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
using namespace std;

class Timer {
   private:
    chrono::system_clock::time_point start;  // 開始時間
    int limit;                               // 設定時間 [ms]

   public:
    // コンストラクタ l: 設定時間 [ms]
    Timer(int l) {
        start = chrono::system_clock::now();
        limit = l;
    }
    // 現在時間と開始時間の差[ms]
    int get() {
        chrono::system_clock::time_point now = chrono::system_clock::now();
        int dur =
            chrono::duration_cast<chrono::milliseconds>(now - start).count();
        return dur;
    }
    // 設定時間を経過したか
    bool isExpired() {
        int dur = get();
        if (limit < 0) return false;
        return dur > limit ? true : false;
    }
};
Timer timer(1990);

// RNG
std::mt19937 rng(std::random_device{}());

// constexpr int D = 365;
int d = 5;
constexpr int N = 26;  // コンテストの種類数

vector<int> c(N + 1);
vector<vector<int>> s(D + 1, vector<int>(N + 1, 0));

int simulate(vector<int> &t) {
    int satisfaction = 0;
    vector<int> last(N + 1, 0);

    for (int d = 1; d <= D; d++) {
        satisfaction += s[d][t[d]];
        last[t[d]] = d;

        for (int i = 1; i <= N; i++) {
            satisfaction -= c[i] * (d - last[i]);
        }

        cout << satisfaction << endl;
    }

    return max(satisfaction + 1000000, 0);
}

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

    cin >> D;
    for (int i = 1; i <= N; i++) cin >> c[i];
    for (int i = 1; i <= D; i++) {
        for (int j = 1; j <= N; j++) {
            cin >> s[i][j];
        }
    }

    vector<int> t(D + 1);
    for (int i = 1; i <= D; i++) cin >> t[i];

    simulate(t);
}


Compiler output:
a.cc:50:23: error: 'D' was not declared in this scope
   50 | vector<vector<int>> s(D + 1, vector<int>(N + 1, 0));
      |                       ^
a.cc: In function 'int simulate(std::vector<int>&)':
a.cc:56:26: error: 'D' was not declared in this scope
   56 |     for (int d = 1; d <= D; d++) {
      |                          ^
a.cc: In function 'int main()':
a.cc:74:12: error: 'D' was not declared in this scope
   74 |     cin >> D;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int>c(26);
  for (int i=0;i<26;i++) {
    cin >> c.at(i); 
  }
  vector<vector<int>>s(n,vector<int>(26));
  for(int i=0;i<n;i++) {
    for (int j=0;j<26;j++) {
      cin >> s[i][j];
    }
  }  
  vector<int>t(n);
  for (int i=0;i<n;i++) {
    cin >> t.at(i); 
  }
  vector<int>(n); 
  int ans=0;
  vector<int>l(26,1);
  for (int i=0;i<n;i++) {
    l[t[i]-1]=0;
    ans+=s[i][t[i]-1];
    for (int j=0;j<26;j++) {
      if(t[i]!=j+1){
        ans-=c[j]*l[j];
          
      }
      l[j]++;
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: conflicting declaration 'std::vector<int> n'
   21 |   vector<int>(n);
      |               ^
a.cc:5:7: note: previous declaration as 'int n'
    5 |   int n;
      |       ^
Language: C

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

int main() {
  int d, type = 26;
  vector<int> c;
  vector<vector<int>> s;
  vector<int> t;
  vector<int> v;
  vector<int> last;

  cin >> d;

  c.push_back(0);
  for (int i = 0; i < type; i++) {
    int tmp;
    cin >> tmp;
    c.push_back(tmp);
  }

  vector<int> vtmp;
  for (int j = 0; j < type; j++) {
    vtmp.push_back(0);
  }
  s.push_back(vtmp);

  for (int i = 0; i < d; i++) {
    vector<int> vtmp;
    vtmp.push_back(0);
    for (int j = 0; j < type; j++) {
      int tmp;
      cin >> tmp;
      vtmp.push_back(tmp);
    }
    s.push_back(vtmp);
  }

  t.push_back(0);
  for (int i = 0; i < type; i++) {
    int tmp;
    cin >> tmp;
    t.push_back(tmp);
  }

  // cout << d << endl;
  // for (int i = 1; i <= type; i++) {
  //   cout << c[i] << " ";
  // }
  // cout << endl;

  // for (int j = 1; j <= d; j++) {
  //   for (int i = 1; i <= type; i++) {
  //     cout << s[j][i] << " ";
  //   }
  //   cout << endl;
  // }

  // for (int i = 1; i <= d; i++) {
  //   cout << t[i] << " ";
  // }
  // cout << endl;

  for (int i = 0; i <= type; i++) {
    last.push_back(0);
  }

  v.push_back(0);
  for (int day = 1; day <= d; day++) {
    last[t[day]] = day;
    int desat = 0;
    for (int j = 1; j <= type; j++) {
      desat += c[j] * (day - last[j]);
    }
    v.push_back(v[day - 1] + s[day][t[day]] - desat);
    cout << v[day] << endl;
  }
  return 0;
}

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;

const long long MOD = 1000000007;
const long long MAX = 2000000;

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
int koushin(int c[26],int last[26],int used,int d,int kasan,int sum){
    last[used]=d;
    int sum_m=sum;
    for(int i=0;i<26;i++){
        sum_m-=c[i]*(d-last[i]);
    }
    sum_m+=kasan;
    return sum_m;
}

int main()
{
    int D;
    int c[26];
    int last[26];
    for(int i=0;i<26;i++){
        last[i]=0;
    }
    cin>>D;
    pair<int,int>s[D][26];
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    for(int i=0;i<D;i++){
        for(int j=0;j<26;j++){
            int tmp;
            cin>>tmp;
            s[i][j]=make_pair(tmp,j+1);
        }
    }
  int t[D];
  for(int i=0;i<D;i++){cin>>t[i];}
  
    int sum=0;
    vector<int>anss;
    random_device seed_gen;
    mt19937 engine(seed_gen());
    for(int i=0;i<D;i++){
        srand(1);
        int x= engine()%26;
      x=t[i]
        anss.push_back(x);
        sum=koushin(c,last,x,i+1,s[D][x].first,sum);

    }
    for(int i=0;i<D;i++){
        //cout<<anss[i]<<endl;
    }
    cout<<sum<<endl;

    


    
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: expected ';' before 'anss'
   56 |       x=t[i]
      |             ^
      |             ;
   57 |         anss.push_back(x);
      |         ~~~~
Language: C

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

int down(const int c[], int d){
    int downscore=0, swap=0;
    for(int i = 0;i<26;i++){
        downscore = c[i]*(d-last(d,i)) + downscore;
    }
    return downscore;
}

int main(void){
    // Your code here!
    int d, c[26];
    scanf("%d", &d);
    for(int i = 0; i<26; i++){
        scanf("%d", &c[i]);
    }
    int s[d][26], t[d], v[d];
    for(int i = 0; i<d; i++){
        for(int j =0; j<26; j++){
            scanf("%d", &s[i][j]);
        }
    }
    for(int i = 0; i<d; i++){
        scanf("%d", &t[i]);
    }
   
   for(int i = 0; i<d; i++){
       v[i] = s[d][t[i]]-down(c,i);
   }
    for(int i =0 ;i<d;i++){
        printf("%d\n",v[i]);
    }
    
    return 0;
}


Compiler output:
main.c: In function 'down':
main.c:7:29: error: implicit declaration of function 'last' [-Wimplicit-function-declaration]
    7 |         downscore = c[i]*(d-last(d,i)) + downscore;
      |                             ^~~~
Language: C++

5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13

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

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

int down(const int c[], int d){
    int downscore=0, swap=0;
    for(int i = 0;i<26;i++){
        downscore = c[i]*(d-last(d,i)) + downscore;
    }
    return downscore;
}

int main(void){
    // Your code here!
    int d, c[26];
    scanf('"%d", &d);
    for(int i = 0; i<26; i++){
        scanf("%d", &c[i]);
    }
    int s[d,26], t[d], v[d];
    for(i = 0; i<d; i++){
        for(int j =0; j<26; j++){
            scanf("%d", &s[i,j]);
        }
    }
    for(i = 0; i<d; i++){
        scanf("%d", &t[i]);
    }
   
   for(i = 0; i<d; i++){
       v[i] = s[d,t[i]]-down(c,i);
   }
    for(i =0 ;i<d;i++){
        printf("%d\n",v[i]);
    }
    
    return 0;
}


Compiler output:
main.c: In function 'down':
main.c:7:29: error: implicit declaration of function 'last' [-Wimplicit-function-declaration]
    7 |         downscore = c[i]*(d-last(d,i)) + downscore;
      |                             ^~~~
main.c: In function 'main':
main.c:15:11: warning: missing terminating ' character
   15 |     scanf('"%d", &d);
      |           ^
main.c:15:11: error: missing terminating ' character
   15 |     scanf('"%d", &d);
      |           ^~~~~~~~~~~
main.c:16:5: error: expected expression before 'for'
   16 |     for(int i = 0; i<26; i++){
      |     ^~~
main.c:36:14: error: expected ';' before '}' token
   36 |     return 0;
      |              ^
      |              ;
   37 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int last(int d,int b,int &t[d]){
  int mday=0;
  for(int k=0;k<d;k++){
    if(t[k]==t[b] && k<=b){
      mday=k;
    }
  }
  return mday;
}

int main(){
  int d;
  cin >> d;
  int c[25]={0};
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  int s[d][25]={0};//d日目のtype25のときの＋満足度
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      cin >> s[i][j];
    }
  }
  int t[d];//d日目までに満足できる最高の日程
  for(int i=0;i<d;i++){
    cin >> t[i];
  }
  
  for(int i=0;i<d;i++){
    int m=t[i];
    cout << s[i][m] << endl;
  }
}

  


Compiler output:
a.cc:3:27: error: expected ',' or '...' before 't'
    3 | int last(int d,int b,int &t[d]){
      |                           ^
a.cc: In function 'int last(int, int, int&)':
a.cc:6:8: error: 't' was not declared in this scope
    6 |     if(t[k]==t[b] && k<=b){
      |        ^
Language: C++

#incluDe <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main(){
    int D;
    cin>>D;
    int c[26];
    for(int i=0;i<26;i++)cin>>c[i];
    int s[D][26];
    for(int i=0;i<D;i++)for(int j=0;j<26;j++){
        cin>>s[i][j];
    }
    int t[D];
    for(int i=0;i<D;i++)cin>>t[i];
    int score=0;
    int last[26]={};
    for(int i=1;i<=D;i++){
        last[t[i-1]-1]=i;
        score+=s[i-1][t[i-1]-1];
        for(int j=0;j<26;j++){
            score-=(i-last[j])*c[j];
        }
        cout<<score<<endl;
    }
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #incluDe; did you mean #include?
    1 | #incluDe <bits/stdc++.h>
      |  ^~~~~~~
      |  include
a.cc:4:11: error: 'pair' does not name a type
    4 | using P = pair<ll, ll>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>D;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #incluDe <bits/stdc++.h>
a.cc:25:9: error: 'cout' was not declared in this scope
   25 |         cout<<score<<endl;
      |         ^~~~
a.cc:25:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:22: error: 'endl' was not declared in this scope
   25 |         cout<<score<<endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #incluDe <bits/stdc++.h>
Language: C++

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

int main(){
    int D; cin >> D;
    vector<int> c(27,0);
    for(int i = 1; i < 27; i++) cin >> c[i];
    vector<vector<int>> s(D+1,vector<int>(27,0));
    for(int d = 1; d < D+1; d++){
        for(int i = 1; i < 27; i++) cin >> s[d][i];
    }
    
    vector<int> t(D+1);AC
    for(int i = 1; i < D+1; i++){
        cin >> t[i];
    }
    
    map<int,int> mp;
    
    int ans  = 0;
    for(int d = 1; d < D+1 ; d++){
        ans += s[d][t[d]];
        //cout << ans << endl;
        mp[t[d]] = d;
        for(int i = 1; i < 27; i++)ans -= c[i]*(d -mp[i]);
        cout << ans << endl;
        
    }
    
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: 'AC' was not declared in this scope
   13 |     vector<int> t(D+1);AC
      |                        ^~
a.cc:14:20: error: 'i' was not declared in this scope
   14 |     for(int i = 1; i < D+1; i++){
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int last(int d,int b,int i){
  int mday=0;
  for(int k=0;k<d;k++){
    if(t[k]==t[b] && k<=b){
      mday=k;
    }
  }
  return mday;
}

int main(){
  int d;
  cin >> d;
  int c[25]={0};
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  int s[d][25]={0};//d日目のtype25のときの＋満足度
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      cin >> s[i][j];
    }
  }
  int t[d];//d日目までに満足できる最高の日程
  for(int i=0;i<d;i++){
    cin >> t[i];
  }
  
  for(int i=0;i<d;i++){
    int m=t[i];
    cout << s[i][m] << endl;
  }
}

  

Compiler output:
a.cc: In function 'int last(int, int, int)':
a.cc:6:8: error: 't' was not declared in this scope
    6 |     if(t[k]==t[b] && k<=b){
      |        ^
Language: C

#include <stdio.h>

int main(){
   int d,c[26],s[365][26],last[26],i,j,t;
   long sum;

   scanf("%d",&d);
   for (i=0;i<26;i++) {
      scanf("%d",&c[i]);
      last[i]=-1;
   }
   for (j=0;j<d;j++)
      for (i=0;i<26;i++) scanf("%d",&s[j][i]);
   sum=0;
   for (i=0;i<d;i++) {
      scanf("%d",&t);
      sum+=s[i][t-1];
      last[t-1]=i;
      for (sc=j=0;j<26;j++)
         sum-=c[j]*(i-last[j]);
      printf("%ld\n",sum);
   }
   return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:12: error: 'sc' undeclared (first use in this function); did you mean 's'?
   19 |       for (sc=j=0;j<26;j++)
      |            ^~
      |            s
main.c:19:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        cin >> t[i];
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
        cout << ans, << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:22: error: expected primary-expression before '<<' token
   33 |         cout << ans, << endl;
      |                      ^~
Language: C++

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

long d;
long c[26];
long s[365][26];
long t[365];
long last[27];


int main(){
    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];
        }
    }
    long t[d];
    for(int i=0;i<d;i++)cin >> t[i];
    
    for(int i=1;i<=26;i++)last[i] = 0;

    long ans = 0;

    for(int i=1;i<=d;i++){
        last[t[i-1]] = i;
        ans += s[i-1][t[i-1]];
        ans += calcAns(i);

    }
    cout << ans << endl;
}


long calcAns(int day){

    long ans = 0;
    for(int i=1;i<=26;i++){
        ans -= c[i-1] * (day - last[i]);
    }

    return ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'calcAns' was not declared in this scope
   29 |         ans += calcAns(i);
      |                ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
using ll = long long;

int main(){
    int d;
    cin>>d;
    vector<ll> c(26),t(d);
    vector<vector<int>> s(d,vector<int>(26));
    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];
        }
    }
    for(int i=0;i<d;i++){
        int a;
        cin>>a;
        a--;
        t[i]=a;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
        int a,b,ans=0;
        vector<int> last(26,-1);
        cin>>a>>b;
        a--;
        b--;
        t[a]=b;
        for(int j=0;j<d;j++){
            last[t[j]]=j;
            ans+=s[j][t[j]];
            for(int k=0;k<26;k++) ans-=c[k]*(j-last[k]);
        }
        cout<<ans<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<ll> c(26),t(d);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:14: error: expected primary-expression before '>' token
    8 |     vector<ll> c(26),t(d);
      |              ^
a.cc:8:16: error: 'c' was not declared in this scope
    8 |     vector<ll> c(26),t(d);
      |                ^
a.cc:8:22: error: 't' was not declared in this scope
    8 |     vector<ll> c(26),t(d);
      |                      ^
a.cc:9:19: error: expected primary-expression before 'int'
    9 |     vector<vector<int>> s(d,vector<int>(26));
      |                   ^~~
a.cc:15:18: error: 's' was not declared in this scope
   15 |             cin>>s[i][j];
      |                  ^
a.cc:28:16: error: expected primary-expression before 'int'
   28 |         vector<int> last(26,-1);
      |                ^~~
a.cc:34:13: error: 'last' was not declared in this scope
   34 |             last[t[j]]=j;
      |             ^~~~
a.cc:35:18: error: 's' was not declared in this scope
   35 |             ans+=s[j][t[j]];
      |                  ^
Language: C

#include <iostream>
#include <list>

#define llong long long
#define rep(i,l,n) for(int (i)=(l);(i)<(n);(i++))

using namespace std;

int main(){
	int D; cin >> D;
	int c[26],s[D][26],t[D];
	rep(i,0,26) cin >> c[i];
	rep(i,0,D) rep(j,0,26) cin >> s[i][j];
	rep(i,0,D){ cin >> t[i]; t[i]--; }
	
	int score = 0;
	
	list<int> day[26]; // �R���e�X�g���J�Â��ꂽ���t
	rep(i,0,26) day[i].push_back(0);
	rep(i,0,D){
		int num = t[i]; // �R���e�X�g�^�C�v
		score += s[i][num];
		score -= c[num]*(i-day[num].back())*(i+1-day[num].back())/2;
		day[num].push_back(i+1);
	}
	rep(i,0,26){
		score -= c[i]*(D-day[i].back())*(D+1-day[i].back())/2;
		day[i].push_back(D+1);
	}

	int M; cin >> M;
	rep(i,0,M){
		int d,q; cin >> d >> q; q--;
		int p = t[d-1]; // �ύX�����O�̃R���e�X�g�ԍ�
		// �R���e�X�g p ���J�Â���Ȃ����Ƃɂ��e��
		for(list<int>::iterator itr=day[p].begin();itr!=day[p].end();itr++){
			if( *itr == d ){	// �K���ǂ����Ɋ܂܂��
				list<int>::iterator back=itr,next=itr; back--; next++;
				// �K��0���擪�Ɋ܂܂�Ă���̂�itr!=begin
				// �K��D+1���I�[�Ɋ܂܂�Ă���̂�next!=end
				score -= c[p]*(d-*back)*(*next-d)+s[d-1][p];
				day[p].erase(itr);
				break;
			}
		}
		// �R���e�X�g q ���J�Â���邱�Ƃɂ��e��
		for(list<int>::iterator itr=day[q].begin();;itr++){
			if( *itr > d ){
				// �I�[��D+1�ŕK�������|���邱�Ƃ��ۏ؂����
				list<int>::iterator back=itr; back--;
				day[q].insert(itr,d);
				score += c[q]*(d-*back)*(*itr-d)+s[d-1][q];
				break;
			}
		}
		t[d-1] = q;
		cout << score << endl;
	}
	
	return 0;
}


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

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

ll c[30];
ll t[30];
ll s[400][30];
ll last[400][30];

int main(void){
	int D;
	cin>>D;
	for(int i=1;i<=26;i++){
        cin>>c[i];
        last[0][i]=0;
    }
	for(int i=1;i<=D;i++){
		for(int j=1;j<=26;j++){
			cin>>s[i][j];
		}
	}
    ll ans=0;
	for(ll d=1;d<=D;d++){
		cin>>t[d];
		for(int i=1;i<=26;i++){
            last[d][i]=last[d-1][i];
            if(i==t[d])last[d][t[d]]=d;
        }
		ans+=s[d][t[d]];
		for(ll j=1;j<=26;j++){
            ans-=c[j]*(d-last[d][j]);
		}
	}
    ll m;
    cin>>m;
    /*for(int i=1;i<=26;i++){
        for(int j=1;j<=D;j++){
            cout<<last[j][i]<<" ";
        }
        cout<<endl;
    }*/
    for(int query=0;query<m;query++){
        ll d,q;
        cin>>d>>q;
        ans+=s[d][q]-s[d][t[d]];
        ll old1 = last[d][t[d]];
        ll new1 = last[d-1][t[d]];
        ll old2 = last[d][q];
        ll new2 = d;
        for(ll i=1;i<=D;i++){
            ans+=c[t[d]]*(i-last[i][t[d]]);
            if(last[i][t[d]]==old1)last[i][t[d]]=new1;
            ans-=c[t[d]]*(i-last[i][t[d]]);
        }
        for(ll i=1;i<=D;i++){
            ans+=c[q]*(i-last[i][q]);
            if(last[i][q]==old2)last[i][q]=new2;
            ans-=c[q]*(i-last[i][q]);
        }
        cout<<query+1<<endl;
        /*for(int i=1;i<=26;i++){
        for(int j=1;j<=D;j++){
            cout<<last[j][i]<<" ";
        }
        cout<<endl;*/
    }
        t[d]=q;
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:96:11: error: 'd' was not declared in this scope
   96 |         t[d]=q;
      |           ^
a.cc:96:14: error: 'q' was not declared in this scope
   96 |         t[d]=q;
      |              ^
a.cc: At global scope:
a.cc:99:5: error: expected unqualified-id before 'return'
   99 |     return 0;
      |     ^~~~~~
a.cc:100:1: error: expected declaration before '}' token
  100 | }
      | ^
Language: C++

5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
3 4
5 24
4 19

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 5
      | ^
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Test {
	static int n = 26, d;
	static int[] c, last;
	static int[][] s;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		d = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = Integer.parseInt(sa[i]);
		}
		s = new int[d][n];
		for (int i = 0; i < d; i++) {
			sa = br.readLine().split(" ");
			for (int j = 0; j < n; j++) {
				s[i][j] = Integer.parseInt(sa[j]);
			}
		}
		int[] t = inputB(br);

		int m = Integer.parseInt(br.readLine());
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			int k = Integer.parseInt(sa[0]) - 1;
			int q = Integer.parseInt(sa[1]) - 1;
			t[k] = q;
			System.out.println(calc(t, d - 1));
		}
		br.close();
	}

	static int[] inputB(BufferedReader br) throws Exception {
		int[] t = new int[d];
		for (int i = 0; i < d; i++) {
			t[i] = Integer.parseInt(br.readLine()) - 1;
		}
		return t;
	}

	static int calc(int[] t, int end) {
		int[] last = new int[n];
		int ret = 0;
		for (int i = 0; i <= end; i++) {
			ret += s[i][t[i]];
			last[t[i]] = i + 1;
			for (int j = 0; j < n; j++) {
				ret -= c[j] * (i + 1 - last[j]);
			}
		}
		return ret;
	}
}


Compiler output:
Main.java:4: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error