Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pt", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		int i;
		vector <double> tpx (3, 0.);
		vector <double> tpy (3, 0.);
		double px = 0.;
		double py = 0.;
	
		stringstream ss(str);

		for (i = 0; i < 3; ++i){
			double tx,ty;
			ss >> tx >> ty;
			tpx[i] = tx; tpy[i] = ty;
		} // end for
		ss >> px >> py;

		vector <double> a(3, 0.);
		vector <double> b(3, 0.);
		vector <double> c(3, 0.);
/*
		for (i = 0; i < 3; ++i){
			cout << "tp[" << i << "]: ";
			cout << '(' << tpx[i] << ',' << tpy[i] << ')' << endl;
		} // end for
		cout << "p: ";
		cout << '(' << px << ',' << py << ')' << endl;
*/
		int j;
		for (i = 0; i < 3; ++i){
			j = (i + 1) % 3;
			if (tpx[i] == tpx[j]){
				a[i] = 1.0;
				b[i] = 0.0;
				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			}else if (tpy[i] == tpy[j]){
				a[i] = 0.0;
				b[i] = 1.0;
				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			}else{
				a[i] = (tpy[j] - tpy[i]);
				b[i] = -(tpx[j] - tpx[i]);
 				c[i] = -a[i]*tpx[i] - b[i]*tpy[i];
			} // end if
//			cout << a[i] << ' ' << b[i] << ' ' << c[i] << endl;
		} // end for
		vector <int> d(3, 0.0);

		for (i = 0; i < 3; ++i){
			if (a[i] != 0.0 && b[i] != 0.0){
				if ( py > (-a[i]*px - c[i])/b[i] ){
					d[i] = 1;
				}else if ( py < (-a[i]*px - c[i])/b[i] ){
					d[i] = -1;
				} // end if
			}else if (a[i] == 0.0 && b[i] != 0.0){
				if ( py > - c[i]/b[i] ){
					d[i] = 1;
				}else if ( py < -c[i]/b[i] ){
					d[i] = -1;
				} // end if
			}else if (a[i] != 0.0 && b[i] == 0.0){
				if ( px > -c[i]/a[i] ){
					d[i] = 1;
				}else if ( px < -c[i]/a[i] ){
					d[i] = -1;
				} // end if
			} // end if
//			cout << "d[" << i << "]: " << d[i] << endl;
		} // end for

		int plus = 0;
		int minus = 0;
		for (i = 0; i < 3; ++i){
			if (d[i] > 0){
				++plus;
			}else{
				++minus;
			} // end if
		} // end for

		if (plus == 1 && minus == 2){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if
			
	} // end for
		
	return 0;
}

C++: #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>

using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }
};

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {

  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
           ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
  }
}

int inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=1000000;

  int n=ps.size();
  ps.push_back(ps[0]);

  if(a.y<=ymn||a.y>=ymx)return 0;
  
  for(int i=0;i<n;i++){
    if(is_point_on_line(ps[i],ps[i+1],p))return 0;
  }
  
  int cnt1=0;
  for(int i=0;i<n;i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<n;i++)
    if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
  
  return (cnt-cnt1)%2;
}

int main(void){
 
  point in[4],p;
  vector<point>ps;

  while(cin>>in[1].x>>in[1].y>>in[2].x>>in[2].y>>in[3].x>>in[3].y>>p.x>>p.y){

    ps.clear();

    for(int i=1;i<4;i++)
    ps.push_back(in[i]);

    if(inside(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>  
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

struct Vector {
	double x;
	double y;
};

#define Vectex Vector;

Vector sub_vector(const Vector& a, const 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, px, py; 
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py) {
		Vector A, B, C, P;
		A.x = x1; A.y = y1;
		B.x = x2; B.y = y2;
		C.x = x3; C.y = y3;
		P.x = px; P.y = py;

		Vector AB = sub_vector(B, A);
		Vector BP = sub_vector(P, B);
		Vector BC = sub_vector(C, B);
		Vector CP = sub_vector(P, C);
		Vector CA = sub_vector(A, C);
		Vector AP = sub_vector(P, A);

		double c1 = AB.x * BP.y - AB.y * BP.x;
		double c2 = BC.x * CP.y - BC.y * CP.x;
		double c3 = CA.x * AP.y - CA.y * AP.x;

		if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) printf("YES\n");
		else printf("NO\n"); 
	}	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
long double x;
long double x1,y1,x2,y2,x3,y3,xp,yp;
int S=0;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
{
	if(y1<y2&&y3<y2)
	{
	for(double i=x1;i<=x3;i+=0.0001)
{
x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2<(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
}
}
}
else if(y1>y2&&y1>y1)
{
for(long double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(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