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

#include <iostream>
#include <string>
#include <complex>

using namespace std;

// typedef complex<int> comp;

class comp : public complex<int> {
public:
    comp() : complex<int>() {}
    comp(complex<int> const& c) {
        real(c.real()), imag(c.imag());
    }
    bool overflow;
};

int const lim = 10000;

comp operate(const comp &a, const comp &b, char o) {
    comp c;
    if (o == '+') {
        c=a+b;
    } else if (o == '-') {
        c=a-b;
    } else /* if (0 == '*') */ {
        c=a*b;
    }

    bool t = c.real() > lim || c.real() < -lim || c.imag() > lim || c.imag() < -lim;
    c.overflow = a.overflow || b.overflow ? true : t;
    return c;
}

comp expr(string const&);
comp term(string const&);
comp fctr(string const&);

comp expr(string &s) {
    comp a = term(s);
    while (s[0] == '+' || s[0] == '-') {
        char o = s[0];
        s.erase(0, 1);
        comp b = term(s);
        a = operate(a, b, o);
    }
    return a;
}

comp term(string &s) {
    comp a = fctr(s);
    while (s[0] == '*') {
        s.erase(0, 1);
        comp b = fctr(s);
        a = operate(a, b, '*');
    }
    return a;
}

comp fctr(string &s) {
    comp z;
    z.overflow = false;
    if (s[0] == '(') {
        s.erase(0, 1);
        z = expr(s);
        s.erase(0, 1);
        return z;
    }

    int sign = 1;
    if (s[0] == '+')
        s.erase(0, 1);
    else if (s[0] == '-') {
        s.erase(0, 1);
        sign = -1;
    }

    if (s[0] == 'i') {
        s.erase(0, 1);
        z.imag(sign);
        return z;
    }

    int i = 0;
    while (s[i] >= '0' && s[i] <= '9') {
        z.real(z.real() * 10 + s[i] - '0');
        i++;
        if (z.real() > lim) z.overflow = true;
    }
    z.real(z.real()*sign);
    s.erase(0, i);
    return z;
}

 void print(const comp &z) {
     if (z.imag() == 0){
         cout << z.real() << endl;
     } else if (z.real() == 0) {
         cout << z.imag() << "i" << endl;
     } else {
         cout << z.real();
         if (z.imag() > 0)
             cout << "+";
         cout << z.imag() << "i" << endl;
     }
 }

int main() {
    string s;
    while (cin >> s) {
        comp z = expr(s);
        if (z.overflow) puts("overflow");
        else print(z);
    }
}

Compiler output:
/usr/bin/ld: /tmp/ccMTruPL.o: in function `expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
a.cc:(.text+0x197): undefined reference to `term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: a.cc:(.text+0x1e1): undefined reference to `term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccMTruPL.o: in function `term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
a.cc:(.text+0x29b): undefined reference to `fctr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: a.cc:(.text+0x2ce): undefined reference to `fctr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
Language: C++

// Calculation of Expressions
import java.util.*;

public class Main {
	static String formula;
	static int pos;
	static boolean overflow;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		formula = sc.next();
		pos = 0;
		overflow = false;
		Complex c = parse();
		if (overflow)
			System.out.println("overflow");
		else
			System.out.println(c);
		sc.close();
	}

	static Complex parse() {
		Complex result = term();
		while (pos < formula.length()) {
			if (formula.charAt(pos++) == '+')
				result = result.add(term());
			else
				result = result.sub(term());
		}
		return result;
	}

	static Complex term() {
		Complex result = mul();
		while (pos < formula.length() && formula.charAt(pos) == '*') {
			pos++;
			result = result.mul(mul());
		}
		return result;
	}

	static Complex mul() {
		Complex result;
		if (Character.isDigit(formula.charAt(pos)))
			return new Complex(number(), 0);
		if (formula.charAt(pos++) == 'i')
			return new Complex(0, 1);
		result = term();
		while(pos < formula.length()&&formula.charAt(pos) != ')'){
			if(formula.charAt(pos++) == '+')
				result = result.add(term());
			else
				result = result.sub(term());
		}
		pos++;
		return result;
	}

	static int number() {
		int result = 0;
		while (pos < formula.charAt(pos)
				&& Character.isDigit(formula.charAt(pos))) {
			result *= 10;
			result += formula.charAt(pos++) - '0';
		}
		return result;
	}

	static class Complex {
		int real, imaginary;

		Complex(int r, int i) {
			real = r;
			imaginary = i;
			checkOverflow();
		}

		Complex add(Complex anotherComplex) {
			return new Complex(this.real + anotherComplex.real, this.imaginary
					+ anotherComplex.imaginary);
		}

		Complex sub(Complex anotherComplex) {
			return new Complex(this.real - anotherComplex.real, this.imaginary
					- anotherComplex.imaginary);
		}

		Complex mul(Complex anotherComplex) {
			return new Complex(this.real * anotherComplex.real - this.imaginary
					* anotherComplex.imaginary, this.real
					* anotherComplex.imaginary + this.imaginary
					* anotherComplex.real);
		}

		@Override
		public String toString() {
			StringBuilder sb = new StringBuilder();
			if (real == 0) {
				if (imaginary == 0)
					return sb.append("0").toString();
				return sb.append(imaginary).append("i").toString();
			}
			sb.append(real);
			if (imaginary == 0)
				return sb.toString();
			if (imaginary < 0)
				return sb.append(imaginary).append("i").toString();
			return sb.append("+").append(imaginary).append("i").toString();
		}

		void checkOverflow() {
			if (Math.abs(real) <= 10000 && Math.abs(imaginary) <= 10000)
				return;
			pos = formula.length();
			overflow = true;
		}
	}
}

