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

/* ABC159 E
 * 2020.4.4~
 * H 1-10
 * W 1-10000
 * K 1-H*W
 */
#include <iostream>
#include <vector>
//#include <algorithm>
using namespace std;

//#define DB

#ifdef DB
#else
#define _DB(f)
#endif

inline int max(int x, int y){
  return (x>y)?x:y;
}
inline int min(int x, int y){
  return (x<y)?x:y;
}

int s[10][1000]; //最大
int H,W,K;

void init_mat(){
  cin >> H >> W >> K;
  string st;
  for(int i=0;i!=H;++i){
    cin >> st; // W桁の文字列で入力される
    for(int j=0;j!=W;++j){
      s[i][j] = st[j]-'0';
    }
  }
  return;
}

/* 行区切りのvectorが与えられたとき，
   ある列区間での各区画でのs=1となるセルの数の最大値 */
int max_num(vector<int> rows, int lcol, int rcol){
  int len = rows.size();
  int res = 0;
  for(int i=0;i!=len-1;++i){ // 行区間
    int trow = rows[i], brow = rows[i+1];
    int tmp = 0;
    for(int row=trow;row!=brow;++row){
      for(int col=lcol;col!=rcol;++col){
        tmp += s[row][col];
      }
    }
    res = max(res,tmp);
  }
  return res;
}

/* 行区切りのvectorが与えられたとき，
   (s==1)なセル数<=k に必要な列区切り数のgreedy算出 */
int greedy(vector<int> rows){
  int l=0, lines=0, r=1;
  _DB(printf("=greed: "));
  while(r!=W+1){
    if( max_num(rows,l,r)>K ){
      if( l == r-1 ){ // 区間1でもKを超える場合NG
        return INT_MAX;
      } else { // 前のループで l~r-1 ではK超えなかったので，r-1で
        l = r-1;
        ++lines;
        _DB(printf("%d ", l));
      }
    } else {
      ++r;
    }
  }
  _DB(printf("\n"));
  return lines;
}

/* bitの1になっている位置をvectorに追加
   ただし最下位bitを位置1とみなす */
void bit_to_vec(vector<int>& v,int bits){
  //vector<int> *p = new vector<int>();
  int b = 0x1;
  for(int i=1;i!=H;++i){
    if( bits&b ){
      v.push_back(i);
    }
    b <<= 1;
  }
  return;
}

int main(void){
  init_mat();
  int res = INT_MAX;
  for(int b=0x0;b!=(0x1<<H);++b){ // bit全探索 0~1111..1b (H-1個)
    vector<int> rows;
    rows.push_back(0);
    bit_to_vec(rows, b);
    rows.push_back(H);
    res = min(res,greedy(rows)+rows.size()-2);
    _DB(printf("main %x min: %d\n", b, res));
  }
  cout << res << endl;
}

/* 例
3 5 4
11100
10001
00111
答え 2
*/


Compiler output:
a.cc: In function 'int greedy(std::vector<int>)':
a.cc:67:16: error: 'INT_MAX' was not declared in this scope
   67 |         return INT_MAX;
      |                ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <vector>
  +++ |+#include <climits>
    9 | //#include <algorithm>
a.cc: In function 'int main()':
a.cc:97:13: error: 'INT_MAX' was not declared in this scope
   97 |   int res = INT_MAX;
      |             ^~~~~~~
a.cc:97:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

/* ABC159 E
 * 2020.4.4~
 * H 1-10
 * W 1-10000
 * K 1-H*W
 */
#include <iostream>
#include <vector>
//#include <algorithm>
using namespace std;

//#define DB

#ifdef DB
#define _DB(f) \
{  \
f; \
}
#else
#define _DB(f)
#endif

inline int max(int x, int y){
  return (x>y)?x:y;
}
inline int min(int x, int y){
  return (x<y)?x:y;
}

int s[10][1000]; //最大
int H,W,K;

void init_mat(){
  cin >> H >> W >> K;
  string st;
  for(int i=0;i!=H;++i){
    cin >> st; // W桁の文字列で入力される
    for(int j=0;j!=W;++j){
      s[i][j] = st[j]-'0';
    }
  }
  return;
}

/* 行区切りのvectorが与えられたとき，
   ある列区間での各区画でのs=1となるセルの数の最大値 */
int max_num(vector<int> rows, int lcol, int rcol){
  int len = rows.size();
  int res = 0;
  for(int i=0;i!=len-1;++i){ // 行区間
    int trow = rows[i], brow = rows[i+1];
    int tmp = 0;
    for(int row=trow;row!=brow;++row){
      for(int col=lcol;col!=rcol;++col){
        tmp += s[row][col];
      }
    }
    res = max(res,tmp);
  }
  return res;
}

/* 行区切りのvectorが与えられたとき，
   (s==1)なセル数<=k に必要な列区切り数のgreedy算出 */
int greedy(vector<int> rows){
  int l=0, lines=0, r=1;
  _DB(printf("=greed: "));
  while(r!=W+1){
    if( max_num(rows,l,r)>K ){
      if( l == r-1 ){ // 区間1でもKを超える場合NG
        return INT_MAX;
      } else { // 前のループで l~r-1 ではK超えなかったので，r-1で
        l = r-1;
        ++lines;
        _DB(printf("%d ", l));
      }
    } else {
      ++r;
    }
  }
  _DB(printf("\n"));
  return lines;
}

/* bitの1になっている位置をvectorに追加
   ただし最下位bitを位置1とみなす */
void bit_to_vec(vector<int>& v,int bits){
  //vector<int> *p = new vector<int>();
  int b = 0x1;
  for(int i=1;i!=H;++i){
    if( bits&b ){
      v.push_back(i);
    }
    b <<= 1;
  }
  return;
}

int main(void){
  init_mat();
  int res = INT_MAX;
  for(int b=0x0;b!=(0x1<<H);++b){ // bit全探索 0~1111..1b (H-1個)
    vector<int> rows;
    rows.push_back(0);
    bit_to_vec(rows, b);
    rows.push_back(H);
    res = min(res,greedy(rows)+rows.size()-2);
    _DB(printf("main %x min: %d\n", b, res));
  }
  cout << res << endl;
}

