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

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

using namespace std;

int N,M,X;
vector<vector<int>> graph(N, vector<int> (M));
vector<int> sum_text(M, 0);
int sum_price = 0;
int ans = 0;
 

void f(int n, bool x){
  //Cnを使うとき
  if(x){
    sum_price += graph[n][0]//値段をたす
    for(int i = 1; i <= M; i++){
      sum_text[i] += graph[n][i]//理解度をたす
    }
  }
  
  if(n = N){
    bool judge = true;
    for(int i = 0; i < M; i++){
     if(sum_text[i]<X){
       judge = false;
     }
    }
    
    if(judge){
      if(ans > sum_price){
        ans = sum_price;
      }
    }
    return;
  }
    
  f(n+1,true);
  f(n+1, false);
}
      
    
int main(){  
  cin >>N >>M>>X;
   
  for(int i = 0, i < N; i++){
    for(int j = 0, j <= M){
      cin >> graph[N][M];
    }
  }
  
  for(int i = 0; i < N; i++){
    ans += graph[i][0];
  }
  
  f(0, true);
  f(0, false);
  
  cout << ans << endl;
  

}






Compiler output:
a.cc: In function 'void f(int, bool)':
a.cc:16:29: error: expected ';' before 'for'
   16 |     sum_price += graph[n][0]//値段をたす
      |                             ^
      |                             ;
   17 |     for(int i = 1; i <= M; i++){
      |     ~~~                      
a.cc:17:20: error: 'i' was not declared in this scope
   17 |     for(int i = 1; i <= M; i++){
      |                    ^
a.cc: In function 'int main()':
a.cc:46:19: error: expected ';' before '<' token
   46 |   for(int i = 0, i < N; i++){
      |                   ^~
      |                   ;
a.cc:46:20: error: expected primary-expression before '<' token
   46 |   for(int i = 0, i < N; i++){
      |                    ^
a.cc:47:21: error: expected ';' before '<=' token
   47 |     for(int j = 0, j <= M){
      |                     ^~~
      |                     ;
a.cc:47:22: error: expected primary-expression before '<=' token
   47 |     for(int j = 0, j <= M){
      |                      ^~
a.cc:47:26: error: expected ';' before ')' token
   47 |     for(int j = 0, j <= M){
      |                          ^
      |                          ;
Language: C++

#include <iostream>
#include<string>
#include<map>
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<unordered_map>
using namespace std;
int n,m,x;
const int N = 20;
int a[N][N];
int c[N];

long long res = LLONG_MAX;

void solve(string s) {
//    cout << s << endl;
    vector<int> t(m + 1, 0);
    long long temp = 0;
    for (int i = 0; i < s.size(); i ++) {
        // check if possible to achieve using this books
        // if yes write to res;
        int x = s[i] - '0';
        x--;
        for (int j = 0; j < m; j ++) {
            t[j] += a[x][j];
        }
        temp += c[x];
    }
    bool f = true;
    for (int i = 0; i < m; i ++) {
        if (t[i] < x) {
            f = false;
            break;
        }
    }
    if (f) res = min(res, temp);
    for (int i = 1; i <= n; i ++){
        if (s.find(to_string(i)) == std::string::npos) {
            solve(s + to_string(i));
        }
    }
}
int main() {
     cin >> n >> m >> x;
    for (int i = 0; i < n; i ++) {
        cin >> c[i];
        for (int j = 0 ; j < m; j ++) {
            cin >> a[i][j];
        }
    }
    solve("");
    if (res == LLONG_MAX) {
        cout << "-1";
    }
    else
    cout << res << endl;


}



Compiler output:
a.cc:15:17: error: 'LLONG_MAX' was not declared in this scope
   15 | long long res = LLONG_MAX;
      |                 ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include<unordered_map>
  +++ |+#include <climits>
    9 | using namespace std;
a.cc: In function 'int main()':
a.cc:54:16: error: 'LLONG_MAX' was not declared in this scope
   54 |     if (res == LLONG_MAX) {
      |                ^~~~~~~~~
a.cc:54:16: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>

using namespace std;
#define INF 1000000000

int main(){
  int N,M,X;
  cin >> N>> M>>X;
  
  int C[13] = {0};
  int A[13][13] = {0};
  for(int i=1; i<=N;i++){
    cin >> C[i];
    for(int j=1; j<=M; j++){
     cin >> A[i][j] ;
    }
  }
  int min = INF;
  for(unsigned p=0; p<(1<<N); p++){
     int sum = 0;
     int score[13] = 0;
     for(int i=1; i<=N; i++){
       if((p<<1)&(1<<i)){
         sum += C[i];
         for(int j=1; j<=M; j++){
           score[j] += A[i][j]; 
         }
       }
     }
    
     int count = 0;
     for(int j=1; j<=M; j++){
       if(score[j]>=X)
         count++;
     }
     if(count == M){
      min = min(sum,min); 
     }
  }
  
  if(min == INF){
   cout << -1 << endl; 
  }else{
   cout << min << endl; 
  }
  
  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: array must be initialized with a brace-enclosed initializer
   21 |      int score[13] = 0;
      |                      ^
a.cc:37:16: error: 'min' cannot be used as a function
   37 |       min = min(sum,min);
      |             ~~~^~~~~~~~~
Language: C++

#include <iostream>

using namespace std;
#define INF 1000000000

int main(){
  int N,M,X;
  cin >> N>> M>>X;
  
  int C[13] = {0};
  int A[13][13] = {0};
  for(int i=1; i<=N;i++){
    cin >> C[i];
    for(int j=1; j<=M; j++){
     cin >> A[i][j] 
    }
  }
  int min = INF;
  for(unsigned p=0; p<(1<<N); i++){
     int sum = 0;
     int score[13] = 0;
     for(int i=1; i<=N; i++){
       if((p<<1)&(1<<i)){
         sum += C[i];
         for(int j=1; j<=M; j++){
           score[j] += A[i][j]; 
         }
       }
     }
    
     int count = 0;
     for(int j=1; j<=M; j++){
       if(score[j]>=X)
         count++;
     }
     if(count == M){
      min = min(sum,min); 
     }
  }
  
  if(min == INF){
   cout << -1 << endl; 
  }else{
   cout << min << endl; 
  }
  
  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected ';' before '}' token
   15 |      cin >> A[i][j]
      |                    ^
      |                    ;
   16 |     }
      |     ~               
a.cc:19:31: error: 'i' was not declared in this scope
   19 |   for(unsigned p=0; p<(1<<N); i++){
      |                               ^
a.cc:21:22: error: array must be initialized with a brace-enclosed initializer
   21 |      int score[13] = 0;
      |                      ^
a.cc:37:16: error: 'min' cannot be used as a function
   37 |       min = min(sum,min);
      |             ~~~^~~~~~~~~
Language: C++

#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
int n,m,x;
int c,a[100];
int pos;
ll ans;
bool cmp(int a,int b){
	return a>b;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		cin>>c;
		for(int j=0;j<m;j++)cin>>a[j];
		sort(a,a+m,cmp);
		pos=0;
		while(k>0){
			k-=a[pos];
			pos++;
		}
		ans+=pos*c;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:23: error: 'k' was not declared in this scope
   42 |                 while(k>0){
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int N,M,X;
  cin>>N>>M>>X;
 int data[N][M+1];
  for(int i=0;i<N;i++){
  	for(int j=0;j<M;j++){
    	 cin>>data[i][j];
    }
  }
  int count;
  bool nazo=true;
  for(int i=1;i<M;i++){
  	for(int j=0;j<N;j++){
    count+=data[j][i];
        
    }
    	if(X<=count){
        nazo=true;
        }
      	else{
        cout<<"-1";
         nazo=false;
          break;
        }	
   }
  int cost;
 if(nazo) {
 	for(int i=0;i<N;i++){
    	cost=cosst+data[i][0];
    }
   for(int i=0;i<N;i++){
   cost-data[i][0]=
   }
 }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:14: error: 'cosst' was not declared in this scope; did you mean 'cost'?
   31 |         cost=cosst+data[i][0];
      |              ^~~~~
      |              cost
a.cc:35:4: error: expected primary-expression before '}' token
   35 |    }
      |    ^
Language: C++

#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<algorithm>
#include <vector>
using namespace std;
int main(){
    long long ans=(1<<30);
   int N,M,X;cin>>N>>M>>X;
   vector<vector<int> > V(N,vector<int>(M+1));
   for (int i = 0; i < N; i++) {
    for (int j = 0; j < M+1; j++) {
      cin >> V.at(i).at(j);
    }
  }
  　for (int bit=0;bit<(1<<N);bit++){
      int f=0;
      long long now=0;
      vector<int>d(M);
      for(int i=0;i<N;i++){

          if(bit& (1<<i)){
              now+=V[i][0];
              for(int j=1;j<M+1;j++){
                  d[j-1]+=V[i][j];
              }
          }
      }
      for(int i=0;i<M;i++ ){
          //cout<<d[i]<<" ";
          if(d[i]<X)f=1;
      }
      //cout<<" "<<endl;
      if (f==0)ans=min(now,ans);
      //cout<<"ans:"<<ans<<endl;
  }
  if(ans==(1<<30))ans=-1;
  cout<<ans<<endl;
 
}


Compiler output:
a.cc:18:3: error: extended character 　 is not valid in an identifier
   18 |   　for (int bit=0;bit<(1<<N);bit++){
      |   ^
a.cc: In function 'int main()':
a.cc:18:10: error: expected primary-expression before 'int'
   18 |   　for (int bit=0;bit<(1<<N);bit++){
      |          ^~~
a.cc:18:20: error: 'bit' was not declared in this scope
   18 |   　for (int bit=0;bit<(1<<N);bit++){
      |                    ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, m, x;
  vector<vector<int>> data(n, vector<int>(m));
 
  // 入力 (2重ループを用いる)
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> data.at(i).at(j);
    }
  }
 
  for(int )
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: expected unqualified-id before ')' token
   15 |   for(int )
      |           ^
a.cc:15:10: error: expected ';' before ')' token
   15 |   for(int )
      |          ^~
      |          ;
a.cc:15:11: error: expected primary-expression before ')' token
   15 |   for(int )
      |           ^
a.cc:15:10: error: expected ';' before ')' token
   15 |   for(int )
      |          ^~
      |          ;
a.cc:17:1: error: expected primary-expression before '}' token
   17 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int n, m, x;
  cin >> n >> m >> x;
  long long int ans = 1e9+7;
  long long int ca[n][m+1];
  for(int i=0; i<n; i++){
    for(int j=0; j<m+1; j++){
      cin >> ca[i][j];
    }
  }
  int step = 1;
  step <<= n;
  for(int i=1; i<step; i++){
    int tmp[m+1] = {};
    int g = 0;
    bool ok = true;
    while(g<n){
      if(i & (1<<g)){
        for(int j=0; j<m; j++){
          tmp[j] += ca[g][j];
        }
      }
      g++;
    }
    for(int j=1; j<m; j++){
      if(tmp[j] >= x) continue;
      ok = false;
    }
    if(ok) ans = min(ans, tmp[0]);
  }
  if(ans == 1e9+7) ans = -1;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: no matching function for call to 'min(long long int&, int&)'
   32 |     if(ok) ans = min(ans, tmp[0]);
      |                  ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:32:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   32 |     if(ok) ans = min(ans, tmp[0]);
      |                  ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:32:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |     if(ok) ans = min(ans, tmp[0]);
      |                  ~~~^~~~~~~~~~~~~
Language: C++

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

using namespace std;

int N,M,X;
vector<vector<int>> graph(N, vector<int> (M));
vector<int> sum_text(M, 0);
int sum_price = 0

int f(int n, int m, bool x){
  //Cnを使うとき
  if(x){
    sum_price += graph[n][0]//値段をたす
    rep(i, M){
      sum_text[i] += graph[n][i]//理解度をたす
    }
  }
  
  if(n = N){
    bool judge = true;
    rep(i, M){
     if(sum_text[i]<X){
       judge = false;
     }
    }
    
      
    
    
    


int main(){
  
  cin >>n >>m>>X;
  
  
  rep(i, N){
    rep(j, M){
      cin >> graph[N][M];
    }
  }

}




Compiler output:
a.cc:11:1: error: expected ',' or ';' before 'int'
   11 | int f(int n, int m, bool x){
      | ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

struct ReferenceBook {
	int price;
	vector<ll> understandings;

	bool isUnderstandOK(ll understand) {
		for (auto itr = understandings.begin(); itr != understandings.end(); ++itr) {
			if (*itr < understand)	return false;
		}

		return true;
	}
	void Print() {
		cout << price << endl;
	}
};

ll ansPrice = LLONG_MAX;

void func(ll index, const vector<ReferenceBook>& referenceBooks, ReferenceBook& ans, ll understand) {

	if (ans.isUnderstandOK(understand)) {
		//ans.Print();
		if (ansPrice > ans.price) {
			ansPrice = ans.price;
		}
		return;
	}
	if (index >= referenceBooks.size())	return;

	func(index + 1, referenceBooks, ans, understand);

	auto tmpAns = ans;
	tmpAns.price += referenceBooks[index].price;
	for (int i = 0; i < referenceBooks[index].understandings.size(); ++i) {
		tmpAns.understandings[i] += referenceBooks[index].understandings[i];
	}
	func(index + 1, referenceBooks, tmpAns, understand);

}

int main(void) {


	ll n, m, x;
	cin >> n >> m >> x;

	vector<ReferenceBook> referenceBooks;
	for (int i = 0; i < n; ++i) {
		ReferenceBook rb;

		cin >> rb.price;

		for (int j = 0; j < m; ++j) {
			ll a;
			cin >> a;
			rb.understandings.push_back(a);
		}
		referenceBooks.push_back(rb);
	}

	ReferenceBook ans;
	ans.price = 0;
	ans.understandings.resize(m);

	func(0, referenceBooks, ans, x);

	if (ansPrice == LLONG_MAX) {
		ansPrice = -1;
	}
	auto output = ansPrice;
	cout << output;

	return 0;
}


Compiler output:
a.cc:75:15: error: 'LLONG_MAX' was not declared in this scope
   75 | ll ansPrice = LLONG_MAX;
      |               ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 | using namespace std;
a.cc: In function 'int main()':
a.cc:125:25: error: 'LLONG_MAX' was not declared in this scope
  125 |         if (ansPrice == LLONG_MAX) {
      |                         ^~~~~~~~~
a.cc:125:25: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long cr[50],p,n,m,a[50],c[50][50],ans,k,F;
go(int cur,int r,long long x){
	
	for(k=1;k<=m;k++){
		cr[k]+=r*c[cur][r]; 
	}
	
	int f=0;
	for(k=1;k<=m;k++){
		if(cr[k]<p) f=1;
	}
	//cout<<cur<<" "<<r<<" "<<x<<endl;
	if(f==0) ans=min(ans,x+a[cur]*r),F=1;
	if(cur!=n){
		go(cur+1,0,x+a[cur]*r);
		go(cur+1,1,x+a[cur]*r);
	}
	for(k=1;k<=m;k++){
		cr[k]-=r*c[cur][r]; 
	}
}
int main(){
	cin>>n>>m>>p;
	for(k=1;k<=n;k++)
	{
		cin>>a[k];
		for(int i=1;i<=m;i++){
			cin>>c[k][i];
		}
	}
	ans=1e10;
	go(1,0,0);
	go(1,1,0);
	
	if(F==0) cout<<-1;
	else cout<<ans;
}

Compiler output:
a.cc:4:1: error: ISO C++ forbids declaration of 'go' with no type [-fpermissive]
    4 | go(int cur,int r,long long x){
      | ^~
a.cc: In function 'int go(int, int, long long int)':
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> p(n);
    vector<vector<int>> A(n,vector<int> (m));
    
    for(int i = 0; i < n; i++) {
        cin >> p.at(i);
        for(int j = 0; j < m; j++) {
            cin >> A.at(i).at(j);
        }
    }
    int minp = 10000000;
    
    for(int tmp = 0; tmp < (1 << 12); tmp++) {
        int price = 0;
        vector<int> r(m);
        bitset<12> s(tmp);
        for(int i = 0; i < n; i++) {
            if(s.test(i)) {
                price += p.at(i);
                for(int j = 0; j < m; j++) {
                    r.at(i) += A.at(i).at(j);
                }
            }
        }
        bool b = true;
        for(int i = 0; i < m; i++) {
            if(r.at(i) < X) b = false;
        }
        if(b && price < minp) {
            minp = price;
        }
    }

    if(minp == 10000000) {
        cout << -1;
    }
    else cout << minp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'X' was not declared in this scope
   31 |             if(r.at(i) < X) b = false;
      |                          ^
Language: C

#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int n,m,x;
struct b {
  int c;
  int a[20];
};
vector<struct b> bs;

int check(int mask) {
  vector<int> v(n);
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      for(int j = 0; j < m; ++j) {
        v[j] += bs[i].a[j];
      }
    }
  }
  int ok = 1;
  for(int i = 0; i < m; ++i) {
    if( v[i] >= x) continue;
    else {
      ok = 0;
      break;
    }
  }
  return ok;
}

int cost(int mask) {
  int ret = 0;
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      ret += bs[i].c;
    }
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> x;
  bs.resize(n);
  REP(i,n) {
    int c;
    cin >> c;
    bs[i].c = c;
    REP(j,m) {
      int a2;
      cin >> a2;
      bs[i].a[j] = a2;
    }
  }
 // REP(i,n) {
 //   cout << bs[i].c << endl;
 //   REP(j,m) {
 //      cout << bs[i].a[j] << " " << endl;
 //   }
 //   cout << endl;
 // }
  int ret = 1e9;
  for(int mask = 0 ; mask < (1 << n) ; ++mask) {
    if( check(mask) ) {
      ret = min(ret,cost(mask));
    } 
  
  }
  if( ret != 1e9 ) {
    cout << ret << endl;
  }else {
    cout << -1 << 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;

int N, M, X;
vector<int> C, E;
vector<vector<int>> A;

int main()
{
  cin >> N >> M >> X;
  C.resize(N);
  E.resize(M, 0);
  A.resize(N, vector<int>(M));
  for (int i = 0; i < N; i++)
  {
    for (int j = -1; j < M; j++)
    {
      int n;
      cin >> n;
      if (j == -1)
      {
        C.at(i) = n;
      }
      else
      {
        A.at(i).at(j) = n;
      }
    }
  }
  int min_cost = 10000000, tmp;
  for (int bit = 0; bit < (1 << N); bit++)
  {
    for (int j = 0; j < M; j++)
    {
      E.at(j) = 0;
    }
    tmp = 0;
    for (int i = 0; i < N; i++)
    {
      if (bit & (1 << i))
      {
        tmp += C.at(i);
        for (int j = 0; j < M; j++)
        {
          E.at(j) += A.at(i).at(j);
        }
      }
    }
    bool flag = true;
    for (int j = 0; j < M; j++)
    {
      if (E.at(j) < X)
      {
        flag = false;
        break;
      }
    }
    if (flag)
    {
      min_cost = min(min_cost, tmp);
    }
  }
  if (min_cost == 10000000)
  {
    min_cost = -1;
  }
  cout << min_cost << endl;
}

2020年5月10日(日) 21:06 平野瑠登 <hiuni_mono100@me.com>:
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    bool res = true;
    if(t.size() == s.size() + 1){
        for( int i = 0;i<s.size();i++){
            if(s.at(i) != t.at(i)) res = false;
        }
    } else {
        res = false;
    }
    if(res){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Compiler output:
a.cc:70:48: error: stray '@' in program
   70 | 2020年5月10日(日) 21:06 平野瑠登 <hiuni_mono100@me.com>:
      |                                                ^
a.cc:70:1: error: expected unqualified-id before numeric constant
   70 | 2020年5月10日(日) 21:06 平野瑠登 <hiuni_mono100@me.com>:
      | ^~~~~~~~~~~~~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main(){
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> vc(N, 0);
    vector<vector<int>> va(N, vector<int>(M, 0));
    for (int i = 0; i < N; i++)
    {
        cin >> vc[i];
        for (int j = 0; j < M; j++)
        {
            cin >> va[i][j];
        }
    }

    int count = 0;
    int ans = 1e9;
    int maximum = (1 << N);
    while (count != maximum)
    {
        int sum_cost = 0;
        int tmp_count = count;
        vector<int> vu(M, 0);
        for (int i = 0; i < N; i++)
        {
            if ((tmp_count >> i) & 1)
            {
                sum_cost += vc[i];
                for (int j = 0; j < M; j++)
                {
                    vu[j] += va[i][j];
                }
            }
        }
        if (*min_element(vu.begin(), vu.end()) >= X)
        {
            ans = min(ans, sum_cost);
        }
        count++;
    }

    if (ans == 1e9)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: 'min_element' was not declared in this scope
   40 |         if (*min_element(vu.begin(), vu.end()) >= X)
      |              ^~~~~~~~~~~
Language: C++

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

typedef long long LL;
typedef unsigned long long ULL;

const int PI = 3.141592653589793;
const int inf = 1000111222;
const int mod = 1000000007;
const int N = 200007;

void solve() {
        int n, m, x;
        cin >> n >> m >> x;
        int cost[n + 7], A[n + 7][m + 7];
        for (int i = 0; i < n; i++) {
                cin >> cost[i];
                for (int j = 0; j < m; j++)
                        cin >> A[i][j];
        }
        int spend = inf;
        memset(ans, 0, sizeof ans);
        for (int mask = 0; mask < (1 << n); mask++) {
                int curr_spend = 0;
                int curr_ans[m + 7];
                memset(curr_ans, 0, sizeof curr_ans);
                for (int i = 0; i < 24; i++) {
                        if ((1 << i) & mask) {
                                curr_spend += cost[i];
                                for (int j = 0; j < m; j++) {
                                        curr_ans[j] += A[i][j];
                                }
                                int flag = 0;
                                for (int j = 0; j < m; j++) {
                                        if (curr_ans[j] < x)
                                                ++flag;
                                }
                                if (!flag) {
                                        spend = min(spend, curr_spend);
                                }
                        }
                }
        }
        if (spend == inf) cout << "-1\n";
        else cout << spend << endl;
}

int main(){

        ios_base::sync_with_stdio(0);
        cin.tie(0); cout.tie(0);

        solve();
        return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:22:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         memset(ans, 0, sizeof ans);
      |                ^~~
      |                abs
Language: C++

#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef long double LD;
//#define int ll
#define double LD
#define pb push_back
#define mp make_pair
#define REP(i,n) for (int i = 0; i < n; i++)
#define loop(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define mem(a, b) memset(a, b, sizeof a)
#define append push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define print(x) cout << (x) << endl
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const double PI=acos(-1);
const int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;

mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers.
 
void solve();
 
signed main(){
	FAST_IO;
	PRECISION(10);
 
	int t = 1;
	//cin>> t;
	FOR(testcase,1,t+1){
		// printf("Case #%lld: ",testcase); 
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}   
 
void solve(){
	int n, m, x;
	cin>> n >> m >> x;
	vector<int> cost(n);
	int grid[n][m];

	for(int i = 0; i < n; i++){
		cin>> cost[i];
		for(int j = 0; j < m; j++)
			cin>> grid[i][j];
	}
	int mn = INT_MAX;
	for(int i = 0; i < (1<<n); i++){
		vector<int> course(m, 0);
		int tmp = 0;
		for(int j = 0; j < n; j++){
			if((i&(1<<j))){
				//cerr<< j <<' ';
				tmp += cost[j];
				for(int hehe = 0; hehe < m; hehe++)
					course[hehe] += grid[j][hehe];
			}
		}
		// cerr<< endl;
		bool flag = 1;
		for(int j = 0; j < m; j++)
			flag = (flag and (course[j] >= x));
		// cerr<< tmp << ' ' << flag << endl;
		if(flag)
			mn = min(mn, tmp);
	}
	if(mn == INT_MAX)
		print(-1);
	else
		print(mn);
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:94:18: error: 'INT_MAX' was not declared in this scope
   94 |         int mn = INT_MAX;
      |                  ^~~~~~~
a.cc:34:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   33 | #include <utility>
  +++ |+#include <climits>
   34 | #include <vector>
Language: C++

using namespace std;
int minn=0;
int n,m,x,c[15],a[15][15],u[15]={0};
bool flag=false;
bool check()
{
	for (int i=1;i<=m;i++)
		if(u[i]<x) return false;
	return true;
}
void search(int k,int sum)
{
	if(k==n+1)
	{
		if(check())
		{
			flag=true;
			if(sum<minn) minn=sum;
		}
		return;
	}
	for (int j=1;j<=m;j++)
		u[j]+=a[k][j];
	search(k+1,sum+c[k]);
	for (int j=1;j<=m;j++)
		u[j]-=a[k][j];
	search(k+1,sum);
}
int main()
{
	cin>>n>>m>>x;
	for (int i=1;i<=n;i++)
	{
		cin>>c[i];
		minn+=c[i];
		for (int j=1;j<=m;j++)
			cin>>a[i][j];
	}
	search(1,0);
	if (flag) cout<<minn; else cout<<-1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'cin' was not declared in this scope
   31 |         cin>>n>>m>>x;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:40:19: error: 'cout' was not declared in this scope
   40 |         if (flag) cout<<minn; else cout<<-1;
      |                   ^~~~
a.cc:40:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:36: error: 'cout' was not declared in this scope
   40 |         if (flag) cout<<minn; else cout<<-1;
      |                                    ^~~~
a.cc:40:36: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;




int main(){
    
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j,m){
           cin >> a[i][j]; 
        }
    }
    int all = (1<<n);
    int ans = INT_MAX/2;
    for(int s = 1; s < all; s++){
        vector<int> got(m,0);
        int need = 0;
        for (int i = 0; i < n; i++){
            if (s>>i & 1){
                need += c[i];
                for(int j = 0; j < m; j++){
                    got[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        for(int j = 0; j < m; j++){
            if (got[j] < x) ok = false;
        }
        if (ok) ans = min(ans,need);
    }
    
    if (ans == INT_MAX/2) cout << -1;
    else cout << ans;
    
}










Compiler output:
a.cc: In function 'int main()':
a.cc:57:15: error: 'INT_MAX' was not declared in this scope
   57 |     int ans = INT_MAX/2;
      |               ^~~~~~~
a.cc:19:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   18 | #include <stack>
  +++ |+#include <climits>
   19 |
Language: C++

//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll n, m, x, c[19], a[19][19], h[19], ans = INT_MAX;
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>m>>x;
    for(int i=0;i<n;i++) {
        cin>>c[i];
        for(int j=0;j<m;j++) {
            cin>>a[i][j];
        }
    }
    for(int mask = 0; mask < (1 << n); mask++) {
        ll cost = 0;
        for(int i=0;i<n;i++) {
            if(mask & (1 << i)) {
                cost += c[i];
                for(int j=0;j<m;j++)
                    h[j] += a[i][j];
            }
        }
        bool p = 1;
        for(int j=0;j<m;j++) {
            if(h[j] < x) {
                p = 0;
                break;
            }
        }
        if(p)
            ans = min(ans, cost);
        for(int j=0;j<m;j++)
            h[j] = 0;
    }
    if(ans == INT_MAX)
        cout<<-1;
    else
        cout<<ans;
}
/*
 2
 1 1
 1 0
 1 1
 1 1
 */


Compiler output:
a.cc:32:44: error: 'INT_MAX' was not declared in this scope
   32 | ll n, m, x, c[19], a[19][19], h[19], ans = INT_MAX;
      |                                            ^~~~~~~
a.cc:27:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   26 | #include <assert.h>
  +++ |+#include <climits>
   27 | #define ff first
a.cc: In function 'int main()':
a.cc:63:15: error: 'INT_MAX' was not declared in this scope
   63 |     if(ans == INT_MAX)
      |               ^~~~~~~
a.cc:63:15: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <assert.h>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <bitset>
#include <numeric>
#include <string.h>
#include <utility>

using namespace std;
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define sz(x) (int)((x).size())
#define forn(i,n) for (int i=0; i < n; i++)
#define forse(i,s,e) for (int i=s; i < e; i++)
#define pb push_back 
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mp make_pair
#define fi first
#define se second
#define all(vec) vec.begin(), vec.end()
#define time() ((double)clock() / CLOCKS_PER_SEC)
#define debug(x) cerr << (#x) << " is " << (x) << endl;

#ifndef LOCAL
#define cerr if(false)cerr
#endif

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll P=1e9+7;
double PI=3.141592653589793;
const int arrn = 2e5 + 1;


void solve(){
	int n,m,x;
	cin >> n >> m >> x;
	vector<vector<int>> vals(n,vector<int>(m));
	vector<int> cs(n);
	forn(i,n){
		cin >> cs[i];
		forn(j,m) cin >> vals[i][j];
	}
	int ans=INT_MAX;
	forn(i,(1<<n)){
		vector<int> cur(m,0);
		int cst=0;
		forn(j,n){
			if(i&(1<<j)){
				cst+=cs[j];
				forn(t,m) cur[t]+=vals[j][t];
			}
		}	
		bool chk=1;
		forn(j,m){
			if(cur[j]<x) chk=0;
		}
		if(chk){
			ans=min(ans,cst);
		}
	}

	if(ans==INT_MAX) cout << -1;
	else cout << ans;
}

int main() {
	IO;
	int T=1;
//	cin >> T;
	forn(c,T){
		solve();
	}
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:58:17: error: 'INT_MAX' was not declared in this scope
   58 |         int ans=INT_MAX;
      |                 ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <utility>
  +++ |+#include <climits>
   16 |
Language: C

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, m, x; cin >> n >> m >> x;
  vector<int> c(n); REP(i, n) cin >> c[i];
  vector<vector<int>> a(n, vector<int>(m)); REP(i, n) REP(j, m) cin >> a[i][j];
  int ans = INF;
  REP(i, 1 << n) {
    int cost = 0;
    vector<int> und(m, 0);
    REP(j, n) {
      if (i >> j & 1) {
        cost += c[j];
        REP(k, m) und[k] += a[j][k];
      }
    }
    if (*min_element(ALL(und)) >= x) chmin(ans, cost);
  }
  cout << (ans == INF ? -1 : ans) << '\n';
  return 0;
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] <= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) left = mid;
		else right = mid;
	}
	/* left は条件を満たす最大の値、right は条件を満たさない最小の値になっている */
	return left;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
double PI = 3.141592653589793238;
vector<vector<int>>G(100030);
int main() {
	int n;
	long long int k;
	cin >> n >> k;
	vector<int> v;
	v.push_back(0);
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	int now = 1;
	for (int i = 1; i <= 1000000; i++) {
		now = v[now];
		if (i == k) {
			cout << now;
			return 0;
		}
	}
	int susum[200030] = {};
	k = k - 1000000;
	vector<int>roop;
	for (int i = 1; i <= 1000000; i++) {
		if (susum[v[now]] == 0) {
			roop.push_back(v[now]);
			susum[v[now]] = 1;
			now = v[now];
		}
		else {
			break;
		}
	}
	long long int f = long long int(roop.size());
	long long int t = k % f;
	if (t == 0) {
		cout <<roop[roop.size() - 1];
	}
	else {
		cout << roop[t-1];
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:128:27: error: expected primary-expression before 'long'
  128 |         long long int f = long long int(roop.size());
      |                           ^~~~
Language: C++

#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	ll n,k;
	cin>>n>>k;
	ll a[n];
	in(a,n);
	rep(i,n)a[i]--;
	ll loop=1,town=0,visit[n];
	init(visit,n);
	while(visit[town]==0){
		visit[town]=loop;
		town=a[town];
		loop++;
	}
	loop=loop-visit[town];
	k%=loop;
	town=0;
	rep(i,k)town=a[town];
	cout<<town+1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'll' was not declared in this scope; did you mean 'all'?
    9 |         ll n,k;
      |         ^~
      |         all
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'in'?
   10 |         cin>>n>>k;
      |         ^~~
      |         in
a.cc:10:14: error: 'n' was not declared in this scope; did you mean 'in'?
   10 |         cin>>n>>k;
      |              ^
      |              in
a.cc:10:17: error: 'k' was not declared in this scope
   10 |         cin>>n>>k;
      |                 ^
a.cc:11:11: error: expected ';' before 'a'
   11 |         ll a[n];
      |           ^~
      |           ;
a.cc:12:12: error: 'a' was not declared in this scope
   12 |         in(a,n);
      |            ^
a.cc:2:45: note: in definition of macro 'in'
    2 | #define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
      |                                             ^
a.cc:13:13: error: 'i' was not declared in this scope; did you mean 'in'?
   13 |         rep(i,n)a[i]--;
      |             ^
      |             in
a.cc:13:9: error: 'rep' was not declared in this scope
   13 |         rep(i,n)a[i]--;
      |         ^~~
a.cc:14:11: error: expected ';' before 'loop'
   14 |         ll loop=1,town=0,visit[n];
      |           ^~~~~
      |           ;
a.cc:15:14: error: 'visit' was not declared in this scope
   15 |         init(visit,n);
      |              ^~~~~
a.cc:1:42: note: in definition of macro 'init'
    1 | #define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
      |                                          ^
a.cc:16:15: error: 'visit' was not declared in this scope
   16 |         while(visit[town]==0){
      |               ^~~~~
a.cc:16:21: error: 'town' was not declared in this scope
   16 |         while(visit[town]==0){
      |                     ^~~~
a.cc:17:29: error: 'loop' was not declared in this scope
   17 |                 visit[town]=loop;
      |                             ^~~~
a.cc:18:22: error: 'a' was not declared in this scope
   18 |                 town=a[town];
      |                      ^
a.cc:21:9: error: 'loop' was not declared in this scope
   21 |         loop=loop-visit[town];
      |         ^~~~
a.cc:21:19: error: 'visit' was not declared in this scope
   21 |         loop=loop-visit[town];
      |                   ^~~~~
a.cc:21:25: error: 'town' was not declared in this scope
   21 |         loop=loop-visit[town];
      |                         ^~~~
a.cc:25:9: error: 'cout' was not declared in this scope
   25 |         cout<<town+1;
      |         ^~~~
Language: C

#include <iostream>
#include <vector>

using namespace std;
const int N = 2e5 + 1;
long long k;
int n,a[N];
bool avail[N];
vector <int> V;
int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    V.push_back(0);
    int start = 1; bool run = false;
    while (avail[a[start]] == false){
        start = a[start];
        avail[start] = true;
        V.push_back(start);
    }
    V.push_back(a[start]);
    //for (int i = 1; i < V.size(); i++) cout << V[i] << " "; cout << "\n";
    int d , c = V.size() - 2;
    for (int i = 1; i < V.size() - 1; i++)
        if (a[start] == V[i]) d = i;
    //cout << d << " " << c << "\n";
    if (k < d) cout << V[k];
    else{
        k = k - d + 1;
        k = k % (c - d + 1);
        if (k == 0) cout << V[c];
        else cout << V[d + k - 1];
    }
    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<vector>
using namespace std;
typedef long long li;
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }


int main() {
  int n; li k; cin >>n >>k;
  vector<int> a(n); for(auto& x:a){ cin >>x; x--; }
  vector<int> seen(n);
  seen[0]=1;
  int tmp=a[0],cnt=1;
  while(seen[tmp]==0){
    cnt++;
    seen[tmp]=1;
    tmp=a[tmp];
  }
  int tail=0,tmp2=0;
  while(tmp2!=tmp){
    tail++;
    tmp2=a[tmp2];
  }
  
  if(k<=cnt){
    int ans=0;
    rep(i,k){
      ans=a[ans];
    }
    print(ans+1);
    return 0;
  }
  
  int T=cnt-tail;
  li q=(k-tail)/T,r=(k-tail)%T;
  k=min(k,(li)tail);
  int ans=0;
  rep(i,tail+r){
    ans=a[ans];
  }
  print(ans+1);
}


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

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

 
int main() {

    int64_t n,k;
    cin>>n>>k;


    vector<int64_t> A(n);
    for(int i=0;i<n;i++){
        cin>>A.at(i);
        A.at(i)--; // 0～にする。
    } 


    vector<int64_t> visit(n);
    int64_t next=0;
    int64_t loop_length=1;
    bool loop_flg=false;
    for(int i=0;i<(min(k,n);i++){
//        cout<<next<<" ";
        visit.at(next) = i+1;
        next = A.at(next);

        if(visit.at(next) != 0){
            loop_length = i+1 - visit.at(next)+1;
            loop_flg=true;
            break;
        }
    }

    int64_t index;
        index = (k-visit.at(next))%loop_length;
//    cout<<"loop_length="<<loop_length<<endl;
//    cout<<"index="<<index<<endl;
    for(int i=0;i<index;i++){
        next = A.at(next);
    }

//    cout<<endl;
    cout<<++A.at(next)<<endl;

 	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:28: error: expected ')' before ';' token
   23 |     for(int i=0;i<(min(k,n);i++){
      |                   ~        ^
      |                            )