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 <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	double m = 0;
	bool flg = false;
	    double x1[] =  {x[2] - x[0],  x[1] - x[0]};
	    double y1[] = { y[2] - y[0] , y[1] - y[0]};
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    REP(i,1e3){
		REP(j,1e3){
		s = (double)i / 1e3;
		t = (double)j / 1e3;
		if(s * x1[0] + t * x1[1] - x2 < 1e-3 && s * y1[0] + t * y1[1] - y2 < 1e-3){
		    flg = true;
		    break;
		}
	    }
		if(flg) break;
	    }
	    if(flg) cout << "YES" << endl;
	    else cout << "NO" << endl;

    }

    return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double x[4], y[4], xp, yp;
	double vx, vy, vpx, vpy;
	double crossZ;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF)
	{
		bool ans = true;
		x[3] = x[0]; y[3] = y[0];
		for(int i = 0; i < 3; i++)
		{
			vx = x[i+1] - x[i];
			vy = y[i+1] - x[i];
			vpx = xp - x[i];
			vpy = yp - y[i];

			crossZ = vx * vpy - vy * vpx;
			printf("%lf\n", crossZ);
			if(crossZ < 0)
			{
				ans = false;
				break;
			}
		}
		cout << (ans?"YES":"NO") << endl;
	}
}

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};

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; }

#define X real()
#define Y imag()
typedef complex<double> P;
const double EPS = 1e-10;

double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

bool is_intersected(P a1, P a2, P b1, P b2) {
	return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < -EPS ) &&
		( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < -EPS );
}

int main() {
	double latte[4], beet[4];
	while (cin >> latte[0]) {
		rep(i, 4) {
			if (i == 0) cin >> beet[0];
			else cin >> latte[i] >> beet[i];
		}

		P a[3], r;

		rep(i, 3) {
			a[i] = P(latte[i], beet[i]);
		}

		r = P(latte[3], beet[3]);

		int ans = 1;
		int cnt = 0;
		rep(_, 4) {
			rep(i, 3) {
				cnt += is_intersected(a[i], a[(i + 1) % 3], r, P(100.1 * (_ & 2 ? 1 : -1), 100.1 * (_ & 1 ? 1 : -1)));
			}
			ans *= cnt;
		}

		cout << (ans ? "YES" : "NO") << endl;
	}
}

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

double x[4], y[4];

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

double T(int a, int b, int c)
{
	double A = l(a, b);
	double B = l(b, c);
	double C = l(c, a);
	double s = (A + B + C) / 2;
	return sqrt(s * (s - A) * (s - B) * (s - C));
}

int main()
{
	while (true){
		for (int i = 0; i < 4; i++){
			if (scanf("%lf %lf", &x[i], &y[i]) == EOF) return 0;
		}
		
		double S = T(0, 1, 3) + T(1, 2, 3) + T(2, 0, 3) - T(0, 1, 2);
		
		if (S == 0){
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	
	return 0;
}

C++: #include <stdio.h>

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

int main()
{
	for(;;) {
		double x[4], y[4];
		if (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
					x, y, x+1, y+1, x+2, y+2, x+3, y+3)==EOF) {
			return 0;
		}
		else {
			double cr1 = cr(x[3]-x[0], y[3]-y[0], x[3]-x[1], y[3]-y[1]);
			double cr2 = cr(x[3]-x[1], y[3]-y[1], x[3]-x[2], y[3]-y[2]);
			double cr3 = cr(x[3]-x[2], y[3]-y[2], x[3]-x[0], y[3]-y[0]);
			if (cr1*cr2>=0 && cr2*cr3>=0) printf("YES\n");
			else printf("NO\n");
		}
	}
}

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

double cross(complex<double> A, complex<double> B){
	return (conj(A)*B).imag();
}

int main(){
	while(true){
		complex<double> Points[3], P;
		double x,y;
		for(int i=0;i<3;i++){
			cin >> x >> y;
			Points[i]={x,y};
		}

		cin >> x >> y;
		P={x,y};

		if(!cin)break;

		int sum=0;
		for(int i=0;i<3;i++){
			sum += cross((Points[(i+1)%3]-Points[i]), (P-Points[i])) > 0;
		}
		cout << (sum==0||sum==3 ? "Yes":"No") << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stack>
#include <stdio.h>
using namespace std;
double a,b,c;//ax+by+c=0
double x[4],y[4];//p,1,2,3
void make_line(double x1,double y1,double x2,double y2){
	if(x1!=x2&&y1!=y2){
		a=(y1-y2)/(x1-x2);
		b=-1;
		c=-a*x1+y1;
	}else if(x1==x2){
		a=1;
		b=0;
		c=-x1;
	}else if(y1==y2){
		a=0;
		b=1;
		c=-y1;
	}
	return;
}
bool check(int p,int q,int r){
	make_line(x[p],y[p],x[q],y[q]);//line pq
	if((a*x[r]+b*y[r]+c)*(a*x[0]+b*y[0]+c)<=0)return false;
	return true;
}

int main()
{
	while(cin>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]>>x[0]>>y[0]){
		bool ans=true;
		ans&=check(1,2,3);
		ans&=check(2,3,1);
		ans&=check(3,1,2);
		printf(ans?"YES\n":"NO\n");
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
double x[3],y[3],xp,yp;
int solve(){
	int tes=0,i,j;
	for(i=0,j=2;i<3;j=i++){
		if(((yp>y[i]&&yp<=y[j])||(yp<=y[i]&&yp>y[j]))&&xp<=(x[i]-x[j])*(yp-y[i])/(y[i]-y[j])+x[i])
			tes++;
	}
	
	return tes%2==1;
}
int main(){
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		if(solve()==1)
			cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
	}
	return 0;
}