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<iostream>
#include<cmath>
using namespace std;
int main(){
  double x1,y1,x2,y2,x3,y3,px,py;

  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));
    cout<<s<<endl;

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));
    cout<<s1<<endl;

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));
    cout<<s2<<endl;

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));
    cout<<s3<<endl;

    if(s1==0.0||s2==0.0||s3==0.0)cout<<"NO"<<endl;
    else{
      if((s1+s2+s3)==s)cout<<"YES"<<endl;
      else  cout<<"NO"<<endl; 
    } 

  }
  return 0;
}

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

bool point(double x1, double y1, double x2, double y2, double x3, double y3, double px, double py){
	double a1 = (x2 != x1) ? (y2 - y1) / (x2 - x1) : 100000 * (((y2 - y1) < 0) * 2 - 1 );
	double a2 = (x3 != x1) ? (y3 - y1) / (x3 - x1) : 100000 * (((y3 - y1) < 0) * 2 - 1 );
	double ap = (px != x1) ? (py - y1) / (px - x1) : 100000 * (((py - y1) < 0) * 2 - 1 );
	
	if ((a1 >= ap && a2 <= ap) || (a1 <= ap && a2 >= ap))
		return true;
	else
		return false;
}

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py)
		puts((point(x1, y1, x2, y2, x3, y3, px, py) && point(x2, y2, x3, y3, x1, y1, px, py)) ? "YES" : "NO");

	return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;



int isPointInsidePolygon(vector<pair<double,double>> angle,pair<double,double> point){    //点が多角形の内側にあるかどうかを求める
    long angleSum=angle.size();
    int count=0;
    
    for(int i=0;i<angleSum;i++){
        double x1=angle[i].first;
        double y1=angle[i].second;
        double x2=angle[(i+1)%angleSum].first;
        double y2=angle[(i+1)%angleSum].second;
        double xp=point.first;
        double yp=point.second;
        
        double result=(x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        
        if(result<0)return 0;       //点は外側にある
        
        if(result==0)count+=2;
        else if(result>0)count++;
        
    }
    if(count==angleSum)return 2;    //点は内側にある
    else return 1;                  //点は周上にある
    
}


int main(){
    double a,b,c,d,e,f,g,h;
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        vector<pair<double,double>> angle;
        angle.pb(pair<double,double>(a,b));
        angle.pb(pair<double,double>(c,d));
        angle.pb(pair<double,double>(e,f));

        if(isPointInsidePolygon(angle,pair<double,double>(g,h))==0){
            cout<<"NO"<<endl;
        }
        else cout<<"YES"<<endl;
    }


    return 0;
}

C++: #include<iostream>
using namespace std;
struct Point { long double px, py; };
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double norm(Point a) { return a.px*a.px + a.py*a.py; }
Point Minus(Point p1, Point p2) {
	Point A1; 
	A1.px = p1.px - p2.px;
	A1.py = p1.py - p2.py;
	return A1;
}
int ccw(Point p0, Point p1, Point p2) {
	Point a = Minus(p1, p0), b = Minus(p2, p0);
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
bool its(Point p1, Point p2, Point p3, Point p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
Point P1, P2, P3, P4;
int main() {
	while (cin >> P1.px >> P1.py >> P2.px >> P2.py >> P3.px >> P3.py >> P4.px >> P4.py) {
		int OK = 0;
		if (its(P1, P2, P3, P4) == true) { OK = 1; }
		if (its(P1, P3, P2, P4) == true) { OK = 1; }
		if (its(P1, P4, P2, P3) == true) { OK = 1; }
		if (OK == 1) { cout << "NO" << endl; }
		else { cout << "YES" << endl; }
	}
}

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

	return 0;
}

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