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;

#define EPS 1e-10

double heron(double a,double b,double c){
      double s = (a + b + c) / 2;

      return sqrt(s * (s - a) * (s - b) * (s - c));
}

int main() {
    double x[3],y[3],xp,yp,a,b,c,d,e,f,sq,sqd,sqe,sqf;
    
    while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
        a = sqrt(pow((x[1] - x[0]),2) + pow((y[1] - y[0]),2));
        b = sqrt(pow((x[2] - x[0]),2) + pow((y[2] - y[0]),2));
        c = sqrt(pow((x[2] - x[1]),2) + pow((y[2] - y[1]),2));

        sq = heron (a,b,c);

        d = sqrt(pow((xp - x[0]),2) + pow((yp - y[0]),2));
        e = sqrt(pow((xp - x[1]),2) + pow((yp - y[1]),2));
        f = sqrt(pow((xp - x[2]),2) + pow((yp - y[2]),2));

        sqd = heron(e,a,d);
        sqe = heron(d,b,f);
        sqf = heron(f,c,e);


        cout << sq << endl << sqd + sqe + sqf<< endl;
        if(abs(sq - (sqd + sqe + sqf)) < EPS){
            cout << "YES" << endl;
            }
        else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int main()
{
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
  double s;
  double a,b,c;
  a =sqrt(pow(x1-x2,2)+pow(y1-y2,2));
  c =sqrt(pow(x1-x3,2)+pow(y1-y3,2));
  b =sqrt(pow(x2-x3,2)+pow(y2-y3,2));
  s =(a+b+c)/2;
  double abcS =sqrt(s*(s-a)*(s-b)*(s-c));
  double ap,bp,cp;
  ap =sqrt(pow(x1-xp,2)+pow(y1-yp,2));
  bp =sqrt(pow(x2-xp,2)+pow(y2-yp,2));
  cp =sqrt(pow(x3-xp,2)+pow(y3-yp,2));
  s =(ap+bp+a)/2;
  double abpS =sqrt(s*(s-ap)*(s-bp)*(s-a));
  s =(bp+cp+b)/2;
  double bpcS =sqrt(s*(s-bp)*(s-cp)*(s-b));
  s =(ap+cp+c)/2;
  double apcS =sqrt(s*(s-ap)*(s-cp)*(s-c));
  double var =abcS-(abpS+bpcS+apcS);
  if((var<=0.001&&var>=-0.01))
     var=0.0;
  if(var==0.0)
    cout <<"YES"<<endl;
  else
    cout <<"NO"<<endl;
  
  }
  return 0;
}

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

struct TPoint
{
    double x;
    double y;
    TPoint(){}
    TPoint(int X, int Y)
     : x(X), y(Y){}
};
struct TTriangle
{
    TPoint p1;
    TPoint p2;
    TPoint p3;
};
typedef TPoint TVector;
TVector Vector(const TPoint& A, const TPoint& B)
{
    return TVector(B.x - A.x, B.y - A.y);
    // return TVector(A.x - B.x, A.y - B.y);
}
double Cross(const TVector& A, const TVector& B)
{
    return A.x * B.y - B.x * A.y;
}

