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<cmath>
#include<iostream>
using namespace std;
#define PI 3.141592

double wn_angle(int x, int y)
{
  double r = acos(x / sqrt(x * x + y * y));
  // y????????????????¬¬3, 4?±????
  if(y < 0)
    r = PI * 2 - r;
  return y < 0 ? PI * 2 - r : r;
}

int winding_number(int x, int y, double p[][2], int n)
{
  int xx = p[n - 1][0] - x, yy = y - p[n - 1][1] - y;
  double r1 = wn_angle(xx, yy);
  double s = 0;
  for(int i = 0; i < n; i++)
  {
    int xx = p[i][0] - x, yy = p[i][1] - y;
    double r2 = wn_angle(xx, yy);
    double ts = r2 - r1;
    // 180???????????§?????????????????¨?????????
    if(abs(ts) > PI)
      ts = ts / abs(ts) * (PI - abs(ts));
    s += ts ;
    r1 = r2;
  }
  return abs(s) < PI ? 0 : 1;
}


double p[3][2];
int main()
{
  while(cin >> p[0][0] >> p[0][1] >> p[1][0] >> p[1][1] >> p[2][0] >> p[2][1])
  {
    double x, y;
    cin >> x >> y;
    cout << (winding_number(x, y, p, 3) ? "YES" : "NO ") << endl;;
  }
}

C++: #include <iostream>

/// check if (x1, y1) <-> (x2, y2) and (x3, y3) <-> (x4, y4) is crossed.
bool is_cross(double x1, double y1, double x2, double y2,
              double x3, double y3, double x4, double y4)
{
  if (((x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3)) *
      ((x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4)) > 0) {
    return false;
  } else {
    return true;
  }
}

int main()
{
  double x1, y1, x2, y2, x3, y3, xp, yp, center_x, center_y;
  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    center_x = (x1 + x2 + x3) / 3.0;
    center_y = (y1 + y2 + y3) / 3.0;
    if (is_cross(x1, y1, x2, y2, xp, yp, center_x, center_y) ||
        is_cross(x1, y1, x3, y3, xp, yp, center_x, center_y) ||
        is_cross(x2, y2, x3, y3, xp, yp, center_x, center_y)) {
      std::cout << "NO" << std::endl;
    } else {
      std::cout << "YES" << std::endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);++i)
 
static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double eps = 1e-8;
 
double x[3],y[3];
double xp,yp;
 
double dist(P a,P b){
    return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}
 
double tri_pro(P a,P b,P c){
    double aa,bb,cc;
    aa = dist(b,c);
    bb = dist(c,a);
    cc = dist(a,b);
    double s = (aa+bb+cc)/2.0;
    return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}
 
 
int main(){
    //P a(0.0,0.0),b(4.0,0.0),c(4.0,2.0);
    //cout<<tri_pro(a,b,c)<<endl;
    
    
    
    while(cin>>x[0]>>y[0]){
        rep(i,2) cin>>x[i+1]>>y[i+1];
        cin>>xp>>yp;
        P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
        P p(xp,yp);
        double sa,sb,sc;
        sa = tri_pro(b,c,p);
        sb = tri_pro(c,a,p);
        sc = tri_pro(a,b,p);
        double s = tri_pro(a,b,c);
        //cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
        if((int)(s*100)-(int)((sa+sb+sc)*100)==0) cout<<"YES\n";
        else cout<<"NO\n";
    }
    
    return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>

#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  double _x[3][2], _p[2];
  while (scanf(" %lf %lf %lf %lf %lf %lf %lf %lf ", &_x[0][0], &_x[0][1], &_x[1][0], &_x[1][1], &_x[2][0], &_x[2][1], &_p[0], &_p[1]) == 8) {
    coor x[3], g(0, 0);
    for (int i = 0; i < 3; i++) {
      x[i] = coor(_x[i][0], _x[i][1]);
      g += x[i];
    }
    g /= 3;
    coor p = coor(_p[0], _p[1]);
    coor d;
    for (int i = 0; i < 3; i++) {
      d = x[(i + 1) % 3] - x[i];
      if ((dot(d * coor(0, 1), g) - dot(d * coor(0, 1), x[i])) * (dot(d * coor(0, 1), p) - dot(d * coor(0, 1), x[i])) < 0) {
	printf("NO\n");
	goto next;
      }
    }
    printf("YES\n");
  next:;
  }
}

C++: #include<iostream>
using namespace std;
int main()
{
    float x1,y1,x2,y2,x3,y3,x,y,a,b,c;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y)
    {
        a=((y-y2)*(x-x1)-(y-y1)*(x-x2))*((y3-y2)*(x3-x1)-(y3-y1)*(x3-x2));
        b=((y-y3)*(x-x2)-(y-y2)*(x-x3))*((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3));
        c=((y-y3)*(x-x1)-(y-y1)*(x-x3))*((y2-y3)*(x2-x1)-(y2-y1)*(x2-x3));
        if(a>0&&b>0&&c>0)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}

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

int test(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp)
{
    double xa = (x2 - x1);
    double ya = (y2 - y1);
    double xb = (x3 - x1);
    double yb = (y3 - y1);
    double xc = (xp - x1);
    double yc = (yp - y1);
    double d = 1.0 / (xa*yb - xb*ya);
    double k = d * (yb * xc - xb * yc);
    double m = d * (-ya * xc + xa * yc);
    return (k >= 0.0 && m >= 0.0)? 1 : 0;
}

int main(void)
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        int tmp = 1;
        tmp *= test(x1, y1, x2, y2, x3, y3, xp, yp);
        tmp *= test(x2, y2, x1, y1, x3, y3, xp, yp);
        tmp *= test(x3, y3, x1, y1, x2, y2, xp, yp);
        cout << ((tmp ==1)? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

float KXmax(float x[3]){
	float max=x[0];
	if(max<x[1]){
		max=x[1];
	}
	if(max<x[2]){
		max=x[2];
	}
	return max;
}

float KXmin(float x[3]){
	float min=x[0];
	if(min>x[1]){
		min=x[1];
	}
	if(min>x[2]){
		min=x[2];
	}
	return min;
}

float KYmax(float y[3]){
	float max=y[0];
        if(max<y[1]){
		max=y[1];
	}
	if(max<y[2]){
		max=y[2];
	}
	return max;
}

float KYmin(float y[3]){
	float min=y[0];
	if(min>y[1]){
		min=y[1];
	}
	if(min>y[2]){
		min=y[2];
	}
	return min;	
}

int main()
{
	float x[3],y[3],p1,p2,Xmax,Xmin,Ymax,Ymin;
	
	for(int i=1;i<=100;i++){
		cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p1>>p2;
		Xmax=KXmax(x);		
		Xmin=KXmin(x);
		Ymax=KYmax(y);
		Ymin=KYmin(y);
		
		if((Xmin<=p1&&Xmax>=p1) && (Ymin<=p2&&Ymax>=p2)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
		
	}
		
	return 0;
}