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

const double EPS = 1e-6;
typedef complex<double> Point;

double cross(Point a, Point b){
    return (conj(a)*b).imag();
}

int main(){
    Point V[3], P;
    while(!cin.eof()){
        for(int i=0; i<3; i++){
            double x, y; cin >> x >> y;
            V[i] = {x, y};
        }
        double x, y; cin >> x >> y;
        P = {x, y};
        
        int sum = 0;
        for(int i=0; i<3; i++){
            double a = cross(V[(i+1)%3]-V[i], (P-V[i]));
            sum += a/abs(a) + EPS;
        }
        cout << (abs(sum) == 3? "YES": "NO") << endl;
    }
    return 0;
}

C++: #include <complex>
#include <cstdio>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std{
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
bool in_triangle(const P& p1,const P& p2,const P& p3,const P& p){
	return cross(p2-p,p1-p)<0 || cross(p3-p,p2-p)<0 || cross(p1-p,p3-p)<0;
}
int main(){
	double x1,y1,x2,y2,x3,y3,x,y;
	for(;~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&x1,&x2,&y2,&x3,&y3,&x,&y);){
		P p1(x1,y1),p2(x2,y2),p3(x3,y3),p(x,y);
		bool in=in_triangle(p1,p2,p3,p);
		puts(in?"YES":"NO");
	}
}

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

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

double x1,y01,x2,y2,x3,y3,xp,yp;

double mennseki (double x_1,double y_1,double x_2,double y_2,double x_3,double y_3)
{
	x_2-=x_1;
	y_2-=y_1;
	x_3-=x_1;
	y_3-=y_1;
	return fabs(x_2*y_3-x_3*y_2)/2;
}

int main()
{

	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y01,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF)
	{
		if(mennseki(x1,y01,x2,y2,xp,yp)+mennseki(x3,y3,x2,y2,xp,yp)+mennseki(x1,y01,x3,y3,xp,yp)==mennseki(x1,y01,x2,y2,x3,y3))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define NITENKAN(a, b) sqrt(((a.first - b.first) * (a.first - b.first)) + ((a.second - b.second) * (a.second - b.second)))
using namespace std;

bool checkTriIn(pair<double, double> vA, pair<double, double> vB, pair<double, double> vC, pair<double, double> P){
	pair<double, double> center((vA.first + vB.first + vC.first / 3), (vA.second + vB.second + vC.second / 3));

	vector<pair<double, double> > triangleLine;
	vector<pair<double, double> > centerToVertex;
	pair<double, double> vAvB(vB.first - vA.first, vB.second - vA.second);
	pair<double, double> vBvC(vC.first - vB.first, vC.second - vB.second);
	pair<double, double> vCvA(vA.first - vC.first, vA.second - vC.second);

	triangleLine.push_back(vAvB);
	triangleLine.push_back(vBvC);
	triangleLine.push_back(vCvA);

	pair<double, double> centerP(P.first - center.first, P.second - center.second);
	pair<double, double> centerA(vA.first - center.first, vA.second - center.second);
	pair<double, double> centerB(vB.first - center.first, vB.second - center.second);
	pair<double, double> centerC(vC.first - center.first, vC.second - center.second);

	centerToVertex.push_back(centerA);
	centerToVertex.push_back(centerB);
	centerToVertex.push_back(centerC);

	for(int i = 0; i < 3; i++){
		double cross = triangleLine[i].first * centerP.second - centerP.first * triangleLine[i].second;
		if(cross == 0) continue;
		double r = triangleLine[i].first * centerToVertex[i].second - centerToVertex[i].first * triangleLine[i].second;
		if(r == 0) continue;
		r /= cross;
		double s = centerP.first * centerToVertex[i].second - centerToVertex[i].first * centerP.second;
		if(s == 0) continue;
		s /= cross;

		if(r >= 0 && r <= 1 && s >= 0 && s <= 1){
			return true;
		}
	}
	return false;
}

int main(){
	pair<double, double> vA, vB, vC, P;

	while(cin >> vA.first >> vA.second >> vB.first >> vB.second >> vC.first >> vC.second >> P.first >> P.second){
		if(checkTriIn(vA, vB, vC, P)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define EPS 1e-9

typedef complex<double> P;

double x[4],y[4],xp,yp;

double cross(P a, P b){
	return imag( conj(a) * b );
}

int main(){
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		
		P p(xp, yp), q[4];
		rep(i,3) q[i] = P(x[i], y[i]);
		
		int posi=0, nega=0;
		rep(i,3){
			double cr = cross( q[(i+1)%3] - q[i], p - q[i]);
			if(cr > EPS) posi++;
			if(cr < EPS) nega++;
		}
		cout<<(posi==3 || nega==3 ? "YES" : "NO")<<endl;
	}
}

C++: #include <stdio.h>
#include <stdlib.h>

 typedef struct  Point {
    float x;
    float y;
}fPoint;

float area(float x1, float y1, float x2, float y2, float x3, float y3)
{
   return abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0);
}


bool isInside(int x1, int y1, int x2, int y2, int x3, int y3, int x, int y)
{
   /* Calculate area of triangle ABC */
   float A = area (x1, y1, x2, y2, x3, y3);

   /* Calculate area of triangle PBC */
   float A1 = area (x, y, x2, y2, x3, y3);

   /* Calculate area of triangle PAC */
   float A2 = area (x1, y1, x, y, x3, y3);

   /* Calculate area of triangle PAB */
   float A3 = area (x1, y1, x2, y2, x, y);

   /* Check if sum of A1, A2 and A3 is same as A */
   return (A == A1 + A2 + A3);
}
float sign(fPoint p1, fPoint p2, fPoint p3)
{
  return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}

bool PointInTriangle(fPoint pt, fPoint v1, fPoint v2, fPoint v3)
{
  bool b1, b2, b3;

  b1 = sign(pt, v1, v2) < 0.0f;
  b2 = sign(pt, v2, v3) < 0.0f;
  b3 = sign(pt, v3, v1) < 0.0f;

  return ((b1 == b2) && (b2 == b3));
}

int main()
{

   float x1,x2,x3,x4,x5,x6,x7,x8;
   while(scanf("%f%f%f%f%f%f%f%f",&x1,&x2,&x3,&x4,&x5,&x6,&x7,&x8)==8)
   {
       fPoint pt,v1,v2,v3;
       pt.x=x7;
       pt.y=x8;
       v1.x=x1;
       v1.y=x2;
       v2.x=x3;
       v2.y=x4;
       v3.x=x5;
       v3.y=x6;



       if (PointInTriangle( pt, v1, v2, v3))
        printf ("YES\n");
      else
         printf ("NO\n");

   }


   return 0;
}