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

#include<stdio.h>
#include<math.h>

struct Point { double x, y; }]

void koch(int n, Point a, Point b) {
  if ( n == 0) return ;

  Point c, d, e;
  double th = M_PI * 60.0 /180.0;

  c.x = (2.0 * a.x +1.0 * b.x)/ 3.0;
  c.y = (2.0 * a.x +1.0 * b.x)/ 3.0;
  d.x = (1.0 * a.x +1.0 * b.x)/ 3.0;
  d.y = (1.0 * a.x +1.0 * b.x)/ 3.0;
  e.x = (d.x - c.x) * cos(th) - (d.y - c.y) * sin(th) + c.x;
  e.x = (d.x - c.x) * sin(th) + (d.y - c.y) * cos(th) + c.y;  
  
  koch( n-1 ,a, c);
  printf("%.8f %.8f\n", c.x, c.y);
  koch( n-1 ,c, e);
  printf("%.8f %.8f\n", e.x, e.y);
  koch( n-1 ,e, d);
  printf("%.8f %.8f\n", d.x, d.y);
  koch( n-1 ,d, b);
  }
  

int main(){
  Point a,b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch( n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;

}

Compiler output:
a.cc:4:30: error: expected ';' after struct definition
    4 | struct Point { double x, y; }]
      |                              ^
      |                              ;
a.cc:4:30: error: expected unqualified-id before ']' token
a.cc: In function 'int main()':
a.cc:41:3: error: 'koch' was not declared in this scope
   41 |   koch( n, a, b);
      |   ^~~~
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; }

