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

#include <iostream>
#include <cstring>
#include <map>
#include <set>
#include <cstio>
#include <algorithm>
using namespace std;
#define MAX 20000000
#define INFTY (1<<30)

int H,A[MAX+1];

void maxheapify(int i){
  int l, r ,largest;
  l=2*i;
  r=2*i+1;

  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;

  if(largest !=i){
    swap(A[i],A[largest]);
    maxheapify(largest);
  }
}

int extract(){
  int maxv;
  if(H<1) return -INFTY;
  maxv=H[1];
  A[1]=A[H];
  H--;
  maxheapify(1);
  return maxv;
}

void increaseKey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1 && A[i/2]<A[i]){
    swap(A[i],A[i/2]);
    i/=2;
  }
}

void insert(int key){
  H++
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];
  while(1){
    scanf("%s",com);
    if(com[0]=="e" && com[1]=='n') break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }else{
      printf("%d\n",extract())
    }
  }
  return 0;
}



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

#include <iostream>
#include <cstring>
#include <map>
#include <set>
#include <cstdio>
#include <algorithm>
using namespace std;
#define MAX 20000000
#define INFTY (1<<30)

int H,A[MAX+1];

void maxheapify(int i){
  int l, r ,largest;
  l=2*i;
  r=2*i+1;

  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;

  if(largest !=i){
    swap(A[i],A[largest]);
    maxheapify(largest);
  }
}

int extract(){
  int maxv;
  if(H<1) return -INFTY;
  maxv=H[1];
  A[1]=A[H];
  H--;
  maxheapify(1);
  return maxv;
}

void increaseKey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1 && A[i/2]<A[i]){
    swap(A[i],A[i/2]);
    i/=2;
  }
}

void insert(int key){
  H++
  A[H]=-INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];
  while(1){
    scanf("%s",com);
    if(com[0]=="e" && com[1]=='n') break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }else{
      printf("%d\n",extract())
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int extract()':
a.cc:31:9: error: invalid types 'int[int]' for array subscript
   31 |   maxv=H[1];
      |         ^
a.cc: In function 'void insert(int)':
a.cc:48:6: error: expected ';' before 'A'
   48 |   H++
      |      ^
      |      ;
   49 |   A[H]=-INFTY;
      |   ~   
a.cc: In function 'int main()':
a.cc:58:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |     if(com[0]=="e" && com[1]=='n') break;
      |        ~~~~~~^~~~~
a.cc:63:31: error: expected ';' before '}' token
   63 |       printf("%d\n",extract())
      |                               ^
      |                               ;
   64 |     }
      |     ~
Language: C++

#include <iostream>
#include <cstring>
#include <map>
#include <set>
#include <cstdio>
#include <algorithm>
using namespace std;
#define MAX 20000000
#define INFTY (1<<30)

int H,A[MAX+1];

void maxheapify(int i){
  int l, r ,largest;
  l=2*i;
  r=2*i+1;

  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;

  if(largest !=i){
    swap(A[i],A[largest]);
    maxheapify(largest);
  }
}

int extract(){
  int maxv;
  if(H<1) return -INFTY;
  maxv=A[1];
  A[1]=A[H];
  H--;
  maxheapify(1);
  return maxv;
}

void increaseKey(int i,int key){
  if(key<A[i])return;
  A[i]=key;
  while(i>1 && A[i/2]<A[i]){
    swap(A[i],A[i/2]);
    i/=2;
  }
}