bool IsContain(const TTriangle& Tri, const TPoint& P)
{
    bool s1 = Cross(Vector(Tri.p1, Tri.p2), Vector(Tri.p1, P)) < 0;
    bool s2 = Cross(Vector(Tri.p2, Tri.p3), Vector(Tri.p2, P)) < 0;
    bool s3 = Cross(Vector(Tri.p3, Tri.p1), Vector(Tri.p3, P)) < 0;
    std::cout << s1 << s2 << s3 << std::endl;
    return s1 == s2 && s2 == s3;
}
int main()
{
    while(true){
        TTriangle Tri;
        TPoint P;
        std::cin >> Tri.p1.x >> Tri.p1.y >> Tri.p2.x >> Tri.p2.y >> Tri.p3.x >> Tri.p3.y >> P.x >> P.y;
        if(std::cin.eof()) break;
        std::cout << (IsContain(Tri, P) ? "YES" : "NO") << std::endl;
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

bool side(double a, double b, double c, double d) {
  return a * d - b * c >= 0;
}

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) == 8) {
    if (side(x2-x1, y2-y1, x3-x1, y3-y1) == side(x2-x1, y2-y1, xp-x1, yp-y1) &&
        side(x3-x2, y3-y2, x1-x2, y1-y2) == side(x3-x2, y3-y2, xp-x2, yp-y2) &&
        side(x1-x3, y1-y3, x2-x3, y2-y3) == side(x1-x3, y1-y3, xp-x3, yp-y3))
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}

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

double getd(double x, double y){
	double r = atan2(y, x) * 180 / M_PI;
	return r;
}

int main(){
	printf("%lf\n", getd(2,4));
	printf("%lf\n", getd(-1,0));
	printf("%lf\n", getd(2,2));
	printf("%lf\n", getd(2,-2));
	printf("%lf\n", getd(-2,-2));
	printf("%lf\n", getd(-2,2));
	

	double x1,y1,x2,y2,x3,y3,xp,yp,d1,d2,d3;
	double h;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) + 1){
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;
		d1 = getd(x1,y1);
		d2 = getd(x2,y2);
		d3 = getd(x3,y3);
		if(d1 > d2){
			h = d1;
			d1 = d2;
			d2 = h;
		}
		if(d2 > d3){
			h = d2;
			d2 = d3;
			d3 = h;
			if(d1 > d2){
				h = d1;
				d1 = d2;
				d2 = h;
			}
		}
		d2 -= d1;
		d3 -= d1;
		if(180 > d2){
			if(180 < d3 && d3 < d2 + 180){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: //A Point in a Triangle

#include <iostream>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double a, b, c;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		int flag = false;
		a = (x2 - x1)*(yp - y2) - (y2 - y1)*(xp - x2);
		b = (x3 - x2)*(yp - y3) - (y3 - y2)*(xp - x3);
		c = (x1 - x3)*(yp - y1) - (y1 - y3)*(xp - x1);
		//cout << "a:" << a << endl;
		//cout << "b:" << b << endl;
		//cout << "c:" << c << endl;
		
		if(a > 0 && b > 0 && c > 0) {
			flag = true;
		}
		else if(a < 0 && b < 0 && c < 0) {
			flag = true;
		}
		
		if(flag == true) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define EPS (1e-10)
#define equals(a,b)(fabs((a)-(b))<EPS)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator*(double a) { return Point(a*x, a*y); }
	Point operator-(Point p) { return Point(x - p.x, y - p.y); }
};
struct Segment {
	Point p1, p2;
};
double cross(Point a, Point b) {
	return a.x*b.y - a.y*b.x;
}
double dot(Point a, Point b) {
	return a.x*b.x + a.y*b.y;
}
bool isPrallel(Segment s1, Segment s2) {
	return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
bool isOrthogonal(Segment s1, Segment s2) {
	return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
typedef vector<Point>Polygon;
int contains(Polygon g, Point p) {
	int n = g.size();
	bool x = false;
	rep(i, n) {
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if (abs(cross(a, b)) < EPS&&dot(a, b) < EPS)return 1;
		if (a.y > b.y)swap(a, b);
		if (a.y < EPS&&EPS<b.y&&cross(a, b)>EPS)x = !x;
	}
	return x ? 2 : 0;
}
int main() {
	while (1) {
		Polygon g;
		double x, y;
		rep(i, 3) {
			if (!(cin >> x))break;
			cin >> y;
			g.push_back(Point(x, y));
		}
		cin >> x >> y;
		if (contains(g, Point( x,y )) == 2)puts("YES");
		else puts("NO");
	}
}