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

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

#define ll long long
#define ar array

const int mxH=10, mxW=1e3;
int h, w, k, ans=1e9;
string g[mxH];
vector<int> v[mxW];

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

	cin >> h >> w >> k;
	for(int i=0; i<h; ++i)
		cin >> g[i];
	for(int i=0; i<1<<h-1; ++i) {
		int ca=__builtin_popcount(i);
		for(int j=0; j<w; ++j) {
			int s=0;
			for(int k=0; k<h; ++k) {
				s+=g[k][j]&1;
				if(i>>k&1) {
					v[j].push_back(s);
					s=0;
				}
			}
			v[j].push_back(s);
			for(int vi : v[j])
				if(vi>k)
                {
                  ca=1e9;
                  goto e;
                }
		}
		vector<int> u(v[0].size());
		for(int j=0; j<w; ++j) {
			bool split=0;
			for(int l=0; l<u.size(); ++l)
				split|=u[l]+v[j][l]>k;
			if(split) {
				++ca;
				u=vector<int>(u.size());
			}
			for(int l=0; l<u.size(); ++l)
				u[l]+=v[j][l];
			v[j].clear();
		}
		//cout << i << " " << ca << endl;
     	 e:
		ans=min(ca, ans);
	}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:10: error: jump to label 'e'
   52 |          e:
      |          ^
a.cc:35:24: note:   from here
   35 |                   goto e;
      |                        ^
a.cc:38:29: note:   crosses initialization of 'std::vector<int> u'
   38 |                 vector<int> u(v[0].size());
      |                             ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int h,w,k; cin >> h >> w >> k;
    vector<string> cho(h);
    rep(i,h) cin >> cho[i];
    int tans=INF; 

    rep(i,1<<(h-1)){
        vector<int> now(h,0);
        vector<int> group(h,-1);
        int g=0;
        rep(j,h){
            group[j]=g;
            if(i>>j&1) g++;
        }
        g++;
        int ans=g-1;
        int check=-1;
        int p=0;
        while(p<w){
            check++;
            int c=0;
            rep(j,g){
                while(group[c]==j && c<h){
                    if(cho[c][p]=='1') now[j]++;
                    c++;
                }
            }
            bool wr=true; bool nest=true;
            rep(j,g){
            if(now[j]>k){
                if(!check){
                    wr=false;
                    break;
                }
                nest=false;
                break;
            }
            }
            if(nest==false){
                ans++;
                rep(j,g) now[j]=0;
                check=-1;
                p--;
            }
            if(wr==false){
                rep(j,g) now[j]=0;
                ans=INF
                break;
            }
            p++;
        }
    tans=min(tans,ans);
    }
    cout << tans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:17: error: expected ';' before 'break'
   56 |                 break;
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int h,w,k; cin >> h >> w >> k;
    vector<string> cho(h);
    rep(i,h) cin >> cho[i];
    int tans=INF; 

    rep(i,1<<(h-1)){
        vector<int> now(h,0);
        vector<int> group(h,-1);
        int g=0;
        rep(j,h){
            group[j]=g;
            if(i>>j&1) g++;
        }
        g++;
        int ans=g-1;
        int check=-1;
        int p=0;
        while(p<w){
            check++;
            int c=0;
            rep(j,g){
                while(group[c]==j && c<h){
                    if(cho[c][p]=='1') now[j]++;
                    c++;
                }
            }
            bool wr=true; bool nest=true;
            rep(j,g){
            if(now[j]>k){
                if(!check){
                    wr=false;
                    break;
                }
                nest=false;
                break;
            }
            }
            if(nest==false){
                ans++;
                rep(j,g) now[j]=0;
                check=-1;
                p--;
            }
            if(wr==false){
                rep(j,g) now[j]=0;
                break;
            }
            p++;
        }
    if(wr==true) tans=min(tans,ans);
    }
    cout << tans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:8: error: 'wr' was not declared in this scope; did you mean 'w'?
   59 |     if(wr==true) tans=min(tans,ans);
      |        ^~
      |        w
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ck cout<<(id++)<<endl
typedef long long ll;
const int maxn=1e6+100;
const int maxc=26;
const int mod=998244353;
char s[20][1100];
int a[20][1100];
int id;
int main()
{
    int h,w,k;
    scanf("%d%d%d",&h,&k,&w);
    for(int i=1;i<=h;i++)
    scanf("%s",s[i]);
    for(int i=1;i<=h;i++){
        for(int j=0;j<k;j++){
            a[i][j+1]=s[i][j]-'0';
        }
    }
    int mine=h*w;
    for(int i=0;i<(1<<(h-1));i++){
        //ck;
        int e=0,dp[12]={},cnt=0,vis=1;
        for(int j=1;j<=k;j++){
            int now[12]={},flag=1;
            e=0;
            for(int u=1;u<=h;u++){
                now[e]+=a[u][j];
                if((i>>(u-1))&1)
                    e++;
            }
            for(int u=0;u<=e;u++){
                if(dp[u]+now[u]>w)
                    flag=0;
                if(now[u]>w)
                    vis=0;
            }
            if(flag){
                for(int u=0;u<=e;u++)
                    dp[u]+=now[u];
            }else {
                for(int u=0;u<=e;u++)
                    dp[u]=now[u];
                cnt++;
            }

        }
        e=_builtin_popcount(i);
        if(vis) mine=min(mine,cnt+e);
    }
    cout<<mine<<endl;
    return 0;
}
/*

*/


