Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)

bool judge(double x[3], double y[3]) {
	double rad1 = atan2(y[0], x[0]);
	double rad2 = atan2(y[1], x[1]);
	double rad3 = atan2(y[2], x[2]);
	if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
	else return false;
}

int 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 x[3], y[3];
		x[0] = x2 - x1;
		y[0] = y2 - y1; 
		x[1] = x3 - x1;
		y[1] = y3 - y1;
		x[2] = xp - x1;
		y[2] = yp - y1;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		x[0] = x1 - x2;
		y[0] = y1 - y2;
		x[1] = x3 - x2;
		y[1] = y3 - y2;
		x[2] = xp - x2;
		y[2] = yp - y2;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		cout << "YES" << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;
double cross(P a,P b){return a.X*b.Y-a.Y*b.X;}
bool ccw(P a,P b,P c){return cross(b-a,c-a)>=0;}

int main(){
	
	double xa,ya,xb,yb,xc,yc,xp,yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&xa,&ya,&xb,&yb,&xc,&yc,&xp,&yp)!=EOF){
		P a = P(xa,ya);
		P b = P(xb,yb);
		P c = P(xc,yc);
		P p = P(xp,yp);
		
		if(!ccw(a,b,c)){
			swap(b,c);
		}
		
		if(!ccw(a,b,p)||!ccw(b,c,p)||!ccw(c,a,p))puts("NO");
		else puts("YES");
	}
}

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

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

	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{
		m = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) /
                ((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1));
 
        n = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) /
                ((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1));
 
        if(m > 0 && n > 0 && m + n < 1) cout << "YES" << endl;
        else cout << "NO" << endl;
	}

	return 0;
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    double a2,b2,a3,b3,ap,bp,s,t;
    a2=x2-x1; b2=y2-y1; a3=x3-x1; b3=y3-y1; ap=xp-x1; bp=yp-y1;
    s=(b3*ap-a3*bp)/(a2*b3-a3*b2);
    t=(-b2*ap+a2*bp)/(a2*b3-a3*b2);
    if(0.0<s+t && s+t<1.0 && 0.0<s && 0.0<t)
      cout << "YES\n";
    else
      cout <<"NO\n";
  }
  return 0;
}

C++: /*AOJ 0012*/

#include<iostream>
using namespace std;

class Line_obj{
public:
	double x1,x2,y1,y2;

	void set(double sx1,double sx2,double sy1,double sy2){
		x1 = sx1;
		x2 = sx2;
		y1 = sy1;
		y2 = sy2;
	}

	int isUpDown(double x3,double y3){

		if( (x1-x2)*(y3-y1)+(y1-y2)*(x1-x3)>0){
			return 1;
		}
		else if( (x1-x2)*(y3-y1)+(y1-y2)*(x1-x3)<0){
			return -1;
		}
		else{
			return 0;
		}
	}

};

