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 <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];
		x[0] = x2 - x1;
		y[0] = y2 - y1; 
		x[1] = xp - x1;
		y[1] = yp - y1;
		double bx[2], by[2];
		x[0] = x3 - x2;
		y[0] = y3 - y2;
		x[1] = xp - x2;
		y[1] = yp - y2;
		double cx[2], cy[2];
		x[0] = x1 - x3;
		y[0] = y1 - y3;
		x[1] = xp - x3;
		y[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 <cmath>
using namespace std;
typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) {
  return (conj(a) * b).imag();
}

double x[4], y[4];
int main() {
  while (1) {
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (!cin) break;
    xy_t a(x[0], y[0]), b(x[1], y[1]), c(x[2], y[2]), p(x[3], y[3]);
    double pab = cross_product(a-p, b-p);
    double pbc = cross_product(b-p, c-p);
    double pca = cross_product(c-p, a-p);
    bool ok = (pab * pbc > 0 && pab * pca > 0);
    cout << (ok ? "YES" : "NO") << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	double x[4] = {-1}, y[4] = {-1},xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[1], &y[1], &x[2], &y[2], &x[3], &y[3], &xp, &yp), x[1] != EOF){
		
		sort(x, x + 3);
		sort(y, y + 3);
		
		max_x = x[3];
		max_y = y[3];
		min_x = x[1];
		min_y = y[1];
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;

double Area(double* x1, double* y1, double* x2, double* y2){
  return (*x1 * *y2 - *x2 * *y1)/2.0;
}

double Segitiga(double* a, double * b, double* c, double* d, double* e, double* f){
  return abs (Area(a,b,c,d) + Area(c,d,e,f) + Area(e,f,a,b));
}

int main(){
  double a, b, c, d, e, f, g, h, ta, tb;
  cin >> a >> b >> c >> d >> e >> f >> g >> h;
  ta = Segitiga(&a, &b, &c, &d, &e, &f);
  tb = Segitiga(&a, &b, &c, &d, &g, &h) + Segitiga(&a, &b, &e, &f, &g, &h) + Segitiga(&c, &d, &e, &f, &g, &h);

  if(tb-ta >= 1e-8)
    cout << "NO\n";
  else
    cout << "YES\n";
  
return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;

typedef struct POINT_tag // POINT_t …… 点
{
	double x; // x 座標
	double y; // y 座標
} POINT_t;

typedef struct LINE_tag // LINE_t …… 線分、直線
{
	POINT_t a; // 始点
	POINT_t b; // 終点
} LINE_t;

typedef struct TRIANGLE_tag // TRIANGLE_t …… 三角形
{
	POINT_t a;
	POINT_t b;
	POINT_t c;
} TRIANGLE_t;

int side( POINT_t *p, LINE_t *e )
{
	POINT_t p1 = *p;
	POINT_t p2 = e->a; // 有向線分 e の始点
	POINT_t p3 = e->b; // 有向線分 e の終点

	// 有向線分 (p2,p1), (p2,p3) の外積の z 成分を求める
	const double n  = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
	if      ( n > 0 ) return  1; // 左
	else if ( n < 0 ) return -1; // 右
	else              return  0; // 線上
}//side

int PointInTriangle( POINT_t *p, TRIANGLE_t *t )
{
	LINE_t 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;
	const int pab = side( p, &ab ); // 有向線分 ab から見た点 p の方向
	const int pbc = side( p, &bc ); // 有向線分 bc から見た点 p の方向
	const int pca = side( p, &ca ); // 有向線分 ca から見た点 p の方向

	// 三角形の内側にあれば正
	if ( (0 < pab) && (0 < pbc) && (0 < pca) )
		return 1; // 点 p が常に左側にある（時計回り）
	if ( (0 > pab) && (0 > pbc) && (0 > pca) )
		return 1; // 点 p が常に右側にある（反時計回り）

	// 三角形の線上にあれば負
	if ( (0 <= pab) && (0 <= pbc) && (0 <= pca) )
		return -1; // 点 p が常に左側にある（時計回り）
	if ( (0 >= pab) && (0 >= pbc) && (0 >= pca) )
		return -1; // 点 p が常に右側にある（反時計回り）

	// 三角形の外側にあれば 0
	return 0;
}//PointInTriangle

int main(){

	//double a,b,c,d,e,f,x,y;
	POINT_t p1,p2,p3,po;
	TRIANGLE_t tr;
		
	while(1){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> po.x >> po.y;
		tr.a = p1;
		tr.b = p2;
		tr.c = p3;
		if(PointInTriangle(&po,&tr)!=0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		if(cin.eof())break;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

typedef struct{
	double x;
	double y;
	double z;
} vec3D;

void setVec(vec3D &v,double x,double y,double z){
	v.x=x;v.y=y;v.z=z;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	vec3D v1,v2,v3,vp1,vp2,vp3;
	double z1,z2,z3;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		setVec(v1,x2-x1,y2-y1,0);
		setVec(v2,x3-x2,y3-y2,0);
		setVec(v3,x1-x3,y1-y3,0);
		setVec(vp1,xp-x1,yp-y1,0);
		setVec(vp2,xp-x2,yp-y2,0);
		setVec(vp3,xp-x3,yp-y3,0);

		z1=v1.x*vp1.y-v1.y*vp1.x;
		z2=v2.x*vp2.y-v2.y*vp2.x;
		z3=v3.x*vp3.y,v3.y*vp3.x;

		if((z1>0 && z2>0 && z3>0) || (z1<0 && z2<0 && z3<0)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
typedef double d;
bool isintersect(d x1,d x2, d y1 , d y2 , d px, d py , d qx, d qy)
{
  return ((py-y1)*(x1-x2) + (x1 - px)*(y1-y2))*((qy-y1)*(x1-x2) + (x1 - qx)*(y1-y2)) >= 0;
}
int main(){
  d x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin >>  x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp )
    {
      if( isintersect(x1,x2,y1,y2,xp,yp,x3,y3) &&
	  isintersect(x1,x3,y1,y3,xp,yp,x2,y2) &&
	  isintersect(x3,x2,y3,y2,xp,yp,x1,y1))cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  return 0;
}