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 <complex>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,a,b) for(int i=a; i<b; i++)
#define REP(i,n) FOR(i,0,n)

typedef complex<double> P;

int main(){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    char c;
    while(cin>>c>>x1>>c>>y1>>c>>x2>>c>>y2
          >>c>>x3>>c>>y3>>c>>x4>>c>>y4){
        P t[4]={P(x1,y1),P(x2,y2),P(x3,y3),P(x4,y4)};
        int ans=0;
        REP(i,4){
            P a=t[(i+1)%4]-t[i];
            P b=t[(i+3)%4]-t[i];
            double angle=arg(a/b);
            ans+=angle>0;
        }
        cout<<(abs(ans)==4||ans==0?"YES":"NO")<<endl;
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
struct P{
  double x,y;
  P(){}
  P(double x,double y):x(x),y(y){}
  P operator - (P p){
    return P(x - p.x,y - p.y);
  }
  double det(P p){
    return x*p.y - y*p.x;
  }
};
int main(){
  P a[4];
  char e;
  while( cin >> a[0].x >> e >> a[0].y){
    int flag = 1;
    for(int i = 1 ; i < 4 ; i++ ){
      cin >> e >> a[i].x >> e >>  a[i].y;
    }
    for(int i = 0 ; i < 4 ; i++ ){
      if((a[i] - a[(i + 1)%4]).det( a[(i + 1)%4] - a[(i + 2)%4] ) < 0){
	cout << "NO" << endl;
	flag = 0;
	break;
      }
    }
    if(flag)cout << "YES" << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main() {
    double xa, ya, xb, yb, xc, yc, xd, yd;
    char c;
    while (cin >> xa >> c >> ya >> c >> xb >> c >> yb >> c >> xc >> c >> yc >> c >> xd >> c >> yd) {
        double check1, check2;
        bool flg = false;
        check1 = (yb - ya) - (yc - ya) / (xc - xa) * (xb - xa);
        check2 = (yd - ya) - (yc - ya) / (xc - xa) * (xd - xa);
        if (check1 * check2 > 0) { //同じ側
            flg = true;
        }
        check1 = (ya - yb) - (yd - yb) / (xd - xb) * (xa - xb);
        check2 = (yc - yb) - (yd - yb) / (xd - xb) * (xc - xb);
        if (check1 * check2 > 0) { //同じ側
            flg = true;
        }
        if (flg == true) {
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
using namespace std;
struct Point
{
	Point(double _x, double _y) : x(_x), y(_y) {}
	double x;
	double y;
};
typedef Point Vector;
bool isConvex(Point& P1, Point& P2, Point& P3){
	Vector V1(P1.x - P2.x, P1.y - P2.y);
	Vector V2(P3.x - P2.x, P3.y - P2.y);
	return (V1.x * V2.y - V1.y * V2.x) > 0;
}
bool isConvexSquare(Point& P1, Point& P2, Point& P3, Point& P4){
	bool b1 = isConvex(P1, P2, P3);
	bool b2 = isConvex(P2, P3, P4);
	bool b3 = isConvex(P3, P4, P1);
	bool b4 = isConvex(P4, P1, P2);
	return (b1 == b2 && b2 == b3 && b3 == b4 && b4 == b1);
}
vector<double> Split(string& line){
	vector<double> vN(8, 0.0);
	string::size_type p1 = 0;
	string::size_type p2 = line.find(',');
	int i = 0;
	double v;
	while (p1 != string::npos){
		if (p1 == 0) v = atof(line.substr(0, p2).c_str());
		else if (p2 != string::npos)	v= atof(line.substr(p1 + 1, p2 - p1 - 1).c_str());
		else v = atof(line.substr(p1 + 1).c_str());
		vN[i] = v;
		p1 = p2;
		++i;
		if (p1 != string::npos)
			p2 = line.find(',', p1 + 1);
	}
	return vN;
}
void getValue(string& line, double* X, double* Y){
	vector<double> vN = Split(line);
	X[0] = vN[0];
	Y[0] = vN[1];
	X[1] = vN[2];
	Y[1] = vN[3];
	X[2] = vN[4];
	Y[2] = vN[5];
	X[3] = vN[6];
	Y[3] = vN[7];
}
int main()
{
	double X[4] = {}, Y[4] = {};
	string line;
	while (cin >> line){
		getValue(line, X, Y);
		Point P1(X[0], Y[0]);
		Point P2(X[1], Y[1]);
		Point P3(X[2], Y[2]);
		Point P4(X[3], Y[3]);
		if (isConvexSquare(P1, P2, P3, P4)) cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}

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 <iostream>
#include <complex>
#include <cstdio>
using namespace std;
 
#define EPS 1e-7
 
typedef complex<double> P;
#define X real()
#define Y imag()
 
double cross(P a,P b){ return (a.X*b.Y)-(a.Y*b.X); }
 
int isIntersected(P a1,P a2,P b1,P b2)
{
        return cross(a2-a1,b1-a1) * cross(a2-a1,b2-a1) < EPS &&
                   cross(b2-b1,a1-b1) * cross(b2-b1,a2-b1) < EPS;
}
 
int main()
{
        double a,b,c,d,e,f,g,h;
 
        while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&a,&b,&c,&d,&e,&f,&g,&h))
        {
                P aa(a,b), bb(c,d), cc(e,f), dd(g,h);
                cout<<( isIntersected(aa,cc,bb,dd)>0.0 || isIntersected(bb,dd,aa,cc)>0.0 ? "YES" : "NO" )<<endl;
        }
 
        return 0;
}

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

double spase(double a,double b,double c){
	return sqrt((a+b+c)*(b-a+c)*(a-b+c)*(a+b-c));
}

int main(){
	double a,b,c,d,e,f,g,h,AB,BC,CD,DA,AC,BD,abc,bcd,cda,dab;
	while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&a,&b,&c,&d,&e,&f,&g,&h) != EOF ){
		AB=sqrt((a-c)*(a-c)+(b-d)*(b-d));
		BC=sqrt((c-e)*(c-e)+(d-f)*(d-f));
		CD=sqrt((e-g)*(e-g)+(f-h)*(f-h));
		DA=sqrt((g-a)*(g-a)+(h-b)*(h-b));
		AC=sqrt((a-e)*(a-e)+(b-f)*(b-f));
		BD=sqrt((c-g)*(c-g)+(d-h)*(d-h));
		abc=((a-c)*(c-e)+(b-d)*(d-f))/AB/BC;
		bcd=((c-e)*(e-g)+(d-f)*(f-h))/BC/CD;
		cda=((e-g)*(g-a)+(f-h)*(h-b))/CD/DA;
		dab=((g-a)*(a-c)+(h-b)*(b-b))/DA/AB;
		abc=acos(abc)+acos(bcd)+acos(cda)+acos(dab);
		if(((float)(abc-2*M_PI)==0)&&((float)(spase(AB,BC,AC)+spase(CD,DA,AC))==(float)(spase(DA,AB,BD)+spase(CD,BC,BD)))){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;

typedef complex<double> P;

int main(){
  for(;;){
    P p[4];
    for(int i=0;i<4;i++){
      double x,y;
      if(!((cin>>x).ignore()>>y).ignore())return 0;
      p[i]=P(x,y);
    }
    bool a[2]={};
    for(int i=0;i<4;i++){
      P c=p[i]-p[(i+1)%4],d=p[(i+1)%4]-p[(i+2)%4];
      a[c.real()*d.imag()-c.imag()*d.real()>0]|=true;
    }
    cout<<((a[0]&a[1])?"NO":"YES")<<endl;
  }
  return 0;
}