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>
using namespace std;

double cross(double X[], double Y[]){
	return X[0]*Y[1]-X[1]*Y[0];
}
double x[4],y[4];

int main(){
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]){
		// for(int i=0;i<4;i++)
		// 	cin >> x[i] >> y[i];

		double vec_ap[2] = {(x[3]-x[0]),(y[3]-y[0])};
		double vec_bp[2] = {(x[3]-x[1]),(y[3]-y[1])};
		double vec_cp[2] = {(x[3]-x[2]),(y[3]-y[2])};
		double vec_ab[2] = {(x[1]-x[0]),(y[1]-y[0])};
		double vec_bc[2] = {(x[2]-x[1]),(y[2]-y[1])};
		double vec_ca[2] = {(x[0]-x[2]),(y[0]-y[2])};

		if((cross(vec_ap,vec_ab)>0&&cross(vec_bp,vec_bc)>0&&cross(vec_cp,vec_ca)>0) || (cross(vec_ap,vec_ab)<0&&cross(vec_bp,vec_bc)<0&&cross(vec_cp,vec_ca)<0)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

struct Point2D {
  double x,y;

  Point2D operator-(Point2D &p);
  friend istream &operator>>(istream &is, Point2D &t);
  friend double cross(Point2D &a, Point2D &b);
};

Point2D Point2D::operator-(Point2D &p) {
  Point2D t;
  t.x = x - p.x;
  t.y = y - p.y;
  return t;
}

istream &operator>>(istream &is, Point2D &t) {
  is >> t.x >> t.y;
  return is;
}

double cross(Point2D &a, Point2D &b) {
  return a.x * b.y - a.y * b.x;
}

int judge(double t) {
  if(t>0.0) return 1;
  else if(t<0.0) return -1;
  else return 0;
}

int main() {
  vector<Point2D> t(3);
  Point2D p;
  
  while(cin >> t[0] >> t[1] >> t[2] >> p) {
    int key = 0;
        
    for(int i = 0; i < 3; i++) {
      Point2D m = t[i] - t[( i + 1 ) % 3];
      Point2D n = t[i] - p;
      key += judge(cross(m, n));
      cout << key << endl;
    }
    cout << ((abs(key) == 3) ? "YES" : "NO") << endl;
  }
  
  return 0;
}

C++: #include <stdio.h>

typedef struct _Point {
	double x;
	double y;
} Point;

static Point
sub_vector(const Point* a, const Point* b)
{
    Point ret;
    ret.x = a->x - b->x;
    ret.y = a->y - b->y;

    return ret;
}

int
main(void)
{
	char line[80];

	Point a;
	Point b;
	Point c;
	Point p;
	
	while (fgets(line, sizeof line, stdin)) {
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &(a.x), &(a.y), &(b.x), &(b.y), &(c.x), &(c.y),
				   &(p.x), &(p.y)) == 8) {

			Point ab = sub_vector(&b, &a);
			Point bp = sub_vector(&p, &b);
			
			Point bc = sub_vector(&c, &b);
			Point cp = sub_vector(&p, &c);
			
			Point ca = sub_vector(&a, &c);
			Point ap = sub_vector(&p, &a);
			
		    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;
    
        	bool rt = (c1 > 0 && c2 > 0 && c3 > 0) ||
        			  (c1 < 0 && c2 < 0 && c3 < 0);

			printf("%s\n", (rt ? "YES" : "NO"));
		}
	}

	return 0;
}

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

typedef complex<double> Point;

Point ps[4];

int main() {
  while (1) {
    for (int i=0; i<4; i++) {
      double x, y;
      if (scanf("%lf%lf", &x, &y) != 2) return 0;
      ps[i] = Point(x, y);
    }

    bool found = false;
    for (int i=0; i<3; i++) {
      Point a0 = ps[(i+1)%3]-ps[i];
      Point b0 = ps[(i+2)%3]-ps[i];
      Point c0 = ps[3]-ps[i];
      if (abs(arg(c0/a0)) > abs(arg(b0/a0))) {
        puts("NO");
        found = true;
        break;
      }
    }

    if (!found) puts("YES");
  }
}

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

using namespace std;

struct Point{
	double x,y;
	Point(double x=0.0,double y=0.0):x(x),y(y){}
};

typedef Point Vector;

double cross(Vector a,Vector b){
	return a.x*b.y-a.y*b.x;
}

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)){
		Vector v1(x2-x1,y2-y1),v2(x3-x2,y3-y2),v3(x1-x3,y1-y3);
		Vector u1(xp-x1,yp-y1),u2(xp-x2,yp-y2),u3(xp-x3,yp-y3);
		if (cross(v1,u1)*cross(v2,u2)>0 && cross(v2,u2)*cross(v3,u3)>0){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

const double EPS=1e-10;
int sig(double r){return (r<-EPS)?-1:(r>EPS)?1:0;}

struct Pt{
	double x,y;
	Pt(){}
	Pt(double x,double y) : x(x),y(y) {}
	Pt operator+(const Pt &a) const {return Pt(x+a.x,y+a.y);}
	Pt operator-(const Pt &a) const {return Pt(x-a.x,y-a.y);}
	Pt operator*(const Pt &a) const {return Pt(x*a.x-y*a.y,x*a.y+y*a.x);}
	Pt operator-() const {return Pt(-x,-y);}
	Pt operator*(const double &k) const {return Pt(x*k,y*k);}
	Pt operator/(const double &k) const {return Pt(x/k,y/k);}
	double abs() const {return sqrt(x*x+y*y);}
	double abs2()const{return x*x+y*y;}
	double arg()const{return atan2(y,x);}
	double dot(const Pt&a)const{return x*a.x+y*a.y;}
	double det(const Pt&a)const{return x*a.y-y*a.x;}
	bool operator<(const Pt &a)const{return (x!=a.x)?(x<a.x):(y<a.y);}
	bool operator==(const Pt&a)const{return (sig(x-a.x)==0&&sig(y-a.y)==0);}
};
ostream &operator<<(ostream &os,const Pt &a){os<<"("<<a.x<<","<<a.y<<")";return os;}
double tri(Pt a, Pt b, Pt c){return (b-a).det(c-a);}
bool iLS(Pt a,Pt b,Pt c,Pt d){
	return (sig(tri(a,b,c))*sig(tri(a,b,d))<=0);
}
int main() {
	Pt a,b,c,x;
	for(;scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y,&x.x,&x.y);){
		if(iLS(a,b,c,x)||iLS(a,c,b,x)||iLS(b,c,a,x)){
			puts("NO");
		}else{
			puts("YES");
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro = (  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2)));
        if( (x2 * x2 + y2 * y2) >= (x1*x1 + y1 * y1)) continue;
	    if(  abs(1 - sqrt(dotpro))  <= 1e-6  ){
//		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}