Language: C++

#include <iostream>
#include <list>
#include <math.h>

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define EQF(a, b) (fabs((a) - (b)) < EPS)

const double EPS = 0.1;

class Vector {
	double x, y;
	int angle;
public:
	Vector() : x(0.0), y(0.0) {}
	Vector(double x, double y) : x(x), y(y) {}
	explicit Vector(std::istream &input) { input >> x >> y; }
	Vector(const Vector &v) : x(v.x), y(v.y), angle(v.angle) {}
	Vector operator+(const Vector &v) const { return Vector(x + v.x, y + v.y); }
	Vector operator-(const Vector &v) const { return Vector(x - v.x, y - v.y); }
	double operator*(const Vector &v) const { return x * v.x + y * v.y; }
	Vector operator*(double s) const { return Vector(x * s, y * s); }
	Vector operator/(double s) const { return Vector(x / s, y / s); }
	double operator^(const Vector &v) const { return x * v.y - y * v.x; }
	Vector &operator=(const Vector &v) { x = v.x; y = v.y; angle = v.angle; return *this; }
	Vector scale(double s) const { return Vector(x * s, y * s); }
	double size() const { return sqrt(x * x + y * y); }
	Vector normalize() const { return *this / size(); }
	void print() const { std::cout << "(" << x << ", " << y << ")" << std::endl; }
	void set_angle(int new_angle) { angle = new_angle; }
	int get_angle() { return angle; }
};
Vector operator*(double s, const Vector &v) { return v.scale(s); }

class NumericException : public std::exception {
	std::string msg;
public:
	NumericException() : msg("") {}
	explicit NumericException(const std::string &msg) : msg(msg) {}
	virtual ~NumericException() throw() {}
	const char *what() const throw() { return msg.c_str(); }
};

std::list<Vector> vertex_list;
std::list<std::list<Vector> > save_stack;
int large_num, small_num;

void dump()
{
	for(std::list<Vector>::iterator i = vertex_list.begin(); i != vertex_list.end(); i++) {
		std::cout << i->get_angle() << ", ";
	}
	std::cout << std::endl;
}

int solve_recursive()
{
	if(vertex_list.size() < 3) return 0;

	save_stack.push_back(std::list<Vector>(vertex_list));

	while(1) {
		int flag = false;
		for(std::list<Vector>::iterator i = vertex_list.begin(); i != vertex_list.end(); i++) {
			std::list<Vector>::iterator prev = i;
			std::list<Vector>::iterator next = i;

			if(prev == vertex_list.begin()) prev = vertex_list.end();
			prev--;
			next++;
			if(next == vertex_list.end()) next = vertex_list.begin();

			if(i->get_angle() % 360 == 0) {
				prev->set_angle(prev->get_angle() + next->get_angle() - 360);
				i = vertex_list.erase(i);
				if(vertex_list.size() < 3) return 0;
				vertex_list.erase(next);
				if(vertex_list.size() < 3) return 0;
				flag = true;
				simp_count++;
				break;
			}
		}
		if(!flag) break;
	}

	if(vertex_list.size() < 3) return 0;

	for(std::list<Vector>::iterator i = vertex_list.begin(); i != vertex_list.end(); i++) {
		std::list<Vector>::iterator prev = i;
		std::list<Vector>::iterator next = i;

		if(prev == vertex_list.begin()) prev = vertex_list.end();
		prev--;
		next++;
		if(next == vertex_list.end()) next = vertex_list.begin();
		
		int i_old = i->get_angle();
		int prev_old = prev->get_angle();
		int next_old = next->get_angle();

		switch(i->get_angle()) {
		case 36:
			if(prev->get_angle() >= 144 && next->get_angle() >= 144) {
				i->set_angle(324);
				prev->set_angle(prev->get_angle() - 144);
				next->set_angle(next->get_angle() - 144);
				small_num++;
				if(solve_recursive() == 0) return 0;
				small_num--;
			}
			break;
		case 72:
			if(prev->get_angle() >= 108 && next->get_angle() >= 108) {
				i->set_angle(288);
				prev->set_angle(prev->get_angle() - 108);
				next->set_angle(next->get_angle() - 108);
				large_num++;
				if(solve_recursive() == 0) return 0;
				large_num--;
			}
			break;
		case 108:
			if(prev->get_angle() >= 72 && next->get_angle() >= 72) {
				i->set_angle(252);
				prev->set_angle(prev->get_angle() - 72);
				next->set_angle(next->get_angle() - 72);
				large_num++;
				if(solve_recursive() == 0) return 0;
				large_num--;
			}
			break;
		case 144:
			if(prev->get_angle() >= 36 && next->get_angle() >= 36) {
				i->set_angle(216);
				prev->set_angle(prev->get_angle() - 36);
				next->set_angle(next->get_angle() - 36);
				small_num++;
				if(solve_recursive() == 0) return 0;
				small_num--;
			}
			break;
		default:
			continue;
		}
		i->set_angle(i_old);
		prev->set_angle(prev_old);
		next->set_angle(next_old);
	}

	vertex_list = save_stack.back();
	save_stack.pop_back();
	return 1;
}

int main()
{
	while(1) {
		try {
			int vertex_num;

			std::cin >> vertex_num;

			if(std::cin.eof()) break;

			if(vertex_num < 3) throw NumericException("Please specify more than 2 vertices");

			large_num = 0;
			small_num = 0;

			std::list<Vector> input_list;

			REP(i, vertex_num) {
				input_list.push_back(Vector(std::cin));
			}

			Vector prev = input_list.back();

			for(std::list<Vector>::iterator i = input_list.begin(); i != input_list.end(); i++) {
				Vector diff = (*i) - prev;

				if(!EQF(diff.size(), round(diff.size()))) throw NumericException("Edge length must be integer");

				int segment_num = static_cast<int>(round(diff.size()) + EPS);

				for(int j = 1; j <= segment_num; j++) {
					vertex_list.push_back(prev + (double)j * diff.normalize());
				}

				prev = (*i);
			}

			for(std::list<Vector>::iterator i = vertex_list.begin(); i != vertex_list.end(); i++) {
				std::list<Vector>::iterator prev = i;
				std::list<Vector>::iterator next = i;

				if(prev == vertex_list.begin()) {
					prev = vertex_list.end();
				}
				prev--;

				next++;
				if(next == vertex_list.end()) {
					next = vertex_list.begin();
				}

				Vector prev_diff = (*i - *prev).normalize();
				Vector next_diff = (*next - *i).normalize();

				double dot = prev_diff * next_diff;

				if(dot < -1.0) dot = -1.0;
				if(dot > 1.0) dot = 1.0;

				double bend = acos(dot) / M_PI * 180.0;

				if(!EQF(bend, round(bend))) throw NumericException("Corner angles must be integer");

				int bend_i = 180 - round(bend);

				if((prev_diff ^ next_diff) < -EPS) bend_i = 360 - bend_i;

				if(bend_i % 36) throw NumericException("Corner angles must be multiple of 36");
			
				i->set_angle(bend_i);
			}

			if(solve_recursive()) throw NumericException("The given test case could not be solved");

			std::cout << small_num << " " << large_num << std::endl;
		} catch(NumericException e) {
			std::cout << "-1 -1" << std::endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve_recursive()':
a.cc:79:33: error: 'simp_count' was not declared in this scope
   79 |                                 simp_count++;
      |                                 ^~~~~~~~~~