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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int main(){
	ios::sync_with_stdio(false);

	vd x(3), y(3);
	double px, py;
	double a1, a2, a3;
	bool s = false;

	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py){
		s = false;

		a1 = (x[1] - x[0])*(py - y[1]) - (y[1] - y[0])*(px - x[1]);
		a2 = (x[2] - x[1])*(py - y[2]) - (y[2] - y[1])*(px - x[2]);
		a3 = (x[0] - x[2])*(py - y[0]) - (y[0] - y[2])*(px - x[0]);

		if (((a1 > 0) && (a2 > 0) && (a3 > 0)) || ((a1 < 0) && (a2 < 0) && (a3 < 0)))
			s = !s;

		if (s)
			puts("YES");
		else
			puts("NO");
	}
}

C++: #include<bits/stdc++.h>
#define EPS 1.0e-9
using namespace std;

bool is_in_a_triangle(double ax, double ay, double bx, double by, double cx, double cy, double px, double py){
    double c1 = (bx-ax) * (py-ay) - (by-ay) * (px-ax);
    double c2 = (cx-bx) * (py-by) - (cy-by) * (px-bx);
    double c3 = (ax-cx) * (py-cy) - (ay-cy) * (px-cx);
    if(c1 + EPS > 0 && c2 + EPS > 0 && c3 + EPS > 0) return true;
    else if(c1 + EPS < 0 && c2 + EPS < 0 && c3 + EPS < 0) 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){
        if(is_in_a_triangle(x1,y1,x2,y2,x3,y3,xp,yp))cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;



int isPointInsidePolygon(vector<pair<double,double>> angle,pair<double,double> point){    //点が多角形の内側にあるかどうかを求める
    long angleSum=angle.size();
    int count=0;
    
    for(int i=0;i<angleSum;i++){
        double x1=angle[i].first;
        double y1=angle[i].second;
        double x2=angle[(i+1)%angleSum].first;
        double y2=angle[(i+1)%angleSum].second;
        double xp=point.first;
        double yp=point.second;
        
        double result=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        
        if(result<0)return 0;       //点は外側にある
        
        if(result==0)count+=2;
        else if(result>0)count++;
        
    }
    if(count==angleSum)return 2;    //点は内側にある
    else return 1;                  //点は周上にある
    
}


int main(){
    double a,b,c,d,e,f,g,h;
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        vector<pair<double,double>> angle;
        angle.pb(pair<double,double>(a,b));
        angle.pb(pair<double,double>(c,d));
        angle.pb(pair<double,double>(e,f));

        if(isPointInsidePolygon(angle,pair<double,double>(g,h))==0){
            cout<<"NO"<<endl;
        }
        else cout<<"YES"<<endl;
    }


    return 0;
}

C++: #include <iostream>
using namespace std;
bool judge_Cross(double, double, double, double);

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double pax = x1 - xp;
		double pay = y1 - yp;
		double pbx = x2 - xp;
		double pby = y2 - yp;
		double pcx = x3 - xp;
		double pcy = y3 - yp;

		if ((judge_Cross(pax, pay, pbx, pay) && judge_Cross(pbx, pby, pcx, pcy) && judge_Cross(pcx, pcy, pax, pay)) ||
			!((judge_Cross(pax, pay, pbx, pay) || judge_Cross(pbx, pby, pcx, pcy) || judge_Cross(pcx, pcy, pax, pay)))) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

bool judge_Cross(double x1,double y1,double x2,double y2) {
	if (x1 * y2 - x2 * y1 > 0) {
		return true;
	} else {
		return false;
	}
}

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

using namespace std;

double crossProduct(double px, double py, double x1, double y1, double x2, double y2) {
  double v1[2] = {px - x1, py - y1};
  double v2[2] = {x2 - x1, y2 - y1};
  return v1[0] * v2[1] - v1[1] * v2[0];
}

int main() {
	double x1, x2, x3, xp, y1, y2, y3, yp;
  double t[3];
  int f;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    t[0] = crossProduct(xp, yp, x1, y1, x2, y2);
    t[1] = crossProduct(xp, yp, x2, y2, x3, y3);
    t[2] = crossProduct(xp, yp, x3, y3, x1, y1);
    for (int i = f = 0; i < 3; i++) {
      if (t[i] < 0) f++;
      else if (t[i] > 0) f--;
      else return -1;
    }
    if (f == 3 || f == -3) cout << "YES\n";
    else cout << "NO\n";
	}
	return 0;
}

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

typedef struct {
	double x;
	double y;
}vector;

bool ex_product(double x0,double y0,double x1,double y1,double xp,double yp ){
	vector a={x1-x0,y1-y0};
	vector b={xp-x0,yp-y0};

	return (a.x*b.y-a.y*b.x)>=0;
}

int main(int argc, char *argv[]){
    
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin >> x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	
		bool a=ex_product(x1,y1,x2,y2,xp,yp); 
		bool b= ex_product(x2,y2,x3,y3,xp,yp) ;
		bool c=ex_product(x3,y3,x1,y1,xp,yp) ;
	
		if((a && b && c) || ((!a) && (!b) && (!c)))cout <<"YES"<<endl;
		else cout <<"NO"<<endl;
	}
	
    return 0;
}