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 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)) break;
	    if(  abs(1 - sqrt(dotpro))  <= 0.000001  ){
//		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

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

using namespace std;

int main(void){
  double x[3], y[3], cx, cy;
  double p[3];
  
  while (scanf("%lf%lf", &x[0], &y[0])>0){
    scanf("%lf%lf%lf%lf%lf%lf", &x[1], &y[1], &x[2], &y[2], &cx, &cy);
    for (int i=0; i<3; i++){
      int j=(i+1)%3;
      p[i] = (x[i]-cx)*(y[j]-cy)-(x[j]-cx)*(y[i]-cy);
    }
    puts(p[0]*p[1]<0||p[1]*p[2]<0||p[2]*p[0]<0 ? "NO": "YES");
  }
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>


float area(float x1, float y1, float x2, float y2, float x3, float y3)
{
   return abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0);
}


bool isInside(int x1, int y1, int x2, int y2, int x3, int y3, int x, int y)
{
   /* Calculate area of triangle ABC */
   float A = area (x1, y1, x2, y2, x3, y3);

   /* Calculate area of triangle PBC */
   float A1 = area (x, y, x2, y2, x3, y3);

   /* Calculate area of triangle PAC */
   float A2 = area (x1, y1, x, y, x3, y3);

   /* Calculate area of triangle PAB */
   float A3 = area (x1, y1, x2, y2, x, y);

   /* Check if sum of A1, A2 and A3 is same as A */
   return (A == A1 + A2 + A3);
}

int main()
{

   float x1,x2,x3,x4,x5,x6,x7,x8;
   while(scanf("%f%f%f%f%f%f%f%f",&x1,&x2,&x3,&x4,&x5,&x6,&x7,&x8)==8)
   {
       if (isInside(x1,x2,x3,x4,x5,x6,x7,x8))
     printf ("YES\n");
   else
     printf ("NO\n");

   }


   return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct point{ double x, y; };

point sub(const point& a, const point& b){
  point ret;
  ret.x = a.x - b.x;
  ret.y = a.y - b.y;
  return ret;
}

int solve(point a, point b, point c, point p){
  point ab = sub(b, a), bp = sub(p, b);
  point bc = sub(c, b), cp = sub(p, c);
  point ca = sub(a, c), ap = sub(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;

  if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) return 1;
  return 0;
}

int main(){
  double x1, x2, x3, xp, y1, y2, y3, yp;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) && x1+y1+x2+y2+x3+y3+xp+yp){
    point a, b, c, P;
    a.x = x1; a.y = y1;
    b.x = x2; b.y = y2;
    c.x = x3; c.y = y3;
    P.x = xp; P.y = yp;

    if(solve(a, b, c, P)) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

using namespace std;

typedef complex<double> P;

#define  EPS (1e-10)
#define  EQ(a, b)  (abs((a) - (b)) < EPS)
#define  EQV(a, b)  (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))

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


int main()
{
    double x1, y1, x2, y2, x3, y3, xp, yp;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        P a(x1, y1), b(x2, y2), c(x3, y3), d(xp, yp);

        if ((cross(b - a, d - a) > -EPS) && 
            (cross(c - b, d - b) > -EPS) &&
            (cross(a - c, d - c) > -EPS))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}

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

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double dot(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double det(const P &a, const P &b) {
	return (conj(a) * b).imag();
}



int contains(const vector<P> &ps, P q) {
	int n = ps.size();
	int res = -1;
	
	rep (i, n) {
		P a = ps[i] - q, b = ps[(i + 1) % n] - q;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() < EPS && b.imag() > EPS && det(a, b) > EPS) res = -res;
		if(fabs(det(a, b)) < EPS && dot(a, b) < EPS) return 0;
	}
	return res;
}

int main(){
	for (double x1, y1, x2, y2, x3, y3, xp, yp; cin>> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp; ) {
		vector<P> ps;
		ps.pb(P(x1, y1));
		ps.pb(P(x2, y2));
		ps.pb(P(x3, y3));
		P q(xp, yp);
		cout << (contains(ps, q) == 1 ? "YES" : "NO" ) << endl;
	}
	
	return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;

#define EPS (1e-7)

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

double dot(P const& a, P const& b) {
  return real(conj(a)*b);
}

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

int ccw(P a, P b, P c) {
  b -= a, c -= a;
  if(cross(b, c) > 0) return +1; // counter clockwise
  if(cross(b, c) < 0) return -1;  // clockwise
  if(dot(b, c) < 0) return +2;    // c-a-b
  if(norm(b) < norm(c)) return -2;  // a-b-c
  return 0; // on segment
}

int main () {
  
  P ps[4];
  while(1) {
    rep(i, 4) {
      cin >> ps[i].real() >> ps[i].imag();
    }
    if(cin.eof()) break;
    int sum = 0;
    rep(i, 3) {
      sum += ccw(ps[i], ps[(i+1)%3], ps[3]);
    }
    if(sum == 3 || sum == -3) cout << "YES\n";
    else cout << "NO\n";
  }
  return 0;
}