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 <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);++i)
 
static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double eps = 1e-8;
 
double x[3],y[3];
double xp,yp;
 
double dist(P a,P b){
    return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}
 
double tri_pro(P a,P b){

    double s = real(a)*imag(b)-real(b)*imag(a);
    return s>0?s:0;
}
 
 
int main(){
    //P a(0.0,0.0),b(4.0,0.0),c(4.0,2.0);
    //cout<<tri_pro(a,b,c)<<endl;
    
    
    
    while(cin>>x[0]>>y[0]){
        rep(i,2) cin>>x[i+1]>>y[i+1];
        cin>>xp>>yp;
        P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
        P p(xp,yp);
        b-=a; c-=a; p-=a;
        bool f=true;
        if((tri_pro(b,p)>0&&tri_pro(c,p)>0)||(tri_pro(p,b)&&tri_pro(p,c))) f=false;
        if(f) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

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

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

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		x = (x1 - x3) * (yp - y1) - (y1 - y3) * (xp - x1);
		y = (x2 - x1) * (yp - y2) - (y2 - y1) * (xp - x2);
		z = (x3 - x2) * (yp - y3) - (y3 - y2) * (xp - x3);
		if ((x > 0 && y > 0 && z > 0) || (x < 0 && y < 0 && z < 0)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <complex>
using namespace std;
  
double cross(complex<double> A, complex<double> B){
	return (conj(A)*B).imag();
}
 
int main(){
    complex<double> V[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            cin >> x >> y;
            V[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
         
        if(!cin)break;
         
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(V[(i+1)%3]-V[i], (P-V[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}

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

using namespace std;

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

double area(Point l, Point m, Point n);

int main() {
    while (cin) {
        Point a, b, c, p;
        cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y;
        if (area(a, b, c) == area(a, b, p) + area(b, c, p) + area(c, a, p)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        } 
    }
}

double area(Point l, Point m, Point n) {
    return fabs( (m.x - l.x) * (n.y - l.y)
            - (m.y - l.y) * (n.x - l.x)) * 0.5;
}

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;
			}
			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;
			}
			bool pnt=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(px>x[(i+1)%3])pnt=true;
			}
			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(pnt!=plus)ok=false;
		}
		if(ok)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pt", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		int i;
		vector <double> tpx (3, 0.);
		vector <double> tpy (3, 0.);
		double px = 0.;
		double py = 0.;
	
		stringstream ss(str);
		double minX = DBL_MAX; double maxX = DBL_MIN;
		double minY = DBL_MAX; double maxY = DBL_MIN;
		for (i = 0; i < 3; ++i){
			double tx,ty;
			ss >> tx >> ty;
			tpx[i] = tx; tpy[i] = ty;
			minX = min (minX, tx); maxX = max (maxX, tx);
			minY = min (minY, ty); maxY = max (maxY, ty);
		} // end for
		ss >> px >> py;

		if (px < minX || px > maxX || py < minY || py > maxY){
			cout << "NO" << endl;
			return 0;
		} // end if
		 
		vector <double> a(3, 0.);
		vector <double> b(3, 0.);
		vector <double> c(3, 0.);
/*
		for (i = 0; i < 3; ++i){
			cout << "tp[" << i << "]: ";
			cout << '(' << tpx[i] << ',' << tpy[i] << ')' << endl;
		} // end for
		cout << "p: ";
		cout << '(' << px << ',' << py << ')' << endl;
*/
		int j;
		for (i = 0; i < 3; ++i){
			j = (i + 1) % 3;
			if (tpx[i] == tpx[j]){
				a[i] = 1.0;
				b[i] = 0.0;
				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			}else if (tpy[i] == tpy[j]){
				a[i] = 0.0;
				b[i] = 1.0;
				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			}else{
				a[i] = (tpy[j] - tpy[i]);
				b[i] = -(tpx[j] - tpx[i]);
 				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			} // end if
//			cout << a[i] << ' ' << b[i] << ' ' << c[i] << endl;
		} // end for
		vector <int> d(3, 0);

		for (i = 0; i < 3; ++i){
			if (a[i] != 0.0 && b[i] != 0.0){
				if ( py > (-a[i]*px - c[i])/b[i] ){
					d[i] = 1;
				}else if ( py < (-a[i]*px - c[i])/b[i] ){
					d[i] = -1;
				} // end if
			}else if (a[i] == 0.0){
				if ( py > -c[i] ){
					d[i] = 1;
				}else if ( py < -c[i] ){
					d[i] = -1;
				} // end if
			}else if (b[i] == 0.0){
				if ( px > -c[i] ){
					d[i] = 1;
				}else if ( px < -c[i] ){
					d[i] = -1;
				} // end if
			} // end if
//			cout << "d[" << i << "]: " << d[i] << endl;
		} // end for
		if ( (d[0] < 0 || d[1] < 0 || d[2] < 0 ) && d[0]*d[1]*d[2] > 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if 
	
	} // end for
		
	return 0;
}

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

int main(){
  float x1, y1, x2, y2, x3, y3, xp, yp;
  float areasize;
  float areasize_sum, tmp;

  while(cin>>x1){
    cin>>y1;
    cin>>x2; cin>>y2;
    cin>>x3; cin>>y3;
    cin>>xp; cin>>yp;
    areasize=(x2-x1)*(y3-y1)-(y2-y1)*(x3-x1);
    if(areasize<0) areasize*=-1.0f;

    tmp=(x1-xp)*(y2-yp)-(y1-yp)*(x2-xp);
    if(tmp<0) tmp*=-1.0f;
    areasize_sum=tmp;
    tmp=(x2-xp)*(y3-yp)-(y2-yp)*(x3-xp);
    if(tmp<0) tmp*=-1.0f;
    areasize_sum+=tmp;
    tmp=(x3-xp)*(y1-yp)-(y3-yp)*(x1-xp);
    if(tmp<0) tmp*=-1.0f;
    areasize_sum+=tmp;

    if(areasize==areasize_sum) printf("YES\n");
    else printf("NO\n");
  }

  return 0;
}