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 <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

double x[4], y[4];

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

int main() {
  while (true) {
    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 && pbc*pca>0;
    cout << (ok ? "YES" : "NO") << endl;
  }
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> p;

int main()
{
	p a,b,c,d;
	while(cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag())
	{
		a=a-d; 
		b=b-d; 
		c=c-d;

		double ab=a.real()*b.imag()-a.imag()*b.real();
		double bc=b.real()*c.imag()-b.imag()*c.real();
		double ca=c.real()*a.imag()-c.imag()*a.real();

		if(ab<0&&bc<0&&ca<0) cout<<"YES"<<endl;
		else if(ab>0&&bc>0&&ca>0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-9;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}


int main() {
  VP vp;

  while(1) {
    REP(i,4) {
      double x,y;
      if(scanf("%lf %lf", &x, &y) == EOF) {
	vp.clear();
	return 0;
      }
      vp.push_back(P(x,y));
    }
    double d1 = cross(vp[1]-vp[0],vp[3]-vp[0]);
    double d2 = cross(vp[2]-vp[1],vp[3]-vp[1]);
    double d3 = cross(vp[0]-vp[2],vp[3]-vp[2]);
    if((d1 > 0 && d2 > 0 && d3 > 0) || (d1 < 0 && d2 < 0 && d3 < 0)) printf("YES\n");
    else printf("NO\n");
    vp.clear();
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

double x[3], y[3], xp, yp;

double cross(int a, int b){
    return x[a] * y[b] - y[a] * x[b];
}

signed main(){
    while(1){
        if(cin.eof()) break;        
        rep(i, 0, 3) cin >> x[i] >> y[i];
        cin >> xp >> yp;
        rep(i, 0, 3){
            x[i] -= xp;
            y[i] -= yp;
        }
        bool f = true;
        rep(i, 0, 3){
            if(cross(i, (i + 1) % 3) * 10000 < 0) f = false; 
        }
        cout << (f ? "YES" : "NO") << endl;
    }
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double cross(double x1,double y1,double x2,double y2)
{
	return x1*y2-x2*y1;
}

int ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	float x,y,a,b,n,m,p,q;
	int i;
	for(;~scanf("%f%f%f%f%f%f%f%f",&x,&y,&a,&b,&n,&m,&p,&q);puts(i>2^!i?"YES":"NO"))
		i=((p-x)*(b-y)>(q-y)*(a-x))+((p-a)*(m-b)>(q-b)*(n-a))+((p-n)*(y-m)>(q-m)*(x-n));
	
	//puts("long");
	//for(double x,y,a,b,n,m,p,q;scanf("%lf%lf%lf%lf%lf%lf%lf%lf",x,y,x+1,y+1,x+2,y+2,&xp,&yp)==8;){
	//	int counter=0;
	//	rep(i,3)
	//		counter+=ccw(x[i],y[i],x[(i+1)%3],y[(i+1)%3],xp,yp);
	//	
	//	cout<<(counter%3==0?"YES":"NO")<<endl;
	//}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
struct Point { long double px, py; };
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double norm(Point a) { return a.x*a.x + a.y*a.y; }
Point Minus(Point p1, Point p2) {
	Point A1; 
	A1.px = p1.px - p2.px;
	A1.py = p1.py - p2.py;
	return A1;
}
int ccw(Point p0, Point p1, Point p2) {
	Point a = Minus(p1, p0), b = Minus(p2, p0);
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
bool its(Point p1, Point p2, Point p3, Point p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
Point P1, P2, P3, P4;
int main() {
	while (cin >> P1.px >> P1.py >> P2.px >> P2.py >> P3.px >> P3.py >> P4.px >> P4.py) {
		int OK = 0;
		if (its(P1, P2, P3, P4) == true) { OK = 1; }
		if (its(P1, P3, P2, P4) == true) { OK = 1; }
		if (its(P1, P4, P2, P3) == true) { OK = 1; }
		if (OK == 1) { cout << "NO" << endl; }
		else { cout << "YES" << endl; }
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	long double x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3,S;
	int A,B,C,D;
	while(true){
		if (cin.eof())break; 
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		S=(x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
		s1=(x1-xp)*(y2-yp)-(x2-xp)*(y1-yp);
		s2=(x2-xp)*(y3-yp)-(x3-xp)*(y2-yp);
		s3=(x3-xp)*(y1-yp)-(x1-xp)*(y3-yp);
		S=fabs(S);
		s1=fabs(s1);
		s2=fabs(s2);
		s3=fabs(s3);
		A=S*1000000;
		B=s1*1000000;
		C=s2*1000000;
		D=s3*1000000;
		if(A==B+C+D){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}	
}