Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func check(x, y, x1, y1, x2, y2 float64) float64 {
	return (x2-x1)*y - (y2-y1)*x + x1*y2 - x2*y1
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]float64, 8)
	for scanner.Scan() {
		info := strings.Split(scanner.Text(), ",")
		for j := 0; j < 8; j++ {
			a[j], _ = strconv.ParseFloat(info[j], 64)
		}
		if check(a[0], a[1], a[2],a[3], a[6], a[7])*check(a[4], a[5], a[2], a[3], a[6], a[7]) < 0 && check(a[6], a[7], a[0], a[1], a[4], a[5])*check(a[2],a[3], a[0], a[1], a[4], a[5]) < 0 {
			fmt.Println("YES")	
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <cmath>
using namespace std;

double triangle(double x1,double y1,double x2,double y2,double x3,double y3) {
  double a[2],b[2],theta,al,bl;
  a[0] = x2 - x1;
  a[1] = y2 - y1;
  b[0] = x3 - x1;
  b[1] = y3 - y1;
  al = sqrt(a[0] * a[0] + a[1] * a[1]);
  bl = sqrt(b[0] * b[0] + b[1] * b[1]);
  theta = acos((a[0] * b[0] + a[1] * b[1]) / (al * bl));
  return al * bl * abs(sin(theta)) / 2;
}

int main() {
  double x0,y0,x1,y1,x2,y2,x3,y3;
  double abc,bcd,cda,dab,abd,cbd,acd;
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&x0,&y0,&x1,&y1,&x2,&y2,&x3,&y3) == 8) {
    abc = triangle(x0,y0,x1,y1,x2,y2);
    bcd = triangle(x1,y1,x2,y2,x3,y3);
    cda = triangle(x2,y2,x3,y3,x0,y0);
    dab = triangle(x3,y3,x0,y0,x1,y1);
    abd = triangle(x0,y0,x1,y1,x3,y3);
    cbd = triangle(x2,y2,x1,y1,x3,y3);
    acd = triangle(x0,y0,x2,y2,x3,y3);
    if(abc > abd + cbd)
      cout << "NO" << endl;
    else if(bcd > abc + acd)
      cout << "NO" << endl;
    else if(cda > abd + bcd)
      cout << "NO" << endl;
    else if(dab > abc + acd)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

struct Point{
	double x,y;
	Point(){}
	Point(double _x,double _y){
		x=_x; y=_y;
	}
};

struct Line{
	double x[2],y[2];
	Line(){}
	Line(Point p,Point q){
		x[0]=p.x; x[1]=q.x;
		y[0]=p.y; y[1]=q.y;
	}
};

void RevXY(Point &p){
	swap(p.x,p.y);
}

void RevXY(Line &l){
	for(int i=0;i<2;i++) swap(l.x[i],l.y[i]);
}

bool Is_SameSide(Line l,Point p,Point q){
	//printf("%lf,%lf - %lf,%lf\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],p.x,p.y,q.x,q.y);
	if(l.x[1]==l.x[0]){
		RevXY(l); RevXY(p); RevXY(q);
	}
	double a,b;
	a = (l.y[1]-l.y[0])/(l.x[1]-l.x[0]);
	b = l.y[0]-a*l.x[0];
	//printf("%lf,%lf - %lf,%lf : y = %lfx+(%lf)\np(%lf,%lf),q(%lf,%lf)\n",l.x[0],l.y[0],l.x[1],l.y[1],a,b,p.x,p.y,q.x,q.y);
	if((p.y-(a*p.x+b))*(q.y-(a*q.x+b))>0) return true;
	else return false;
}

int main(){
	Point S[4];
	while(scanf("%lf,%lf",&S[0].x,&S[0].y)!=EOF){
		Point sum = Point(S[0].x,S[0].y);
		for(int i=1;i<4;i++){
			scanf(",%lf,%lf",&S[i].x,&S[i].y);
			sum.x += S[i].x; sum.y += S[i].y;
		}
		bool ans=true;
		for(int i=0;i<4;i++){
			if(Is_SameSide(Line(S[i],S[(i+2)%4]),S[(i+1)%4],Point((sum.x-S[(i+1)%4].x)/3,(sum.y-S[(i+1)%4].y)/3))==true){
				ans = false;
			}
		}
		if(ans) puts("YES");
		else puts("NO");
	}
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define X real()
#define Y imag()
#define EQ(a,b) (abs((a)-(b))<EPS)
typedef complex<double> Po;
double isIntersect(Po p1,Po p2,Po p3,Po p4)
{
	//straight line(p1,p2) and line segment(p3,p4) are
	//if(n<0) crossed if(n==0) parallel if(n>0) not crossed
	return ((p1.X-p2.X)*(p3.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p3.X)) * ((p1.X-p2.X)*(p4.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p4.X));
}
int main()
{
	double x[4];
	double y[4];
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3])!=EOF)
	{
	Po p[4];
	for(int i=0;i<4;i++)
	{
		p[i].X=x[i];
		p[i].Y=y[i];
	}
	if(isIntersect(p[0],p[2],p[1],p[3])>0.0||isIntersect(p[1],p[3],p[0],p[2])>0.0)
	{
		cout << "NO" << endl;
	}
	else
	{
		cout << "OK" << endl;
	}
	}
	return 0;
}

