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

using namespace std;

inline double sq (double x) {
    return x * x;
}

double rad (double x1, double y1, double x2, double y2) {
    double a = x1 * x2 + y1 * y2;
    double b = sqrt(sq(x1) + sq(y1)) * sqrt(sq(x2) + sq(y2));
    return acos(a / b);
}

int main (void) {
    double x1, x2, x3, xp;
    double y1, y2, y3, yp;
    for (;;) {
        cin >> x1; cin >> y1;
        cin >> x2; cin >> y2;
        cin >> x3; cin >> y3;
        cin >> xp; cin >> yp;
        if (cin.eof()) break;
        double d1, d2, d3;
        d1 = rad(xp - x1, yp - y1, xp - x2, yp - y2);
        d2 = rad(xp - x1, yp - y1, xp - x3, yp - y3);
        d3 = rad(xp - x2, yp - y2, xp - x3, yp - y3);
        if (d1 + d2 + d3 < 2 * M_PI)
            cout << "NO" << endl;
        else
            cout << "YES" << endl;
    }
    return 0;
}

C++: #include <stdio.h>
int main(void) {
  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 st, tt, ut;
    int s, t, u;
    x1 -= xp, x2 -= xp, x3 -= xp;
    y1 -= yp, y2 -= yp, y3 -= yp;
    //printf("%f %f %f %f %f %f\n", x1, y1, x2, y2, x3, y3);
    st = x1 * y2 - x2 * y1;
    if(!st) {
      printf("NO\n");
      continue;
    }
    s = st < 0 ? 0 : 1;
    tt = x2 * y3 - x3 * y2;
    if(!tt) {
      printf("NO\n");
      continue;
    }
    t = tt < 0 ? 0 : 1;
    ut = x3 * y1 - x1 * y3;
    if(!ut) {
      printf("NO\n");
      continue;
    }
    u = ut < 0 ? 0 : 1;
    //printf("%d %d %d\n", s, t, u);
    if(s == t && t == u) printf("YES\n");
    else printf("NO\n");
  }
}

C++: using namespace std;
typedef complex<double> xy_t;
xy_t a, b, c, p;
double x1, x2, x3, xp, y_1, y2, y3, yp;
double s1, s2, s3;
int main()
{
	while(cin >> x1 >> y_1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{
		a=xy_t(x1, y_1);
		b=xy_t(x2, y2);
		c=xy_t(x3, y3);
		p=xy_t(xp, yp);
		s1=(conj(a-p)*(b-p)).imag();
		s2=(conj(b-p)*(c-p)).imag();
		s3=(conj(c-p)*(a-p)).imag();
		if(((s1>0)&&(s2>0)&&(s3>0))||((s1<0)&&(s2<0)&&(s3<0)))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>

using namespace std;

#define EPS 1e-5

struct point{
	double x;
	double y;
};
struct line{
	double a; // 傾き
	double b; // 切片
};

int recog_point_place( const point& a , const point&b , const point& c );
bool get_line( const point& a , const point& b , line *a_b );

int main(void)
{
	point a, b, c, p;
	int input;

	while( scanf("%d", &input ) != EOF )
	{
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y;

		int result_ab_c = recog_point_place( a , b , c );
		int result_ab_p = recog_point_place( a , b , p );
		int result_bc_a = recog_point_place( b , c , a );
		int result_bc_p = recog_point_place( b , c , p );
		int result_ca_b = recog_point_place( c , a , b );
		int result_ca_p = recog_point_place( c , a , p );

		if( result_ab_c == result_ab_p && result_bc_a == result_bc_p && result_ca_b == result_ca_p ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

int recog_point_place( const point& a , const point&b , const point& c )
{
	line a_b;

	bool result = get_line( a , b , &a_b );
	if( result == false )
	{
		if( (a.x + b.x)/2 < c.x ) return 1; // 点が直線より右にある場合に1をリターン
		else return 0;
	}
	else if( result == true )
	{
		if( c.y > a_b.a * c.x + a_b.b ) return 1; // 点が直線より上にある場合に1をリターン
		else return 0;
	}

}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS )
	{
		return false;
	}
	else
	{
		a_b->a = (a.y - b.y) / (a.x - b.x);
		a_b->b = a.y - a_b->a * a.x;

		return true;
	}
}

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);
    if(S2<=S)
      printf("YES\n");
    else printf("NO\n");
  }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

typedef complex<double> P;

double cross(P a,P b){
  return a.real()*b.imag() - a.imag()*b.real();
}

vector<P> ps(3);
P p;

bool isIn(){
  for(int i = 0 ; i < ps.size() ; i ++){
    P q = ps[i];
    P r = ps[(i+1)%ps.size()];
    if(cross(r-q,p-q) < 0.0)return false;
  }
  return true;
}

int main(void){
  while(cin>>ps[0].real()>>ps[0].imag()){
    loop(i,1,3)cin>>ps[i].real()>>ps[i].imag();
    cin>>p.real()>>p.imag();
    bool res = false;
    if(isIn() || (swap(ps[0],ps[1]), isIn() ) ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;

}

C++: #include<iostream>
using namespace std;
class Vector {
public:
  double x;
  double y;
  Vector(double xx=0,double yy=0) {x=xx;y=yy;}
  Vector operator+(Vector p) ;
  Vector operator-(Vector p);
};
Vector Vector::operator+(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
Vector Vector::operator-(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P);

int main() {
  double x1,x2,x3,y1,y2,y3,x,y;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y) {
    Vector A(x1,y1);
    Vector B(x2,y2);
    Vector C(x3,y3);
    Vector P(x,y);
    if(check_hit(A,B,C,P))
      cout<<"YES\n";
    else
      cout<<"NO\n"; 
   }
  return 0;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P) {
  Vector AB=B-A;
  Vector BC=C-B;
  Vector CA=A-C;
  Vector AP=P-A;
  Vector BP=P-B;
  Vector CP=P-C;
  double calc1=AB.x*BP.y - AB.y*BP.x;
  double calc2=BC.x*CP.y - BC.y*CP.x;
  double calc3=CA.x*AP.y - CA.y*AP.x;
  if( (calc1>0 && calc2>0 && calc3>0)||(calc1<0 && calc2<0 && calc3<0) )
    return true;
  return false;
      }