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 <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>
#include <math.h>
#include<cstdio>
using namespace std;

//???????????????
struct Vertex2D{
	double x;
	double y;
};
//?????????????????????(????????¨??????)
#define Vector2D Vertex2D

//???????????¢
double distance_vertex(Vertex2D p1, Vertex2D p2) {
	return pow( ( p2.x - p1.x ) * ( p2.x - p1.x ) + ( p2.y - p1.y ) * ( p2.y - p1.y ), 0.5 );
}

//??????????????????
double cross_vector(Vector2D vl, Vector2D vr) {
	return vl.x * vr.y - vl.y * vr.x;
}

//???P??¨???(AB)????????¢
double Distance_DotAndLine(Vertex2D P, Vertex2D A, Vertex2D B )
{
	Vector2D AB,AP;

	AB.x = B.x - A.x;
	AB.y = B.y - A.y;
	AP.x = P.x - A.x;
	AP.y = P.y - A.y;

	//????????????AB???AP??????????????¶???????????????????????¢D?????¢????????????
	double D =  cross_vector( AB, AP );

	double L = distance_vertex( A, B );	//AB???????????¢

	double H = D / L;
	return H;

}


int main(){

	struct  Vertex2D point[4];
	while(	scanf("%lf %lf %lf %lf %lf %lf %lf %lf ",&point[0].x , &point[0].y,
													 &point[1].x , &point[1].y,
													 &point[2].x , &point[2].y,
													 &point[3].x , &point[3].y) != EOF){

	for(int i=0;i<=3;i++){
		double tmp =  Distance_DotAndLine(point[i%3],point[(i+1)%3],point[3]);
		if(tmp < 0){
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	double x[3],y[3],px,py;
	while(cin>>x[0]>>y[0]){
		for(int i=1;i<3;i++)cin>>x[i]>>y[i];
		cin>>px>>py;
		bool ok=true;
		for(int i=0;i<3;i++){
			bool plus=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(x[i]>x[(i+1)%3])plus=true;
				if(x[i]==x[(i+1)%3])ok=false;
			}
			else{
				double a,b;
				a=(x[i]+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(y[i]+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)plus=true;
				if(a==b)ok=false;
			}
			bool pnt=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(px>x[(i+1)%3])pnt=true;
				if(px==x[(i+1)%3])ok=false;
			}
			else{
				double a,b;
				a=(px+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(py+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)pnt=true;
				if(a==b)ok=false;
			}
			if(pnt!=plus)ok=false;
		}
		if(ok)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

double spase(double a,double b,double c,double d,double e,double f){
	double x,y,z;
	x=sqrt( (a-c)*(a-c)+(b-d)*(b-d) );
	y=sqrt( (c-e)*(c-e)+(d-f)*(d-f) );
	z=sqrt( (e-a)*(e-a)+(f-b)*(f-b) );
	return sqrt((x+y+z)*(y-x+z)*(x-y+z)*(x+y-z));
}

int main(){
	double a,b,c,d,e,f,p,q;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
	if( (float)spase(a,b,c,d,e,f)==(float)(spase(a,b,c,d,p,q)+spase(a,b,e,f,p,q)+spase(p,q,c,d,e,f)) ){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
double cross(double x1, double y1, double x2, double y2){
	return (x1 * y2) - (y1 * x2);
}
int main(){
	double x[3], y[3], x, y;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py){
		double ret[3];
		for(int i = 0; i < 3; ++i ){
			int n =( i+1 ) % 3;
			ret[i] = cross( px - x[i], py - y[i], x[n] - x[i], y[n] - y[i] );
		}
		if(ret[0] < 0 && ret[1] < 0 && ret[2] < 0 
		|| ret[0] > 0 && ret[1] > 0 && ret[2] > 0) 
			cout << "YES" << endl;
		else
		    cout << "NO" << endl;		
	}
}

C++: 	#include <cstdio>
	#include <iostream>
	#include <math.h>

	using namespace std;
	#define rep(i,n) for(int i = 0; i < (n); ++i)

	bool judge(double x[3], double y[3]) {
		double rad1 = atan2(y[0], x[0]);
		double rad2 = atan2(y[1], x[1]);
		double rad3 = atan2(y[2], x[2]);
		if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
		else return false;
	}

	int main() {
		cout << atan2(0,-1);
		double x1, y1, x2, y2, x3, y3, xp, yp;
		while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
			double x[3], y[3];
			x[0] = x2 - x1;
			y[0] = y2 - y1; 
			x[1] = x3 - x1;
			y[1] = y3 - y1;
			x[2] = xp - x1;
			y[2] = yp - y1;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x2;
			y[0] = y1 - y2;
			x[1] = x3 - x2;
			y[1] = y3 - y2;
			x[2] = xp - x2;
			y[2] = yp - y2;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;
		}
		return 0;
	}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	double x1;
	while(cin>>x1){
		double x[3],y[3],px,py;
		x[0]=x1;
		cin>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>px>>py;
		double c[3];
		for(int i=0;i<3;i++){
			double vx1 = x[(i+1)%3]-x[i],vy1 = y[(i+1)%3]-y[i];
			double vx2 = px-x[i],vy2 = py-y[i];
			c[i] = vx1*vy2-vy1*vx2;
		}
		if((c[0]>0&&c[1]>0&&c[2]>0)||(c[0]<0&&c[1]<0&&c[2]<0)) out("YES");
		else out("NO");
	}

	return 0;
}