void koch(int n, Point a, Point b) {
  if ( n == 0) return;

  Point s, t, u;
  double th = M_PI * 60.0 /180.0;

  s.x = (2.0 * a.x +1.0 * b.x)/ 3.0;
  s.y = (2.0 * a.x +1.0 * b.x)/ 3.0;
  t.x = (1.0 * a.x +1.0 * b.x)/ 3.0;
  t.y = (1.0 * a.x +1.0 * b.x)/ 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.x = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;  
  
  koch( n-1 ,a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch( n-1 ,s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch( n-1 ,u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch( n-1 ,t, b);
  }
  

int main(){
  Point a,b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch( n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;

}

Compiler output:
a.cc:4:30: error: expected ';' after struct definition
    4 | struct Point { double x, y; }
      |                              ^
      |                              ;
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
??
void Kochcurve(double stX, double stY, double edX, double edY, int n){
????????if(n!=0){
????????????????double sX, sY, tX, tY, uX, uY;
????????????????sX = stX + (edX - stX) / 3;
????????????????sY = stY + (edY - stY) / 3;
????????????????tX = stX + (edX - stX) * 2 / 3;
????????????????tY = stY + (edY - stY) * 2 / 3;
????????????????uX = sX + (tX - sX) / 2 - (tY - sY) * sqrt(3) / 2;
????????????????uY = sY + (tX - sX) * sqrt(3) / 2 + (tY - sY) / 2;
??????????????????
????????????????Kochcurve(stX,stY,sX,sY,n-1);
????????????????cout << sX << " " << sY << endl;
????????????????Kochcurve(sX,sY,uX,uY,n-1);
????????????????cout << uX << " " << uY << endl;
????????????????Kochcurve(uX,uY,tX,tY,n-1);
????????????????cout << tX << " " << tY << endl;
????????????????Kochcurve(tX,tY,edX,edY,n-1);
????????}
}
??
int main() {
????????int n;
????????cin>>n;
????????cout << 0 << " " << 0 << endl;
????????Kochcurve(0,0,100,0,n);
????????cout << 100 << " " << 0 << endl;
????????return 0;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:24:1: error: expected unqualified-id before '?' token
   24 | ??
      | ^
Language: C++

#include<cstdio>
#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
#include<cstring>
#define _USE_MATH_DEFINES // M_PI????????????????????????
#include<math.h>
#pragma warning(disable:4996)
using namespace std;

struct Point{ double x, y; }

void koch(int n, Point a, Point b){
	if( n==0 ) return ;
	Point s, t, u;
	double th = M_PI*60.0/180.0; // ?????????????????¢?????????????????????

	s.x = ( 2.0 * a.x + 1.0 * b.x ) / 3.0;
	s.y = ( 2.0 * a.y + 1.0 * b.y ) / 3.0;
	t.x = ( 1.0 * a.x + 2.0 * b.x ) / 3.0;
	t.y = (  ) / 3.0;
	u.x = ( t.x - s.x ) * cos(th) - ( t.y - s.y ) * sin(th) + s.x;
	u.y = ( t.x - s.x ) * sin(th) - ( t.y - s.y ) * cos(th) + s.y;

	koch(n-1,a,s);
	cout << s.x << s.y << "\n";
	koch(n-1,s,u);
	cout << u.x << u.y << "\n";
	koch(n-1,u,t);
	cout << t.x << t.y << "\n";
	koch(n-1,t,b);
}

int main(){
	Point a,b;
	int n;
	cin >> n;

	a.x = 0;
	a.y = 0;
	b.x = 0;
	b.y = 0;

	cout << a.x << a.y << "\n";
	koch(n,a,b);
	cout << b.x << b.y << "\n";

	return 0;
}

Compiler output:
a.cc:12:29: error: expected ';' after struct definition
   12 | struct Point{ double x, y; }
      |                             ^
      |                             ;
a.cc: In function 'void koch(int, Point, Point)':
a.cc:22:18: error: expected primary-expression before ')' token
   22 |         t.y = (  ) / 3.0;
      |                  ^
Language: C++

#include<cstdio>
#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
#include<cstring>
#define _USE_MATH_DEFINES // M_PI????????????????????????
#include<math.h>
#pragma warning(disable:4996)
using namespace std;

struct Point{ double x, y; }

void koch(int n, Point a, Point b){
	if( n==0 ) return;
	Point s, t, u;
	double th = M_PI*60.0/180.0; // ?????????????????¢?????????????????????

	s.x = ( 2.0 * a.x + 1.0 * b.x ) / 3.0;
	s.y = ( 2.0 * a.y + 1.0 * b.y ) / 3.0;
	t.x = ( 1.0 * a.x + 2.0 * b.x ) / 3.0;
	t.y = ( 1.0 * a.y + 2.0 * b.y ) / 3.0;
	u.x = ( t.x - s.x ) * cos(th) - ( t.y - s.y ) * sin(th) + s.x;
	u.y = ( t.x - s.x ) * sin(th) - ( t.y - s.y ) * cos(th) + s.y;

	koch(n-1,a,s);
	cout << s.x << s.y << "\n";
	koch(n-1,s,u);
	cout << u.x << u.y << "\n";
	koch(n-1,u,t);
	cout << t.x << t.y << "\n";
	koch(n-1,t,b);
}

int main(){
	Point a,b;
	int n;
	cin >> n;

	a.x = 0;
	a.y = 0;
	b.x = 0;
	b.y = 0;

	cout << a.x << a.y << "\n";
	koch(n,a,b);
	cout << b.x << b.y << "\n";

	return 0;
}

Compiler output:
a.cc:12:29: error: expected ';' after struct definition
   12 | struct Point{ double x, y; }
      |                             ^
      |                             ;
Language: C++

#include<cstdio>
#include<math.h>
using namespace std;

struct Point{
	double x;
	double y;
};

void koch(int n, Point a, Point b)
{
	if(n==0) return;
	Point s,u,t;
	double th = M_PI * 60.0/180.0; 
	

	s.x = (b.x+2*a.x)/3;
	s.y = (b.y+2*a.y)/3;
	
	t.x = (2*b.x+a.x)/3;
	t.y = (2*b.y+a.y)/3;
	
	u.x = (t.x-s.x)*cos(th)-(t.y- t.y)*sin(th) + s.x;
	u.y = (t.x-s.x)*sin(th)+(t.y- t.y)*cos(th) + s.y;
	
	koch(n-1,a,s);
	printf("%.8f %.8f\n",s.x,s.y);
	koch(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	koch(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	
	
}
int main()
{
	Point a;
	a.x= a.y= 0;
	Point b;
	b.x = 100;
	b.y = 0;
	
	int n;
	cin >> n;
	
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.x,b.y);
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'cin' was not declared in this scope
   44 |         cin >> n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<math.h>
  +++ |+#include <iostream>
    3 | using namespace std;
Language: C++


#include <iostream>
#include <algorithm>
#include <assert.h>
#include <string>

using namespace std;

int tempmarge[1000100];

int N, A[10000000];

int preorder[1000], inorder[1000];

bool bsearch(const int array[], int left, int right, int value) {
	while (left + 1 < right) {
		int med = (left + right) / 2;
		if (array[med] > value)right = med;
		else left = med;
	}
	return left < right  && array[left] == value;
}

long long int MargeSort(int x[], int left, int right) {
	long long int mid, i, j, k, cl, cr, c;

	if (left >= right)
		return 0;

	mid = (left + right) / 2;
	cl = MargeSort(x, left, mid);
	cr = MargeSort(x, mid + 1, right);


	for (i = left; i <= mid; i++)
		tempmarge[i] = x[i];
	for (i = mid + 1, j = right; i <= right; i++, j--)
		tempmarge[i] = x[j];

	i = left;
	j = right;
	c = 0;
	for (k = left; k <= right; k++)
		if (tempmarge[i] <= tempmarge[j])
			x[k] = tempmarge[i++];
		else {
			c += mid + 1 - i;
			x[k] = tempmarge[j--];
		}

	return c + cl + cr;
}

void recover(int fp, int lp, int fi, int li) {
	int root, i;
	for (i = fi; i < li + 1; i++) {
		if (preorder[fp] == inorder[i]) break;
	}
	root = i;
	if (fi < root) {
		recover(fp + 1, fp + root - fi, fi, root - 1);
		cout << " ";
	}
	if (root < li) {
		recover(fp + root - fi + 1, lp, root + 1, li);
		cout << " ";
	}
	cout << inorder[root];
}

void koch(double p1[2], double p2[2], double tol) {
	double s[2], t[2], u[2];
	
	if (sqrt(pow((p1[0] - p2[0]), 2.0) + pow((p1[1] - p2[1]), 2.0)) > tol ){
		s[0] = (p1[0] * 2 + p2[0]) / 3;
		s[1] = (p1[1] * 2 + p2[1]) / 3;
		t[0] = (p1[0] + p2[0] * 2) / 3;
		t[1] = (p1[1] + p2[1] * 2) / 3;
		u[0] = s[0] + (t[0] - s[0])*0.5 - (t[1] - s[1])*sqrt(3.0) / 2;
		u[1] = s[1] + (t[0] - s[0])*sqrt(3.0) / 2 + (t[1] - s[1])*0.5;

		koch(p1, s, tol);

		cout << s[0] << " " << s[1] << endl;

		koch(s, u, tol);

		cout << u[0] << " " << u[1] << endl;

		koch(u, t, tol);

		cout << t[0] << " " << t[1] << endl;

		koch(t, p2, tol);
	}
}

int main() {
	
	cin >> N;
	
	double tol = 100/pow(3,N)+0.0001;

	double p1[2] = { 0,0 };
	double p2[2] = { 100,0 };

	cout << p1[0] << " " << p1[1] << endl;

	koch(p1, p2, tol);

	cout << p2[0] << " " << p2[1] << endl;

	cin >> N;

	return 0;
}

Compiler output:
a.cc: In function 'void koch(double*, double*, double)':
a.cc:74:18: error: 'pow' was not declared in this scope
   74 |         if (sqrt(pow((p1[0] - p2[0]), 2.0) + pow((p1[1] - p2[1]), 2.0)) > tol ){
      |                  ^~~
a.cc:74:13: error: 'sqrt' was not declared in this scope
   74 |         if (sqrt(pow((p1[0] - p2[0]), 2.0) + pow((p1[1] - p2[1]), 2.0)) > tol ){
      |             ^~~~
a.cc: In function 'int main()':
a.cc:102:26: error: 'pow' was not declared in this scope
  102 |         double tol = 100/pow(3,N)+0.0001;
      |                          ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <list>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <ostream>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <iomanip>
#include "Stacktp.h"

#define N 2005
#define INF (1 << 30)
using namespace std;
struct coordinate {
	double x, y;
};
const double PI = 2.0 * acos(0.0);
const double cos60 = cos(PI / 3.0);
const double sin60 = sin(PI / 3.0);
void koch(int n, coordinate p1, coordinate p2)
{
	if (n == 0)
	{
		printf("%.8lf %.8lf\n", p1.x, p1.y);
		return;
	}
	coordinate s, t, u;
	s.x = (2 * p1.x + p2.x) / 3.0;
	s.y = (2 * p1.y + p2.y) / 3.0;
	t.x = (p1.x + 2 * p2.x) / 3.0;
	t.y = (p1.y + 2 * p2.y) / 3.0;
	u.x = (t.x - s.x) * cos60 - (t.y - s.y) * sin60 + s.x;
	u.y = (t.x - s.x) * sin60 + (t.y - s.y) * cos60 + s.y;
	koch(n - 1, p1, s);
	koch(n - 1, s, u);
	koch(n - 1, u, t);
	koch(n - 1, t, p2);
}

int main()
{
	int n;
	cin >> n;
	coordinate p1, p2;
	p1.x = 0.0;
	p1.y = 0.0;
	p2.x = 100.0;
	p2.y = 0.0;
	koch(n, p1, p2);
	printf("%.8lf %.8lf\n", p2.x, p2.y);
	return 0;
}

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

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

struct Point {
  double x;
  double y;
};

void print(Point pt) {
  printf("%lf %lf\n", pt.x, pt.y);
}


void koch(int n, Point p1, Point p2) {
  if ( n == 0 ) return;

  Point s, t, u;
  s.x = (p2.x - p1.x) / 3.0;
  t.x = (p2.x - p1.x) * 2.0 / 3.0;
  u.x = (p2.x - p1.x) / 2.0;
  s.y = p1.y;
  t.y = p2.y;
  u.y = (t.x - s.x) * sqrt(3);

  koch(n - 1, p1, s);
  print(s);
  koch(n - 1, s, u);
  print(u);
  koch(n - 1, u, t);
  print(t);
  koch(n - 1, t, p2);
}

int main() {
  int n;
  cin >> n;

  Point p1;
  Point p2;
  p1.x = 0.0, p1.y = 0.0;
  p2.x = 100.0, p2.y = 0.0;

  print(p1);
  koch(n, p1, p2);
  print(p2);
  
 return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:10: error: expected ';' before '}' token
   49 |  return 0
      |          ^
      |          ;
   50 | }
      | ~
Language: C++

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

int main(){
  double x1=0.0, y1=0.0, x2=100.0, y2=0.0;
  int d;
  cin >> d;

  spr(x1,y1,x2,y2,d);
  cout << fixed << x2 << ' ' << y2 << endl;

  return 0;
}

void spr(double x1,double y1,double x2,double y2,int d){
  assert(d>=0);  
  double sx,sy,ux,uy,tx,ty;

  if(d==0){
    cout << fixed << x1 << ' ' << y1 << endl;
  }else{
    sx=(2.0*x1+x2)/3.0;
    sy=(2.0*y1+y2)/3.0;
    tx=(x1+2.0*x2)/3.0;
    ty=(y1+2.0*y2)/3.0;

    //u-s=(s-p1)*exp(i??/3)
    //u=(s-p1)*(1/2+i???3/2)+s
    ux=(sx-x1)*(1.0/2.0)-(sy-y1)*(sqrt(3.0)/2.0);
    uy=(sx-x1)*(sqrt(3.0)/2.0)+(sy-y1)*(1.0/2.0);

    spr(x1,y1,sx,sy,d-1);
    spr(sx,sy,ux,uy,d-1);
    spr(ux,uy,tx,ty,d-1);
    spr(tx,ty,x2,y2,d-1);
  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'spr' was not declared in this scope
   10 |   spr(x1,y1,x2,y2,d);
      |   ^~~
a.cc: In function 'void spr(double, double, double, double, int)':
a.cc:30:35: error: 'sqrt' was not declared in this scope
   30 |     ux=(sx-x1)*(1.0/2.0)-(sy-y1)*(sqrt(3.0)/2.0);
      |                                   ^~~~
Language: C++

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

#define Pi 3.1415926535

typedef struct Point
{
	double x;
	double y;
};

Point rotate(Point center,Point target,double angle)
{
	double ans_x;
	double ans_y;
	ans_x = (target.x - center.x)*cos(angle) - (target.y - center.y)*sin(angle) + center.x;
	ans_y = (target.x - center.x)*sin(angle) + (target.y - center.y)*cos(angle) + center.y;
	Point P = { ans_x,ans_y };
	return P;
}

void func(Point previous, Point next,int n)
{
	if (n <= 0);
	else
	{
		double x1 = previous.x;
		double y1 = previous.y;
		double x2 = next.x;
		double y2 = next.y;
		double lx = abs(x2 - x1);
		double ly = abs(y2 - y1);
		Point P1 = { x1 + lx / 3,y1 + ly / 3 };
		Point P2;
		Point P3 = { x1 + lx / 3 * 2,y1 + ly / 3 * 2 };
		P2 = rotate(P1, P3, Pi / 3);
		func(previous, P1, n - 1);
		printf_s("%.8lf %.8lf\n", P1.x, P1.y);
		func(P1, P2, n - 1);
		printf_s("%.8lf %.8lf\n", P2.x, P2.y);
		func(P2, P3, n - 1);
		printf_s("%.8lf %.8lf\n", P3.x, P3.y);
		func(P3, next, n - 1);
	}
}

int main()
{
	int n;
	cin >> n;
	Point point_start = { 0,0 };
	Point point_end = { 100,0 };
	printf("%.8lf %.8lf\n", point_start.x, point_start.y);
	func(point_start, point_end, n);
	printf("%.8lf %.8lf\n", point_end.x, point_end.y);
	return 0;
}

Compiler output:
a.cc:7:1: warning: 'typedef' was ignored in this declaration
    7 | typedef struct Point
      | ^~~~~~~
a.cc: In function 'void func(Point, Point, int)':
a.cc:39:17: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   39 |                 printf_s("%.8lf %.8lf\n", P1.x, P1.y);
      |                 ^~~~~~~~
      |                 printf
Language: C++

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

#define PI 3.14159265

typedef struct point
{
  double x;
  double y;
} __point;

__point get_s(__point p1, __point p2)
{
  __point s;
  s.x = (2 * p1.x + p2.x) / 3;
  s.y = (2 * p1.y + p2.y) / 3;
  return s;
}

__point get_t(__point p1, __point p2)
{
  __point t;
  t.x = (p1.x + 2 * p2.x) / 3;
  t.y = (p1.y + 2 * p2.y) / 3;
  return t;
}

__point get_u(__point s, __point t)
{
  __point u;
  double d = PI * 60 / 180; // degrees
  u.x = cos(d) * (t.x - s.x) - sin(d) * (t.y - s.y) + s.x;
  u.y = sin(d) * (t.x - s.x) + cos(d) * (t.y - s.y) + s.y;
  return u;
}

void print_point(__point p)
{
  cout << p.x << " " << p.y << endl;
}

void kock(int n, __point p1, __point p2)
{
  if (!n) return;
  __point s, u, t;
  s = get_s(p1, p2);
  t = get_t(p1, p2);
  u = get_u(s, t);

  /* recusion */
  kock(n - 1, p1, s);
  print_point(s);
  kock(n - 1, s, u);
  print_point(u);
  kock(n - 1, u, t);
  print_point(t);
  kock(n - 1, t, p2);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
const int INF = 0x3f3f3f3f;
const double M_PI = acos(double(-1));

struct Point{ double x, y;};

void koch(int d, Point x1, Point x2){
	if(!d) return;
	Point s, u, t;
	double th = M_PI * 60.0 / 180.0;

	s.x = (2.0 * x1.x + x2.x) / 3.0;
	s.y = (2.0 * x1.y + x2.y) / 3.0;
	u.x = (x1.x + 2.0 * x2.x) / 3.0;
	u.y = (x1.y + 2.0 * x2.y) / 3.0;
	t.x = (u.x - s.x) * cos(th) - (u.y - s.y) * sin(th) + s.x;
	t.y = (u.x - s.x) * sin(th) + (u.y - s.y) * cos(th) + s.y;

	koch(d - 1, x1, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(d - 1, s, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(d - 1, t, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(d - 1, u, x1);
}

int main(){
	int n;
	cin >> n;
	Point x1, x2;
	x1.x = 0.0; x1.y = 0.0; x2.x = 100.0; x2.y = 0.0;
	printf("%.8f %.8f\n", x1.x, x1.y);
	koch(n, x1, x2);
	printf("%.8f %.8f\n", x2.x, x2.y); 
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/cmath:47,
                 from a.cc:6:
a.cc:9:14: error: expected unqualified-id before numeric constant
    9 | const double M_PI = acos(double(-1));
      |              ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
#define Pi 3.1415926

class P {
public:
	double x, y;
	P() :x(0), y(0) {}
	P(double a, double b) :x(a), y(b) {}
	void print() {
		cout << setprecision(8) <<fixed<< x << " " << y << endl;
	}
};

void koch(int n, P p1, P p2) {
	P s, u, t;
	double th = Pi* 60 /180.0;
	if (n == 0) return;

	s.x = (2.0*p1.x + 1.0*p2.x) / 3.0;
	s.y = (2.0*p1.y + 1.0*p2.y) / 3.0;
	t.x = (1.0*p1.x + 2.0*p2.x) / 3.0;
	t.y = (1.0*p1.y + 2.0*p2.y) / 3.0;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

	koch(n - 1, p1, s);
	s.print();
	koch(n - 1, s, u);
	u.print();
	koch(n - 1, u, t);
	t.print();
	koch(n - 1, t, p2);
}

int main(){
	P a(0.0,0.0), b(100.0,0.0);
	int n;
	cin >> n;

	a.print();
	koch(n,a, b);
	b.print();

	return 0;
}

Compiler output:
a.cc: In function 'void koch(int, P, P)':
a.cc:26:27: error: 'cos' was not declared in this scope
   26 |         u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
      |                           ^~~
a.cc:26:49: error: 'sin' was not declared in this scope
   26 |         u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
      |                                                 ^~~
Language: C++

#include<stdio.h>
#include<math.h>
   
typedef struct{
  double x;
  double y;
}koch;
 
void fractal(int,koch,koch);
  
int main(){
   
  koch p1,p2;
  int n;
   
  p1.x = 0;
  p2.x = 100;
  p1.y = 0;
  p2.y = 0;
   
  scanf("%d",&n);
   
  printf("%f %f\n",p1.x,p1.y);
  fractal(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);
   
  return 0;
}
 
void fractal(int n, koch p1, koch p2){
  
  if(n==0) return;
  koch s,t,u;
   
  s.x = ((p2.x-p1.x)/3)+p1.x;
  s.y = ((p2.y-p1.y)/3)+p1.y;
  t.x = (2*(p2.x-p1.x)/3)+p1.x;
  t.y = (2*(p2.y-p1.y)/)3+p1.y;
  u.x = (t.x-s.x)/2-sqrt(3)/(2*(t.y-s.y))+s.x;
  u.y = (t.y-s.y)/2+sqrt(3)/(2*(t.x-s.x))+s.y;
   
  fractal(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
     
  fractal(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
     
  fractal(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
   
  fractal(n-1,t,p2);
}

Compiler output:
a.cc: In function 'void fractal(int, koch, koch)':
a.cc:38:24: error: expected primary-expression before ')' token
   38 |   t.y = (2*(p2.y-p1.y)/)3+p1.y;
      |                        ^
Language: C++

#include<stdio.h>
#include<math.h>

struct point{
    double x,y;
};

void koch(int n, point a, point b){
    if (n == 0) {return;}
    
    point l,m,r;
    double th = M_PI * 60.0/180.0;
    l.x = (2.0*a.x + 1.0* b.x)/3.0;
    l.y = (2.0*a.y + 1.0* b.y)/3.0;
   
    r.x = (2.0*b.x + 1.0* a.x)/3.0;
    r.y = (2.0*b.y + 1.0* a.y)/3.0;
    
    m.x = (r.x - l.x)*cos(th) - (r.y - l.y)*sin(th) + l.x;
    m.y = (r.x - l.x)*sin(th) + (r.y - l.y)*cos(th) + l.y;
    
    koch(n-1,a,l);
    printf("%.8f %.8f\n", l.x, l.y);
    koch(n-1,l,m);
    printf("%.8f %.8f\n", m.x, m.y);
    koch(n-1,m,r);
    printf("%.8f %.8f\n", r.x, r.y);
}

int main(){
    Point a,b;
    int n;
    scanf("%d" &n);
    
    a.x = a.y = 0;
    b.x = 100;
    b.y = 0;
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n,a,b);
    printf("%.8f %.8f\n", b.x, b.y);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'Point' was not declared in this scope; did you mean 'point'?
   31 |     Point a,b;
      |     ^~~~~
      |     point
a.cc:33:16: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
   33 |     scanf("%d" &n);
      |           ~~~~ ^~
      |           |     |
      |           |     int
      |           const char [3]
a.cc:35:5: error: 'a' was not declared in this scope
   35 |     a.x = a.y = 0;
      |     ^
a.cc:36:5: error: 'b' was not declared in this scope
   36 |     b.x = 100;
      |     ^
Language: C++

#include<stdio.h>
#include<math.h>

struct point{
    double x,y;
};

void koch(int n, point a, point b){
    if (n == 0) {return;}
    
    point l,m,r;
    double th = M_PI * 60.0/180.0;
    l.x = (2.0*a.x + 1.0* b.x)/3.0;
    l.y = (2.0*a.y + 1.0* b.y)/3.0;
   
    r.x = (2.0*b.x + 1.0* a.x)/3.0;
    r.y = (2.0*b.y + 1.0* a.y)/3.0;
    
    m.x = (r.x - l.x)*cos(th) - (r.y - l.y)*sin(th) + l.x;
    m.y = (r.x - l.x)*sin(th) + (r.y - l.y)*cos(th) + l.y;
    
    koch(n-1,a,l);
    printf("%.8f %.8f\n", l.x, l.y);
    koch(n-1,l,m);
    printf("%.8f %.8f\n", m.x, m.y);
    koch(n-1,m,r);
    printf("%.8f %.8f\n", r.x, r.y);
}

int main(){
    point a,b;
    int n;
    scanf("%d" &n);
    
    a.x = a.y = 0;
    b.x = 100;
    b.y = 0;
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n,a,b);
    printf("%.8f %.8f\n", b.x, b.y);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:16: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
   33 |     scanf("%d" &n);
      |           ~~~~ ^~
      |           |     |
      |           |     int
      |           const char [3]
Language: C++

#include<stdio.h>
#include<math.h>

struct Point{double x,y};

void koch(int n,Point a,Point b){
	if (n == 0){
		return;
	}
	Point s, t, u;
	double th = M_PI * 60 / 180;
	s.x = (2.0*a.x + 1.0*b.x) / 3.0;
	s.y = (2.0*a.y + 1.0*b.y) / 3.0;
	t.x = (1.0*a.x + 2.0*b.x) / 3.0;
	t.y = (1.0*a.y + 2.0*b.y) / 3.0;
	u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
	u.y = (t.x - s.x)*sin(th) - (t.y - s.y)*cos(th) + s.y;
	koch(n - 1, a, s);
	printf("%.8f %.8f\n", s.x, s.y);
	koch(n - 1, s, u);
	printf("%.8f %.8f\n", u.x, u.y);
	koch(n - 1, u, t);
	printf("%.8f %.8f\n", t.x, t.y);
	koch(n - 1, t, b);
}

int main(){
	Point a, b;
	int n;
	scanf("%d", &n);
	a.x = 0;
	a.y = 0;
	b.x = 100.0;
	b.y = 0;
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n, a, b);
	printf("%.8f %.8f\n", b.x, b.y);
	return 0;

}

Compiler output:
a.cc:4:23: error: expected ';' at end of member declaration
    4 | struct Point{double x,y};
      |                       ^
      |                        ;
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
??
#define PI 3.141592
??
using namespace std;
??
class coodinate
{
public:
????????double x;
????????double y;
};
??
??
void koch_curve(int n, coodinate p, coodinate q)
{
????????if (n == 0)
????????{
??????????????????
????????????????return;
????????}
??
????????coodinate left,mid,right;
????????double length;
??
????????length = sqrt(pow(q.x - p.x , 2) + pow(q.y - p.y , 2)) / 3;
??
????????//printf("length=%f\n", length);
??
????????left.x = (2 * p.x + q.x) / 3;
????????left.y = (2 * p.y + q.y) / 3;
??
????????right.x = (p.x + 2 * q.x) / 3;
????????right.y = (p.y + 2 * q.y) / 3;
??
????????mid.x = (right.x - left.x) * cos((60 * PI) / 180) - (right.y - left.y) * sin((60 * PI) / 180) + left.x;
????????mid.y = (right.x - left.x) * sin((60 * PI) / 180) + (right.y - left.y) * cos((60 * PI) / 180) + left.y;
??
????????koch_curve(n-1,p,left);
????????printf("%f %f\n", left.x, left.y);
??
????????koch_curve(n-1,left,mid);
????????printf("%f %f\n", mid.x, mid.y);
??
????????koch_curve(n-1,mid,right);
????????printf("%f %f\n", right.x,right.y);
??
????????koch_curve(n-1,right,q);
??
}
??
int main()
{
????????int n;
??
????????coodinate p1,p2;
??
????????p1.x = 0;
????????p1.y = 0;
??
????????p2.x = 100;
????????p2.y = 0;
??
????????scanf("%d", &n);
??
????????printf("%f %f\n", p1.x,p1.y);
??
????????koch_curve(n,p1,p2);
??
????????printf("%f %f\n", p2.x,p2.y);
??
????????return 0;
}

Compiler output:
a.cc:32:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????//printf("length=%f\n", length);
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ??
      | ^
a.cc:10:1: error: expected unqualified-id before '?' token
   10 | ??
      | ^
a.cc:17:1: error: expected unqualified-id before '?' token
   17 | ??
      | ^
a.cc:55:1: error: expected unqualified-id before '?' token
   55 | ??
      | ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
 
#define rad(x) (x*atan(1.0)*4.0/180.0)
int n;
 
void koch( double x1, double y1, double x4, double y4, int d ){
    if( d == n ){
        printf("%.5lf %.5lf\n", x4, y4);
        return;
    }
    double x2 = (x4-x1) / 3.0 + x1;
    double y2 = (y4-y1) / 3.0 + y1;
    double x3 = (x4-x1) * 2.0 / 3.0 + x1;
    double y3 = (y4-y1) * 2.0 / 3.0 + y1;
    double x = (x3-x2)/2 - (y3-y2)*sqrt(3)/2 + x2;
    double y = (x3-x2*sqrt(3)/2 + (y3-y2)/2 + y2;
    koch( x1, y1, x2, y2, d+1 );
    koch( x2, y2, x,  y,  d+1 );
    koch( x,  y,  x3, y3, d+1 );
    koch( x3, y3, x4, y4, d+1 );
}
 
int main(){
    cin >> n;
    cout << "0.00000 0.00000" << endl;
    koch(0.0,0.0,100.0,0.0,0);
    return 0;
}

Compiler output:
a.cc: In function 'void koch(double, double, double, double, int)':
a.cc:19:49: error: expected ')' before ';' token
   19 |     double y = (x3-x2*sqrt(3)/2 + (y3-y2)/2 + y2;
      |                ~                                ^
      |                                                 )
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; }

void koch(int n, Point a, Point b) {
  if ( n == 0 ) return;

  Point s, t, u;
  double th = M_PI * 60.0 / 180.0;  // 度からラジアンへ単位を変換

  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n - 1, a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


Compiler output:
a.cc:4:30: error: expected ';' after struct definition
    4 | struct Point { double x, y; }
      |                              ^
      |                              ;
Language: C++

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

struct Point {
  double x;
  double y;
};
void koch(int n,Point a,Point b) {
  if (n==0) {
    return;
  }
  Point s, t, u;
  double th=M_PI*60.0/180.0;
  s.x=(2.0*a.x+1.0*b.x)/3;
  s.y=(2.0*a.y+1.0*b.y)/3;
  t.x=(1.0*a.x+2.0*b.x)/3;
  t.y=(1.0*a.x+2.0*b.x)/3;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
  koch(n-1,a,s);
  cout<<fixed<<setprecision(8)<<s.x<<" "<<s.y<<endl;
  koch(n-1,s,u);
  cout<<fixed<<setprecision(8)<<u.x<<" "<<u.y<<endl;
  koch(n-1,u,t);
  cout<<fixed<<setprecision(8)<<t.x<<" "<<t.y<<endl;
  koch(n-1,t,b);
}
int main() {
  int n;
  cin>>n;
  Point a, b;
  a.x=0;
  a.y=0;
  b.x=100.0;
  b.y=0;
  cout<<fixed<<setprecision(8)<<a.x<<a.y<<endl;
  koch(n,a,b);
  cout<<fixed<<setprecision(8)<<b.x<<b.y<<endl;
  return 0;
}
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

struct Point {
  double x;
  double y;
};
void koch(int n,Point a,Point b) {
  if (n==0) {
    return;
  }
  Point s, t, u;
  double th=M_PI*60.0/180.0;
  s.x=(2.0*a.x+1.0*b.x)/3;
  s.y=(2.0*a.y+1.0*b.y)/3;
  t.x=(1.0*a.x+2.0*b.x)/3;
  t.y=(1.0*a.x+2.0*b.x)/3;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
  koch(n-1,a,s);
  cout<<fixed<<setprecision(8)<<s.x<<" "<<s.y<<endl;
  koch(n-1,s,u);
  cout<<fixed<<setprecision(8)<<u.x<<" "<<u.y<<endl;
  koch(n-1,u,t);
  cout<<fixed<<setprecision(8)<<t.x<<" "<<t.y<<endl;
  koch(n-1,t,b);
}
int main() {
  int n;
  cin>>n;
  Point a, b;
  a.x=0;
  a.y=0;
  b.x=100.0;
  b.y=0;
  cout<<fixed<<setprecision(8)<<a.x<<a.y<<endl;
  koch(n,a,b);
  cout<<fixed<<setprecision(8)<<b.x<<b.y<<endl;
  return 0;
}



Compiler output:
a.cc:48:8: error: redefinition of 'struct Point'
   48 | struct Point {
      |        ^~~~~
a.cc:6:8: note: previous definition of 'struct Point'
    6 | struct Point {
      |        ^~~~~
a.cc:52:6: error: redefinition of 'void koch(int, Point, Point)'
   52 | void koch(int n,Point a,Point b) {
      |      ^~~~
a.cc:10:6: note: 'void koch(int, Point, Point)' previously defined here
   10 | void koch(int n,Point a,Point b) {
      |      ^~~~
a.cc:72:5: error: redefinition of 'int main()'
   72 | int main() {
      |     ^~~~
a.cc:30:5: note: 'int main()' previously defined here
   30 | int main() {
      |     ^~~~
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; };

void koch( int n, Point a, Point b) {
  Point a1, b1, ab;
  double th = M_PI * 60.0 / 180.0;
  
  a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;

  a2.x = (1.0 * a.x + b.x * 2.0) / 3.0;
  a2.y = (1.0 * a.y + b.y * 2.0) / 3.0;
  
  ab.x = (a2.x - a1.x) * cos(th) - (a2.y - a1.y) * sin(th) + a1.x;
  ab.y = (a2.x - a1.x) * sin(th) - (a2.y - a1.y) * cos(th) + a1.y;

  koch( n - 1, a, a1);
  printf("%.8f %.8f\n", a1.x, a1.y);
  koch( n - 1, a1, ab);
  print("%.8f, %.8f\n", ab.x, ab.y);
  koch( n - 1, ab, a2);
  print("%.8f, %.8f\n", a2.x, a2.y);
  koch( n - 1, a2, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


Compiler output:
a.cc: In function 'void koch(int, Point, Point)':
a.cc:13:3: error: 'a2' was not declared in this scope; did you mean 'ab'?
   13 |   a2.x = (1.0 * a.x + b.x * 2.0) / 3.0;
      |   ^~
      |   ab
a.cc:22:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   22 |   print("%.8f, %.8f\n", ab.x, ab.y);
      |   ^~~~~
      |   rint
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; };

void koch( int n, Point a, Point b) {
  Point a1, b1, ab;
  double th = M_PI * 60.0 / 180.0;
  
  a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;

  b1.x = (1.0 * a.x + b.x * 2.0) / 3.0;
  b1.y = (1.0 * a.y + b.y * 2.0) / 3.0;
  
  ab.x = (b1.x - a1.x) * cos(th) - (b1.y - a1.y) * sin(th) + a1.x;
  ab.y = (b1.x - a1.x) * sin(th) - (b1.y - a1.y) * cos(th) + a1.y;

  koch( n - 1, a, a1);
  printf("%.8f %.8f\n", a1.x, a1.y);
  koch( n - 1, a1, ab);
  print("%.8f, %.8f\n", ab.x, ab.y);
  koch( n - 1, ab, b1);
  print("%.8f, %.8f\n", a2.x, a2.y);
  koch( n - 1, b1, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


Compiler output:
a.cc: In function 'void koch(int, Point, Point)':
a.cc:22:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   22 |   print("%.8f, %.8f\n", ab.x, ab.y);
      |   ^~~~~
      |   rint
a.cc:24:25: error: 'a2' was not declared in this scope; did you mean 'ab'?
   24 |   print("%.8f, %.8f\n", a2.x, a2.y);
      |                         ^~
      |                         ab
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; };

void koch( int n, Point a, Point b) {
  Point a1, b1, ab;
  double th = M_PI * 60.0 / 180.0;
  
  a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;

  b1.x = (1.0 * a.x + b.x * 2.0) / 3.0;
  b1.y = (1.0 * a.y + b.y * 2.0) / 3.0;
  
  ab.x = (b1.x - a1.x) * cos(th) - (b1.y - a1.y) * sin(th) + a1.x;
  ab.y = (b1.x - a1.x) * sin(th) - (b1.y - a1.y) * cos(th) + a1.y;

  koch( n - 1, a, a1);
  printf("%.8f %.8f\n", a1.x, a1.y);
  koch( n - 1, a1, ab);
  print("%.8f, %.8f\n", ab.x, ab.y);
  koch( n - 1, ab, b1);
  print("%.8f, %.8f\n", b1.x, b1.y);
  koch( n - 1, b1, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


Compiler output:
a.cc: In function 'void koch(int, Point, Point)':
a.cc:22:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   22 |   print("%.8f, %.8f\n", ab.x, ab.y);
      |   ^~~~~
      |   rint
Language: C++

#include<stdio.h>
#include<math.h>

struct Point { double x, y; };

void koch( int n, Point a, Point b) {
  Point a1, b1, ab;
  double th = M_PI * 60.0 / 180.0;
  
  a1.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  a1.y = (2.0 * a.y + 1.0 * b.y) / 3.0;

  b1.x = (1.0 * a.x + b.x * 2.0) / 3.0;
  b1.y = (1.0 * a.y + b.y * 2.0) / 3.0;
  
  ab.x = (b1.x - a1.x) * cos(th) - (b1.y - a1.y) * sin(th) + a1.x;
  ab.y = (b1.x - a1.x) * sin(th) - (b1.y - a1.y) * cos(th) + a1.y;

  koch( n - 1, a, a1);
  printf("%.8f %.8f\n", a1.x, a1.y);
  koch( n - 1, a1, ab);
  print("%.8f %.8f\n", ab.x, ab.y);
  koch( n - 1, ab, b1);
  print("%.8f %.8f\n", b1.x, b1.y);
  koch( n - 1, b1, b);
}

int main() {
  Point a, b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);

  return 0;
}


Compiler output:
a.cc: In function 'void koch(int, Point, Point)':
a.cc:22:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   22 |   print("%.8f %.8f\n", ab.x, ab.y);
      |   ^~~~~
      |   rint
Language: C++

#include<iostream>
#include<math.h>
struct Point{
	double x;
	double y;
};
void gohho(int n,Point a,Point b){
	if(n==0)
	return;
	Point s,t,u;
	double yh=m_PI*60.0/180.0;
	s.x=(2.0*a.x+1.0*b.x)/3.0;
	s.y=(2.0*a.y+1.0*b.y)/3.0;
	t.x=(1.0*a.x+2.0*b.x)/3.0;
	t.y=(1.0*a.y+2.0*b.y)/3.0;
	u.x=(t.x-s.x)*cos(yh)-(t.y-s.y)*sin(yh)+s.x;
	u.y=(t.x-s.x)*sin(yh)+(t.y-s.y)*cos(yh)+s.y;
	gohho(n-1,a,s);
	std::cout<<s.x<<"  "<<s.y<<"\n";
	gohho(n-1,s,u);
	std::cout<<u.x<<"  "<<u.y<<"\n";
	gohho(n-1,u,t);
	std::cout<<t.x<<"  "<<t.y<<"\n";
gohho(n-1,t,b);
}
int main(){
	Point a,b;
	int n;
	std::cin>>n;
	a.x=0;
	a.y=0;
	b.x=100;
	b.y=0;
	std::cout<<a.x<<"  "<<a.y<<"\n"
	gohho(n,a,b);
	std::cout<<b.x<<"  "<<b.y<<"\n"
return 0;
}


Compiler output:
a.cc: In function 'void gohho(int, Point, Point)':
a.cc:11:19: error: 'm_PI' was not declared in this scope; did you mean 'M_PI'?
   11 |         double yh=m_PI*60.0/180.0;
      |                   ^~~~
      |                   M_PI
a.cc: In function 'int main()':
a.cc:34:40: error: expected ';' before 'gohho'
   34 |         std::cout<<a.x<<"  "<<a.y<<"\n"
      |                                        ^
      |                                        ;
   35 |         gohho(n,a,b);
      |         ~~~~~                           
a.cc:36:40: error: expected ';' before 'return'
   36 |         std::cout<<b.x<<"  "<<b.y<<"\n"
      |                                        ^
      |                                        ;
   37 | return 0;
      | ~~~~~~
Language: C++

import math

a=math.sin(math.radians(60))
b=math.cos(math.radians(60))

n=int(input())

def f(n,x1,y1,x2,y2):
	if n==0:
		return
		
	sx=(x1*2+x2*1)/3
	sy=(y1*2+y2*1)/3
	tx=(x1*1+x2*2)/3
	ty=(y1*1+y2*2)/3
	ux=(tx-sx)*b-(ty-sy)*a+sx
	uy=(tx-sx)*a-(ty-sy)*b+sy
	
	f(n-1,x1,y1,sx,sy)
	print(sx,sy)
	f(n-1,sx,sy,ux,uy)
	print(ux,uy)
	f(n-1,ux,uy,tx,ty)
	print(tx,ty)
	f(n-1,tx,ty,x2,y2)
	
	
print(0.00000000,0.00000000)
f(n,0,0,100,0)
print(100.00000000,0.00000000)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
int n;

struct Point{
	double x;
	double y;
}

void calc(int m,Point p1,Point p2){
	if(m>=n){
		return;
	}
	Point s,t,u;
	s.x=(2*p1.x+1*p2.x)/3.0;
	s.y=(2*p1.y+1*p2.y)/3.0;
	t.x=(1*p1.x+2*p2.x)/3.0;
	s.y=(1*p1.y+2*p2.y)/3.0;
	u.x=(t.x-s.x)*(1/2.0)-(t.y-s.y)*(sqrt(3)/2.0)+s.x;
	u.x=(t.x-s.x)*(sqrt(3)/2.0)+(t.y-s.y)*(1/2.0)+s.y;
	calc(m+1,p1,s);
	printf("%.8f %.8f\n",s.x,s.y);
	calc(m+1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	calc(m+1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	calc(m+1,t,p2);
}

int main(){
	std::cin>>n;
	Point p1,p2;
	p1.x=0; p1.y=0; p2.x=100; p2.y=0;
	printf("%.8f %.8f\n",p1.x,p1.y);
	calc(0,p1,p2);
	printf("%.8f %.8f\n",p2.x,p2.y);
	
	return 0;
}


Compiler output:
a.cc:9:2: error: expected ';' after struct definition
    9 | }
      |  ^
      |  ;
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
int n;

struct Point{
	double x;
	double y;
};

void calc(int m,Point p1,Point p2){
	if(m>=n){
		return 0;
	}
	Point s,t,u;
	s.x=(2.0*p1.x+p2.x)/3.0;
	s.y=(2.0*p1.y+p2.y)/3.0;
	t.x=(p1.x+2.0*p2.x)/3.0;
	t.y=(p1.y+2.0*p2.y)/3.0;
	u.x=(t.x-s.x)*(1.0/2.0)-(t.y-s.y)*(sqrt(3.0)/2.0)+s.x;
	u.x=(t.x-s.x)*(sqrt(3.0)/2.0)+(t.y-s.y)*(1.0/2.0)+s.y;
	calc(m+1,p1,s);
	printf("%.8f %.8f\n",s.x,s.y);
	calc(m+1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	calc(m+1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	calc(m+1,t,p2);
}

int main(){
	std::cin>>n;
	Point p1,p2;
	p1.x=0; p1.y=0; p2.x=100; p2.y=0;
	printf("%.8f %.8f\n",p1.x,p1.y);
	calc(0,p1,p2);
	printf("%.8f %.8f\n",p2.x,p2.y);
	
	return 0;
}


Compiler output:
a.cc: In function 'void calc(int, Point, Point)':
a.cc:13:24: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |                 return 0;
      |                        ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
int n;

struct Point{
	double x;
	double y;
};

void calc(int m,Point p1,Point p2){
	if(m>=n){
		return 0;
	}
	Point s,t,u;
	s.x=(2.0*p1.x+p2.x)/3.0;
	s.y=(2.0*p1.y+p2.y)/3.0;
	t.x=(p1.x+2.0*p2.x)/3.0;
	t.y=(p1.y+2.0*p2.y)/3.0;
	u.x=(t.x-s.x)*(1.0/2.0)-(t.y-s.y)*(sqrt(3.0)/2.0)+s.x;
	u.x=(t.x-s.x)*(sqrt(3.0)/2.0)+(t.y-s.y)*(1.0/2.0)+s.y;
	calc(m+1,p1,s);
	printf("%.8f %.8f\n",s.x,s.y);
	calc(m+1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	calc(m+1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	calc(m+1,t,p2);
}

int main(){
	std::cin>>n;
	Point p1,p2;
	p1.x=0; p1.y=0; p2.x=100; p2.y=0;
	printf("%.8f %.8f\n",p1.x,p1.y);
	calc(0,p1,p2);
	printf("%.8f %.8f\n",p2.x,p2.y);
	
	return 0;
}
	



Compiler output:
a.cc: In function 'void calc(int, Point, Point)':
a.cc:13:24: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |                 return 0;
      |                        ^
Language: C++

#include<iostream>
#include<cmath>
#include<cstdio>

#define PI 3.14159265358979

using namespace std;

struct P {
  double x;
  double y;
};

void Plot(int n, P a, P b) {
  if ( == 0) {
    return;
  }

  double th = 60.0 * (PI / 180.0); // degree to rad

  P s, t, u;
  s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;  
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y ) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y ) * cos(th) + s.y;  

  Plot(n - 1, a, s);
  printf("%.8lf %.8lf\n", s.x, s.y);
  Plot(n - 1, s, u);
  printf("%.8lf %.8lf\n", u.x, u.y);
  Plot(n - 1, u, t);
  printf("%.8lf %.8lf\n", t.x, t.y);
  Plot(n - 1, t, b);
}
 
int main() {
  const P A = {0.0, 0.0}, B = {100.0, 0.0};
  int N;

  cin >> N;

  printf("%.8lf %.8lf\n", A.x, A.y);
  Plot(N, A, B);
  printf("%.8lf %.8lf\n", B.x, B.y);

  return 0;
}


Compiler output:
a.cc: In function 'void Plot(int, P, P)':
a.cc:15:8: error: expected primary-expression before '==' token
   15 |   if ( == 0) {
      |        ^~
a.cc:22:16: error: 'p1' was not declared in this scope; did you mean 'y1'?
   22 |   s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
      |                ^~
      |                y1
a.cc:22:29: error: 'p2' was not declared in this scope
   22 |   s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
      |                             ^~
Language: C++

#include<iostream>
#include<cmath>
#include<cstdio>

#define PI 3.14159265358979

using namespace std;

struct P {
  double x;
  double y;
};

void Plot(int n, P a, P b) {
  if (n == 0) {
    return;
  }

  double th = 60.0 * (PI / 180.0); // degree to rad

  P s, t, u;
  s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;  
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y ) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y ) * cos(th) + s.y;  

  Plot(n - 1, a, s);
  printf("%.8lf %.8lf\n", s.x, s.y);
  Plot(n - 1, s, u);
  printf("%.8lf %.8lf\n", u.x, u.y);
  Plot(n - 1, u, t);
  printf("%.8lf %.8lf\n", t.x, t.y);
  Plot(n - 1, t, b);
}
 
int main() {
  const P A = {0.0, 0.0}, B = {100.0, 0.0};
  int N;

  cin >> N;

  printf("%.8lf %.8lf\n", A.x, A.y);
  Plot(N, A, B);
  printf("%.8lf %.8lf\n", B.x, B.y);

  return 0;
}


Compiler output:
a.cc: In function 'void Plot(int, P, P)':
a.cc:22:16: error: 'p1' was not declared in this scope; did you mean 'y1'?
   22 |   s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
      |                ^~
      |                y1
a.cc:22:29: error: 'p2' was not declared in this scope
   22 |   s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
      |                             ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
using namespace std;
map <int ,int> mpa,mpb;

struct Point{double x,y};

void koch(int n, Point a, Point b){
  if(n==0) return;
  Point s, t, u;
  double th=M_PI*60/180;
  s.x=(2.0*a.x+1.0*b.x)/3.0;
  s.y=(2.0*a.y+1.0*b.y)/3.0;
  t.x=(1.0*a.x+2.0*b.x)/3.0;
  t.y=(1.0*a.y+2.0*b.y)/3.0;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

  koch(n-1,a,s);
  printf("%.6f","%.6f\n", s.x, s.y);
  koch(n-1,s,u);
  printf("%.6f","%.6f\n", u.x, u.y);
  koch(n-1,u,t);
  printf("%.6f","%.6f\n", t.x, t.y);
  koch(n-1,t,b);
}

int main(){
  int n;
  cin >> n;
  Point  a, b;
  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.6f","%.6f\n", a.x, a.y);
  koch(n,a,b);
  printf("%.6f","%.6f\n", b.x, b.y);
  return 0;
}



Compiler output:
a.cc:15:23: error: expected ';' at end of member declaration
   15 | struct Point{double x,y};
      |                       ^
      |                        ;
Language: C++

#include<iostream>                                                                    
#include<algorithm>
#include<math.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)n;i++)

int n;

struct Point{
        double x,y;
}

void koch(int n,Point a,Point b){
        if(n==0) return;
        Point s,t,u;
        double th=M_PI*60.0/180.0;

        s.x=(2.0*a.x+1.0*b.x)/3.0;
        s.y=(2.0*a.y+1.0*b.y)/3.0;
        t.x=(1.0*a.x+2.0*b.x)/3.0;
        t.y=(2.0*a.y+1.0*b.y)/3.0;
        u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
koch(n-1,a,s);
cout<<s.x<<s.y<<endl;
koch(n-1,s,u);
cout<<u.x<<u.y<<endl;
koch(n-1,u,t);
cout<<t.x<<t.y<<endl;
koch(n-1,t,b);
}


int main(){
        Point a,b;
        int n;
        cin>>n;
        a.x=0;
        a.y=0;
        b.x=100;
        b.y=0;
        cout<<a.x<<a.y<<endl;
        koch(n,a,b);
        cout<<b.x<<b.y<<endl;

        return 0;
}  


Compiler output:
a.cc:11:2: error: expected ';' after struct definition
   11 | }
      |  ^
      |  ;
Language: C++

#include<iostream>                                                                    
#include<algorithm>
#include<math.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)n;i++)

int n;

struct Point{
        double x,y;
}

void koch(int n,Point a,Point b){
        if(n==0) return;
        Point s,t,u;
        double th=M_PI*60.0/180.0;

        s.x=(2.0*a.x+1.0*b.x)/3.0;
        s.y=(2.0*a.y+1.0*b.y)/3.0;
        t.x=(1.0*a.x+2.0*b.x)/3.0;
        t.y=(2.0*a.y+1.0*b.y)/3.0;
        u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
koch(n-1,a,s);
cout<<s.x<<s.y<<endl;
koch(n-1,s,u);
cout<<u.x<<u.y<<endl;
koch(n-1,u,t);
cout<<t.x<<t.y<<endl;
koch(n-1,t,b);
}


int main(){
        Point a,b;
        int n;
        cin>>n;
        a.x=0;
        a.y=0;
        b.x=100;
        b.y=0;
        cout<<a.x<<a.y<<endl;
        koch(n,a,b);
        cout<<b.x<<b.y<<endl;

        return 0;
}                           



Compiler output:
a.cc:11:2: error: expected ';' after struct definition
   11 | }
      |  ^
      |  ;
Language: C++

#include <stdio.h>
#include <math.h>

struct Point {
    double x, y;
}

void koch(int n, Point a, Point b) {
    if(n==0) return;
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;
    
    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) - (t.y - s.y) * cos(th) + s.y;
    
    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}

int main() {
    Point a, b;
    int n;
    
    scanf("%d", &n);
    
    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;
    
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    
    return 0;
}


Compiler output:
a.cc:6:2: error: expected ';' after struct definition
    6 | }
      |  ^
      |  ;
Language: C++

bool flagfirst=true;

//function kochCurve
void kochCurve(XY p1,XY p2,int n){
  XY s,u,t;
  double xlen;

  xlen=p2.x-p1.x;

  s.x=xlen/3;
  s.y=p1.y/3;
  t.x=2*xlen/3;
  t.y=p2.y*2/3;

  u.x=s.x*cos(M_PI/3)-s.y*sin(M_PI/3)+s.x;
  u.y=s.x*sin(M_PI/3)+s.y*cos(M_PI/3)+s.y;

  //print to 8 decimal places
  if(flagfirst==true) {
    printf("%.8f  %.8f\n",p1.x,p1.y);
    flagfirst=false;
  }
 
  if(n>0){
    kochCurve(p1,s,n-1);
    printf("%.8f  %.8f\n",s.x,s.y);
    kochCurve(s,u,n-1);  
    printf("%.8f  %.8f\n",u.x,u.y);   
    kochCurve(u,t,n-1);
    printf("%.8f  %.8f\n",t.x,t.y); 
    kochCurve(t,p2,n-1);
    
    if(n-1==0){
      printf("%.8f  %.8f\n",p2.x,p2.y); 
    }
  
  }


}

int main(){

  int n;
  XY p1,p2;

  //load number
  cin >>n;

  //initialize
  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;


  //execute kochCurve
  kochCurve(p1,p2,n);



  return 0;

}

Compiler output:
a.cc:4:6: error: variable or field 'kochCurve' declared void
    4 | void kochCurve(XY p1,XY p2,int n){
      |      ^~~~~~~~~
a.cc:4:16: error: 'XY' was not declared in this scope
    4 | void kochCurve(XY p1,XY p2,int n){
      |                ^~
a.cc:4:22: error: 'XY' was not declared in this scope
    4 | void kochCurve(XY p1,XY p2,int n){
      |                      ^~
a.cc:4:28: error: expected primary-expression before 'int'
    4 | void kochCurve(XY p1,XY p2,int n){
      |                            ^~~
a.cc: In function 'int main()':
a.cc:45:3: error: 'XY' was not declared in this scope
   45 |   XY p1,p2;
      |   ^~
a.cc:48:3: error: 'cin' was not declared in this scope
   48 |   cin >>n;
      |   ^~~
a.cc:51:3: error: 'p1' was not declared in this scope
   51 |   p1.x=0;
      |   ^~
a.cc:53:3: error: 'p2' was not declared in this scope
   53 |   p2.x=100;
      |   ^~
a.cc:58:3: error: 'kochCurve' was not declared in this scope
   58 |   kochCurve(p1,p2,n);
      |   ^~~~~~~~~