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 <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

bool ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		vector<double> x(3),y(3);
		rep(i,3)
			iss>>x[i]>>y[i];
		double xp,yp;
		iss>>xp>>yp;
		
		bool in_triangle=true;
		rep(i,3)
			if(ccw(x[0],y[0],x[1],y[1],xp,yp)!=ccw(x[1],y[1],x[2],y[2],xp,yp))
				in_triangle=false;
		
		cout<<(in_triangle?"YES":"NO")<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(void) {
  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) {
    int s, t, u;
    x1 -= xp, x2 -= xp, x3 -= xp;
    y1 -= yp, y2 -= yp, y3 -= yp;
    //printf("%f %f %f %f %f %f\n", x1, y1, x2, y2, x3, y3);
    s = x1 * y2 - x2 * y1;
    if(!s) {
      printf("NO\n");
      continue;
    }
    s = s < 0 ? 0 : 1;
    t = x2 * y3 - x3 * y2;
    if(!t) {
      printf("NO\n");
      continue;
    }
    t = t < 0 ? 0 : 1;
    u = x3 * y1 - x1 * y3;
    if(!u) {
      printf("NO\n");
      continue;
    }
    u = u < 0 ? 0 : 1;
    //printf("%d %d %d\n", s, t, u);
    if(!s^t && !t^u) printf("YES\n");
    else printf("NO\n");
  }
  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-y2)-(y2-y1)*(xp-x2);
		calc2 = (x3-x2)*(yp-y3)-(y3-y2)*(xp-x3);
		calc3 = (x3-x1)*(yp-y1)-(y3-y1)*(xp-x1);

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

C++: #include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
double x[4],y[4];
string ok;

double cross_product(xy_t a,xy_t b) {
  return (conj(a)*b).imag()/2.0;
}

int main () {
  while (true) {
    for (int i=0; i<4; ++i) {
      cin >> x[i] >> y[i];
    }
    if (!cin) break;
    xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]),p(x[3], y[3]);
    double pab = cross_product(a-p,b-p);
    double pbc = cross_product(b-p,c-p);
    double pca = cross_product(c-p,a-p);
    if ((pab>0&&pbc>0&&pca>0)||(pab<0&&pbc<0&&pca<0)) {
      ok = "YES";
    }
    else {
      ok = "NO";
    }
    cout << ok << endl;
  }
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cctype>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<algorithm>
using namespace std;

#define LL long long
#define LLU unsigned long long
#define re return(0)
#define pi 2*acos(0.0)
#define MAX 120

const int infinity=100000000000LL;

double Edge(double x1,double x2,double y1,double y2)
{
    return sqrt((x1-y1)*(x1-y1)+(x2-y2)*(x2-y2));
}

int main()
{
    double p1,p2,q1,q2,r1,r2,x1,x2;
    while(cin>>p1>>p2>>q1>>q2>>r1>>r2>>x1>>x2)
    {
        double a,b,c,s,area,new_area,m,n,o;
        new_area=0;
        a=Edge(p1,p2,q1,q2);
        b=Edge(q1,q2,r1,r2);
        c=Edge(r1,r2,p1,p2);
        s=(a+b+c)/2;
        area=s*(s-a)*(s-b)*(s-c);
        area=sqrt(area);
        m=Edge(x1,x2,p1,p2);
        n=Edge(x1,x2,q1,q2);
        o=Edge(x1,x2,r1,r2);
        s=(a+m+n)/2;
        new_area+=sqrt(s*(s-a)*(s-m)*(s-n));
        s=(b+n+o)/2;
        new_area+=sqrt(s*(s-b)*(s-o)*(s-n));
        s=(c+o+m)/2;
        new_area+=sqrt(s*(s-c)*(s-m)*(s-o));
        if(area==new_area) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    re;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

struct point {
	double x, y;
}A, B, C, P;

double crossProd(point A, point B, point C) {
	return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

int main() {
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &P.x, &P.y) != EOF) {
		if (crossProd(A, B, P) > 0 && crossProd(B, C, P) > 0 && crossProd(C, A, P) > 0   //点在三角形内 
		 || crossProd(A, P, B) > 0 && crossProd(B, P, C) > 0 && crossProd(C, P, A) > 0) puts("YES");
		else puts("NO"); //点在三角形外 
	}
	return 0;
}

C++: /*by SilverN*/
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
struct point{
    double x,y;
    point operator - (point rhs){return (point){x-rhs.x,y-rhs.y};}
    point operator + (point rhs){return (point){x+rhs.x,y+rhs.y};}
}p[5];
double Cross(point a,point b){return a.x*b.y-a.y*b.x;}
bool judge(){
	if(Cross(p[3]-p[1],p[2]-p[1])<0)swap(p[3],p[2]);
	if(Cross(p[2]-p[1],p[4]-p[1])>0)return 0;
	if(Cross(p[3]-p[2],p[4]-p[2])>0)return 0;
	if(Cross(p[1]-p[3],p[4]-p[3])>0)return 0;
	return 1;
}
int main(){
	int i,j;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
		&p[1].x,&p[1].y,&p[2].x,&p[2].y,&p[3].x,&p[3].y,&p[4].x,&p[4].y)!=EOF){
		if(judge())printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}