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

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<functional>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<unordered_set>
#include<unordered_map>
#define P pair<int,int>
#define int long long
using namespace std;

P S, G;
P k[200000];
vector<int>V;
int dp[200001];
signed main(){
	cin >> S.first >> S.second;
	cin >> G.first >> G.second;
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> k[i].first >> k[i].second;
	}
	sort(k, k + n);
	if (S.first > G.first)swap(S, G);
	for (int i = 0; i < n; i++) {
		if (G.first > k[i].first&&S.first < k[i].first&&max(S.first,G.first) > k[i].second&&min(S.first, G.first) < k[i].second) {
			V.push_back(k[i].second);
		}
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < V.size(); i++) {
		*lower_bound(dp, dp + n, V[i]) = V[i];
	}
	int i = 0;
	for (i = V.size(); i >= 0; i--) {
		if (dp[i] <= 1000000000000000ll)break;
	}
	printf("%.20lf\n", (G.first - S.first + abs(G.second - S.second)) * 100 - (20 - double(20)*3.141592653589793238462*0.25)*i);
	getchar();
	getchar();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'memset' was not declared in this scope
   33 |         memset(dp, 0x3f, sizeof(dp));
      |         ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include<unordered_set>
  +++ |+#include <cstring>
   10 | #include<unordered_map>
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 200005;

const double pi = acos(-1);

int n;
int f[N];
pair<int , int> a[N] , s , t;
int d[N] , D , c[N];

int main() {
    bool swaped = 0;
    scanf("%d%d%d%d%d" , &s.first,  &s.second , &t.first , &t.second , &n);
    int dd = abs(s.first - t.first) + abs(s.second - t.second);
    if (s.second == t.second) {
        swaped = 1;
        swap(s.first , s.second);
        swap(t.first , t.second);
    }
    if (s > t) {
        swap(s , t);
    }

    for (int i = 0 ; i < n ; ++ i) {
        scanf("%d%d" , &a[i].first , &a[i].second);
        if (swaped) {
            swap(a[i].first , a[i].second);
        }
    }
    sort(a , a + n);

    if (s.first == t.first) {
        bool find = 0;
        double res = dis * 100.0;
        for (int i = 0 ; i < n ; ++ i) {
            if (a[i].first == s.first &&
                s.second < a[i].second && a[i].second < t.second) {
                find = 1;
                break;
            }
        }
        if (find) res += 10 * pi - 20;
        printf("%f\n" , res);
        return 0;
    }

    if (t.second < s.second) {
        s.second = -s.second;
        t.second = -t.second;
        for (int i = 0 ; i < n ; ++ i) {
            a[i].second = -a[i].second;
        }
    }
    d[D ++] = s.second;
    d[D ++] = t.second;
    for (int i = 0 ; i < n ; ++ i) {
        d[D ++] = a[i].second;
    }
    sort(d , d + D);
    D = unique(d , d + D) - d;

    s.second = lower_bound(d , d + D , s.second) - d + 1;
    t.second = lower_bound(d , d + D , t.second) - d + 1;
    for (int i = 0 ; i < n ; ++ i) {
        a[i].second = lower_bound(d , d + D , a[i].second) - d + 1;
    }

    for (int i = 0 ; i < n ; ++ i) {
        f[i] = -1 << 30;
        if (a[i].first >= s.first && a[i].second >= s.second) {
            f[i] = 0;
        }
    }
    memset(c , 0xC0 , sizeof(c));
    int res = 0;
    for (int i = 0 ; i < n ; ++ i) {
        //printf("%d %d\n" , a[i].first , a[i].second);
        for (int j = a[i].second ; j > 0 ; j -= j & -j) {
            f[i] = max(f[i] , c[j]);
        }
        if (a[i].first <= t.first && a[i].second <= t.second) {
            res = max(res , ++ f[i]);
        }
        for (int j = a[i].second ; j <= D ; j += j & -j) {
            c[j] = max(c[j] , f[i]);
        }
    }
    __float128 ans = res * (5 * pi - 20);
    __float128 dis = 100.0;
    dis *= dd;
    ans += dis;

    printf("%f\n" , (double)ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: 'dis' was not declared in this scope; did you mean 'div'?
   35 |         double res = dis * 100.0;
      |                      ^~~
      |                      div
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))
//-------------------------------------------------------

double d1,d2;
int X1,Y1,X2,Y2;
int N;
int XX[202020],YY[202020];

vector<int> LIS(vector<int>& v) {
	int i,N=v.size();
	vector<int> dp(N,1<<30),id(N);
	FOR(i,v.size()) {
		id[i] = lower_bound(dp.begin(),dp.end(),v[i]) - dp.begin();
		dp[id[i]] = v[i];
	}
	int nl = *max_element(id.begin(),id.end());
	vector<int> ret(nl+1);
	FOR(i,N) if(id[N-1-i] == nl) ret[nl--] = v[N-1-i];
	return ret;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	double PI=atan(1)*4;
	d1=20-20*PI/4;
	d2=20*PI/2-20;
	
	cin>>X1>>Y1>>X2>>Y2;
	cin>>N;
	FOR(i,N) {
		cin>>XX[i]>>YY[i];
		if(XX[i]<min(X1,X2) || XX[i]>max(X1,X2) || YY[i]<min(Y1,Y2) || YY[i]>max(Y1,Y2)) i--,N--;
	}
	
	X2-=X1;
	Y2-=Y1;
	FOR(i,N) {
		XX[i]-=X1;
		if(X2<0) XX[i]=-XX[i];
		YY[i]-=Y1;
		if(Y2<0) YY[i]=-YY[i];
	}
	if(X2<0) X2=-X2;
	if(Y2<0) Y2=-Y2;
	
	double ret=100.0*(X2+Y2);
	if(N) {
		vector<pair<int,int>> V;
		vector<int> V2;
		FOR(i,N) V.push_back({XX[i],YY[i]});
		sort(ALL(V));
		FORR(v,V) V2.push_back(v.second);
		auto V3=LIS(V2);
		
		if(V3.size()==min(X2,Y2)+1) {
			ret-=d1*(V3.size()-1);
			ret+=d2;
		}
		else {
			ret-=d1*V3.size();
		}
	_P("%.12lf\n",ret);
	
	
}


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);
	cout.tie(0); solve(); return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:80:31: error: a function-definition is not allowed here before '{' token
   80 | int main(int argc,char** argv){
      |                               ^
a.cc:85:2: error: expected '}' at end of input
   85 | }
      |  ^