Compiler output:
a.cc: In function 'int main()':
a.cc:50:11: error: '_builtin_popcount' was not declared in this scope; did you mean '__builtin_popcount'?
   50 |         e=_builtin_popcount(i);
      |           ^~~~~~~~~~~~~~~~~
      |           __builtin_popcount
Language: C++

#include<bits/stdc++.h>

using namespace std;


int cuts(const vector<vector<int>>& grid, const int& mask,
	const int& h, const int& w, const int& k) {
	vector<int> cuts;//номера строк с разрезами
	for (int i = 0; i < h - 1; ++i)
		if (mask & (1 << i))
			cuts.push_back(i);
	cuts.push_back(10);
	vector<int> pieces(cuts.size());//горизонтальные кусочки
	int c(0);//суммарное число ВЕРТИКАЛЬНЫХ разрезов
	for (int j = 0; j < w; ++j) {//цикл по столбцам
		int x(0);//номер текщего разреза
		for (int i = 0; i < h; ++i) //цикл по строкам
		{
			const bool hasCut = i == cuts[x]; // есть ли разрез в этой строке
			pieces[hasCut ? (x++) : x] += grid[i][j];
		}
		
		for (int n = 0; n < pieces.size(); ++n) {
			if (pieces[n] > k) {
				c++;//делаем разрез
				memset(&pieces[0], 0, 4 * pieces.size());//заполняем pieces нулями
				x = 0;//номер текущего разреза сбрасываем в 0

				//пробегаем по столбцу перед разрезом
				//если накопили k единиц и встречаем очередную - этот уже перебор
				for (int i = 0; i < h; ++i) {
					if (pieces[x] == k && grid[i][j]) return -1;
					const bool hasCut = i == cuts[x];
					pieces[hasCut ? (x++) : x] += grid[i][j];
				}
			}
		}
	}
	return c;
}


int main() {
	int h, w, k;
	char c;
	cin >> h >> w >> k;
	
	
	vector<vector<int>> grid(h, vector<int>(w));
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			cin >> c;
			grid[i][j] = c - '0';
		}

	int hs(1 << (h - 1)), ans(h + w - 2);
	for (int mask = 0; mask < hs; ++mask) {
		int res = cuts(grid, mask, h, w, k);
		if (res >= 0) ans = min(ans, res + static_cast<int>(__popcnt(mask)));
	}
	cout << ans << '\n';
	return 0;
}
	


Compiler output:
a.cc: In function 'int main()':
a.cc:59:69: error: '__popcnt' was not declared in this scope
   59 |                 if (res >= 0) ans = min(ans, res + static_cast<int>(__popcnt(mask)));
      |                                                                     ^~~~~~~~
Language: C++

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


int cuts(const vector<vector<int>>& grid, const int& mask,
	const int& h, const int& w, const int& k) {
	vector<int> cuts;//номера строк с разрезами
	for (int i = 0; i < h - 1; ++i)
		if (mask & (1 << i))
			cuts.push_back(i);
	cuts.push_back(10);
	vector<int> pieces(cuts.size());//горизонтальные кусочки
	int c(0);//суммарное число ВЕРТИКАЛЬНЫХ разрезов
	for (int j = 0; j < w; ++j) {//цикл по столбцам
		int x(0);//номер текщего разреза
		for (int i = 0; i < h; ++i) //цикл по строкам
		{
			const bool hasCut = i == cuts[x]; // есть ли разрез в этой строке
			pieces[hasCut ? (x++) : x] += grid[i][j];
		}
		
		for (int n = 0; n < pieces.size(); ++n) {
			if (pieces[n] > k) {
				c++;//делаем разрез
				memset(&pieces[0], 0, 4 * pieces.size());//заполняем pieces нулями
				x = 0;//номер текущего разреза сбрасываем в 0

				//пробегаем по столбцу перед разрезом
				//если накопили k единиц и встречаем очередную - этот уже перебор
				for (int i = 0; i < h; ++i) {
					if (pieces[x] == k && grid[i][j]) return -1;
					const bool hasCut = i == cuts[x];
					pieces[hasCut ? (x++) : x] += grid[i][j];
				}
			}
		}
	}
	return c;
}


int main() {
	int h, w, k;
	char c;
	cin >> h >> w >> k;
	
	
	vector<vector<int>> grid(h, vector<int>(w));
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			cin >> c;
			grid[i][j] = c - '0';
		}

	int hs(1 << (h - 1)), ans(h + w - 2);
	for (int mask = 0; mask < hs; ++mask) {
		int res = cuts(grid, mask, h, w, k);
		if (res >= 0) ans = min(ans, res + static_cast<int>(__popcnt(mask)));
	}
	cout << ans << '\n';
	return 0;
}
	


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

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int INF = 1000000009;

