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

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    ld x1, x2, x3, xp, y1, y2, y3, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        auto z1 = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2);
        auto z2 = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3);
        auto z3 = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1);
        auto isIn = z1 != 0 && z2 != 0 && z3 != 0;
        if (isIn) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

C++: //A Point in a Triangle
#include<bits/stdc++.h>
using namespace std;

//(x1, y1)と(x2, y2)の距離
double dis(double x1, double y1, double x2, double y2){
  return sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0));
}

//ヘロンの公式
double helon(double x1, double y1, double x2, double y2, double x3, double y3){
  double a=dis(x1, y1, x2, y2), b=dis(x2, y2, x3, y3), c=dis(x3, y3, x1, y1);
  double s=(a+b+c)/2.0;
  return sqrt(s*(s-a)*(s-b)*(s-c));
}

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){
    double hx1, hy1, hx2, hy2, hx3, hy3;//それぞれの点の中点
    hx1=(x1+x2)/2.0, hx2=(x2+x3)/2.0, hx3=(x3+x1)/2.0;
    hy1=(y1+y2)/2.0, hy2=(y2+y3)/2.0, hy3=(y3+y1)/2.0;
    double s=helon(hx1, hy1, hx2, hy2, hx3, hy3);
    if(s>helon(xp, yp, hx2, hy2, hx3, hy3) && s>helon(hx1, hy1, xp, yp, hx3, hy3) && s>helon(hx1, hy1, hx2, hy2, xp, yp)) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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

bool m(double a1, double b1, double a2, double b2){
	bool key;

	if(a1==0){
		if(a2==0) key=true;
		else key=false;
	}
	else{
		if(a2==0) key=false;
		else{
			if(b1/a1==b2/a2) key=true;
			else key=false;		
		}
	}

	return key;
}

int main(){
	double x1,x2,x3,xp,y1,y2,y3,yp;
	while( scanf(" %lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF ){
		
		//(x1,y1)が原点に来るように平行移動
		x2-=x1; y2-=y1; x3-=x1; y3-=y1; xp-=x1; yp-=y1;
		x1-=x1; y1-=y1;
		
		//printf(" %lf %lf %lf %lf %lf %lf %lf %lf\n", x1, y1, x2, y2, x3, y3, xp, yp);
		
		bool ans;
		
		//(xp,yp)が辺の延長線上にあるとき
		if(m(x2,y2,xp,yp) || m(x3,y3,xp,yp)){
			ans=false;
		}
		else{
			double p, q;
			
			if(x2!=0){
				q=(yp-xp*y2/x2)/(y3-x3*y2/x2);
				p=(xp-q*x3)/x2;
			}
			else{
				q=xp/x3;
				p=(yp-q*y3)/y2;
			}
		
			//printf("p=%lf, q=%lf\n",p ,q);
		
			if(0<p && p<1 && 0<q && q<1 && p+q<1) ans= true;
			else ans=false;
		}
		
		if(ans) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
double x[4],y[4],px,py,ax,ay,bx,by;
int main()
{
	while(true)
	{
		for(int i = 1;i<=3;i++){cin >> x[i];cin >> y[i];}
		if(cin.eof())break;
		cin >> px;
		cin >> py;
		double m,n,s;
		ax = x[2]-x[1];
		ay = y[2]-y[1];
		bx = x[3]-x[1];
		by = y[3]-y[1];
		double det = ax*by-ay*bx;
		m = (by*px-bx*py)/det;
		n = (-ay*px+ax*py)/det;
		if((m+n)<1&&m>0 && n > 0&& m<1 && n < 1) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

class Point2d {
private:
	double x, y;
public:
	void set(double x, double y) { this->x = x; this->y = y; }
	double X() { return this->x; }
	double Y() { return this->y; }
	Point2d operator+(Point2d &p) {
		Point2d result;
		result.set(this->x + p.X(), this->y + p.Y());
		return result;
	}
	Point2d operator-(Point2d &p) {
		Point2d result;
		result.set(this->x - p.X(), this->y - p.Y());
		return result;
	}
	Point2d operator*(double a) {
		Point2d result;
		result.set(this->x * a, this->y * a);
		return result;
	}
	/* ¼ü p1p2 Æüª q1q2 ªðíÁÄ¢êÎ true ðÔ· */
	static bool interectLine(Point2d &p1, Point2d &p2, Point2d &q1, Point2d &q2) {
		Point2d p = p2 - p1, pq1 = q1 - p1, pq2 = q2 - p1;
		double tmp1, tmp2, t1z;
		tmp1 = p.X() * pq1.Y() - p.Y() * pq1.X();	/* p Æ pq1 ÌOÏÌz¬ª */
		tmp2 = p.X() * pq2.Y() - p.Y() * pq2.X();	/* p Æ pq2 ÌOÏÌz¬ª */
		t1z = tmp1 * tmp2;	/* OÏÌü«ªá¦Î¼ü p1p2 Æüª q1q2 ÍðíÁÄ¢é */
		return t1z <= 0.;
	}
	/* üª p1p2 Æüª q1q2 ªðíÁÄêÎ true ðÔ· */
	static bool interect(Point2d &p1, Point2d &p2, Point2d &q1, Point2d &q2) {
		return interectLine(p1, p2, q1, q2) && interectLine(q1, q2, p1, p2);
	}
	/* _ p ª¼ü q1q2 ãÉ êÎ true ðÔ· */
	static bool pointInLine(Point2d &p, Point2d &q1, Point2d &q2) {
		Point2d l1 = q1 - p, l2 = q2 - p;
		double crossZ = l1.X() * l2.Y() - l1.Y() * l2.X();
		return crossZ == 0.;
	}
};

int main() {
	using namespace std;
	double x[3], y[3], xp, yp, xq, yq;
	Point2d ptR[3], ptP, ptQ;
	int count;

	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
		for (int i = 0; i < 3; ++i) {
			ptR[i].set(x[i], y[i]);
		}
		ptP.set(xp, yp);
		xq = x[0];
		for (int i = 1; i < 3; ++i) {
			if (x[i] > xq) { xq = x[i]; }
		}
		xq += (double)(rand() % 100 + 10) * 0.1;
		for (;;) {
			yq = yp + (double)((rand() % 100) - 50) * 0.1;
			ptQ.set(xq, yq);

			bool flag = false;
			for (int i = 0; i < 3; ++i) {
				if (Point2d::pointInLine(ptR[i], ptP, ptQ)) { flag = true; }
			}
			if (!flag) { break; }
		}

		count = 0;
		for (int i = 0; i < 3; ++i) {
			if (Point2d::interect(ptP, ptQ, ptR[i], ptR[(i + 1) % 3])) {
				++count;
			}
		}
		cout << (((count & 1) != 0) ? "YES" : "NO") << endl;
	}
	return 0;
}

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

struct vec2
{
	double x;
	double y;
};

//2次元ベクトル外積
double Outer_products(const vec2 (&a)[2]) {
	return (a[0].x * a[1].y - a[0].y * a[1].x);
}

//符号判定  '+' is (1) , '-' is (-1) , '0' is (0)
double Sign(const double &p) {
	return (p > 0) - (p < 0);
}

//３つの引数の符号が同じ場合true
bool Is_all_three(const double (&check)[3]) {
	int cnt = 0;
	for (int i = 0; i < 3; ++i) {
		cnt += Sign(check[i]);
	}
	return (abs(cnt) == 3) ? true : false;
}

int main() {
	vec2 ver[3];
	vec2 p;
	vec2 tmp[2];
	double check[3];

	while (true) {
		if (cin.eof())break;
		for (int i = 0; i < 3; ++i) {
			cin >> ver[i].x;
			cin >> ver[i].y;
		}
		cin >> p.x >> p.y;

		for (int i = 0; i < 3; ++i) {
			tmp[0].x = ver[(i + 1) % 3].x - ver[i].x;
			tmp[0].y = ver[(i + 1) % 3].y - ver[i].y;
			tmp[1].x = p.x - ver[i].x;
			tmp[1].y = p.y - ver[i].y;
			check[i] = Outer_products(tmp);
		}
		if (Is_all_three(check)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	
	return 0;
}