a.cc:33:14: note: to match this '{'
   33 | void solve() {
      |              ^
Language: C++

#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>

#define MAX_INT 2147483647
#define PI 3.14159265358979323846
#define long long long int

static const int MAX = 100000000;
using std::vector;
using std::map;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

int main() {
    std::ios::sync_with_stdio(false);

    int x1, y1, x2, y2, n;

    cin >> x1 >> y1 >> x2 >> y2 >> n;

    vector<pair<int, int>> c(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        c[i] = {x, y};
    }

    if (x1 > x2) {
        x1 = MAX - x1;
        x2 = MAX - x2;
        for (auto &item : c) {
            item.first = MAX - item.first;
        }
    }
    if (y1 > y2) {
        y1 = MAX - y1;
        y2 = MAX - y2;
        for (auto &item : c) {
            item.second = MAX - item.second;
        }
    }

    vector<pair<int, int>> good;
    for (auto item : c) {
        if (item.first >= x1 && item.first <= x2 && item.second >= y1 && item.second <= y2) {
            good.push_back(item);
        }
    }

    sort(good.begin(), good.end());
    int max = 0;
    vector<int> p(good.size() + 1, MAX_INT);

    for (auto item : good) {
        int l = -1;
        int r = p.size() + 1;
        while (r > l + 1) {
            int m = (l + r) / 2;
            if (p[m] > item.second) {
                r = m;
            } else {
                l = m;
            }
        }
        p[r] = item.second;
        max = std::max(max, r + 1);
    }

//    cerr << max << "\n";

    double res = 100 * (x2 - x1 + y2 - y1);
    if (x1 == x2 || y1 == y2) {
        res += 10 * max * (PI - 2);
    } else {
        res += 10 * max * (PI / 2 - 2);
    }

    cout << std::setprecision(20);
    cout << res << "\n";

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   58 |     sort(good.begin(), good.end());
      |     ^~~~
      |     short
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(short i=0;i<n;++i)
const short N = 2002;
typedef bitset<N> bi;
bi xrot[N], rrot[N], lrot[N];
bi A;
short cnt[N];
char buf[N];
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	short n = 0;
	char c = _getchar_nolock();
	while (c=='0'||c=='1') {
		if (c == '1')A.set(n);
		n++;
		c = _getchar_nolock();
	}

	rep(i, n) {
		c = _getchar_nolock();
		if (c == '1') {
			rep(j, n) {
				rrot[j].set((i + j) % n);
				lrot[j].set((i + j) % n);
			}
		}
	}
	if (!rrot[0].any() && A.any()) {
		puts("-1"); return 0;
	}
	rep(i, n) {
		xrot[i] = A^rrot[i];
		cnt[i] = xrot[i].count();
	}

	rep(i, n - 1)rrot[i + 1] |= rrot[i];

	lrot[n] = lrot[0];
	for (short i = n - 1; i >= 0; i--)lrot[i] |= lrot[i + 1];
	short ans = 1e4;

	rep(i, n) {//最後
		for (short j = i; j < n; ++j) {
			short l = j, r = n + 1;
			while (r - l > 1) {
				short mi = r + l >> 1;
				if (((rrot[j] | lrot[mi])&xrot[i]) == xrot[i])l = mi;
				else r = mi;
			}
			ans = min(ans, short(j + j + n + n - l - l - i + cnt[i]));
		}
		for (short j = i; j >= 0; --j) {
			short l = -1, r = j;
			while (r - l > 1) {
				short mi = l + r >> 1;
				if (((lrot[j] | rrot[mi])&xrot[i]) == xrot[i])r = mi;
				else l = mi;
			}
			ans = min(short(r + r + n - j - j + i + cnt[i]), ans);
		}
	}
	cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: '_getchar_nolock' was not declared in this scope; did you mean 'getchar_unlocked'?
   18 |         char c = _getchar_nolock();
      |                  ^~~~~~~~~~~~~~~
      |                  getchar_unlocked
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable:4996)
#include<iostream>
#include<stdio.h>
#include<bitset>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int N = 2001;
typedef bitset<N> bi;
bi xrot[N], rrot[N], lrot[N];
bi A;
int cnt[N];
char a[N];
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	scanf("%s", a);
	int n = strlen(a);
	char c;
	rep(i, n) {
		scanf("%c", &c);
		if (c == '1') {
			rep(j, n - i) {
				rrot[j].set(i + j);
				lrot[j].set(i + j);
			}
			for (int j = n - i; j < n; j++) {
				rrot[j].set(i + j - n);
				lrot[j].set(i + j - n);
			}
		}
	}
	rep(i, n)if (a[i] == '1')A.set(i);
	if (!rrot[0].any() && A.any()) {
		cout << -1 << endl; return 0;
	}
	rep(i, n) {
		xrot[i] = A^rrot[i];
		cnt[i] = xrot[i].count();
	}

	rep(i, n - 1)rrot[i + 1] |= rrot[i];

	lrot[n] = lrot[0];
	for (int i = n - 1; i >= 0; i--)lrot[i] |= lrot[i + 1];

	int ans = 1e9;

	rep(i, n) {//最後
		for (int j = i; j < n; j++) {
			int l = j, r = n + 1;
			while (r - l > 1) {
				int mi = (r + l) >> 1;
				if (((rrot[j] | lrot[mi])&xrot[i]) == xrot[i])l = mi;
				else r = mi;
			}
			ans = min(ans, j + j + n + n - l - l - i + cnt[i]);
		}
		for (int j = i; j >= 0; j--) {
			int l = -1, r = j;
			while (r - l > 1) {
				int mi = (l + r) >> 1;
				if (((lrot[j] | rrot[mi])&xrot[i]) == xrot[i])r = mi;
				else l = mi;
			}
			ans = min(r + r + n - j - j + i + cnt[i], ans);
		}
	}
	printf("%d\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'strlen' was not declared in this scope
   21 |         int n = strlen(a);
      |                 ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include<algorithm>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: C++

#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const int maxn = 4e3 + 3;
int n, a[maxn], b[maxn], lshft[maxn], rshft[maxn];
int ans = 1<<30;
int gol(int x, int t) {
	int lsh = 0, ans = 0;
	for(int i = 1; i <= n; i++) {
		if(a[i] == b[x+i]) continue; //good
		ans++;
		if(rshft[i]<=x) continue;
		lsh = max(lsh, lshft[i]);
	}
	//cout << x << " " << ans << " " << lsh << '\n';
	int t = abs(t-lsh);
	ans += min(t, n-t);
	return lsh+ans;
}
int gor(int x, int t) {
	int ox = x;
	x = (n-x)%n;
	int lsh = 0, ans = 0;
	for(int i = 1; i <= n; i++) {
		if(a[i] == b[x+i]) continue; //good
		ans++;
		if(lshft[i]<=ox) continue;
		lsh = max(lsh, rshft[i]);
	}
	//cout << x << " " << ans << " " << lsh << "L\n";
	int t = abs(t-lsh);
	ans += min(t, n-t);
	return lsh+ans;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("test.txt", "r", stdin);
	string _a, _b;
	cin >> _a >> _b;
	n = _a.size();
	int acnt = 0, bcnt = 0;
	for(int i = 1; i <= n; i++) a[i] = _a[i-1]-'0', a[i+n] = a[i], acnt += a[i]==1;
	for(int i = 1; i <= n; i++) b[i] = _b[i-1]-'0', b[i+n] = b[i], bcnt += b[i]==1;
	if(acnt&&bcnt==0) return cout << -1, 0;
	if(!bcnt) return cout << 0, 0;
	for(int i = 1; i <= n; i++) {
		int j = i;
		while(!b[j]) j++;
		rshft[i] = j-i;
	}
	for(int i = n+1; i <= n+n; i++) {
		int j = i;
		while(!b[j]) j--;
		lshft[i-n] = i-j;
	}
	for(int i = 0; i <= n; i++) ans = min(ans, i + gol(i%n, i));
	for(int i = 0; i <= n; i++) ans = min(ans, i + gor(i%n, (n-i)%n));
	cout << ans;
}


Compiler output:
a.cc: In function 'int gol(int, int)':
a.cc:21:13: error: declaration of 'int t' shadows a parameter
   21 |         int t = abs(t-lsh);
      |             ^
a.cc:12:20: note: 'int t' previously declared here
   12 | int gol(int x, int t) {
      |                ~~~~^
a.cc: In function 'int gor(int, int)':
a.cc:36:13: error: declaration of 'int t' shadows a parameter
   36 |         int t = abs(t-lsh);
      |             ^
a.cc:25:20: note: 'int t' previously declared here
   25 | int gor(int x, int t) {
      |                ~~~~^
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2003;
ll dp[N];
ll pd[N];
ll a[N];
ll b[N];
int32_t main(){
    string s,t;
    cin >> s >> t;
    ll n=s.size();
    ll t3=0,t4=0;
    for (int i=1;i<=n;i++){
        if (s[i-1]=='1'){
            a[i]=1;
            t3++;
        }
        if (t[i-1]=='1'){
            b[i]=1;
            t4++;
        }
    }
    if (t4==0 && t3>0){
        cout << -1;
        return 0;
    }
    ll p1=0;
    if (b[1]!=1){
        for (int i=n;i>0;i--){
            p1++;
            if (b[i]==1){
                break;
            }
        }
    }
    dp[1]=p1;
    for (int i=2;i<=n;i++){
        if (b[i]==1){
            dp[i]=0;
        }
        else{
            dp[i]=dp[i-1]+1;
        }
      //  cout << i << " km " << dp[i] << endl;
    }
    ///
    p1=0;
    if (b[n]!=1){
        for (int i=1;i<n;i++){
            p1++;
            if (b[i]==1){
                break;
            }
        }
    }
    pd[n]=p1;
    for (int i=n-1;i>0;i--){
        if (b[i]==1){
            pd[i]=0;
        }
        else{
            pd[i]=pd[i+1]+1;
        }
        //cout << i << " rf " << pd[i] << endl;
    }
    ll mi=1e9+100;
    for (int i=0;i<=n;i++){
        ll ans=0;
        for (int j=1;j<=n;j++){
            if (a[j]==0 && b[(j+i-1)%n+1]==1){
                ans++;
            }
        }

        ll ch=0;
        for (int j=1;j<=n;j++){
            if (a[j]==1 && b[z]==0 && pd[j]<=i){
                ans++;
            }
            if (a[j]==1 && b[(j+i-1)%n+1]==0 && pd[j]>i){
                ch=max(ch,dp[j]);
                ans++;
            }

        }
        //cout << i << " " << ans << " " << ch << endl;
        ans+=2*ch+i;
        mi=min(ans,mi);
    }
    //cout << mi << endl;
    for (int i=0;i<=n;i++){
        ll ans=0;
        for (int j=1;j<=n;j++){
            ll z=j-i+n;
            z%=n;
            if (z==0){
                z=n;
            }
            if (a[j]==0 && b[z]==1){
                ans++;
            }
        }

        ll ch=0;
        for (int j=1;j<=n;j++){
            ll z=j-i+n;
            z%=n;
            if (z==0){
                z=n;
            }
            if (a[j]==1 && b[z]==0 && dp[j]<=i){
                ans++;
            }
            if (a[j]==1 && b[z]==0 && dp[j]>i){
                ch=max(ch,pd[j]);
                if (i==1 )
                ans++;
            }

        }
        //cout << i << " " << ans << " " << ch << endl;
        ans+=2*ch+i;
        mi=min(ans,mi);
    }
    cout << mi;

}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:88:30: error: 'z' was not declared in this scope
   88 |             if (a[j]==1 && b[z]==0 && pd[j]<=i){
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
 
  string p,q;
  cin>>p>>q;
   int s=2*p.length();
   
  int sa[s+s/2];
  int sb[s+s/2];
  rep(i, s){
    if(i<s/2){
    sa[i+s/2]=p[i]-'0';}
    else{
      sb[i]=q[i-s/2]-'0';}
  }
  


  int suma=0;
  int sumb=0;
  for(int i=s/2;i<s;i++){
    if(sa[i]==1){
      suma++;}
    if(sb[i]==1){
      sumb++;}
  }
  
  if(sumb==0 && suma!=0){
    cout<<-1<<endl;
    return 0;}
  if(suma==0 && sumb==0){
    cout<<0<<endl;
    return 0;}
  
    
  
  for(int i=s; i<=s+s/2-1;i++){
    sa[i]=sa[i-s/2];
    sb[i]=sb[i-s/2];
  }
  for(int i=0;i<s/2;i++){
    sa[i]=sa[i+s/2];
    sb[i]=sb[i+s/2];
  }
  
  vector<int> vec;
 for(int i=s/2;i<s;i++){
   if(sb[i]==1){
     vec.push_back(i-s/2);}
 }

  
  
  int ssa[s/2];
  int disl[s/2];
  int disr[s/2];
  int ans=INF;
  
  int a=0;

  
    rep(i, s/2){
      if(i<vec[0]){
        disl[i]=s/2+i-vec[sumb-1];}
      
     if(i>vec[sumb-1]){
       disr[i]=s/2+vec[0]-i;}

        if(vec[a]==i){
          disl[i]=0;
          disr[i]=0;
          a++;}
         else{
           if(a!=0){
        disl[i]=i-vec[a-1];}
           if(a!=sumb){
        disr[i]=vec[a]-i;}
      }
      
      
 
      
    }

    
  for(int k=0;k<s/2;k++){
    
    for(int j=0;j<s/2;j++){
      if(k+j<s/2){
        ssa[k+j]=sa[j];}
        else{
         ssa[k+j-s/2]=sa[j];}
    }


    int val[s/2];
    rep(i, s/2){
      val[i]=0;
    }
    rep(i, s/2){
      if(ssa[i]!=sb[i]){
      val[disl[i]]=max(disr[i],val[disl[i]]);
      }
    }
  

    for(int j=s/2-2;j>=0;j--){
      val[j]=max(j+val[j],j+1+val[j+1]);
                 }
     
  
    int vans=INF;
  
   rep(i, s/2){
     if(k<=s/4){
       if(ssa[i]!=sb[i]){
     vans=min(vans,2*val[i]+max(s/2-k-val[i],0));
       }
     }
     else{
       if(ssa[i]!=sb[i]){
       vans=min(vans,2*val[i]+max(k-i, 0));
   }
     }
   }
                 vans+=abs(suma-sumb);
                 ans=min(vans, ans);
 cout<<ans<<endl;
                 }
cout<<ans<<endl;
                 return 0;
  atosukosi;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:140:3: error: 'atosukosi' was not declared in this scope
  140 |   atosukosi;
      |   ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
  vector <int> vec;
 
  for(int i=0;i<=4500;i++){
    int p;
    cin>>p;
    if(p!=0 && p!=1){
      break;}
    vec.push_back(p);
  }
  
  int s=vec.size();
  
  int sa[s+s/2];
  int sb[s+s/2];
  rep(i, s){
    if(i<s/2){
    sa[i+s/2]=vec[i];}
    else{
      sb[i]=vec[i];}
  }
  
  int suma=0;
  int sumb=0;
  for(int i=s/2;i<s;i++){
    if(sa[i]==1){
      suma++;}
    if(sb[i]==0){
      sumb++;}
  }
  
  if(sumb==0&&suma!=0){
    cout<<-1<<endl;
    return 0;}
  if(suma==0 && sumb==0){
    cout<<0<<endl;
    return 0;}
  
  for(int i=s; i<=s+s/2-1;i++){
    sa[i]=sa[i-s/2];
    sb[i]=sb[i-s/2];
  }
  for(int i=0;i<s/2;i++){
    sa[i]=sa[i+s/2];
    sb[i]=sb[i+s/2];
  }
  
  vector <int> vec;
 for(int i=s/2;i<s;i++){
   if(sb[i]==1){
     vec.push_back(i-s/2);}
 }
  
  
  int ssa[s/2];
  int disl[s/2];
  int disr[s/2];
  int ans=INF;
    
  for(int k=0;k<s/2;k++){
    
    for(int j=0;j<s/2;j++){
      if(k+j<s/2){
        ssa[k+j]=sa[j];}
        else{
         ssa[k+j-s/2]=sa[j];}
    }
      int a=0;
    int lefmin,rigmin=0;
    
    rep(i, s/2){
      if(i<vec[0]){
        int q=i;
        disl[i]=s/2+q-vec[sumb-1];}
      
     if(i>vec[sumb-1]){
       int q=i;
       disr[i]=s/2+vec[0]-q;}

      if(a<sumb){
        if(i==vec[a]){
          disl[i]=0;
          disr[i]=0;
          a++;}
         else{
        int q=i;
        disl[i]=q-disl[a-1];
        disr[i]=disr[a]-q;
      }
      }
      
      else{
        int q=i;
        disl[i]=q-disl[a-1];}
      
    }
     
    rep(i, s/2){
      
    
   wakarimasen;
    
        

}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:16: error: redeclaration of 'std::vector<int> vec'
   57 |   vector <int> vec;
      |                ^~~
a.cc:11:16: note: 'std::vector<int> vec' previously declared here
   11 |   vector <int> vec;
      |                ^~~
a.cc:110:4: error: 'wakarimasen' was not declared in this scope
  110 |    wakarimasen;
      |    ^~~~~~~~~~~
a.cc:114:2: error: expected '}' at end of input
  114 | }
      |  ^
a.cc:69:25: note: to match this '{'
   69 |   for(int k=0;k<s/2;k++){
      |                         ^
a.cc:114:2: error: expected '}' at end of input
  114 | }
      |  ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
template <class T> void read(T &x){ x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); x *= f; }

const int MAXN = 110000;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
char s[MAXN], t[MAXN], h[MAXN];
int p1[MAXN], p2[MAXN], v[MAXN];
int n;

struct Node{ int a, b;
	bool operator < (const Node &t) const { return a < t.a; }
}p[MAXN];

int Calc(int r, int a, int b){
//	printf("r:%d a:%d b:%d\n", r, a, b);
	int rnt = min(r, n - r) + n;
	if(b <= r) rnt = min(rnt, r + 2 * a);
	else rnt = min(rnt, 2 * (a + b) - r);
	r = n - r;
	if(a <= r) rnt = min(rnt, r + 2 * b);
	else rnt = min(rnt, 2 * (a + b) - r);
	return rnt;
}

int Solve(int rot){
	memset(p1, 0, sizeof(p1));
	memset(p2, 0, sizeof(p2));
	memset(v, 0, sizeof(v));
	
	for(int i = 0; i < n; ++ i) t[i] = h[(i + rot) % n];
	
	int cnt = 0, L, R;
	for(int i = 0; i < n; ++ i) cnt += (s[i] == '1' && t[i] == '0');
	
	for(int i = n - 1; i >= 0; -- i) if(s[i] == '1') L = i;
	for(int i = 0; i < n; ++ i) if(s[i] == '1') R = i;
	p1[0] = R - n, p2[n - 1] = n + L;
	if(s[0] == '1') p1[0] = 0;
	if(s[n - 1] == '1') p2[n - 1] = n - 1;
	for(int i = 1; i < n; ++ i) 
		p1[i] = s[i] == '1' ? i : p1[i - 1];
	for(int i = n - 2; i >= 0; -- i) 
		p2[i] = s[i] == '1' ? i : p2[i + 1];
	
	int q = 0;
	for(int i = 0; i < n; ++ i)
		if(t[i] == '1' && s[i] == '0'){
			p[++ q].a = i - p1[i],
			p[q].b = p2[i] - i;
		}
	sort(p + 1, p + q + 1);
	for(int i = q; i >= 1; -- i) v[i] = max(v[i + 1], p[i].b);
	
	int rnt = INF;
	for(int i = 0; i <= q; ++ i){
		int a = p[i].a, b = v[i + 1];
		rnt = min(rnt, Calc(rot, a, b));
	}
	return rnt + cnt + q;
}

int main(){
	scanf("%s%s", &h, &s);
	n = strlen(s);
	
	if(Check(h) == 0 && Check(s) == 0) return puts("0"), 0;
	else if(Check(s) == 0) return puts("-1"), 0;
	
	int ans = INF;
	for(int i = 0; i < n; ++ i) ans = min(ans, Solve(i));
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:12: error: 'Check' was not declared in this scope
   68 |         if(Check(h) == 0 && Check(s) == 0) return puts("0"), 0;
      |            ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
template <class T> void read(T &x){ x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); x *= f; }

const int MAXN = 110000;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
char s[MAXN], t[MAXN], h[MAXN];
int p1[MAXN], p2[MAXN], v[MAXN];
int n;

struct Node{ int a, b;
	bool operator < (const Node &t) const { return a < t.a; }
}p[MAXN];

int Calc(int r, int a, int b){
//	printf("r:%d a:%d b:%d\n", r, a, b);
	int rnt = min(r, n - r) + n;
	if(b <= r) rnt = min(rnt, r + 2 * a);
	else rnt = min(rnt, 2 * (a + b) - r);
	r = n - r;
	if(a <= r) rnt = min(rnt, r + 2 * b);
	else rnt = min(rnt, 2 * (a + b) - r);
	return rnt;
}

int Solve(int rot){
	memset(p1, 0, sizeof(p1));
	memset(p2, 0, sizeof(p2));
	memset(v, 0, sizeof(v));
	
	for(int i = 0; i < n; ++ i) t[i] = h[(i + rot) % n];
	
	int cnt = 0, L, R;
	for(int i = 0; i < n; ++ i) cnt += (s[i] == '1' && t[i] == '0');
	
	for(int i = n - 1; i >= 0; -- i) if(s[i] == '1') L = i;
	for(int i = 0; i < n; ++ i) if(s[i] == '1') R = i;
	p1[0] = R - n, p2[n - 1] = n + L;
	if(s[0] == '1') p1[0] = 0;
	if(s[n - 1] == '1') p2[n - 1] = n - 1;
	for(int i = 1; i < n; ++ i) 
		p1[i] = s[i] == '1' ? i : p1[i - 1];
	for(int i = n - 2; i >= 0; -- i) 
		p2[i] = s[i] == '1' ? i : p2[i + 1];
	
	int q = 0;
	for(int i = 0; i < n; ++ i)
		if(t[i] == '1' && s[i] == '0'){
			p[++ q].a = i - p1[i],
			p[q].b = p2[i] - i;
		}
	sort(p + 1, p + q + 1);
	for(int i = q; i >= 1; -- i) v[i] = max(v[i + 1], p[i].b);
	
	int rnt = INF;
	for(int i = 0; i <= q; ++ i){
		int a = p[i].a, b = v[i + 1];
		rnt = min(rnt, Calc(rot, a, b));
	}
	return rnt + cnt + q;
}

int main(){
	scanf("%s%s", &h, &s);
	n = strlen(s);
	
	bool flg = false;
	for(int i = 0; i < n; ++ i) if(s[i] == '1') flg = true;
	if(!flg){ return puts("-1"), 0; }
	
	for(int i = 1;
	int ans = INF;
	for(int i = 0; i < n; ++ i) ans = min(ans, Solve(i));
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:9: error: expected primary-expression before 'for'
   74 |         for(int i = 0; i < n; ++ i) ans = min(ans, Solve(i));
      |         ^~~
a.cc:73:23: error: expected ')' before 'for'
   73 |         int ans = INF;
      |                       ^
      |                       )
   74 |         for(int i = 0; i < n; ++ i) ans = min(ans, Solve(i));
      |         ~~~            
a.cc:72:12: note: to match this '('
   72 |         for(int i = 1;
      |            ^
a.cc:75:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   75 |         printf("%lld\n", ans);
      |                          ^~~
      |                          abs
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int n;
char a[2010],b[2010];
int l[2010],r[2010];
int ans=1e9;
int main()
{
	scanf("%s%s",a,b);
	n=strlen(a);
	int s1=0,s2=0;
	for(int i=0;i<n;i++)s1+=a[i]-'0',s2+=b[i]-'0';
	if(!s2)
	{
		if(s1)printf("-1");
		else printf("0");
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		int p=i;
		while(b[p]!='1')
		{
			l[i]++;
			p=(p+n-1)%n; 
		}
		p=i;
		while(b[p]!='1')
		{
			r[i]++;
			p=(p+1)%n;
		}
	}
	for(int i=0;i<n;i++)
	{
		vector<pair<int,int> >tot;
		for(int j=0;j<n;j++)
		{
			if(a[j]!=b[(i+j)%n])tot.push_back(make_pair(l[j],r[j]));
		}
		sort(tot.begin(),tot.end());
		int mx=0;
		int res=(int)tot.size();
		int k=(int)tot.size()-1;
		for(int j=n-1;j>=0;j--)
		{
			while(k>=0 && tot[k].first>j)
			{
				mx=max(mx,tot[k].second);
				k--;
			}
			ans=min(ans,res+j+j+(i>=mx?i:i+n));
			ans=min(ans,res+mx+mx+(n-i>=j?n-i:n-i+n));
		}
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: 'vector' was not declared in this scope
   40 |                 vector<pair<int,int> >tot;
      |                 ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include<algorithm>
  +++ |+#include <vector>
    6 | using namespace std;
a.cc:40:38: error: expected primary-expression before '>' token
   40 |                 vector<pair<int,int> >tot;
      |                                      ^
a.cc:40:39: error: 'tot' was not declared in this scope
   40 |                 vector<pair<int,int> >tot;
      |                                       ^~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 2010
#define INF 0x3FFFFFFF
using namespace std;
char s[MAXN*3],s1[MAXN];
int pre[MAXN*3],nl[MAXN*3],nr[MAXN*3],ans=INF,len;
vector<pair<int,int> > add;
void prepare(){
	nl[0]=-INF;
	for(int i=1;i<=len*3;i++){
		nl[i]=nl[i-1];
		if(s[i]=='1')
			nl[i]=i;
	}
	nr[len*3+1]=INF;
	for(int i=len*3;i>=1;i--){
		nr[i]=nr[i+1];
		if(s[i]=='1')
			nr[i]=i;
	}
	for(int i=1;i<=len*3;i++)
		pre[i]=pre[i-1]+s[i]-'0';
}
int findl(int x){
	return min(INF,x-nl[x]);
}
int findr(int x){
	return min(INF,nr[x]-x);	
}
int main(){
	SF("%s",s1+1);
	SF("%s",s+1);
	len=strlen(s+1);
	for(int i=len+1;i<=len*3;i++)
		s[i]=s[(i-1)%len+1];
	prepare();
	for(int i=1;i<=2*len+1;i++){
		add.clear();
		int sum=0;
		for(int j=1;j<=len;j++){
			if(s1[j]!=s[i]){
				sum++;
				int r=j+len;
				int l=j+i-1;
				if(l>r)
					swap(l,r);
				if(pre[r]-pre[l-1]==0)
					add.push_back(make_pair(findl(l),findr(r)));
			}
		}
		sort(add.begin(),add.end());
		int adds=0,maxv=0;
		if(add.size()!=0)
			adds=INF;
		for(int i=int(add.size()-1);i>=0;i--){
			if(add[i].first!=INF&&maxv!=INF)
				adds=min(adds,maxv+add[i].first);
			maxv=max(maxv,add[i].second);
			if(maxv==INF)
				break;
		}
		//PF("{%d %d %d}\n",len+1-i,adds,ans);
		if(adds!=INF)
			ans=min(ans,adds+abs(len+1-i)+sum);
	}
	if(ans==INF)
		ans=-1;
	PF("%d",ans);
}

Compiler output:
a.cc:12:1: error: 'vector' does not name a type
   12 | vector<pair<int,int> > add;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:43:17: error: 'add' was not declared in this scope; did you mean 'fadd'?
   43 |                 add.clear();
      |                 ^~~
      |                 fadd
Language: C++

#include <bits/stdc++.h>

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define ld long double
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 2e3 + 10;
const int M = (int) 2018 * 2018;
const int K = (int) 500 + 10;
const int INF = (int) 1e9 + 7;
const int mod = (int) 998244353;
const ld EPS = (ld) 1e-9;
const ll LINF = (ll) 1e18;

int n;
int fixed_a[N], a[N], b[N];
bitset<2 * N> fixed_a, b;
bool needs[N];

int get(int x, int y) {
	for (int i = 0; i < n; i++) {
		a[i] = fixed_a[i];
	}
	int rl = x + y, lr = x + y;
	for (int i = 0; i < n; i++) {
		int new_i = (i + x - y + n) % n;
		if (a[i] != b[new_i]) {
			needs[i] = 1;
		} else {
			needs[i] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if (!needs[i])
			continue;
		bool can = 0;
		for (int j = 0; j <= x; j++) {
			if (b[(i + j) % n] == 1) {
				can = 1;
			}
		}
		for (int j = 0; j <= y; j++) {
			if (b[(i + x - j + n) % n] == 1) {
				can = 1;
			}	
		}	
		if (!can) {
			rl = INF;
			break;
		}
		rl++;
	}
	for (int i = 0; i < n; i++) {
		if (!needs[i])
			continue;
		bool can = 0;
		for (int j = 0; j <= y; j++) {
			if (b[(i - j + n) % n] == 1) {
				can = 1;
			}	
		}	
		for (int j = 0; j <= x; j++) {
			if (b[(i - y + j + n) % n] == 1) {
				can = 1;
			}
		}
		if (!can) {
			lr = INF;
			break;
		}
		lr++;
	}
	return min(lr, rl);
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	srand(time(0));
	string s, t;
	cin >> s >> t;
	n = sz(s);
	for (int i = 0; i < n; i++) {
		fixed_a[i] = s[i] - '0';
	}
	for (int i = 0; i < n; i++) {
		b[i] = t[i] - '0';
	}
	int ans = INF;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (i + j >= ans) continue;
			ans = min(ans, get(i, j));
		}
	}
	if (ans == INF)
		ans = -1;
	cout << ans;
	return 0;
}

Compiler output:
a.cc:26:15: error: conflicting declaration 'std::bitset<4020> fixed_a'
   26 | bitset<2 * N> fixed_a, b;
      |               ^~~~~~~
a.cc:25:5: note: previous declaration as 'int fixed_a [2010]'
   25 | int fixed_a[N], a[N], b[N];
      |     ^~~~~~~
a.cc:26:24: error: conflicting declaration 'std::bitset<4020> b'
   26 | bitset<2 * N> fixed_a, b;
      |                        ^
a.cc:25:23: note: previous declaration as 'int b [2010]'
   25 | int fixed_a[N], a[N], b[N];
      |                       ^
Language: C++

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

int n;
int a[2000];
int b[2000];

int calc(int x){
  int res=0;
  for(int i=0;i<n;i++)
    if(a[i]!=b[(i+x)%n])
      res++;
  return res;
}

int findA(set<int> &X,int i){
  set<int> :: iterator it;
  it = X.lower_bound(i);
  
  if(it==X.end()){
    return n-i+*X.begin();
  }else{
    return *it - i;
  }
}

int findB(set<int> &X,int i){
  set<int> :: iterator it;
  it = X.lower_bound(i);
  
  if(it==X.begin()){
    it=X.end();
    it--;
    return *it - i;
  }else{
    it--;
    return i-*it;
  }
}

int main(){
  
  string s;
  cin>>s;
  n=s.size();
  for(int i=0;i<n;i++)a[i]=s[i]-'0';
  cin>>s;
  for(int i=0;i<n;i++)b[i]=s[i]-'0';

  set<int> X;
  for(int i=0;i<n;i++)if(b[i])X.insert(i);
  
  if(U.empty()){
    int ans=n;
    for(int i=0;i<n;i++)
      if(calc(i)==0)
        ans=min(ans, min(i,n-1-i) );
    if(ans==n)ans=-1;
    cout<<ans<<endl;
    return 0;
  }
  
  int ans=1e9;
  for(int tc=0;tc<2;tc++){
    reverse(a,a+n);
    reverse(b,b+n);
    
    X.clear();
    set<int> U;
    for(int i=0;i<n;i++)if(b[i])X.insert(i);
    for(int i=0;i<n;i++)if(b[i])U.insert(i);
    
    for(int i=0;i<=n;i++){
      int cost = i + calc(i);
      int A=0;
      int B=0;

      for(int j=0;j<n;j++){
        if(b[j]==a[(j-i+n)%n])continue;
        if(X.count(j))continue;
        
        int ap = findA(X,j);
        int bp = findB(U,j);
        A=max(A,ap);
        B=max(B,bp);
      }
      ans=min(ans,cost+A*2);
      ans=min(ans,cost+B*2);
      
      set<int> nx;
      for(int f:X){
        nx.insert(f);
        nx.insert((f+1)%n);
      }
      X=nx;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:6: error: 'U' was not declared in this scope
   53 |   if(U.empty()){
      |      ^
Language: C++

// ConsoleApplication5.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"



#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
using namespace std;


vector<int> lmemo(2001, -1);
vector<int> rmemo(2001, -1);
vector<vector<int>> IsOneInmemo(2001, vector<int>(2001, -1));



template <typename T>
void Write(vector<T> &A);
int Res(int d, vector<bool> A, vector<bool> B);
int Res(int i, int d, vector<bool> A, vector<bool> B);
int l(int i);
int r(int i);
bool IsOneIn(int i, int d, vector<bool> B);

vector<bool> A, B;
int main() {
	string str;

	cin >> str;
	for (int i = 0; i < str.length(); i++) {
		A.push_back(str[i] - '0');
	}
	cin >> str;
	for (int i = 0; i < str.length(); i++) {
		B.push_back(str[i] - '0');
	}
	bool fl=false;
	for (auto v : B) {
		fl |= v;
	}
	if (!fl)cout << -1;
	else {
		int res = 1e9;
		for (int d = 0; d < A.size(); d++) {

			int cnt = 0;
			for (int k = 0; k < B.size(); k++)cnt += B[k] ^ A[(k + d) % B.size()];

			res = min(res, Res(d, A, B) + cnt);
		}
		reverse(A.begin(), A.end());
		reverse(B.begin(), B.end());
		for (auto x : lmemo)x = -1;
		for (auto x : rmemo)x = -1;
		for (auto x : IsOneInmemo)for (auto y : x)y = -1;
		for (int d = 0; d < A.size(); d++) {

			int cnt = 0;
			for (int k = 0; k < B.size(); k++)cnt += B[k] ^ A[(k + d) % B.size()];

			res = min(res, Res(d, A, B) + cnt);
		}
		cout << res << endl;
	}
}

template <typename T>
void Write(vector<T> &A) {
	for (auto v : A) {
		cout << v;
	}
	cout << endl;
}
int Res(int d, vector<bool> A, vector<bool> B) {
	int res = 0;
	for (int i = 0; i < A.size(); i++) {
		res = max(res, Res(i, d, A, B));
	}
	return res;
}
int Res(int i, int d, vector<bool> A, vector<bool> B) {

	if (!IsOneIn(i, d, B) || !A[i]) {
		return min(2 * l(i) + d, 2 * r(i) - d);
	}
	else {
		return d;
	}
}
int l(int i) {
	if (lmemo[i] != -1)return lmemo[i];
	else
	{
		int res = 0;
		while (B[(i - res + B.size()) % B.size()] == 0) {
			res++;
		}
		lmemo[i] = res;
		return res;
	}
}

int r(int i) {
	if (rmemo[i] != -1)return rmemo[i];
	else
	{
		int res = 0;
		while (B[(i + res) % B.size()] == 0) {
			res++;
		}
		rmemo[i] = res;
		return res;
	}
}
bool IsOneIn(int i, int d, vector<bool> B) {
	if (IsOneInmemo[i][d] != -1) return IsOneInmemo[i][d];
	else {
		bool flag = 0;
		for (int k = 0; k <= d; k++) {
			int num = (i + k) % B.size();
			flag |= B[num];
		}
	}
}
//bool IsOneIn(int i, int d, deque<bool> B) {
//	if (IsOneInmemo[i][d] != -1) return IsOneInmemo[i][d];
//	else {
//		bool flag = 0;
//		for (auto it = B.begin() + i; it != B.begin() +i+ d + 1; it++) {
//			flag |= *it == 0;
//		}
//		IsOneInmemo[i][d] = flag;
//		return flag;
//	}
//}



Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
using namespace std;


vector<int> lmemo(2001, -1);
vector<int> rmemo(2001, -1);
vector<vector<int>> IsOneInmemo(2001, vector<int>(2001, -1));


void L(vector<bool> &A);
void R(vector<bool> &A);
void T(vector<bool> &A, int n);
template <typename T>
void Write(vector<T> &A);
int Res(int d, vector<bool> A, vector<bool> B);
int Res(int i, int d, vector<bool> A, vector<bool> B);
int l(int i, vector<bool> B);
int r(int i, vector<bool> B);
bool IsOneIn(int i, int d, vector<bool> B);


int main() {
	string str;
	vector<bool> A, B;
	cin >> str;
	for (int i = 0; i < str.length(); i++) {
		A.push_back(str[i] - '0');
	}
	cin >> str;
	for (int i = 0; i < str.length(); i++) {
		B.push_back(str[i] - '0');
	}
	bool fl=false;
	for (auto v : B) {
		fl |= v;
	}
	if (!fl)cout << -1;
	else {
		int res = 1e9;
		for (int d = 0; d < A.size(); d++) {

			int cnt = 0;
			for (int k = 0; k < B.size(); k++)cnt += B[k] ^ A[(k + d) % B.size()];

			res = min(res, Res(d, A, B) + cnt);
		}
		reverse(A.begin(), A.end());
		reverse(B.begin(), B.end());
		for (auto x : lmemo)x = -1;
		for (auto x : rmemo)x = -1;
		for (auto x : IsOneInmemo)for (auto y : x)y = -1;
		for (int d = 0; d < A.size(); d++) {

			int cnt = 0;
			for (int k = 0; k < B.size(); k++)cnt += B[k] ^ A[(k + d) % B.size()];

			res = min(res, Res(d, A, B) + cnt);
		}
		cout << res << endl;
	}
}

template <typename T>
void Write(vector<T> &A) {
	for (auto v : A) {
		cout << v;
	}
	cout << endl;
}
int Res(int d, vector<bool> A, vector<bool> B) {
	int res = 0;
	for (int i = 0; i < A.size(); i++) {
		res = max(res, Res(i, d, A, B));
	}
	return res;
}
int Res(int i, int d, vector<bool> A, vector<bool> B) {

	if (!IsOneIn(i, d, B) || !A[i]) {
		return min(2 * l(i, B) + d, 2 * r(i, B) - d);
	}
	else {
		return d;
	}
}
int l(int i, vector<bool> B) {
	if (lmemo[i] != -1)return lmemo[i];
	else
	{
		int res = 0;
		while (B[(i - res + B.size()) % B.size()] == 0) {
			res++;
		}
		lmemo[i] = res;
		return res;
	}
}

int r(int i, vector<bool> B) {
	if (rmemo[i] != -1)return rmemo[i];
	else
	{
		int res = 0;
		while (B[(i + res) % B.size()] == 0) {
			res++;
		}
		rmemo[i] = res;
		return res;
	}
}
bool IsOneIn(int i, int d, vector<bool> B) {
	if (IsOneInmemo[i][d] != -1) return IsOneInmemo[i][d];
	else {
		bool flag = 0;
		for (int k = 0; k <= d; k++) {
			int num = (i + k) % B.size();
			flag |= B[num];
		}
	}
}

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

#include<algorithm> 
#include<bitset> 
#include<memory.h> 
#include<cstdio> 
#include<cmath>
#include<cstring> 
#define maxn 40010
#define ll long long
#define pa pair<ll,ll> 
#define ld long double 
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
using namespace std; 
inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; } 
inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  } 
inline void writeln(ll x){ write(x);   puts("");   }
ll answ=1e9,sum[maxn],n,las;	bool vis[maxn];
char s1[maxn],s2[maxn];
inline ll QQQ(ll x,ll y){
	x=(x+n)%n;
	y%=n;
	if (!x)	x+=n;
	if (!y)	y+=n;
	if (x>y)	return sum[n]-sum[x+1]+sum[y];
	return sum[y]-sum[x-1];
}
inline bool pd1(ll l,ll r){
	For(i,1,n)	if (vis[i]&&!QQQ(i-l,i+r))	return 0;
	return 1;
}
inline bool pd2(ll l,ll r){
	For(i,1,n)	if (vis[i]&&!QQQ(i-l,i+r))	return 0;
}
int main(){
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	n=strlen(s1+1);
	bool flag=0,fl2=0;
	For(i,1,n)	flag|=s2[i]=='1',fl2|=s1[i]=='1';
	if (!flag&&fl2)	return puts("-1"),0;
	For(i,1,n)	sum[i]=sum[i-1]+s2[i]=='1';
	For(i,1,n){
		answ[i]=las;
		if (s2[i]=='1')	las=i;
	}
	For(i,1,n){
		answ[i]=las;
		if (s2[i]=='1')	las=i;
	}
	For(i,0,n-1){
		ll ned=0,ans=n,l=0,r=n-1;
		For(j,1,n)	if (s2[j]!=s1[(j+i-1)%n+1])	ned++,vis[(j+i-1)%n+1]=1;	else	vis[(j+i-1)%n+1]=0;
		while(l<=r){
			ll mid=(l+r)>>1;
			if (pd1(mid,i))	r=mid-1,ans=mid;
			else	l=mid+1;
		}
		answ=min(answ,ned+2*i+ans);
	}
	For(i,0,n-1){
		ll ned=0,ans=0,l=0,r=n-1;
		For(j,1,n)	if (s2[j]!=s1[(j-i+n+n-1)%n+1])	ned++,vis[(j-i+n+n-1)%n+1]=1;	else	vis[(j-i+n+n-1)%n+1]=0;
		while(l<=r){
			ll mid=(l+r)>>1;
			if (pd2(mid,i))	r=mid-1,ans=mid;
			else	l=mid+1;
		}
		answ=min(answ,ned+2*i+ans);
	}
	writeln(answ);
}
//0000000
//0000000

Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: invalid types 'long long int[long long int]' for array subscript
   43 |                 answ[i]=las;
      |                     ^
a.cc:47:21: error: invalid types 'long long int[long long int]' for array subscript
   47 |                 answ[i]=las;
      |                     ^
a.cc: In function 'bool pd2(long long int, long long int)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
Language: C++

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

int dist(int a, int n){
	return min((a+n+n)%n,(n+n+n-a)%n);
}
int main(){
	string a, b;
	cin >> a >> b;
	int n = a.size();
	int ok = 0;
	int oka = 1;
	for(int i = 0; i < n; i++){
		if(b[i] == '1') ok = 1;
		if(a[i] != b[i]) oka = 0;
	}

	if(!ok){
		if(oka){
			cout << 0 << endl;
			return 0;
		}
		cout << -1 << endl;
		return 0;
	}
	for(int i = 0; i < 101000101010; i++){
		int d = i*i;
		ok = d;
	}
	return 0;
	map<int,int> vis;
	int nvis = 0;
	for(int i = 0; i < n; i++){
		vis[i] = 0;
		if(a[i] == '0'){
			vis[i] = 1000000;
			nvis++;
		}
	}
	int e = 0;
	int ans = 1000000;
	vector<int> oks, oke;
	for(int s = 0; s < n; s++){
		// using [s,e) ok
		while(nvis < n || e <= s){
			for(int i = 0; i < n; i++){
				nvis -= (vis[(i+e)%n] > 0);
				vis[(i+e)%n] += (b[i] == '1');
				nvis += (vis[(i+e)%n] > 0);
			}
			e++;
		}
		for(int e2 = e; e2 <= s + n + 2; e2++){
			oks.push_back(s);
			oke.push_back(e2-1);
		}
		//cout << s << " " << e << " " << p << endl;
		for(int i = 0; i < n; i++){
			nvis -= (vis[(i+s)%n] > 0);
			vis[(i+s)%n] -= (b[i] == '1');
			nvis += (vis[(i+s)%n] > 0);
		}
	}
	int diff[n];
	for(int s = 0; s < n; s++){
		diff[s] = 0;
		for(int i = 0; i < n; i++){
			if(a[(i+s) % n] != b[i]) diff[s]++;
		}
	}

	for(int c = 0; c < oks.size(); c++){
		int zs = oks[c];
		int ze = oke[c];
		//cout << s << " " << ze << endl;
		for(int z2 = 0; z2 < n; z2++){
			int p = dist(ze%n,n) + (ze-zs) + dist(zs-z2,n) + diff[z2%n];
			int q = dist(zs%n,n) + (ze-zs) + dist(ze-z2,n) diff[z2%n];
			ans = min(ans, min(p,q));
		}

	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:72: error: expected ',' or ';' before 'diff'
   79 |                         int q = dist(zs%n,n) + (ze-zs) + dist(ze-z2,n) diff[z2%n];
      |                                                                        ^~~~
Language: C++

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

int dist(int a, int n){
	return min((a+n+n)%n,(n+n+n-a)%n);
}
int main(){
	string a, b;
	cin >> a >> b;
	int n = a.size();
	int ok = 0;
	int oka = 1;
	for(int i = 0; i < n; i++){
		if(b[i] == '1') ok = 1;
		if(a[i] != b[i]) oka = 0;
	}

	if(!ok){
		if(oka){
			cout << 0 << endl;
			return 0;
		}
		cout << -1 << endl;
		return 0;
	}
	for(int i = 0; i < 101000101010; i++){
		int d = i*i;
		ok = d;
	}
	return 0;
	map<int,int> vis;
	int nvis = 0;
	for(int i = 0; i < n; i++){
		vis[i] = 0;
		if(a[i] == '0'){
			vis[i] = 1000000;
			nvis++;
		}
	}
	int e = 0;
	int ans = 1000000;
	vector<int> oks, oke;
	for(int s = 0; s < n; s++){
		// using [s,e) ok
		while(nvis < n || e <= s){
			for(int i = 0; i < n; i++){
				nvis -= (vis[(i+e)%n] > 0);
				vis[(i+e)%n] += (b[i] == '1');
				nvis += (vis[(i+e)%n] > 0);
			}
			e++;
		}
		for(int e2 = e; e2 <= s + n + 2; e2++){
			oks.push_back(s);
			oke.push_back(e2-1);
		}
		//cout << s << " " << e << " " << p << endl;
		for(int i = 0; i < n; i++){
			nvis -= (vis[(i+s)%n] > 0);
			vis[(i+s)%n] -= (b[i] == '1');
			nvis += (vis[(i+s)%n] > 0);
		}
	}
	int diff[n];
	for(int s = 0; s < n; s++){
		diff[s] = 0;
		for(int i = 0; i < n; i++){
			if(a[(i+s) % n] != b[i]) diff[s]++;
		}
	}

	for(int c = 0; c < oks.size(); c++){
		int zs = oks[c];
		int ze = oke[c];
		//cout << s << " " << ze << endl;
		for(int z2 = 0; z2 < n; z2++){
			int p = dist(ze%n,n) + (ze-zs) + dist(zs-z2,n) + diff[z2%n];
			int q = dist(zs%n,n) + (ze-zs) + dist(ze-z2,n) diff[z2%n];
		}
		ans = min(ans, min(p,q));

	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:72: error: expected ',' or ';' before 'diff'
   79 |                         int q = dist(zs%n,n) + (ze-zs) + dist(ze-z2,n) diff[z2%n];
      |                                                                        ^~~~
a.cc:81:36: error: 'p' was not declared in this scope
   81 |                 ans = min(ans, min(p,q));
      |                                    ^
a.cc:81:38: error: 'q' was not declared in this scope
   81 |                 ans = min(ans, min(p,q));
      |                                      ^