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<cstdio>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

#define ll long long
#define LL long long
#define ULL unsigned long long 
#define ull unsigned long long 
#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 int(x) int x;scanf("%d",&x);
#define double(x) double x;scanf("%lf",&x);
#define string(x) double string;cin>>x;

using namespace std;

int main()
{
	float x1, x2, x3, y1, y2, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{

		float x_max, x_min, y_max, y_min;
		x_max = max(x1, max(x2, x3));
		x_min = min(x1, min(x2, x3));
		y_max = max(y1, max(y2, y3));
		y_min = min(y1, min(y2, y3));

		if (xp < x_max&&xp > x_min&&yp > y_min&&yp < y_max) {
			cout << "YES\n";
		}
		else {
			cout << "NO\n";
		}
	}

	return 0;
}

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

double x1, y1, x2, y2, x3, y3, xp, yp;

int side(double p1_x, double p1_y, double p2_x, double p2_y){
	double n = xp*(p1_y - p2_y) + p1_x*(p2_y - yp) + p2_x*(yp - p1_y);
	if(n > 0) return 1; // left
	else if(n < 0) return -1; //right
	else return 0; //on_line
}

bool judge_in(){
	int pab = side(x1,y1,x2,y2);
	int pbc = side(x2,y2,x3,y3);
	int pca = side(x3,y3,x1,y1);

	if((pab > 0) && (pbc > 0) && (pca > 0)) return true;
	if((pab < 0) && (pbc < 0) && (pca < 0)) return true;
	return false;
}


int main(){
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		bool judge = judge_in();
		if(judge == true) cout << "YES" << endl;
		else if(judge == false) cout << "NO" << endl;
	}
}

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

#define fs first
#define sc second

using namespace std;

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
const D EPS=1e-12;


namespace std{
  bool operator<(const P &a, const P &b){
    return real(a)==real(b)?imag(a)<imag(b):real(a)<real(b);
  }
}

D dot(P x, P y){return real(conj(x)*y);}

D cross(P x, P y){return imag(conj(x)*y);}

int ccw(P a, P b, P c){
  b -= a; c -= a;
  if(cross(b, c) > EPS) return 1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b, c) < -EPS) return 2;
  if(abs(b) < abs(c)) return -2;
  return 0;
}

bool para(L a, L b){return abs(cross(a.fs - a.sc, b.fs-b.sc))<EPS;}

int main(){
    D x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >>  x1 >> y1 >> x2 >> y2 >>  x3>> y3>> xp >> yp){
    P A = P(x1, y1);
    P B = P(x2, y2);
    P C = P(x3, y3);
    P p = P(xp, yp);
    if(ccw(A, B, p) == ccw(B, C, p) && ccw(B, C, p) == ccw(C, A, p)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    }
    return 0;
}

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

using namespace std;

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

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		calc1 = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
		calc2 = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
		calc3 = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);

		if((calc1>0&&calc2>0&&calc3>0) || (calc1<0&&calc2<0&&calc3<0)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>

using namespace std;

typedef complex<double> P;

double dot(P p1,P p2){
	return p1.real() * p2.imag() - p1.imag() * p2.real();
}


int main(){

	double x1,x2,x3,y1,y2,y3;
	double xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P  p1(x1,y1),p2(x2,y2),p3(x3,y3),po(xp,yp);
		bool f = true;
		if( dot(p2-p1,p3-p1) * dot(p2-p1,po-p1) < 0)
			f = false;
		else if(dot(p3-p1,p2-p1) * dot(p3-p1,po-p1) < 0)
			f = false;

		cout << (f ? "YES" : "NO") << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

bool flag;
double x1, yt1, x2, y2, x3, y3, xp, yp;
double v[3][2];

double inpr(double v1[2], double v2[2]) {
	double ret = v1[0] * v2[0] + v1[1] * v2[1];
	return ret;
}

int main() {
	x2 = -123456;
	cin >> x1 >> yt1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;

	while (x2 != -123456) {
		flag = true;
		v[0][0] = -(y2 - yt1);
		v[0][1] = x2 - x1;		
		
		v[1][0] = x3 - x1;
		v[1][1] = y3 - yt1;

		v[2][0] = xp - x1;
		v[2][1] = yp - yt1;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) < 0) flag = false;
		
		v[0][0] = -(y3 - y2);
		v[0][1] = x3 - x2;		
		
		v[1][0] = x1 - x2;
		v[1][1] = yt1 - y2;

		v[2][0] = xp - x2;
		v[2][1] = yp - y2;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) < 0) flag = false;
		
		v[0][0] = -(yt1 - y3);
		v[0][1] = x1 - x3;		
		
		v[1][0] = x2 - x3;
		v[1][1] = y2 - y3;

		v[2][0] = xp - x3;
		v[2][1] = yp - y3;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) < 0) flag = false;

		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;

		x2 = -123456;
		cin >> x1 >> yt1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

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-6 && s * y1[0] + t * y1[1] - y2 < 1e-6){
		    flg = true;
		    break;
		}
	    }
		if(flg) break;
	    }
	    if(flg) cout << "YES" << endl;
	    else cout << "NO" << endl;

    }

    return 0;
}

C++: #include<stdio.h>
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)){
		bool ok1=true;
		bool ok2=true;
		if(x1*y4-x4*y1<0)ok1=false;
		else ok2=false;
		if(x2*y4-x4*y2<0)ok1=false;
		else ok2=false;
		if(x3*y4-x4*y3<0)ok1=false;
		else ok2=false;
		printf((ok1||ok2)?"NO\n":"YES\n");
	}
}