Compiler output:
a.cc:95:17: error: stray '@' in program
   95 |                 @Override
      |                 ^
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: Java

import java.util.Scanner;

public class AOJ_1103{
    
    int HEIGHT = 4;
    int WIDTH = 4;
    int[][] relationXY;

    void run(){
        Scanner sc = new Scanner(System.in);
        //int[][] temp = { { -2, 1},{ -1, 1},{ 1, 1},{ 1, 2}};
        
        while(true){
            int[][] temp = new int[4][2];
            int x = sc.nextInt();
            if(x > 4){
                break;
            }
            int y = sc.nextInt();
            temp[0][0] = x;
            temp[0][1] = y;
            for(int i = 1;i < 4;i++){
                temp[i][0] = sc.nextInt();
                temp[i][1] = sc.nextInt();
            }
            relationXY = temp;
            boolean[][] visited = new boolean[HEIGHT][WIDTH];
            System.out.println(dfs(visited,HEIGHT*WIDTH,0));
        }
    }
    int dfs(boolean[][] visited,int remain,int next){
        /*
        System.out.println("remain "+remain);
        for(int i = 0;i < HEIGHT;i++){
            for(int ii = 0;ii < WIDTH;ii++){
                System.out.print(visited[i][ii]? 1: 0);
            }
            System.out.println();
        }
        */
        if(remain == 0){
            return 1;
        }
        if(next >= HEIGHT*WIDTH){
            return 0;
        }

        int count = 0;

        int y = next / HEIGHT;
        int x = next % WIDTH;
        if( visited[y][x]){
            count+=dfs(visited,remain,next+1);
        }
        else{
            for(int i = 0;i < relationXY.length;i++){
                int rx = x + relationXY[i][0];
                int ry = y + relationXY[i][1];
                if(rx < 0 || WIDTH <= rx || ry < 0 || HEIGHT <= ry){
                    continue;
                }
                if(!visited[ry][rx]){
                    visited[y][x] = true;
                    visited[ry][rx] = true;
                    count += dfs(visited,remain-2,next+1);
                    visited[y][x] = false;
                    visited[ry][rx] = false;
                }
            }
        }

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

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

#include "stdafx.h"
#include <stdio.h>
// #include <windows.h>

int ans = 0;
int x[4],y[4];
int depth = 0;

int put_map(int m[4][4],int current){
	
	if(depth == 8){
		ans++;
		return 0;
	}

	int i,j,k,a,b,pointer;
	int next1,next2;
	int copy[4][4];

	for(pointer = current; pointer < 15; pointer++){
		i = pointer / 4;
		j = pointer % 4;

		if(m[i][j] == 0){
			for(k = 0; k < 4; k++){
				next1 = i + x[k];
				next2 = j + y[k];
				if(0 <= next1 && next1 <= 3 && 0 <= next2 && next2 <= 3){
					if(m[next1][next2] == 0){
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								copy[a][b] = m[a][b];
							}
						}
						copy[i][j] = 1;
						copy[next1][next2] = 1;
						depth++;
						
					//	for(a = 0; a < 4; a++){
					//		for(b = 0; b < 4; b++){
					//			printf("%d",copy[b][a]);
					//		}
					//		printf("\n");
					//	}

						put_map(copy,pointer);

						depth--;
						copy[i][j] = 0;
						copy[next1][next2] = 0;
					}
				}
				next1 = i - x[k];
				next2 = j - y[k];
				if(0 <= next1 && next1 <= 3 && 0 <= next2 && next2 <= 3){
					if(m[next1][next2] == 0){
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								copy[a][b] = m[a][b];
							}
						}
						copy[i][j] = 1;
						copy[next1][next2] = 1;
						depth++;
						
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								printf("%d",copy[b][a]);
							}
							printf("\n");
						}

						put_map(copy,pointer);

						depth--;
						copy[i][j] = 0;
						copy[next1][next2] = 0;
					}
				}
			}
			return 0;
		}
	}
	return 0;
}

int main()
{
	int map[4][4];
	int i,j;
	scanf("%d",&x[0]);
	while(x[0] < 4){
		scanf("%d",&y[0]);
		for(i = 1; i < 4; i++){
			scanf("%d %d",&x[i],&y[i]); // x,yの読み取り
		}

		ans = 0; // 解の個数を0に戻す
		depth = 0; // 探索中の深さを0に戻す

		for(i = 0; i < 4; i++){
			for(j = 0; j < 4; j++){
				map[i][j] = 0; // マップの初期化
			}
		}
		i = put_map(map,0);
		printf("%d\n",ans); // 解の出力
	
		scanf("%d",&x[0]);
	}
	return 0;
}

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

#include "stdafx.h"
#include <stdio.h>

int ans = 0;
int x[4],y[4];
int depth = 0;

