Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include<cstdio>
#include<cmath>

double getd(double x, double y){
	double r = atan2(y, x) * 180 / M_PI;
	return r;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp,d1,d2,d3;
	int flug;
	double h;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) + 1){
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;
		flug = 0;
		d1 = getd(x1,y1);
		d2 = getd(x2,y2);
		d3 = getd(x3,y3);
		if(d1 > d2){
			h = d1;
			d1 = d2;
			d2 = h;
		}
		if(d2 > d3){
			h = d2;
			d2 = d3;
			d3 = h;
			if(d1 > d2){
				h = d1;
				d1 = d2;
				d2 = h;
			}
		}
		d2 -= d1;
		d3 -= d1;
		if(180 < d3 && d3 < d2 + 180){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

typedef struct _Line {
	Point a;
	Point b;
} Line;

typedef struct _Triangle {
	Point a;
	Point b;
	Point c;
} Triangle;

int side(Point p, Line l) {
	int n = p.x * (l.a.y - l.b.y) + l.a.x * (l.b.y - p.y) + l.b.x * (p.y - l.a.y);
	if (n > 0) return 1;
	else if (n < 0) return -1;
	else return 0;
}

bool pointInaTriangle(Point p, Triangle t) {
	Line ab, bc, ca;
	ab.a = t.a; ab.b = t.b;
	bc.a = t.b; bc.b = t.c;
	ca.a = t.c; ca.b = t.a;
	int pab = side(p, ab);
	int pbc = side(p, bc);
	int pca = side(p, ca);
	if (0 < pab && 0 < pbc && 0 < pca)
		return true;
	if (0 > pab && 0 > pbc && 0 > pca)
		return true;
	return false;
}

int main() {
	Triangle t;
	Point p;
	while (cin >> t.a.x >> t.a.y >> t.b.x >> t.b.y >> t.c.x >> t.c.y >> p.x >> p.y) {
		if (pointInaTriangle(p, t) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;

bool judge(double x[2], double y[2]) {
	double cross = x[0] * y[1] - y[0] * x[1];
	if(cross >= 0) return true;
	else return false;
}

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
		double ax[2], ay[2];
		ax[0] = x2 - x1;
		ay[0] = y2 - y1; 
		ax[1] = xp - x1;
		ay[1] = yp - y1;
		double bx[2], by[2];
		bx[0] = x3 - x2;
		by[0] = y3 - y2;
		bx[1] = xp - x2;
		by[1] = yp - y2;
		double cx[2], cy[2];
		cx[0] = x1 - x3;
		cy[0] = y1 - y3;
		cx[1] = xp - x3;
		cy[1] = yp - y3;
		if(judge(ax, ay) && judge(bx, by) && judge(cx, cy) || !judge(ax, ay) && !judge(bx, by) && !judge(cx, cy)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<vector>
using namespace std;
typedef complex < double > P;
typedef vector< P > G;
const double EPS = 1e-8;
const double INF = 1e12;
double cross(const P& a,const P& b){ //外積
  return imag(conj(a) * b);
}
double dot(const P& a,const P& b){ // 内積
  return real(conj(a) * b);
}
#define curr(P,i) P[i]
#define next(P,i) P[(i+1)%P.size()]
bool conteins(const G& Q, const P& p){
  bool in = false;
  for(int i = 0 ; i < Q.size() ; i++ ){
    P a = curr(Q,i) - p, b = next(Q,i) - p;
    if(imag(a) > imag(b)) swap(a,b);
    if(imag(a) <= 0 && 0 < imag(b) && cross(a,b) < 0) in = !in;
    if(cross(a,b) == 0 && dot(a,b) <= 0) return true;
  }
  return in;
}

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    G g(3);
    g[0] = P(x1,y1);
    g[1] = P(x2,y2);
    g[2] = P(x3,y3);
    cout << (conteins(g,P(xp,yp)) ? "YES" : "NO") << endl;
  }
}

C++: #include <cmath>
#include <stdio.h>

double PI = 3.141592653589;
//ベクトルの定義
struct Vector2D{
	double x;
	double y;
};

//ベクトルの長さを計算する
double get_vector_length( Vector2D v ) {
	return pow( ( v.x * v.x ) + ( v.y * v.y ), 0.5 );
}

//ベクトル内積
double dot_product(Vector2D vl, Vector2D vr) {
	return vl.x * vr.x + vl.y * vr.y;
}

//２つのベクトルABのなす角度θを求める
double AngleOf2Vector(Vector2D A, Vector2D B )
{
	//　※ベクトルの長さが0だと答えが出ませんので注意してください。

	//ベクトルAとBの長さを計算する
	double length_A = get_vector_length(A);
	double length_B = get_vector_length(B);

	//内積とベクトル長さを使ってcosθを求める
	double cos_sita = dot_product(A,B) / ( length_A * length_B );

	//cosθからθを求める
	double sita = acos( cos_sita );	

	//ラジアンでなく0〜180の角度でほしい場合はコメント外す
	sita = sita * 180.0 / PI;

	if(sita > 180){
		sita = 360 - sita;
	}

	return sita;
}

int main()
{
	Vector2D v1,v2,v3;
	double x[3],y[3],xp,yp;
	double sum;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF){
		v1.x = x[0] - xp;
		v1.y = y[0] - yp;
		v2.x = x[1] - xp;
		v2.y = y[1] - yp;
		v3.x = x[2] - xp;
		v3.y = y[2] - yp;
		sum = AngleOf2Vector(v1, v2) + AngleOf2Vector(v1, v3) + AngleOf2Vector(v3, v2);
		if(sum < 360){
			printf("NO\n");
		}else{
			printf("YES\n");
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
 
//#include<iostream>
using namespace std;
 
int main(){
    float  x1, y1, x2, y2, x3, y3, xp, yp;
	float  x12, y12, x23, y23, x31, y31, x1p, y1p, x2p, y2p, x3p, y3p;

	while( ~scanf("%f%f%f%f%f%f%f%f" , &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)){
		x12=x2-x1; y12=y2-y1;
		x23=x3-x2; y23=y3-y2;
		x31=x1-x3; y31=y1-y3;
		x1p=xp-x1; y1p=yp-y1;
		x2p=xp-x2; y2p=yp-y2;
		x3p=xp-x3; y3p=yp-y3;

		if((x12*y1p-y12*x1p>0 && x23*y2p-y23*x2p>0 && x31*y3p-y31*x3p>0) ||
			(x12*y1p-y12*x1p<0 && x23*y2p-y23*x2p<0 && x31*y3p-y31*x3p<0))
					 printf("YES\n");
		else		printf("NO\n");
	}

    return 0;
}