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

#include<bits\stdc++.h>
#define P 1000000007
#define ll long long
using namespace std;
ll n,a[10005];
int main()
{
	scanf("%lld",&n);
	for (ll i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	ll Ans=1,sum=0;
	for (ll i=1;i<=n;i++)
	{
	//	cout<<Ans<<' '<<sum<<endl;
		if (sum*2+1>a[i]+1)
			Ans=Ans*sum%P;
		else
		if (sum*2+1==a[i]+1) Ans=Ans*(sum+1)%P;
		else sum++;
	//cout<<Ans<<' '<<sum<<endl;
	}
	while(sum) Ans=Ans*(sum--)%P;
	printf("%lld\n",Ans);
}

Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

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

public class A {
	FastScanner in;
	PrintWriter out;

	void solve() {
		final int mod = (int) 1e9 + 7;
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		long res = 1;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			int pos = a[i];
			cnt++;
			int can = (pos + 1) / 2;
			while (cnt > can) {
				res = res * cnt % mod;
				cnt--;
			}
		}
		while (cnt > 1) {
			res = res * cnt % mod;
			cnt--;
		}
		out.println(res);
	}

	void run() {
		try {
			in = new FastScanner(new File("object.in"));
			out = new PrintWriter(new File("object.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new A().runIO();
	}
}

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

//Link : https://atcoder.jp/contests/mujin-pc-2017/tasks/mujin_pc_2017_b

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 503
#define inf 200000000
char s[N][N];
void solve() {
  int n;scanf("%d ", &n);
  int row[N],column[N];
  memset(row,0,sizeof(row));
  memset(column,0,sizeof(column));

  for(int i=0;i<n;++i) {
    scanf(" %s ", s[i]);
    for(int j=0;j<n;++j) {
      if(s[i][j]=='#') {
        ++column[j];
        ++row[i];
      }
    }
  }
  int x = n;
  int ret = inf;
  for(int i=0;i<n;++i) {
    if(row[i]==n) {
      --x;
    }
  }
  for(int c=0;c<n;++c) {
    bool isGood = true;
    int tmp = 0;
    for(int j = 0;j<n;++j) {
      if(s[c][j]=='.') {
        if(c==j && column[j]==0) {
          if(row[c])
            tmp+=2;
          else
            isGood = false;
        } else {
          ++tmp;
        }
      }
    }
    if(!isGood) {
      continue;
    }
    for(int j=0;j<n;++j) if (s[c][j]=='.'||column[j].size()!=n) tmp++;
    ret = min(ret,tmp);
  }

  if(ret==inf) {
    ret = -1;
  }
  printf("%d\n", ret);
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:49:54: error: request for member 'size' in 'column[j]', which is of non-class type 'int'
   49 |     for(int j=0;j<n;++j) if (s[c][j]=='.'||column[j].size()!=n) tmp++;
      |                                                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;

int main() {
    int n, r=0, ans = IINF;
    bool ok = false;
    cin >> n;
    vector<string> s(n);
    for(int i=0;i<n;i++) cin >> s[i];
    for(int j=0;j<n;j++){
        int cnt = 0;
        for(int i=0;i<n;i++){
            if(s[i][j] == '#') cnt++;
        }
        if(cnt == n) r++;
        ok |= cnt > 0;
    }
    if(!ok){
        cout << -1 << endl;
        return 0;
    }
    for(int j=0;j<n;j++){
        int f = 1;
        for(int i=0;i<n;i++){
            if(s[i][j] == '#') f = 0;
        }
        int cnt = 0;
        for(int i=0;i<n;i++){
            if(s[j][i] == '.') cnt++;
        }
        ans = min(ans, cnt+n-r+f);
    }
    cout << (ans < IINF ? ans : -1) << endl;
    return 0;
}


Compiler output:
a.cc:4:11: error: 'll' does not name a type
    4 | constexpr ll LLINF = LLONG_MAX;
      |           ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  int c = 0;
  V<string> s(n);
  for (auto&& e : s) {
    cin >> e;
    c += count(begin(e), end(e), '#');
  }
  if (!c) return cout << -1 << '\n', 0;
  int res = 0;
  int mn = 1e9;
  for (int j = 0; j < n; ++j) {
    c = 0;
    for (int i = 0; i < n; ++i) c += s[i][j] == '#';
    res += c < n;
    if (c) {
      mn = min(mn, count(begin(s[j]), end(s[j]), '.'));
    }
  }
  res += mn;
  cout << res << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: no matching function for call to 'min(int&, std::__iterator_traits<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, void>::difference_type)'
   24 |       mn = min(mn, count(begin(s[j]), end(s[j]), '.'));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:24:15: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__iterator_traits<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >, void>::difference_type' {aka 'long int'})
   24 |       mn = min(mn, count(begin(s[j]), end(s[j]), '.'));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:24:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |       mn = min(mn, count(begin(s[j]), end(s[j]), '.'));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include "/Users/daikikodama/Desktop/stdc++.h"
//#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int n;
char c[510][510];

signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    bool black=false;
    rep(i,n)rep(j,n){
        cin>>c[i][j];
        if(c[i][j]=='#')black=true;
    }
    if(!black){
        cout<<-1<<endl;
        return 0;
    }
    
    int white=0;
    rep(i,n){
        bool b=false;
        rep(j,n)if(c[j][i]=='.')b=true;
        if(b)white++;
    }
    
    int ans=INF;
    rep(i,n){
        bool b=false;
        int cnt=0;
        rep(j,n){
            if(c[j][i]=='#')b=true;
            if(c[i][j]=='.')cnt++;
        }
        if(!b)cnt++;
        chmin(ans, cnt+white);
    }
    
    cout<<ans<<endl;
    return 0;
    
}

Compiler output:
a.cc:1:10: fatal error: /Users/daikikodama/Desktop/stdc++.h: No such file or directory
    1 | #include "/Users/daikikodama/Desktop/stdc++.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>


using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef vector<VP> VVP;

const int maxn = 501;
int g[maxn][maxn];
int n;

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	VI ison(n, 0);
	VI numoffinrow(n, 0);
	VI colscount(n, 0;)
	int numallblackcols = 0;
	bool possible = false;
	for (int i = 0; i < n; ++i) {
		char c;
		int black_count = 0;
		for (int j = 0; j < n; ++j) {
			cin >> c;
			g[i][j] = (c == '#' ? 1 : 0);
			if (g[i][j]) ison[j] = 1;
			black_count += g[i][j];
			if (!g[i][j]) ++numoffinrow[i];
			colscount[j] += g[i][j];
		}
		if (black_count > 0) possible = true;
	}
	for (int j = 0; j < n; ++j) {
		if (colscount[j] == n) ++numallblackcols;
	}
	if (!possible) {
		cout << -1;
		return 0;
	}
	int sol = 2*n + 1000;
	for (int i = 0; i < n; ++i) {
		if (ison[i]) {
			sol = min(sol, numoffinrow[i] + (n-numallblackcols));
		}
	}
	cout << sol;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: expected ')' before ';' token
   27 |         VI colscount(n, 0;)
      |                     ~    ^
      |                          )
a.cc:27:27: error: expected primary-expression before ')' token
   27 |         VI colscount(n, 0;)
      |                           ^
a.cc:44:42: error: 'numallblackcols' was not declared in this scope
   44 |                 if (colscount[j] == n) ++numallblackcols;
      |                                          ^~~~~~~~~~~~~~~
a.cc:53:60: error: 'numallblackcols' was not declared in this scope
   53 |                         sol = min(sol, numoffinrow[i] + (n-numallblackcols));
      |                                                            ^~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 1234;
 
int col[N];
char s[N][N];
 
int main() 
{
	int h;
	scanf("%d", &h);
	int w = h;
	for (int i = 0; i < h; i++) 
		scanf("%s", s[i]);
	bool any = false;
	for (int i = 0; i < h; i++) 
		for (int j = 0; j < w; j++) 
			any |= (s[i][j] == '#');
	
	if (!any)
	{
		puts("-1");
		return 0;
	}
	for (int i = 0; i < h; i ++) 
		for (int j = 0; j < w; j ++)
			if (s[i][j] == '#') 
				col[j] ++;

	int ans = (int) 2 * n + 1;
	for (int i = 0; i < h; i ++) 
	{
		int cur = 0;
		if (col[i] == 0) cur ++;
		for (int j = 0; j < w; j ++)
			if (s[i][j] == '.')
				cur ++;
		for (int j = 0; j < w; j ++) 
			if (col[j] < h) 
				cur ++;
		ans = min(ans, cur);
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:29: error: 'n' was not declared in this scope
   30 |         int ans = (int) 2 * n + 1;
      |                             ^
Language: C++

#include <bits/stdc++.h>

#define PAUSE system("pause")
#define LLI long long int
#define LD long double
#define PB push_back
#define PF push_front
#define MP make_pair
#define FORi(i, a, b) for(int i = a; i < b ; ++i)
#define FORd(i, a, b) for(int i = a; i > b ; --i)

using namespace std;

const int MOD = 1e9+7;

int solve(vector<vector<bool> > v){
	vector<vector<bool> > b = v;
	int n = v.size();
	FORi(i,0,n){
		FORi(j,0,n){
			if (!v[i][j])
				break;
			if (j == n-1){
				return 0;
			}
		}
	}
	int a=1e9;
	FORi(r,0,n){
		FORi(c,0,n){
			FORi(i,0,n){
				b[i][c] = v[r][i];
			}
			a = min(a, solve(b));
			
			FORi(i,0,n){
				b[i][c] = v[i][c];
			}
		}
	}
	return a;
}

int main() {	
//	ifstream fin("in.txt");
//	ofstream fout("out.txt");
	
	int n;
	cin >> n;
	vector<vector<bool> > black(n);
	int cnt = 0, max_raw = 0; col_cnt = 0;
	char ch;
	FORi(i,0,n){
		int raw = 0;
		FORi(j,0,n){
			cin >> ch;
			x[i][j] = (ch == '#');
			cnt += x[i][j];
			raw += x[i][j];
		}
		max_raw = max(max_raw, raw);
	}
	
	FORi(j,0,n){
		FORi(i,0,n){
			if (!black[i][j]){
				col_cnt++;
				break;
			}
		}
	}
	
	if (!cnt){
		cout << -1;
	}
	
	return solve(black) + col_cnt;
//	if (cnt == n*n){
//		cout << 0;
//	}
//	if (max_raw == n){
//		cout << col_cnt;
//	}
//	
//	if (n==2){
//		cout << 4 - (black[0][0] || black[1][1] || black[0][1] && black[1][0]);
//	}
//	
//	if (n==3){
//		if (max_raw == 1){
//			cout << 3 - (black[0][0] || black[1][1] || black[2][2]) + col_cnt;
//		}
//	}
	
//	PAUSE;
//	fin.close();
//	fout.close();
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:35: error: 'col_cnt' was not declared in this scope
   51 |         int cnt = 0, max_raw = 0; col_cnt = 0;
      |                                   ^~~~~~~
a.cc:57:25: error: 'x' was not declared in this scope
   57 |                         x[i][j] = (ch == '#');
      |                         ^
Language: C++

#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <limits>

char color[510][510];
bool writeable_row[510];
int row_black[510];
int tate_black[510];
bool tate_filled[510];
int filled;
int min_whiteid = -1;
int min_white = 1000;
int main() {
	int N;
	std::cin >> N;
	for (int i = 0; i < N; i++)	for (int j = 0; j < N; j++)std::cin >> color[i][j];
	filled = 0;
	for (int i = 0; i < N; i++)
	{
		writeable_row[i] = false;
		tate_black[i] = 0;
		row_black[i] = 0;
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (color[i][j] == '#') {
				writeable_row[j] = true;
				row_black[i]++;
				tate_black[j]++;
			}		
		}
	}
	min_white = N + 1;
	for (int j = 0; j < N; j++) {
		if (writeable_row[j]) {
			if (min_white > N - row_black[j]) {
				min_white = N - row_black[j];
				min_whiteid = j;
			}
		}
		tate_filled[j] = (tate_black[j] == N);
		if (row_black[i] == N)filled++;
	}
	
	int ans;
	if (min_whiteid == -1) {
		ans = -1;
	}
	else {
		int tatef_cnt = 0;
		for (int i = 0; i < N; i++)
		{
			if (tate_filled[i])tatef_cnt++;
		}

		if (filled == N) {
			ans = 0;
		}
		else {
			ans = min_white + N - tatef_cnt;
		}
	}

	std::cout << ans;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:31: error: 'i' was not declared in this scope
   48 |                 if (row_black[i] == N)filled++;
      |                               ^
Language: C++

#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>

using namespace std;
char s[505][505];
int x[505],y[505];
int main()
{
    int n;
    scanf("%d",&n);
    getchar();
    for(int i=1;i<=n;++i) gets(s[i]+1);
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=n;++j)
        {
            if(s[i][j]=='#'){
                ++x[i],++y[j];
            }
        }
    }
    int mii=0x3f3f3f3f,ki=-1;
    for(int i=1;i<=n;++i)
    {
        //cout<<x[i]<<' ';
        if(x[i]==n)
        {
            mii=0;
            ki=i;
            break;
        }
        else if(y[i]&&n-x[i]<mii)
        {
            mii=n-x[i];
            ki=i;
        }
    }
    //cout<<endl;
    if(mii==0x3f3f3f3f)
        printf("-1");
    else
    {
        //cout<<mii<<endl;
        int ff=0;
        for(int j=1;j<=n;++j)
        {
            if(y[j]==n) ++ff;
        }
        //cout<<ff<<endl;
        printf("%d",mii+n-ff);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: 'gets' was not declared in this scope; did you mean 'getw'?
   24 |     for(int i=1;i<=n;++i) gets(s[i]+1);
      |                           ^~~~
      |                           getw
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

vector<vector<char> > ch(vector< vector<char> > mp, int a, int b, int n) {
	vector< vector<char> > mpp = mp;
	for (int i = 0; i < n; i++) {
		mpp[i][b] = mp[a][i];
	}
	return mpp;
}

int cc(vector< vector<char> > mp, int n) {
	bool h = true;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (mp[i][j] != "#") {
				h = false;
			}
		}
	}
	if (h) {
		return 0;
	} else {
		int a = 10;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a = min(a, 1+cc(ch(mp, i, j, n), n))
			}
		}
		return a;
	}
}

int main() {
	int n;
	cin >> n;
	vector< vector<char> > mp(n, vector<char>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> mp[i][j];
		}
	}
	
	cout << cc(mp, n) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int cc(std::vector<std::vector<char> >, int)':
a.cc:19:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |                         if (mp[i][j] != "#") {
a.cc:30:69: error: expected ';' before '}' token
   30 |                                 a = min(a, 1+cc(ch(mp, i, j, n), n))
      |                                                                     ^
      |                                                                     ;
   31 |                         }
      |                         ~
Language: C++

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
vector<string> S;
int ret;
int R[501],C[501];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	int ok=0;
	
	FOR(y,N) {
		cin>>s;
		S.push_back(s);
		FOR(x,N) {
			if(S[y][x]=='#') {
				ok++;
				R[y]++;
				C[x]++;
			}
		}
	}
	if(ok==0) {
		cout<<-1<<endl;
		return;
	}
	int ok=0;
	FOR(i,N) if(S[i][i]=='#') ok++;
	assert(ok);
	
	
	int mi=101010;
	FOR(y,N) if(R[y]==N) {
		int num=0;
		FOR(x,N) if(C[x]!=N) num++;
		mi=min(mi,num);
	}
	FOR(y,N) FOR(x,N) if(S[y][x]=='#') {
		int num=0;
		FOR(i,N) {
			if(S[x][i]=='#') {
				if(C[i]!=N) num++;
			}
			else {
				num+=2;
			}
		}
		mi=min(mi,num);
	}
	
	FOR(y,N) {
		int num=0;
		FOR(x,N) {
			if(S[y][x]=='.') {
				FOR(i,N) if(S[x][i]=='#') {
					num+=3;
					break;
				}
				if(i==N) break;
			}
			else {
				if(C[x]!=N) num++;
			}
		}
		if(x==N) mi=min(mi,num);
	}
	
	cout<<mi<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	FOR(i,1) {
		S.clear();
		ZERO(R);
		ZERO(C);
		solve();
	}
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:42:13: error: redeclaration of 'int ok'
   42 |         int ok=0;
      |             ^~
a.cc:25:13: note: 'int ok' previously declared here
   25 |         int ok=0;
      |             ^~
Language: C++

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int ret = 2000;

int N;
string c[510];
bool all[510];
bool ex[510];
int d[510];

int main() {
	cin >> N;

	bool ng = 1;

	queue<int> que;
	memset(d, -1, sizeof(d));

	rep(i, N) {
		cin >> c[i];
		rep(j, N) {			
			if (c[i][j] == '#') {
				ex[j] = 1;
				d[j] = 0;
				que.push(j);
				ng = 0;
			}
		}
	}

	while (!que.empty()) {
		int v = que.front(); que.pop();
		rep(j, N) if (c[i][j] == '#') {
			if (d[j] == -1) {
				d[j] = d[v] + 1;
				que.push(j);
			}
		}
	}

	if (ng) {
		puts("-1");
		return 0;
	}

	rep(j, N) {
		all[j] = 1;
		rep(i, N) if (c[i][j] != '#') {
			all[j] = 0;
		}
	}

	rep(i, N) {
		bool ok = 1;
		rep(j, N) if (c[i][j] != '#') {
			ok = 0;
		}
		if (ok) {
			int sm = 0;
			rep(j, N) {
				if (!all[j]) ++sm;
			}
			ret = min(ret, sm);
		}
	}

	rep(i, N) {
		set<int> us;
		memset(d, -1, sizeof(d));

		//if (ex[i]) {
			rep(j, N) if (c[i][j] != '#') {
				us.insert(j);
			}

			if (us.size() == 0) {
				continue;
			}

			int cnt = 0;

			rep(j, N) {
				bool t = 1;
				if (!us.count(j)) {
					++cnt;
				} else {
					if (!all[j]) {
						++cnt;
					}
				}
			}

			int t = (int)us.size() + cnt + d[i];
			//if (!ex[i]) ++t;
			ret = min(ret, t);
		//}
	}

	cout << ret << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:33: error: 'i' was not declared in this scope
   47 |                 rep(j, N) if (c[i][j] == '#') {
      |                                 ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector< vector<char> > mp(n, vector<char>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> mp[i][j];
		}
	}
	vector<int> d(n, 0);
	vector<int> d2(n, 0);
	int MAX = 0;
	int aa = 0;
	int MAX2 = 0;
	vector<string> ss(n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (mp[i][j] == '#') {
				d[i]++;
				aa++;
				ss[i] += mp[i][j];
			}
			if (mp[j][i] == '#') {
				d2[i]++;
			}
		}
		MAX = max(MAX, d[i]);
		MAX2 = max(MAX2, d2[i]);
	}
	if (n == 2) {
		if (aa == 4) {
			cout << 0 << endl;
		} else if (aa == 3) {
			cout << 1 << endl;
		} else if (MAX == 2 || MAX2 == 2) {
			cout << 2 << endl;
		} else if (aa == 2 || s[0] == "#." || s[1] == ".#") {
			cout << 3 << endl;
		} else if (aa == 1){
			cout << 4 << endl;
		} else {
			cout << -1 << endl;
		}
	} else {
		if (MAX == 3) {
			int a = 0;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3) {
					a++;
				}
			}
			cout << a << endl;
		} else if (aa == 0){
			cout << -1 << endl;
		} else if (aa == 1 && (ss[0] == ".#." || ss[2] == ".#." || ss[1] == "#.." || ss[1] == "..#")) {
			cout << 6 << endl;
		} else if (aa == 1) {
			cout << 5 << endl;
		} else if (ss[0] == "##." || ss[1] == "##.") {
			int a = 2;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3 && i != 2) {
					a++;
				}
			}
			cout << a << endl;
		} else if (ss[1] == ".##" || ss[2] == ".##") {
			int a = 2;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3 && i != 0) {
					a++;
				}
			}
			cout << a << endl;
		} else if (ss[0] == "#.#" || ss[2] == "#.#") {
			int a = 2;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3 && i != 1) {
					a++;
				}
			}
			cout << a << endl;
		} else {
			int a = 2;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3) {
					a++;
				}
			}
			cout << a << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:39: error: 's' was not declared in this scope; did you mean 'ss'?
   44 |                 } else if (aa == 2 || s[0] == "#." || s[1] == ".#") {
      |                                       ^
      |                                       ss
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,a[505][505],b[505],Ans,Mn;
char nc()
{
	char c=getchar();
	while(c!='#'&&c!='.') c=getchar();
	return c;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)b[i]=1;
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
		a[i][j]=(nc()=='#'),b[j]&=a[i][j],sum+=b[j];
	if (!sum) return puts("-1"),0;
	for (int i=1;i<=n;i++)
		if (!b[i]) Ans++;
	Mn=100000000;
	for (int i=1;i<=n;i++)
	{
		int t=0,now=0;
		for (int j=1;j<=n;j++)
			if (a[j][i]) {t=j;break;}
		if (t==0) now++;
		for (int j=1;j<=n;j++)
			if (!a[i][j]) now++;
		Mn=min(Mn,now);
	}
	if (Mn==100000000)
		puts("-1");
	else printf("%d\n",Mn+Ans);
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:51: error: 'sum' was not declared in this scope
   18 |                 a[i][j]=(nc()=='#'),b[j]&=a[i][j],sum+=b[j];
      |                                                   ^~~
a.cc:19:14: error: 'sum' was not declared in this scope
   19 |         if (!sum) return puts("-1"),0;
      |              ^~~
Language: C++

#include <cstring>
#include <cstdint>
#include <iostream>
#include <string>
#include <memory>
#include <queue>
#include <limits>

char color[510][510];
char writeable_row[510];
int row_black[510];
int tate_black[510];
bool tate_filled[510];
int filled;
int min_whiteid = -1;
int min_white = INT_MAX;
int main() {
	int N;
	std::cin >> N;
	for (int i = 0; i < N; i++)	for (int j = 0; j < N; j++)std::cin >> color[i][j];
	filled = 0;
	for (int i = 0; i < N; i++)
	{
		tate_black[i] = 0;
		row_black[i] = 0;
		for (int j = 0; j < N; j++)
		{
			if (color[j][i] == '#') {
				tate_black[i]++;
			}
			if (color[i][j] == '#') {
				writeable_row[j] |= 1;
				row_black[i]++;
			}
			if (row_black[i] == N)filled++;
		}
	}
	min_white = N;
	for (int j = 0; j < N; j++) {
		if (writeable_row[j]) {
			if (min_white > N - row_black[j]) {
				min_white = N - row_black[j];
				min_whiteid = j;
			}
		}
		tate_filled[j] = (tate_black[j] == N);
	}
	
	int ans;
	if (min_whiteid == -1) {
		ans = -1;
	}
	else {
		int tatef_cnt = 0;
		for (int i = 0; i < N; i++)
		{
			if (tate_filled[i] && (color[min_whiteid][i] == '#'))tatef_cnt++;
		}

		if (filled == N) {
			ans = 0;
		}
		else {
			ans = min_white + N - tatef_cnt;
		}
	}

	std::cout << ans;
	return 0;
}


Compiler output:
a.cc:16:17: error: 'INT_MAX' was not declared in this scope
   16 | int min_white = INT_MAX;
      |                 ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <limits>
  +++ |+#include <climits>
    8 |
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector< vector<char> > mp(n, vector<char>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> mp[i][j];
		}
	}
	vector<int> d(n, 0);
	vector<int> d2(n, 0);
	int MAX = 0;
	int aa = 0;
	int MAX2 = 0;
	vector<string> ss(n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (mp[i][j] == '#') {
				d[i]++;
				aa++;
				ss[i] += mp[i][j];
			}
			if (mp[j][i] == '#') {
				d2[i]++;
			}
		}
		MAX = max(MAX, d[i]);
		MAX2 = max(MAX2, d2[i]);
	}
	if (n == 2) {
		if (aa == 4) {
			cout << 0 << endl;
		} else if (aa == 3) {
			cout << 1 << endl;
		} else if (MAX == 2 || MAX2 == 2) {
			cout << 2 << endl;
		} else if (aa == 2 || aa == 1) {
			cout << 3 << endl;
		} else {
			cout << -1 << endl;
		}
	} else {
		if (MAX == 3) {
			int a = 0;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3) {
					a++;
				}
			}
			cout << a << endl;
		} else if (aa == 0){
			cout << -1 << endl;
		} else if (aa == 1) {
			cout << 5 << endl;
		} else if (s[0] == "##." || s[1] == "##." || s[1] == ".##" || s[2] == ".##" || s[0] == "#.#" || s[2] == "#.#") {
			int a = 1;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3) {
					a++;
				}
			}
			cout << a << endl;
		} else {
			int a = 2;
			for (int i = 0; i < 3; i++) {
				if (d2[i] != 3) {
					a++;
				}
			}
			cout << a << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:28: error: 's' was not declared in this scope; did you mean 'ss'?
   62 |                 } else if (s[0] == "##." || s[1] == "##." || s[1] == ".##" || s[2] == ".##" || s[0] == "#.#" || s[2] == "#.#") {
      |                            ^
      |                            ss
Language: C++

#include <cstdio>
#include <queue>
#include <iostream>
#include <cstring>
using namespace std;

int n;
string board[505];
int dist[505][505];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		cin >> board[i];
	}
	memset(dist, -1, sizeof dist);
	queue< pair<int,int> > q;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (board[i][j] == '#') {
				dist[i][j] = 0;
				q.push(make_pair(i, j));
			}
		}
	}
	while (!q.empty()) {
		int ux = q.front().first, uy = q.front().second;
		q.pop();
		for (int j = 0; j < n; j++) {
			if (dist[uy][j] < 0) {
				dist[uy][j] = dist[ux][uy] + 1;
				q.push(make_pair(uy, j));
			}
		}
	}
	int empty_cols = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) if (board[i][j] == '.') {
			empty_cols++;
			break;
		}
	}

	int ret = -1;
	for (int i = 0; i < n; i++) {
		sort(dist[i], dist[i] + n);
		if (dist[i][0] < 0) {
			continue;
		}
		int total_dist = 0, cnt = 0;
		for (int j = 0; j < n; j++) {
			if (dist[i][j] > 0) {
				while (cnt + 1 < dist[i][j]) {
					total_dist++;
					cnt++;
				}
				total_dist++;
				cnt = dist[i][j];
			}
		}
		if (ret < 0 || ret > total_dist + empty_cols) {
			ret = total_dist + empty_cols;
		}
	}
	printf("%d\n", ret);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |                 sort(dist[i], dist[i] + n);
      |                 ^~~~
      |                 short
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,maxi=0,i,j,row[10005],col[1000],in,c1=0,c2=0;
	char a[600][600];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int c=0;
		for(j=0;j<n;j++)
		
		{
			scanf(" %c",&a[i][j]);
			if(a[i][j]=='#')
			c++,c2++;
		}
		row[i]=c;
		if(row[i]>maxi)
		maxi=row[i],in=i;
	}
	if(c2==0)
	{
		printf("-1");
		return 0;
	}
	for(i=0;i<n;i++)
	{
		int c=0;
		for(j=0;j<n;j++)
		
		{
			//scanf(" %c",&a[i][j]);
			if(a[j][i]=='#')
			c++;
		}
		col[i]=c;
		
	}
	for(i=0;i<n;i++)
	{
		if(a[in][i]=='.')
		{
			if(maxi==n)
			continue;
			c++;
		}
		else
		{
			if(col[i]<n)
			c++;
		}
	}
	printf("%d",c1+n-maxi);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:25: error: 'c' was not declared in this scope
   46 |                         c++;
      |                         ^
