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 <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

struct Vector {
	double x;
	double y;
};

#define Vectex Vector;

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

int main() {
	double x1, y1, x2, y2, x3, y3, px, py; 
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py) {
		Vector A, B, C, P;
		A.x = x1; A.y = y1;
		B.x = x2; B.y = y2;
		C.x = x3; C.y = y3;
		P.x = px; P.y = py;

		Vector AB = sub_vector(B, A);
		Vector BP = sub_vector(P, B);
		Vector BC = sub_vector(C, B);
		Vector CP = sub_vector(P, C);
		Vector CA = sub_vector(A, C);
		Vector AP = sub_vector(P, A);

		double c1 = AB.x * BP.y - AB.y * BP.x;
		double c2 = BC.x * CP.y - BC.y * CP.x;
		double c3 = CA.x * AP.y - CA.y * AP.x;

		if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("YES\n");
		else printf("NO\n"); 
	}	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
long double x;
long double x1,y1,x2,y2,x3,y3,xp,yp;
int S=0;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
{
	if(y1<y2&&y3<y2)
	{
	for(double i=x1;i<=x3;i+=0.0001)
{
x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2<(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
}
}
}
else if(y1>y2&&y1>y1)
{
for(long double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2<(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2>(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
	}	
	}	
}
else if(y3>y1&&y3>y2)
{
	for(long double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1<(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2>(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;
}
}
}

{
if(S<1)
{
 	cout<<"NO"<<endl;
 }
}
}
return 0;
}

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

class Vector2{
public:
	Vector2(){}
	Vector2( double aX, double aY ) : x( aX ), y( aY ){}

	double cross( Vector2& a ){
		return ( x * a.y ) - ( y * a.x );
	}

	double x;
	double y;
};

int main(){
	Vector2 p0, p1, p2, q;

	while ( cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> q.x >> q.y ){
		bool isInner = false;
		Vector2 ab( p1.x - p0.x, p1.y - p0.y );
		Vector2 bc( p2.x - p1.x, p2.y - p1.y );
		Vector2 ca( p0.x - p2.x, p0.y - p2.y );
		Vector2 ap( q.x - p0.x, q.y - p0.y );
		Vector2 bp( q.x - p1.x, q.y - p1.y );
		Vector2 cp( q.x - p2.x, q.y - p2.y );

		if( (ab.cross( ap ) > 0 ) &&
			(bc.cross( bp ) > 0 ) &&
			(ca.cross( cp ) > 0 ) ){
			isInner = true;
		}

		cout << ( isInner ? "Yes" : "No" ) << endl;
	}

	return 0;
}

C++: #include <iostream>

struct Vector2D {
	double x, y;

	Vector2D() : x(0.0), y(0.0) {}
	Vector2D(double init_x, double init_y) : x(init_x), y(init_y) {}
	Vector2D& operator-=(const Vector2D& rhs)
	{
		x -= rhs.x;
		y -= rhs.y;
		return *this;
	}
};

Vector2D operator-(const Vector2D& lhs, const Vector2D& rhs)
{
	return Vector2D(lhs) -= rhs;
}

int main()
{
	Vector2D p1, p2, p3, pp;
	while (std::cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> pp.x >> pp.y) {
		// p3-based vectors
		Vector2D r1(p1 - p3), r2(p2 - p3), rp(pp - p3);

		// rp = a1 * r1 + a2 * r2
		double det = r1.x * r2.y - r2.x * r1.y;
		double a1 = ( r2.y * rp.x - r2.x * rp.y) / det;
		double a2 = (-r1.y * rp.x + r1.x * rp.y) / det;

		if (a1 > 0 && a2 > 0 && a1 + a2 < 1.0) {
			std::cout << "YES" << std::endl;
		} else {
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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

using namespace std;

typedef struct Point {
    double x;
    double y;
} POINT;

double area(Point l, Point m, Point n);

int main() {
    Point a, b, c, p;
    while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y) {
        //cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y;
        //cout << area(a,b,c) << endl;
        double diff = area(a, b, c) - (area(a, b, p) + area(b, c, p) + area(c, a, p));
        //cout << diff << endl;
        if (fabs(diff) < 0.001) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        } 
    }
}

double area(Point l, Point m, Point n) {
    return fabs( (m.x - l.x) * (n.y - l.y)
            - (m.y - l.y) * (n.x - l.x)) * 0.5;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

double x[3], y[3], xp, yp;

double cross(int a, int b){
    return x[a] * y[b] - y[a] * x[b];
}

signed main(){
    while(1){
        rep(i, 0, 3) cin >> x[i] >> y[i];
        cin >> xp >> yp;
        if(cin.eof()) break;
        rep(i, 0, 3){
            x[i] -= xp;
            y[i] -= yp;
        }
        bool f = true;
        rep(i, 0, 3){
            if(cross(i, (i + 1) % 3) < 0) f = false; 
        }
        cout << (f ? "YES" : "NO") << endl;
    }
}

C++: #include<iostream>
#include<vector>
int main()
{
	std::vector<bool>result;
	while (true)
	{
		double x1, y1, x2, y2, x3, y3, xp, yp;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
		if (!std::cin)
		{
			break;
		}
		double k = ((x2 - x3)*(y3 - y1) - (x3 - x1)*(y2 - y3)) / ((x2 - x3)*(yp - y1) - (xp - x1)*(y2 - y3));
		double s = ((x1 - x3)*(yp - y1) - (xp - x1)*(y1 - y3)) / ((x2 - x3)*(yp - y1) - (xp - x1)*(y2 - y3));
		result.push_back(1 < k && 0 < s && s < 1);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include<cstdio>

using namespace std;
 
#define god(x1,y1,x2,y2,x3,y3) x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)

int main(){
	double x1,y1,x2,y2,x3,y3,ax,ay;

	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&ax,&ay) != EOF){
		if(god(x1,y1,x2,y2,x3,y3) > 0.0 && god(ax,ay,x1,y1,x2,y2) > 0.0 &&
			god(ax,ay,x3,y3,x1,y1) > 0.0 &&  god(ax,ay,x2,y2,x3,y3) > 0.0){
				printf("YES\n");
		}
		else if(god(x1,y1,x2,y2,x3,y3) < 0.0 && god(ax,ay,x1,y1,x2,y2) < 0.0 &&
			god(ax,ay,x3,y3,x1,y1) < 0.0 &&  god(ax,ay,x2,y2,x3,y3) < 0.0){
				printf("YES\n");
		}
		else printf("NO\n");
	}
	return 0;
}