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<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
double check(double xa,double ya,double xb,double yb,double xc,double yc);
int main(void){
	for(;;){
	    double qxa,qya,qxb,qyb,qxc,qyc,qxp,qyp;
	    cin>>qxa>>qya>>qxb>>qyb>>qxc>>qyc>>qxp>>qyp;
	    double abc,abp,bcp,cap;
	    abc=check(qxa,qya,qxb,qyb,qxc,qyc);
	    abp=check(qxa,qya,qxb,qyb,qxp,qyp);
        bcp=check(qxb,qyb,qxc,qyc,qxp,qyp);
        cap=check(qxc,qyc,qxa,qya,qxp,qyp);

        double var=abc-(abp+bcp+cap);
        if(var<=0.01&&var>=-0.01)var=0.0;
        if(var==0.0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;


	}
	return 0;
}


double check(double xa,double ya,double xb,double yb,double xc,double yc){

    double ab,bc,ca;
    double S,s;
    ab=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
    bc=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc));
    ca=sqrt((xc-xa)*(xc-xa)+(yc-ya)*(yc-ya));
    s=0.5*(ab+bc+ca);
    S=sqrt(s*(s-ab)*(s-bc)*(s-ca));
    //cout<<S<<endl;
    return S;


}

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,P c){
    double aa,bb,cc;
    aa = dist(b,c);
    bb = dist(c,a);
    cc = dist(a,b);
    double s = (aa+bb+cc)/2.0;
    return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}
 
 
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);
        double sa,sb,sc;
        sa = tri_pro(b,c,p);
        sb = tri_pro(c,a,p);
        sc = tri_pro(a,b,p);
        double s = tri_pro(a,b,c);
        //cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
        if((int)(s*10)-(int)((sa+sb+sc)*10)==0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

bool sameside(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy) {
    if (ax == bx) {
        if ( (cx - ax) * (dx - ax) > 0 ) return true;
        else    return false;
    } else {
        double slope = (by - ay) / (bx - ax);
        double r = ay - slope * ax;
        if ( (cy - slope * cx - r) * (dy - slope * dx - r) > 0 )    return true;
        else    return false;
    }

}

int main() {

    double a, b, c, d, e, f, g, h;
    while( cin >> a >> b >> c >> d >> e >> f >> g >> h) {
        if (sameside(a, b, c, d, e, f, g, h) && sameside(c, d, e, f, a, b, g, h) && sameside(e, f, a, b, c, d, g, h) ) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;

float calc_crossZ(vector<float> v1, vector<float>v2){
  float result = v1[0]*v2[1] - v1[1]*v2[0];
  return result;
}

bool same_sign(float a, float b){
  if(a<0 && b<0){
    return true;
  }else if(a>0 && b>0){
    return true;
  }
  return false;
}
    

bool do_calc(float x1, float y1, float x2, float y2, float x3, float y3, float xp,float yp){

  // vector<vector <float> > points(3, 2);
  
  // points[0][0] = x1;
  // points[0][1] = y1;
  // points[1][0] = x2;
  // points[1][1] = y2;
  // points[2][0] = x3;
  // points[2][1] = y3;

  
  vector<float> AB;
  AB.push_back(x2-x1);
  AB.push_back(y2-y1);
  vector<float> AC;
  AC.push_back(x3-x1);
  AC.push_back(y3-y1);
  vector<float> AP;
  AP.push_back(xp-x1);
  AP.push_back(yp-y1);

  float std = calc_crossZ(AB, AC);
  float comp = calc_crossZ(AB, AP);

  if(same_sign(std, comp)){
    return true;
  }else{
    return false;
  }


}
  

int main(){
  float x1, y1, x2, y2, x3, y3, xp, yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    if(do_calc(x1, y1, x2, y2, x3, y3, xp, yp)&&do_calc(x2, y2, x3, y3, x1, y1, xp, yp)&&do_calc(x3, y3, x1, y1, x2, y2, xp, yp)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  
  return 0;
}

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

typedef struct{

  double x,y;
}vec_t;

int main(){

  double x1,y1,x2,y2,x3,y3,xp,yp;
  vec_t AB,BC,CA,AP,BP,CP;

  cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp;

  AB.x=x2-x1 , AB.y=y2-y1;
  BC.x=x3-x2 , BC.y=y3-y2;
  CA.x=x1-x3 , CA.y=y1-y3;
  AP.x=xp-x1 , AP.y=yp-y1;
  BP.x=xp-x2 , BP.y=yp-y2;
  CP.x=xp-x3 , CP.y=yp-y3;

  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))cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}

C++: #include <iostream>
#include <cmath>
#define EPS 1.0e-5
using namespace std;

int main() {
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a[2],b[2];
  double A,B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(fabs(a[0] * b[1] -b[0] * a[1]) >= EPS) {
      A = ( b[1] * xp - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[0] * yp - xp * a[1]) / (a[0] * b[1] - b[0] * a[1]);
      if ((A+B < 1) && (A > 0) && (B > 0)) {
        cout << "YES" << endl;
      }
      else {
        cout << "NO" << endl;
      }
    }
    else
      cout << "NO" << endl;
  }
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

int main(){
	double x[3],y[3],xp,yp;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		//??????
		double gaiseki[3];
		for(int i=0;i<3;i++){
			double vx,vy,vxp,vyp;
			vx = x[(i+1)%3]-x[i];
			vy = y[(i+1)%3]-y[i];
			vxp = xp-x[i];
			vyp = yp-y[i];
			gaiseki[i] = vx*vyp-vy*vxp;
		}
		if((gaiseki[0]>0&&gaiseki[1]>0&&gaiseki[2]>0)||(gaiseki[0]<0&&gaiseki[1]<0&&gaiseki[2]<0)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}