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 _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8, pi = acos(-1.0);
bool eq(ld a, ld b){return (abs(b-a)<eps);}
ld dot(Point a, Point b){return real(conj(a)*b);}
ld cross(Point a, Point b){ return imag(conj(a)*b);}
int ccw(Point a, Point b, Point c){
  b-=a;c-=a;
  if(cross(b,c)>eps) return 1;//countor_crockwise
  if(cross(b,c)<-eps) return -1;//crockwise
  if(dot(b,c)<0) return 2;//c,a,b
  if(norm(b)<norm(c)) return -2;//a,b,c
  return 0;//a,c,b
}

int main(){
  Point p[4];
  ld x,y;
  while(cin>>x>>y){
    p[0]=Point(x,y);
    REP(i,3){
      cin>>x>>y;
      p[i+1]=Point(x,y);
    }
    int a=ccw(p[0],p[1],p[3]);
    int b=ccw(p[1],p[2],p[3]);
    int c=ccw(p[2],p[0],p[3]);
    if((a==1&&b==1&&c==1)||(a==-1&&b==-1&&c==-1))
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

using namespace std;

bool line(double x1, double y1, double x2, double y2, double xp, double yp){
    return (yp-y1)*(x2-x1) - (y2-y1)*(xp-x1) > 0;
}

int main(){
    vector<double> p(6);
    double xp, yp;
    while(cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> xp >> yp){
        bool yes = true;
        for(int i = 0; i < 3; i++){
            yes &= !(line(p[0],p[1],p[2],p[3],p[4],p[5]) ^ line(p[0],p[1],p[2],p[3],xp,yp));
            rotate(p.begin(), p.begin()+2, p.end());
        }
        cout << (yes ? "YES" : "NO") << endl;
    }
}

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

int main(){

	typedef struct{
		double x, y;
	}_point;

	double a, b, s, t, r_p3, r_p2, eps;
	_point p1, p2, p3, p;
	
	eps = 10^(-3);
 
  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p.x >> p.y){
		p2.x -= p1.x;
		p2.y -= p1.y;
		p3.x -= p1.x;
		p3.y -= p1.y;
		p.x -= p1.x;
		p.y -= p1.y;
		r_p2 = sqrt(p2.x * p2.x + p2.y * p2.y);
		r_p3 = sqrt(p3.x * p3.x + p3.y * p3.y);
		if(p2.x > eps){
			s = p.y - p.x * p2.y / p2.x;
			t = p3.y - p3.x * p2.y / p2.x;
			a = (s / t);
			b = (p.x - a * p3.x) / p2.x;
		}
		else {
			a = p.x / p3.x;
			b = (p.y - a * p3.y) / p2.y;
		}

		if(a > 0 && b > 0 && a + b < 1) cout << "YES" << endl;
		else cout << "NO" << endl;
  }

  return 0;
}

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

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

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

P p[4];
void solve() {
    p[0] -= p[3];
    p[1] -= p[3];
    p[2] -= p[3];
    int u = 0;
    for (int i = 0; i < 3; i++) {
        P p1 = p[i], p2 = p[(i+1)%3];
        if (p1.imag() > p2.imag()) swap(p1, p2);
        if (p1.imag() > 0 || p2.imag() <= 0) continue;
        if (cross(p1, p2) < 0) continue;
        u++;
    }
    if (u == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


int main() {
    while (true) {
        for (int i = 0; i < 4; i++) {
            R x, y;
            cin >> x >> y;
            p[i] = P(x, y);
        }
        if (cin.eof()) break;
        solve();
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

double EPS = 1e-10;
double add(double a, double b){
  if(abs(a+b) < EPS* (abs(a) + abs(b))) return 0;
  return a+b;
}
struct P{
  double x,y;
  P(){}
  P(double _x,double _y):x(_x),y(_y){}
  P operator + (P p){
    return P(add(x,p.x) ,add(y,p.y));
  }
  P operator - (P p){
    return P(add(x,-p.x) ,add(y,-p.y));
  }
  P operator * (double d){
    return P(x * d,y * d);
  }
  double dot(P p){
    return add(x * p.x,y*p.y);
  }
  double det(P p){
    return add(x*p.y,-y*p.x);
  }
  double dist2(P p){
    return ((*this-p).x * (*this-p).x) + ((*this-p).y * (*this-p).y);
  }
  double GetSlope(P &p){
    P tmp = *this - p;
    return tmp.y/tmp.x;
  }
};
//???????????????????????¨?????????
bool on_seg(P p1,P p2,P q){
  return (p1-q).det(p2-q) == 0 && (p1-q).dot(p2-q) <= 0;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,xp,yp;
  while(cin >> a >> b >> c >> d >> e >> f >> xp >> yp){
    bool flag = true;
    double acx = c-a,abx = e-a,acy = d-b,aby = f-b,apx = xp-a,apy = yp - b;
    P p1 = P(a,b),p2 = P(c,d),p3 = P(e,f),p4 = P(xp,yp);
    double t,s;
    if(acx == 0){
      s = apx/ abx;
      t = (apy - s * aby)/acy;
    }
    else if(acy == 0){
      s = apy/aby;
      t = (apx - s * abx)/acx;
    }
    else if(abx == 0){
      t = apx / acx;
      s = (apy- t * acy)/aby;
    }
    else if(aby == 0){
      t = apy/acy;
      s = (apx - t * acx)/abx;
    }
    else{
//       t = (abx * apy - apx * aby)/(acy - acx*aby);
      t = (apy * abx - aby * apx)/(acy * (abx - aby) - (acx - acy));
//       s = (apx - t * acx)/abx;
      s = ((apx - apy) - t * (acx - acy))/(abx - aby);
    }
    if(on_seg(p1,p2,p4) || on_seg(p1,p3,p4) || on_seg(p2,p3,p4)){
      flag = false;
    }
    else{
      flag = 0 < t+s && t+s < 1 && s > 0 && t > 0;
    }
    Ans(flag);
  }
  return 0;
}