int main(){

	Line_obj line1,line2,line3;

	double x1,y1,x2,y2,x3,y3,xp,yp,xh,yh;

	while(cin>>x1){
		cin>>y1;
		cin>>x2;
		cin>>y2;
		cin>>x3;
		cin>>y3;
		cin>>xp;
		cin>>yp;

		line1.set(x1,x2,y1,y2);
		line2.set(x1,x3,y1,y3);
		line3.set(x2,x3,y2,y3);

		xh = (x1+x2+x3)/3.0;
		yh = (y1+y2+y3)/3.0;

		if( line1.isUpDown(xp,yp)*line1.isUpDown(xh,yh)<0 ||
			line2.isUpDown(xp,yp)*line2.isUpDown(xh,yh)<0 ||
			line3.isUpDown(xp,yp)*line3.isUpDown(xh,yh)<0){
				cout<<"NO"<<endl;
		}

		else{
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

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

typedef struct POINT_tag // POINT_t …… 点
{
	double x; // x 座標
	double y; // y 座標
} POINT_t;

typedef struct LINE_tag // LINE_t …… 線分、直線
{
	POINT_t a; // 始点
	POINT_t b; // 終点
} LINE_t;

typedef struct TRIANGLE_tag // TRIANGLE_t …… 三角形
{
	POINT_t a;
	POINT_t b;
	POINT_t c;
} TRIANGLE_t;

int side( POINT_t *p, LINE_t *e )
{
	POINT_t p1 = *p;
	POINT_t p2 = e->a; // 有向線分 e の始点
	POINT_t p3 = e->b; // 有向線分 e の終点

	// 有向線分 (p2,p1), (p2,p3) の外積の z 成分を求める
	const int n  = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
	if      ( n > 0 ) return  1; // 左
	else if ( n < 0 ) return -1; // 右
	else              return  0; // 線上
}//side

int PointInTriangle( POINT_t *p, TRIANGLE_t *t )
{
	LINE_t ab, bc, ca;
	ab.a = t->a; ab.b = t->b;
	bc.a = t->b; bc.b = t->c;
	ca.a = t->c; ca.b = t->a;
	const int pab = side( p, &ab ); // 有向線分 ab から見た点 p の方向
	const int pbc = side( p, &bc ); // 有向線分 bc から見た点 p の方向
	const int pca = side( p, &ca ); // 有向線分 ca から見た点 p の方向

	// 三角形の内側にあれば正
	if ( (0 < pab) && (0 < pbc) && (0 < pca) )
		return 1; // 点 p が常に左側にある（時計回り）
	if ( (0 > pab) && (0 > pbc) && (0 > pca) )
		return 1; // 点 p が常に右側にある（反時計回り）

	// 三角形の線上にあれば負
	if ( (0 <= pab) && (0 <= pbc) && (0 <= pca) )
		return -1; // 点 p が常に左側にある（時計回り）
	if ( (0 >= pab) && (0 >= pbc) && (0 >= pca) )
		return -1; // 点 p が常に右側にある（反時計回り）

	// 三角形の外側にあれば 0
	return 0;
}//PointInTriangle

int main(){

	//double a,b,c,d,e,f,x,y;
	POINT_t p1,p2,p3,po;
	TRIANGLE_t tr;
		
	while(1){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> po.x >> po.y;
		tr.a = p1;
		tr.b = p2;
		tr.c = p3;
		if(PointInTriangle(&po,&tr)>0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		if(cin.eof())break;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<complex>
using namespace::std;
typedef complex<double> P;


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

double dot(P a, P b){
  return a.real()*b.real() + a.imag()*b.real();
}

int ccw(P a, P b, P c){
  b -= a; c -= a;
  if(cross(b, c) > 0) return 1;
  if(cross(b, c) < 0) return -1;
  if(dot(b, c) < 0) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

int main(){

  int r1, r2, r3;
  float x1, x2, x3, xp, y1, y2, y3, yp;

  for(;;){
    if(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) == EOF){
      break;
    }
  P p1 = P(x1, y1);
  P p2 = P(x2, y2);
  P p3 = P(x3, y3);
  P p4 = P(xp, yp);

  r1 = ccw(p1, p2, p4);
  r2 = ccw(p2, p3, p4);
  r3 = ccw(p3, p1, p4);

  if((r1 == -1) && (r2 == -1) && (r3 == -1)){
    printf("YES\n");
  }else if ((r1 == 1) && (r2 == 1) && (r3 == 1)){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  }
  return 0;
}

C++: #include <cstdio>
#include <cmath>

using namespace std;

inline double out(double ax,double ay,double bx,double by){
	return bx * ay - by * ax;
}

int main(void){
	double x1, y1, x2, y2, x3, y3, px, py;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&px,&py) != EOF){
		if(out(px - x1,py - y1,x2 - x1,y2 - y1) > 0 && out(px - x2,py - y2,x3 - x2,y3 - y2) > 0 && out(px - x3,py - y3,x1 - x3,y1 - y3) > 0){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	return 0;
}