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<cstdio>

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	int flug;
	double h;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) + 1){
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;
		flug = 0;
		if(x1 < 0.00001 || x1 > -0.00001){
			if(y1 > 0){
				if(y2 < 0 && y3 < 0){
					if(x2 * x3 < 0){
						flug = 1;
					}
				}
			}else{
				if(y2 > 0 && y3 > 0){
					if(x2 * x3 < 0){
						flug = 1;
					}
				}
			}
		}else{
			h = (y1 / x1 * x2 - y2)*(y1 / x1 * x3 - y3);
			if(x1 * x2 > 0 && y1 * y2 > 0){
				if(x3 * x1 < 0 && y3 * y1 < 0){
					if(h > 0){
						flug = 1;
					}
				}
			}
		}
		if(flug){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
typedef complex<double>P;
double dot(P a, P b){ return real(conj(a)*b);}
double cross(P a,P b){return imag(conj(a)*b);}
struct L: public vector<P>{
    L(const P &a,const P &b){
        push_back(a); push_back(b);
    }// line
};
struct C{
    P c; double r;
    C(const P &c, double r) : c(c),r(r){}    // circle
};
/*complex ?????????*/
namespace std {
    bool operator < (const P& a, const P& b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
        //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
    }
    bool operator == (const P& a, const P& b) {
        return a.real()==b.real()&&a.imag()==b.imag();
    }
}
/*????¨?????????????????¨???????????????????*/
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 on line
    if (norm(b) < norm(c)) return -2;       // a--b--c on line
    return 0;
}
int main(){
    vector<P>v(4);vector<pdd>p(3);
    vector<double>t(3,0);
    pdd temp;
    while(cin>>p[0].first>>p[0].second>>p[1].first>>p[1].second>>p[2].first>>p[2].second>>temp.first>>temp.second){
        rep(i,3)v[i]=P(p[i].first,p[i].second);
        P pit=P(temp.first,temp.second); v[3]=v[0];
        bool flag=true;P hoge;
        rep(i,3)t[i]=cross((-v[i]+v[i+1]),-v[i+1]+pit);
        if((t[0]>0&&t[1]>0&&t[2])||(t[0]<0&&t[1]<0&&t[2]))puts("YES");
        else puts("NO");
    }
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    ld x1, x2, x3, xp, y1, y2, y3, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        auto z1 = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        auto z2 = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        auto z3 = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        auto isIn = z1 > 0 && z2 > 0 && z3 > 0;
        if (isIn) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

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

double Area(double* x1, double* y1, double* x2, double* y2){
  return (*x1 * *y2 - *x2 * *y1)/2.0;
}

double Segitiga(double* a, double * b, double* c, double* d, double* e, double* f){
  return abs (Area(a,b,c,d) + Area(c,d,e,f) + Area(e,f,a,b));
}

int main(){
  double a, b, c, d, e, f, g, h, ta, tb;
  cin >> a >> b >> c >> d >> e >> f >> g >> h;
  ta = Segitiga(&a, &b, &c, &d, &e, &f);
  tb = Segitiga(&a, &b, &c, &d, &g, &h) + Segitiga(&a, &b, &e, &f, &g, &h) + Segitiga(&c, &d, &e, &f, &g, &h);

  if(tb-ta < 1e-10)
    cout << "YES\n";
  else
    cout << "NO\n";
  
return 0;
}