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

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

struct Time{
	int h , m ;
	time(){
		
	}
	void operator ++ (){
		m++;
		if( m == 60 ){
		 m = 0;
		 h ++ ;
		 if( h == 24 )
			 h = 0;
		}
	}

	int at(){
		if( (h>=11&&m>=0) &&( h <=14 && m <= 59) )return 0;
		if( ( h >=18&&m>=0 ) && (h<=20&&m<=59)) return 1;
		if( (h>=21&&m>=0)||(h<=1&&m<=59)) return 2;
		return 3;
	}
};
int ans[3][2];
int main(){
	int n ;while(~scanf("%d",&n),n){
		memset(ans,0,sizeof(ans));
		int a , b , c ;
		Time tmp;
		for(int i = 0 ; i< n ; ++ i ){
			scanf("%d:%d%d",&a,&b,&c);
			
			tmp.h = a;
			tmp.m = b;
			int aat = tmp.at();
			if( aat == 3  ) continue ;
			ans[aat][0]++;
			int k = 0 ;
			while( tmp.m != c ){
				tmp++;
				k++;
			}
			if( k <= 8 )
				ans[aat][1]++;
		}
		printf("lunch ");
		if( ans[0][0] == 0 ) printf("no guest\n");
		else printf("%d\n",ans[0][1]*100/ans[0][0]);
		printf("dinner ");
		if( ans[1][0] == 0 ) printf("no guest\n");
		else printf("%d\n",ans[1][1]*100/ans[1][0]);
		printf("midnight ");
		if( ans[2][0] == 0 ) printf("no guest\n");
		else printf("%d\n",ans[2][1]*100/ans[2][0]);
			
	}
}

Compiler output:
a.cc:9:9: error: ISO C++ forbids declaration of 'time' with no type [-fpermissive]
    9 |         time(){
      |         ^~~~
a.cc: In member function 'int Time::time()':
a.cc:11:9: warning: no return statement in function returning non-void [-Wreturn-type]
   11 |         }
      |         ^
a.cc: In function 'int main()':
a.cc:45:36: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   45 |                                 tmp++;
      |                                 ~~~^~
Language: Java

\import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int channelCnt = sc.nextInt();
		Queue queue = new PriorityQueue(1, new Main().new MyComparator());
		for(int i=0 ; i<channelCnt ; i++) {
			Bangumi bangumi = new Main().new Bangumi(sc.next(), sc.next(), sc.next());
			queue.add(bangumi);
		}
		int favCnt = sc.nextInt();
		List list = new ArrayList();
		for(int j=0 ; j<favCnt ; j++) {
			list.add(sc.next());
		}
		List favList = new ArrayList();
		Object[] o = queue.toArray();
		Arrays.sort(o, new Main().new MyComparator());
		for(int i=0 ; i<o.length ; i++) {
			Bangumi b = (Bangumi)o[i];
			for(int j=0 ; j<list.size() ; j++) {
				if(list.get(j).toString().equals(b.name)) {
					favList.add(b);
				}
			}
		}
		Queue queue2 = new PriorityQueue(1, new Main().new MyComparator());
		outside: for(int i=0 ; i<o.length ; i++) {
			Bangumi b = (Bangumi)o[i];
			boolean flg = true;
			for(int j=0 ; j<favList.size() ; j++) {
				Bangumi bb = (Bangumi)favList.get(j);
				if((b.time+30) > bb.time && (b.time+30) < (bb.time+30)) {
					flg = false;
				}
			}
			if(flg)
				queue2.add(b);
		}
		Object[] o1 = queue2.toArray();
		Arrays.sort(o1, new Main().new MyComparator());
		int beforeEnd = 0;
		int result = 0;
		for(int l=0 ; l<o1.length ; l++) {
			if(((Bangumi)o1[l]).time > beforeEnd) {
				result++;
				beforeEnd = ((Bangumi)o1[l]).time + 30;
			}
		}
		System.out.println(result);
	}









	public class MyComparator implements Comparator<Object> {
		public int compare(Object o1, Object o2) {
			Bangumi a = (Bangumi)o1;
			Bangumi b = (Bangumi)o2;

			if(a.time > b.time)
				return 1;
			else if(a.time < b.time) {
				return -1;
			}else {
				return 0;
			}
		}
	}



	public class Bangumi {
		String name;
		int time;
		public Bangumi(String name, String youbi, String time){
			this.name = name;
			this.time = new Integer((youbi + time)).intValue();
		}
	}
}

Compiler output:
Main.java:1: error: illegal character: '\'
\import java.util.ArrayList;
^
Main.java:1: error: class, interface, enum, or record expected
\import java.util.ArrayList;
        ^
Main.java:2: error: class, interface, enum, or record expected
import java.util.Arrays;
^
Main.java:3: error: class, interface, enum, or record expected
import java.util.Comparator;
^
Main.java:4: error: class, interface, enum, or record expected
import java.util.List;
^
Main.java:5: error: class, interface, enum, or record expected
import java.util.PriorityQueue;
^
Main.java:6: error: class, interface, enum, or record expected
import java.util.Queue;
^
Main.java:7: error: class, interface, enum, or record expected
import java.util.Scanner;
^
8 errors
Language: C++

import bisect

while(1):
    N=int(raw_input())
    if N==0: break
    D={}
    for i in range(N):
        inp=raw_input().split()
        inp[1:]=map(int, inp[1:])
        stt=inp[1]*24*60+inp[2]/100*60+inp[2]%100
        D[inp[0]]=stt
    P=int(raw_input())
    Tlist=[-99999999,999999999]
    for i in range(P):
        f=raw_input()
        Tlist.append(D.pop(f))
    Tlist.sort()
    for i in range(P+1):
        if Tlist[i+1]<Tlist[i]+30:
            print -1
            break
    else:
        ans=P
        E=sorted(D.values())
        for st in E:
            if (st - Tlist[ bisect.bisect(Tlist, st)-1])>= 30 and (Tlist[ bisect.bisect(Tlist, st)] - st ) >= 30:
                ans+=1
                bisect.insort(Tlist, st)
        print ans

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:5: error: expected unqualified-id before 'for'
    7 |     for i in range(N):
      |     ^~~
Language: C++

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

int n, p;
typedef pair<int, string> TV;

