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++: // 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

bool existIntersection(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
  return ((x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3)) *
           ((x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4)) <
         0;
}

void solve() {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    if ((x1 - x3) * (y1 - y2) == (x1 - x2) * (y1 - y3)) {
      cout << "NO" << endl;
      continue;
    }
    double xg = (x1 + x2 + x3) / 3;
    double yg = (y1 + y2 + y3) / 3;
    if (existIntersection(x1, y1, x2, y2, xp, yp, xg, yg)) {
      cout << "NO" << endl;
      continue;
    }
    if (existIntersection(x2, y2, x3, y3, xp, yp, xg, yg)) {
      cout << "NO" << endl;
      continue;
    }
    if (existIntersection(x3, y3, x1, y1, xp, yp, xg, yg)) {
      cout << "NO" << endl;
      continue;
    }
    cout << "YES" << endl;
  }
}

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

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

  while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){

    if(((( x1 <= xp && xp <= x2 )||( x2 <= xp && xp <= x1 )) &&(( y1 <= yp && yp <= y2 )||( y2 <= yp && yp <= y1 )))||((( x1 <= xp && xp <= x3 ) || ( x3 <= xp && xp <= x1))&&(( y1 <= yp && yp <= y3 )||(y3 <= yp <= y1 )))||((( x2 <= xp && xp <= x3 ) || ( x3 <= xp && xp <= x2))&&(( y2 <= yp && yp <= y3 )||(y3 <= yp <= y2 )))) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>

using namespace std;

class vec2d
{
public:
	vec2d() : x(0.0), y(0.0) {};
	vec2d(double _x, double _y) : x(_x), y(_y) {};
	double x, y;
	vec2d operator-(const vec2d &);
	double vec(const vec2d &);
};

vec2d vec2d::operator-(const vec2d &b)
{
	vec2d r;
	r.x = x - b.x;
	r.y = y - b.y;
	return r;
}

double vec2d::vec(const vec2d &b)
{
	return x * b.y - y * b.x;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(1)
	{
		if (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
		{
			vec2d a(x1, y1), b(x2, y2), c(x3, y3), p(xp, yp);

			vec2d ab, bc, ca, ap, bp, cp;
			ab = a - b;
			bp = b - p;
			bc = b - c;
			cp = c - p;
			ca = c - a;
			ap = a - p;

			double c1, c2, c3;
			c1 = ab.vec(bp);
			c2 = bc.vec(cp);
			c3 = ca.vec(ap);

			if ((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0))
				cout << "YES" << '\n';
			else
				cout << "NO" << '\n';
		}
		else
			break;
	}

	return 0;
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

#define EPS 1e-10

struct point{
	double x;
	double y;
};
struct line{
	double a; // 傾き
	double b; // 切片
};

int recog_point_place( const point& a , const point&b , const point& c );
bool get_line( const point& a , const point& b , line *a_b );

int main(void)
{
	point a, b, c, p;
	int num_of_data;

	while( scanf("%d", &num_of_data ) != EOF )
	{
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y;

		int result_ab_c = recog_point_place( a , b , c );
		int result_ab_p = recog_point_place( a , b , p );
		int result_bc_a = recog_point_place( b , c , a );
		int result_bc_p = recog_point_place( b , c , p );
		int result_ca_b = recog_point_place( c , a , b );
		int result_ca_p = recog_point_place( c , a , p );

		if( result_ab_c == result_ab_p && result_bc_a == result_bc_p && result_ca_b == result_ca_p ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

int recog_point_place( const point& a , const point&b , const point& c )
{
	line a_b;

	bool result = get_line( a , b , &a_b );
	if( result == false )
	{
		if( (a.x + b.x)/2 < c.x ) return 1; // 点が直線より右にある場合に1をリターン
		else return 0;
	}
	else if( result == true )
	{
		if( c.y > a_b.a * c.x + a_b.b ) return 1; // 点が直線より上にある場合に1をリターン
		else return 0;
	}

}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS )
	{
		return false;
	}
	else
	{
		a_b->a = (a.y - b.y) / (a.x - b.x);
		a_b->b = a.y - a_b->a * a.x;

		return true;
	}
}

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

using namespace std;


int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double dist1,dist2,dist3,p_dist1,p_dist2,p_dist3;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		//(x3,y3)????????¢:(y2-y1)*x+(x1-x2)*y+(y1*(x2-x1)-x1*(y2-y1))
		//(x1,y1)????????¢:(y2-y3)*x+(x3-x2)*y+(y3*(x2-x3)-x3*(y2-y3))
		//(x2,y2)????????¢:(y3-y1)*x+(x1-x3)*y+(y1*(x3-x1)-x1*(y3-y1));
		dist1 = fabs((y2-y3)*x1+(x3-x2)*y1+(y3*(x2-x3)-x3*(y2-y3)))/sqrt((y2-y3)*(y2-y3)+(x3-x2)*(x3-x2));
		dist2 = fabs((y3-y1)*x2+(x1-x3)*y2+(y1*(x3-x1)-x1*(y3-y1)))/sqrt((y3-y1)*(y3-y1)+(x1-x3)*(x1-x3));
		dist3 = fabs((y2-y1)*x3+(x1-x2)*y3+(y1*(x2-x1)-x1*(y2-y1)))/sqrt((y2-y1)*(y2-y1)+(x1-x2)*(x1-x2));

		p_dist1 = fabs((y2-y3)*xp+(x3-x2)*yp+(y3*(x2-x3)-x3*(y2-y3)))/sqrt((y2-y3)*(y2-y3)+(x3-x2)*(x3-x2));
		p_dist2 = fabs((y3-y1)*xp+(x1-x3)*yp+(y1*(x3-x1)-x1*(y3-y1)))/sqrt((y3-y1)*(y3-y1)+(x1-x3)*(x1-x3));
		p_dist3 = fabs((y2-y1)*xp+(x1-x2)*yp+(y1*(x2-x1)-x1*(y2-y1)))/sqrt((y2-y1)*(y2-y1)+(x1-x2)*(x1-x2));

		if(p_dist1 != 0 && p_dist2 != 0 && p_dist3 != 0 && p_dist1 < dist1 && p_dist2 < dist2 && p_dist3 < dist3){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x1,x2,x3,y1,y2,y3,x,y;
  double a,b,c,d,ans;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y){
    a=x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);
    b=x*(y1-y2)+x1*(y2-y)+x2*(y-y1);
    c=x*(y2-y3)+x2*(y3-y)+x3*(y-y2);
    d=x*(y3-y1)+x3*(y1-y)+x1*(y-y3);
    if((a<0 && b<0 && c<0 && d<0) || (a>0 && b>0 && c>0 && d>0)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}