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<stdio.h>
#include<cmath>

using namespace std;

#define EPS 1e-10

struct point{
	double x;
	double y;
};
struct line{
	double a; // 傾き
	double b; // 切片
};

int recog_point_place( const point& a , const point&b , const point& c );
bool get_line( const point& a , const point& b , line *a_b );

int main(void)
{
	point a, b, c, p;
	int num_of_data;

	while( scanf("%d", &num_of_data ) != EOF )
	{
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y;

		int result_ab_c = recog_point_place( a , b , c );
		int result_ab_p = recog_point_place( a , b , p );
		int result_bc_a = recog_point_place( b , c , a );
		int result_bc_p = recog_point_place( b , c , p );
		int result_ca_b = recog_point_place( c , a , b );
		int result_ca_p = recog_point_place( c , a , p );

		if( result_ab_c == result_ab_p && result_bc_a == result_bc_p && result_ca_b == result_ca_p ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

int recog_point_place( const point& a , const point&b , const point& c )
{
	line a_b;

	bool result = get_line( a , b , &a_b );
	if( result == false )
	{
		if( (a.x + b.x)/2 < c.x ) return 1; // 点が直線より右にある場合に1をリターン
		else return 0;
	}
	else if( result == true )
	{
		if( c.y > a_b.a * c.x + a_b.b ) return 1; // 点が直線より上にある場合に1をリターン
		else return 0;
	}

}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS )
	{
		return false;
	}
	else
	{
		a_b->a = (a.y - b.y) / (a.x - b.x);
		a_b->b = a.y - a_b->a * a.x;

		return true;
	}
}

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

void couten(double x[], double y[], double &cx, double &cy){
	double a2, b2, c2, a, b, c, s, S2;
	a2 = abs((x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1]));
    b2 = abs((x[0]-x[2])*(x[0]-x[2]) + (y[0]-y[2])*(y[0]-y[2]));
    c2 = abs((x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0]));
    a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
	if((a + b + c) == 0){
		s = 0;
		cx = 0;
		cy = 0;
	} else{
		s = (a + b + c) / 2;S2 = s * (s-a) * (s-b) * (s-c);
		cx = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
		cy = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
	}
}

int hantei(double x[], double y[], double &cx, double &cy, double xp, double yp){
	bool flag[3];
	double tc, tp, tcc, tpp;
	x[3] = x[0]; y[3] = y[0];
	for(int i = 0; i < 3; i++){
		tc = (x[i] - x[i + 1]) * (cy - y[i]) + (y[i] - y[i + 1]) * (x[i] - cx);
		tp = (x[i] - x[i + 1]) * (yp - y[i]) + (y[i] - y[i + 1]) * (x[i] - xp);
		if(tc * tp >= 0){
			flag[i] = true;
		} else{
			continue;
		}
	}
	if(flag[0] == true && flag[1] == true && flag[2] == true){
		return 1;
	} else{
		return 0;
	}
}


int main(){
	double x[3], y[3], xp, yp, cxx, cyy;
	double &cx = cxx, &cy = cyy;
	
	while(cin >>x[0] >>y[0] >>x[1] >>y[1] >>x[2] >>y[2] >>xp >>yp){
		couten(x, y, cx, cy);
		if(hantei(x, y, cx, cy, xp, yp)){
			cout <<"Yes"<<endl;
		} else{
			cout <<"No"<<endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <complex>

using namespace std;

typedef	complex<double> P;

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

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

	double xp,yp,x1,x2,x3,y1,y2,y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P p1(x1,y1);
		P p2(x2,y2);
		P p3(x3,y3);
		P p(xp,yp);

		double v1 = cross(p1,p2);
		double v2 = cross(p2,p3);
		double v3 = cross(p3,p1);

		if((v1>=0&&v2>=0&&v3>=0)||(v1<0&&v2<0&&v3<0))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}

	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

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

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

using namespace std;

float hang(float a,float b,float c,float d,float e,float f){
    float A;
    A=(a*d + b*e + c*f - e*d - b*c - a*f)/2;
    if(A<0)A=-A;
    return A;      
}

int main()
{
    float x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3,s;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
       s1=hang(xp,yp,x2,y2,x3,y3);
       s2=hang(x1,y1,xp,yp,x3,y3);
       s3=hang(x1,y1,x2,y2,xp,yp);
       s=hang(x1,y1,x2,y2,x3,y3);
       if(s==(s1+s2+s3))cout<<"YES";
       else cout<<"NO";                                                   
    }
    return 0;
}

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

using namespace std;

double cross(complex<double> A, complex<double> B){
	return (conj(A)*B).imag();
}

int main(){
	while(1){
		complex<double> Point[3], P;
		double x,y;
		for(int i=0;i<3;i++){
			if(!(cin>>x>>y))
				return 0;
			Point[i]={x,y};
		}
		cin >> x >> y;
		P={x,y};

		int sum=0;
		for(int i=0;i<3;i++){
			sum += cross(Point[(i+1)%3]-Point[i], P-Point[i])>0;
		}
		cout << (sum==0||sum==3 ? "Yes":"No") << endl;
	}
	return 0;
}

C++: #include <stdio.h>
double root(double a1, double b1, double a2, double b2, double a3, double b3) {double S=a1*b2+a2*b3+a3*b1-b1*a2-b2*a3-b3*a1;if (S<0) return -S; else return S;}
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) {
    double s=root(x1,y1,x2,y2,x3,y3),s1=root(x1,y1,x2,y2,xp,yp),s2=root(x1,y1,xp,yp,x3,y3),s3=root(xp,yp,x2,y2,x3,y3);
    if (s==s1+s2+s3) puts("YES"); else puts("NO");} return 0;}

C++: #include <cstdio>
#include <iostream>
#include <complex>
#define rep(i,n) for(int i=0; i<(n); i++)
#define EPS 1e-15
using namespace std;

typedef complex<double> cd;

double s(cd a, cd b){
  return abs( a.real()*b.imag()-a.imag()*b.real() );
}

int main(){
  cd a[4];
  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){
    a[0] = cd(x1,y1);
    a[1] = cd(x2,y2);
    a[2] = cd(x3,y3);
    a[3] = cd(xp,yp);
    if(abs(s(a[0]-a[3], a[1]-a[3])
           + s(a[1]-a[3], a[2]-a[3])
           + s(a[2]-a[3], a[0]-a[3])
           - s(a[1]-a[0], a[2]-a[0])) < EPS )
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main() {
	double x[3], y[3], p, q;
	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p>>q) {
		bool f = true;
		for (int i = 0; i < 3; i++) {
			if ((x[i % 3] - p)*(y[(i + 1) % 3] - q) - (y[i % 3] - q)*(x[(i + 1) % 3] - p) <= 0)f = false;
		}
		if (f)puts("YES");
		else puts("NO");
	}
	return 0;
}