int put_map(int m[4][4],int current){
	
	if(depth == 8){
		ans++;
		return 0;
	}

	int i,j,k,a,b,pointer;
	int next1,next2;
	int copy[4][4];

	for(pointer = current; pointer < 15; pointer++){
		i = pointer / 4;
		j = pointer % 4;

		if(m[i][j] == 0){
			for(k = 0; k < 4; k++){
				next1 = i + x[k];
				next2 = j + y[k];
				if(0 <= next1 && next1 <= 3 && 0 <= next2 && next2 <= 3){
					if(m[next1][next2] == 0){
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								copy[a][b] = m[a][b];
							}
						}
						copy[i][j] = 1;
						copy[next1][next2] = 1;
						depth++;
						put_map(copy,pointer);

						depth--;
						copy[i][j] = 0;
						copy[next1][next2] = 0;
					}
				}
				next1 = i - x[k];
				next2 = j - y[k];
				if(0 <= next1 && next1 <= 3 && 0 <= next2 && next2 <= 3){
					if(m[next1][next2] == 0){
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								copy[a][b] = m[a][b];
							}
						}
						copy[i][j] = 1;
						copy[next1][next2] = 1;
						depth++;
						
						for(a = 0; a < 4; a++){
							for(b = 0; b < 4; b++){
								printf("%d",copy[b][a]);
							}
							printf("\n");
						}

						put_map(copy,pointer);

						depth--;
						copy[i][j] = 0;
						copy[next1][next2] = 0;
					}
				}
			}
			return 0;
		}
	}
	return 0;
}

int main()
{
	int map[4][4];
	int i,j;
	scanf("%d",&x[0]);
	while(x[0] < 4){
		scanf("%d",&y[0]);
		for(i = 1; i < 4; i++){
			scanf("%d %d",&x[i],&y[i]);	}

		ans = 0;
		depth = 0;

		for(i = 0; i < 4; i++){
			for(j = 0; j < 4; j++){
				map[i][j] = 0; 			}
		}
		i = put_map(map,0);
		printf("%d\n",ans);	
		scanf("%d",&x[0]);
	}
	return 0;
}

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

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

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

typedef vector<int> VI;

int cnt;
int num[8];

void solve(VI board, int depth)
{
	//end check
	if(depth == 8)
	{
		bool is_end = true;
		REP(i, board.size())
		{
			if(board[i] == 0)
			{
				is_end = false;
				break;
			}
		}
		
		if(is_end){
	 		cnt++;
			return;
		}
	}

	//normal procedure
	bool is_set = false;
	REP(y, 4)
	{
		REP(x, 4)
		{
			if(board[y*4+x] == 0)
			{
				REP(i, 4)
				{
					int dx = num[i*2+0];
					int dy = num[i*2+1];
					int xx = x + dx;
					int yy = y + dy;
					if(xx>=0 && yy>=0 && xx<4 && yy<4) 
					{
						if(board[yy*4+xx] == 0)
						{
							VI v = VI(16);
							memcpy(&v[0], &board[0], sizeof(int)*16);
							v[y*4+x] = depth+1;
							v[yy*4+xx] = depth+1;
							solve(v, depth+1);
						}
					}
				}
				is_set = true;
				break;
			}
		}
		if(is_set) break;
	}	
}
   
int main()
{
	while( 1 )
	{
		scanf("%d", &num[0]);
		if(num[0] > 4) break;
		
		for(int i=1; i<8; i++)
		{
			scanf("%d", &num[i]);
		}

		cnt = 0;
		VI v = VI(16);
		memset(&v[0], 0, sizeof(int)*16);
		solve(v, 0);

		printf("%d\n", cnt);
	}
}

Compiler output:
a.cc: In function 'void solve(VI, int)':
a.cc:52:57: error: 'memcpy' was not declared in this scope
   52 |                                                         memcpy(&v[0], &board[0], sizeof(int)*16);
      |                                                         ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | 
a.cc: In function 'int main()':
a.cc:81:17: error: 'memset' was not declared in this scope
   81 |                 memset(&v[0], 0, sizeof(int)*16);
      |                 ^~~~~~
a.cc:81:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: Java

import java.util.*;

class Main{
	public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int mX,mY;
        int ang=0;
        String[] puts=new String[50];
        