/* 例
3 5 4
11100
10001
00111
答え 2
*/


Compiler output:
a.cc: In function 'int greedy(std::vector<int>)':
a.cc:71:16: error: 'INT_MAX' was not declared in this scope
   71 |         return INT_MAX;
      |                ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <vector>
  +++ |+#include <climits>
    9 | //#include <algorithm>
a.cc: In function 'int main()':
a.cc:101:13: error: 'INT_MAX' was not declared in this scope
  101 |   int res = INT_MAX;
      |             ^~~~~~~
a.cc:101:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 479001599;
const int maxn = 5e5 + 111;
        
using namespace std;          

int n, m, k, dp[2000][2000], ans;

int get(int x2, int y2, int x1, int y1){
	int x = dp[x2][y2] - dp[x2][y1] - dp[x1][y2] + dp[x1][y1];
	//cout << x1 << " " << y1 << " " << x2 << " " << y2 << " -> " << x << endl;
	return x;
}

void solve(){
	cin >> n >> m >> k;

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++){
			char x;
			cin >> x;
			dp[i][j] = x - '0';
			if (x == '0')
				//cout << i << " " << j << endl;
		}

	ans = n + m - 2;

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			dp[i][j] += dp[i][j - 1];
   	
   	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			dp[i][j] += dp[i - 1][j];

   	/*for (int i = 1; i <= n; i++){
   		for (int j = 1; j <= m; j++)
   			cout << dp[i][j] << " ";
   		cout << endl;
   	}*/  

	for (int mask = 0; mask < (1 << (n - 1)); mask++){
		//cout << mask << " ";
		vector <int> v;
		v.pb(0);
		for (int j = 0; j < n - 1; j++)
			if ((mask & (1 << j)) > 0)
				v.pb(j + 1);
		v.pb(n);
		int mx = sz(v) - 2;
		int pos = 0;
		for (int j = 1; j <= m; j++){
			for (int i = 0; i < sz(v) - 1; i++){
				int x = get(v[i + 1], j, v[i], pos);
				if (j - pos == 1 && x > k){
					mx = inf;
					break;
				}
				if (x > k){
					mx++;
					pos = j - 1;
					break;
				}
			}
		}
		//cout << ans << " " << mx << " " << mask << endl;
		ans = min(ans, mx);
	}

	cout << ans;
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:52:17: error: expected primary-expression before '}' token
   52 |                 }
      |                 ^
