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>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
const double EPS = 1.0e-9;
const double PI = acos(-1);
namespace std {
    bool operator < (const Point& a, const Point& b){
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b){
        push_back(a);
        push_back(b);
    }
};
double cross(const Point& a, const Point& b){
    return imag(conj(a) * b);
}
double dot(const Point& a, const Point& b) {
    return real(conj(a) * b);
}
bool input(vector<Point>& vP){
    rep(i, 3) cin >> vP[i].real() >> vP[i].imag();
    if(cin.eof())
      return false;
    else
      return true;
}
int main(){
    vector<Point> t(3);
    Point p;
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(input(t)){
        cin >> p.real() >> p.imag();
        bool is_IN = false;
        rep(i, 3){
            Point a = t[i] - p, b = t[(i + 1) % 3] - p;
            if(imag(a) > imag(b)) swap(a, b);
            if(imag(a) <= 0 && 0 < imag(b))
              if(cross(a, b) < 0) is_IN = !is_IN;
            if(cross(a, b) == 0 && dot(a, b) <= 0){
                is_IN = true;
                break;
            }
        }
        if(is_IN)
          cout << "YES" << endl;
        else
          cout << "NO" << endl;
    }
    return 0;
}

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

using namespace std;

#define EPS 1e-5

double heron(double a,double b,double c){
      double s = (a + b + c) / 2;

      return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main() {
    double x[3],y[3],xp,yp,a,b,c,d,e,f,sq,sqd,sqe,sqf;
    
    while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
        a = sqrt(pow((x[1] - x[0]),2) + pow((y[1] - y[0]),2));
        c = sqrt(pow((x[2] - x[0]),2) + pow((y[2] - y[0]),2));
        b = sqrt(pow((x[2] - x[1]),2) + pow((y[2] - y[1]),2));

        sq = heron (a,b,c);

        d = sqrt(pow((xp - x[0]),2) + pow((yp - y[0]),2));
        e = sqrt(pow((xp - x[1]),2) + pow((yp - y[1]),2));
        f = sqrt(pow((xp - x[2]),2) + pow((yp - y[2]),2));

        sqd = heron(d,e,a);
        sqe = heron(e,b,f);
        sqf = heron(f,c,d);
        /*
        if(sqd == 0 || sqe == 0 || sqf == 0){
             cout << "NO" << endl;
             return 0;
         }
        */
         if(abs(sq - (sqd + sqe + sqf)) < EPS){
            cout << "YES" << endl;
            
        }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

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

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

int main()
{
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		vector<bool> vec(3, true);
		point points[] = { { x2 - x1, y2 - y1 }, { x3 - x2, y3 - y2 }, { x1 - x3, y1 - y3 } };
		point p_p[] = { { xp - x2, yp - y2 }, { xp - x3, yp - y3 }, { xp - x1, yp - y1 } };
		for (int i = 0; i < 3; i++){
			if (points[i].x * p_p[i].y - points[i].y * p_p[i].x > 0) vec[i] = false;
		}
		//cout << boolalpha << vec[0] << vec[1] << vec[2] << noboolalpha << endl;
		if (vec[0] * vec[1] * vec[2] || !(vec[0] + vec[1] + vec[2])) cout << "YES";
		else cout << "NO";
		cout << 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;
//}
#define cross(x1,y1,x2,y2) (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));
	
	for(double x,y,a,b,n,m,p,q;scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x,&y,&a,&b,&n,&m,&p,&q)==8;){
		int counter=0;
		//counter+=(p-x)*(b-y)-(q-y)*(a-x)>0;
		//counter+=(p-a)*(m-b)-(q-b)*(n-a)>0;
		//counter+=(p-n)*(y-m)-(q-m)*(x-n)>0;
		counter+=cross(a-x,b-y,p-x,q-y)>=0;
		counter+=cross(n-a,m-b,p-a,q-b)>=0;
		counter+=cross(x-n,y-m,p-n,q-m)>=0;
		
		cout<<(counter%3==0?"YES":"NO")<<endl;
	}
	
	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;
	double m = 0;
	bool flg = false;
	    double x1[] =  {x[2] - x[0],  x[1] - x[0]};
	    double y1[] = { y[2] - y[0] , y[1] - y[0]};
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    REP(i,1e3){
		REP(j,1e3){
		s = (double)i / 1e3;
		t = (double)j / 1e3;
		if(s + t > 1) break;
		if(s * x1[0] + t * x1[1] - x2 < 1e-6 && s * y1[0] + t * y1[1] - y2 < 1e-6){
		    flg = true;
		    break;
		}
	    }
		if(flg) break;
	    }
	    if(flg) cout << "YES" << endl;
	    else cout << "NO" << endl;

    }

    return 0;
}

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

using namespace std;
typedef long long ll;

#define PI 3.141592653

bool cross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
    double a,b,c,d;
    
    a=(x3-x4)*(y1-y3)+(y3-y4)*(x3-x1);
    b=(x3-x4)*(y2-y3)+(y3-y4)*(x3-x2);
    c=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3);
    d=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4);
    
    if((a<0)^(b<0) && (c<0)^(d<0))
        return true;
    else
        return false;
}

int main(){
    double x[3],y[3],x_p,y_p;
    
    while(EOF!=scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x_p,&y_p)){

        bool f = true;
        
        for(int i=0;i<3;i++){
    
            if(cross(x[i], y[i], x[(i+1)%3], y[(i+1)%3],x[(i+2)%3], y[(i+2)%3], x_p, y_p)){
                f=false;
            }
            
        }
        
        if(f){
            puts("YES");
        }else{
            puts("NO");
        }
    }
    
    return 0;
}