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>
#define N 0.00000001
using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3,px,py;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));

    if(-N<s1<N||-N<s2<N||-N<s3<N)cout<<"NO"<<endl;
    else if((s1+s2+s3)>s-N &&(s1+s2+s3)<s+N )cout<<"YES"<<endl;
    else  cout<<"NO"<<endl; 
  }
  return 0;
}

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){
		bool ans = true;
		//???????????¨????????????
		double gaiseki[3];	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for (int i = 0; i<3; i++){
			int k = (i + 1) % 3;
			double vx, vy, vpx, vpy;
			vx = x[k] - x[i];
			vy = y[k] - y[i];
			vpx = xp - x[i];
			vpy = yp - y[i];
			gaiseki[i] = vx*vpy - vy*vpx;
			if (gaiseki[i] <= 0) ans = false;
		}
		if (ans){
			cout << "YES" << endl;
		} else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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;
		r /= cross;
		double s = centerP.first * centerToVertex[i].second - centerToVertex[i].first * centerP.second;
		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 <algorithm>

struct Vec2D {
	double x = 0.0, y = 0.0;

	Vec2D() = default;
	Vec2D(const Vec2D&) = default;
	Vec2D& operator = (const Vec2D&) = default;

	Vec2D(double _x, double _y) :
		x(_x), y(_y) {}

	Vec2D operator - (const Vec2D& vec) {
		return Vec2D(x - vec.x, y - vec.y);
	}
};

inline Vec2D normalize(const Vec2D& vec) {
	double k = vec.x * vec.x + vec.y * vec.y;
	return Vec2D(vec.x / k, vec.y / k);
}
inline double cross(const Vec2D& v1, const Vec2D& v2) {
	return v1.x * v2.y - v1.y * v2.x;
}

int main() {
	Vec2D vecs[3];
	Vec2D p;

	while (std::cin) {
		for (auto&& vec : vecs) {
			std::cin >> vec.x >> vec.y;
		}

		std::cin >> p.x >> p.y;

		double res[3];
		for (int i = 0; i < 3; ++i) {
			res[i] = cross(
				p - vecs[i],
				normalize(vecs[(i + 1) % 3] - vecs[i])
				);
		}

		if (
			std::all_of(res, std::end(res), [](double x) {return x > 0; }) ||
			std::all_of(res, std::end(res), [](double x) {return x < 0; })
			) {
			std::cout << "YES" << std::endl;
		}
		else
			std::cout << "NO" << std::endl;
	}
}

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

#include <utility>
using namespace std;


pair<double,double> tp[3];
pair<double,double> p;
bool flag=true;


int main(){
	
	
	
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tp[0].first,&tp[0].second,&tp[1].first,&tp[1].second,&tp[2].first,&tp[2].second,&p.first,&p.second) == 8){
		flag=true;
		
		for(int i=0;i<3;i++){
					
			if (tp[i%3].second-tp[(i+1)%3].second==0){
				if(
					(p.second-tp[i%3].second)
					*(tp[(i+2)%2].second-tp[i%3].second)
					<0
				)flag=false;
			}else {
				printf("%lf\n",
					(p.second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(p.first-tp[i%3].first)+tp[i%3].second)
					*(tp[(i+2)%2].second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(tp[(i+2)%2].first-tp[i%3].first)+tp[i%3].second));
				if(
					(p.second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(p.first-tp[i%3].first)+tp[i%3].second)
					*(tp[(i+2)%2].second - (tp[i%3].first-tp[(i+1)%3].first)/(tp[i%3].second-tp[(i+1)%3].second)*(tp[(i+2)%2].first-tp[i%3].first)+tp[i%3].second)
					<0
				)flag=false;
			}
		}
		
		
		
		
		if(flag)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

const double ESP=1e-8;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define eq(a,b) a-b<ESP

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

int main(){
  while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
    bool yes=true;
    REP(i,3){
      double flg,flg2;
      if (eq(x[i],x[(i+1)%3])){
	flg=x[(i+2)%3]-x[i];
	flg2=xp-x[i];
	if (flg*flg2<0){
	  yes=false;
	}
      }
      else{
	double m=(y[(i+1)%3]-y[i])/(x[(i+1)%3]-x[i]);
	double n=-x[i]*m+y[i];
	flg=y[(i+2)%3]-(m*x[(i+2)%3]+n);
	flg2=yp-(m*xp+n);
	if (flg*flg2<0){
	  yes=false;
	}
      }
    }
    cout<<(yes ? "YES" : "NO")<<endl;
  }
  return 0;
}