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>

int sign(double x);

int main()
{
    double x1, y1, x2, y2, x3, y3;
    double xp, yp;

    while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double vec12_x_vec1p = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        double vec23_x_vec2p = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        double vec31_x_vec3p = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        int judge = sign(vec12_x_vec1p) + sign(vec23_x_vec2p)
                  + sign(vec31_x_vec3p);

        if (judge == 1 + 1 + 1 || judge == -1 - 1 - 1) {
            std::cout << "YES" << std::endl;
        } else {
            std::cout << "NO" << std::endl;
        }
    }

    return 0;
}

int sign(double x)
{
    return ((x >= 0)? 1: (-1));
}

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

bool solve(double a1, double b1, double a2, double b2, double x, double y)
{
	if((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1) > max((x-a1)*(x-a1)+(y-b1)*(y-b1),(a2-x)*(a2-x)+(b2-y)*(b2-y)))
		return true;
	return false;
}

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		if(solve(x1,y1,x2,y2,xp,yp && solve(x2,y2,x3,y3,xp,yp) && solve(x3,y3,x1,y1,xp,yp)))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

template <typename T> 
class Point
{
private:
    T x;
    T y;
public:
    Point(T x=0, T y=0): x(x), y(y) {}
    T getx() const {return x;}
    T gety() const {return y;}

    static T norm2(Point<T> a, Point<T> b) 
    {
        return std::pow(a.x-b.x, 2) + std::pow(a.y-b.y, 2);
    }
};

template <typename T>
void distance_argmax(std::vector<Point<T>> ps, int& a, int& b)
{
    T max_d{-1};
    for(int i=0; i<ps.size(); ++i)
    {
        for(int j=i; j<ps.size(); ++j)
        {
           if(i != j)
           {
               T d = Point<T>::norm2(ps[i], ps[j]);
               if(d > max_d)
               {
                   a = i;
                   b = j;
                   max_d = d;
               }
           }
        }
    }
}

int main()
{
    double x{0}; double y{0};
    std::vector<Point<double>> points(4);
    int i = 0;

    while(std::cin >> x >> y)
    {
        int idx = i % points.size();
        points[idx] = Point<double>(x, y);
        //std::cout << points[idx].getx() << " " << points[idx].getx() << std::endl;
        if(idx == (points.size()-1))
        {
            int a, b;
            distance_argmax<double>(points, a, b);
            auto ans = a!=points.size()-1 && b!=points.size()-1 ? "YES" : "NO";
            std::cout << ans << std::endl;;
        }
        ++i;
    }

    return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename T>
constexpr T det2(const T &a1, const T &a2, const T &b1, const T &b2) {
  return a1 * b2 - b1 * a2;
}

void solve() {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    double a = det2(xp - x1, yp - y1, x2 - x1, y2 - y1),
           b = det2(xp - x2, yp - y2, x3 - x2, y3 - y2),
           c = det2(xp - x3, yp - y3, x1 - x3, y1 - y3);
    cout << ((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0) ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pt", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		if (str.empty() ){
			break;
		} // end if

		vector <double> tpx (3, 0.);
		vector <double> tpy (3, 0.);
		double px = 0.;
		double py = 0.;
		int i;
	
		stringstream ss(str);
		for (i = 0; i < 3; ++i){
			ss >> tpx[i] >> tpy[i];
		} // end for
		ss >> px >> py;
		 
		vector <double> vx(3, 0.);
		vector <double> vy(3, 0.);
		vector <double> vpx(3, 0.);
		vector <double> vpy(3, 0.);

		for (i = 0; i < 3; ++i){
			vx[i] = tpx[(i+1) % 3] - tpx[i];
			vy[i] = tpy[(i+1) % 3] - tpy[i];
		} // end for
		for (i = 0; i < 3; ++i){
			vpx[i] = px - tpx[i];
			vpy[i] = py - tpy[i];
		} // end for
		
		vector <double> D(3, 0.);
		for (i = 0; i < 3; ++i){
			D[i] = (vx[i]*vpy[i] - vy[i]*vpx[i]);
		} // end for

		for (i = 0; i < 3; ++i){
			if (D[i] > 0.0){
				continue;
			}else{
				cout << "NO" << endl;
				break;
			} // end if
		} // end for
		if (i == 3){
			cout << "YES" << endl;
		} // end if 
	
	} // end while
		
	return 0;
}

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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define vP vectorProduct
#define EPS 1e-9

double vectorProduct(double ax,double ay,double bx,double by){return ax*by-ay*bx;}

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(vP(x2-x1,y2-y1,xp-x1,yp-y1) + EPS > 0 &&
       vP(x3-x2,y3-y2,xp-x2,yp-y2) + EPS > 0 &&
       vP(x1-x3,y1-y3,xp-x3,yp-y3) + EPS > 0)
      printf("YES\n");
    else printf("NO\n");
  }

  return 0;
}