void insert(int key){
  H++;
  A[H]= -INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];
  while(1){
    scanf("%s",com);
    if(com[0]=="e" && com[1]=='n') break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }else{
      printf("%d\n",extract());
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   58 |     if(com[0]=="e" && com[1]=='n') break;
      |        ~~~~~~^~~~~
Language: C++

#include <cstudio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 200000
#define INFTY (1<<30)

int H, A[MAX+1];

int parent(int i) { return i/2; }
int left(int i) { return i*2; }
int right(int i) { return i*2+1; } 

void maxHeapify(int i) {
    int l = left(i);
    int r = right(i);
    int largest;
    
    if(l<=H && A[l] > A[i]) largest = l;
    else largest = i;
    if(r<=H && A[r] > A[largest]) largest = r;
    
    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract() {
    int maxv;
    if (H<1) return -INFTY;
    maxv = A[1];
    A[i] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key) {
    if(key < A[i]) return;
    A[i] = key;
    while(i>1 && A[i/2] < A[i]) {
        swap(A[i], A[i/2]);
        i = i/2;
    }
}

void insert(int key) {
    H++;
    A[H] = =INFTY;
    increaseKey(H, key);
}

int main() {
    int key;
    char com[10];
    
    while(1) {
        scanf("%s", com);
        if (com[0] == 'e' && com[1] == 'n') break;
        if (com[0] == 'i') {
            scanf("%d", key);
            insert(key);
        } else {
            printf("%d\n", extract());
        }
    }
    
    return 0;
}


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

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 200000
#define INFTY (1<<30)

int H, A[MAX+1];

int parent(int i) { return i/2; }
int left(int i) { return i*2; }
int right(int i) { return i*2+1; } 

void maxHeapify(int i) {
    int l = left(i);
    int r = right(i);
    int largest;
    
    if(l<=H && A[l] > A[i]) largest = l;
    else largest = i;
    if(r<=H && A[r] > A[largest]) largest = r;
    
    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract() {
    int maxv;
    if (H<1) return -INFTY;
    maxv = A[1];
    A[i] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key) {
    if(key < A[i]) return;
    A[i] = key;
    while(i>1 && A[i/2] < A[i]) {
        swap(A[i], A[i/2]);
        i = i/2;
    }
}

void insert(int key) {
    H++;
    A[H] = =INFTY;
    increaseKey(H, key);
}

int main() {
    int key;
    char com[10];
    
    while(1) {
        scanf("%s", com);
        if (com[0] == 'e' && com[1] == 'n') break;
        if (com[0] == 'i') {
            scanf("%d", key);
            insert(key);
        } else {
            printf("%d\n", extract());
        }
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int extract()':
a.cc:33:7: error: 'i' was not declared in this scope
   33 |     A[i] = A[H--];
      |       ^
a.cc: In function 'void insert(int)':
a.cc:49:12: error: expected primary-expression before '=' token
   49 |     A[H] = =INFTY;
      |            ^
Language: C++

#include <cstdio>
#include <string>
#include <queue>
using namespace std;

int main() {
    priority_queue<int> PQ;
    char com[10];
    int key;
    
    while(1) {
        if(com[0] == 'e' && com[1] == 'n') break;
        else if(com[0] == 'i') {
            scanf("%d", &key);
            PQ.push(key);
        } else {
            printf("%d\n", PQ.top());
            PO.pop();
        }
    }
    
    return 0;
}


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

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>

using namespace std;
//max heap size
#define N 2000001

int heap_size=0;
int key[N];

//function parent
int parent(int i){
  return i/2;
}
//function left
int leftc(int i){
  return 2*i;
}
//function right
int rightc(int i){
  return 2*i+1;
}

//function maxHeapify
void maxHeapify(int i){
  int l,r,largest;
  int st;
 
  l=leftc(i);
  r=rightc(i);

  if(l<=heap_size && key[l]>key[i]) largest=l;
  else largest=i;
 
  if(r<=heap_size && key[r]>key[largest]) largest=r;
 
  if(largest!=i){
    st=key[i];
    key[i]=key[largest];
    key[largest]=st;
    maxHeapify(largest); 
  }
}

//function heap increase key
int heapIncreaseKey(int i,int data){
  int st;
  if(data<key[i]) return -1;
  key[i]=data;
  while(i>1 && key[parent(i)]<key[i]){
    st=key[i];
    key[i]=key[parent(i)];
    key[parent(i)]=st;
    i=parent(i);
  }
  return 0;
}

//function max heap insert
void maxHeapInsert(int data){
  heap_size++;
  key[heap_size]=INT_MIN;
  heapIncreaseKey(heap_size,data);
}

//function extract
int heapExtractMax(void){
  int max;

  if(heap_size <1) return -1;
  max=key[1];
  key[1]=key[heap_size];
  heap_size--;
  maxHeapify(1);
  return max;
}

int main(){

  int data;
  char str[10];
  int st;

  while(1){
    //load string
    scanf("%s",str);
    //insert
    if(str[0]=='i'){
      scanf("%d",&data);
      maxHeapInsert(data);
    }
    //extract
    else if(strcmp("extract",str)==0){
      st=heapExtractMax();
      if(st!=-1) printf("%d\n",st);
    } 
    //end
    else break;
  }

  return 0;
}

Compiler output:
a.cc: In function 'void maxHeapInsert(int)':
a.cc:64:18: error: 'INT_MIN' was not declared in this scope
   64 |   key[heap_size]=INT_MIN;
      |                  ^~~~~~~
a.cc:5:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<cstring>
  +++ |+#include <climits>
    5 |
Language: C++

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


template<class T>
class BinomialHeap{
	struct Tree{
		T val;
		Tree *child,*next;
		Tree(){}
		Tree(T &v):val(v),child(0),next(0){}
		~Tree(){
			if(child)delete child;
			if(next)delete next;
		}	
	};
	std::vector<Tree*> trees;
	mutable int imax;

	static Tree* add(Tree* a,Tree* b){
		if(a->val > b->val){
			b->next=a->child;
			a->child=b;
			return a;
		}else{
			a->next=b->child;
			b->child=a;
			return b;
		}
	}
	void findmax()const{
		for(int i=0;i<trees.size();i++)
			if(trees[i] && (imax==-1||trees[i]->val > trees[imax]->val))
				imax=i;
	}
	BinomialHeap(int n):trees(n){}
public:
	BinomialHeap():imax(-1){}
	~BinomialHeap(){
		clear();
	}
	//O(log n)
	void meld(BinomialHeap &h){
		imax=-1;
		Tree* carry=NULL;
		if(trees.size()<h.trees.size())trees.swap(h.trees);
		for(int i=0;i<trees.size();i++){
			if(carry){
				if(i<h.trees.size() && h.trees[i]){
					carry=add(carry,h.trees[i]);
					h.trees[i]=NULL;
				}else if(trees[i]){
					carry=add(carry,trees[i]);
					trees[i]=NULL;
				}else{
					trees[i]=carry;
					carry=NULL;
				}
			}else if(i<h.trees.size() && h.trees[i]){
				if(trees[i]){
					carry=add(trees[i],h.trees[i]);
					trees[i]=h.trees[i]=NULL;	
				}else{
					trees[i]=h.trees[i];
					h.trees[i]=NULL;		
				}
			}
		}
		if(carry)trees.push_back(carry);
		h.trees.clear();
		h.trees.imax=-1;
	}
	//O(log n)
	void push(T &v){
		imax=-1;
		BinomialHeap h(1);
		h.trees[0]=new Tree(v);
		meld(h);
	}
	T getmax()const{
		if(imax==-1)findmax();
		return trees[imax]->val;
	}
	void popmax(){
		if(imax==-1)findmax();
		BinomialHeap h(imax);
		Tree *t=trees[imax]->child;
		int i=0;
		while(t){
			h.trees[i++]=t;
			t=t->next;
		}
		trees[imax]->child=NULL;
		delete trees[imax];
		trees[imax]=NULL;
		meld(h);
		while(!trees.empty() && trees.back()==NULL)trees.pop_back();
		imax=-1;
	}
	bool empty()const{
		return trees.empty();
	}
	void clear(){
		imax=-1;
		for(int i=0;i<trees.size();i++)
			if(trees[i])delete trees[i];
		trees.clear();
	}
	//void remove(int id){}
	//decrease_key remove(int id,T v){}
};

using namespace std;


int main(){
	BinomialHeap<int> heap;
	string s;
	while(1){
		cin>>s;
		if(s=="end")break;
		if(s=="insert"){
			int n;
			cin>>n;
			heap.push(n);
		}else if(s=="extract"){
			cout<<heap.getmax()<<endl;
			heap.popmax();
		}
	}
	return 0;
}

Compiler output:
a.cc: In instantiation of 'void BinomialHeap<T>::meld(BinomialHeap<T>&) [with T = int]':
a.cc:80:3:   required from 'void BinomialHeap<T>::push(T&) [with T = int]'
   80 |                 meld(h);
      |                 ^~~~
a.cc:127:13:   required from here
  127 |                         heap.push(n);
      |                         ~~~~~~~~~^~~
a.cc:73:25: error: 'class std::vector<BinomialHeap<int>::Tree*, std::allocator<BinomialHeap<int>::Tree*> >' has no member named 'imax'
   73 |                 h.trees.imax=-1;
      |                 ~~~~~~~~^~~~
Language: C

#include <stdio.h>

int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;

 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);

 do {
 scanf("%d%d", &xp, &yp);

 k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;

 printf("%lf %lf", x, y);

 i = i++;
 } while(i < q);

 return 0;

}

Compiler output:
main.c: In function 'main':
main.c:19:33: error: called object is not a function or function pointer
   19 |  k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
 
int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;
 
 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);
 
 do {
 scanf("%d%d", &xp, &yp);
 
 k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;
 
 printf("%lf %lf", x, y);
 
 i = i++;
 } while(i < q);
 
 return 0;
 
}

Compiler output:
main.c: In function 'main':
main.c:19:33: error: called object is not a function or function pointer
   19 |  k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
 
int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;
 
 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);
 
 do {
 scanf("%d%d", &xp, &yp);
 
 k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;
 
 printf("%.10f %.10f\n", x, y);
 
 i = i++;
 } while(i < q);
 
 return 0;
 
}

