Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

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

int test(int x1, int y1, int x2, int y2, int x3, int y3, int xp, int yp)
{
    double xa = (x2 - x1);
    double ya = (y2 - y1);
    double xb = (x3 - x1);
    double yb = (y3 - y1);
    double xc = (xp - x1);
    double yc = (yp - y1);
    double d = 1.0 / (xa*yb - xb*ya);
    double k = d * (yb * xc - xb * yc);
    double m = d * (-ya * xc + xa * yc);
    return (k >= 0 && m >= 0)? 1 : 0;
}

int main(void)
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        int tmp = 1;
        tmp *= test(x1, y1, x2, y2, x3, y3, xp, yp);
        tmp *= test(x2, y2, x1, y1, x3, y3, xp, yp);
        tmp *= test(x3, y3, x1, y1, x2, y2, xp, yp);
        cout << ((tmp ==1)? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

class vector2d
{
public:
	vector2d(float vx, float vy) : x(vx), y(vy)
	{}
	void normalize()
	{
		float n = sqrt(x*x + y*y);
		x /= n;
		y /= n;	
	}
public:
	float x,y;
};

float dot(vector2d& v1, vector2d& v2)
{
	return v1.x*v2.x + v1.y*v2.y;
}

float cross(vector2d& v1, vector2d& v2)
{
	return v1.x*v2.y - v2.x*v1.y;
}

int main(int argc, char const *argv[])
{
	float x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF)
	{
		float miny = (y1 < y2) ? y1 : y2;
		miny = (miny < y3) ? miny : y3;
		if (miny == y2)
		{
			swap(x2, x1);
			swap(y2, y1);
		}
		else if (miny == y3)
		{
			swap(x3, x1);
			swap(y3, y1);
		}
		vector2d v1(x2-x1,y2-y1); v1.normalize();
		vector2d v2(x3-x1,y3-y1); v2.normalize();
		vector2d ve(1.0,0.0);
		bool ans = true;
		vector2d vp1(xp-x1,yp-y1);
		vector2d vp2(xp-x2,yp-y2);
		vector2d vp3(xp-x3,yp-y3);
		if (dot(ve,v1) < dot(ve,v2))
		{
			vector2d v2(x3-x2,y3-y2); v2.normalize();
			vector2d v3(x1-x3,y1-y3); v3.normalize();
			ans &= cross(v1, vp1) < 0;
			ans &= cross(v2, vp2) < 0;
			ans &= cross(v3, vp3) < 0;
		}
		else
		{
			vector2d v1(x3-x1,y3-y1); v1.normalize();
			vector2d v2(x1-x2,y1-y2); v2.normalize();
			vector2d v3(x2-x3,y2-y3); v3.normalize();
			ans &= cross(v1, vp1) < 0;
			ans &= cross(v2, vp2) < 0;
			ans &= cross(v3, vp3) < 0;
		}
		if (ans)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y  - b.x * a.y;
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) > 0 || cross_product(AB, CD) < 0)
      cout << "NO" << endl;
    else 
      cout << "YES" << endl;
  }
}

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;
		} //x=y y=-x
		for(int i=0;i<3;i++){
			printf("%lf\n",(tx[i%3]*ty[(i+1)%3])-(ty[i%3]*tx[(i+1)%3]));
			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++: //23
#include<iostream>
#include<complex>

using namespace std;

int main(){
  for(;;){
    complex<double> p[4];
    for(int i=0;i<4;i++){
      double x,y;
      if(!(cin>>x>>y))return 0;
      p[i]=complex<double>(x,y);
    }
    int s=0;
    for(int i=0;i<3;i++){
      complex<double> e=p[(i+1)%3]-p[i],c=p[3]-p[i];
      s|=(e.real()*c.imag()-e.imag()*c.real()>0)<<i;
    }
    cout<<((s==0||s==7)?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
const double EPS = 1.0e-9;
const double PI = acos(-1);
namespace std {
    bool operator < (const Point& a, const Point& b){
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b){
        push_back(a);
        push_back(b);
    }
};
double cross(const Point& a, const Point& b){
    return imag(conj(a) * b);
}
double dot(const Point& a, const Point& b) {
    return real(conj(a) * b);
}
bool input(vector<Point>& vP){
    rep(i, 3) cin >> vP[i].real() >> vP[i].imag();
    if(cin.eof())
      return false;
    else
      return true;
}
int main(){
    vector<Point> t(3);
    Point p;
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(input(t)){
        cin >> p.real() >> p.imag();
        bool is_IN = false;
        rep(i, 3){
            Point a = t[i] - p, b = t[(i + 1) % 3] - p;
            if(imag(a) > imag(b)) swap(a, b);
            if(imag(a) <= 0 && 0 < imag(b))
              if(cross(a, b) < 0) is_IN = !is_IN;
            if(cross(a, b) == 0 && dot(a, b) <= 0){
                is_IN = true;
                break;
            }
        }
        if(is_IN)
          cout << "YES" << endl;
        else
          cout << "NO" << endl;
    }
    return 0;
}