        do{
			int x=sc.nextInt();
	        int y=sc.nextInt();
			String s=sc.next();
			while(!(s.equals("STOP"))){
	            if(s.equals("FORWARD"){
					int f=sc.nextInt();
					switch(ang){
						case 0:
							for(int i=0;i<f;i++){
								if(x!=100){
									x++;
								}
							}
							break;
						case 1:
							for(int i=0;i<f;i++){
								if(y!=100){
									y++;
								}
							}
							break;
						case 2:
							for(int i=0;i<f;i++){
								if(x!=0){
									x--;
								}
							}
							break;
						case 3:
							for(int i=0;i<f;i++){
								if(y!=0){
									y--;
								}
							}
							break;
					}
				}else if(s.equals("RIGHT"){
					if(ang!=3){
						ang++;
					}else{
						ang=0;
					}
				}else if(s.equals("LEFT"){
					if(ang!=0){
						ang--;
					}else{
						ang=3;
					}
				}
			}
			System.out.println(mX+" "+mY);
		}while((x!=0)&&(y!=0));
	}
}



Compiler output:
Main.java:15: error: ')' expected
	            if(s.equals("FORWARD"){
	                                  ^
Main.java:47: error: ')' expected
				}else if(s.equals("RIGHT"){
				                          ^
Main.java:53: error: ')' expected
				}else if(s.equals("LEFT"){
				                         ^
3 errors
Language: Java

import java.util.*;

public class AOJ1104{

    public static void main(String[] args){
	int Walk,x,y,w,h;
	Scanner in = new Scanner(System.in);
	final int[] dx = {0,1,0,-1}; 
	final int[] dy = {1,0,-1,0};
	int dir;
       
	while(true){
	    w = in.nextInt();
	    h = in.nextInt();	       

	    if(w+h == 0)break;
	    dir = 0;
	    x=y=1;
	    while(true){
		String op = in.next();
		if(op.equals("STOP"))break;

		if(op.equals("RIGHT")){
		    ++dir;
		    if(dir == 4)dir = 0;
		}
		else if(op.equals("LEFT")){
		    --dir;
		    if(dir == -1)dir = 3;
		}
		else if(op.equals("FORWARD")){
		    Walk = in.nextInt();
		    x = x + Walk*dx[dir];
		    if(x > w)x = w;
		    if(x <= 0)x=1;
		    y = y + Walk*dy[dir];
		    if(y > h)y = h;
		    if(y <= 0)y=1;
		}
		else if(op.equals("BACKWARD")){
		    Walk = in.nextInt();
		    x = x - Walk*dx[dir];
		    if(x > w)x = w;
		    else if(x < 0)x = 1;
		    y = y - Walk*dy[dir];
		    if(y > h)y = h;
		    else if(y <= 0)y = 1;
		}
	    }
	    System.out.println(x + " " + y);
	}

    }



}

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

import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[][]ds={{0,1},{1,0},{0,-1},{-1,0}};for(int[]n={0,0};(n[0]=s.nextInt())>0;){n[1]=s.nextInt();int[]p={1,1};int d=0,i,x;for(String y;!(y=s.next()).equals("STOP");System.out.println(p[0]+" "+p[1])){if(y.endsWith("D"))for(i=2,x=s.nextInt();i-->0;)p[i]=Math.min(n[i],Math.max(1,p[i]+ds[d][i]*x*(y.charAt(0)==70?1:-1)));if(y.charAt(0)==76)d=(d+3)%4;if(y.charAt(0)==82)d=(d+1)%4;}}}}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[][]ds={{0,1},{1,0},{0,-1},{-1,0}};for(int[]n={0,0};(n[0]=s.nextInt())>0;){n[1]=s.nextInt();int[]p={1,1};int d=0,i,x;for(String y;!(y=s.next()).equals("STOP");System.out.println(p[0]+" "+p[1])){if(y.endsWith("D"))for(i=2,x=s.nextInt();i-->0;)p[i]=Math.min(n[i],Math.max(1,p[i]+ds[d][i]*x*(y.charAt(0)==70?1:-1)));if(y.charAt(0)==76)d=(d+3)%4;if(y.charAt(0)==82)d=(d+1)%4;}}}}
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[][]ds={{0,1},{1,0},{0,-1},{-1,0}};for(int[]n={0,0};(n[0]=s.nextInt())>0;){n[1]=s.nextInt();int[]p={1,1};int d=0,i,x;for(String y;!(y=s.next()).equals("STOP");System.out.println(p[0]+" "+p[1])){if(y.endsWith("D"))for(i=2,x=s.nextInt();i-->0;)p[i]=Math.min(n[i],Math.max(1,p[i]+ds[d][i]*x*(y.charAt(0)==70?1:-1)));if(y.charAt(0)==76)d=(d+3)%4;if(y.charAt(0)==82)d=(d+1)%4;}}}}
      |            ^
main.c:1:20: error: unknown type name 'class'
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[][]ds={{0,1},{1,0},{0,-1},{-1,0}};for(int[]n={0,0};(n[0]=s.nextInt())>0;){n[1]=s.nextInt();int[]p={1,1};int d=0,i,x;for(String y;!(y=s.next()).equals("STOP");System.out.println(p[0]+" "+p[1])){if(y.endsWith("D"))for(i=2,x=s.nextInt();i-->0;)p[i]=Math.min(n[i],Math.max(1,p[i]+ds[d][i]*x*(y.charAt(0)==70?1:-1)));if(y.charAt(0)==76)d=(d+3)%4;if(y.charAt(0)==82)d=(d+1)%4;}}}}
      |                    ^~~~~
main.c:1:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int[][]ds={{0,1},{1,0},{0,-1},{-1,0}};for(int[]n={0,0};(n[0]=s.nextInt())>0;){n[1]=s.nextInt();int[]p={1,1};int d=0,i,x;for(String y;!(y=s.next()).equals("STOP");System.out.println(p[0]+" "+p[1])){if(y.endsWith("D"))for(i=2,x=s.nextInt();i-->0;)p[i]=Math.min(n[i],Math.max(1,p[i]+ds[d][i]*x*(y.charAt(0)==70?1:-1)));if(y.charAt(0)==76)d=(d+3)%4;if(y.charAt(0)==82)d=(d+1)%4;}}}}
      |                              ^
Language: C++

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#include <stack>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;

using namespace std;