int main() {
  int h, w, k; cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++) { cin >> s[i]; }

  int ans = INF;
  for (int bit = 0; bit < (1 << (h-1)); bit++) {
    int cur = 0;
    for (int i = 0; i < (h-1); i++) { if ((bit >> i) & 1) { cur++; } }
    int block_size = cur + 1;
    vector<int> block(block_size, 0);

    for (int i = 0; i < w; i++) {
      int block_id = 0;a
      for (int j = 0; j < h; j++) {
        block[block_id] += (s[j][i] == '1');
        block_id += ( (bit >> j) & 1 );
      }
      bool is_ok = (*max_element(block.begin(), block.end()) <= k);
      if (!is_ok) {
        cur++;
        fill(block.begin(), block.end(), 0);
        block_id = 0;
        for (int j = 0; j < h; j++) {
          block[block_id] += (s[j][i] == '1');
          block_id += ( (bit >> j) & 1 );
        }
      }
      if (*max_element(block.begin(), block.end()) > k) { cur = INF; break; }
    }
    ans = min(ans, cur);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'a' was not declared in this scope
   22 |       int block_id = 0;a
      |                        ^
a.cc:23:23: error: 'j' was not declared in this scope
   23 |       for (int j = 0; j < h; j++) {
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int h,w,k;
int mat[11][1005];
vector<int>p;

int get_sum(int x1, int y1, int x2, int y2)
{
	return mat[x2][y2] - mat[x1][y2] - mat[x2][y1] + mat[x1][y1];
}

bool check(int x, int y){
	for(int i = 1; i < (int)p.size(); ++i) {
		//cout << p[i - 1] << " " << x << " " << p[i] << " " << y << " " << get_sum(p[i - 1],x,p[i],y) << endl;
		if(get_sum(p[i - 1],x,p[i],y) > k) return true;
	}

	return false;
}

int main()
{
	//fastIO;
	cin >> h >> w >> k;
	rep(i,1,h + 1) {
		rep(j,1,w + 1){
			scanf("%1d",&mat[i][j]);
		}
	}		
	rep(i,1,h + 1) {
		rep(j,1,w + 1){
			mat[i][j] += mat[i- 1][j] + mat[i][j - 1] - mat[i - 1][j - 1];
		}
	}
	int ans = INT_MAX;
	for(int i = 0; i < (1 << (h - 1)); ++i){
		p.clear(); p.pb(0);
		int now = 0;
		for(int j = 1; j <= h - 1; ++j){
			if(( 1 << (j - 1)) & i) p.pb(j), now++;
		}
		p.pb(h);
		//cout << i << " ";
		//rep(i,0,SZ(p)) cout << p[i] << " ";
		//cout << endl;
		int pre = 0;
		for(int j = 1; j <= w; ++j) {
			if(check(pre,j)) ｛
				if(j == pre + 1) {
					now = INT_MAX;
					break;
				}
				pre = j - 1, now++;
			｝
		}
		if(check(pre,w)) now = INT_MAX;
		ans = min(ans,now);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:42: error: '｛' was not declared in this scope
   70 |                         if(check(pre,j)) ｛
      |                                          ^~
a.cc:76:25: error: '｝' was not declared in this scope
   76 |                         ｝
      |                         ^~
Language: C++

//#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int c[10][1005];

int main(){
	int h,w,K;
	cin >> h>>w>>K;
	int ans=INF;
	string s[h];
	rep(i,h){
		cin >> s[i];
	}
	rep(div,1<<(h-1)){
		int g=0;//グループ数
		vector<int> id(h);
		rep(i,n){
			if[i]=g;
			if(div>>i&1==1)g++;
		}
		g++;

		rep(i,g)rep(j,w)c[i][j]=0;
		rep(i,h)rep(j,w)c[id[i]][j]+=(s[i][j]-'0');

		int num=g-1;
		vector<int> now(g);
		auto add=[&](int j){
			rep(i,g) now[i]+=c[i][j];
			rep(i,g) if(now[i]>k)return 0;
			return 1;
		}
		rep(j,w){
			if(!add(j)){
				num++;
				now=vector<int>(g);
				if(!add(j)){
					num=INF;
					break;
				}
			}
		}
		chmn(ans,num);
	}
	cout<<ans<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:69:23: error: 'n' was not declared in this scope
   69 |                 rep(i,n){
      |                       ^
a.cc:11:39: note: in definition of macro 'rep'
   11 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
      |                                       ^
a.cc:70:27: error: expected '(' before '[' token
   70 |                         if[i]=g;
      |                           ^
      |                           (
a.cc: In lambda function:
a.cc:82:44: error: 'k' was not declared in this scope
   82 |                         rep(i,g) if(now[i]>k)return 0;
      |                                            ^
a.cc: In function 'int main()':
a.cc:11:18: error: expected ',' or ';' before 'for'
   11 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
      |                  ^~~
a.cc:85:17: note: in expansion of macro 'rep'
   85 |                 rep(j,w){
      |                 ^~~
a.cc:85:21: error: 'j' was not declared in this scope
   85 |                 rep(j,w){
      |                     ^
a.cc:11:31: note: in definition of macro 'rep'
   11 | #define rep(i,n) for(int i=0; i<(int)(n); i++)
      |                               ^
Language: C++

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

int fun(vector<vector<int>> &vec,vector<bool> &visited,int k)
{
    int m=vec[0].size();
    int n=vec.size();
    int count=0;
    for(int i=0;i<visited.size();++i)
    {
        if(visited[i])
        count++;
    }
    //cout<<count<<endl;
    vector<vector<int>> temp(count+1,vector<int>(m,0));
    for(int j=0;j<m;++j)
    {int sum=0;
    int k1=0;
        for(int i=0;i<n;++i)
        {
            sum+=(vec[i][j]);
            
            if(i!=n-1)
            {
            if(visited[i])
            {
                temp[k1][j]=sum;
                //cout<<sum<<" ";
                sum=0;
                k1++;
            }
            }
            
        }
        temp[k1][j]=sum;
    }
    
    int max=INT_MIN;
    int sum=0;
    //cout<<k<<endl;
    for(int i=0;i<(count+1);++i)
    {
        
        int y=0;
        int j=0;
        int flag=0;
        while(j<m)
        {
            //cout<<j<<" ";
            int lo=j;
            int sum=0;
            while(sum<=k&&lo<m)
            {
                sum+=temp[i][lo];
                //cout<<temp[i][lo]<<" ";
                lo++;
            }
            //cout<<sum<<" ";
            if(sum>k&&lo==j+1)
            {
                flag=1;
                break;
            }
            else if(sum>k)
            {
            y++;
            j=lo-1;
            }
            else
            j=lo;
        }
        if(flag==1)
        break;
        if(y>max)
        max=y;
        
    }
    if(flag==1)
    return INT_MAX;
    
    return max;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int n,m,k;
	cin>>n>>m>>k;
	vector<string> vec1(n);
	for(int i=0;i<n;++i)
	{
	    cin>>vec1[i];
	}
	vector<vector<int>> vec(n,vector<int>(m,0));
	for(int i=0;i<n;++i)
	{
	    for(int j=0;j<m;++j)
	    {
	        vec[i][j] = vec1[i][j]-'0';
	        //cout<<vec[i][j]<<" ";
	    }
	}
	int min=INT_MAX;
	for(ll i=0;i<(1<<(n-1));++i)
	{
	    vector<bool> visited(n-1,false);
	    int count=0;
	    for(int j=0;j<(n-1);++j)
	    {
	        int temp=i&(1<<j);
	        if(temp)
	        {
	        visited[j]=true;
	        count++;
	        }
	    }
	    //cout<<count<<" ";
	    int num=fun(vec,visited,k);
	    //cout<<num<<" "<<count<<endl;
	    num=num+count;
	    if(num<min)
	    min=num;
	    //cout<<min<<" ";
	}
	cout<<min<<endl;
}


Compiler output:
a.cc: In function 'int fun(std::vector<std::vector<int> >&, std::vector<bool>&, int)':
a.cc:79:8: error: 'flag' was not declared in this scope
   79 |     if(flag==1)
      |        ^~~~
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res%mod;}
long modInverse(long a) {return powmod(a, mod-2);}

int tab[20][1010];
int dp[20][1010];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=1;i<=h;i++){
        string s;
        cin>>s;
        for(int j=1;j<=w;j++){
            if(s[i]=='0')tab[i][j]=0;
            else tab[i][j]=1;
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            dp[i][j]=tab[i][j]+dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1];
        }
    }
    int sz=h*w+1;
    int a=0;int b=0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            for(int ii=0;ii+i<=h;ii++){
                for(int jj=0;jj+j<=w;jj++){
                    int taille=dp[ii][jj]-dp[i][j]+tab[i][j];
                    if(taille>k){
                        if(sz<(ii+1)*(jj+1)){
                            a=ii+1;
                            b=jj+1;
                        }
                        sz=min(sz,(ii+1)*(jj+1));
                    }
                }
            }
        }
    }
    sz--;
    while()
    if(sz==h*w){
        cout<<0<<endl;
        return 0;
    }
    int res=h/a+w/b;
    cout<<res<<endl;
    return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:56:11: error: expected primary-expression before ')' token
   56 |     while()
      |           ^
Language: C++

#include <iostream>
#include <ios>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <iomanip>
#include <cmath>

using namespace std;

const int N = (int) 2e5 + 5;
const int M = (int) 1e9 + 7;

typedef long long ll;

int h, w, k;
string s[15];

int main() {
    cin >> h >> w >> k;
    for (int i = 0; i < h; i++) cin >> s[i];

    int res = INT_MAX;
    for (int b = 0; b < (1 << (h - 1)); b++) {
        int total = 0;

        for (int i = 0; i < h; i++)
            if (b & (1 << i)) total++;

        bool valid = true;

        int blk[10] = {0};
        int col[10] = {0};

        for (int j = 0; j < w; j++) {
            for (int i = 0; i < h; i++) col[i] = 0;

            int id = 0;
            for (int i = 0; i < h; i++) {
                col[id] += s[i][j] == '1';
                if ((1 << i) & b) id++;
            }

            for (int i = 0; i <= id; i++) {
                if (col[i] > k) {
                    valid = false;
                    break;
                }
            }

            if (!valid) break;

            bool inc = false;

            for (int i = 0; i <= id; i++) {
                if (blk[i] + col[i] > k) {
                    inc = true;
                    break;
                }
            }

            if (inc) {
                total++;
                for (int i = 0; i <= id; i++) blk[i] = 0;
            }
            for (int i = 0; i <= id; i++) blk[i] += col[i];
        }

        if (valid) res = min(res, total);
    }

    cout << res << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: 'INT_MAX' was not declared in this scope
   24 |     int res = INT_MAX;
      |               ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <cmath>
  +++ |+#include <climits>
    9 |
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;
 
int main(){
  using namespace std;
  int h, w, k;
  cin>>h>>w>>k;
  vector<string> s(h);
  REP(i, h){
    cin>>s[i];
  }
  
  long long ans = INF;
  REP(div, 1<<h){
    if(div>>(h-1)&1)continue;
    int gid[h];
    int g = 0;
    REP(i, h){
      gid[i] = g;
      if(div>>i&1) g++;
    }
    g++;
    
    int c[g][w] = {};
    REP(i, h) REP(j, w) c[gid[i]][j] += s[i][j] - '0';
    vector<int> cnt(g, 0);
    
    long long temp = g - 1;
    auto add = [&](int j){
      REP(i, g) cnt[i] += c[i][j];
      bool ok = true;
      REP(i, g) if(cnt[i] > k) ok = false;
      return ok;
    }
    REP(j, w){
      if(!add(j)){
        temp++;
        cnt = vector<int>(g, 0);
        if(!add(j)){
          temp = INF;
          break;
        }
      }
    }
    ans = min(ans, temp);
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:95:27: sorry, unimplemented: capture of variably-modified type 'int [g][w]' that is not an N3639 array of runtime bound
   95 |       REP(i, g) cnt[i] += c[i][j];
      |                           ^
a.cc:95:27: note: because the array element type 'int [w]' has variable size
a.cc: In function 'int main()':
a.cc:6:18: error: expected ',' or ';' before 'for'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:100:5: note: in expansion of macro 'REP'
  100 |     REP(j, w){
      |     ^~~
a.cc:100:9: error: 'j' was not declared in this scope
  100 |     REP(j, w){
      |         ^
a.cc:6:30: note: in definition of macro 'REP'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;
 
int main(){
  using namespace std;
  int h, w, k;
  cin>>h>>w>>k;
  vector<string> s(h);
  REP(i, h){
    cin>>s[i];
  }
  
  long long ans = INF;
  REP(div, 1<<h){
    if(div>>(h-1)&1)continue;
    int gid[h];
    int g = 0;
    REP(i, h){
      gid[i] = g;
      if(div>>i&1) g++;
    }
    g++;
    
    int c[g][w] = {};
    REP(i, h) REP(j, w) c[id[i]][j] += s[i][j] - '0';
    vector<int> cnt(g, 0);
    
    long long temp = g - 1;
    auto add = [&](int j){
      REP(i, g) cnt[i] += c[i][j];
      bool ok = true;
      REP(i, g) if(cnt[i] > k) ok = false;
      return ok;
    }
    REP(j, w){
      if(!add(j)){
        temp++;
        cnt = vector<int>(g, 0);
        if(!add(j)){
          temp = INF;
          break;
        }
      }
    }
    ans = min(ans, temp);
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:27: error: 'id' was not declared in this scope; did you mean 'i'?
   90 |     REP(i, h) REP(j, w) c[id[i]][j] += s[i][j] - '0';
      |                           ^~
      |                           i
a.cc: In lambda function:
a.cc:95:27: sorry, unimplemented: capture of variably-modified type 'int [g][w]' that is not an N3639 array of runtime bound
   95 |       REP(i, g) cnt[i] += c[i][j];
      |                           ^
a.cc:95:27: note: because the array element type 'int [w]' has variable size
a.cc: In function 'int main()':
a.cc:6:18: error: expected ',' or ';' before 'for'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:100:5: note: in expansion of macro 'REP'
  100 |     REP(j, w){
      |     ^~~
a.cc:100:9: error: 'j' was not declared in this scope
  100 |     REP(j, w){
      |         ^
a.cc:6:30: note: in definition of macro 'REP'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;
 
int main(){
  using namespace std;
  int h, w, k;
  cin>>h>>w>>k;
  vector<string> s(h);
  REP(i, h){
    cin>>s[i];
  }
  
  long long ans = INF;
  REP(div, 1<<h){
    if(div>>(h-1)&1)continue;
    int gid[h];
    int g = 0;
    REP(i, h){
      gid[i] = g;
      if(div>>i&1) g++;
    }
    g++;
    
    int c[g][w] = {};
    REP(i, h) REP(j, w) c[id(i)][j] += s[i][j] - '0';
    vector<int> cnt(g, 0);
    
    long long temp = g - 1;
    auto add = [&](int j){
      REP(i, g) cnt[i] += c[i][j];
      bool ok = true;
      REP(i, g) if(cnt[i] > k) ok = false;
      return ok;
    }
    REP(j, w){
      if(!add(j)){
        temp++;
        cnt = vector<int>(g, 0);
        if(!add(j)){
          temp = INF;
          break;
        }
      }
    }
    ans = min(ans, temp);
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:27: error: 'id' was not declared in this scope; did you mean 'i'?
   90 |     REP(i, h) REP(j, w) c[id(i)][j] += s[i][j] - '0';
      |                           ^~
      |                           i
a.cc: In lambda function:
a.cc:95:27: sorry, unimplemented: capture of variably-modified type 'int [g][w]' that is not an N3639 array of runtime bound
   95 |       REP(i, g) cnt[i] += c[i][j];
      |                           ^
a.cc:95:27: note: because the array element type 'int [w]' has variable size
a.cc: In function 'int main()':
a.cc:6:18: error: expected ',' or ';' before 'for'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:100:5: note: in expansion of macro 'REP'
  100 |     REP(j, w){
      |     ^~~
a.cc:100:9: error: 'j' was not declared in this scope
  100 |     REP(j, w){
      |         ^
a.cc:6:30: note: in definition of macro 'REP'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

int main()
{
    ll h,w,k;
    cin >> h >> w >> k;
    vector<vector<char>> s(h,vector<char>(w,0));
    rep(i,h){
        rep(j,w){
            cin >> s[i][j];
        }
    }
    ll ans=INF;
    for(ll i=0;i<(1<<(h-1));i++){
        ll cnt=1;
        ll cnt_1=0;
        rep(j,h-1){
            if((i>>j) & 1){
                cnt++;
            }
        }
        vector<ll> a(cnt,0);
        rep(j,w){
            ll num=0;
            ll r=s[0][j]-'0';
            a[num]+=r;
            for(ll t=0;t<h-1;t++){
                if((i>>t) & 1){
                    num++;
                }
                ll v=s[t+1][j]-'0';
                a[num]+=v;
            }
            bool flag=true;
            for(ll t=0;t<cnt;t++){
                if(a[t]>k){
                    flag=false;
                    break;
                }
            }
            /*cout << cnt << " ";
            rep(t,cnt){
                cout << a[t];
            }*/
            if(flag){
                continue;
            }
            else{
                cnt_1++;
                j--;
                a=vectot<ll>(cnt);
            }
            
        }
        //cout << endl;
        ans=min(ans,cnt-1+cnt_1);
        
    }
    cout << ans << endl;
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:90:19: error: 'vectot' was not declared in this scope
   90 |                 a=vectot<ll>(cnt);
      |                   ^~~~~~
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:90:26: note: in expansion of macro 'll'
   90 |                 a=vectot<ll>(cnt);
      |                          ^~
Language: C++

#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'a')+1)
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=200005;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;

int n,m,k;
int g[15][1009];
char str[1009];
int pp[20];
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;i++){
        scanf("%s",str+1);
        for(int j=1;j<=m;j++)
            g[i][j]=g[i-1][j]+g[i][j-1]-g[i-1][j-1]+str[j]-'0';
    }
    if(g[n][m]<=k){
        cout<<0<<endl;
        return 0;
    }
    int answer=INT_MAX;
    for(int i=0;i<(1<<(n-1));i++)
    {
        memset(pp,0, sizeof(pp));int nn=0;//pp[i]=j表示第i跟横线在j+1处，nn表示个数
        int pre=0;//表示上一条纵线在哪个位置
        for(int k=0;k<n-1;k++){
            if((i>>k)&1)pp[++nn]=k+1;
        }
        pp[++nn]=n-1;
        int cnn=0;//第i种情况下纵线的条数
        for(int j=1;j<=m;j++)
        {
            int flag=0;
            for(int xx=1;xx<=nn;xx++){
                if(g[pp[xx]+1][j]-g[pp[xx]+1][pre]-g[pp[xx-1]+1][j]+g[pp[xx-1]+1][pre]>k){
                    cnn++;flag=1;
                }
            }
            if(flag)pre=j;
        }
        answer=min(answer,cnn+nn);//统计答案
    }
    cout<<answer<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:16: error: 'INT_MAX' was not declared in this scope
   50 |     int answer=INT_MAX;
      |                ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include<cstdlib>
  +++ |+#include <climits>
   15 | typedef long long ll;
Language: C++

lude<bits/stdc++.h>
using namespace std;
#define int long long 

char table[15][1010];
const int inf = 1LL << 60;

signed main(void){ 
  
  int h,w,k; cin >> h >> w >> k;
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){ 
      cin >> table[i][j];
    }
  }
  
  int ans = inf;
  
  for(int bt = 0; bt < (1<<(h-1)); bt++){ 
   
    int cnt = 0;
    
    for(int i = 0; i < h; i++){
      if( bt >> i & 1 ){ cnt++;}
    }//1の個数を数えた
   
    
    bool impossible = false;
    
    int stock[12] = {}; 
     
    for(int j = 0; j < w; j++){
      
      
      int nw[12] = {}; int pos = 0;
      
      bool fold = false;
      
      for(int i = 0; i < h; i++){
        nw[pos] += (table[i][j] == '1'); 
        if( bt >> i & 1 ){ pos++;}
      }
      
      for(int i = 0; i < h; i++){ 
        
        if( nw[i]+stock[i] >= k ){ fold = true;}
        if( nw[i] >= k ){ impossible = true;}
        
      }
      
      if(impossible){break;}
      
      if(fold){ 
        
        for(int i = 0; i < h; i++){ 
          
          stock[i] = nw[i];
          
         
        }
          
        cnt++;
        
      }
      else{
        
        for(int i = 0; i < h; i++){ 
          
          stock[i] += nw[i];
        }
      }
      
    }
    
    if(impossible){ cnt = inf;}
    
    ans = min(ans,cnt);
  }

  cout << ans << endl;
  
  return 0;
}
  

Compiler output:
a.cc:1:1: error: 'lude' does not name a type
    1 | lude<bits/stdc++.h>
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:14: error: 'cin' was not declared in this scope
   10 |   int h,w,k; cin >> h >> w >> k;
      |              ^~~
a.cc:78:11: error: 'min' was not declared in this scope; did you mean 'main'?
   78 |     ans = min(ans,cnt);
      |           ^~~
      |           main
a.cc:81:3: error: 'cout' was not declared in this scope
   81 |   cout << ans << endl;
      |   ^~~~
a.cc:81:18: error: 'endl' was not declared in this scope
   81 |   cout << ans << endl;
      |                  ^~~~
Language: C++

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

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

int main(){
  int h,w,K,ans=1e9;cin>>h>>w>>K;
  vector<string> s(h);
  REP(i,h)cin>>s[i];
  REP(bit,1<<(h-1)){
    vector<int> v;
    REP(i,h-1)if((bit>>j)&1)v.push_back(j);
    int res=v.size(),n=v.size()+1;
    vector<int> cnt(n,0),tmp(n,0);
    REP(x,w){
      int now=0;
      REP(y,h){
        tmp[now]+=s[y][x]=='1';
        if(now<v.size()&&v[now]==j)now++;
      }
      REP(j,n)if(tmp[j]>K)x=res=INF;
      bool f=true;
      REP(j,n)if(cnt[j]+tmp[j]>K)f=false;
      REP(j,n)cnt[j]=cnt[j]*f+tmp[j],tmp[j]=0;
      res+=!f;
    }
    if(ans>res)ans=res;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'j' was not declared in this scope
   12 |     REP(i,h-1)if((bit>>j)&1)v.push_back(j);
      |                        ^
a.cc:19:34: error: 'j' was not declared in this scope
   19 |         if(now<v.size()&&v[now]==j)now++;
      |                                  ^
a.cc:21:33: error: 'INF' was not declared in this scope
   21 |       REP(j,n)if(tmp[j]>K)x=res=INF;
      |                                 ^~~
Language: C++

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

signed main(){
  int h,w,K,ans=1e9;;cin>>h>>w>>K;
  vector<string> s(h);
  for(int i=0;i<h;i++)cin>>s[i];
  for(int a=0;a<(1<<(h-1));a++){
    vector<int> v;
    for(int j=0;j<h-1;j++)if((a>>j)&1)v.push_back(j);
    int res=v.size(),n=v.size()+1;
    vector<int> cnt(n,0),tmp(n,0);
    for(int k=0;k<w;k++){
      int now=0;
      for(int j=0;j<h;j++){
        tmp[now]+=s[j][k]=='1';
        if(now<v.size()&&v[now]==j)now++;
      }
      for(int j=0;j<n;j++)if(tmp[j]>K)k=res=INF;
      bool f=false;
      for(int j=0;j<n;j++)if(cnt[j]+tmp[j]>K)f=1;
      if(f)for(int j=0;j<n;j++)cnt[j]=tmp[j];
      else for(int j=0;j<n;j++)cnt[j]+=tmp[j];
      res+=f;
      for(int j=0;j<n;j++)tmp[j]=0;
    }
    chmin(ans,res);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:45: error: 'INF' was not declared in this scope
   19 |       for(int j=0;j<n;j++)if(tmp[j]>K)k=res=INF;
      |                                             ^~~
a.cc:27:5: error: 'chmin' was not declared in this scope
   27 |     chmin(ans,res);
      |     ^~~~~
Language: C++

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

ll d2sum[11][1001];
ll h,w,k;
vector<ll> group(ll bit,ll size)
{
	vector<ll> bitzen(size-1);
	for(ll i = 0;i<size-1;i++)
	{
		bitzen[i] = bit&1;
		bit/=2;
	}
	ll n = 0;
	vector<ll> res(size);
	for(ll i = 0;i<size-1;i++)
	{
		if(bitzen[i]==1)
		{
			res[i+1] = ++n;
		}
		else
		{
			res[i+1] = n;
		}
		
	}
	return res;
}

int main()
{
	
	cin >> h>> w>> k;
	vector<string> s(h);
	for(ll i = 0;i<h;i++)cin >> s[i];
	for(ll i = 0;i<h;i++)
	{
		for(ll j = 0;j<w;j++)
		{
			if(s[i][j]=='1')
			{
				d2sum[i+1][j+1]+=d2sum[i+1][j]+d2sum[i][j+1]+1-d2sum[i][j];
			}
			else
			{
				d2sum[i+1][j+1]+=d2sum[i+1][j]+d2sum[i][j+1]-d2sum[i][j];
			}
		}
	}
	ll ans = INT_MAX;
	for(ll bit = 0;bit<(1<<(h-1));bit++)
	{
		
		ll N = 0;
		vector<ll> G = group(bit,h);
		N += G.back();
		
		vector<ll> now(h);
		for(ll i = 0;i<w;i++)
		{
			for(ll j = 0;j<h;j++)
			{
				if(s[j][i]=='1')now[G[j]]++;
				if(now[G[j]]>k)
				{
					//cout<<';'<<i<<';'<<N<<endl;
					for(ll k = 0;k<h;k++)
					{
						now[G[k]]=0;
					}
					for(ll k = 0;k<h;k++)
					{
						if(s[k][i]=='1')now[G[k]]++;
						if(now[G[k]]>k)N+=INF;
					}

					N++;
					break;
				}
			}
		}
		//cout<<N<<endl;
		ans = min(N,ans);
	}
	for(ll bit = 0;bit<(1<<(h-1));bit++)
	{
		
		ll N = 0;
		vector<ll> G = group(bit,h);
		N += G.back();
		
		vector<ll> now(h);
		for(ll i = w-1;i>=0;i--)
		{
			for(ll j = 0;j<h;j++)
			{
				if(s[j][i]=='1')now[G[j]]++;
				if(now[G[j]]>k)
				{
					//cout<<';'<<i<<';'<<N<<endl;
					for(ll k = 0;k<h;k++)
					{
						now[G[k]]=0;
					}
					for(ll k = 0;k<h;k++)
					{
						if(s[k][i]=='1')now[G[k]]++;
					}
					N++;
					break;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
	
	for(ll i = 0;i<h+1;i++)
	{
		for(ll j = 0;j<w+1;j++)
		{
			cout<<d2sum[i][j]<<' ';
		}
		cout<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:67: error: 'INF' was not declared in this scope
   76 |                                                 if(now[G[k]]>k)N+=INF;
      |                                                                   ^~~
Language: C++

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

vector<vector<int> > intlis;
int h, w, k;

int main(){
    cin >> h >> w >> k;
    vector<string> lis(h);
    for(int i = 0; i < h; i++){
        cin >> lis[i];
    }
    intlis = vector<vector<int> >(h, vector<int>(w, 0));
    for(int i = 0; i < h; i++){
        if(lis[i][0] == '1'){
            intlis[i][0] = 1;
        }
    }
    for(int i = 0; i < h; i++){
        for(int l = 1; l < w; l++){
            int k = 0;
            if(lis[i][l] == '1'){
                k = 1;
            }
            intlis[i][l] = intlis[i][l-1] + k;
        }
    }
    int ans = 1000000;
    for(int i = 0; i < (1 << h-1); i++){
        vector<vector<int>> cans(h, vector<int>(w, 0));
        vector<int> mid(w, 0);
        for(int l = 0; l < w; l++){
            mid[l] = intlis[0][l];
        }
        int mm = 0;
        for(int k = 0; k < h-1; k++){
            //cout << (i >> k) << endl;
            if((i >> k) && 1 == 1){
                //cout << 33 << endl;
                for(int j = 0; j < w; j++){
                    cans[mm][j] = mid[j];
                    mid[j] = intlis[k+1][j];
                }
                mm++;
                //cout << "mm" << mm << endl;
            }else{
                for(int l = 0; l < w; l++){
                    mid[l] += intlis[k+1][l];
                }
            }
        }
        for(int l = 0; l < w; l++){
            cans[mm][l] = mid[l];
        }
        int pre = 0;
        int cc = 0;
        for(int i = 0; i < w; i++){
            for(int l = 0; l < mm; l++){
                if(cans[l][i] - pre <= k]){
                    cc++;
                    pre = cans[l][i];
                    break;
                }
            }
        }
        ans = min(cc, ans);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:41: error: expected ')' before ']' token
   60 |                 if(cans[l][i] - pre <= k]){
      |                   ~                     ^
      |                                         )
a.cc:60:41: error: expected primary-expression before ']' token
Language: C++

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int h, w, k;
vector<int> tobit(int m) {
    vector<int> res(h - 1, 0);
    int bit = m;
    for(int i = 0; i < h - 1; i++) {
        res[i] = (bit & 1);
        bit /= 2;
    }
    return res;
}
int solve(vector<vector<int>> &v) {
    vector<int> dp(w + 1, 114514);
    dp[0] = 0;
    for(int i = 0; i < w; i++) {
        for(int j = 0; j <= i; j++) {
            for(int l = 0; l < v.size(); l++) {
                if(v[l][i + 1] - v[l][j] <= k) {
                    dp[i + 1] = min(dp[i + 1], dp[j] + 1);
                }
            }
        }
        dp[i + 1] = tmp;
    }
    return *min_element(all(dp));
}
int main() {
    cin >> h >> w >> k;
    vector<string> s(h);
    for(int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<int>> rui(h, vector<int>(w + 1, 0));
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            rui[i][j + 1] = rui[i][j] + (s[i][j] == '1');
        }
    }
    int ans = INT_MAX;
    for(int i = 0; i < (2 << (h - 2)); i++) {
        vector<int> tob = tobit(i);
        vector<int> gru(h, 0);
        for(int i = 1; i < h; i++) {
            gru[i] = gru[i - 1] + tob[i - 1];
        }
        vector<vector<int>> v(gru.back() + 1, vector<int>(w + 1, 0));
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w + 1; j++) {
                v[gru[i]][j] += rui[i][j];
            }
        }
        ans = min(ans, solve(v));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int solve(std::vector<std::vector<int> >&)':
a.cc:27:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   27 |         dp[i + 1] = tmp;
      |                     ^~~
      |                     tm