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 <bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

double triangleArea(double x, double y, double z){
    return (y * z * sin( acos( (y * y +  z * z - x * x) / (2 * y * z) ) )) / 2;
}

double inputXY(double x1, double y1, double x2, double y2, double x3, double y3){
    double x, y ,z;
    x = dist(x1, y1, x2, y2);
    y = dist(x2, y2, x3, y3);
    z = dist(x3, y3, x1, y1);
    return triangleArea(x, y, z);
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double allArea, area12, area23, area31;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        allArea = inputXY(x1, y1, x2, y2, x3, y3);
        area12 = inputXY(xp, yp, x2, y2, x1, y1);
        area23 = inputXY(x2, y2, x3, y3, xp, yp);
        area31 = inputXY(x3, y3, x1, y1, xp, yp);

        if(abs(allArea - (area12 + area23 + area31)) < 0.000000000000001) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
double a,b,c,d,e,f;
double x1,y1,x2,y2,x3,y3,xp,yp;
while(cin>>x1){
cin>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
x1-=x3;y1-=y3;x2-=x3;y2-=y3;xp-=x3;yp-=y3;
if((a=x1*y2-x2*y1)>0)b=1;else b=-1;
if((c=b*(x1*yp-xp*y1))<0){cout<<"NO"<<endl;continue;}
if((d=b*(xp*y2-x2*yp))<0){cout<<"NO"<<endl;continue;}
if(c+d>a*b)cout<<"NO"<<endl;else cout<<"YES"<<endl;
}
return 0;
}

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

using namespace std;
#define EPS (1e-10)
#define ABS(x) ((x)<0?-(x):(x))
struct L{
    L(double xa, double ya, double xb, double yb){
	x1 = xa;
	y1 = ya;
	x2 = xb;
	y2 = yb;
	if(xa-xb == 0){
	    a = 1;
	    b = 0;
	    c = -xa;
	}
	else {
	    a = (ya-yb);
	    b = (xb-xa);
	    c = -(a*xa + b*ya);
	}
    };
    double f(double x, double y){
	return a*x + b*y + c;
    }
    double a, b, c, x1, x2, y1, y2;//0 = ax + by + c [x1, x2]
};

bool cross(L a, L b){
    return (a.f(b.x1, b.y1) * a.f(b.x2, b.y2) < 0 && 
	    b.f(a.x1, a.y1) * b.f(a.x2, a.y2) < 0);
}

double x1, y1, x2, y2, x3, y3, xp, yp;

int main(){
    while(cin){
	cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp;
	L a = L(x1, y1, x2, y2);
	L b = L(x1, y1, x3, y3);
	L c = L(x2, y2, x3, y3);
	L p = L(xp, yp, 1000, 2003.141592);
	int res = 0;
	if(cross(a,p))res++;
	if(cross(b,p))res++;
	if(cross(c,p))res++;
	if(res == 1)cout << "YES" <<  endl;
	else cout << "NO"<<endl;
    }
    return 0;
}

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

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp;
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector bc = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ab.x * bp.y - ab.y * bp.x;
		double c2 = bc.x * cp.y - bc.y * cp.x;
		double c3 = ca.x * ap.y - ca.y * ap.x;
		if((c1>0 && c2>0 && c3 >0) || (c1<0 && c2<0 && c3<0)){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

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

int main(){
  double x[3],y[3],xp,yp,xmax,ymax,xmin,ymin,ymid;

  xmax = 0; ymax = 0; xmin = 999999; ymin = 999999;
  while( cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp ){
    for(int i = 0 ; i < 3 ; i++ ){
      if( xmax < x[i] ) xmax = x[i];
      if( xmin > x[i] ) xmin = x[i];
      if( ymax < y[i] ) ymax = y[i];
      if( ymin > y[i] ) ymin = y[i];
    }

    ymid = (ymax + ymin)/2;

    if( (( xmin <= xp && xp <= xmax ) && (ymin <= yp && yp <= ymax )) && ( ymid >= yp ))
      cout <<"YES" << endl;
    else cout <<"NO" << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<vector>

struct Point
{
    double x;
 
    double y;
};
 
double Abs(double x)
{
    return x>=0 ? x : -x;
}
 
double Triangle(const Point& P, const Point& Q, const Point& R)
{
    Point A = {Q.x-P.x, Q.y-P.y};
 
    Point B = {R.x-P.x, R.y-P.y};
 
    return Abs(A.x*B.y-A.y*B.x);
}

void SwapPoint(Point& a, Point& b)
{
	Point temp={0,0};

	temp =a;

	a=b;

	b=temp;
}

int main()
{
	Point a, b, c, x;

	bool flg=1;//点Xが三角形の中にある=1

	while(std::cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> x.x >>x.y)
	{
		for(int i=0; i<3; ++i)
		{
			if(Triangle(a,b,c)<Triangle(a,b,x)+Triangle(b,c,x))
			{
				flg=0;
			}

			SwapPoint(c,a);
			
			SwapPoint(b,c);
		}

		std::cout << (flg ? "YES\n" : "No\n");	
	}
}

C++: //二次元幾何ライブラリ
#include <iostream>
#include <complex>
#include <map>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define x(a) (a).real()
#define y(a) (a).imag()
typedef long double D;
typedef bool B;
typedef complex<D> P;   //点
typedef complex<D> V;   //ベクトル
typedef pair<P,P>  L;   //直線
typedef pair<P,D>  C;   //円
typedef vector<P>  Pol; //多角形

//変数名定義
const D INF = 1e100;
const D EPS = 1e-8;
const D PI = acos(-1);

template<class T> bool operator==(T a, T b){return abs(a - b )< EPS;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}

  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }

// ベクトルaの絶対値を求める
// D Length = abs(a);

// 2点a,b間の距離を求める
// D Distance = abs(a-b); 

// 内積 (Inner Product) : a・b = |a||b|cosθ
D IP(V a, V b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// 外積 (Exterior Product) : a×b = |a||b|sinθ
D EP(V a, V b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

// 2直線の直交判定 : a⊥b <=> IP(a, b) = 0
B IsVecular(P a1, P a2, P b1, P b2) {
	return IP(a1-a2, b1-b2)==0.0;
}

// 2直線の平行判定 : a//b <=> EP(a, b) = 0
B IsParallel(P a1, P a2, P b1, P b2) {
	return EP(a1-a2, b1-b2)== 0.0;
}


// 点と直線の距離 (Distance of Point and Line)  //l1の構造 x座標 first<second y座標 first>second 右上 正 左下 負 一致の
D  DPL(P p,L l){
	V v1=(p-l.first);
	V v2=(l.second-l.first);
	return EP(v1,v2)/abs(v1);
}

// 三角形の領域判定 Teritory of Triangle 内部のみ
B TT(P p1,P p2,P p3,P p){
	L l1,l2,l3;
	l1=make_pair(p2,p3);
	l2=make_pair(p3,p1);
	l3=make_pair(p1,p2);

	if(sig(DPL(p1,l1))!=sig(DPL(p,l1)))
		return false;
	else if(sig(DPL(p2,l2))!=sig(DPL(p,l2)))
		return false;
	else if(sig(DPL(p3,l3))!=sig(DPL(p,l3)))
		return false;
	else
		return true;
}


//変数名 = 型 代入したいもの
//example : v1 = V(5.0,-3.0) p1=P(0.0,4.0)
int main(void){
	while(true){
		if(cin.eof())
			break;
		P point[4];	
		rep(j,4)
		cin >> point[j].real() >> point[j].imag();
		if (TT(point[0],point[1],point[2],point[3]))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}