bool cmp(int a,int b)
{
    return a>b;
}
int flag;
int x,y,n,m;
int getbool(int i){
	if(i==1){
		return (flag+1)%4;
	}
	else {
		flag--;
		if(flag==-1){
			return 3;

		return flag;
	}
}
void getval(int num)
{
	if(flag==0){
		y+=num;
	}
	if(flag==1){
		x+=num;
	}
	if(flag==2){
		y-=num;
	}
	if(flag==3){
		x-=num;
	}
	if(y>n)y=n;
	if(y<=0)y=1;
	if(x<=0)x=1;
	if(x>m)x=m;
}
int main()
{
    #ifndef ONLINE_JUDGE
       freopen("in.txt","r",stdin);
    #endif
    while(cin>>m>>n){
		if((n+m)==0)break;
		flag=0;
		x=y=1;
		string s;
		while(cin>>s){
			if(s[0]=='S')break;
			else if(s[0]=='R'){
				flag=getbool(1);
			}
			else if(s[0]=='L')flag=getbool(2);
			else {
				int len;
			    cin>>len;
			    if(s[0]=='F')
			         getval(len);
				else getval(-len);
			}

		}
		cout<<x<<" "<<y<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int getbool(int)':
a.cc:48:1: error: a function-definition is not allowed here before '{' token
   48 | {
      | ^
a.cc:66:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   66 | int main()
      |         ^~
a.cc:66:9: note: remove parentheses to default-initialize a variable
   66 | int main()
      |         ^~
      |         --
a.cc:66:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:67:1: error: a function-definition is not allowed here before '{' token
   67 | {
      | ^
a.cc:94:2: error: expected '}' at end of input
   94 | }
      |  ^
a.cc:35:19: note: to match this '{'
   35 | int getbool(int i){
      |                   ^
a.cc:94:2: warning: control reaches end of non-void function [-Wreturn-type]
   94 | }
      |  ^
Language: C++

#include<iostream>
#include<math.h>
#include<iomanip>
#include<String>
using namespace std;

int main(){
  int n,m,x,y,num;
  int di=0;
  string order;
  while(1){
    cin>>n>>m;
    x=1;y=1;
    if(n==0 && m==0)break;
    while(1){
      cin>>order;
      if(order=="FORWARD"){
	cin>>num;
	if(di==0){
	  y=min(y+num,m);
	}else if(di==1){
	  x=min(x+num,n);
	}else if(di==2){
	  y=max(y-num,1);
	}else if(di==3){
	  x=max(x-num,1);
	}
      
      }else if(order=="BACKWARD"){
	cin>>num;
	if(di==2){
	  y=min(y+num,m);
	}else if(di==3){
	  x=min(x+num,n);
	}else if(di==0){
	  y=max(y-num,1);
	}else if(di==1){
	  x=max(x-num,1);
	}
      }else if(order=="RIGHT"){
	di=(di+1)%4;
      }else if(order=="LEFT"){
	di=(di-1)%4;
      }else if(order=="STOP"){
	cout << x <<" "<<y<<endl;
	break;
      }else{
	cout << "ERROR "<<order<<endl;
	return 0;
      }
    }
  }
}

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

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

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    int n, m;
    while(cin >> n >> m, n+m){
        int mx = 1, my = 1;
        int direction = 0;
        while(1){
            string command;
            int step;
            cin >> command;
            if(command == "FORWARD"){
                cin >> step;
                if(mx+dx[direction]*step <= n) mx += dx[direction]*step;
                else mx = n;
                if(my+dy[direction]*step <= m) my += dy[direction]*step;
                else my = m;
            }
            else if(command == "BACKWARD"){
                cin >> step;
                if(0 <= mx-dx[direction]*step) mx -= dx[direction]*step;
                else mx = 0;
                if(0 <= my-dy[direction]*step) my -= dy[direction]*step;
                else my = 0;
            }
            else if(command == "RIGHT")direction = (direction+1)%4;
            else if(command == "LEFT"){
                direction--;
                if(direction == -1) direction = 3;
            }
            else if(command == "STOP"

Compiler output:
a.cc: In function 'int main()':
a.cc:35:38: error: expected ')' at end of input
   35 |             else if(command == "STOP"
      |                    ~                 ^
      |                                      )
a.cc:35:38: error: expected statement at end of input
a.cc:35:38: error: expected '}' at end of input
a.cc:12:17: note: to match this '{'
   12 |         while(1){
      |                 ^
a.cc:35:38: error: expected '}' at end of input
   35 |             else if(command == "STOP"
      |                                      ^
a.cc:9:30: note: to match this '{'
    9 |     while(cin >> n >> m, n+m){
      |                              ^
a.cc:35:38: error: expected '}' at end of input
   35 |             else if(command == "STOP"
      |                                      ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define all(in) in.begin(),in.end()
#define pb(in,a) in.push_back(a)
using namespace std;
int a[4]={0,1,0,-1};
int b[4]={1,0,-1,0};
int main(){
  int n,m;
  while(cin>>n>>m,n||m){
    int to=0;
    string s;
    int x=1,y=1;
    while(1){
      if(s=="FORWARD"){
	int tmp;
	cin>>tmp;
	x+=tmp*a[to];
	y+=tmp*b[to];
      }else{
	int tmp;
	cin>>tmp;
	x-=tmp*a[to];
	y-=tmp*b[to];
      }else if(s=="STOP")break;
      else if(s=="LEFT")to--;
      else to++;

      if(to>3)to=0;
      else if(to<0)to=3;

      if(x>n)x=n;
      else if(x<1)x=1;
      if(y>m)y=m;
      else if(y<1)y=1;

    }
    cout<<x<<" "<<y<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:8: error: 'else' without a previous 'if'
   28 |       }else if(s=="STOP")break;
      |        ^~~~
Language: C

/*

*/

#include<stdio.h>

int Main();

int main(int argc, char *argv[]){
	while( Main() == 0 );
	return 0;
}

int Main(){
	int n = 0, a = 0, b = 0, count = 0, i = 0, j = 0;	//?????????????????\????????????a??¨b???????????§?????????????????°???
	if( scanf("%d %d %d", &n, &a, &b) != 3 ){ return -1; }
	char list[n+1];	//????????§????????????????????????????????????0????????????????????????1???
	for( i = 0; i < n+1; i++ ){ list[i] = 1; }
	for( i = 0; a * i <= n; i++ ){
		for( j = 0; a * i + b * j <= n; j++ ){
			list[a*i+b*j] = 0;
		}
	}
	for( i = 1; i <= n; i++ ){ count += (int)list[i];
	printf("%d\n", count);
	return 0;
}

Compiler output:
main.c: In function 'Main':
main.c:27:1: error: expected declaration or statement at end of input
   27 | }
      | ^
Language: C

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,1,-1,-1,0};
const int dy[]={0,0,1,-1,1,-1,1,-1,0};

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

int main() {
	int n, a, b, g, res;
	IL {
		cin >> n >> a >> b;
		if (n == 0 && a == 0 && b == 0) break;
		if (a > b) swap(a, b);
		g = gcd(a, b);
		res = 0;
		if (g > 1) {
			res += n - n / g;
			n /= g;
			a /= g;
			b /= g;
		}
		repn (i, 1, a) {
			rep (j, a) {
				if (b * j % a == i) {
					res += b * j / a;
					break;
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}

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

#include<iostream>
#include<string>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,a,b;
bool used[1000004];
int main(){
  while(cin>>n>>a>>b,n){
    int sum=0;
    memset(used,0,sizeof(used));
    for(int i=a;i<=n;i+=a)used[i]=1;
    for(int j=b;j<=n;j+=b)used[j]=1;
    r(i,n+1)if(used[i]&&i+a<=n)used[i+a]=1;
    r(i,n+1)if(used[i]&&i+b<=n)used[i+b]=1;
    r(i,n)if(!used[i+1])sum++;
    cout<<sum<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(used,0,sizeof(used));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

include<iostream>

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b){
  if(a%b==0)return b;
  return gcd(b,a%b);
}

lli lcm(lli a, lli b){
  if(a<b)swap(a,b);
  lli g=gcd(a,b);
  return b*(a/g);
}

int main(){
  while(true){
    int ableCount = 0;
    int n,a,b;
    cin >> n >> a >> b;
    if(n==0&&a==0&&b==0)break;
    for(int k = 1; k <= n; k++){
      bool cond1 = ((k%a)%b)==0;
      bool cond2 = ((k%b)%a)==0;
      //if(cond1&&cond2)continue;
      if(cond1||cond2)++ableCount;
    }
    cout <<n-(n%lcm(a,b)==0?0:1)-ableCount << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'lli lcm(lli, lli)':
a.cc:13:10: error: 'swap' was not declared in this scope
   13 |   if(a<b)swap(a,b);
      |          ^~~~
a.cc: In function 'int main()':
a.cc:22:5: error: 'cin' was not declared in this scope
   22 |     cin >> n >> a >> b;
      |     ^~~
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout <<n-(n%lcm(a,b)==0?0:1)-ableCount << endl;
      |     ^~~~
a.cc:30:47: error: 'endl' was not declared in this scope
   30 |     cout <<n-(n%lcm(a,b)==0?0:1)-ableCount << endl;
      |                                               ^~~~
Language: C++

#include<iostream>
int n,a,b,i,j,f[1000001];main(){ for(;std::cin>>n>>a>>b,n|a|b;printf("%d\n",j)){for(i=0;i<n;i++)f[i]=1;for(i=0;i<=n;i+=a)if(f[i])for(j=i;j<=n;j+=b)f[j]=0;j=0;for(i=1;i<=n;)f[i++]&&j++;}

Compiler output:
a.cc:2:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | int n,a,b,i,j,f[1000001];main(){ for(;std::cin>>n>>a>>b,n|a|b;printf("%d\n",j)){for(i=0;i<n;i++)f[i]=1;for(i=0;i<=n;i+=a)if(f[i])for(j=i;j<=n;j+=b)f[j]=0;j=0;for(i=1;i<=n;)f[i++]&&j++;}
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:2:186: error: expected '}' at end of input
    2 | int n,a,b,i,j,f[1000001];main(){ for(;std::cin>>n>>a>>b,n|a|b;printf("%d\n",j)){for(i=0;i<n;i++)f[i]=1;for(i=0;i<=n;i+=a)if(f[i])for(j=i;j<=n;j+=b)f[j]=0;j=0;for(i=1;i<=n;)f[i++]&&j++;}
      |                                ~                                                                                                                                                         ^
Language: C++

from fractions import gcd

while True:
    a, b, c = map(int, input().split())
    if not a:
        break
    d = (b ** 2 - 4 * a * c) ** 0.5
    if isinstance(d, complex) or d - int(d) > 1e-6:
        print('Impossible')
        continue
    num1, num2 = -b + int(d), -b - int(d)
    den = 2 * a
    cmn1, cmn2 = gcd(num1, den), gcd(num2, den)
    print(den // cmn1, -num1 // cmn1, den // cmn2, -num2 // cmn2)

Compiler output:
a.cc:9:15: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
    9 |         print('Impossible')
      |               ^~~~~~~~~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from fractions import gcd
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  while(cin>>a>>b>>c,a){
    if(c==0){
      if(a==1&&b<0)cout<<a<<' '<<0<<' '<<1<<' '<<b<<endl;
      else cout<<a<<' '<<b<<' '<<1<<' '<<0<<endl;
    }
    else{for(int j=1;j<=a;j++){
      if(a%j==0){
        if(a/j>=j)
          for(int i=10000;i>=-10000;i--){
            long long t,p=0;
            if(i*j+a/j*p==b&&p*i==c){
              cout<<a/j<<' '<<i<<' '<<j<<' '<<p<<endl;
              goto L;
            }
            if(i!=0){
              if(c%abs(i)==0)t=c/i;
              else continue;
            }
            else continue;
            if(i*j+a/j*t==b&&t*i==c){
              if(j*j==a&&i<t)cout<<a/j<<' '<<t<<' '<<j<<' '<<i<<endl;
              else cout<<a/j<<' '<<i<<' '<<j<<' '<<t<<endl;
              goto L;
            }
          }
          else break;
        }
      }
      cout<<"Impossible"<<endl;L:;
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:35:4: error: expected '}' at end of input
   35 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

bool ok(int p, int q, int r, int s) {
	return (p>r || (p==r && q>=s));
}

int main() {
	int a, b, c;
	while(cin >> a >> b >> c, a) {
		FOR(p, 1, a) {
			int r = a/p;
			if(p*r != a) 
				continue;
			if(c != 0) {
				int st = min(-c, c), en = max(-c, c);
				FOR(q, st, en) {
					if(q == 0)
						continue;
					int s = c/q;
					if(q*s != c)
						continue;

Compiler output:
a.cc: In function 'int main()':
a.cc:54:58: error: expected '}' at end of input
   54 |                                                 continue;
      |                                                          ^
a.cc:49:48: note: to match this '{'
   49 |                                 FOR(q, st, en) {
      |                                                ^
a.cc:54:58: error: expected '}' at end of input
   54 |                                                 continue;
      |                                                          ^
a.cc:47:36: note: to match this '{'
   47 |                         if(c != 0) {
      |                                    ^
a.cc:54:58: error: expected '}' at end of input
   54 |                                                 continue;
      |                                                          ^
a.cc:43:30: note: to match this '{'
   43 |                 FOR(p, 1, a) {
      |                              ^
a.cc:54:58: error: expected '}' at end of input
   54 |                                                 continue;
      |                                                          ^
a.cc:42:38: note: to match this '{'
   42 |         while(cin >> a >> b >> c, a) {
      |                                      ^
a.cc:54:58: error: expected '}' at end of input
   54 |                                                 continue;
      |                                                          ^
a.cc:40:12: note: to match this '{'
   40 | int main() {
      |            ^
Language: C++

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

const double PI = 3.14159265;

bool eq(double a, double b){
    return fabs(a-b) < 1e-7;
}

double angle(double cur, double next){
    double r = cur - next + 2*PI;
    while( r >= 2*PI ) r -= 2*PI;
    return r;
}

double dist(double x1, double y1, double x2, double y2){
    return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
}

int main(){
    int n;
    double x[400], y[400];
    while( cin >> n && n ){
        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i];
        }
        double cx = 0, cy = 0, cang = atan2(0,-1);
        double lv, ld, sum = 0.0;
        int ln;
        for(int i = 0; i < n; i++){
            lv = 100; ld = 1000;
            for(int j = 0; j < n; j++){
                if( x[j] < 0 ) continue;
                double ang = angle( cang,
                                    atan2(y[j]-cy, x[j]-cx) );
                if( ang < lv ||
                    ( eq(ang, lv) && dist(cx, cy, x[j], y[j]) < ld ) ){
                    lv = ang; ln = j;
                    ld = dist(cx, cy, x[j], y[j]);
                }
             }
             sum += ld;
             cang = atan2(y[ln]-cy, x[ln]-cx);
             cx = x[ln]; cy = y[ln];
             x[ln] = -1;
         }
         cout << fixed << setprecision(1)
              << (int)(sum*10+0.5)/10.0 << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'double dist(double, double, double, double)':
a.cc:19:51: error: expected ')' before ';' token
   19 |     return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
      |                ~                                  ^
      |                                                   )
Language: C++

#include <iostream>
#include <vector>
#include <complex>
#include <iterator>
#include <iomanip>

using namespace std;

int main() {
    int n;
    while (cin>>n) {
        vector<complex<float>> vs;
        complex<float> next_point, last_vector;
        float min = 10.0f;
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            vs.push_back(complex<float>(y, x));
            if (arg(complex<float>(y,x)) < min) {next_point = complex<float>(y, x); min = arg(next_point);}
        }
        cout<<next_point<<endl;
        float length = abs(next_point);
        auto last_point = last_vector = next_point;
        vs.erase(find(begin(vs), end(vs), next_point));
        for (int i = 1; i < n; i++) {
            next_point = complex<float>(500,0);
            auto _it = begin(vs);
            float max = -abs(last_vector);
            for (auto it = begin(vs); it != end(vs); it++) {
                float temp = ((*it - last_point) * conj(last_vector)).real() / abs(*it - last_point);
                if (temp > max) {max = temp; _it = it;}
            }
            next_point = *_it;
            cout<<next_point<<endl;
            vs.erase(_it);
            last_vector = next_point - last_point;
            length += abs(last_vector);
            last_point = next_point;
        }
        cout<<fixed<<setprecision(1)<<length<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: no matching function for call to 'find(std::vector<std::complex<float> >::iterator, std::vector<std::complex<float> >::iterator, std::complex<float>&)'
   24 |         vs.erase(find(begin(vs), end(vs), next_point));
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:24:22: note:   '__gnu_cxx::__normal_iterator<std::complex<float>*, std::vector<std::complex<float> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   24 |         vs.erase(find(begin(vs), end(vs), next_point));
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

#define X first
#define Y second

using namespace std;

const int MAX = 450;
const double EPS = 1e-9;

typedef pair<int,int> P;
vector<P> V;
bool come[MAX];


double dot(P a, P b){
  return a.X*b.X+a.Y*b.Y;
}

double cross(P a, P b){
  return a.X*b.Y-a.Y*b.X;
}

double getLength(P pre, P nex){
  return sqrt((pre.X-nex.X)*(pre.X-nex.X)+(pre.Y-nex.Y)*(pre.Y-nex.Y));
}

double getAngle(P pre, P nex){
  return acos(dot(pre,nex)/(getLength(pre,P(0,0))*getLength(nex,P(0,0))));
}

bool ccw(P p0, P p1, P p2){
  P a = P(p1.first-p0.first,p1.second-p0.second);
  P b = P(p2.first-p0.first,p2.second-p0.second);
  return (cross(a,b) > EPS);
}


P Pminus(P a, P b){
  a.first -= b.first;
  a.second -= b.second;
  return a;
}


void solve(){

  sort(V.begin(),V.end());

  double ans = getLength(P(0,0),V[0]);

  P pre = P(0,0);
  P now = V[0];

  int roop = V.size()-1;

  while(roop--){
    int nex = -1;
    double nexTheta;

    for(int i = 1; i < V.size(); i++){
      if(come[i]) continue;
   
      //  if(ccw(pre,now,V[i])) continue;
   
      if(nex == -1){
	nex = i;
	nexTheta = getAngle(Pminus(V[i],now),Pminus(now,pre));
	continue;
      }


      double theta = getAngle(Pminus(now,pre),Pminus(V[i],now));
      
      if(fabs(nexTheta-theta) > EPS && nexTheta > theta){
	  nex = i;
	  nexTheta = theta;
      } 
      if(fabs(nexTheta-theta) < EPS && getLength(now,V[nex]) > getLength(now,V[i])){
	nex = i;
	nexTheta = theta;
      }
    }

    //cout << nex << endl;

    //  cout <<nex << " " <<  V[nex].X << " " << V[nex].Y << endl;
    come[nex] = true;

    ans += getLength(now,V[nex]);
    pre = now;
    now = V[nex];
  }
  printf("%.1f\n",ans);
}

int main(){

  int n;
  while(cin >> n && n){
    memset(come,false,sizeof(come));
    V.resize(n);
    for(int i = 0; i < n; i++) cin >> V[i].X >> V[i].Y;
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:53:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   53 |   sort(V.begin(),V.end());
      |   ^~~~
      |   sqrt
Language: C++

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

using namespace std;

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define dle(a,b) (equals(a, b) || a < b)
static const double PI = acos(-1);

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(x*a, y*a); }
  
  double abs() { return sqrt(norm()); }
  double norm() { return x*x+y*y; }
  
  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;

class Segment {
public:
  Point p1, p2;
  Segment(Point s = Point(), Point t = Point()): p1(s), p2(t) {}
};

double norm( Vector a ) { return a.x*a.x + a.y*a.y; }
double abs( Vector a ) { return sqrt(norm(a)); }
double getDistance( Vector a, Vector b ) { return a.x*b.x + a.y*b.y; }
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; }

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw( Point p0, Point p1, Point p2 ) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if( cross(a, b) > EPS ) return COUNTER_CLOCKWISE;
  if( cross(a, b) < -EPS ) return CLOCKWISE;
  if( dot(a, b) < -EPS ) return ONLINE_BACK;
  if( norm(a) < norm(b) ) return ONLINE_FRONT;
  return ON_SEGMENT;
}

int main() {
  Point p[401];
  int n;
  
  while(cin >> n, n){
    for(int i = 0; i < n; i++) {
      cin >> p[i].x >> p[i].y;
    }
    bool flag=true;
    int i, j, k;
    for(i = 0; i < n; i++) {
      flag = true;
      for(j = 0; j < n; j++) {
	if(i == j) continue;
	for(k = 0; k < n; k++) {
	  if(i == k || j == k) continue;
	  if(ccw(p[i],p[j],p[k]) == COUNTER_CLOCKWISE || ccw(p[i],p[j],p[k]) == ONLINE_BACK) swap(p[j],p[k])
	}
	if(flag) break;
      }
      if (flag) break;
    }
    
    double d = 0;
    for(int m = 1; m < n; m++) {
      d += getDistance(p[m-1],p[m]);
    }
    cout << d << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:109: error: expected ';' before '}' token
   82 |           if(ccw(p[i],p[j],p[k]) == COUNTER_CLOCKWISE || ccw(p[i],p[j],p[k]) == ONLINE_BACK) swap(p[j],p[k])
      |                                                                                                             ^
      |                                                                                                             ;
   83 |         }
      |         ~