a.cc: At global scope:
a.cc:101:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  101 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
	int h,w;
	int K;
	char s[10][1000];
	cin>>h>>w>>K;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>s[i][j];
		}
	}
	int ans=1e9+7;
	for(int i=0;i<(1<<(h-1));i++){
		int cnt=0;
		vector<int> hoge;
		hoge.push_back(0);
		for(int j=0;j<h;j++){
			if(i&(1<<j)){
				hoge.push_back(j+1);
				cnt++;
			}
		}
		hoge.push_back(h);
		int sum[10][1000]={};
		for(int j=1;j<hoge.size();j++){
			for(int k=hoge[j-1];k<hoge[j];k++){
				for(int l=0;l<w;l++){
					sum[j-1][l]+=(s[k][l]=='1'?1:0);
				}
			}
		}
		bool ok=true;
		for(int j=0;j<hoge.size()-1;;j++){
			for(int k=0;k<w;k++){
				if(sum[j][k]>K){
					ok=false;
				}
			}
		}
		if(!ok){
			continue;
		}
		for(int j=0;j<w;j++){
			bool f=true;
			for(int k=0;k<hoge.size()-1;k++){
				if(sum[k][j]+sum[k][j-1]>K){
					f=false;
				}
			}
			if(f){
				for(int k=0;k<hoge.size()-1;k++){
					sum[k][j]+=sum[k][j-1];
				}
			}else{
				cnt++;
			}
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:45: error: expected primary-expression before ';' token
   35 |                 for(int j=0;j<hoge.size()-1;;j++){
      |                                             ^
a.cc:35:45: error: expected ')' before ';' token
   35 |                 for(int j=0;j<hoge.size()-1;;j++){
      |                    ~                        ^
      |                                             )
a.cc:35:46: error: 'j' was not declared in this scope
   35 |                 for(int j=0;j<hoge.size()-1;;j++){
      |                                              ^
Language: C++

 int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(n);
    rep(i, h) cin >> s[i];
    int ans = INF
    //最大数配列確保
    int[10][1000] c;

    // 1 << h-1 = 2^(h-1)
    //線を引くor引かないの２通り
    rep(div, 1 << h-1)
    {
         //2進数でビットが立っているところで分ける(div)
        int group =0;
        vector<int> id;
        rep(i,h)
        {
            id[i] = group;
            //シフトして１(線を引く)なら次からのグループをインクリする
            if(div >> i&1) group++;
        }
        //グループ数を表す為にインクリ
        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')
        bool ok = true;
        rep(i,g)rep(i,w) if(c[i][j] > k) ok = false;
        if(!Ok) continue;
        
        //縦に切っていく
        int num = g - 1;
        vector<int> now(g);
        auto add = [&](int j)
        {
            rep(i,g) 
            {
                now[i] += c[i][j];
                if(now[i] > k)
                   return false;
            }
            return true;
        };
        rep(j,w)
        {
            if(!add(j))
            {
                num++;
                now = vevtor<int>(g);
               add(j);
                
            }         
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;

Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin >> h >> w >> k;
      |     ^~~
a.cc:3:5: error: 'vector' does not name a type
    3 |     vector<string> s(n);
      |     ^~~~~~
a.cc:4:8: error: expected constructor, destructor, or type conversion before '(' token
    4 |     rep(i, h) cin >> s[i];
      |        ^
a.cc:5:15: error: 'INF' was not declared in this scope
    5 |     int ans = INF
      |               ^~~
a.cc:11:8: error: expected constructor, destructor, or type conversion before '(' token
   11 |     rep(div, 1 << h-1)
      |        ^
a.cc:57:5: error: 'cout' does not name a type
   57 |     cout << ans << endl;
      |     ^~~~
a.cc:58:5: error: expected unqualified-id before 'return'
   58 |     return 0;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
#define INF 0x3f3f3f3f
using namespace std;
const int maxn = 1005;
int h, w, K;
char a[maxn];
int sum[11][maxn], pos[11], cnt[11], chk[11];
int main() {
	ios::sync_with_stdio(false);
	cin >> h >> w >> K;
	for(int i = 1; i <= h; ++i) {
		gets(a);
		for(int j = 1; j <= w; ++j)
			sum[i][j] = sum[i - 1][j] + (a[j - 1] == '1');
	}
	int tot, ans = INF, cur;
	for(int i = 0; i < (1 << h); ++i) {
		memset(cnt, 0, sizeof(cnt));
		tot = 0, cur = 0;
		for(int j = 0; j < h - 1; ++j) {
			if((i >> j) & 1) 
				pos[++tot] = j + 1;
		}
		cur = tot, pos[++tot] = h;
		bool flag = false;
		for(int j = 1; j <= w; ++j) {
			for(int k = 1; k <= tot; ++k) {
				chk[k] = sum[pos[k]][j] - sum[pos[k - 1]][j];
				if(chk[k] > K) {
					flag = true;
					break;
				}
			}
			if(flag) break;
			for(int k = 1; k <= tot; ++k) {
				cnt[k] += chk[k];
				if(cnt[k] > K) {
					for(int l = 1; l <= tot; ++l)
						cnt[l] = chk[l];
					cur++;
					break;
				}
			}
		}
		if(flag) continue;
		ans = min(ans, cur);
	}
	cout << ans << endl;
	return 0;
}

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

#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
const int maxn = 1005;
int h, w, K;
char a[maxn];
int sum[11][maxn], pos[11], cnt[11], chk[11];
int main() {
	ios::sync_with_stdio(false);
	cin >> h >> w >> K;
	for(int i = 1; i <= h; ++i) {
		gets(a);
		for(int j = 1; j <= w; ++j)
			sum[i][j] = sum[i - 1][j] + (a[j - 1] == '1');
	}
	int tot, ans = INF, cur;
	for(int i = 0; i < (1 << h); ++i) {
		memset(cnt, 0, sizeof(cnt));
		tot = 0, cur = 0;
		for(int j = 0; j < h - 1; ++j) {
			if((i >> j) & 1) 
				pos[++tot] = j + 1;
		}
		cur = tot, pos[++tot] = h;
		bool flag = false;
		for(int j = 1; j <= w; ++j) {
			for(int k = 1; k <= tot; ++k) {
				chk[k] = sum[pos[k]][j] - sum[pos[k - 1]][j];
				if(chk[k] > K) {
					flag = true;
					break;
				}
			}
			if(flag) break;
			for(int k = 1; k <= tot; ++k) {
				cnt[k] += chk[k];
				if(cnt[k] > K) {
					for(int l = 1; l <= tot; ++l)
						cnt[l] = chk[l];
					cur++;
					break;
				}
			}
		}
		if(flag) continue;
		ans = min(ans, cur);
	}
	cout << ans << endl;
	return 0;
}

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

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


using namespace std;

int maxwhite, h, w;
int grid[10][1000];
int answer;



long long Deviding(int row, int datas) {

	if (row < h-1) {
		return min(Deviding(row + 1, datas + (1 << row)), Deviding(row + 1, datas));
	}

	long long ans = 0;

	vector<int> devidedata;

	//cout << "datas = " << datas << endl;


	for (int i = 0; i < h; i++) {
		if (datas % 2 == 1) devidedata.push_back(i);
		datas /= 2;
	}
	devidedata.push_back(h);

	int zenkai = 0;
	vector<int> whites(devidedata.size());

	for (int i = 0; i < w; i++) {
		for (int j = 0; j < devidedata.size(); j++) {
			for (int k = (j > 0) ? devidedata[j - 1] + 1 : 0; k <= min(devidedata[j], h - 1); k++) {
				//cout << "k=" << k << endl;
				whites[j] += grid[k][i];
				if (whites[j] > maxwhite) {
					//cout << "over" << endl;
					if (zenkai == i) return LONG_MAX;
					ans++;
					zenkai = i;
					for (int j = 0; j < whites.size(); j++) whites[j] = 0;
					j--; break;
				}
			}
		}

	}

	//cout << "answer = " << ans + whites.size() -1  << endl;
	return ans + whites.size() -1 ;
}



int main()
{
	cin >> h >> w >> maxwhite;

	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			grid[i][j] = atoi(s.substr(j, 1).c_str());
		}
	}

	cout << Deviding(0, 0) << endl;


	//cout << answer << endl;
}

Compiler output:
a.cc: In function 'long long int Deviding(int, int)':
a.cc:44:65: error: 'LONG_MAX' was not declared in this scope
   44 |                                         if (zenkai == i) return LONG_MAX;
      |                                                                 ^~~~~~~~
a.cc:4:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #include <string>
Language: C++

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


using namespace std;

int maxwhite, h, w;
int grid[10][1000];
int answer;



long long Deviding(int row, int datas) {

	if (row < h-1) {
		return min(Deviding(row + 1, datas + (1 << row)), Deviding(row + 1, datas));
	}

	long long ans = 0;

	vector<int> devidedata;

	//cout << "datas = " << datas << endl;


	for (int i = 0; i < h; i++) {
		if (datas % 2 == 1) devidedata.push_back(i);
		datas /= 2;
	}
	devidedata.push_back(h);

	int zenkai = 0;
	vector<int> whites(devidedata.size());

	for (int i = 0; i < w; i++) {
		for (int j = 0; j < devidedata.size(); j++) {
			for (int k = (j > 0) ? devidedata[j - 1] + 1 : 0; k <= min(devidedata[j], h - 1); k++) {
				//cout << "k=" << k << endl;
				whites[j] += grid[k][i];
				if (whites[j] > maxwhite) {
					//cout << "over" << endl;
					if (zenkai == i) return LLONG_MAX;
					ans++;
					zenkai = i;
					for (int j = 0; j < whites.size(); j++) whites[j] = 0;
					j--; break;
				}
			}
		}

	}

	//cout << "answer = " << ans + whites.size() -1  << endl;
	return ans + whites.size() -1 ;
}



int main()
{
	cin >> h >> w >> maxwhite;

	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			grid[i][j] = atoi(s.substr(j, 1).c_str());
		}
	}

	cout << Deviding(0, 0) << endl;


	//cout << answer << endl;
}

Compiler output:
a.cc: In function 'long long int Deviding(int, int)':
a.cc:44:65: error: 'LLONG_MAX' was not declared in this scope
   44 |                                         if (zenkai == i) return LLONG_MAX;
      |                                                                 ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #include <string>
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
#define vll vector<long long int>
#define vvll vector<vector<long long int>>
#define all(v) (v).begin(),(v).end()
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

//繰り返し2乗法
ll power(ll x, ll y){//繰り返し2乗法
  if(y < 0){
    return 0;
  }else if(y == 0){
    return 1LL;
  }else if(y%2 == 0){//偶数
    return power(x,y/2)*power(x,y/2);
  }else{//奇数
    return power(x,y-1)*x;
  }
}

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll H, W, K; cin >> H >> W >> K; 
  vector<string> str(H); FOR(i,H){ cin >> str[i]; }
  
  //二次元累積和
  vvll sum(H+1,vll(W+1,0));
  FOR(i,H){ FOR(j,W){ sum[i+1][j+1] = str[i][j]-'0'; } }
  FOR(i,H+1){ FOR(j,W){ sum[i][j+1] += sum[i][j]; } }
  FOR(j,W+1){ FOR(i,H){ sum[i+1][j] += sum[i][j]; } }
  
  //main
  ll ans = 1e18;
  for(int bit=0; bit<power(2,H-1); bit++){ //H-1桁目は絶対に1にならない。
    set<ll> st; st.insert(0); st.insert(H);
    for(int i=0; i<H; i++){
      if((bit>>i)%2){ st.insert(i+1); }//どこが切れているかを記憶。
    }
    
    ll tmp = 0;
    ll last = 0;
    
    for(int j=1; j<=W; j++){
      for(auto itr=st.begin(); itr != prev(st.end()); itr++){//*(prev(st.end()))はH。
        if((sum[*(next(itr))][j]-sum[*itr][j]-sum[*(next(itr))][last]+sum[*itr][last])>K){
          if(j-1 == last){
            goto ENDLOOP;
          }else{
            tmp ++; last = j-1;
            debug.insert(last);
            break;
          }
        }
      }
      if(j==W){
        for(auto itr=st.begin(); itr != prev(st.end()); itr++){
          if((sum[*(next(itr))][j]-sum[*itr][j]-sum[*(next(itr))][last]+sum[*itr][last])>K){
            goto ENDLOOP;
          }
        }
      }
    }
    tmp += st.size()-2;
    ans = min(ans, tmp);
    
    ENDLOOP:{}
  }
  
  // output
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:13: error: 'debug' was not declared in this scope
   76 |             debug.insert(last);
      |             ^~~~~
Language: C++

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

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 d = 1;
  for (int i=0;i<H-1;i++){
    d *= 2;
  }
  int mcut = 1008;
  vector<int> L(H);
  vector<int> C(0);
  vector<int> tmp(0);
  bool cutp = true, cutq = true;
  int cut, M = 0;
  int tmpp;
  for (int i=0;i<d;i++){
    tmpp = i;
    for (int j=1;j<H;j++){
      L[j] = L[j-1] + tmpp % 2;
      tmpp /= 2;
    }
    C = vector<int>(L[H-1]+1, 0);
    cutp = true, cutq = true;
    cut = L[H-1];
    for (int m=0;m<W;m++){
      tmp = vector<int>(L[H-1]+1, 0);
      for (int l=0;l<H;l++){
        if (S[l][m] == '1'){
          tmp[L[l]] += 1;
          C[L[l]] += 1;
        }
      }
      M = maxplan(C);
      if (cutq){
        cutq = false;
        if (M > K){
          cutp = false;
          break;
        }
      }
      else{
        if (M > K){
          cut += 1;
          C = tmp;
        }
      }
      tmp = vector<int>(L[H-1]+1, 0);
      if (cutp == false){
        break;
      }
    }
    if (cutp){
      if (cut < mcut){
        mcut = cut;
      }
    }
  }
  cout << mcut << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: 'maxplan' was not declared in this scope
   39 |       M = maxplan(C);
      |           ^~~~~~~
Language: C

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,k,cnt=0,a[11][1001],ch[11],ans=0x3f3f3f3f;
void work(int t)
{
	vector<int> tot(11,0);
	int cut=0;
	for(int i=1;i<=m;i++)
	{
		vector<int> now(11,0);
		bool flag=0;
		for(int l=1;l<=n;l++)
			now[ch[l]]+=a[l][i];
		for(int l=0;l<t;l++)
			cout<<now[l]<<"  ";
		cout<<endl;
		for(int l=0;l<t;l++)
			if(tot[l]+now[l]>k)
			{
				flag=1;
				break;
			}	
		if(flag)
			for(int l=0;l<t;l++)
				tot[l]=now[l];
		else
			for(int l=0;l<t;l++)
				tot[l]+=now[l];
		cut+=flag;
	}
	ans=min(ans,cut+t-1);
	cout<<ans; 
}
void dfs(int now,int t)
{ 
	if(now==n+1)
	{
		for(int i=1;i<=n;i++)
			cout<<ch[i];
		cout<<endl;
		work(t);
		cout<<endl; 
		return ;
	}
	ch[now]=t;
	cout<<now<<" "<<ch[now]<<endl;
	dfs(now+1,t);
	if(now!=1)
	{
		ch[now]=t+1;
		cout<<now<<" "<<ch[now]<<endl;
		dfs(now+1,t+1);
	}
}
signed main()
{
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		for(int l=1;l<=m;l++)
			a[i][l]=s[l-1]-'0';
	}
	dfs(1,1);
	cout<<ans;
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (auto&& e : s) {
    cin >> e;
  }
  int res = 1e9;
  for (int bt = 0; bt < 1 << (h - 1); ++bt) {
    vector<int> p{0};
    for (int i = 1; i < h; ++i) {
      if (bt >> (i - 1) & 1) {
        p.push_back(i);
      }
    }
    p.push_back(h);
    int n = p.size() - 1;
    int cur = n - 1;
    int l = 0, r = 0;
    while (l < w) {
      vector<int> c(n);
      while (r < w) {
        for (int t = 0; t < n; ++t) {
          for (int i = p[t]; i < p[t + 1]; ++i) {
            c[t] += s[i][r] == '1';
          }
        }
        if (*max_element(begin(c), end(c)) > k) {
          break;
          f=1;
        }
        ++r;
      }
      l = r;
      cur += l < w;
    }
    res = min(res, cur);
  }
  cout << res << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:11: error: 'f' was not declared in this scope
   35 |           f=1;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (auto&& e : s) {
    cin >> e;
  }
  int res = 1e9;
  for (int bt = 0; bt < 1 << (h - 1); ++bt) {
    vector<int> p{0};
    for (int i = 1; i < h; ++i) {
      if (bt >> (i - 1) & 1) {
        p.push_back(i);
      }
    }
    p.push_back(h);
    int n = p.size() - 1;
    int cur = n - 1;
    int l = 0, r = 0;
    while (l < w) {
      bool f=0;
      vector<int> c(n);
      while (r < w) {
        for (int t = 0; t < n; ++t) {
          for (int i = p[t]; i < p[t + 1]; ++i) {
            c[t] += s[i][r] == '1';
          }
        }
        if (*max_element(begin(c), end(c)) > k) {
          f=1;
          break;
        }
        ++r;
      }
      l = r;
      cur += l < w;
      if(f)
      {
      	break;
	  }
    }
    if(!f)
    res = min(res, cur);
  }
  cout << res << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'f' was not declared in this scope
   47 |     if(!f)
      |         ^
Language: C++

#include <bits/stdc++.h>

#define int long long

using namespace std;

const ll N = 3001;
const ll inf = INT_MAX;

int h, w, k, mat[N][N], pr[N][N], ans = inf;
string s[N];

signed main() {
    scanf("%d %d %d", &h, &w, &k);
    for (int i = 1; i <= h; ++i)
        cin >> s[i];
    for (int i = 1; i <= h; ++i)
        for (int j = 0; j < w; ++j)
            mat[i][j + 1] = (s[i][j] - '0');
    for (int i = 1; i <= h + 1; ++i)
        for (int j = 1; j <= w; ++j)
            pr[i][j] = pr[i][j - 1] + mat[i][j];
    for (int mask = 0; mask < (1 << (h - 1)); ++mask) {
        int cnt = __builtin_popcount(mask);
        int last = 0;
        for (int i = 1; i <= w + 1; ++i) {
            int col = 0;
            int mx = 0;
            for (int j = 1; j <= h; ++j) {
                col += pr[j][i] - pr[j][last];
                if (mask & (1<<(j - 1))) {
                    mx = max(mx , col);
                    col = 0;
                }
            }
            mx = max(mx , col);
            if (mx > k) {
                last = i - 1;
                cnt++;
            }
            col = 0;
        }
        ans = min(ans, cnt);
    }
    printf("%d", ans);
}


Compiler output:
a.cc:7:7: error: 'll' does not name a type
    7 | const ll N = 3001;
      |       ^~
a.cc:8:7: error: 'll' does not name a type
    8 | const ll inf = INT_MAX;
      |       ^~
a.cc:10:18: error: 'N' was not declared in this scope
   10 | int h, w, k, mat[N][N], pr[N][N], ans = inf;
      |                  ^
a.cc:10:21: error: 'N' was not declared in this scope
   10 | int h, w, k, mat[N][N], pr[N][N], ans = inf;
      |                     ^
a.cc:10:28: error: 'N' was not declared in this scope
   10 | int h, w, k, mat[N][N], pr[N][N], ans = inf;
      |                            ^
a.cc:10:31: error: 'N' was not declared in this scope
   10 | int h, w, k, mat[N][N], pr[N][N], ans = inf;
      |                               ^
a.cc:10:41: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   10 | int h, w, k, mat[N][N], pr[N][N], ans = inf;
      |                                         ^~~
      |                                         ynf
a.cc:11:10: error: 'N' was not declared in this scope
   11 | string s[N];
      |          ^
a.cc: In function 'int main()':
a.cc:16:16: error: 's' was not declared in this scope
   16 |         cin >> s[i];
      |                ^
a.cc:19:13: error: 'mat' was not declared in this scope
   19 |             mat[i][j + 1] = (s[i][j] - '0');
      |             ^~~
a.cc:19:30: error: 's' was not declared in this scope
   19 |             mat[i][j + 1] = (s[i][j] - '0');
      |                              ^
a.cc:22:13: error: 'pr' was not declared in this scope
   22 |             pr[i][j] = pr[i][j - 1] + mat[i][j];
      |             ^~
a.cc:22:39: error: 'mat' was not declared in this scope
   22 |             pr[i][j] = pr[i][j - 1] + mat[i][j];
      |                                       ^~~
a.cc:30:24: error: 'pr' was not declared in this scope
   30 |                 col += pr[j][i] - pr[j][last];
      |                        ^~
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int int64;

const int H = 15;
const int W = 1005;
int matr[H][W];
int whatType[H];
int aa[H];
int ans = H*W;
int h, w, k;

int checkk() {
	for(int hh = 1; hh <= h; hh++)
		aa[hh] = 0;
	for(int j = 1; j <= w; j++) {
		for(int i = 1; i <= h; i++)
			aa[whatType[i]] += matr[i][j];
		for(int i = 1; i <= h; i++)
			if(aa[whatType[i]] > k) return 100000000;
		for(int i = 1; i <= h; i++)
			aa[hh] = 0;
	}
	int curAns = 0;
	for(int j = 1; j <= w; j++) {
		for(int i = 1; i <= h; i++)
			aa[whatType[i]] += matr[i][j];
		bool flag = false;
		for(int i = 1; i <= h; i++)
			if(aa[whatType[i]] > k)
				flag = true;
		if(flag) {
			for(int hh = 1; hh <= h; hh++)
				aa[whatType[hh]] = 0;
			curAns++;
			j--;
		}
	}
	return curAns;
}

void fillRecursion(int pr, int curr) {
	whatType[curr] = pr;
	for(int i = curr+1; i <= h; i++) {
		fillRecursion(pr + 1, i);
		whatType[i] = pr;
	}
	int ch = checkk();
	ans = min(ans, ch + (pr-1));
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> h >> w >> k;
	for(int i = 1; i <= h; i++) {
		for(int j = 1; j <= w; j++) {
			char cc;
			cin >> cc;
			matr[i][j] = cc - '0';
		}
	}
	
	fillRecursion(1, 1);
	
	cout << ans << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int checkk()':
a.cc:24:28: error: 'hh' was not declared in this scope; did you mean 'h'?
   24 |                         aa[hh] = 0;
      |                            ^~
      |                            h
Language: C++

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

int c[10][1000];

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  
  int res = INF;
  
  rep(d, 1<<(h-1)){
    int g = 0;
    vector<int> id(h);
    rep(i, h){
      id[i] = g;
      if(d>>i & 1) ++g;
    } 
    ++g;
    
    rep(i, h) rep(j, w) c[i][j] = 0;
    rep(i, h) rep(j, w) c[id[i]][j] += (s[i][j] - '0');
    
    int cut = g-1;
    vector<int> n(g);
    
    auto add[&](int j){
      rep(i, g) n[i] += c[i][j];
      rep(i, g) if(n[i] > k) return false;
      return true;
    }
    
    rep(j, w){
      if(!add(j)){
        ++cut;
        n = vector<int>(g);
        if(!add(j)){
          cut = INF;
          break;
        }
      }
    }
    res = min(res, cut);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'INF' was not declared in this scope
   16 |   int res = INF;
      |             ^~~
a.cc:33:15: error: expected primary-expression before ']' token
   33 |     auto add[&](int j){
      |               ^
a.cc:2:19: error: expected primary-expression before 'for'
    2 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                   ^~~
a.cc:34:7: note: in expansion of macro 'rep'
   34 |       rep(i, g) n[i] += c[i][j];
      |       ^~~
a.cc:2:19: error: expected '}' before 'for'
    2 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                   ^~~
a.cc:34:7: note: in expansion of macro 'rep'
   34 |       rep(i, g) n[i] += c[i][j];
      |       ^~~
a.cc:33:23: note: to match this '{'
   33 |     auto add[&](int j){
      |                       ^
a.cc:34:11: error: 'i' was not declared in this scope
   34 |       rep(i, g) n[i] += c[i][j];
      |           ^
a.cc:2:35: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                                   ^
a.cc:40:11: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   40 |       if(!add(j)){
      |           ^~~
      |           std::filesystem::perm_options::add
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here
  219 |       add       = 0x2,
      |       ^~~
a.cc:41:11: error: 'cut' was not declared in this scope
   41 |         ++cut;
      |           ^~~
a.cc:42:9: error: 'n' was not declared in this scope
   42 |         n = vector<int>(g);
      |         ^
a.cc:42:25: error: 'g' was not declared in this scope
   42 |         n = vector<int>(g);
      |                         ^
a.cc:49:20: error: 'cut' was not declared in this scope
   49 |     res = min(res, cut);
      |                    ^~~
a.cc: At global scope:
a.cc:51:3: error: expected unqualified-id before 'return'
   51 |   return 0;
      |   ^~~~~~
a.cc:52:1: error: expected declaration before '}' token
   52 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <cstdio>
#include <bitset>


using namespace std;
using ll = long long;

#define rep(i, n)  for (ll i = 0; i < (n); i++)
#define INF 100000000

ll H, W, K;
vector<string> S;

bitset<16> divs;


bool sat(const vector<ll> &whites) {
  ll cnt = 0;

  rep(i, H) { // 切れ目の数なので
    cnt += whites[i];

    if (cnt > K) {
      return false;
    }

    if (divs[i] > 0)  {
      cnt = 0;
    }
  }

  return true;
}

ll check(bitset<16> divs) {
  ll cut = 0;
  bool ate = false;

  vector<ll> whites(10, 0);

  for (ll w = 0; w < W; w++) {
    rep(h, H) {
      if (S[h][w] == '1') {
        whites[h]++;
      }
    }

    if (sat(whites)) {
      ate = true;
    } else { //  unsat
      if (ate == false) {
        return INF; // impossible
      }

//      printf("cut at %lld\n", w);

      // cut and start from last bite
      cut++;
      w -= 1;
      ate = false;

      fill(whites.begin(), whites.end(), 0);
    }
  }
  return cut;
}

// void show() {
//   rep(i, H-1) {
//     printf("%lld ", divs[i]);
//   }
// }

ll search(ll h) {
  if (h >= H - 1) {
    ll c = check();
    ll a = accumulate(divs.begin(), divs.end(), 0LL);

//    show();
//    printf("a = %lld, c = %lld\n", a, c);

    return c + a;
  }

  ll tmp = search(h + 1);
  // make move
  divs[h] = 1;
  ll tmp2 = search(h + 1);
  divs[h] = 0;

  return min(tmp, tmp2);
}


int main() {
  cin >> H >> W >> K;

  rep(i, H) {
    string tmp; cin >> tmp;
    S.emplace_back(tmp);
  }

  ll result = search(0);

  cout << result << endl;
  return 0;
}

Compiler output:
a.cc: In function 'll search(ll)':
a.cc:82:17: error: too few arguments to function 'll check(std::bitset<16>)'
   82 |     ll c = check();
      |            ~~~~~^~
a.cc:41:4: note: declared here
   41 | ll check(bitset<16> divs) {
      |    ^~~~~
a.cc:83:28: error: 'class std::bitset<16>' has no member named 'begin'
   83 |     ll a = accumulate(divs.begin(), divs.end(), 0LL);
      |                            ^~~~~
a.cc:83:42: error: 'class std::bitset<16>' has no member named 'end'
   83 |     ll a = accumulate(divs.begin(), divs.end(), 0LL);
      |                                          ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

ll h,w,K;
void func(vector<ll>& dst, vector<ll>& src){
  for(int i = 0; i < w; ++i){
    dst[i]+= src[i];
    if(dst[i]>K)dst[0]= -1;
  }
}
int main(){
  cin >> h >> w >> K;
  vector<string> a(n);
  for(int i = 0; i < n; ++i)cin >> a[i];
  Graph s(h,vector<int>(w) );
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      if(a[i][j]=='1')s[i][j]=1;
    }
  }
  ll ans = INF;
  for(int i = 0; i < (1LL<<(h-1)); ++i){
    bitset<10> bs (i);
    ll cnt = bs.count();
    if(cnt>ans)continue;
    ll sz = cnt +1;
    vector<ll> group(sz);
    Graph vec(sz,vector<int>(w));
    ll now = 0;
    bool g = false;
    func(vec[now], s[0]);
    for(int j = 0; j < h-1; ++j){
      if(bs[j])++now;
      func(vec[now], s[j]);
      if(vec[now][0]==-1)g=true;
    }
    if(g)continue;
    vector<ll> tmp(sz);
    for(int j = 0; j < w; ++j){
      bool f = true;
      for(int k = 0; k < sz; ++k){
        tmp[k]+= vec[k][j];
        if(tmp[k])f = false;
      }
      if(f)continue;
      ++cnt;
      for(int k = 0; k < sz; ++k){
        tmp[k]= vec[k][j];
      }
    }
    ans = min(ans,cnt);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: 'n' was not declared in this scope
   23 |   vector<string> a(n);
      |                    ^
a.cc:41:9: error: invalid initialization of reference of type 'std::vector<long long int>&' from expression of type '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}
   41 |     func(vec[now], s[0]);
      |     ~~~~^~~~~~~~~~~~~~~~
a.cc:15:23: note: in passing argument 1 of 'void func(std::vector<long long int>&, std::vector<long long int>&)'
   15 | void func(vector<ll>& dst, vector<ll>& src){
      |           ~~~~~~~~~~~~^~~
a.cc:44:11: error: invalid initialization of reference of type 'std::vector<long long int>&' from expression of type '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}
   44 |       func(vec[now], s[j]);
      |       ~~~~^~~~~~~~~~~~~~~~
a.cc:15:23: note: in passing argument 1 of 'void func(std::vector<long long int>&, std::vector<long long int>&)'
   15 | void func(vector<ll>& dst, vector<ll>& src){
      |           ~~~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
const int N = 3010;
const int S = 3010;
const int mod = 998244353;
int n, s;
int a[N];
int dp[2][N][S];
int tmp[N][S];
//dp[0][i]: len - 2 
//dp[1][i]: len - 1 
int ans;
int main() {
	scanf("%d%d", &n, &s);
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) {
		dp[0][i][a[i]]++;
		ans = (ans + dp[0][i][s]) % mod;
		if (i < n) {
			dp[1][i][a[i]]++;
			dp[1][i][a[i + 1]]++;
			if (a[i] + a[i + 1] <= s) dp[1][i][a[i] + a[i + 1]]++;
			ans = (ans + dp[1][i][s]) % mod;
		}
	}
	for (int len = 3; len <= n; len++) {
		for (int i = 1; i + len - 1 <= n; i++) {
			int j = i + len - 1;
			tmp[i]
		}
	}
	printf("%d", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:31: error: expected ';' before '}' token
   30 |                         tmp[i]
      |                               ^
      |                               ;
   31 |                 }
      |                 ~
Language: C++




import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    Scanner sc = new Scanner(System.in);

    int h = sc.nextInt();
    int w = sc.nextInt();
    int k = sc.nextInt();

    char[][] arr = new char[h][w];

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        for (int i=0; i<h; i++) {
            arr[i] = sc.next().toCharArray();
        }

        int ans = Integer.MAX_VALUE;
        label:
        for (int i=0; i<1<<(h-1); i++) {
            int[][] a = new int[h][w];
            int varH = 0;
            int tmpAns = Integer.bitCount(i);
            for (int j=0; j<h; j++) {
                for (int l=0; l<w; l++) {
                    a[varH][l] += arr[j][l]-'0';
                }
                if ((i>>j & 1) == 1) {
                    varH++;
                }
            }
            int[] sum = new int[h];
            int front = 0;
            for (int j=0; j<w; j++) {
//                inner:
                for (int l=0; l<h; l++) {
                    sum[l] += a[l][j];
                    if (sum[l]>k) {
                        if (j==front) {
                            continue label;
                        }
                        front = j;
                        Arrays.fill(sum, 0);
                        tmpAns++;
                        j--;
//                        break ;
                    }
                }
            }
//            out.println(tmpAns);
//            out.flush();
            ans = Math.min(ans, tmpAns);
        }

        out.println(ans);
        out.flush();
    }
}


Compiler output:
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.PrintWriter;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Arrays;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Scanner;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C++

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

int main()
{
  int h, w, k;
  cin >> h >> w >> k;

  vector<string> s;
  for(int i = 0; i < h; ++i) cin >> s[i];

  int ans = h + w - 2;

  for(int horizonPat = 0; horizonPat < (1 << h-1); ++horizonPat)
  {
    vector<int> cutPos;
    cutPos.clear();
    cutPos.emplace_back(0);

    int tmpAns = 0;

    for(int i = 0; i < h; ++i)
    {
      if(horizonPat >> i & 1)
      {
        tmpAns++;
        cutPos.emplace_back(i+1);
      }
    }
    
    cutPos.emplace_back(h);

    vrctor<vector<int>> a;
    vector<int> b;
    a.clear();
    b.clear();

    for(int i = 0; i < cutPos.size(); ++i)
    {
      b.clear();
      
      for(int column = 0; column < w; ++column)
      {
        int cnt = 0;

        for(int row = cutPos.at(i); row < cutPos.at(i+1); ++row)
        {
          if(s[row][column]=='1') cnt++;
        }
        
        b.emplace_back(cnt);
      }

      a.emplace_back(b);
    }

    for(int verticalIdx = 0; verticalIdx < w; ++verticalIdx)
    {
      int startColimnIdx = 0;
      
      for(int i = 0; i < a.size(); ++i)
      {
        int checkVal = 0;
        
        for(int j = startColimnIdx; j <= verticalIdx; ++j)
        {
          checkVal += a.at(i).at(j);
          
          if(checkVal > k)
          {
            if(startColimnIdx == verticalIdx)
            {
              j = verticalIdx;
              i = a.size();
              verticalIdx == w;
              break;
            }
            else
            {
              startColimnIdx = verticalIdx;
              tmpAns++;
              break;
            }
          }
        }
      }
    }

    if(ans > tmpAns) ans = tmpAns;
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'vrctor' was not declared in this scope
   35 |     vrctor<vector<int>> a;
      |     ^~~~~~
a.cc:35:22: error: expected primary-expression before '>' token
   35 |     vrctor<vector<int>> a;
      |                      ^~
a.cc:35:25: error: 'a' was not declared in this scope
   35 |     vrctor<vector<int>> a;
      |                         ^
Language: C++

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

int main()
{
  int h, w, k;
  cin >> h >> w >> k;

  vector<string>;
  for(int i = 0; i < h; ++i) cin >> s[i];

  int ans = h + w - 2;

  for(int horizonPat = 0; horizonPat < (1 << h-1); ++horizonPat)
  {
    vector<int> cutPos;
    cutPos.clear();
    cutPos.emplace_back(0);

    int tmpAns = 0;

    for(int i = 0; i < h; ++i)
    {
      if(horizonPat >> i & 1)
      {
        tmpAns++;
        cutPos.emplace_back(i+1);
      }
    }
    
    cutPos.emplace_back(h);

    vrctor<vector<int>> a;
    vector<int> b;
    a.clear();
    b.clear();

    for(int i = 0; i < cutPos.size(); ++i)
    {
      b.clear();
      
      for(int column = 0; column < w; ++column)
      {
        int cnt = 0;

        for(int row = cutPos.at(i); row < cutPos.at(i+1); ++row)
        {
          if(s[row][column]=='1') cnt++;
        }
        
        b.emplace_back(cnt);
      }

      a.emplace_back(b);
    }

    for(int verticalIdx = 0; verticalIdx < w; ++verticalIdx)
    {
      int startColimnIdx = 0;
      
      for(int i = 0; i < a.size(); ++i)
      {
        int checkVal = 0;
        
        for(int j = startColimnIdx; j <= verticalIdx; ++j)
        {
          checkVal += a.at(i).at(j);
          
          if(checkVal > k)
          {
            if(startColimnIdx == verticalIdx)
            {
              j = verticalIdx;
              i = a.size();
              verticalIdx == w;
              break;
            }
            else
            {
              startColimnIdx = verticalIdx;
              tmpAns++;
              break;
            }
          }
        }
      }
    }

    if(ans > tmpAns) ans = tmpAns;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: declaration does not declare anything [-fpermissive]
   11 |   vector<string>;
      |   ^~~~~~~~~~~~~~
a.cc:12:37: error: 's' was not declared in this scope
   12 |   for(int i = 0; i < h; ++i) cin >> s[i];
      |                                     ^
a.cc:35:5: error: 'vrctor' was not declared in this scope
   35 |     vrctor<vector<int>> a;
      |     ^~~~~~
a.cc:35:22: error: expected primary-expression before '>' token
   35 |     vrctor<vector<int>> a;
      |                      ^~
a.cc:35:25: error: 'a' was not declared in this scope
   35 |     vrctor<vector<int>> a;
      |                         ^
a.cc:50:14: error: 's' was not declared in this scope
   50 |           if(s[row][column]=='1') cnt++;
      |              ^
Language: C++

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

int main()
{
	string s[12];
	int h, w, a;
	cin >> h >> w >> a;
	for (int i = 0; i < h; i++)
		cin >> s[i];
	int ans = 1e9;
	for (int i = 0; i < 1 << (h-1); i++)
	{
		int cnt = 0;
		bool flag = 1;
		for (int j = 0; j < (h-1); j++)
			if ((i >> j) & 1) cnt++;
		int cs = cnt, r[cnt+1] = {0};
		for (int j = 0; j < w; j++)
		{
			int c[cnt+1] = {0};
			int p, res; p = res = 0;
			for (int k = 0; k < h; k++)
			{
				c[p] += s[i][j] - '0';
				cs = max(cs, c[p]);
				if (i & (1 << k)) p++;
			}
			if (cs > a) { flag = 0; break; }
			res = 0;
			for (int k = 0; k <= x; k++)
				res = max(res, r[k] + c[k]);
			if (res > a) { memset(r, 0, sizeof r); cnt++; }
			for (int k = 0; k <= x; k++) r[k] += c[k];
		}
		if (flag)	ans = min(ans, cs);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:46: error: 'x' was not declared in this scope
   31 |                         for (int k = 0; k <= x; k++)
      |                                              ^
a.cc:34:46: error: 'x' was not declared in this scope
   34 |                         for (int k = 0; k <= x; k++) r[k] += c[k];
      |                                              ^