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 <cstdio>

float x1,y1,x2,y2,x3,y3,xp,yp;
float X1,Y1,X2,Y2,XP,YP;
float d,s,t;

int main(){
  while(~scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)){
    X1=x2-x1;
    Y1=y2-y1;
    X2=x3-x1;
    Y2=y3-y1;
    XP=xp-x1;
    YP=yp-y1;
    d=X1*Y2-X2*Y1;
    t=(XP*Y2-X2*YP)/d;
    s=(-XP*Y1+X1*YP)/d;
    if(0<t&&t<1&&0<s&&s<1&&s+t<1){
      puts("YES");
    }else{
      puts("NO");
    }
  }
}

C++: #include <bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

double dist(double x1, double y1, double x2, double y2){
    return sqrt( ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)) );
}

double triangleArea(double x, double y, double z){
    return (y * z * sin( acos( (y * y +  z * z - x * x) / (2 * y * z) ) )) / 2;
}

double inputXY(double x1, double y1, double x2, double y2, double x3, double y3){
    double x, y ,z;
    x = dist(x1, y1, x2, y2);
    y = dist(x2, y2, x3, y3);
    z = dist(x3, y3, x1, y1);
    return triangleArea(x, y, z);
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double allArea, area12, area23, area31;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        allArea = inputXY(x1, y1, x2, y2, x3, y3);
        area12 = inputXY(xp, yp, x2, y2, x1, y1);
        area23 = inputXY(x2, y2, x3, y3, xp, yp);
        area31 = inputXY(x3, y3, x1, y1, xp, yp);

        if(abs(allArea - (area12 + area23 + area31)) < 0.000001) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <iostream>

using namespace std;

typedef struct _Point {
	double x;
	double y;
} Point;

typedef struct _Line {
	Point a;
	Point b;
} Line;

typedef struct _Triangle {
	Point a;
	Point b;
	Point c;
} Triangle;

double interSect(Point p1, Point p2, Point p3, Point p4) {
	double ret = 0, ret_ = 0;
	ret += (p1.x - p2.x) * (p3.y - p1.y);
	ret += (p1.y - p2.y) * (p1.x - p3.x);
	ret_ += (p1.x - p2.x) * (p4.y - p1.y);
	ret_ += (p1.y - p2.y) * (p1.x - p4.x);
	ret *= ret_;
	return ret;
}

bool pointInaTriangle(Point p, Triangle t) {
	if ((t.a.x - t.c.x) * (t.a.y - t.b.y) == (t.a.x - t.b.x) * (t.a.y - t.c.y))
		return false;
	Point c;
	c.x = (t.a.x + t.b.x + t.c.x) / 3;
	c.y = (t.a.y + t.b.y + t.c.y) / 3;
	double pab = interSect(t.a, t.b, p, c);
	double pbc = interSect(t.b, t.c, p, c);
	double pca = interSect(t.c, t.a, p, c);
	if (pab < 0 && pbc < 0 && pca < 0)
		return true;
	return false;
}

int main() {
	Triangle t;
	Point p;
	while (cin >> t.a.x >> t.a.y >> t.b.x >> t.b.y >> t.c.x >> t.c.y >> p.x >> p.y) {
		if (pointInaTriangle(p, t) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 while(ir.hasNext()){
  P[] ps=new P[3];
  for(int i=0;i<3;i++) ps[i]=new P(ir.nextDouble(),ir.nextDouble());
  P p=new P(ir.nextDouble(),ir.nextDouble());
  double tot=0;
  for(int i=0;i<3;i++){
   tot+=Math.abs(ps[i].sub(p).det(ps[(i+1)%3].sub(p)));
  }
  if(accurateTotal(-tot,Math.abs(ps[1].sub(ps[0]).det(ps[2].sub(ps[0]))))==0.0) out.println("YES");
  else out.println("NO");
 }
}

static final double EPS=1e-10;

public static double accurateTotal(double a,double b){
 if(Math.abs(a+b)<EPS*(Math.abs(a)+Math.abs(b))) return 0.0;
 return a+b;
}

static class P{

 public double x,y;

 public P(double x,double y){
  this.x=x; this.y=y;
 }

 public double getX(){
  return this.x;
 }

 public double getY(){
  return this.y;
 }

 public P add(P v){
  return new P(accurateTotal(this.x,v.x),accurateTotal(this.y,v.y));
 }

 public P sub(P v){
  return new P(accurateTotal(this.x,-v.x),accurateTotal(this.y,-v.y));
 }

 public P mul(double k){
  return new P(this.x*k,this.y*k);
 }

 public double dot(P v){
  return accurateTotal(this.x*v.x,this.y*v.y);
 }

 public double det(P v){
  return accurateTotal(this.x*v.y,-this.y*v.x);
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {

 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}