a.cc:51:25: error: 'c' was not declared in this scope
   51 |                         c++;
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define For(i,l,r) for (int i = l; i <= r; ++i)
#define Cor(i,l,r) for (int i = l; i >= r; --i)

int n;
char A[555][555];g
int main() {
	cin >> n;
	For(i,1,n) scanf("%s", A[i] + 1);
	int full_col = 0;
	bool full_row = 0;
	For(i,1,n) {
		bool x = true;
		For(j,1,n) if (A[i][j] == '.') { x = false ; break ; }
		full_row |= x;
		x = true;
		For(j,1,n) if (A[j][i] == '.') { x = false ; break ; }
		full_col += x;
	}
	int ans = n + n + 1;
	if (full_row) {
		ans = n - full_col;
	} else {
		For(i,1,n) For(j,1,n) if (A[i][j] == '#') {
			int leak = 0;
			For(k,1,n) if (A[j][k] == '.') ++leak;
			ans = min(ans, leak + n - full_col);
		}
	}
	if (ans >= n + n) puts("-1"); else cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:8:18: error: 'g' does not name a type
    8 | char A[555][555];g
      |                  ^
Language: C++

int main(){
int ans = -1;
cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'cout' was not declared in this scope
    3 | cout << ans << endl;
      | ^~~~
a.cc:3:16: error: 'endl' was not declared in this scope
    3 | cout << ans << endl;
      |                ^~~~
Language: C++

#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <cstdio>
#include <utility>
#include <bitset>
#include <complex>
#include <stack>
#include <tuple>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const ll INF = 1e7;
int main(){
	int N;
	cin >> N;
	vector<string> area(N);
	for(int i=0;i<N;i++)
		cin >> area[i];
	vector<int> not;
	for(int x=0;x<N;x++){
		bool flag=false;
		for(int y=0;y<N;y++){
			if(area[y][x]=='.')
				flag=true;
		}
		if(flag)
			not.push_back(x);
	}
	ll ans=INF;
	for(int base=0;base<N;base++){
		int cost=INF;
		bool flag=true;
		for(int x=0;x<N;x++)
			if(area[base][x]=='.')
				flag=false;
		if(flag)
			cost=0;
		else{
			bool exist=false;
			for(int y=0;y<N;y++){
				if(area[y][base]=='#')
					exist=true;
			}
			if(exist){
				cost=0;
				for(int x=0;x<N;x++)
					if(area[base][x]=='.')
						cost++;
			}
		}
		ans=min(ans,(ll)cost+not.size());
	}
	if(ans==INF)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: expected unqualified-id before 'not' token
   26 |         vector<int> not;
      |                     ^~~
a.cc:34:28: error: expected primary-expression before '.' token
   34 |                         not.push_back(x);
      |                            ^
a.cc:58:41: error: expected primary-expression before '.' token
   58 |                 ans=min(ans,(ll)cost+not.size());
      |                                         ^
Language: C++

//#pragma GCC optimize(2)
//#include<bits/stdc++.h>
//using namespace std;
//stack <char> q;
//char a[1200000];
//inline int read() {
//	int X=0,w=0;
//	char ch=0;
//	while(!isdigit(ch)) {
//		w|=ch=='-';
//		ch=getchar();
//	}
//	while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
//	return w?-X:X;
//}
//int main() {
//	freopen("fusion.in","r",stdin);
//	freopen("fusion.out","w",stdout);
//	scanf("%s",a+1);
//	int m;
//	cin>>m;
//	for(int i=1; i<=m; i++) {
//		int x,y;
//		x=read();
//		y=read();
//		while(!q.empty()) q.pop();
//		for(int j=x; j<=y; j++) {
//			if(q.empty()) {
//				q.push(char(a[j]));
//				continue;
//			}
//			char w=q.top();
//			char at=a[j];
//			q.push((char)a[j]);
//			if(w==at) {
//L1:
//				;
//				if(w=='z') {
//					q.pop();
//					q.pop();
//				} else {
//					q.pop();
//					q.pop();
//
//					at=(char)w+1;
//					if(q.empty()) {
//						q.push(at);
//						continue;
//					}
//					w=q.top();
//					q.push(at);
//					if(at==w) goto L1;
//				}
//			}
//		}
//		if(q.empty()) puts("Yes");
//		else puts("No");
//	}
//	return 0;
//}








































#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
char s[560000];
int n,m;
int to[560000][30],nxt[560000][30];
inline int read() {
	int ret=0;
	char c=getchar();
	while((c>'9')||(c<'0'))c=getchar();
	while((c>='0')&&(c<='9'))ret=(ret<<1)+(ret<<3)+c-'0',c=getchar();
	return ret;
}
void pre() {
	for(int i=1; i<=n+2; i++) {
		for(int j=0; j<=26; j++) to[i][j]=n+2;
		for(int j=0; j<=19; j++) nxt[i][j]=n+2;
	}
	for(int i=n; i; i--) {
		to[i][s[i]]=i+1;//更新自己这一位
		for(int j=s[i]+1; j<=26; j++) to[i][j]=to[to[i][j-1]][j-1]; //从k变到j（合并操作）
		nxt[i][0]=to[i][26];//记录消除完的情况
		for(int j=1; j<20; j++) nxt[i][j]=nxt[nxt[i][j-1]][j-1]; //更新多段消除完的情况
		for(int j=0; j<26; j++) if(to[i][j]==n+2) to[i][j]=to[nxt[i][0]][j]; //如azzabcd…即对于前面没有算出东西的情况中，先消除掉一部分再进行计算。
	}
}
bool check(int l,int r) {
	for(int i=19; i>=0; i--) {
		if(nxt[l][i]==r+1) return true;
		if(nxt[l][i]<=r) l=nxt[l][i];
	}
	return false;
}
int main() {
// 	freopen("fusion.in","r",stdin);
// 	freopen("fusion.out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1; i<=n; i++) s[i]-='a';
	pre();
	w=read();
	while(m--) {
		int l=read(),r=read();
		if(check(l,r)) puts("Yes");
		else puts("No");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:141:9: error: 'w' was not declared in this scope
  141 |         w=read();
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
char str[500005];
int q;
int dp[500005][27];
int go[500005][21];
int main(){
	scanf("%s%d",&str,&q); int n = strlen(str);
	rep(i,500005) rep(j,27) dp[i][j] = INF;
	for(int i=0;i<n;i++){
		dp[i][str[i]-'a'] = i;
	}
	while(1){
		bool upd = 0;
		for(int j=1;j<=26;j++){
			for(int i=0;i<n;i++){
				if(dp[i][j-1] < n && dp[dp[i][j-1]+1][j-1] < n && dp[i][j] > dp[dp[i][j-1]+1][j-1]){
					dp[i][j] = dp[dp[i][j-1]+1][j-1];
					upd = 1;
				}
				if(dp[i][26] < n && dp[dp[i][26]+1][j] < n && dp[i][j] > dp[dp[i][26]+1][j]){
					dp[i][j] = dp[dp[i][26]+1][j];
					upd = 1;
				}
			}
		}
		if(!upd) break;
	}
	for(int i=0;i<str.size();i++){
		go[i][0] = dp[i][26]+1;
		//cout<<i<<" "<<go[i][0]<<endl;
	}
	go[n][0] = n;
	for(int j=0;j<19;j++){
		for(int i=0;i<=n;i++){
			if(go[i][j] >= n) go[i][j+1] = INF;
			else go[i][j+1] = go[go[i][j]][j];
		}
	}
	//cout<<go[0][1]<<endl;
	rep(i,q){
		int x,y; scanf("%d%d",&x,&y); x--;
		for(int i=19;i>=0;i--){
			if(go[x][i] <= y) x = go[x][i];
		}
	//	cout<<x<<" "<<y<<endl;
		puts(x==y?"Yes":"No");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:27: error: request for member 'size' in 'str', which is of non-class type 'char [500005]'
   48 |         for(int i=0;i<str.size();i++){
      |                           ^~~~
Language: C++

#include <bits/stdc++.h>
#define X first
#define Y second
#define mp make_pair
using namespace std;
typedef pair<int,int> PII;
const int N = 500010;
char s[N];
int n,m,x,y,f[N][30],a[N];
bool ans[100010];
PII q[100010];
bool pd[N];
vector<int> v[N],Q[N]; 
void dfs(int x){
	pd[x]=true;
	for(int i=0;i<Q[x].size();i++) {
		if(pd[q[Q[x][i]].Y]) ans[Q[x][i]]=true;
	//	printf("%d %d %d\n",x,Q[x][i],ans[Q[x][i]]);
	}
	for(int i=0;i<v[x].size();i++) dfs(v[x][i]);
	pd[x]=false;
}
int main(){
	gets(s+1);
	//scanf("%s",s+1);
	n = strlen(s+1);
	for(int i=1;i<=n;i++) a[i]=s[i]-'a';
	for(int i=0;i<=26;i++) f[n+2][i]=f[n+1][i]=n+1;
	//cout<<n<<endl;
	for(int i=n;i>0;i--){
		f[i][a[i]]=i;
		for(int j=a[i]+1;j<=26;j++) f[i][j]=f[f[i][j-1]+1][j-1];
		for(int j=0;j<a[i];j++) f[i][j]=f[f[i][26]+1][j];
		if(f[i][26]<=n) 
			v[f[f[i][26]+1][26]].push_back(f[i][26]);
	}
//	for(int i=1;i<=n;i++) printf("%d ",f[i][26]); puts("");
	scanf("%d",&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		q[i] = mp(x,y);
		if(f[x][26]<=n) Q[f[x][26]].push_back(i);
	}
	dfs(n+1);
	for(int i=1;i<=m;i++) if(ans[i]) puts("Yes"); else puts("No");
	return 0;
}
/*
yzyyyzyzyyyz
8
1 6
7 12
1 12
6 11
1 1
1 3
4 9
3 8
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   24 |         gets(s+1);
      |         ^~~~
      |         getw
Language: C++

#include <iostream>
#include <vector>
#include <string.h>
#include <limits.h>

using namespace std;

int judge(char* str, int start, int end, int length){
  for(int count = 0; count < length; count++){
    int head = INT_MAX;
    for(int i = start; i < end; i++){
      char t_i = str[i];
      char t_i1 = str[i+1];
      // cout << t_i << ", " << t_i1 << endl;
      if(t_i == t_i1){
	head = i;
	break;
      }
    }
  
    // cout << "head: " << head+1 << endl; 
    // cout << "length: " << strlen(str) << endl;
    if(head == INT_MAX || strlen(str) < 1)
      break;
    // else{
    if(str[head] == 'z')
      strcpy(str+head, str+head+2);
    else{
      str[head] = ((str[head] - 'a' + 1) % 26) + 'a';
      strcpy(str+head+1, str+head+2);
    }
    // cout << "string: "<< str << endl; 
    // }
  }

  return strlen(str);
}


int main(int argc, char* argv[]){
  string s;
  int q = 0;
  cin >> s;
  cin >> q;

  for(int i = 0; i < q; i++){
    int l, r;
    cin >> l >> r;
    int count = r-l+1;
    // char t[count+1];
    // strncpy(t, s.c_str()+l-1, count);
    // t[count] = '\0';
    int size_ = judge(s.c_str(), l-1, r-1, count);
    if(size_ > 0)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;

    // cout << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:53:30: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
   53 |     int size_ = judge(s.c_str(), l-1, r-1, count);
      |                       ~~~~~~~^~
      |                              |
      |                              const char*
a.cc:8:17: note:   initializing argument 1 of 'int judge(char*, int, int, int)'
    8 | int judge(char* str, int start, int end, int length){
      |           ~~~~~~^~~
Language: C++

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

#define int long long

#define inf (int)1000000007
#define mod (int)1000000007

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rtrep(i, n) for(int i = (n); i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

string ds;

int dp[514514][27];

int solve(int p, int m) {
	if(dp[p][m] < -1) {
		int w = ds[p] - 'a';
		if(m == 26) {
			int now = p;
			bool ok = true;
			mfor(i, w, 26) {
				if(now >= ds.size() - 1) {
					dp[p][m] = -1;
					ok = false;
					break;
				}
				int t = solve(now + 1, i);
				if(t < 0) {
					dp[p][m] = -1;
					ok = false;
					break;
				}
				now = t;
			}
			if(ok) {
				dp[p][m] = now;
			}
		}
		else if(w == m) {
			dp[p][m] = p;
		}
		else if(w < m) {
			int t = solve(p, m - 1);
			if(t < 0 || t == ds.size() - 1) {
				dp[p][m] = -1;
			}
			else {
				int u = solve(t + 1, m - 1);
				if(u < 0) {
					dp[p][m] = -1;
				}
				else {
					dp[p][m] = u;
				}
			}
		}
		else {
			int t = solve(p, 26);
			if(t < 0 || t == ds.size() - 1) {
				dp[p][m] = -1;
			}
			else {
				int u = solve(t + 1, m);
				if(u < 0) {
					dp[p][m] = -1;
				}
				else {
					dp[p][m] = u;
				}
			}
		}
	}
	return dp[p][m];
}

bool trw[514514];
vector<int> tree[514514];

vector<pair<int, int>> ddq[514514];

bool ns[514514];
bool ans[114514];

void solve2(int p) {
	for(auto i : ddq[p]) {
		if(ns[i.first]) {
			ans[i.second] = true;
		}
		else {
			ans[i.second] = false;
		}
	}
	ns[p] = true;
	for(auto i : tree[p]) {
		solve2(i, s);
	}
	ns[o] = false;
}

signed main() {
	cin >> ds;
	int dn = ds.size();
	int dq;
	cin >> dq;
	rep(i, dn) {
		rep(j, 27) {
			dp[i][j] = -2;
		}
	}
	trep(i, dn) {
		trw[i] = false;
		ns[i] = false;
	}
	rep(i, dn) {
		if(!trw[i]) {
			int a = i;
			while(a < dn && solve(a, 26) > 0) {
				trw[a] = true;
				tree[solve(a, 26) + 1].push_back(a);
				a = solve(a, 26) + 1;
			}
		}
	}
	rep(i, dq) {
		int l, r;
		cin >> l >> r;
		l--;
		ddq[l].push_back(make_pair(r, i));
	}
	trep(i, dn) {
		if(!trw[i]) {
			set<int> s;
			solve2(i, s);
		}
	}
	rep(i, dq) {
		if(ans[i]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}


Compiler output:
a.cc: In function 'void solve2(long long int)':
a.cc:102:27: error: 's' was not declared in this scope
  102 |                 solve2(i, s);
      |                           ^
a.cc:104:12: error: 'o' was not declared in this scope
  104 |         ns[o] = false;
      |            ^
a.cc: In function 'int main()':
a.cc:140:31: error: too many arguments to function 'void solve2(long long int)'
  140 |                         solve2(i, s);
      |                         ~~~~~~^~~~~~
a.cc:91:6: note: declared here
   91 | void solve2(int p) {
      |      ^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#define MAXN 500005
using namespace std;

string s;
int n;
int pos[MAXN][26], vanish[MAXN];


int main() {
	cin >> s;
	n = s.size();
	memset(pos, -1, sizeof pos);
	memset(vanish, -1, sizeof vanish);
	for (int i = 0; i < n; i++) {
		s[i] -= 'a';
	}

	pos[n - 1][s[n - 1]] = n - 1;
	for (int i = n - 2; i >= 0; i--) {
		pos[i][s[i]] = i;
		for (int j = s[i] + 1; j <= 26; j++) {
			if (pos[i][j - 1] >= 0 && pos[pos[i][j - 1] + 1][j - 1] >= 0) {
				pos[i][j] = pos[pos[i][j - 1] + 1][j - 1];
			}
		}
		if (pos[i][26] >= 0 && pos[pos[i][26] + 1][26] >= 0) {
			vanish[i] = pos[i][26];
		}

		if (vanish[i] >= 0) {
			for (int j = 0; j < s[i]; j++) {
				pos[i][j] = pos[vanish[i] + 1][j];
			}			
		}
	}
	scanf("%d", &Q);
	while (Q--) {
		scanf("%d %d", &u, &v);
		u--;
		v--;
		while (u < v) {
			u = vanish[u] + 1;
		}
		if (u == v) {
			printf("Yes\n");
		} else {
			printf("No\n");
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:22: error: 'Q' was not declared in this scope
   39 |         scanf("%d", &Q);
      |                      ^
a.cc:41:33: error: 'u' was not declared in this scope
   41 |                 scanf("%d %d", &u, &v);
      |                                 ^
a.cc:41:37: error: 'v' was not declared in this scope
   41 |                 scanf("%d %d", &u, &v);
      |                                     ^