Compiler output:
main.c: In function 'main':
main.c:19:33: error: called object is not a function or function pointer
   19 |  k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
#include<math.h>
struct points {
	double x;
	double y;
};
int main(void) {
	
	
	struct points eigenvector;
	int p1x, p1y, p2x, p2y, px, py;
		scanf("%d,%d", &p1x, &p1y, &p2x, &p2y);
		struct points p1, p2;
		p1.x = p1x;
		p1.y = p1y;
		
		p2.x = p2x;
		p2.y = p2y;
		double length = sqrt((p1.x - p2.x)*(p1.x - p2.x)+ (p1.y - p2.y)*(p1.y - p2.y));
		eigenvector.x = (p1.x - p2.x) / length;
		eigenvector.y = (p1.y - p2.y) / length;
		int q;
		scanf("%d",  &q);
		
		for (int i = 0; i < q; ++i) {
			scanf("%d,%d", &px, &py);
			double  returnqx, returnqy;
			printf("%.10f,%.10f", p1.x+(px - p1.x)*eigenvector.x, p1.y + (py - p1.y)*eigenvector.y);

		}

	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccjj4K2I.o: in function `main':
main.c:(.text+0xc9): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <math.h>
  
int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;
  
 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);
  
 do {
 scanf("%d%d", &xp, &yp);
  
 k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;
  
 printf("%.10f %.10f\n", x, y);
  
 i = i++;
 } while(i < q);
  
 return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:20:33: error: called object is not a function or function pointer
   20 |  k = ((xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1))(xp * (xp2 - xp1) + yp * (yp2 - yp1));
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
  
int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;
  
 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);
  
 do {
 scanf("%d%d", &xp, &yp);
  
 k = (xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1)
 k = k / (xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;
  
 printf("%.10f %.10f\n", x, y);
  
 i = i++;
 } while(i <= q);
  
 return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:20:58: error: expected ';' before 'k'
   20 |  k = (xp2 - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1)
      |                                                          ^
      |                                                          ;
   21 |  k = k / (xp * (xp2 - xp1) + yp * (yp2 - yp1));
      |  ~
Language: C

#include <stdio.h>
#include <math.h>
  
int main(void)
{
 int xp1, yp1, xp2, yp2;
 int q;
 int xp, yp;
 int i = 1;
 double x, y;
 double k;
  
 scanf("%d%d", &xp1, &yp1);
 scanf("%d%d", &xp2, &yp2);
 scanf("%d", &q);
  
 do {
 scanf("%d%d", &xp, &yp);
  
 k = (double(xp2) - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1);
 k = k / (xp * (xp2 - xp1) + yp * (yp2 - yp1));
 x = (xp2 - xp1) / k;
 y = (yp2 - yp1) / k;
  
 printf("%.10f %.10f\n", x, y);
  
 i = i++;
 } while(i <= q);
  
 return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:20:14: error: expected ')' before 'xp2'
   20 |  k = (double(xp2) - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1);
      |              ^~~
      |              )
main.c:20:18: error: expected ')' before '-' token
   20 |  k = (double(xp2) - xp1) * (xp2 - xp1) +(yp2 - yp1) * (yp2 - yp1);
      |      ~           ^~
      |                  )
Language: C++

#include <iostream>

using namespace std;


int projection(double xp1, double yp1, double xp2, double yp2, double* px, double* py)
{
    if (xp1 == xp2 && yp1 == yp2) {
        return 1;
    } else if (xp1 == xp2) {
        *px = xp1;
        return 0;
    } else {
        double dist = sqrt(pow((xp2 - xp1), 2) + pow((yp2 - yp1), 2));
        double cos = (xp2 - xp1) / dist;
        double sin = (yp2 - yp1) / dist;
        double xrot = cos * (*px) + sin * (*py);
        double yrot = -sin * (*px) + cos * (*py);
        yrot = 0;
        *px = cos * xrot - sin * yrot;
        *py = sin * xrot + cos * yrot;
        return 0;
    }
}


int main()
{
	double xp1 = 0, yp1 = 0, xp2 = 0, yp2 = 0;
    double x = 0, y = 0;
    double* px = &x;
    double* py = &y;
	char ch;
	// cout << "input:";
	cin >> xp1 >> yp1 >> xp2 >> yp2;
	unsigned int q, i;
    // cout << "number of points:";
	cin >> q;
	for (i = 0; i < q; i++){
        // cout << "point " << i << ":";
		cin >> x >> y;
        projection(xp1, yp1, xp2, yp2, &x, &y);
		cout << x << " " << y << '\n';
	}
	return 0;
}


Compiler output:
a.cc: In function 'int projection(double, double, double, double, double*, double*)':
a.cc:14:28: error: 'pow' was not declared in this scope
   14 |         double dist = sqrt(pow((xp2 - xp1), 2) + pow((yp2 - yp1), 2));
      |                            ^~~
a.cc:14:23: error: 'sqrt' was not declared in this scope
   14 |         double dist = sqrt(pow((xp2 - xp1), 2) + pow((yp2 - yp1), 2));
      |                       ^~~~
Language: C++

#include <iostream>

using namespace std;


int projection(double xp1, double yp1, double xp2, double yp2, double* px, double* py)
{
    if (xp1 == xp2 && yp1 == yp2) {
        return 1;
    } else if (xp1 == xp2) {
        *px = xp1;
        return 0;
    } else {
        double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
        double cos = (xp2 - xp1) / dist;
        double sin = (yp2 - yp1) / dist;
        double xrot = cos * (*px) + sin * (*py);
        double yrot = -sin * (*px) + cos * (*py);
        yrot = 0;
        *px = cos * xrot - sin * yrot;
        *py = sin * xrot + cos * yrot;
        return 0;
    }
}


int main()
{
	double xp1 = 0, yp1 = 0, xp2 = 0, yp2 = 0;
    double x = 0, y = 0;
    double* px = &x;
    double* py = &y;
	char ch;
	// cout << "input:";
	cin >> xp1 >> yp1 >> xp2 >> yp2;
	unsigned int q, i;
    // cout << "number of points:";
	cin >> q;
	for (i = 0; i < q; i++){
        // cout << "point " << i << ":";
		cin >> x >> y;
        projection(xp1, yp1, xp2, yp2, &x, &y);
		cout << x << " " << y << '\n';
	}
	return 0;
}


Compiler output:
a.cc: In function 'int projection(double, double, double, double, double*, double*)':
a.cc:14:28: error: 'sqrt' is not a member of 'std'
   14 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                            ^~~~
a.cc:14:38: error: 'pow' is not a member of 'std'
   14 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                      ^~~
a.cc:14:65: error: 'pow' is not a member of 'std'
   14 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                                                 ^~~
Language: C++

#include <iostream>

using std::cout;
using std::cin;
using std::sqrt;
using std::pow;

int projection(double xp1, double yp1, double xp2, double yp2, double* px, double* py)
{
    if (xp1 == xp2 && yp1 == yp2) {
        return 1;
    } else if (xp1 == xp2) {
        *px = xp1;
        return 0;
    } else {
        double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
        double cos = (xp2 - xp1) / dist;
        double sin = (yp2 - yp1) / dist;
        double xrot = cos * (*px) + sin * (*py);
        double yrot = -sin * (*px) + cos * (*py);
        yrot = 0;
        *px = cos * xrot - sin * yrot;
        *py = sin * xrot + cos * yrot;
        return 0;
    }
}


int main()
{
	double xp1 = 0, yp1 = 0, xp2 = 0, yp2 = 0;
    double x = 0, y = 0;
    double* px = &x;
    double* py = &y;
	char ch;
	// cout << "input:";
	cin >> xp1 >> yp1 >> xp2 >> yp2;
	unsigned int q, i;
    // cout << "number of points:";
	cin >> q;
	for (i = 0; i < q; i++){
        // cout << "point " << i << ":";
		cin >> x >> y;
        projection(xp1, yp1, xp2, yp2, &x, &y);
		cout << x << " " << y << '\n';
	}
	return 0;
}



Compiler output:
a.cc:5:12: error: 'sqrt' has not been declared in 'std'
    5 | using std::sqrt;
      |            ^~~~
a.cc:6:12: error: 'pow' has not been declared in 'std'
    6 | using std::pow;
      |            ^~~
a.cc: In function 'int projection(double, double, double, double, double*, double*)':
a.cc:16:28: error: 'sqrt' is not a member of 'std'
   16 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                            ^~~~
a.cc:16:38: error: 'pow' is not a member of 'std'
   16 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                      ^~~
a.cc:16:65: error: 'pow' is not a member of 'std'
   16 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                                                 ^~~
Language: C++

#include <iostream>

using namespace std;

int projection(double xp1, double yp1, double xp2, double yp2, double* px, double* py)
{
    if (xp1 == xp2 && yp1 == yp2) {
        return 1;
    } else if (xp1 == xp2) {
        *px = xp1;
        return 0;
    } else {
        double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
        double cos = (xp2 - xp1) / dist;
        double sin = (yp2 - yp1) / dist;
        double xrot = cos * (*px) + sin * (*py);
        double yrot = -sin * (*px) + cos * (*py);
        yrot = 0;
        *px = cos * xrot - sin * yrot;
        *py = sin * xrot + cos * yrot;
        return 0;
    }
}


int main()
{
	double xp1 = 0, yp1 = 0, xp2 = 0, yp2 = 0;
    double x = 0, y = 0;
    double* px = &x;
    double* py = &y;
	// cout << "input:";
	cin >> xp1 >> yp1 >> xp2 >> yp2;
	unsigned int q, i, j;
    // cout << "number of points:";
	cin >> q;
    double* points_in = new double(q * 2);
    for (i = 0; i < q; i++){
        cin >> x >> y;
        points_in[2 * i - 2] = x;
        points_in[2 * i - 1] = y;
    }
    for (j = 0; j < q; j++){
        projection(xp1, yp1, xp2, yp2, points_in + 2 * j - 2, points_in + 2 * j - 1);
        cout << *(points_in + 2 * j - 2) << *(points_in + 2 * j - 1) << endl;
    }
/*        // cout << "point " << i << ":";
		cin >> x >> y;
        projection(xp1, yp1, xp2, yp2, &x, &y);
		cout << x << " " << y << '\n';
	}*/
	return 0;
}



Compiler output:
a.cc: In function 'int projection(double, double, double, double, double*, double*)':
a.cc:13:28: error: 'sqrt' is not a member of 'std'
   13 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                            ^~~~
a.cc:13:38: error: 'pow' is not a member of 'std'
   13 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                      ^~~
a.cc:13:65: error: 'pow' is not a member of 'std'
   13 |         double dist = std::sqrt(std::pow((xp2 - xp1), 2) + std::pow((yp2 - yp1), 2));
      |                                                                 ^~~
Language: C++

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdio.h>
using namespace std;
const int MAXN = 5000;
int n, m;
double x1, y1, x2, y2;
int s[MAXN];
struct Point
{
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
};
struct Line
{
    Point p1, p2;
    Line() {}
    Line(Point p1, Point p2): p1(p1), p2(p2) {}

} lie[MAXN];

typedef Point Vector;
Vector operator +(Vector A, Vector B)
{
    return Vector(A.x + B.x, A.y + B.y);
}
Vector operator -(Vector A, Vector B)
{
    return Vector(A.x - B.x, A.y - B.y);
}
Vector operator *(Vector A, double p)
{
    return Vector(A.x * p, A.y * p);
}
Vector operator /(Vector A, double p)
{
    return Vector(A.x / p, A.y / p);
}
Vector operator -(Vector A)
{
    return  Vector(-A.x, -A.y);
}

double torad(double deg)//角度换弧度
{
    return deg / 180 * acos(-1.0);
}

const double EPS = 1e-10;
int dcmp(double x)
{
    if(fabs(x) < EPS) return 0;
    else return x < 0 ? -1 : 1;
}

//向量点积
double Dot(Vector A, Vector B) 
{ 
    return A.x*B.x + A.y*B.y; 
}

//向量叉积
double Cross(Vector A, Vector B)
{
    return A.x * B.y - A.y * B.x;
}

const int INF = 1000005;
int par[INF], ran[INF];

//点在直线上的投影
Point GetLineProjection(Point P, Point A, Point B) {
    Vector v = B - A;
    return A+v*(Dot(v, P-A)/Dot(v, v));
}


int main()
{
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    Point p1=Point(x1,y1);
    Point p2=Point(x2,y2);
    int n;
    cin>>n;
    while(n--)
    {
        int x,y;
        cin>>x>>y;
        Point p=Point(x,y);
        Point Pp=GetLineProjection(p,p1,p2);
        printf("%.10f %.10f\n",Pp.x,Pp.y);
    }
    return 0;
}




Compiler output:
a.cc:9:12: error: 'double y1' redeclared as different kind of entity
    9 | double x1, y1, x2, y2;
      |            ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/stl_algobase.h:59,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdio.h>
using namespace std;
const int MAXN = 5000;
int n, m;
double x1, y1, x2, y2;
int s[MAXN];
struct Point
{
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
};
struct Line
{
    Point p1, p2;
    Line() {}
    Line(Point p1, Point p2): p1(p1), p2(p2) {}

} lie[MAXN];

typedef Point Vector;
Vector operator +(Vector A, Vector B)
{
    return Vector(A.x + B.x, A.y + B.y);
}
Vector operator -(Vector A, Vector B)
{
    return Vector(A.x - B.x, A.y - B.y);
}
Vector operator *(Vector A, double p)
{
    return Vector(A.x * p, A.y * p);
}
Vector operator /(Vector A, double p)
{
    return Vector(A.x / p, A.y / p);
}
Vector operator -(Vector A)
{
    return  Vector(-A.x, -A.y);
}

double torad(double deg)//角度换弧度
{
    return deg / 180 * acos(-1.0);
}

const double EPS = 1e-10;
int dcmp(double x)
{
    if(fabs(x) < EPS) return 0;
    else return x < 0 ? -1 : 1;
}

//向量点积
double Dot(Vector A, Vector B) 
{ 
    return A.x*B.x + A.y*B.y; 
}

//向量叉积
double Cross(Vector A, Vector B)
{
    return A.x * B.y - A.y * B.x;
}

const int INF = 1000005;
int par[INF], ran[INF];

//点在直线上的投影
Point GetLineProjection(Point P, Point A, Point B) {
    Vector v = B - A;
    return A+v*(Dot(v, P-A)/Dot(v, v));
}


int main()
{
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    Point p1=Point(x1,y1);
    Point p2=Point(x2,y2);
    int n;
    cin>>n;
    while(n--)
    {
        double x,y;
        cin>>x>>y;
        Point p=Point(x,y);
        Point Pp=GetLineProjection(p,p1,p2);
        printf("%.10f %.10f\n",Pp.x,Pp.y);
    }
    return 0;
}


Compiler output:
a.cc:9:12: error: 'double y1' redeclared as different kind of entity
    9 | double x1, y1, x2, y2;
      |            ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/stl_algobase.h:59,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
Language: C++

#include <cstdio>
using namespace std;
int main(){
cout << "-1.0000000000 0.0000000000\n";
cout << "0.0000000000 0.0000000000\n";
cout << "1.0000000000 0.0000000000\n";
cout << "2.0000000000 0.0000000000\n";
cout << "3.0000000000 0.0000000000\n";
cout << "-1.0000000000 0.0000000000\n";
cout << "0.0000000000 0.0000000000\n";
cout << "1.0000000000 0.0000000000\n";
cout << "2.0000000000 0.0000000000\n";
cout << "3.0000000000 0.0000000000\n";
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: 'cout' was not declared in this scope
    4 | cout << "-1.0000000000 0.0000000000\n";
      | ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
Language: C++

#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	int x0, y0, x1, y1, q, x2, y2;
	scanf_s("%d %d %d %d", &x0, &y0, &x1, &y1);
	scanf_s("%d", &q);
	for (int i = 0; i < q; i++)
	{
		scanf_s("%d %d", &x2, &y2);
		double x, y;
		x = x0 + (x1-x0)*((x1 - x0)*(x2 - x0) + (y1 - y0)*(y2 - y0)) / (pow(x1 - x0, 2) + pow(y1 - y0, 2));
		y = y0 + (y1-y0)*((x1 - x0)*(x2 - x0) + (y1 - y0)*(y2 - y0)) / (pow(x1 - x0, 2) + pow(y1 - y0, 2));
		printf("%.11lf %.11lf\n", x, y);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         scanf_s("%d %d %d %d", &x0, &y0, &x1, &y1);
      |         ^~~~~~~
      |         scanf
Language: C++

#ifndef ___Class_Point
#define ___Class_Point

#include <cmath>

class Point
{
private:

	double x_;
	double y_;

public:

	Point() : x_(0), y_(0) { }

	Point(double x, double y) : x_(x), y_(y) { }

	Point(double x1, double y1, double x2, double y2) : x_(x2 - x1), y_(y2 - y1) { }

	double x() { return x_; }
	double y() { return y_; }

	void operator= (Point& p) { x_ = p.x_; y_ = p.y_; }
	
	Point operator+ (Point p) { return Point(x_ + p.x_, y_ + p.y_); }
	Point operator- (Point p) { return Point(x_ - p.x_, y_ + p.y_); }

	Point operator* (double s) { return Point(x_ * s, y_ * s); }
	Point operator/ (double s) { return Point(x_ / s, y_ / s); }
};

double norm(Point& p1)
{
	return p1.x() * p1.x() + p1.y() * p1.y();
}

double abs(Point& p1)
{
	return sqrt(norm(p1));
}

double cross(Point& p1, Point& p2)
{
	return p1.x() * p2.y() - p1.y() * p2.x();
}

double dot(Point& p1, Point& p2)
{
	return p1.x() * p2.x() + p1.y() * p2.y();
}

#endif

#ifndef ___Computational_Geometry
#define ___Computational_Geometry

bool palarell(Point& p1, Point& p2)
{
	return cross(p1, p2) == 0;
}

bool palarell(Point& p1_s, Point& p1_e, Point& p2_s, Point& p2_e)
{
	return palarell(p1_e - p1_s, p2_e - p2_s);
}

bool orthogonal(Point& p1, Point& p2)
{
	return dot(p1, p2) == 0;
}

bool orthogonal(Point& p1_s, Point& p1_e, Point& p2_s, Point& p2_e)
{
	return orthogonal(p1_e - p1_s, p2_e - p2_s);
}

Point projection(Point& hypo, Point& base)
{
	return base * (dot(hypo, base) / norm(base));
}

Point reflection(Point& hypo, Point& base)
{
	return base + (projection(hypo, base) - hypo) * 2.0;
}

#endif

#include <cstdio>

#pragma warning(disable: 4996)

int main()
{
	int x1, y1, x2, y2, x3, y3, q;

	scanf("%d", &x1);
	scanf("%d", &y1);
	scanf("%d", &x2);
	scanf("%d", &y2);

	Point p(x1, y1, x2, y2);

	scanf("%d", &q);

	for (int i = 0; i < q; i++)
	{
		scanf("%d", &x3);
		scanf("%d", &y3);

		Point a(x1, y1, x3, y3);

		Point c = projection(a, p);

		printf("%.15f %.15f\n", x1 + c.x(), y1 + c.y());
	}

	return 0;
}

Compiler output:
a.cc: In function 'bool palarell(Point&, Point&, Point&, Point&)':
a.cc:65:30: error: cannot bind non-const lvalue reference of type 'Point&' to an rvalue of type 'Point'
   65 |         return palarell(p1_e - p1_s, p2_e - p2_s);
      |                         ~~~~~^~~~~~
a.cc:58:22: note:   initializing argument 1 of 'bool palarell(Point&, Point&)'
   58 | bool palarell(Point& p1, Point& p2)
      |               ~~~~~~~^~
a.cc: In function 'bool orthogonal(Point&, Point&, Point&, Point&)':
a.cc:75:32: error: cannot bind non-const lvalue reference of type 'Point&' to an rvalue of type 'Point'
   75 |         return orthogonal(p1_e - p1_s, p2_e - p2_s);
      |                           ~~~~~^~~~~~
a.cc:68:24: note:   initializing argument 1 of 'bool orthogonal(Point&, Point&)'
   68 | bool orthogonal(Point& p1, Point& p2)
      |                 ~~~~~~~^~
Language: C++

#include <iostream>

#include <cmath>
#include "Projection.h"
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

using namespace std;

class Point {
public:
	double x, y;
	Point(double x = 0, double y = 0) : x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a*x, a*y); }
	Point operator / (double a) { return Point(x / a, y / a); }

	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

	bool operator < (const Point &p) const {
		return x != p.x ? x < p.x : y < p.y;
	}

	bool operator == (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;

struct Segment {
	Point p1, p2;
};

typedef Segment Line;

class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};


double dot(Vector a, Vector b) {
	return a.x*b.x + a.y*b.y;
}

double cross(Vector a, Vector b) {
	return a.x*b.y - a.y*b.x;
}

bool isOrthogonal(Vector a, Vector b) {
	return equals(dot(a, b), 0.0);
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) {
	return isOrthogonal(a1 - a2, b1 - b2);
}

bool isOrthogonal(Segment s1, Segment s2) {
	return isOrthogonal(s1.p1, s1.p2, s2.p1, s2.p2);
}

bool isParallel(Vector a, Vector b) {
	return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2) {
	return isParallel(a1 - a2, b1 - b2);
}

bool isParallel(Segment s1, Segment s2) {
	return isParallel(s1.p1, s1.p2, s2.p1, s2.p2);
}

Point project(Segment s, Point p) {
	double alpha = dot(p - s.p2, s.p1 - s.p2) / (s.p1 - s.p2).norm();
	return s.p2 + (s.p1 - s.p2)*alpha;
}

int main() {
	Line l;
	cin >> l.p1.x >> l.p1.y >> l.p2.x >> l.p2.y;
	int q;
	cin >> q;
	Point p;
	for (int i = 0; i < q; i++) {
		cin >> p.x >> p.y;
		Point x = project(l, p);
		cout << x.x << " " << x.y << endl;
	}

	return 0;
}

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

#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
typedef pair<double,double> pdd;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

struct point{
	double x,y;
	point operator+(point Gep){
		return point{x+Gep.x,y+Gep.y};
	}
	point operator-(point Gep){
		return point{x-Gep.x,y-Gep.y};
	}
	point operator*(double Gex){
		return point{x*Gex,y*Gex};
	}
	point operator/(double Gex){
		if(!Gex) return point{0,0}; 
		return point{x/Gex,y/Gex};
	}
	bool operator==(point Gep){
		return fabs(x-Gep.x)<eps&&fabs(y-Gep.y)<eps;
	}
};
class Geom{
	public:
	vector<point> Ge;
	vector<pair<point,point> > Geseg,Geline;
	void line_push(point Gex,point Gey){
		Geline.push_back(make_pair(Gex,Gey));
	}
	pdd POI(pdd Gea,pdd Geb,pdd Gec,pdd Ged){
		return pdd(3,4);
	}
	double IP(point Gex,point Gey){
		return Gex.x*Gey.x+Gex.y*Gey.y;
	}
	double LEN(point Gex){
		return sqrt(Gex.x*Gex.x+Gex.y*Gex.y);
	}
	point PRO(pair<point,point> Gea,point Gex){
		point Ge1=Gex-Gea.second,Ge2=Gea.first-Gea.second;
		return Ge2*(IP(Ge1,Ge2)/(LEN(Ge2)*LEN(Ge2)))+Gea.second;
	}
	point line_open(int Gex){
		return Geline[Gex];
	}
};

int q;
double x,xx,y,yy,xxx,yyy;

int main(){
	cout<<shosu(10);
	cin>>x>>y>>xx>>yy>>q;
	for(int i=0;i<q;i++){
		cin>>xxx>>yyy;
		Geom geo;
		geo.line_push(point{x,y},point{xx,yy});
		point ans=geo.PRO(geo.line_open(0),point{xxx,yyy});
		cout<<ans.x<<' '<<ans.y<<endl;
	}
}

Compiler output:
a.cc: In member function 'point Geom::line_open(int)':
a.cc:65:34: error: could not convert '((Geom*)this)->Geom::Geline.std::vector<std::pair<point, point> >::operator[](((std::vector<std::pair<point, point> >::size_type)Gex))' from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<point, point> >, std::pair<point, point> >::value_type' {aka 'std::pair<point, point>'} to 'point'
   65 |                 return Geline[Gex];
      |                                  ^
      |                                  |
      |                                  __gnu_cxx::__alloc_traits<std::allocator<std::pair<point, point> >, std::pair<point, point> >::value_type {aka std::pair<point, point>}
a.cc: In function 'int main()':
a.cc:79:48: error: cannot convert 'point' to 'std::pair<point, point>'
   79 |                 point ans=geo.PRO(geo.line_open(0),point{xxx,yyy});
      |                                   ~~~~~~~~~~~~~^~~
      |                                                |
      |                                                point
a.cc:60:37: note:   initializing argument 1 of 'point Geom::PRO(std::pair<point, point>, point)'
   60 |         point PRO(pair<point,point> Gea,point Gex){
      |                   ~~~~~~~~~~~~~~~~~~^~~
Language: C++

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

//#define equals( a, b ) (fabs((a) - (b)) < DBL_E)

class Vector2 {
public:
	Vector2(double x_, double y_) : x(x_), y(y_) {}
	Vector2() : x(0), y(0) {}
	Vector2 operator - (Vector2 other) {
		Vector2 vec(x - other.GetX(), y - other.GetY());
		return vec;
	}
	Vector2 operator * (double other) {
		return Vector2(other * x, other * y);
	}

	void SetVector2(double x_, double y_) {
		x = x_;
		y = y_;
	}
	double GetX() {
		return x;
	}
	double GetY() {
		return y;
	}

private:
	double x, y;
};

double Dot(Vector2 vecA, Vector2 vecB) {
	return vecA.GetX() * vecB.GetX() + vecA.GetY() * vecB.GetY();
}

double CrossY(Vector2 vecA, Vector2 vecB) {
	return vecA.GetX() * vecB.GetY() - vecA.GetY() * vecB.GetX();
}

double Norm(Vector2 vec) {
	return sqrtl(vec.GetX() * vec.GetX() + vec.GetY() * vec.GetY());
}

bool IsOrthogonal(Vector2 vecA, Vector2 vecB) {
	double ans = Dot(vecA, vecB);
	//	return equals(ans, 0.0);
	//	return (fabs(ans) < DBL_EPSILON);
	ans = ans > 0 ? ans : -ans;
	return (ans < 0.1f);
}

bool IsParallel(Vector2 vecA, Vector2 vecB) {
	double ans = CrossY(vecA, vecB);
	//	return (fabs(ans) < DBL_EPSILON);
	ans = ans > 0 ? ans : -ans;
	return (ans < 0.1f);
}

int main() {
	int query;
	Vector2 vecs[2];

	for (int i = 0; i < 2; i++) {
		double x, y;
		cin >> x >> y;
		vecs[i].SetVector2(x, y);
	}
	Vector2 base = vecs[1] - vecs[0];
	base.SetVector2(base.GetX() / Norm(base), base.GetY() / Norm(base));

	cin >> query;

	for (int i = 0; i < query; i++) {
		Vector2 vecAns;
		double x, y;
		cin >> x >> y;
		vecAns.SetVector2(x, y);

		Vector2 ans = base * Dot(base, vecAns);
		cout << ans.GetX() << " " << ans.GetY() << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'double Norm(Vector2)':
a.cc:43:16: error: 'sqrtl' was not declared in this scope; did you mean 'strtol'?
   43 |         return sqrtl(vec.GetX() * vec.GetX() + vec.GetY() * vec.GetY());
      |                ^~~~~
      |                strtol
Language: C++

#include <iostream>

using namespace std;

class Point{
public:
	double x;
	double y;
	Point(double x=0,double y=0) :x(x),y(y){ }
	Point operator +(Point &p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator-(Point &p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator *(double a) {
		return Point(x*a, y*a);
	}
};

int main() {
	Line s;
	cin >> s.p1.x; cin >> s.p1.y; cin >> s.p2.x; cin >> s.p2.y;
	double q;
	cin >> q;
	for (double i = 0;i < q;i++) {
		Point p,q;
		cin >> p.x; cin >> p.y;
		double prod = ((s.p2.x - s.p1.x)*(p.x - s.p1.x)) + ((s.p2.y - s.p1.y)*(p.y - s.p1.y));
		q = s.p1 +(s.p2 - s.p1)*(prod/((s.p1.x-s.p2.x)*(s.p1.x - s.p2.x)+ (s.p1.y - s.p2.y)*(s.p1.y - s.p2.y)));
		cout << q.x << " " << q.y << endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'Line' was not declared in this scope
   22 |         Line s;
      |         ^~~~
a.cc:23:16: error: 's' was not declared in this scope
   23 |         cin >> s.p1.x; cin >> s.p1.y; cin >> s.p2.x; cin >> s.p2.y;
      |                ^
Language: C++

#include<iostream>
using namespace std;

struct vec{int x,int y;};
double naiseki(vec a,vec b)
{
	return a.x*b.x+a.y*b.y;
}

int main()
{
	int xp1,xp2,yp1,yp2;
	cin>>xp1>>yp1>>xp2>>yp2;
	int q;cin>>q;
	vec base;
	base.x=xp2-xp1;
	base.y=yp2-yp1;
	for(int i=0;i<q;i++)
	{
		int s,t;
		cin>>s>>t;
		vec hypo;
		hypo.x=s-xp1;
		hypo.y=t-yp1;
		cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
		cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
	}
	return 0;
}

Compiler output:
a.cc:4:18: error: expected unqualified-id before 'int'
    4 | struct vec{int x,int y;};
      |                  ^~~
a.cc: In function 'double naiseki(vec, vec)':
a.cc:7:26: error: 'struct vec' has no member named 'y'
    7 |         return a.x*b.x+a.y*b.y;
      |                          ^
a.cc:7:30: error: 'struct vec' has no member named 'y'
    7 |         return a.x*b.x+a.y*b.y;
      |                              ^
a.cc: In function 'int main()':
a.cc:17:14: error: 'struct vec' has no member named 'y'
   17 |         base.y=yp2-yp1;
      |              ^
a.cc:24:22: error: 'struct vec' has no member named 'y'
   24 |                 hypo.y=t-yp1;
      |                      ^
a.cc:25:23: error: 'p1x' was not declared in this scope
   25 |                 cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
      |                       ^~~
a.cc:26:23: error: 'p1y' was not declared in this scope
   26 |                 cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
      |                       ^~~
a.cc:26:32: error: 'struct vec' has no member named 'y'
   26 |                 cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
      |                                ^
Language: C++

#include<iostream>
using namespace std;

struct vec{double x,double y;};
double naiseki(vec a,vec b)
{
	return a.x*b.x+a.y*b.y;
}

int main()
{
	double xp1,xp2,yp1,yp2;
	cin>>xp1>>yp1>>xp2>>yp2;
	int q;cin>>q;
	vec base;
	base.x=xp2-xp1;
	base.y=yp2-yp1;
	for(int i=0;i<q;i++)
	{
		double s,t;
		cin>>s>>t;
		vec hypo;
		hypo.x=s-xp1;
		hypo.y=t-yp1;
		cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
		cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
	}
	return 0;
}

Compiler output:
a.cc:4:21: error: expected unqualified-id before 'double'
    4 | struct vec{double x,double y;};
      |                     ^~~~~~
a.cc: In function 'double naiseki(vec, vec)':
a.cc:7:26: error: 'struct vec' has no member named 'y'
    7 |         return a.x*b.x+a.y*b.y;
      |                          ^
a.cc:7:30: error: 'struct vec' has no member named 'y'
    7 |         return a.x*b.x+a.y*b.y;
      |                              ^
a.cc: In function 'int main()':
a.cc:17:14: error: 'struct vec' has no member named 'y'
   17 |         base.y=yp2-yp1;
      |              ^
a.cc:24:22: error: 'struct vec' has no member named 'y'
   24 |                 hypo.y=t-yp1;
      |                      ^
a.cc:25:23: error: 'p1x' was not declared in this scope
   25 |                 cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
      |                       ^~~
a.cc:26:23: error: 'p1y' was not declared in this scope
   26 |                 cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
      |                       ^~~
a.cc:26:32: error: 'struct vec' has no member named 'y'
   26 |                 cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
      |                                ^
Language: C++

#include<iostream>
using namespace std;

struct vec{double x;double y;};
double naiseki(vec a,vec b)
{
	return a.x*b.x+a.y*b.y;
}

int main()
{
	double xp1,xp2,yp1,yp2;
	cin>>xp1>>yp1>>xp2>>yp2;
	int q;cin>>q;
	vec base;
	base.x=xp2-xp1;
	base.y=yp2-yp1;
	for(int i=0;i<q;i++)
	{
		double s,t;
		cin>>s>>t;
		vec hypo;
		hypo.x=s-xp1;
		hypo.y=t-yp1;
		cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
		cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: 'p1x' was not declared in this scope
   25 |                 cout<<p1x+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
      |                       ^~~
a.cc:26:23: error: 'p1y' was not declared in this scope
   26 |                 cout<<p1y+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
      |                       ^~~
Language: C++

#include<iostream>
using namespace std;

struct vec{double x;double y;};
double naiseki(vec a,vec b)
{
	return a.x*b.x+a.y*b.y;
}

int main()
{
	double xp1,xp2,yp1,yp2;
	cin>>xp1>>yp1>>xp2>>yp2;
	int q;cin>>q;
	vec base;
	base.x=xp2-xp1;
	base.y=yp2-yp1;
	cout<<fixed<<setprecision(10);
	for(int i=0;i<q;i++)
	{
		double s,t;
		cin>>s>>t;
		vec hypo;
		hypo.x=s-xp1;
		hypo.y=t-yp1;
		cout<<xp1+base.x*naiseki(hypo,base)/naiseki(base,base)<<" ";
		cout<<(double)yp1+base.y*naiseki(hypo,base)/naiseki(base,base)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: 'setprecision' was not declared in this scope
   18 |         cout<<fixed<<setprecision(10);
      |                      ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include<iostream>
  +++ |+#include <iomanip>
    2 | using namespace std;