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>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;

double GetLen(double x1,double y1,double x2,double y2){
  return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
}
double GetAn1(double x1,double y1,double x2,double y2){
  return atan((y2-y1)/(x2-x1));
}
double GetAn2(double a,double b,double c){
  return  acos((b*b+c*c-a*a)/(2*b*c));
}
main(){
  double x1,y1,x2,y2,x3,y3,xp,yp; 
  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
    double S,S2;
    double a,b,c,an;
    double cl1,cl2,cl3,anc;

    if( (xp==x1 && yp==y1) || (xp==x2 && yp==y2) || (xp==x3 && yp==y3)){
      printf("YES\n");
      continue;
    }

    a=GetLen(x1,y1,x2,y2);
    b=GetLen(x2,y2,x3,y3);
    c=GetLen(x3,y3,x1,y1);
    an=GetAn2(a,b,c);
    S=0.5*b*c*sin(an);

    cl1=GetLen(x1,y1,xp,yp);
    cl2=GetLen(x2,y2,xp,yp);
    cl3=GetLen(x3,y3,xp,yp);

    anc=GetAn2(a,cl1,cl2);
    S2=0.5*cl1*cl2*sin(anc);

    anc=GetAn2(b,cl2,cl3);
    S2+=0.5*cl2*cl3*sin(anc);

    anc=GetAn2(c,cl3,cl1);
    S2+=0.5*cl3*cl1*sin(anc);
    long long int Si,Si2;
    Si=S*10000000;
    Si2=S2*10000000;
    //  printf("%f %f %f %f %f %f",a,b,c,an*(180/M_PI),S,S2);
    if(Si2<=Si)
      printf("YES\n");
    else printf("NO\n");
  }
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P; /* ツ点 */

#define PI (3.1415926535)
#define EPS (1e-10)

//ツ静シツ閉ェ
struct S{
  P p1;
  P p2;
  S(P p,P q) : p1(p), p2(q) {}
};

int ccw(P p0, P p1, P p2){
  P d1 = p1-p0;
  P d2 = p2-p0;
  double dx1 = d1.real(), dx2 = d2.real();
  double dy1 = d1.imag(), dy2 = d2.imag();

  if(dx1*dy2 > dy1*dx2) return  1;//ツ板スツ篠楪計ツ嘉アツづィ
  if(dx1*dy2 < dy1*dx2) return -1;//ツ篠楪計ツ嘉アツづィ
  if((dx1*dx2 < 0) || (dy1*dy2 < 0)) return -1;
  if((dx1*dx1+dy1*dy1) < (dx2*dx2+dy2*dy2)) return 1;
  return 0;
}

bool intersect(const S &s1, const S &s2){
  return ((ccw(s1.p1, s1.p2, s2.p1)
	  *ccw(s1.p1, s1.p2, s2.p2)) <= 0)
       &&((ccw(s2.p1, s2.p2, s1.p1)
	  *ccw(s2.p1, s2.p2, s1.p2)) <= 0);
}

bool inside(P t, P *p, int N){
  int count = 0, j = 0;
  S lt(t, P(DBL_MAX,t.imag()));  

  P pj = p[N-1];
  for(int i=1; i<=N; i++){
    S lp(p[i-1],p[i-1]);
    if(ccw(lt.p1, lt.p2, p[i-1]) != 0){
      if(i == j+1){
	lp.p2 = pj;
	if(intersect(lp,lt)) count++;
      }else if(ccw(lt.p1, lt.p2, p[i-1])*ccw(lt.p1, lt.p2, pj) < 0)
	count++;
      j = i;
      if(j == N) pj = p[0];
      else pj = p[j-1];
    }
  }
  return count & 1 == 1;
}

int main(){
  P p[3];
  P x;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
	       &p[0].real(),&p[0].imag(),
	       &p[1].real(),&p[1].imag(),
	       &p[2].real(),&p[2].imag(),
	       &x.real(),&x.imag())){
    puts(inside(x,p,3)?"YES":"NO");
  }
  return 0;
}

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*100000000)-(int)((sa+sb+sc)*100000000)==0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

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

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

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double S = fabs((x2 - x1)*(y3 - y1) - (y2 - y1)*(x3 - x1)) / 2.0;
		
		x1 -= xp; y1 -= yp;
		x2 -= xp; y2 -= yp;
		x3 -= xp; y3 -= yp;
		
		double s1 = fabs(x1*y2 - y1*x2) / 2.0;
		double s2 = fabs(x2*y3 - y2*x3) / 2.0;
		double s3 = fabs(x3*y1 - y3*x1) / 2.0;

		if (fabs(S - s1 - s2 - s3) < 0.00000000001)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

  double x[4], y[4];
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){

    vector<bool> t(3, false);
    for(int i=0; i<3; i++){
      if( ( x[ i ] - x[ (i+1)%3 ] )*(y[3]-y[ (i+1)%3 ]) - (y[i]-y[ (i+1)%3 ])*(x[3]-x[ (i+1)%3 ]) < 0 ) t[i] = true;
    }

    if( t[0] && t[1] && t[2] ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}














// EOF

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>
using namespace std;

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector bc = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ab.x * ap.y - ab.y * ap.x; //??????
		double c2 = bc.x * bp.y - bc.y * bp.x;
		double c3 = ca.x * cp.y - ca.y * cp.x;
		if((c1>0 && c2>0 && c3 >0) || (c1<0 && c2<0 && c3<0)){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}