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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

double crp(double x1, double y1, double x2, double y2) {
	return x1 * y2 - y1 * x2;
}

double vabs(double x, double y) {
	return sqrt(x * x + y * y);
}

int main() {
	for(double x1, y1, x2, y2, x3, y3, xp, yp; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;) {
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;

		y1 -= yp;
		y2 -= yp;
		y3 -= yp;

		double v1 = vabs(x1, y1);
		double v2 = vabs(x2, y2);
		double v3 = vabs(x3, y3);

		double rad_a = crp(x1, y1, x2, y2) / (v1 * v2);
		double rad_b = crp(x2, y2, x3, y3) / (v2 * v3);
		double rad_c = crp(x3, y3, x1, y1) / (v3 * v1);

		if((rad_a > 0.0 && rad_b > 0.0 && rad_c > 0.0) || (rad_a < 0.0 && rad_b < 0.0 && rad_c < 0.0)) puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
const double EPS = 1e-10;

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

struct Point{
	double x, y;
	Point(){}
	Point(double x,double y) :x(x), y(y){}
	Point operator+(Point p) {return Point(x+p.x,y+p.y);}
	Point operator-(Point p) {return Point(x-p.x,y-p.y);}
	Point operator*(double k){return Point(x*k,y*k);}
	Point operator/(double k){return Point(x/k,y/k);}
	double norm(){return x*x+y*y;}
	double abs(){return sqrt(norm());}

	bool operator < (const Point &p) const{
		return x!=p.x?x<p.x:y<p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a,Vector b){
	return a.x * b.y - a.y * b.x;
}

int contains(Polygon g,Point p){
	int n = g.size();
	bool x = false;
	for(int i = 0; i < n; i++){
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if(fabs(cross(a, b)) < EPS && dot(a, b) < EPS) return 1;
		if(a.y > b.y) swap(a, b);
		if(a.y < EPS && EPS < b.y && cross(a,b) > EPS ) x = !x;
	}

	return (x ? 2 : 0);
}

int main() {
	Point a, r;
	Polygon v;

	while (cin >> a.x >> a.y) {
		v.pb(a);
		rep(i, 2) { 
			cin >> a.x >> a.y;
			v.pb(a);
		}
		cin >> r.x >> r.y;

		cout << (contains(v, r) == 2 ? "YES" : "NO") << endl;
	}
}

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

#define x first
#define y second
#define EPS 1e-20

struct vector { double x, y, l; };

int main()
{
    pair<double, double> p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        vector v[3];
        double angle[3];

        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);
        for (int i = 0; i < 3; i++){
            v[i].x = p[i].x - p[3].x;
            v[i].y = p[i].y - p[3].y;
            v[i].l = sqrt(v[i].x * v[i].x + v[i].y * v[i].y);
        }
        for (int i = 0; i < 3; i++){
            double product = v[i].x * v[(i + 1) % 3].x + v[i].y * v[(i + 1) % 3].y;
            angle[i] = acos(product / v[i].l / v[(i + 1) % 3].l) + EPS;
        }

        if (angle[0] + angle[1] + angle[2] == 2 * M_PI + EPS){
            puts("YES");
        }
        else {
            puts("NO");
        }
    }

    return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<string>

using namespace std;

double eps=1e-6;

main(){
  int i,j,l;
  double x[4],y[4],a,b,c,s,tol,ans,temp[3];
  while(cin >> x[0] >>y[0]){
    for(i=1;i<=3;i++){
      cin >> x[i] >> y[i];
    }

    a=pow(x[0]-x[1],2)+pow(y[0]-y[1],2);
    a=sqrt(a);
    b=pow(x[1]-x[2],2)+pow(y[1]-y[2],2);
    b=sqrt(b);
    c=pow(x[2]-x[0],2)+pow(y[2]-y[0],2);
    c=sqrt(c);
    s=(a+b+c)/2;
    tol=sqrt(s*(s-a)*(s-b)*(s-c));

    for(i=0;i<3;i++){

      if(i==1){
      a=pow(x[3]-x[2],2)+pow(y[3]-y[2],2);
      a=sqrt(a);
      }
      else{
      a=pow(x[3]-x[0],2)+pow(y[3]-y[0],2);
      a=sqrt(a);
      }

      b=pow(x[i]-x[i+1],2)+pow(y[i]-y[i+1],2);
      b=sqrt(b);

      if(i==2){
      c=pow(x[2]-x[0],2)+pow(y[2]-y[0],2);
      c=sqrt(c);
      }
      else{
      c=pow(x[3]-x[1],2)+pow(y[3]-y[1],2);
      c=sqrt(c);
      }

      s=(a+b+c)/2;
      temp[i]=sqrt(s*(s-a)*(s-b)*(s-c));
    }
    ans=temp[0]+temp[1]+temp[2];
    //   printf("%f %f\n",tol,ans);

    if(fabs(tol-ans)<eps){
      puts("YES");
    }
    else{
      puts("NO");
    }

  }
}