int main() {
	while(cin >> n, n) {
		vector<TV> tvs;
		for(int i = 0; i < n; i++) {
			string name;
			int week, start;
			cin >> name >> week >> start;
			tvs.push_back(TV(week * 60*24 + (start / 100 * 60) + start % 100, name));
		}
		vector<int> times;
		cin >> p;
		int curTime = -300;
		int tvCount = p;
		sort(tvs.begin(), tvs.end());
		for(int i = 0; i < p; i++) {
			string fav;
			cin >> fav;
			for(int j = 0; j < n; j++) {
				if(tvs[j].second == fav) {
					for(int k = 0; k < (int)times.size(); k++) {
						if(tvs[j].first < times[k] + 30 && times[k] < tvs[j].first + 30) {
							goto mirenai;
						}
					}
					times.push_back(tvs[j].first);
					break;
				}
			}
		}
		
//		sort(times.begin(), times)

		for(int i = 0; i < n; i++) {
			bool watchable = true;
			for(int k = 0; k < times.size(); k++) {
				if(tvs[i].first < times[k] + 30 && times[k] < tvs[i].first + 30) {
					watchable = false;
					break;
				}
			}
			if(!watchable || tvs[i].first < curTime + 30 && curTime < tvs[i].first + 30) {
			}
			else {
				tvCount++;
				curTime = tvs[i].first;
			}
		}
		
		cout << tvCount << endl;
		continue;
		
		mirenai:
		cout << -1 << endl;
	}
}

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

#include<iostream>
#include<string>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++)
static const int MAX = 500;
static const int L = 30;

bool overlap(int a, int b){
  if ( a > b ) swap(a, b);
  return a + 30 > b;
}

int getProgram(vector<int> v){
  sort(v.begin(), v.end());
  int dp[MAX];
  int maxv = v.size()>0?1:0;
  for ( int i = 0; i < v.size(); i++ ) dp[i] = 1;
  for ( int i = 1; i < v.size(); i++ ){
    for ( int j = i-1; j >= 0; j-- ){
      if ( !overlap(v[j], v[i]) ){
	dp[i] = dp[j]+1;
	maxv = max(maxv, dp[i]);
	break;
      }
    }
  }
  return maxv;
}

int solve(int N){
  int in[MAX], w, s, P;
  map<string, int> M;
  string name;
  vector<int> F, T;
  rep(i, N){
    cin >> name >> w >> s;
    M[name] = i;
    in[i] = w*1440 + (s/100)*60 + s%100;
  }
  cin >> P;
  rep(i, P){
    cin >> name;
    F.push_back(in[M[name]]);
  }

  int ans = getProgram(F);
  if ( ans == 0 ) return -1;

  rep(i, N){
    bool f = true;
    for ( int j = 0; j < F.size(); j++ ){
      if ( overlap(F[j], in[i]) ) { f = false; break; }
    }
    if ( f ) T.push_back(in[i]);
  }
  return ans + getProgram(T);
}

main(){
  int N;
  while(1){
    cin >> N;
    if ( N == 0 ) break;
    cout << solve(N) << endl;
  }
}

Compiler output:
a.cc: In function 'int getProgram(std::vector<int>)':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
a.cc: At global scope:
a.cc:62:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
using namespace std;
int main(){
	int n,i,r,last,time,day;
	for(;cin>>n,n;){
		vector<pair<int,string> >program;
		set<string>precious;
		string s;
		{
			map<string,int>m;
			for(;n--;){
				cin>>s>>day>>time;
				program.push_back(make_pair(day*1440+time/100*60+time%100,s));
				m[s]=day*1440+time/100*60+time%100;
			}
			for(cin>>n;n--;){
				cin>>s;
				set<string>::iterator it=precious.begin();
				for(;it!=precious.end();it++){
					if(abs(m[*it]-m[s])<30){puts("-1");goto next;}
				}
				precious.insert(s);
			}
		}
		sort(program.begin(),program.end());
		for(last=r=i=0;i<program.size();i++){
			if(program[i].first>=last){
				last=program[i].first+30;
				r++;
			}else if(precious.find(program[i].second)!=precious.end()){
				last=program[i].first+30;
			}
		}
		printf("%d\n",r);
		next:;
	}
}

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

/*
 *       Author:  8mao
 * Created Time:  2014/3/16 13:31:26
 *    File Name:  1331.cpp
 */
# include<map>
# include<set>
# include<cmath>
# include<queue>
# include<stack>
# include<vector>
# include<string>
# include<cstdio>
# include<cstring>
# include<iostream>
# include<algorithm>
# include<functional>
using namespace std;

typedef pair<int,int> PII;
# define INF 1<<30
# define LL long long
# define MOD 1000000007
# define VI vector<int>
# define VLL vector<LL>
# define VS vector<string>
# define PII pair<int,int>

# define F first
# define S second
# define mp make_pair
# define pb push_back
# define lb lower_bound
# define up upper_bound
# define lowbit(x)(x&-x)
# define lson l,m,rt<<1
# define rson m+1,r,rt<<1|1
# define clr(x) (x).clear()
# define sz(x) ((int)(x).size())
# define all(x) (x).begin(),(x).end()
# define mem(x,y) memset(x,y,sizeof(x))
# define forall(it,c) for(typeof((c).begin())it=(c).begin();it!=(c).end();it++)

# define N 505
# define M 20005
PII a[N];
int dp[N][M], n;

struct node
{
    char s[50];
    int t, must, del;
}e[N];

int calc(int week, int time)
{
    int ans = week * 24 * 60;
    ans += time % 100 + (time / 100 * 60);
    return ans;
}

int dfs(int pos, int end)
{
    int ans = 0;
    if (pos == n + 1)
        return 0;
    if (dp[pos][end] != -1)
        return dp[pos][end];
    if (a[pos].S || a[pos].F >= end) //must  譛牙庄閭ス莨壼?髞?        ans = max (ans, 1 + dfs(pos + 1, a[pos].F + 30));
    ans = max (ans, dfs(pos + 1, end));
    return dp[pos][end] = ans;
}

int Jireh(int m)
{
    int i,  j;
    for (i = 1; i <= m; i++)
         if (e[i].must)
   		{
             for (j = 1; j <= m; j++)
                 if (j != i && abs(e[j].t - e[i].t) < 30)  //豕ィ諢冗せ,譛牙庄閭ス莨壼?髞?                    e[j].del = 1;
        }
    for (i = 1; i <= m; i++)
         if (e[i].must && e[i].del)
            return 0;
    n = 0;
    for (i = 1; i <= m; i++)
         if (!e[i].del)
        {
            ++n;
            a[n].F = e[i].t;
            a[n].S = e[i].must;
        }
    return 1;
}

