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>
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;
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
using namespace std;
int main(){
    double px,py;
    double tx[3],ty[3];
    bool flag;
    bool v[3];
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tx[0],&ty[0],&tx[1],&ty[1],&tx[2],&ty[2],&px,&py) == 8){
        for(int i=0;i<3;i++){
            tx[i]=tx[i]-px;
            ty[i]=ty[i]-py;
        }
        for(int i=0;i<3;i++){
            if((tx[i%3]*ty[(i+1)%3])-(ty[i%3]*tx[(i+1)%3])<0){
                v[i]=true;
            }else{
                v[i]=false;
            }
        }
         
        if(v[0]!=v[1]){
            cout<<"NO"<<endl;
        }else if(v[1]!=v[2]){
            cout<<"NO"<<endl;
        }else {
            cout<<"YES"<<endl;
        }
    }
    return 0;
}

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

using namespace std;

float hang(float a,float b,float c,float d,float e,float f){
    float A;
    A=(a*d + b*e + c*f - e*d - b*c - a*f)/2;
    return A;      
}

int main()
{
    float x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3,s;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
       s1=hang(xp,yp,x2,y2,x3,y3);
       s2=hang(x1,y1,xp,yp,x3,y3);
       s3=hang(x1,y1,x2,y2,xp,yp);
       s=hang(x1,y1,x2,y2,x3,y3);
       if(s==(s1+s2+s3))cout<<"YES"<<endl;
       else cout<<"NO"<<endl;                                                   
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>
using namespace std;
double x,y;
bool C(double a,double b,double c,double d,double e,double f)
{
	pair<double,int>p[3];
	p[0]=make_pair(atan2(d-b,c-a),0);
	p[1]=make_pair(atan2(f-b,e-a),1);
	p[2]=make_pair(atan2(y-b,x-a),2);
	sort(p,p+3);
	return p[1].second==2;
}
int main()
{
	double a,b,c,d,e,f;
	for(;cin>>a>>b>>c>>d>>e>>f>>x>>y;)
	{
		cout<<(C(a,b,c,d,e,f)&&C(c,d,e,f,a,b)&&C(e,f,a,b,c,d)?"YES":"NO")<<endl;
	}
}