C++: #include<iostream>
int main()
{
	while (true)
	{
		double xa, ya, xb, yb, xc, yc, xd, yd;
		char foo;
		std::cin >> xa >> foo >> ya >> foo >> xb >> foo >> yb >> foo >> xc >> foo >> yc >> foo >> xd >> foo >> yd;
		if (std::cin.eof())
		{
			break;
		}
		const double A_C = std::hypot(xa - xc, ya - yc);
		const double B_D = std::hypot(xb - xd, yb - yd);
		const double A_BD = std::abs((yd - yb) * (xa - xd) - (xd - xb) * (ya - yd)) / std::hypot(yd - yb, xd - xb);
		const double B_AC = std::abs((yc - ya) * (xb - xc) - (xc - xa) * (yb - yc)) / std::hypot(yc - ya, xc - xa);
		std::cout << (A_C > A_BD && B_D > B_AC ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include <complex>
#include <stdio.h>
#include <math.h>
using namespace std;

// _ÀWð^Æ·é
typedef complex<double> P;

//XYÀW
#define X real()
#define Y imag()

// ¼üp1,p2Æüªp3,p4Ìð·»è
// (n < 0)<=>ð· , (n == 0)<=>¼üã, (n > 0)<=>ð·µÄ¢È¢  
double isIntersect(P p1, P p2, P p3, P p4){  
    return ( (p1.X-p2.X)*(p3.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p3.X)) * ((p1.X-p2.X)*(p4.Y-p1.Y) + (p1.Y-p2.Y)*(p1.X-p4.X));  
}

int main(){
	double xa, xb, xc, xd, ya, yb, yc, yd;

	while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF ){
		P a( xa , ya );
		P b( xb , yb );
		P c( xc , yc );
		P d( xd , yd );
		
		if( isIntersect(a,c,b,d) > 0.0 || isIntersect(b,d,a,c) > 0.0 ){
			printf("NO\n");
		}else{
			printf("YES\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<complex>
#define eps 10e-9
using namespace std;
typedef complex<double> p;

double cross(p x,p y)
{
	return x.real()*y.imag()-x.imag()*y.real();
}

int main()
{
	p a,b,c,d;
	while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&a.real(),&a.imag(),&b.real(),&b.imag(),&c.real(),&c.imag(),&d.real(),&d.imag())!=EOF) 
	{
		double tmp=1;
		tmp*=cross(b-a,d-a);
		bool flag=true;
		if(tmp*cross(c-b,a-b)<-eps||tmp*cross(d-c,b-c)<-eps||tmp*cross(a-d,c-d)<-eps) flag=false;
		cout<<(flag?"YES":"NO")<<endl;
	}
  return 0;
}

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

using namespace std;
typedef pair<double, double> P;

double Helon(P a, P b, P c)
{
	double square = 0;
	double x, y, z;
	x = sqrt((b.first - a.first) * (b.first - a.first) + (b.second - a.second) * (b.second - a.second));
	y = sqrt((c.first - a.first) * (c.first - a.first) + (c.second - a.second) * (c.second - a.second));
	z = sqrt((c.first - b.first) * (c.first - b.first) + (c.second - b.second) * (c.second - b.second));
	double s = (x + y + z) / 2;
	square = sqrt(s * (s - x) * (s - y) * (s - z));
	return(square);
}

void solve()
{
	vector<P> Vec(4);
	while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &Vec[0].first, &Vec[0].second, 
													&Vec[1].first, &Vec[1].second, 
													&Vec[2].first, &Vec[2].second, 
													&Vec[3].first, &Vec[3].second))
	{
		double square1 = 0;
		square1 += Helon(Vec[0], Vec[1], Vec[2]);
		square1 += Helon(Vec[0], Vec[2], Vec[3]);
		double square2 = 0;
		square2 += Helon(Vec[0], Vec[1], Vec[3]);
		square2 += Helon(Vec[1], Vec[2], Vec[3]);
		if(fabs(square1 - square2) < 0.00000000001)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}