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<iostream>
#include<cmath>

using namespace std;

#define EPS 1e-5

struct point{
	double x;
	double y;
};
struct line{
	double a;
	double b;
};

int recog_point_position( const point& a , const point&b , const point& c );
bool get_line( const point& a , const point& b , line *a_b );
inline istream& operator >> ( istream& s , point& p );

int main(void)
{
	point a, b, c, p;

	while(1)
	{
		cin >> a >> b >> c >> p;
		if( cin.eof() ) break;

		int result_ab_c = recog_point_position( a , b , c );
		int result_ab_p = recog_point_position( a , b , p );
		int result_bc_a = recog_point_position( b , c , a );
		int result_bc_p = recog_point_position( b , c , p );
		int result_ca_b = recog_point_position( c , a , b );
		int result_ca_p = recog_point_position( c , a , p );

		cout << (( result_ab_c == result_ab_p && result_bc_a == result_bc_p && result_ca_b == result_ca_p ) ? "YES" : "NO") << endl;
	}

	return 0;
}

int recog_point_position( const point& a , const point& b , const point& c )
{
	line a_b;

	bool result = get_line( a , b , &a_b );
	if( result == false )
	{
		if( (a.x + b.x)/2 < c.x ) return 1; // 点が直線より右にある場合に1をリターン
		else return 0;
	}
	else if( result == true )
	{
		if( c.y > a_b.a * c.x + a_b.b ) return 1; // 点が直線より上にある場合に1をリターン
		else return 0;
	}

}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS )
	{
		return false;
	}
	else
	{
		a_b->a = (a.y - b.y) / (a.x - b.x);
		a_b->b = a.y - a_b->a * a.x;

		return true;
	}
}

inline istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

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

using namespace std;

const double eps = 1e-12;

double cross(complex<double> a, complex<double> b) {
    return a.real() * b.imag() - a.imag() * b.real();
}

int main() {
    complex<double> t1, t2, t3, p;
    while(cin >> t1.real() >> t1.imag() >> t2.real() >> t2.imag() >> t3.real() >> t3.imag() >> p.real() >> p.imag()) {
        int plus = 0;
        if (cross(t1 - p, t2 - t1) > 0)plus++;
        if (cross(t2 - p, t3 - t2) > 0)plus++;
        if (cross(t3 - p, t1 - t3) > 0)plus++;
        if (plus == 3 || plus == 0)cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

typedef struct{
	double x;
	double y;
} vec2D;

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

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	vec2D 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);
		setVec(v2,x3-x2,y3-y2);
		setVec(v3,x1-x3,y1-y3);
		setVec(vp1,xp-x1,yp-y1);
		setVec(vp2,xp-x2,yp-y2);
		setVec(vp3,xp-x3,yp-y3);

		z1=v1.x*vp2.y-v1.y*vp2.x;
		z2=v2.x*vp3.y-v2.y*vp3.x;
		z3=v3.x*vp1.y-v3.y*vp1.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 <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;


struct point{
	double x, y;
};

bool Func(point p1,point p2,point p3)
{
	double x1 = p2.x - p1.x;
	double y1 = p2.y - p1.y;
	double x2 = p3.x - p2.x;
	double y2 = p3.y - p2.y;

	return (x1*y2 - x2*y1) >0;
}

int main()
{
	point p1, p2, p3, p4;
	while (cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y){

		string ans = (Func(p1, p2, p4) > 0 && Func(p2, p3, p4) > 0 && Func(p3, p1, p4) > 0)||
			(Func(p1, p2, p4) < 0 && Func(p2, p3, p4) < 0 && Func(p3, p1, p4) < 0)
			
			? "YES" : "NO";

		cout << ans << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

double dot(P a,P b){return real(conj(a)*b)};
double cross(P a,P b){return imag(conj(a)*b)};

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)){
    P a(x1,y1), b(x2,y2), c(x3,y3), p(xp,yp);
    double cra = cross(b-a,p-a);
    double crb = cross(c-b,p-b);
    double crc = cross(a-c,p-c);
    if(cra<0){
      cra*=-1;
      crb*=-1;
      crc*=-1;
    }
    if(cra>0 && crb>0 && crc>0){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double ax, ay, bx, by;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        double m,n;
        ax = x2 - x1;
        ay = y2 - y1;
        bx = x3 - x1;
        by = y3 - y1;
        xp = xp - x1;
        yp = yp - y1;
        double point = ax*by - ay*bx;
        m = (by*xp - bx*yp)/point;
        n = (-ay*xp + ax*yp)/point;
        if(point == 0){
            cout << "NO"<<endl;
        }
        else if(m > 0 && m <= 1 && n > 0 && n <= 1 && m+n <= 1 ){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

double pdot(pair<double,double> a,pair<double,double> b){
	return a.first*b.first + a.second*b.second;
}

int main(){
	double a1,a2,b1,b2,c1,c2,p1,p2;
	cin>>a1>>a2>>b1>>b2>>c1>>c2>>p1>>p2;
	pair<double,double> v0 = make_pair(c1-a1,c2-a2);
	pair<double,double> v1 = make_pair(b1-a1,b2-a2);
       	pair<double,double> v2 = make_pair(p1-a1,p2-a2);
	double dot00 = pdot(v0,v0), dot01 = pdot(v0,v1), dot02 = pdot(v0,v2), dot11 = pdot(v1,v1);
	double dot12 = pdot(v1,v2);
	double id = 1.0 / (dot00 * dot11 - dot01 * dot01);
	double u = (dot11 * dot02 - dot01 * dot12) * id;
	double v = (dot00 * dot12 - dot01 * dot02) * id;
	if(u>=0 && v>=0 && u+v<1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

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


using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
	{
		deque<double> nums;
		nums.push_back(x1);
		nums.push_back(x2);
		nums.push_back(x3);
		sort( nums.begin(), nums.end());
		
		deque<double>::iterator it = nums.begin();
		double a,b,c,d;

		a = *it;
		it += 2;
		b = *it;

		nums.clear();

		nums.push_back(y1);
		nums.push_back(y2);
		nums.push_back(y3);
		sort( nums.begin(), nums.end());
		
		it = nums.begin();
		c = *it;
		it += 2;
		d = *it;

		int ture=0;
		
		if(xp<a) ;
		else if(b<xp);
		else ture++;

		if(yp<c) ;
		else if(d<yp);
		else ture++;

		if(ture==2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

	}

	return 0;
}