int cmp(const node &a, const node &b)
{
    return a.t < b.t;
}

int main()
{
    int i, j, n, m, x, y;
    char s[50];
    while (scanf ("%d", &n) != EOF && n)
    {
        mem (dp, -1);
        for (i = 1; i <= n; i++)
        {
            scanf ("%s", e[i].s);
            scanf ("%d %d", &x, &y);
            e[i].t = calc(x, y);
            e[i].must = e[i].del = 0;
        }
        scanf ("%d", &m);
        for (i = 1; i <= m; i++)
        {
            scanf ("%s", s);
            for (j = 1; j <= n; j++)
                if (strcmp(e[j].s, s) == 0)
                {
                    e[j].must = 1;
                    break;
                }
        }
        sort (e + 1, e + n + 1, cmp);
        if (!Jireh(n))
        {
            printf ("-1\n");
            continue;
        }
        int ans = dfs(1, 0);
        printf ("%d\n", ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int Jireh(int)':
a.cc:82:9: error: expected primary-expression before '}' token
   82 |         }
      |         ^
Language: C++

#include<algorithm>
using namespace std;

int main(){
  int n,m;
  int x[100],y[100],c[100];
  int r[100],tmp1,tmp2;
  int cost,total;
  int i,j;

  while(1){
    cin >> n >> m;
    if(!n && !m)break;

    total = 0;
    for(i=0;i<m;i++){
      cin >> x[i] >> y[i] >> c[i];
      total += c[i];
    }
    for(i=0;i<n;i++)r[i] = i;

    for(i=0;i<m;i++){
      for(j=i+1;j<m;j++){
	if(c[i] < c[j]){
	  swap(x[i],x[j]);
	  swap(y[i],y[j]);
	  swap(c[i],c[j]);
	}
      }
    }
    cost = 0; 
    for(i=0;i<m;i++){
      tmp1 = r[0];
      tmp2 = -1;
      for(j=1;j<n;j++){
	if(tmp1 != r[j]){
	  if(tmp2 < 0)tmp2 = r[j];
	  else if(tmp2 != r[j])break;
	}
      }
      if(j==n)break;

      if(r[x[i]] != r[y[i]]){
	cost += c[i];
	tmp1 = r[y[i]];
	for(j=0;j<n;j++){
	  if(r[j] == tmp1)r[j] = r[x[i]];
	}
      }
    }

    i++;
    while(c[i]>=0 && i<m){
      if(r[x[i]] == r[y[i]])cost += c[i];
      i++;
    }

    cout << total - cost << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> n >> m;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:58:5: error: 'cout' was not declared in this scope
   58 |     cout << total - cost << endl;
      |     ^~~~
a.cc:58:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:58:29: error: 'endl' was not declared in this scope
   58 |     cout << total - cost << endl;
      |                             ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int n,m;
int x[100],y[100],c[100];
bool use[100];

bool union_find(void){
  int i,j;
  int tmp,tmp2;
  int g[100];
  for(i=0;i<n;i++)g[i] = i;
  
  for(i=0;i<m;i++){
    if(g[x[i]]!=g[y[i]] && !use[i]){
      tmp = g[x[i]];
      for(j=0;j<n;j++){
	if(g[j] == tmp)g[j] = g[y[i]];
      }
    }
  }
  
  tmp = g[0];
  tmp2 = -1;
  for(i=1;i<n;i++){
    if(tmp != g[i]){
      if(tmp2 < 0)tmp2 = g[i];
      else if(tmp2 != g[i])return false;
    }
  }
  if(tmp2 < 0)return false;
  return true;
}

int main(){
  int cost;
  int i,j;

  while(1){
    cin >> n >> m;
    if(!n && !m)break;

    for(i=0;i<m;i++){
      cin >> x[i] >> y[i] >> c[i];
      use[m] = false;
    }

    if(union_find()){
      cost = 0;
      cout << "no reduce" << endl;
    }
    else cost = INT_MAX;

    for(i=0;i<m;i++){
      for(j=0;j<m;j++){
	use[i] = true;
	use[j] = true;

	if(union_find()){
	  if(i==j){
	    if(cost > c[i])cost = c[i];
	  }else{
	    if(cost > c[i] + c[j])cost = c[i] + c[j];
	  }
	}

	use[i] = false;
	use[j] = false;
      }
    }

    cout << cost << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: 'INT_MAX' was not declared in this scope
   53 |     else cost = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
using namespace std;

typedef struct
{
  int to, cap, rev;
} Edge;

const int MAX_N = 100, INF = 1 << 30;
bool used[MAX_N];

void add_edge(vector<vector<Edge> >& G, int from, int to, int cap)
{
  Edge e1 = { to, cap, G[to].size() };
  G[from].push_back(e1);
  Edge e2 = { from, 0, G[from].size()-1 };
  G[to].push_back(e2);
}

int solve(vector<vector<Edge> >& G, int s, int t, int f)
{
  if (s == t)
    return f;
  
  used[s] = true;
  for (unsigned int i = 0; i < G[s].size(); ++i) {
    Edge& e = G[s][i];
    if (!used[e.to] && e.cap > 0) {
      int d = solve(G, e.to, t, min(e.cap, f));
      if (d > 0) {
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(vector<vector<Edge> > G, int s, int t)
{
  int flow = 0;
  for ( ; ; ) {
    memset(used, 0, sizeof(used));
    int f = solve(G, s, t, INF);
    if (f == 0)
      return flow;
    flow += f;
  }
}

int main()
{
  int n, m;
  while (~scanf("%d %d", &n, &m)) {
    if (n == 0 && m == 0)
      break;

    vector<vector<Edge> > G(n);
    int rev = 0;
    for (int i = 0; i < m; ++i) {
      int x, y, c;
      scanf("%d %d %d", &x, &y, &c);
      if (c < 0) {
	rev += c;
	c = 0;
      }
      add_edge(G, x, y, c);
    }

    int ans = INF;
    for (int i = 0; i < n; ++i) {
      for (int j = i+1; j < n; ++j) {
	ans = min(ans, max_flow(G, i, j));
      }
    }
    printf("%d\n", ans+rev);
  }
  return 0;
}

Compiler output:
a.cc: In function 'void add_edge(std::vector<std::vector<Edge> >&, int, int, int)':
a.cc:28:34: warning: narrowing conversion of '(&(& G)->std::vector<std::vector<Edge> >::operator[](((std::vector<std::vector<Edge> >::size_type)to)))->std::vector<Edge>::size()' from 'std::vector<Edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   28 |   Edge e1 = { to, cap, G[to].size() };
      |                        ~~~~~~~~~~^~
a.cc:30:38: warning: narrowing conversion of '((&(& G)->std::vector<std::vector<Edge> >::operator[](((std::vector<std::vector<Edge> >::size_type)from)))->std::vector<Edge>::size() - 1)' from 'std::vector<Edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   30 |   Edge e2 = { from, 0, G[from].size()-1 };
      |                        ~~~~~~~~~~~~~~^~
a.cc: In function 'int max_flow(std::vector<std::vector<Edge> >, int, int)':
a.cc:58:5: error: 'memset' was not declared in this scope
   58 |     memset(used, 0, sizeof(used));
      |     ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   15 | #include <stack>
  +++ |+#include <cstring>
   16 | using namespace std;
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>

using namespace std;

#define typec __int64
#define V 111
//const typec inf = 0x3f3f3f3f;
const typec maxw = 111;
typec g[V][V], w[V];
typec a[V], v[V], na[V];

typec Stoer_Wagner(int n)
{
    int i, j, pv, zj;
    typec best = maxw * n * n;
    for (i = 0; i < n; i++) v[i] = i; // vertex: 0 ~ n-1
    while (n > 1)
    {
        for (a[v[0]] = 1, i = 1; i < n; i++)
        {
            a[v[i]] = 0;
            na[i - 1] = i;
            w[i] = g[v[0]][v[i]];

        }
        for (pv = v[0], i = 1; i < n; i++ )
        {
            for (zj = -1, j = 1; j < n; j++ )
                if (!a[v[j]] && (zj < 0 || w[j] > w[zj]))

                    zj = j;
            a[v[zj]] = 1;
            if (i == n - 1)
            {
                if (best > w[zj]) best = w[zj];
                for (i = 0; i < n; i++)
                    g[v[i]][pv] = g[pv][v[i]] += g[v[zj]][v[i]];
                v[zj] = v[--n];
                break;
            }
            pv = v[zj];
            for (j = 1; j < n; j++)
                if(!a[v[j]])
                    w[j] += g[v[zj]][v[j]];
        }
    }
    return best;
}

int main()
{
    //freopen("G:\\in.txt","r",stdin);
    int n, m, u, v, w;
    while(scanf("%d%d", &n, &m) != EOF,n+m)
    {
        memset(g, 0, sizeof(g));
        while(m --)
        {
            scanf("%d%d%d", &u, &v, &w);
            g[u][v] += w;
            g[v][u] += w;
        }
        printf("%lld\n", Stoer_Wagner(n));
    }
    return 0;
}

Compiler output:
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
   15 | #define typec __int64
      |               ^~~~~~~
a.cc:18:7: note: in expansion of macro 'typec'
   18 | const typec maxw = 111;
      |       ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
   15 | #define typec __int64
      |               ^~~~~~~
a.cc:19:1: note: in expansion of macro 'typec'
   19 | typec g[V][V], w[V];
      | ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
   15 | #define typec __int64
      |               ^~~~~~~
a.cc:20:1: note: in expansion of macro 'typec'
   20 | typec a[V], v[V], na[V];
      | ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
   15 | #define typec __int64
      |               ^~~~~~~
a.cc:22:1: note: in expansion of macro 'typec'
   22 | typec Stoer_Wagner(int n)
      | ^~~~~
a.cc: In function 'int main()':
a.cc:66:16: error: 'g' was not declared in this scope
   66 |         memset(g, 0, sizeof(g));
      |                ^
a.cc:73:26: error: 'Stoer_Wagner' was not declared in this scope
   73 |         printf("%lld\n", Stoer_Wagner(n));
      |                          ^~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
const double eps=1e-8;

int sgn(double d)
{
    if (d>eps) return 1;
	if (d<-eps) return -1;
	return 0;
}

struct point
{
    double x,y;
	point(double _x=0,double _y=0):x(_x),y(_y){}
	void input()
	{
	   scanf("%lf%lf",&x,&y);
	}
	double len()
	{
	   return sqrt(x*x+y*y);
	}
}p[30010];
point operator+(const point& p1,const point& p2)
{
    return point(p1.x+p2.x,p1.y+p2.y);
}
point operator-(const point& p1,const point& p2)
{
    return point(p1.x-p2.x,p1.y-p2.y);
}

double yy1[30010],yy2[30010];
double sum[30010];
int he[30010];
int n,m;
double s,w,h;
int a[30010];

bool check(double yy1,double yy2,point p)
{
   double y=yy1+((yy2-yy1)/(double)w)*p.x;
   return sgn(y-p.y)>=0;
}

int find_pos(point p)
{
   int L=1,R=m;
   while(L<R)
   {
      if (L==R-1) break;
	  int mid=(L+R)>>1;
	  if (check(yy1[mid],yy2[mid],p)) R=mid;
	  else L=mid;
   }
   if (check(yy1[L],yy2[L],p)) R=L;
   return R;
}

int main()
{
	while(scanf("%d%d%lf%lf%lf",&n,&m,&w,&h,&s))
	{
	   if (n+m+w+h+s==0) break;
	   yy1[0]=0;yy2[0]=0;
	   for (int i=1;i<=m;i++)
	   {
	      scanf("%lf%lf",&yy1[i],&yy2[i]);
	   }
	   for (int i=0;i<n;i++)
		   p[i].input();
	   memset(a,0,sizeof(a));
	   for (int i=0;i<n;i++)
	   {
		   a[find_pos(p[i])]++;
	   }
	   memset(he,0,sizeof(he));
	   for (int i=1;i<=m;i++)
		   he[i]=he[i-1]+a[i];
	   for (int i=1;i<=m;i++)
		   sum[i]=(yy1[i]+yy2[i])*w/2.0;
	   double ts=0;
	   a[m+1]=0;
	   int tmp=0,ans=100000000;
	   for (int i=m;i>=1;i--)
	   {
		  tmp+=a[i+1];
	      ts=(2*h-yy1[i]-yy2[i])*w/2.0;
		  int L=1,R=i;
		  while(L<R)
		  {
		     if (L==R-1) break;
			 int mid=(L+R)>>1;
			 if (sgn(ts+sum[mid]-s)>=0) R=mid;
			 else L=mid;
		  }
		  if (sgn(ts+sum[L]-s)>=0) R=L;
		  ans=min(ans,he[R]+tmp);
	   }
	   printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:12: error: 'memset' was not declared in this scope
   76 |            memset(a,0,sizeof(a));
      |            ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
#include<cstring>
using namespace std;

const int INFI = 1 << 30;
const int V = 20;

int n;
int use[V], ans[V];
struct MAT
{
	int lx,ly,rx,ry,id;
	void rd()
	{
		scanf("%d%d%d%d",&lx,&ly,&rx,&ry);
	}
	bool operator <(const MAT &a)const
	{
		return lx < a.lx || (lx == a.lx && ly < a.ly); 
	}
}mat[V];

int main()
{
	bool first = true;
	while (1)
	{
		scanf("%d",&n);
		if (n == 0) break;
		
		for (int i=0;i<n;i++)
		{
			mat[i].rd();
			mat[i].id = i;
		}
		sort(mat,mat+n);
		memset(use,0,sizeof(use));
		int now = 0;
		while (1)
		{
			if (c != -1)
			{
			int topx = -INFI, topy = INFI, c = -1;
			for (int j=0;j<n;j++)
			if (!use[j] && (mat[j].lx > topx || (mat[j].lx == topx && mat[j].ly < topy)) )
			{
				topx = mat[j].lx;
				topy = mat[j].ly;
				c = j;
				break;
			}
			printf("c is %d %d\n",mat[c].id,mat[c].ry);
			if (c != -1) 
				use[c] = ++now;
			else	break;
			
			int bx = mat[c].rx;
			int by = mat[c].ry;
			bool find;
			do
			{
				find = false;
				for (int k=0;k<n;k++)
				if (mat[k].lx == bx && mat[k].ry == by)
				{
					find = true;
					bx = mat[k].rx;
				}		
			}while (find);
			
			int get = -1;
			for (int k=0;k<n;k++)
			if (!use[k] && mat[k].lx <= bx && mat[k].ly >= mat[c].ry)
			{
				//printf("color %d\n",mat[k].id);
				use[k] = ++now;
				get = k;			
				break;
			}
			//if (get != -1) c = 
		}
		if (!first) printf("\n"); 
		first = false;
		
		for (int i=0;i<n;i++) ans[ mat[i].id ] = use[i];
		for (int i=0;i<n;i++)
			printf("%d\n",ans[i]);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:29: error: 'c' was not declared in this scope
   42 |                         if (c != -1)
      |                             ^
a.cc:44:56: error: redeclaration of 'int c'
   44 |                         int topx = -INFI, topy = INFI, c = -1;
      |                                                        ^
a.cc:42:29: note: '<typeprefixerror>c' previously declared here
   42 |                         if (c != -1)
      |                             ^
a.cc:90:2: error: expected '}' at end of input
   90 | }
      |  ^
a.cc:25:1: note: to match this '{'
   25 | {
      | ^
Language: C

#include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>
#include <vector>

using namespace std;

int n, dat[(1 << 21) - 1];

void init(int size)
{
    int i;
    n = 1;
    while (n < size){
        n *= 2;
    }
    
    for (i = 0; i < 2 * n - 1; i++){
        dat[i] = INT_MAX;
    }
}

void update(int k, int x)
{
    k += n - 1;
    dat[k] = x;
    while (k > 0){
        k = (k - 1) / 2;
        dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}


int x1, x2, y1, y2;
int w, h, q;

int query(int a, int b, int k, int l, int r)
{
    int vl, vr;
    
    if (r <= a || b <= l){
        return (INT_MAX);
    }
    if (a <= l && r <= b){
        return (dat[k]);
    }
    else {
        vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return (min(vl, vr));
    }
}

int main(void)
{
    int t;
    int i, j;
    int ans;
    
    while (1){
        scanf("%d%d%d", &h, &w, &q);
        
        if (w + h + q == 0){
            break;
        }
        
        init(w * h);
        for (i = 0; i < h; i++){
            for (j = 0; j < w; j++){
                scanf("%d", &t);
                update(i * w + j, t);
            }
        }
        
        for (j = 0; j < q; j++){
            scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
            ans = INT_MAX;
            if (x1 == 0 && x2 == w - 1){
            	printf("%d\n", query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
            }
            else {
	            for (int k = y1; k <= y2; k++){
    	        	ans = min(ans, query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
        	    }
            	printf("%d\n", ans);
            }
        }
    }
    
    return (0);
}

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

#include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>
#include <vector>

using namespace std;

int n, dat[(1 << 21) - 1];

void init(int size)
{
    int i;
    n = 1;
    while (n < size){
        n *= 2;
    }
    
    for (i = 0; i < 2 * n - 1; i++){
        dat[i] = INT_MAX;
    }
}

void update(int k, int x)
{
    k += n - 1;
    dat[k] = x;
    while (k > 0){
        k = (k - 1) / 2;
        dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}


int x1, x2, y1, y2;
int w, h, q;

int query(int a, int b, int k, int l, int r)
{
    int vl, vr;
    
    if (r <= a || b <= l){
        return (INT_MAX);
    }
    if (a <= l && r <= b){
        return (dat[k]);
    }
    else {
        vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return (min(vl, vr));
    }
}

int main(void)
{
    int t;
    int i, j;
    int ans;
    
    while (1){
        scanf("%d%d%d", &h, &w, &q);
        
        if (w + h + q == 0){
            break;
        }
        
        init(w * h);
        if (h >= w){
	        for (i = 0; i < h; i++){
    	        for (j = 0; j < w; j++){
        	        scanf("%d", &t);
            	    update(i * w + j, t);
            	}
        	}
        }
        else {
        	for (i = 0; i < h; i++){
        		for (j = 0; j < w; j++){
        			scanf("%d", &t);
        			update(i + j * h, t);
        		}
        	}
        }
        
        for (j = 0; j < q; j++){
            scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
            ans = INT_MAX;
            if (x1 == 0 && x2 == w - 1){
            	printf("%d\n", query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
            }
            else {
            	if (h >= w){
		            for (int k = y1; k <= y2; k++){
    		        	ans = min(ans, query(k * w + x1, k * w + x2 + 1, 0, 0, n));
        		    }
        		}
        		else {
        			for (int k = x1; k <= x2; k++){
        				ans = min(ans, query(k * h + y1, k * h + y2 + 1, 0, 0, n));
        			}
        		}
            	printf("%d\n", ans);
            }
        }
    }
    
    return (0);
}

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

#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <climits>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second

typedef long long int lli;
typedef pair<int,int> Pi;

const int INF=100000000;
const long long int INF_=100000000000000000;

lli Cmin(const lli a,const lli b){
	if(a<b) return a;
	else return b;
}

class SegmentTree{
	private:
	static const lli MAX_N=1<<31;
	lli dat[2*MAX_N-1];
	public:
	int n;
	void Init(int n_){
		n=1;
		while(n<n_) n*=2;
		for(int i=0; i<2*n-1; ++i) dat[i]=INF_;
	}
	void Update(int k,lli a){
		k+=n-1;
		dat[k]=a;
		while(k>0){
			k=(k-1)/2;
			dat[k]=Cmin(dat[k*2+1],dat[k*2+2]);
		}
	}
	lli Query(int a,int b,int k,int l,int r){
		if(r<=a||b<=l) return INF_;
		if(a<=l&&r<=b) return dat[k];
		else {
			lli vl=Query(a,b,k*2+1,l,(l+r)/2);
			lli vr=Query(a,b,k*2+2,(l+r)/2,r);
			return min(vl,vr);
		}
	}
	int GetData(const int k){
		return dat[k];
	}
};

int Serialize(const int y,const int x,const int w){
	return x+y*w;
}

int solve(){
	int R,C,Q;
	cin >> R >> C >> Q;
	if(R==0&&C==0&&Q==0) return 0;
	SegmentTree st;
	st.Init(R*C);
	REP(y,0,R) REP(x,0,C){
		lli tmp;
		cin >> tmp;
		st.Update(Serialize(y,x,C),tmp);
	}
	/*
	REP(i,0,R*C+st.n-1) cout << st.GetData(i) << endl;
	cout << endl;
	*/
	REP(i,0,Q){
		int r[2],c[2];
		REP(j,0,2) cin >> r[j] >> c[j];
		lli ans=INF_;
		REP(y,r[0],r[1]+1) ans=Cmin(ans,st.Query(Serialize(y,c[0],C),Serialize(y,c[1]+1,C),0,0,st.n));
		cout << ans << endl;
	}
	//REP(i,0,R*C) cout << st.GetData(i) << endl;
	//REP(y,0,R) REP(x,0,C) cout << st.GetData(Serialize(y,x,C)) << endl;
	return 1;
}

int main(){
	while(solve());
	return 0;
}

Compiler output:
a.cc:39:26: error: narrowing conversion of '-4294967297' from 'long long int' to 'long unsigned int' [-Wnarrowing]
   39 |         lli dat[2*MAX_N-1];
      |                          ^
a.cc:39:24: error: size '-4294967297' of array 'dat' is negative
   39 |         lli dat[2*MAX_N-1];
      |                 ~~~~~~~^~
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>

using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 10000000000
#define N 1000000000
int r,c,q;
int input;
vector<int> zu[1000];
int aaa,bbb,aa,bb;
int ans;
int n;
int ima;
int dat[1000][4*N];
void init(int n_)
{
	n=1;
	while(n<n_)n*=2;
	rep(i,2*n-1)rep(j,1000)dat[j][i]=INF;
}
void update(int k,int a)
{
	k+=n-1;
	dat[ima][k]=a;
	while(k>0)
	{
		k=(k-1)/2;
		dat[ima][k]=min(dat[ima][k*2+1],dat[ima][k*2+2]);
	}
}
int query(int a,int b,int k,int l,int r)
{
	if(r<=a||b<=l)return INF;
	if(a<=l&&r<=b)return dat[ima][k];
	else
	{
		int v1=query(a,b,k*2+1,l,(l+r)/2);
		int v2=query(a,b,k*2+2,(l+r)/2,r);
		return min(v1,v2);
	}
}
int main()
{
	while(1)
	{
		rep(i,1000)zu[i].clear();
		cin>>r>>c>>q;
		if(r==0)break;
		if(r<=c)
		{
			rep(i,r)
			{
				rep(j,c)
				{
					cin>>input;
					zu[i].push_back(input);
				}
			}
		}
		else
		{
			rep(i,r)
			{
				rep(j,c)
				{
					cin>>input;
					zu[j].push_back(input);
				}
			}
			swap(r,c);
		}
		/*rep(i,r)
		{
			rep(j,c)cout<<zu[i][j]<<" ";
			cout<<endl;
		}*/
		init(c);
		//cout<<"n:"<<n<<endl;
		rep(i,r)
		{
			ima=i;
			rep(j,c)
			{
				update(j,zu[i][j]);
			}
		}
		
		rep(kkk,q)
		{
			cin>>aaa>>bbb>>aa>>bb;
			ans=INF;
			rep2(i,aaa,aa+1)
			{
				ima=i;
				cout<<query(bbb,bb+1,0,0,n)<<endl;
				ans=min(ans,query(bbb,bb+1,0,0,n));
			}
			cout<<ans<<endl;
		}
		
	}
	return 0;
}

Compiler output:
a.cc:20:16: warning: integer overflow in expression of type 'int' results in '-294967296' [-Woverflow]
   20 | int dat[1000][4*N];
      |                ^
a.cc:20:16: error: size '-294967296' of array 'dat' is negative
a.cc: In function 'void init(int)':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   11 | #define INF 10000000000
      |             ^~~~~~~~~~~
a.cc:25:42: note: in expansion of macro 'INF'
   25 |         rep(i,2*n-1)rep(j,1000)dat[j][i]=INF;
      |                                          ^~~
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   11 | #define INF 10000000000
      |             ^~~~~~~~~~~
a.cc:39:30: note: in expansion of macro 'INF'
   39 |         if(r<=a||b<=l)return INF;
      |                              ^~~
a.cc: In function 'int main()':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   11 | #define INF 10000000000
      |             ^~~~~~~~~~~
a.cc:97:29: note: in expansion of macro 'INF'
   97 |                         ans=INF;
      |                             ^~~
Language: C++

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

const int INF = (1LL << 31) - 1;

struct segtree {
	int H, W;
	vector<vector<int>> dat;
	segtree(vector<vector<int>> &f) {
		H = W = 1;
		while(H < (int)f.size()) H <<= 1;
		while(W < (int)f[0].size()) W <<= 1;
		dat.assign(2 * H - 1, vector<int>(2 * W - 1, INF));
		init(f);
	}
	void init(vector<vector<int>> &f) {
		for(int i = 0; i < (int)f.size(); i++)
			for(int j = 0; j < (int)f[0].size(); j++)
				dat[i + H - 1][j + W - 1] = f[i][j];
		for(int i = 2 * H - 2; i > H - 2; i--)
			for(int j = W - 2; j >= 0; j--)
				dat[i][j] = min(dat[i][2 * j + 1], dat[i][2 * j + 2]);
		for(int i = H - 2; i >= 0; i--)
			for(int j = 0; j < 2 * W - 1; j++)
				dat[i][j] = min(dat[2 * i + 1][j], dat[2 * i + 2][j]);
	}
	int query(int li, int lj, int ri, int rj) { return query_h(li, lj, ri, rj, 0, H, 0); }
	int query_h(int li, int lj, int ri, int rj, int si, int ti, int k) {
		if(ri <= si || ti <= li) return INF;
		if(li <= si && ti <= ri) return query_w(lj, rj, 0, W, k, 0);
		const int mi = (si + ti) / 2;
		return min(query_h(li, lj, ri, rj, si, mi, 2 * k + 1), query_h(li, lj, ri, rj, mi, ti, 2 * k + 2));
	}
	int query_w(int lj, int rj, int sj, int tj, int i, int k) {
		if(rj <= sj || tj <= lj) return INF;
		if(lj <= sj && tj <= rj) return dat[i][k];
		const int mj = (sj + tj) / 2;
		return min(query_w(lj, rj, sj, mj, i, 2 * k + 1), query_w(lj, rj, mj, tj, i, 2 * k + 2));
	}
};

segtree st;

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

	int r, c, q;
	while(cin >> r >> c >> q, r | c | q) {
		vector<vector<int>> f(r, vector<int>(c));
		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cin >> f[i][j];
			}
		}

		st.init(f);
		while(q--) {
			int r1, c1, r2, c2;
			cin >> r1 >> c1 >> r2 >> c2;
			cout << st.query(r1, c1, r2 + 1, c2 + 1) << endl;
		}
	}
}

Compiler output:
a.cc:43:9: error: no matching function for call to 'segtree::segtree()'
   43 | segtree st;
      |         ^~
a.cc:10:9: note: candidate: 'segtree::segtree(std::vector<std::vector<int> >&)'
   10 |         segtree(vector<vector<int>> &f) {
      |         ^~~~~~~
a.cc:10:9: note:   candidate expects 1 argument, 0 provided
a.cc:7:8: note: candidate: 'segtree::segtree(const segtree&)'
    7 | struct segtree {
      |        ^~~~~~~
a.cc:7:8: note:   candidate expects 1 argument, 0 provided
a.cc:7:8: note: candidate: 'segtree::segtree(segtree&&)'
a.cc:7:8: note:   candidate expects 1 argument, 0 provided
Language: C++

#include<stdio.h>
#include<string.h>
#include<limits.h>

const int maxn = 1000000*2;
int n;
struct node
{
    int x1,x2,y1,y2;
    int min;
    int ch[4];
};
node tree[maxn];
 
int tol;
 
void maketree(int x1,int x2,int y1,int y2)
{
    int k = ++tol;
    tree[k].x1 = x1;
    tree[k].x2 = x2;
    tree[k].y1 = y1;
    tree[k].y2 = y2;
    tree[k].min = 0;
    if(x1 == x2 && y1==y2)
    {
        scanf("%d",&tree[k].min);
        memset(tree[k].ch,0,sizeof(tree[k].ch));
        return ;
    }
    
    int midx = (x1+x2)>>1;
    int midy = (y1+y2)>>1;
    
    tree[k].ch[0] = tol+1;
    maketree(x1,midx,y1,midy); 
    if(midy+1 <= y2)    
    {
        tree[k].ch[2] = tol+1;
        maketree(x1,midx,midy+1,y2);
    }
    else
        tree[k].ch[2] = 0;


    if(midx+1 <= x2)
    {
        tree[k].ch[3] = tol+1;
        maketree(midx+1,x2,y1,midy);
    }
    else
        tree[k].ch[3] = 0;


    if(midx+1 <= x2 && midy+1 <= y2) 
    {
        tree[k].ch[1] = tol+1;
        maketree(midx+1,x2,midy+1,y2);
    }
    else
        tree[k].ch[1] = 0;
        
    tree[k].min =  tree[tree[k].ch[0]].min;
    for(int i=1; i<4; i++)            
        if(tree[k].ch[i])
            tree[k].min = min(tree[k].min,tree[tree[k].ch[i]].min);
}
 
inline bool cross(int x1,int x2,int y1,int y2,int k)
{
    if(x2 < tree[k].x1 || tree[k].x2 < x1   ||  y2 < tree[k].y1 || tree[k].y2 < y1)
        return false;
    return true;
}
 
int Query(int x1,int x2,int y1,int y2,int k) 
{
    if(cross(x1,x2,y1,y2,k) == 0)  
        return INT_MAX;
 
    if(x1 <= tree[k].x1 && tree[k].x2 <= x2 && y1<= tree[k].y1 && tree[k].y2 <= y2) 
        return tree[k].min;
    int minx = Query(x1,x2,y1,y2,tree[k].ch[0]);
 
    for(int i=1; i<4; i++)
        minx = min(minx,Query(x1,x2,y1,y2,tree[k].ch[i]));
    return minx;
}

int main()
{
    int r,c,q,temp;
    int x1,y1,x2,y2;
    while(( scanf( "%d%d%d",&r,&c,&q ),r ))
    {
        tol=0;
        maketree(1,r,1,c);        
        while(q--)
        {
            scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
            x1++,y1++,x2++,y2++;
            printf("%d\n",Query(x1,x2,y1,y2,1));
        }
    }
}

Compiler output:
a.cc: In function 'void maketree(int, int, int, int)':
a.cc:66:27: error: 'min' was not declared in this scope
   66 |             tree[k].min = min(tree[k].min,tree[tree[k].ch[i]].min);
      |                           ^~~
a.cc: In function 'int Query(int, int, int, int, int)':
a.cc:86:16: error: 'min' was not declared in this scope; did you mean 'minx'?
   86 |         minx = min(minx,Query(x1,x2,y1,y2,tree[k].ch[i]));
      |                ^~~
      |                minx
Language: C++

#include<cstdio>
#include<vector>
#define la (rt*4)
#define lb (rt*4+1)
#define lc (rt*4+2)
#define ld (rt*4+3)
#define MIN(A,B) ((A)>(B)?(B):(A))
using namespace std;

int r, c, q;

struct seg
{
    int x1,y1,x2,y2;
    int v;
    int midx()
    {
        return (x1+x2)>>1;
    }
    int midy()
    {
        return (y1+y2)>>1;
    }
}tr[1000010*5];
int map[1000010];
void build(int rt,int x1,int y1,int x2,int y2)
{
    tr[rt].x1 = x1;
    tr[rt].y1 = y1;
    tr[rt].x2 = x2;
    tr[rt].y2 = y2;
    if(x1==x2 && y1==y2)
    {
        tr[rt].v = map[x1*c + y1];
        return;
    }
    int mx = tr[rt].midx();
    int my = tr[rt].midy();
    if(x1 == x2)
    {
        build(la,x1,y1,mx,my);
        build(lb,x1,my+1,mx,y2);
        tr[rt].v = MIN(tr[la].v,tr[lb].v);
    }
    else if(y1 == y2)
    {
        build(la,x1,y1,mx,my);
        build(lc,mx+1,y1,x2,my);
        tr[rt].v = MIN(tr[la].v,tr[lc].v);
    }
    else
    {
        build(la,x1,y1,mx,my);
        build(lb,x1,my+1,mx,y2);
        build(lc,mx+1,y1,x2,my);
        build(ld,mx+1,my+1,x2,y2);
        tr[rt].v = MIN(tr[la].v,tr[lb].v);
        tr[rt].v = MIN(tr[rt].v,tr[lc].v);
        tr[rt].v = MIN(tr[rt].v,tr[ld].v);
    }
    return;
}
int query(int rt,int x1,int y1,int x2,int y2)
{
    if(x1==tr[rt].x1&&x2==tr[rt].x2&&y2==tr[rt].y2&&y1==tr[rt].y1)
    {
        return tr[rt].v;
    }
    int mx = tr[rt].midx();
    int my = tr[rt].midy();
    //1
    if(x2<=mx&&y2<=my)
        return query(la,x1,y1,x2,y2);
    if(y1>my&&x2<=mx)
        return query(lb,x1,y1,x2,y2);
    if(x1>mx&&y2<=my)
        return query(lc,x1,y1,x2,y2);
    if(mx<x1&&my<y1)
        return query(ld,x1,y1,x2,y2);
    //2
    if(x2<=mx)
    {
        int a = query(la,x1,y1,x2,my);
        int b = query(lb,x1,my+1,x2,y2);
        return MIN(a,b);
    }
    if(y2<=my)
    {
        int a = query(la,x1,y1,mx,y2);
        int b = query(lc,mx+1,y1,x2,y2);
        return MIN(a,b);
    }
    if(x1>mx)
    {
        int a = query(lc,x1,y1,x2,my);
        int b = query(ld,x1,my+1,x2,y2);
        return MIN(a,b);
    }
    if(y1>my)
    {
        int a = query(lb,x1,y1,mx,y2);
        int b = query(ld,mx+1,y1,x2,y2);
        return MIN(a,b);
    }
    //3
    int a = query(la,x1,y1,mx,my);
    int b = query(lb,x1,my+1,mx,y2);
    int c = query(lc,mx+1,y1,x2,my);
    int d = query(ld,mx+1,my+1,x2,y2);
    int e = MIN(a,b);
    e = MIN(e,c);
    e = MIN(e,d);
    return e;
}
int main()
{
    while(scanf("%d%d%d",&r,&c,&q),r||c||q)
    {
        for(int i = 0; i < r; ++i)
            for(int j = 0; j < c; ++j)
                scanf("%d",&map[i*c + j]);

   /*     build(1,0,0,r-1,c-1);
        for(int i = 0; i < q; ++i)
        {
            int a,b,c,d;
            scanf("%d%d%d%d",&a,&b,&c,&d);
            printf("%d\n",query(1,a,b,c,d));
        }
    } */
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:132:2: error: expected '}' at end of input
  132 | }
      |  ^
a.cc:116:1: note: to match this '{'
  116 | {
      | ^
Language: C++

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

int n;
int r,c,q;
int r1,c1,r2,c2;
int tmp;
vector<int> seg[1000];

void init(int num,int n_){
  seq[num].clear();
  for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
}

void update(int x,int k, int a){
  k += n-1;
  seg[x][k] = a;
  while(k>0){
    k = (k-1) / 2;
    seg[x][k] = min(seg[x][k*2+1], seg[x][k*2+2]);
  }
}

int query(int x, int a, int b, int k, int l, int r){
  if(r<=a || b<=l)return (1<<31) - 1;
  if(a<=l && r<=b)return seg[x][k];
  else{
    return min(query(x,a,b,2*k+1,l,(l+r)/2),query(x,a,b,2*k+2,(l+r)/2,r));
  }
}

int main(){
  while(1){
    cin >> r >> c >> q;
    if(!r && !c && !q)break;

    if(r>=c){
      n = 1;
      while(n<r)n *= 2;
      for(int i=0;i<c;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(j,i,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=c1;i<=c2;i++)ans = min(ans,query(i,r1,r2+1,0,0,n));
	cout << ans << endl;
      }
    }else{
      n = 1;
      while(n<c)n *= 2;
      for(int i=0;i<r;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(i,j,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=r1;i<=r2;i++)ans = min(ans,query(i,c1,c2+1,0,0,n));
	cout << ans << endl;
      }
    }
  }
}

Compiler output:
a.cc: In function 'void init(int, int)':
a.cc:13:3: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
   13 |   seq[num].clear();
      |   ^~~
      |   __pstl::execution::v1::seq
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/execution_defs.h:42:46: note: '__pstl::execution::v1::seq' declared here
   42 | _GLIBCXX17_INLINE constexpr sequenced_policy seq{};
      |                                              ^~~
a.cc:14:55: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
   14 |   for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
      |                                                ~~~~~~~^~
a.cc: In function 'int query(int, int, int, int, int, int)':
a.cc:27:34: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
   27 |   if(r<=a || b<=l)return (1<<31) - 1;
      |                          ~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:51:27: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
   51 |         int ans = (1<<31) - 1;
      |                   ~~~~~~~~^~~
a.cc:67:27: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
   67 |         int ans = (1<<31) - 1;
      |                   ~~~~~~~~^~~