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<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstdio>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007


double vector_2nd(double a,double b){

    return b-a;
}



int main(){

    //A(x1,y1) B(x2,y2) C(x3,y3) P(xp,yp)
    double x1,x2,x3,xp,y1,y2,y3,yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        double CA_X,CA_Y;
        double AP_X,AP_Y;
        double BC_X,BC_Y;
        double CP_X,CP_Y;
        double AB_X,AB_Y;
        double BP_X,BP_Y;
        CA_X = vector_2nd(x1,x3);
        CA_Y = vector_2nd(y1,y3);
        AP_X = vector_2nd(xp,x1);
        AP_Y = vector_2nd(yp,y1);
        BC_X = vector_2nd(x3,x2);
        BC_Y = vector_2nd(y3,y2);
        CP_X = vector_2nd(xp,x3);
        CP_Y = vector_2nd(yp,y3);
        AB_X = vector_2nd(x2,x1);
        AB_Y = vector_2nd(y2,y1);
        BP_X = vector_2nd(xp,x2);
        BP_Y = vector_2nd(yp,y2);

        double outer_product_1 = CA_X*AP_Y-CA_Y*AP_X;
        double outer_product_2 = BC_X*CP_Y-BC_Y*CP_X;
        double outer_product_3 = AB_X*BP_Y-AB_Y*BP_X;

        if((outer_product_1 > 0 && outer_product_2 > 0 && outer_product_3 > 0) || (outer_product_1 < 0 && outer_product_2 < 0 && outer_product_3 < 0)){

            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }




        




    }
    return 0;
}

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

using namespace std;

int main(){
  double x1,x2,x3,xp,y1,y2,y3,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    double A = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B = sqrt(pow(x2-x3,2)+pow(y2-y3,2)), C = sqrt(pow(x1-x3,2)+pow(y1-y3,2)) ;
    double s = (A+B+C)/2.0;
    double S = sqrt(s*(s-A)*(s-B)*(s-C));
 
   double A12 = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B1p =sqrt(pow(x1-xp,2)+pow(y1-yp,2)), C2p = sqrt(pow(xp-x2,2)+pow(yp-y2,2)) ;
    double s2 = (A12+B1p+C2p)/2.0;
    double S2 = sqrt(s2*(s2-A12)*(s2-B1p)*(s2-C2p));
    if(S2 == 0){
      cout << "NO" << endl;
      break;
    }
    double A13 = sqrt(pow(x1-x3,2)+pow(y1-y3,2)), Cp3 = sqrt(pow(xp-x3,2)+pow(yp-y3,2));
    double s3 = (A13+B1p+Cp3)/2.0;
    double S3 =  sqrt(s3*(s3-A13)*(s3-B1p)*(s3-Cp3));
    if(s3 == 0){
      cout << "NO" << endl;
      break;
    }

    double A23 = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    double s4 = (A23+C2p+Cp3)/2.0;
    double S4 =  sqrt(s4*(s4-A23)*(s4-C2p)*(s4-Cp3));
    if(S3 == 0){
      cout << "NO" << endl;
      break;
    }
    double Ssum = S2+S3+S4;
    
    fabs(Ssum - S)<0.000001?cout << "YES" << endl:cout << "NO" << endl;


  }
  return 0;
}

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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;

double smen(double x1, double y1, double x2, double y2, double x3, double y3){
	return abs((x3-x2) * (y1-y2) - (x1-x2)*(y3-y2) )* 0.5;
	
}

int main(void){

double x1,y1,x2,y2,x3,y3,xp,yp;

	while(cin >> x1 ){
		cin >> y1 >> x2 >> y2 >> x3 >> y3;
		cin >> xp >> yp;
			
		double saa = smen(x1,y1,x2,y2,x3,y3);
		double sa1 = smen(x1,y1,x2,y2,xp,yp);
		double sa2 = smen(x1,y1,xp,yp,x3,y3);
		double sa3 = smen(xp,yp,x2,y2,x3,y3);
		
		if(saa == sa1 + sa2 + sa3) cout << "YES" <<endl;
		else  cout << "NO" << endl;
	}
	
	return 0;
}

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

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

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ba = sub_vector(v[0] , v[1]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector cb = sub_vector(v[1] , v[2]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ac = sub_vector(v[2] , v[0]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ba.x * bp.y - ba.y * bp.x; //??????
		double c2 = cb.x * cp.y - cb.y * cp.x;
		double c3 = ac.x * ap.y - ac.y * ap.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>=0 && c2>=0 && c3>=0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double S(double ax,double ay,double bx,double by,double cx,double cy){
    double ab,bc,ca;
    ab=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
    bc=sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
    ca=sqrt((cx-ax)*(cx-ax)+(cy-ay)*(cy-ay));
    double s=(ab+bc+ca)/2;
    double S=sqrt(s*(s-ab)*(s-bc)*(s-ca));
    return S;
}
int main(){
    double ax,ay,bx,by,cx,cy,px,py;
    while(cin>>ax>>ay>>bx>>by>>cx>>cy>>px>>py){
        double ABC,ABP,BCP,CAP;
        ABC=S(ax,ay,bx,by,cx,cy);
        ABP=S(ax,ay,bx,by,px,py);
        BCP=S(bx,by,cx,cy,px,py);
        CAP=S(cx,cy,ax,ay,px,py);
        double dif=ABC-ABP-BCP-CAP;
        if(dif<=0.001&&dif>=-0.001)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

using namespace std;

int main(){
    double a, b, c, d, e, f;
    double p, q;
    while(cin >> a >> b >> c >> d >> e >> f){
        cin >> p >> q;
        vector<int> x(3), y(3);
        x[0] = a; x[1] = c; x[2] = e;
        y[0] = b; y[1] = d; y[2] = f;
        int ret = 0;
        bool is = false;
        double X1 = x[0], X2 = x[1], X3 = x[2];
        double Y1 = y[0], Y2 = y[1], Y3 = y[2];

        int ans = 0;
        if ((X2-X1)*(q-Y1)-(Y2-Y1)*(p-X1)>0.0) ans++;
        if ((X3-X2)*(q-Y2)-(Y3-Y2)*(p-X2)>0.0) ans++;
        if ((X1-X3)*(q-Y3)-(Y1-Y3)*(p-X3)>0.0) ans++;

        cout << (ans%3==0?"YES":"NO") << endl;
    }
}