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

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

using namespace std;

typedef complex<long double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)

#define N(a,b) ((a).real()*(b).real()+(a).imag()*(b).imag())
#define D(a) (((a)*conj(a)).real())
#define DD(a,b) (D(a)+D(b))
#define D2(a) ((a)*(a))

int main(){
  long double d;
  while(cin >> d, abs(d)>EPS){
    P p,v;
    long double x,y;
    cin >> x >> y;
    p=P(x,y);
    cin >> x >> y;
    v=P(x,y);
    if(abs((p/v).imag())<EPS){
      double tmp=(p/v).real();
      if(tmp>=0){
	printf("%.8Lf\n",2+abs(p)));
      }else{
	printf("%.8Lf\n",abs(p));
      }
    }else{
      cout << "impossible" << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:35: error: expected ';' before ')' token
   32 |         printf("%.8Lf\n",2+abs(p)));
      |                                   ^
      |                                   ;
Language: C++

#include<iostream>
#include<vector>

using namespace std;

const int infty = 1<<27;

struct frame{
  int ind;
  int x1,y1,x2,y2;
  bool operator<(const frame &t)const{
    if(x1!=t.x1)return x1<t.x1;
    if(y1!=t.y1)return y1<t.y1;
    return false;
  }
};

void getNextFrame(vector<frame> &v, int &cur, int *ans, bool *read){
  int ind=-1;
  vector<frame> cand;
  int cross_x = infty;
  
  sort(v.begin(),v.end());
  for(int i = 0; i < (int)v.size(); ++i){
    if( !read[v[i].ind] ){ ind = i; break; }
  }
  if(ind == -1) return ;
  
  read[ v[ind].ind ] = true;
  ans[v[ind].ind] = cur;
  ++cur;
  
  for(int i = 0; i < (int)v.size(); ++i){
    if( v[ind].x1 <= v[i].x1 && !read[ v[i].ind ] ){
      if( v[i].y1 < v[ind].y2 && v[ind].y2 < v[i].y2 ){
        cross_x = min( cross_x, v[i].x1 );
      }else if( v[ind].y2 >= v[i].y2 ){
        cand.push_back(v[i]);
      }
    }
  }
  
  for(int i = 0; i < (int)cand.size(); ++i){
    if( cross_x <= cand[i].x1 ){
      cand.erase( cand.begin() + i );
      i=-1;
    }
  }

  if(cand.size()>0){
    getNextFrame(cand,cur,ans,read);
  }
  getNextFrame(v,cur,ans,read);
}


int main()
{
  int tc=1;
  int n;
  while(cin>>n && n){
    int cur = 0;
    int x1,y1,x2,y2;
    vector<frame> v;
    vector<int> order;
    int ans[n];
    bool read[n];

    if( tc > 1 ) cout << endl;
    ++tc;
    
    for(int i = 0; i < n; ++i){
      frame f;

      cin >> x1 >> y1 >> x2 >> y2;
      f.x1 = min(x1,x2);
      f.y1 = min(y1,y2);
      f.x2 = max(x1,x2);
      f.y2 = max(y1,y2);
      f.ind = i;
      read[i] = false;

      v.push_back(f);
    }

    getNextFrame(v,cur,ans,read);

    for(int i = 0; i < n; ++i){
      cout << 1+ans[i] << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'void getNextFrame(std::vector<frame>&, int&, int*, bool*)':
a.cc:23:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |   sort(v.begin(),v.end());
      |   ^~~~
      |   short
Language: C++

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

struct C{
	int x1,x2,y1,y2,num;
};

int n;
int count[10];
int c=0;

void Yomu(vector<C> X){
	if(X.size()==0)
		return;
	int mx,my;
	mx=X[0].x1;
	my=X[0].y1;
	int m=X[0].num;
	int temp=0;
	for(int i=1;i<X.size();i++){
		if(my>X[i].y1||(my==X[i].y1 && mx>X[i].x1)){
			m=X[i].num;
			temp=i;
			my=X[i].y1;
			mx=X[i].x1;
		}
	}
	c++;
	count[m]=c;

	int msx=1000,msy=my;
	for(int i=0;i<X.size();i++){
		if(i==temp)
			continue;
		if((X[temp].x2<X[i].x2) && (X[temp].y2>X[i].y1 && X[temp].y2<X[i].y2) && msx>X[i].x2)
			msx=X[i].x2;
	}
	vector<C> Next1,Next2;
	for(int i=0;i<X.size();i++){
		if(i==temp)
			continue;
		if(X[i].x1<msx && X[i].x2<msx && X[i].y1<msy && X[i].y2<msy)
			Next1.push_back(X[i]);
		else Next2.push_back(X[i]);
	}

	Yomu(Next1);
	Yomu(Next2);
}


void solve(){
	c=0;
	memset(count,0,sizeof(count));
	vector<C> T;
	for(int i=0;i<n;i++){
		C t;
		t.num=i;
		cin>>t.x1>>t.y1>>t.x2>>t.y2;
		T.push_back(t);
	}
	Yomu(T);
	for(int i=0;i<n;i++)
		cout<<count[i]<<"\n";
}

int main()
{
	cin>>n;
	while(n!=0){
		solve();
		cin>>n;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:55:9: error: 'memset' was not declared in this scope
   55 |         memset(count,0,sizeof(count));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
#include "cout.h"

using namespace std;

int gcd(int m,int n) {
  if (m == 0 || n == 0)
    return 0;
  while (m != n) {
    if(m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}

int main() {
  int n, m;

  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0)
      return 0;
    long long int sum = (1 + n) * n / 2;
    int count = n;
    vector<int> p;
    for (int i = 0; i < m; i++) {
      int p_i;
      cin >> p_i;
      p.push_back(p_i);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < i; j++) {
        if (p[j] == 0)
          continue;
        if (p[i] % p[j] == 0) {
          p[i] = 0;
        }
      }
    }
    for (int i = 0; i < m; i++) {
      if (p[i] == 0)
        continue;
      sum -= (n / p[i]) * (p[i] + n) / 2;
      count -= n / p[i];
      for (int j = 0; j < i; j++) {
        int x = gcd(p[i], p[j]);
        int max = n / x * x;
        sum += (n / x) * (x + max) / 2;
        count += n / x;
      }
    }
    if (count != 0)
      cout << (double)sum / count << endl;
    else
      cout << (double)0 << endl;
  }
  return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

int gcd(int m,int n) {
  if (m == 0 || n == 0)
    return 0;
  while (m != n) {
    if(m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}

int main() {
  int n, m;

  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0)
      return 0;
    long long int sum = (1 + n) * n / 2;
    int count = n;
    vector<int> p;
    for (int i = 0; i < m; i++) {
      int p_i;
      cin >> p_i;
      p.push_back(p_i);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < i; j++) {
        if (p[j] == 0)
          continue;
        if (p[i] % p[j] == 0) {
          p[i] = 0;
        }
      }
    }
    for (int i = 0; i < m; i++) {
      if (p[i] == 0)
        continue;
      sum -= (n / p[i]) * (p[i] + n) / 2;
      count -= n / p[i];
      for (int j = 0; j < i; j++) {
        int x = gcd(p[i], p[j]);
        int max = n / x * x;
        sum += (n / x) * (x + max) / 2;
        count += n / x;
      }
    }
    if (count != 0)
      cout << (double)sum / count << endl;
    else
      cout << (double)0 << endl;
  }
  return 0;
}

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

#include<iostream>
#include<map>
#include<string>
using namespace std;
int main(){
	int n,m,i,a,b,d,t;
	string ss,pp,gg,aa,bb;
	for(;cin>>n>>m,n;){
		map<string,int> idx;
		int D[500][500],num=0;
		memset(D,9,sizeof(D));//init by INF
		cin>>ss>>pp>>gg;
		for(i=0;i<m;i++){
			cin>>aa>>bb>>d>>t;
			if(idx.find(aa)==idx.end())
				idx[aa]=num++;
			if(idx.find(bb)==idx.end())
				idx[bb]=num++;
			a=idx[aa];
			b=idx[bb];
			D[a][b]=D[b][a]=d/40+t;
		}
		//WF
		{
			int i,j,k;
			for(k=0;k<n;k++)
				for(i=0;i<n;i++)
					for(j=0;j<n;j++)
						D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
		}
		printf("%d\n",D[idx[ss]][idx[pp]]+D[idx[pp]][idx[gg]]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'memset' was not declared in this scope
   11 |                 memset(D,9,sizeof(D));//init by INF
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<map>
  +++ |+#include <cstring>
    3 | #include<string>
Language: Java

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

class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in).useDelimiter("[ \n\r]+");
		
		while(true) {
			int pageSize = sc.nextInt();
			if(pageSize == 0) break;
			int w = sc.nextInt();
			int h = sc.nextInt();
			
			Map<String, List<Button>> pages = new HashMap<String, List<Button>>(pageSize*2);
			String currentPage = null;
			List<String> pageHistory = new ArrayList<String>(64);
			List<Button> currentButtons = null;
			
			
			for(int i = 0; i < pageSize; i++) {
				String pageName = sc.next();
				
				int buttonSize = sc.nextInt();
				List<Button> list = new LinkedList<Button>();
				for(int j = 0; j < buttonSize; j++) {
					list.add(new Button(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.next()));
				}
				if(i == 0) {
					pageHistory.add(pageName);
					currentButtons = list;
				}
				pages.put(pageName, list);
			}
			
			int pointer = 0;
			
			int actionCount = sc.nextInt();
			
			for(int i = 0; i < actionCount; i++) {
				String action = sc.next();
				if(action.equals("click")) {
					int cw = sc.nextInt();
					int ch = sc.nextInt();
				
					for(Button btn : currentButtons) {
						if(btn.beginX <= cw && cw <= btn.endX && btn.beginY <= ch &&ch <= btn.endY) {
							
							pageHistory = pageHistory.subList(0, ++pointer);
							pageHistory.add(btn.to);
							currentButtons = pages.get(btn.to);
							break;
						}
					}
				}
				else if(action.equals("forward")) {
					if(pointer+1 < pageHistory.size()) {
						currentButtons = pages.get(pageHistory.get(++pointer));
					}
				}
				else if(action.equals("back")) {
					if(0 < pointer) {
						currentButtons = pages.get(pageHistory.get(--pointer));
					}
				}
				else if(action.equals("show")) {
					System.out.println(pageHistory.get(pointer));
				}
			}
		}
	}
}

Compiler output:
Main.java:14: error: cannot find symbol
			Map<String, List<Button>> pages = new HashMap<String, List<Button>>(pageSize*2);
			                 ^
  symbol:   class Button
  location: class Main
Main.java:14: error: cannot find symbol
			Map<String, List<Button>> pages = new HashMap<String, List<Button>>(pageSize*2);
			                                                           ^
  symbol:   class Button
  location: class Main
Main.java:17: error: cannot find symbol
			List<Button> currentButtons = null;
			     ^
  symbol:   class Button
  location: class Main
Main.java:24: error: cannot find symbol
				List<Button> list = new LinkedList<Button>();
				     ^
  symbol:   class Button
  location: class Main
Main.java:24: error: cannot find symbol
				List<Button> list = new LinkedList<Button>();
				                                   ^
  symbol:   class Button
  location: class Main
Main.java:26: error: cannot find symbol
					list.add(new Button(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.next()));
					             ^
  symbol:   class Button
  location: class Main
Main.java:45: error: cannot find symbol
					for(Button btn : currentButtons) {
					    ^
  symbol:   class Button
  location: class Main
7 errors
Language: C++

#include <iostream>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdio>
using namespace std;
typedef long long ll;
int main() {
	int N;
	while (cin >> N&&N!=0) {
		pair<ll, string> days[N];
		for (int i=0; i<N; i++) {
			int y,m,d; cin >> y >> m >> d;
			days[i].first=y*365+m*30+d;
			sprintf(days[i].second,"%4d %2d %2d",y,m,d);
		}
		sort(days, days+N);
		for (int i=0; i<N; i++) {
			cout << days[i].second << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:41: error: cannot convert 'std::__cxx11::basic_string<char>' to 'char*'
   15 |                         sprintf(days[i].second,"%4d %2d %2d",y,m,d);
      |                                 ~~~~~~~~^~~~~~
      |                                         |
      |                                         std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:365:38: note:   initializing argument 1 of 'int sprintf(char*, const char*, ...)'
  365 | extern int sprintf (char *__restrict __s,
      |                     ~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>
#include "max_flow.h"

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int n,m;


struct edge{
	int to,cap,rev;
};

const int MAX_V = 10000;
const int INF = 100000000;

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
	edge e;

	e.to = to;
	e.cap = cap;
	e.rev = G[to].size();
	G[from].push_back(e);

	e.to = from;
	e.cap = 0;
	e.rev = G[from].size()-1;
	G[to].push_back(e);
}

// ツ堕敖嘉パツスツづーツ探ツ催オ
int dfs(int v,int t,int f){
	if(v == t)
		return f;
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		edge &e = G[v][i];
		if(!used[e.to] && e.cap > 0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	while(1){
		fill(used,used+MAX_V,false);
		int f = dfs(s,t,INF);
		if(f == 0)
			return flow;
		else
			flow += f;
	}
}


int main(){
	while(cin >> n >> m && !(n == 0 && m == 0)){
		int minminCost = INF;
		int from,to,cap;

		int mincap = INF;
		vector<int> froms,tos,caps;
		for(int i = 0; i < m; i++){
			cin >> from >> to >> cap;
			mincap = min(mincap,cap);
			froms.push_back(from);
			tos.push_back(to);
			caps.push_back(cap);
			add_edge(from,to,cap);
		}
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				for(int k = 0; k < MAX_V; k++)
					G[i].clear();
				for(int k = 0; k < froms.size(); k++){
					if(mincap < 0)
						add_edge(froms[k],tos[k],caps[k]-mincap);
					else
						add_edge(froms[k],tos[k],caps[k]);
				}

				// ツ催渉ャツカツッツトツ姪「ツ妥ィツづーツづつュ
				int minCost = INF;
				minCost = max_flow(i,j);
				minminCost = min(minminCost,minCost);
			}
		}
		if(mincap < 0)
			cout << minminCost+mincap << endl;
		else
			cout << minminCost << endl;
	}


	return 0;
}

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

#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>
#include "max_flow.h"

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int n,m;


int main(){
	while(cin >> n >> m && !(n == 0 && m == 0)){
		int minminCost = INF;
		int from,to,cap;

		vector<int> froms,tos,caps;
		int minus = 0;
		for(int i = 0; i < m; i++){
			cin >> from >> to >> cap;
	//		mincap = min(mincap,cap);
			if(cap < 0)
				minus+=(cap);
			else{
				froms.push_back(from);
				tos.push_back(to);
				caps.push_back(cap);
				add_edge(from,to,cap);
			}
		}
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				for(int k = 0; k < MAX_V; k++)
					G[i].clear();
				for(int k = 0; k < froms.size(); k++){
					add_edge(froms[k],tos[k],caps[k]);
				}

				// ツ催渉ャツカツッツトツ姪「ツ妥ィツづーツづつュ
				int minCost = INF;
				minCost = max_flow(i,j);
				minminCost = min(minminCost,minCost);
			}
		}
		cout << minminCost+minus << endl;
	}


	return 0;
}

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


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

#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;

ll n[3];
int main(){
  ll a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f&&(a || b|| c|| d || e || f)){
    n[0] = a + d;
    n[1] = b + e;
    n[2] = c + f;
    ll l = min(n[0], min(n[1], n[2]));
    ll res = 0;
    rep(i, min(l + 1, 100LL)){
      ll c = i;
      rep(j, 3){
	c  += (n[j] - i) / 3;
      }
      //cout << c << endl;
      res = max(res, c);
    }
    cout << res << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
   13 |   while(cin >> a >> b >> c >> d >> e >> f&&(a || b|| c|| d || e || f)){
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <cstdlib>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout << res << endl;
      |     ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:20: error: 'endl' was not declared in this scope
   27 |     cout << res << endl;
      |                    ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <cstdlib>
  +++ |+#include <ostream>
    5 | using namespace std;
Language: C++

#include <iostream>

using namespace std;

int main(){

	int d[6];
	while(true){
		int sum = 0;
		for(int i=0;i<6;i++){
			cin >> d[i];
			sum += d[i];
		}
		if(sum == 0) break;
		int mx  = 0;
		int res = 0;
		int val[3];
		for(int i=0;i<3;i++){
			val[i] = (d[i]/3);
			mx = max(mx, d[i]-3*L);
		}
		for(int i=0;i<3;i++) mx = min(mx, d[i]);
		for(int j=0;j<=0;j++){
			int tmp = mx-j;
			if(tmp < 0) continue;
			for(int i=0;i<3;i++)
				tmp += min(val[i], (d[i]-mx+j)/3);
			res = max(res, tmp);
		}
		cout << res << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:45: error: 'L' was not declared in this scope
   20 |                         mx = max(mx, d[i]-3*L);
      |                                             ^
Language: C++

#include <iostream>

using namespace std;

int main(){

	int d[6];
	while(true){
		int sum = 0;
		for(int i=0;i<6;i++){
			cin >> d[i];
			sum += d[i];
		}
		if(sum == 0) break;
		int mx  = 0;
		int res = 0;
		int val[3];
		for(int i=0;i<3;i++){
			val[i] = (d[i]/3);
			mx = max(mx, d[i]-3*L);
		}
		for(int i=0;i<3;i++) mx = min(mx, d[i]);
		for(int j=0;j<3;j++){
			int tmp = j;
			if(tmp < 0) continue;
			for(int i=0;i<3;i++)
				tmp += min(val[i], (d[i]-j)/3);
			res = max(res, tmp);
		}
		cout << res << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:45: error: 'L' was not declared in this scope
   20 |                         mx = max(mx, d[i]-3*L);
      |                                             ^
Language: C++

#include<cctype>
#include<cstdio>
#include<vector>

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

using namespace std;

const int INF=1<<29;

struct P{ int x,y,cost; };

int main(){
	for(int w,h;scanf("%d%d",&w,&h),w;){
		int B[100][100];
		int sx,sy,gx,gy;
		int lastdgt=0;
		vector<P> dgt[10010];
		rep(i,h) rep(j,w) {
			char ss[16]; scanf("%s",ss);
			if(!isdigit(ss[0])) B[i][j]=0;
			else sscanf(ss,"%d",&B[i][j]);

			if(ss[0]=='S') sx=j, sy=i;
			if(ss[0]=='G') gx=j, gy=i;
			if(isdigit(ss[0])){
				dgt[B[i][j]].push_back((P){j,i,INF});
				lastdgt=max(lastdgt,B[i][j]);
			}
		}
		dgt[    0    ].push_back((P){sx,sy,0});
		dgt[lastdgt+1].push_back((P){gx,gy,INF});

		rep(k,lastdgt+1){
			rep(i,dgt[k].size()) rep(j,dgt[k+1].size()) {
				P p=dgt[k][i],q=dgt[k+1][j];
				dgt[k+1][j].cost=min(q.cost,p.cost+abs(q.x-p.x)+abs(q.y-p.y));
			}
		}
		printf("%d\n",dgt[lastdgt+1][0].cost);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:68: error: 'abs' was not declared in this scope
   37 |                                 dgt[k+1][j].cost=min(q.cost,p.cost+abs(q.x-p.x)+abs(q.y-p.y));
      |                                                                    ^~~
Language: C++

#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "#")
            return 0;
        int n = s.size();

        int i = 0;
        bool ret = false;
        while(i < n){
            vector<bool> not(3, false);
            vector<string> t(3);
            bool b = true;
            for(int j=0; j<3; ++j){
                ++ i;
                if(s[i] == '~'){
                    not[j] = true;
                    ++ i;
                }
                while(s[i] != '&' && s[i] != ')'){
                    t[j] += s[i];
                    ++ i;
                }
                for(int k=0; k<j; ++k){
                    if(t[j] == t[k] && not[j] != not[k])
                        b = false;
                }
            }
            if(b){
                ret = true;
                break;
            }

            i += 2;
        }

        if(ret)
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: expected unqualified-id before 'not' token
   31 |             vector<bool> not(3, false);
      |                          ^~~
a.cc: In lambda function:
a.cc:37:28: error: expected '{' before '=' token
   37 |                     not[j] = true;
      |                            ^
a.cc: In function 'int main()':
a.cc:37:21: error: no match for 'operator!' (operand type is 'main()::<lambda()>')
   37 |                     not[j] = true;
      |                     ^~~~~~
a.cc:37:21: note: candidate: 'operator!(bool)' (built-in)
a.cc:37:21: note:   no known conversion for argument 1 from 'main()::<lambda()>' to 'bool'
a.cc: In lambda function:
a.cc:45:47: error: expected '{' before '!=' token
   45 |                     if(t[j] == t[k] && not[j] != not[k])
      |                                               ^~
a.cc: In function 'int main()':
a.cc:45:40: error: no match for 'operator!' (operand type is 'main()::<lambda()>')
   45 |                     if(t[j] == t[k] && not[j] != not[k])
      |                                        ^~~~~~
a.cc:45:40: note: candidate: 'operator!(bool)' (built-in)
a.cc:45:40: note:   no known conversion for argument 1 from 'main()::<lambda()>' to 'bool'
a.cc: In lambda function:
a.cc:45:56: error: expected '{' before ')' token
   45 |                     if(t[j] == t[k] && not[j] != not[k])
      |                                                        ^
a.cc: In function 'int main()':
a.cc:45:50: error: no match for 'operator!' (operand type is 'main()::<lambda()>')
   45 |                     if(t[j] == t[k] && not[j] != not[k])
      |                                                  ^~~~~~
a.cc:45:50: note: candidate: 'operator!(bool)' (built-in)
a.cc:45:50: note:   no known conversion for argument 1 from 'main()::<lambda()>' to 'bool'
Language: Java

//2.29
import java.util.Scanner;
import java.io.*;

class Main{
    int num[]=new int[30000];
    int l[]=new int[30000],r[] =new int[30000];
    int max(int a,int b){return a>b?a:b;}
    boolean islower_line(double x,double y,double a,double b){
	return y < a*x+b;
    } 
    void put_xy(int m,int w,double x,double y){
	int tl=0,tr=m;
	int mid=0,ans=-1;
	while(tl <= tr){
	    mid =(tl+tr)/2;
	    if (islower_line(x,y,(r[mid]-l[mid])/(double)w,l[mid])){
		ans=mid;
		tr=mid-1;
	    }else tl=mid+1;
	}
	//System.out.println(islower_line(x,y,(r[ans]-l[ans])/(double)w,
	//l[ans]));
	num[ans]++;
	return;
    }
    int solve(int m,int s,int w){
	int ret=0,now=0;
	int head=0,tail=0;
	int lbase=0,rbase=0;
	while(true){
	    //back++
	    while(tail < m){
		if ((long)w*(long)(l[tail]-lbase+r[tail]-rbase) > 2*s)break;
		now+=num[tail];
		tail++;
	    }
	    ret=max(ret,now);
	    if (tail == m)break;
	    //head++;
	    head++;
	    lbase=l[head-1];
	    rbase=r[head-1];
	    now-=num[head-1];
	}
	return ret;
    }


    void run(){
	Scanner in = new Scanner(System.in);
	//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
	int n,m,w,h;
	int s;
	while(true){
	    n=in.nextInt();
	    m=in.nextInt();
	    w=in.nextInt();
	    h=in.nextInt();
	    s=in.nextInt();
	    if (n == 0)break;
	    for(int i=0;i<m;i++)num[i]=0;
	    for(int i=0;i<m;i++){
		int tmp;
		l[i]=in.nextInt();
		r[i]=in.nextInt();
	    }
	    for(int i=0;i<n;i++){
		double x,y;
		x=in.nextDouble();
		y=in.nextDouble();
		put_xy(m,w,x,y);
	    }
	    s=w*h-s;
	    System.out.println(n-solve(m,s,w));
	}
    }

    /*
    void run(){
	Scanner in = new Scanner(System.in);
	//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
	int n,m,w,h;
	int s;
	while(true){
	    n=Integer.parseInt(in.next());
	    m=Integer.parseInt(in.next());
	    w=Integer.parseInt(in.next());
	    h=Integer.parseInt(in.next());
	    s=Integer.parseInt(in.next());
	    if (n == 0)break;
	    for(int i=0;i<m;i++)num[i]=0;
	    for(int i=0;i<m;i++){
		int tmp;
		l[i]=Integer.parseInt(in.next());
		r[i]=Integer.parseInt(in.next());
	    }
	    for(int i=0;i<n;i++){
		double x,y;
		x=Double.parseDouble(in.next());
		y=Double.parseDouble(in.next());
		put_xy(m,w,x,y);
	    }
	    s=w*h-s;
	    System.out.println(n-solve(m,s,w));
	}
    }
    *.

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

Compiler output:
Main.java:79: error: unclosed comment
    /*
    ^
Main.java:114: error: reached end of file while parsing
}
 ^
2 errors
Language: Java

import java.util.ArrayList;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static long[] count = new long[1000001];
	static ArrayList<Integer> primes = primes(count.length + 1);

	public static void main(String[] args) throws Exception {
		count[1] = 2;
		for (int i = 2; i < count.length; ++i) {
			count[i] = count[i - 1] + totient(i);
		}
		int N = sc.nextInt();
		for (int i = 0; i < N; ++i) {
			System.out.println(count[sc.nextInt()]);
		}
	}

	static int totient(int n) {
		long ret = n;
		for (int i = 0; i < primes.size() && n > 1; ++i) {
			int p = primes.get(i);
			if (p * p > n) {
				ret *= n-1;
				ret /= n;
				break;
			}
			if (n % p == 0) {
				ret *= p - 1;
				ret /= p;
				while (n % p == 0) {
					n /= p;
				}
			}
		}
		return ret;
	}

	public static ArrayList<Integer> primes(int max) {
		if (max < 2) {
			return new ArrayList<Integer>();
		}
		BitSet primeSet = new BitSet(max / 2);
		primeSet.set(1, max / 2);
		int limit = (int) Math.sqrt(max);
		for (int i = 3; i <= limit; i += 2) {
			if (!primeSet.get(i / 2)) {
				continue;
			}
			for (int j = i * i; j < max; j += i * 2) {
				primeSet.clear(j / 2);
			}
		}
		ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(2);
		for (int i = primeSet.nextSetBit(0); i >= 0; i = primeSet.nextSetBit(i + 1)) {
			list.add(i * 2 + 1);
		}
		return list;
	}

}

Compiler output:
Main.java:38: error: incompatible types: possible lossy conversion from long to int
		return ret;
		       ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.BitSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static long[] count = new long[1000001];
	static ArrayList<Integer> primes = primes(count.length + 1);

	public static void main(String[] args) throws Exception {
		count[1] = 2;
		for (int i = 2; i < count.length; ++i) {
			count[i] = count[i - 1] + totient(i);
		}
		int N = sc.nextInt();
		for (int i = 0; i < N; ++i) {
			System.out.println(count[sc.nextInt()]);
		}
	}

	static int totient(int n) {
		long ret = n;
		for (int i = 0; i < primes.size() && n > 1; ++i) {
			int p = primes.get(i);
			if (p * p > n) {
				ret *= n-1;
				ret /= n;
				break;
			}
			if (n % p == 0) {
				ret *= p - 1;
				ret /= p;
				while (n % p == 0) {
					n /= p;
				}
			}
		}
		return (long)ret;
	}

	public static ArrayList<Integer> primes(int max) {
		if (max < 2) {
			return new ArrayList<Integer>();
		}
		BitSet primeSet = new BitSet(max / 2);
		primeSet.set(1, max / 2);
		int limit = (int) Math.sqrt(max);
		for (int i = 3; i <= limit; i += 2) {
			if (!primeSet.get(i / 2)) {
				continue;
			}
			for (int j = i * i; j < max; j += i * 2) {
				primeSet.clear(j / 2);
			}
		}
		ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(2);
		for (int i = primeSet.nextSetBit(0); i >= 0; i = primeSet.nextSetBit(i + 1)) {
			list.add(i * 2 + 1);
		}
		return list;
	}

}

Compiler output:
Main.java:38: error: incompatible types: possible lossy conversion from long to int
		return (long)ret;
		       ^
1 error
Language: C++

#include<iostream>
#include<climits>
#include<algorithm>
#include<cstdlib>
#include<cstdio>

#define MAX 1200010

using namespace std;

int smtree_size;
int smtree[2*MAX-1];

void smtree_init(int *smtree, int n_){
  smtree_size=1;
  while(smtree_size<n_)smtree_size*=2;
  for(int i=0;i<2*smtree_size-1;++i){
    smtree[i]=INT_MAX;
  }
}

void smtree_update(int *smtree, int k, int a){
  k+=smtree_size-1;
  smtree[k]=a;
  while(k>0){
    k=(k-1)/2;
    smtree[k]=min(smtree[k*2+1],smtree[k*2+2]);
  }
}

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

int main()
{
  while(true){
    int r,c,q;
    static int data[MAX];

    scanf("%d%d%d", &r, &c, &q);
    if( r == 0 && c == 0 && q == 0 )break;

    assert(r*c<=1000000);

    if(r<c){
      smtree_init(smtree, r*c);
    }else{
      smtree_init(smtree, r*c);
    }

    bool rowmj = r<=c;
    if(rowmj){
      for(int i = 0; i < r; ++i){
        for(int j = 0; j < c; ++j){          
          scanf("%d", &data[i*c+j]);
        }
      }
    }else{
      for(int i = 0; i < r; ++i){
        for(int j = 0; j < c; ++j){
          scanf("%d", &data[j*r+i]);
        }
      }
    }

    if( rowmj ){
      for(int i = 0; i < r; ++i){
        for(int j = 0; j < c; ++j){
          smtree_update(smtree, i*c+j,data[i*c+j]);
        }
      }
    }else{
      for(int i = 0; i < r; ++i){
        for(int j = 0; j < c; ++j){
          smtree_update(smtree, j*r+i,data[j*r+i]);
        }
      }
    }

    for(int qq = 0; qq < q; ++qq){
      int ans = INT_MAX;
      int i0,j0,i1,j1;
      
      scanf("%d%d%d%d", &i0, &j0, &i1, &j1);
      if( rowmj ){
        for(int i = i0; i <= i1; ++i){
          ans = min( ans, smtree_query( smtree, i*c+j0, i*c+j1+1, 0, 0, smtree_size) );
        }
      }else{
        for(int j = j0; j <= j1; ++j){
          ans = min( ans, smtree_query( smtree, j*r+i0, j*r+i1+1, 0, 0, smtree_size) );
        }
      }
      printf("%d\n", ans);
    }

  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:5: error: 'assert' was not declared in this scope
   55 |     assert(r*c<=1000000);
      |     ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    5 | #include<cstdio>
  +++ |+#include <cassert>
    6 |
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int r, c, q;
main(){
  while(1){
    cin >> r >> c >> q;
    if(r==0 && c==0 && q==0) break;
    vector<vector<int> > data;
    for(int i=0;i<r;i++){
      vector<int> w;
      for(int j=0;j<c;j++){
	int in;
	cin >> in;
	w.push_back(in);
      }
      data.push_back(w);
    }
    for(int t=0;t<q;t++){
      int r1, r2, c1, c2;
      cin >> r1 >> c1 >> r2 >> c2;
      int ans=INT_MAX;
      int i=r1, j=c1;
      for(i=r1;i<=r2;i++){
	for(j=c1;j<=c2;j++){
	  ans=min(ans, data[i][j]);
	}
      }
      cout << ans << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:22:15: error: 'INT_MAX' was not declared in this scope
   22 |       int ans=INT_MAX;
      |               ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <numeric>
#include <algorithm>
using namespace std;
#ifdef DEBUGRUN
#define LOG(a) (cerr<<__LINE__<<": "#a" = "<<(a)<<endl)
#define DBG(...) (__VA_ARGS__)
#else
#define LOG(...) ((void)0)
#define DBG(...) ((void)0)
#endif
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define mp make_pair
#define foreach(it, c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)
typedef long long Int;
#define INF (MY_INFINITY)
#define MOD (YOUR_MODULUS)

struct RMQ {
    int n;
    vector<vector<int> > dp;
    RMQ(int h) {
        int w=1;
        while(w*2<=h) {
            dp.push_back(vector<int>(h, 0));
            w *= 2;
        }
        dp.push_back(vector<int>(h, 0));
    }
    void init(int _n, int *a) {
        n = _n;
        rep(i, n) dp[0][i] = a[i];
        int w = 1;
        rep(k, dp.size()-1) {
            rep(i, n-2*w+1) {
                dp[k+1][i] = std::min(dp[k][i], dp[k][i+w]);
            }
            w *= 2;
        }
    }
    // return min([a[i] for i in [l, r)])
    int min(int l, int r) {
        int ix=0, w=1;
        while(w*2<r-l) ix++, w*=2;
        return std::min(dp[ix][l], dp[ix][r-w]);
    }
};

int main() {
    for(;;) {
        int r, c, q;
        scanf("%d%d%d", &r, &c, &q);
        if(r==0) return 0;
        int w=r, h=c;
        // w < h
        if(r>c) swap(w, h);
        int *f = new int[w*h];
        rep(i, r) rep(j, c) {
            scanf("%d", r<=c ? &f[i*c+j] : &f[j*r+i]);
        }
        vector<RMQ*> rs;
        rep(i, w) {
            LOG(i);
            RMQ *p = new RMQ(h);
            p->init(h, f+i*h);
            rs.push_back(p);
        }
        delete[] f;
        rep(i, q) {
            LOG(i);
            int x1, y1, x2, y2;
            scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
            if(r>c) swap(x1, y1), swap(x2, y2);
            int ans = INT_MAX;
            for(int x=x1; x<=x2; x++) {
                ans = min(ans, rs[x]->min(y1, y2+1));
            }
            printf("%d\n", ans);
        }
        LOG("DEL");
        rep(i, rs.size()) delete rs[i];
    }
}

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

#include<iostream>
using namespace std;

int main(){
  int r,c,q;
  int r1,r2,c1,c2;
  int grid[1000000];
  int min;


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

    for(int i=0;i<r;i++){
      for(int j=0;j<c;j++){
	cin >> grid[i*r+j];
      }
    }
    
    for(int i=0;i<q;i++){
      cin >> r1 >> c1 >> r2 >> c2;
      min = INT_MAX;
      for(int j=r1;j<=r2;j++){
	for(int k=c1;k<=c2;k++){
	  if(grid[j*r+k]<min)min = grid[j*r+k];
	}
      }
      cout << min << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'INT_MAX' was not declared in this scope
   23 |       min = INT_MAX;
      |             ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: Java

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

public class UAPC2011H{
	public static long sqrt(long a)
	{
		long l = 0;
		long r = 0x7fffffffL;
		while ( true )
		{
			if ( l*l == a )
				return l;
			if ( r*r == a )
				return r;
			long c = (l+r)/2;
			if ( c*c < a )
				l = c;
			else
				r = c;
		}
	}
	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while ( true )
		{
			int n = sc.nextInt();
			if ( n==0 )
				return;
			long[] b = new long[n*(n+1)/2];
			for ( int i=0; i<n*(n+1)/2; i++ )
				b[i] = sc.nextLong();
			long[] a = new long[n+1];
			BigInteger t = new BigInteger(Long.toString(b[0]));
			t = t.multiply(new BigInteger(Long.toString(b[1])));
			t = t.divide(new BigInteger(Long.toString(b[n])));
			a[0] = sqrt(t.longValue());
			for ( int i=1; i<=n; i++ )
				a[i] = b[i-1]/a[0];
			
			System.out.println(a[0]);
			
			for ( int i=1; i<=n; i++ )
			{
				if ( i>1 )
					System.out.print(" ");
				System.out.print(a[i]);
			}
			System.out.println();

		}
	}
}

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

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

long long gcd(long long a, long long b){
  return b==0?a:gcd(b,a%b);
}

int main()
{
  int n;
  while(cin>>n && n){
    vector<long long> in;
    vector<long long> even;
    long long G;
    long long min_odd = LLONG_MAX;
    int num = n*(n+1)/2;

    for(int i = 0; i < num; ++i){
      long long tmp;
      cin >> tmp;
      in.push_back(tmp);
      if( tmp % 2 == 0 ){
	even.push_back(tmp);
      }else{
	min_odd = min( min_odd, tmp );
      }
    }

    sort(in.begin(),in.end());
    sort(even.begin(),even.end());
    G = gcd(even[0],even[1]);
    for(int i = 2; i < (int)even.size(); ++i){
      G = gcd(G,even[i]);
    }

    long long x0p = even[0]/G;
    long long x1p = even[1]/G;
    long long g = (long long)sqrt(min_odd/(x0p*x1p)+0.00001);
    long long A = G / g;
    vector<long long> ans;

    for(int i = 0; i < (int)even.size(); ++i){
      ans.push_back( even[i] / A );
    }
    sort(ans.begin(), ans.end());
    cout << A << endl;
    for(int i = 0; i < (int)ans.size(); ++i){
      if(i)cout << ' ';
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}

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

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
int gcd(int a, int b) {if(a%b==0){return b;}return gcd(b,a%b);}
int main() {
	int n;
	while (cin>>n&&n!=0) {
		vl num(n*(n+1)/2);
		for (int i=0; i<n*(n+1)/2; i++) cin>>num[i];
		/*bÌôÍK¸a0~aiÌÍ¸*/
		int g=gcd(num[0],num[1]);
		int c=2;
		while (i<n) {
			g = gcd(g,num[c]);
			c++;
		}
		vl res(n);
		for (int i=0; i<n; i++) {
			res.push_back(num[i]/g%2147483648);
		}
		sort(res.begin(),res.end());
		cout<<g<<endl;
		for (int i=0; i<n; i++) {
			if (i!=0) cout << " ";
			cout << res[i];
		}
		cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'i' was not declared in this scope
   15 |                 while (i<n) {
      |                        ^
a.cc:23:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |                 sort(res.begin(),res.end());
      |                 ^~~~
      |                 short
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
int gcd(int a, int b) {if(a%b==0){return b;}return gcd(b,a%b);}
int main() {
	int n;
	while (cin>>n&&n!=0) {
		int s = n*(n+1)/2;
		vl num(s);
		for (int i=0; i<s; i++) {
			cin>>num[i];
		}
		/*bÌôvfÍK¸a0~aiÌÍ¸ËôvfÌÅåöñªaÌôÉÈéH*/
		ll g=gcd(num[0],num[1]);
		int c=2;
		while (c<n) {
			g = gcd(g,num[c]);
			c++;
		}
		/* ½¾µïÔÉÊÌöñª éÆ«Ååöñªa0*öñÆÈéÌÅ»êð­B */
		if (c+1<s) {
			ll odd=gcd(odds[c],odds[c+1]);
			c += 2;
			while (c<s){
				odd = gcd(odd,odds[c]);
				c++;
			}
			g /= (ll)sqrt(odd);	// ïÌ©¯í¹ÈÌÅoddÍïÔÌÅåöñÌñæÉÈéB
		}
		vl res(n);
		for (int i=0; i<n; i++) {
			res[i] = num[i]/g;
		}
		sort(res.begin(),res.end());
		cout<<g<<endl;
		for (int i=0; i<n; i++) {
			if (i!=0) cout << " ";
			cout << res[i];
		}
		cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: 'odds' was not declared in this scope; did you mean 'odd'?
   26 |                         ll odd=gcd(odds[c],odds[c+1]);
      |                                    ^~~~
      |                                    odd
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
ll gcd(ll a, ll b) {
	if(a%b==0) return b;
	return gcd(b,a%b);
}
int main() {
	int n;
	while (cin>>n&&n!=0) {
		int s = n*(n+1)/2;
		vl num(s);
		for (int i=0; i<s; i++) cin>>num[i];
		/*bÌôvfÍK¸a0~aiÌÍ¸ËôvfÌÅåöñªaÌôÉÈéH*/
		ll g=gcd(num[0],num[1]);
		int c=2;
		while (c<n) {
			g = gcd(g,num[c]);
			c++;
		}
		/* ½¾µïÔÉÊÌöñª éÆ«Ååöñªa0*öñÆÈéÌÅ»êð­B */
		if (c+1<num.size()) {
			ll odd=gcd(num[c],num[c+1]);
			c += 2;
			while (c<num.size()){
				odd = gcd(odd,num[c]);
				c++;
			}
			g /= sqrt(odd);	// ïÌ©¯í¹ÈÌÅoddÍïÔÌÅåöñÌñæÉÈéB
		} else if (n==2) {
			ll a=num[0]/g, b=num[1]/g;
			if (a*b!=num[2]) {
				ll d = num[2]/(a*b)
				g /= d;
			}
		}
		vl res(n);
		for (int i=0; i<n; i++) {
			res[i] = num[i]/g;
		}
		sort(res.begin(),res.end());
		cout<<g<<endl;
		for (int i=0; i<n; i++) {
			if (i!=0) cout << " ";
			cout << res[i];
		}
		cout << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:33: error: expected ',' or ';' before 'g'
   38 |                                 g /= d;
      |                                 ^
Language: C++

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

using namespace std;

long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }

int main(){
	int n;
	while(cin >> n, n){
		vector<long long> a, b;
		for(int i=0;i<n*(n+1)/2;i++){
			long long t; scanf("%lld", &t);
			if(t%2) b.push_back(t);
			else    a.push_back(t);
		}
		sort(a.begin(), a.end());
		sort(b.begin(), b.end());
		long long g = (long long)sqrt(a[0]*a[1]/b[0]+EPS);
//		long long g = gcd(a[0], a[1]);
//		g /= (long long)sqrt(b[0]/(a[0]/g)/(a[1]/g)+1e-8);
		cout << g << endl << a[0]/g;
		for(int i=1;i<n;i++) cout << " " << a[i]/g;
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:62: error: 'EPS' was not declared in this scope
   21 |                 long long g = (long long)sqrt(a[0]*a[1]/b[0]+EPS);
      |                                                              ^~~
Language: C++

/*wa*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long double ll;
typedef vector<ll> vl;
ll gcd(ll a, ll b) {
	if(a%b==0) return b;
	return gcd(b,a%b);
}
int main() {
	int n;
	while (cin>>n&&n!=0) {
		int s = n*(n+1)/2;
		vl num(s);
		int cnt=0, cnt2=n;
		for (int i=0; i<s; i++) {
			int tmp; cin>>tmp;
			if (tmp%2==0) {
				num[cnt]=tmp;
				cnt++;
			} else {
				num[cnt2]=tmp;
				cnt2++;
			}
		}
		/*bÌôvfÍK¸a0~aiÌÍ¸ËôvfÌÅåöñªaÌôÉÈéH*/
		ll g=gcd(num[0],num[1]);
		int c=2;
		while (c<n) {
			g = gcd(g,num[c]);
			c++;
		}
		/* ½¾µïÔÉÊÌöñª éÆ«Ååöñªa0*öñÆÈéÌÅ»êð­B */
		if (c+1<num.size()) {
			ll odd=gcd(num[c],num[c+1]);
			c += 2;
			while (c<num.size()){
				odd = gcd(odd,num[c]);
				c++;
			}
			g /= sqrt(odd);	// ïÌ©¯í¹ÈÌÅoddÍïÔÌÅåöñÌñæÉÈéB
		} else if (n==2) {
			ll a=num[0]/g, b=num[1]/g, tmp=a*b;
			if (tmp!=num[2]) {
				ll d = num[2]/tmp;
				if (g>d) g/=d;
			}
		}
		vl res(n);
		for (int i=0; i<n; i++) {
			res[i] = num[i]/g;
		}
		sort(res.begin(),res.end());
		cout<<g<<endl;
		for (int i=0; i<n; i++) {
			if (i!=0) cout << " ";
			cout << res[i]%2147483648;
		}
		cout << endl;
	}

Compiler output:
a.cc: In function 'll gcd(ll, ll)':
a.cc:10:13: error: invalid operands of types 'll' {aka 'long double'} and 'll' {aka 'long double'} to binary 'operator%'
   10 |         if(a%b==0) return b;
      |            ~^~
      |            | |
      |            | ll {aka long double}
      |            ll {aka long double}
a.cc:11:23: error: invalid operands of types 'll' {aka 'long double'} and 'll' {aka 'long double'} to binary 'operator%'
   11 |         return gcd(b,a%b);
      |                      ~^~
      |                      | |
      |                      | ll {aka long double}
      |                      ll {aka long double}
a.cc: In function 'int main()':
a.cc:60:39: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' {aka 'long double'} and 'long int' to binary 'operator%'
   60 |                         cout << res[i]%2147483648;
a.cc:63:10: error: expected '}' at end of input
   63 |         }
      |          ^
a.cc:13:12: note: to match this '{'
   13 | int main() {
      |            ^