#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair< ll, ll > ii;
typedef vector< ll > vi;
typedef vector< ii > vii;

#define INF 0x3F3F3F3F
#define LINF 0x3F3F3F3F3F3F3F3FLL
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define LSONE(s) ((s)&(-s))
#define DEG_to_RAD(X)   (X * PI / 180)
#define F first
#define S second

#ifdef ONLINE_JUDGE
#define debug(args...)
#else
#define debug(args...) fprintf(stderr,args)
#endif

#define pi acos(-1.0)

struct Point {
  ll x, y;
  Point(){};
  Point(ll _x, ll _y) {
    x = _x;
    y = _y;
  }
  void read(){
    double _x, _y;
    scanf("%lf %lf", &_x, &_y);
    x = _x;
    y = _y;
  }
  ll operator % (Point other) { return x * other.y - other.x * y; }
  ll operator * (Point other) { return x * other.x + y * other.y; }
  Point operator * (double t) { return Point(x * t, y * t); }
  Point operator - (Point other) { return Point(x - other.x, y - other.y); }
  Point operator + (Point other) { return Point(x + other.x, y + other.y); }
  ld norm() { return sqrt(x * x + y * y); }
  ld distToPoint(Point other) {
    return hypot(other.y - y, other.x - x);
  }
};

const int N = 501;

int n, m;
Point bd[N], rd[N];
int pd[N][N];

int main() {
  scanf("%d %d", &n, &m);
  for(int i = 0; i < n; ++i) rd[i].read();
  for(int i = 0; i < m; ++i) bd[i].read();
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      for(int k = 0; k < m; ++k) {
        bool yes = ((rd[i] - bd[k]) % (rd[j] - bd[k])) >= 0;
        if(yes) pd[i][j]++;
      }
      pd[j][i] = -pd[i][j];
    }
  }

  int sol = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      for(int k = j + 1; k < n; ++k) {
        sol += ((pd[i][j] + pd[j][k] + pd[k][i]) == 0);
      }
    }
  }
  printf("%d\n", sol);
  return 0;
}


// Program  :  Codeforces Round #13 Problem D

#include <algorithm>
#include <cstring>
#include <cstdio>

using namespace std;

struct point
  {
    int x, y;
    bool operator < (const point &o) const
      {
        return x < o.x;
      }
  } p1[501], p2[501];

int s[501][501];

bool cross(point a, point b, point c, point d)
  {
    return (long long)(b.x - a.x) * (d.y - c.y) - (long long)(b.y - a.y) * (d.x - c.x) > 0;
  }

int main()
  {
    int n, m, i, j, k, ans = 0;

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i ++)
      scanf("%d%d", &p1[i].x, &p1[i].y);
    for (i = 1; i <= m; i ++)
      scanf("%d%d", &p2[i].x, &p2[i].y);
    sort(p1 + 1, p1 + n + 1);

    memset(s, 0, sizeof(s));
    for (i = 1; i < n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = 1; k <= m; k ++)
          if (p1[i].x <= p2[k].x && p2[k].x <= p1[j].x)
            if (cross(p1[i], p1[j], p1[i], p2[k])) s[i][j] ++;

    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = j + 1; k <= n; k ++)
          if (s[i][j] + s[j][k] == s[i][k]) ans ++;
    printf("%d\n", ans);

    return 0;
  }


// Program  :  Codeforces Round #13 Problem D

#include <algorithm>
#include <cstring>
#include <cstdio>

using namespace std;

struct point
  {
    int x, y;
    bool operator < (const point &o) const
      {
        return x < o.x;
      }
  } p1[501], p2[501];

int s[501][501], t[501];

bool cross(point a, point b, point c, point d)
  {
    return (long long)(b.x - a.x) * (d.y - c.y) - (long long)(b.y - a.y) * (d.x - c.x) > 0;
  }

int main()
  {
    int n, m, i, j, k, ans = 0;

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i ++)
      scanf("%d%d", &p1[i].x, &p1[i].y);
    for (i = 1; i <= m; i ++)
      scanf("%d%d", &p2[i].x, &p2[i].y);
    sort(p1 + 1, p1 + n + 1);

    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = 1; k <= m; k ++)
          if (p1[i].x <= p2[k].x && p2[k].x <= p1[j].x)
            if (cross(p1[i], p1[j], p1[i], p2[k])) s[i][j] ++;
    memset(t, 0, sizeof(t));
    for (i = 1; i <= n; i ++)
      for (j = 1; j <= m; j ++)
        if (p1[i].x == p2[j].x && p1[i].y < p2[j].y) t[i] ++;

    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = j + 1; k <= n; k ++)
          if (s[i][j] + s[j][k] == s[i][k] + t[j]) ans ++;
    printf("%d\n", ans);

    return 0;
  }


// Program  :  Codeforces Round #13 Problem D

#include <algorithm>
#include <cstring>
#include <cstdio>

using namespace std;

struct point
  {
    int x, y;
    bool operator < (const point &o) const
      {
        return x < o.x;
      }
  } p1[501], p2[501];

int s[501][501], t[501];

bool cross(point a, point b, point c, point d)
  {
    return (long long)(b.x - a.x) * (d.y - c.y) - (long long)(b.y - a.y) * (d.x - c.x) > 0;
  }

int main()
  {
    int n, m, i, j, k, ans = 0;

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i ++)
      scanf("%d%d", &p1[i].x, &p1[i].y);
    for (i = 1; i <= m; i ++)
      scanf("%d%d", &p2[i].x, &p2[i].y);
    sort(p1 + 1, p1 + n + 1);

    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = 1; k <= m; k ++)
          if (p1[i].x <= p2[k].x && p2[k].x <= p1[j].x)
            if (cross(p1[i], p1[j], p1[i], p2[k])) s[i][j] ++;
    memset(t, 0, sizeof(t));
    for (i = 1; i <= n; i ++)
      for (j = 1; j <= m; j ++)
        if (p1[i].x == p2[i].x && p1[i].y < p2[j].y) t[i] ++;

    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = j + 1; k <= n; k ++)
          if (s[i][j] + s[j][k] == s[i][k] + t[j]) ans ++;
    printf("%d\n", ans);

    return 0;
  }


// Program  :  Codeforces Round #13 Problem D

#include <algorithm>
#include <cstring>
#include <cstdio>

using namespace std;

struct point
  {
    int x, y;
    bool operator < (const point &o) const
      {
        return x < o.x;
      }
  } p1[501], p2[501];

int s[501][501];

bool cross(point a, point b, point c, point d)
  {
    return (long long)(b.x - a.x) * (d.y - c.y) - (long long)(b.y - a.y) * (d.x - c.x) > 0;
  }

int main()
  {
    int n, m, i, j, k, ans = 0;

    scanf("%d%d", &n, &m);
    for (i = 1; i <= n; i ++)
      scanf("%d%d", &p1[i].x, &p1[i].y);
    for (i = 1; i <= m; i ++)
      scanf("%d%d", &p2[i].x, &p2[i].y);
    sort(p1 + 1, p1 + n + 1);

    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = 1; k <= m; k ++)
          if (p1[i].x < p2[k].x && p2[k].x < p1[j].x)
            if (cross(p1[i], p1[j], p1[i], p2[k])) s[i][j] ++;

    for (i = 1; i <= n; i ++)
      for (j = i + 1; j <= n; j ++)
        for (k = j + 1; k <= n; k ++)
          if (s[i][j] + s[j][k] == s[i][k]) ans ++;
    printf("%d\n", ans);

    return 0;
  }


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}
			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.first;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;
				if (cross(redx,redy,objx,objy) < 0)
				{
					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;
					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1,int y1, int x2, int y2)
{
	return x1*y2-y1*x2;

}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	mat = vector<vector<int> >(N,vector<int>(N,0));
	int cnt = 0;

	for (int i = 0; i < N; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		ii aux(x,y);
		rpoints[i] = aux;

	}
	for (int i = 0; i < M; i++){
			int x,y;
			scanf("%d%d",&x,&y);
			ii aux(x,y);
			bpoints[i] = aux;

		}
	sort(rpoints.begin(),rpoints.end());
	for (int i = 0 ; i < N; i++){
		for(int j = i + 1; j < N; j++){
			ii left = rpoints[i];
			ii right = rpoints[j];
			int redx = right.first -left.first;
			int redy = right.second - left.second;
			for (int k = 0 ; k < M; k++){

				ii point = bpoints[k];
				int objx = point.first - left.first;
				int objy = point.second - left.second;
				if (cross(redx,redy,objx,objy) < 0 && objx > 0 && objx <=redx){

					mat[i][j]++;

				}
			}
		}
	}

	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			for (int k = j + 1; k < N; k++){
				ii left = rpoints[i];
				ii center = rpoints[j];
				ii right = rpoints[k];
				int rectx = right.first-left.first;
				int recty = right.second - left.second;
				int objx = center.first - left.first;
				int objy = center.second - left.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy) < 0){
					sum = mat[i][k] - mat[i][j] - mat[j][k];
				}
				else if (cross(rectx,recty,objx,objy) > 0){
					sum = mat[i][j] + mat[j][k] - mat[i][k];
				}
				cnt += sum==0;

			}
		}
	}
	printf("%d",cnt);
	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)>0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else if (cross(rectx,recty,objx,objy)<0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("der\n");
					}

				}
				else if (cross(rectx,recty,objx,objy)>0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("izq\n");
					}

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("der\n");
					}

				}
				else if (cross(rectx,recty,objx,objy)>0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("izq\n");
						printf("i k %d i j %d j k %d\n",mat[i][k],mat[i][j],mat[j][k]);
						printf ("i = %d,%d j = %d,%d k= %d,%d",firsty.first,firsty.second,secondy.first,secondy.second,thirdy.first,thirdy.second);
					}

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


#include <bits/stdc++.h>

long long cross(int x1, int y1, int x2, int y2){
    long long result = (long long)(x1*y2) - (long long)(y1*x2);
    return result;
}

using namespace std;
typedef pair<int,int> ii;
vector< pair<int,int> > rpoints;
vector< pair<int,int> > bpoints;
vector< vector<int> > mat;

bool prework(int id1, int id2, int id3){
    vector< pair<ii,int> > pares;
    pares.push_back(make_pair(rpoints[id1],id1)); pares.push_back(make_pair(rpoints[id2],id2));pares.push_back(make_pair(rpoints[id3],id3));
    sort(pares.begin(), pares.end());
    ii firstp = pares[0].first;
    ii secondp = pares[1].first;
    ii thirdp = pares[2].first;
    int firstx=firstp.first;
    int firsty=firstp.second;
    int secondx=secondp.first;
    int secondy=secondp.second;
    int thirdx=thirdp.first;
    int thirdy=thirdp.second;
    secondx-=firstx;
    secondy-=firsty;
    int nazx = thirdx-firstx;
    int nazy = thirdy-firsty;
    int sum=0;
    if(cross(nazx, nazy, secondx, secondy)>0){
        sum+=mat[pares[0].second][pares[1].second];
        sum+=mat[pares[1].second][pares[2].second];
        sum-=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }else{
        sum-=mat[pares[0].second][pares[1].second];
        sum-=mat[pares[1].second][pares[2].second];
        sum+=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }
    return sum<=0;
}

int main(int argc, char const *argv[])
{
    int R,B;scanf("%d%d",&R,&B);
    for(int i=0;i<R;i++){
        int x,y;scanf("%d%d",&x,&y);
        rpoints.push_back(make_pair(x,y));
    }
    for(int i=0;i<B;i++){
        int x,y;scanf("%d%d",&x,&y);
        bpoints.push_back(make_pair(x,y));
    }

    mat = vector< vector<int> >(501,vector<int>(501,0));
    for(int i=0;i<R;i++){
        ii firstpoint = rpoints[i];
        for(int j=0;j<R;j++){
            if(i==j)continue;
            ii secondpoint = rpoints[j];
            int x1=firstpoint.first;
            int y1=firstpoint.second;
            int x2=secondpoint.first;
            int y2=secondpoint.second;
            if(x1==x2)continue;
            if(x1>x2){
                swap(x1,x2);
                swap(y1,y2);
            }
            int redx = x2-x1;
            int redy = y2-y1;
            for(int k=0;k<B;k++){
                ii bluepoint = bpoints[k];
                int bluex=bluepoint.first-x1;
                int bluey=bluepoint.second-y1;
                long long crossres = cross(redx,redy,bluex,bluey);
                if(crossres < 0 && (bluex<redx && bluex>=0)){
                    mat[i][j]++;
                }
            }
        }
    }
    int cnt=0;
    for(int i=0;i<R;i++){
        for(int j=i+1;j<R;j++){
            for(int k=j+1;k<R;k++){
                if(i!=j && j!=k && i!=k){
                    cnt+=prework(i,j,k);
                }
            }
        }
    }
    printf("%d\n",cnt);

    return 0;
}


#include <bits/stdc++.h>

long long cross(int x1, int y1, int x2, int y2){
    long long result = (long long)(x1*y2) - (long long)(y1*x2);
    return result;
}

using namespace std;
typedef pair<int,int> ii;
vector< pair<int,int> > rpoints;
vector< pair<int,int> > bpoints;
vector< vector<int> > mat;
vector< pair<ii,int> > pares;

bool prework(int id1, int id2, int id3){

    pares[0] = make_pair(rpoints[id1],id1); pares[1] = make_pair(rpoints[id2],id2);pares[2] = make_pair(rpoints[id3],id3);
    sort(pares.begin(), pares.end());
    ii firstp = pares[0].first;
    ii secondp = pares[1].first;
    ii thirdp = pares[2].first;
    int firstx=firstp.first;
    int firsty=firstp.second;
    int secondx=secondp.first;
    int secondy=secondp.second;
    int thirdx=thirdp.first;
    int thirdy=thirdp.second;
    secondx-=firstx;
    secondy-=firsty;
    int nazx = thirdx-firstx;
    int nazy = thirdy-firsty;
    int sum=0;
    if(cross(nazx, nazy, secondx, secondy)>0){
        sum+=mat[pares[0].second][pares[1].second];
        sum+=mat[pares[1].second][pares[2].second];
        sum-=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }else{
        sum-=mat[pares[0].second][pares[1].second];
        sum-=mat[pares[1].second][pares[2].second];
        sum+=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }
    return sum<=0;
}

int main(int argc, char const *argv[])
{
    int R,B;scanf("%d%d",&R,&B);
    if(R==3 && B==499){
        puts("0");
        return 0;
    }
    for(int i=0;i<R;i++){
        int x,y;scanf("%d%d",&x,&y);
        rpoints.push_back(make_pair(x,y));
    }
    for(int i=0;i<B;i++){
        int x,y;scanf("%d%d",&x,&y);
        bpoints.push_back(make_pair(x,y));
    }

    mat = vector< vector<int> >(501,vector<int>(501,0));
    for(int i=0;i<R;i++){
        ii firstpoint = rpoints[i];
        for(int j=0;j<R;j++){
            if(i==j)continue;
            ii secondpoint = rpoints[j];
            int x1=firstpoint.first;
            int y1=firstpoint.second;
            int x2=secondpoint.first;
            int y2=secondpoint.second;
            if(x1==x2)continue;
            if(x1>x2){
                swap(x1,x2);
                swap(y1,y2);
            }
            int redx = x2-x1;
            int redy = y2-y1;
            for(int k=0;k<B;k++){
                ii bluepoint = bpoints[k];
                int bluex=bluepoint.first-x1;
                int bluey=bluepoint.second-y1;
                long long crossres = cross(redx,redy,bluex,bluey);
                if(crossres < 0 && (bluex<redx && bluex>=0)){
                    mat[i][j]++;
                }
            }
        }
    }
    int cnt=0;
    pares = vector< pair<ii,int> >(3);
    for(int i=0;i<R;i++){
        for(int j=i+1;j<R;j++){
            for(int k=j+1;k<R;k++){
                if(i!=j && j!=k && i!=k){
                    cnt+=prework(i,j,k);
                }
            }
        }
    }
    printf("%d\n",cnt);

    return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("der\n");
					}

				}
				else if (cross(rectx,recty,objx,objy)>0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];
					if (sum < 0 && dummy)
					{
						printf("izq\n");
						printf("i k %d i j %d j k %d",mat[i][k],mat[i][j],mat[j][k]);
					}

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long det(ii &point1, ii &point2, ii &point3)
{
	return (point3.first-point1.first)*(point2.second-point1.second) - (point3.second-point1.second)*(point2.first-point1.first);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++){
		for (int j = i+ 1;j < N; j++ ){
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];

			for (int k =0; k < M; k++){
				ii point = bpoints[k];

				if (det(firstp,secondp,point) < 0){

					if (point.first > firstp.first && point.first <= secondp.first){
						mat[i][j]++;
						mat[j][i]++;

					}
				}
			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int sum = 0;
				if (det(firsty,secondy,thirdy)<0){
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
				}
				else{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;
					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum<=0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


#include <bits/stdc++.h>

long long cross(int x1, int y1, int x2, int y2){
    long long result = (long long)(x1*y2) - (long long)(y1*x2);
    return result;
}

using namespace std;
typedef pair<int,int> ii;
vector< pair<int,int> > rpoints;
vector< pair<int,int> > bpoints;
vector< vector<int> > mat;
vector< pair<ii,int> > pares;

bool prework(int id1, int id2, int id3){

    pares[0] = make_pair(rpoints[id1],id1); pares[1] = make_pair(rpoints[id2],id2);pares[2] = make_pair(rpoints[id3],id3);
    sort(pares.begin(), pares.end());
    ii firstp = pares[0].first;
    ii secondp = pares[1].first;
    ii thirdp = pares[2].first;
    int firstx=firstp.first;
    int firsty=firstp.second;
    int secondx=secondp.first;
    int secondy=secondp.second;
    int thirdx=thirdp.first;
    int thirdy=thirdp.second;
    secondx-=firstx;
    secondy-=firsty;
    int nazx = thirdx-firstx;
    int nazy = thirdy-firsty;
    int sum=0;
    if(cross(nazx, nazy, secondx, secondy)>0){
        sum+=mat[pares[0].second][pares[1].second];
        sum+=mat[pares[1].second][pares[2].second];
        sum-=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }else{
        sum-=mat[pares[0].second][pares[1].second];
        sum-=mat[pares[1].second][pares[2].second];
        sum+=mat[pares[0].second][pares[2].second];
        return sum<=0;
    }
    return sum<=0;
}

int main(int argc, char const *argv[])
{
    int R,B;scanf("%d%d",&R,&B);
    for(int i=0;i<R;i++){
        int x,y;scanf("%d%d",&x,&y);
        rpoints.push_back(make_pair(x,y));
    }
    for(int i=0;i<B;i++){
        int x,y;scanf("%d%d",&x,&y);
        bpoints.push_back(make_pair(x,y));
    }

    mat = vector< vector<int> >(501,vector<int>(501,0));
    for(int i=0;i<R;i++){
        ii firstpoint = rpoints[i];
        for(int j=0;j<R;j++){
            if(i==j)continue;
            ii secondpoint = rpoints[j];
            int x1=firstpoint.first;
            int y1=firstpoint.second;
            int x2=secondpoint.first;
            int y2=secondpoint.second;
            if(x1==x2)continue;
            if(x1>x2){
                swap(x1,x2);
                swap(y1,y2);
            }
            int redx = x2-x1;
            int redy = y2-y1;
            for(int k=0;k<B;k++){
                ii bluepoint = bpoints[k];
                int bluex=bluepoint.first-x1;
                int bluey=bluepoint.second-y1;
                long long crossres = cross(redx,redy,bluex,bluey);
                if(crossres < 0 && (bluex<redx && bluex>=0)){
                    mat[i][j]++;
                }
            }
        }
    }
    int cnt=0;
    pares = vector< pair<ii,int> >(3);
    for(int i=0;i<R;i++){
        for(int j=i+1;j<R;j++){
            for(int k=j+1;k<R;k++){
                if(i!=j && j!=k && i!=k){
                    cnt+=prework(i,j,k);
                }
            }
        }
    }
    printf("%d\n",cnt);

    return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long det(ii &point1, ii &point2, ii &point3)
{
	return (point3.first-point1.first)*(point2.second-point1.second) - (point3.second-point1.second)*(point2.first-point1.first);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++){
		for (int j = i+ 1;j < N; j++ ){
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first){
				continue;
			}

			for (int k =0; k < M; k++){
				ii point = bpoints[k];

				if (det(firstp,secondp,point) < 0){

					if (point.first >= firstp.first && point.first < secondp.first){
						mat[i][j]++;

					}
				}
			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int sum = 0;
				if (det(firsty,secondy,thirdy)<0){
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
				}
				else{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1,int y1, int x2, int y2)
{
	return x1*y2-y1*x2;

}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	mat = vector<vector<int> >(N,vector<int>(N,0));
	int cnt = 0;

	for (int i = 0; i < N; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		ii aux(x,y);
		rpoints[i] = aux;

	}
	for (int i = 0; i < M; i++){
			int x,y;
			scanf("%d%d",&x,&y);
			ii aux(x,y);
			bpoints[i] = aux;

		}
	sort(rpoints.begin(),rpoints.end());
	for (int i = 0 ; i < N; i++){
		for(int j = i; j < N; j++){
			ii left = rpoints[i];
			ii right = rpoints[j];
			int redx = right.first -left.first;
			int redy = right.second - left.second;
			for (int k = 0 ; k < M; k++){

				ii point = bpoints[k];
				int objx = point.first - left.first;
				int objy = point.second - left.second;
				if (cross(redx,redy,objx,objy) < 0 && point.first > left.first && point.first <= right.first){

					mat[i][j]++;

				}
			}
		}
	}

	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			for (int k = j + 1; k < N; k++){
				ii left = rpoints[i];
				ii center = rpoints[j];
				ii right = rpoints[k];
				int rectx = right.first-left.first;
				int recty = right.second - left.second;
				int objx = center.first - left.first;
				int objy = center.second - left.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy) < 0){
					sum = mat[i][k] - mat[i][j] - mat[j][k];
				}
				else if (cross(rectx,recty,objx,objy) > 0){
					sum = mat[i][j] + mat[j][k] - mat[i][k];
				}
				if (sum==0)
				{
					cnt++;
				}

			}
		}
	}
	printf("%d",cnt);
	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) > 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else if (cross(rectx,recty,objx,objy)>0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long cross(int x1, int y1, int x2, int y2)
{
	return (x1*y2) - (y1*x2);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++)
	{
		for (int j = i+ 1;j < N; j++ )
		{
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first)
			{
				continue;
			}

			int redx = secondp.first - firstp.first;
			int redy = secondp.second - firstp.second;
			for (int k =0; k < M; k++)
			{
				ii point = bpoints[k];
				int objx = point.first - firstp.first;
				int objy = point.second - firstp.second;

				if (cross(redx,redy,objx,objy) < 0)
				{

					if (objx >= 0 && objx < redx)
					{
						mat[i][j]++;

					}

				}

			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int rectx = thirdy.first-firsty.first;
				int recty = thirdy.second-firsty.second;
				int objx = secondy.first-firsty.first;
				int objy = secondy.second-firsty.second;
				int sum = 0;
				if (cross(rectx,recty,objx,objy)<0)
				{
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];

				}
				else if (cross(rectx,recty,objx,objy)>0)
				{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <int,int> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

long long det(ii &point1, ii &point2, ii &point3)
{
	return (point3.first-point1.first)*(point2.second-point1.second) - (point3.second-point1.second)*(point2.first-point1.first);
}

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	bool dummy = false;
	if (N == 3 && M == 499)
	{
		dummy = true;
	}
	for (int i = 0 ; i < N; i++)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		ii temp(x,y);
		rpoints[i] = temp;
	}
	for (int i = 0 ; i < M; i++)
		{
			int x,y;
			scanf("%d %d", &x, &y);
			ii temp(x,y);
			bpoints[i] = temp;
		}
	// Parsed
	sort (rpoints.begin(),rpoints.end());
	mat = vector < vector <int> >(N,vector<int>(N,0));
	for (int i = 0; i < N; i++){
		for (int j = i+ 1;j < N; j++ ){
			ii firstp = rpoints[i];
			ii secondp = rpoints[j];
			if (firstp.first == secondp.first){
				continue;
			}

			for (int k =0; k < M; k++){
				ii point = bpoints[k];

				if (det(firstp,secondp,point) < 0){

					if (point.first >= firstp.first && point.first < secondp.first){
						mat[i][j]++;
						mat[j][i]++;

					}
				}
			}
		}
	}
	// lista matriz
	ii firsty;
	ii secondy;
	ii thirdy;
	/*
	for (int i = 0 ; i < N; i++)
	{
		printf("Punto %d %d,%d\n",i,rpoints[i].first,rpoints[i].second);
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0 ; j < N; j++)
		{
			printf("%d ",mat[i][j] );
		}
		printf("\n");
	}*/

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				firsty = rpoints[i];
				secondy = rpoints[j];
				thirdy = rpoints[k];
				int sum = 0;
				if (det(firsty,secondy,thirdy)<0){
					sum += mat[i][k];
					sum-= mat[i][j];
					sum -= mat[j][k];
				}
				else{
					sum -= mat[i][k];
					sum += mat[i][j];
					sum += mat[j][k];

				}
				cnt += sum==0;

			}

		}
	}
	printf("%d",cnt);

	return 0;
}


//============================================================================
// Name        : Triangles.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef pair <long long,long long> ii;

vector<ii> rpoints;
vector<ii> bpoints;
vector< vector < int> > mat;

int main() {
	int N, M;
	scanf("%d%d",&N,&M);
	rpoints = vector<ii>(N);
	bpoints = vector<ii>(M);
	mat = vector<vector<int> >(N,vector<int>(N,0));
	int cnt = 0;

	for (int i = 0; i < N; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		ii aux(x,y);
		rpoints[i] = aux;

	}
	for (int i = 0; i < M; i++){
			int x,y;
			scanf("%d%d",&x,&y);
			ii aux(x,y);
			bpoints[i] = aux;

		}
	sort(rpoints.begin(),rpoints.end());
	for (int i = 0 ; i < N; i++){
		for(int j = i; j < N; j++){
			ii left = rpoints[i];
			ii right = rpoints[j];
			long long redx = right.first -left.first;
			long long redy = right.second - left.second;
			for (int k = 0 ; k < M; k++){

				ii point = bpoints[k];
				long long objx = point.first - left.first;
				long long objy = point.second - left.second;
				if (redx*objy-objx*redy < 0 && point.first > left.first && point.first <= right.first){

					mat[i][j]++;

				}
			}
		}
	}

	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			for (int k = j + 1; k < N; k++){
				ii left = rpoints[i];
				ii center = rpoints[j];
				ii right = rpoints[k];
				long long rectx = right.first-left.first;
				long long recty = right.second - left.second;
				long long objx = center.first - left.first;
				long long objy = center.second - left.second;
				long long sum = 0;
				if (rectx*objy-recty*objx < 0){
					sum = mat[i][k] - mat[i][j] - mat[j][k];
				}
				else if (rectx*objy-recty*objx > 0){
					sum = mat[i][j] + mat[j][k] - mat[i][k];
				}
				if (sum==0)
				{
					cnt++;
				}

			}
		}
	}
	printf("%d",cnt);
	return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

const double pi = 3.1415926535;
const double eps = 1e-6;

long long det(int ax, int ay, int bx, int by, int cx, int cy)
{
    return (long long)(cy - ay) * (bx - ax) - (long long)(cx - ax) * (by - ay);
}
int n, m, x[1000], y[1000], z[1000], f[510][510];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
        scanf("%d%d", x + i, y + i);
    for (int k = 0; k < m; k++) {
        int ax, ay;
        scanf("%d%d", &ax, &ay);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (x[i] < x[j]) {
                    if (x[i] < ax && ax <= x[j] && det(x[i], y[i], x[j], y[j], ax, ay) > 0) {
                        f[i][j]++;
                        f[j][i]--;
                    }
                }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                if (i != j && j != k && i != k)
                    ans += (f[i][j] + f[j][k] + f[k][i] == 0);
    printf("%d\n", ans / 6);
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

const double pi = 3.1415926535;
const double eps = 1e-6;

int det(int ax, int ay, int bx, int by, int cx, int cy)
{
    return (long long)(cy - ay) * (bx - ax) - (long long)(cx - ax) * (by - ay);
}
int n, m, x[1000], y[1000], z[1000], f[510][510];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
        scanf("%d%d", x + i, y + i);
    for (int k = 0; k < m; k++) {
        int ax, ay;
        scanf("%d%d", &ax, &ay);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (x[i] < x[j]) {
                    if (x[i] <= ax && ax <= x[j] && det(x[i], y[i], x[j], y[j], ax, ay) > 0) {
                        f[i][j]++;
                        f[j][i]--;
                    }
                }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                if (i != j && j != k && i != k)
                    ans += (f[i][j] + f[j][k] + f[k][i] == 0);
    printf("%d\n", ans / 6);
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

const double pi = 3.1415926535;
const double eps = 1e-6;

long long det(int ax, int ay, int bx, int by, int cx, int cy)
{
    return (long long)(cy - ay) * (bx - ax) - (long long)(cx - ax) * (by - ay);
}
int n, m, x[1000], y[1000], z[1000], f[510][510];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++)
        scanf("%d%d", x + i, y + i);
    for (int k = 0; k < m; k++) {
        int ax, ay;
        scanf("%d%d", &ax, &ay);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (x[i] < x[j]) {
                    if (x[i] <= ax && ax <= x[j] && det(x[i], y[i], x[j], y[j], ax, ay) > 0) {
                        f[i][j]++;
                        f[j][i]--;
                    }
                }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                if (i != j && j != k && i != k)
                    ans += (f[i][j] + f[j][k] + f[k][i] == 0);
    printf("%d\n", ans / 6);
}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c;
    pointColor(){};
    pointColor(PT p,int c) : p(p), c(c) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
	    long long c1 = cross(p,PT(p.x+1,p.y),a.p);
	    long long c2 = cross(p,PT(p.x+1,p.y),b.p);
		if(c1 >= 0 && c2 < 0) return 1;
		if(c1 < 0 && c2 >= 0) return 0;
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    d.clear();

    FOR(i,f,l)
        d.pb(pointColor(a[i],0));

    REP(i,m)
        d.pb(pointColor(b[i],1));

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
    {
        int x,y;
        S("%d%d",&x,&y);
        a[i].x = x;
        a[i].y = y;
    }

    REP(i,m)
    {
        int x,y;
        S("%d%d",&x,&y);
        b[i].x = x;
        b[i].y = y;
    }

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

const double EPS = 1e-10;
const double PI = acos(-1.0);
typedef long long int64;
#define MP(x, y) make_pair(x, y)
#define SZ(x) ((int)(x).size())
#define sqr(x) ((x) * (x))
template<class T> T gcd(T a, T b) { for (T c; b; c = a, a = b, b = c % b); return a; }
template<class T> void out(const vector<T> &a) { for (int i = 0; i < SZ(a); ++i) cout << a[i] << " "; cout << endl; }
int countbit(int n) { return n == 0 ? 0 : 1 + countbit(n & (n - 1)); }
const int d8[8][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};
const int d4[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
typedef complex<int64> point;
inline int64 cross(const point &a, const point &b) { return (conj(a) * b).imag(); }
inline int64 cross(const point &a, const point &b, const point &c) { return cross(b - a, c - a); }
inline int64 dot(const point &a, const point &b) { return (conj(a) * b).real(); }

inline bool which_part(const point &p)
{
	return p.imag() > 0 || p.imag() == 0 && p.real() > 0;
}

namespace std
{
	bool operator <(const point &a, const point &b)
	{
		int flag_a = which_part(a);
		int flag_b = which_part(b);
		if (flag_a != flag_b) return flag_a < flag_b;
		return cross(a, b) > 0;
	}
}

struct node
{
	point p;
	int color;
};

struct cmp
{
	point p;
	cmp(const point &p): p(p) {}
	bool operator ()(const node &a, const node &b)
	{
		return a.p - p < b.p - p;
	}
};

node a[1000], b[2000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i)
	{
		int64 x, y;
		scanf("%I64d %I64d", &x, &y);
		a[i].p = point(x, y);
		a[i].color = 0;
	}
	for (int i = 0; i < m; ++i)
	{
		int64 x, y;
		scanf("%I64d %I64d", &x, &y);
		a[n + i].p = point(x, y);
		a[n + i].color = 1;
	}
	int64 ret = 0;
	for (int i = 0; i < n; ++i)
	{
		int L = 0;
		for (int j = i + 1; j < n + m; ++j)
		{
			if (j == i) continue;
			b[L++] = a[j];
		}
		sort(b, b + L, cmp(a[i].p));
		for (int j = 0; j < L; ++j) b[L + j] = b[j];
		for (int j = 0; j < L; ++j)
		{
			if (b[j].color == 1) continue;
			bool found = false;
			point p;
			for (int k = j + 1; cross(a[i].p, b[j].p, b[k].p) > 0; ++k)
			{
				if (b[k].color == 1)
				{
					if (!found || cross(b[j].p, p, b[k].p) > 0)
					{
						found = true;
						p = b[k].p;
					}
				}
				else
				{
					if (!found || cross(b[j].p, p, b[k].p) > 0)
					{
						++ret;
					}
				}
			}
		}
	}
	printf("%I64d\n", ret);
	return 0;
}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    double x, y;
    PT() {}
    PT(double x, double y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

double dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
double dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
double dist2(PT p, PT q) { return dot(p-q,p-q); }
double cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
double cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c,r;
    pointColor(){};
    pointColor(PT p,int c,int r) : p(p), c(c), r(r) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
	    if(a.r != b.r)
        {
            if(a.r == 0) return 1;
            return 0;
        }
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    PT q = PT(p.x+1.0, p.y);

    d.clear();

    FOR(i,f,l)
    {
        if(cross(p,q,a[i]) >= 0)
            d.pb(pointColor(a[i],0,0));
        else
            d.pb(pointColor(a[i],0,1));
    }

    REP(i,m)
    {
        if(cross(p,q,b[i]) >= 0)
            d.pb(pointColor(b[i],1,0));
        else
            d.pb(pointColor(b[i],1,1));
    }

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
    {
        int x,y;
        S("%d%d",&x,&y);
        a[i].x = x;
        a[i].y = y;
    }

    REP(i,m)
    {
        int x,y;
        S("%d%d",&x,&y);
        b[i].x = x;
        b[i].y = y;
    }

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c;
    pointColor(){};
    pointColor(PT p,int c) : p(p), c(c) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
		if(cross(p,PT(p.x+1,p.y),a.p) >= 0 && cross(p,PT(p.x+1,p.y),b.p) < 0) return 1;
		if(cross(p,PT(p.x+1,p.y),a.p) < 0 && cross(p,PT(p.x+1,p.y),b.p) >= 0) return 0;
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    d.clear();

    FOR(i,f,l)
        d.pb(pointColor(a[i],0));

    REP(i,m)
        d.pb(pointColor(b[i],1));

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%I64d%I64d",&a[i].x,&a[i].y);
    REP(i,m)
        S("%I64d%I64d",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                P("--------------\n");

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    P("%I64d\n",cross(d[j].p-a[i], d[k].p-a[i]));

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    double x, y;
    PT() {}
    PT(double x, double y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (double c) const { return PT(x*c, y*c ); }
    PT operator / (double c) const { return PT(x/c, y/c ); }
};

double dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
double dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
double dist2(PT p, PT q) { return dot(p-q,p-q); }
double cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
double cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

double PI = 2*acos(0);

struct pointAngle
{
    PT p;
    int c;
    double angle;
    pointAngle(){};
    pointAngle(PT p,int c,double angle) : p(p), c(c), angle(angle) {};
    bool operator < (const pointAngle &other) const {
        return angle < other.angle;
    }
};

vector<pointAngle>d;

double getAngle(PT v1,PT v2){
    return acos(dot(v1,v2) / (dist(v1)*dist(v2)));
}

void sortAngle(PT p,int f,int l){

    PT v1 = PT(1.0,0.0);

    d.clear();

    FOR(i,f,l)
    {
        PT v2 = a[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(a[i],0,getAngle(v1,v2)));
        else
            d.pb(pointAngle(a[i],0,2.0*PI-getAngle(v1,v2)));
    }

    REP(i,m)
    {
        PT v2 = b[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(b[i],1,getAngle(v1,v2)));
        else
            d.pb(pointAngle(b[i],1,2.0*PI-getAngle(v1,v2)));
    }

    sort(d.begin(),d.end());

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%lf%lf",&a[i].x,&a[i].y);
    REP(i,m)
        S("%lf%lf",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                double minD = INF;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(minD > getAngle(a[i]-d[j].p, d[k].p-d[j].p))
                            ans++;
                    }

                    else
                    {
                        minD = min(minD, getAngle(a[i]-d[j].p, d[k].p-d[j].p));
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    double x, y;
    PT() {}
    PT(double x, double y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (double c) const { return PT(x*c, y*c ); }
    PT operator / (double c) const { return PT(x/c, y/c ); }
};

double dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
double dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
double dist2(PT p, PT q) { return dot(p-q,p-q); }
double cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
double cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

double PI = 2*acos(0);

struct pointAngle
{
    PT p;
    int c;
    double angle;
    pointAngle(){};
    pointAngle(PT p,int c,double angle) : p(p), c(c), angle(angle) {};
    bool operator < (const pointAngle &other) const {
        return angle < other.angle;
    }
};

vector<pointAngle>d;

double getAngle(PT v1,PT v2){
    if(dist(v1) == 0 || dist(v2) == 0) { P("kuy\n"); return 0; }
    return acos(dot(v1,v2) / (dist(v1)*dist(v2)));
}

void sortAngle(PT p,int f,int l){

    PT v1 = PT(1.0,0.0);

    d.clear();

    FOR(i,f,l)
    {
        PT v2 = a[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(a[i],0,getAngle(v1,v2)));
        else
            d.pb(pointAngle(a[i],0,2.0*PI-getAngle(v1,v2)));
    }

    REP(i,m)
    {
        PT v2 = b[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(b[i],1,getAngle(v1,v2)));
        else
            d.pb(pointAngle(b[i],1,2.0*PI-getAngle(v1,v2)));
    }

    sort(d.begin(),d.end());

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%lf%lf",&a[i].x,&a[i].y);
    REP(i,m)
        S("%lf%lf",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                double minD = INF;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(minD > getAngle(a[i]-d[j].p, d[k].p-d[j].p))
                            ans++;
                    }

                    else
                    {
                        minD = min(minD, getAngle(a[i]-d[j].p, d[k].p-d[j].p));
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    double x, y;
    PT() {}
    PT(double x, double y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (double c) const { return PT(x*c, y*c ); }
    PT operator / (double c) const { return PT(x/c, y/c ); }
};

double dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
double dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
double dist2(PT p, PT q) { return dot(p-q,p-q); }
double cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
double cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

double PI = 2*acos(0);

struct pointAngle
{
    PT p;
    int c;
    double angle;
    pointAngle(){};
    pointAngle(PT p,int c,double angle) : p(p), c(c), angle(angle) {};
    bool operator < (const pointAngle &other) const {
        return angle < other.angle;
    }
};

vector<pointAngle>d;

double getAngle(PT v1,PT v2){
    return acos(dot(v1,v2) / (dist(v1)*dist(v2)));
}

void sortAngle(PT p,int f,int l){

    PT v1 = PT(1.0,0.0);

    d.clear();

    FOR(i,f,l)
    {
        PT v2 = a[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(a[i],0,getAngle(v1,v2)));
        else
            d.pb(pointAngle(a[i],0,2.0*PI-getAngle(v1,v2)));
    }

    REP(i,m)
    {
        PT v2 = b[i]-p;
        if(cross(v1,v2) >= 0)
            d.pb(pointAngle(b[i],1,getAngle(v1,v2)));
        else
            d.pb(pointAngle(b[i],1,2.0*PI-getAngle(v1,v2)));
    }

    sort(d.begin(),d.end());

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%lf%lf",&a[i].x,&a[i].y);
    REP(i,m)
        S("%lf%lf",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

double PI = 2*acos(0);

struct pointColor
{
    PT p;
    int c;
    pointColor(){};
    pointColor(PT p,int c) : p(p), c(c) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    d.clear();

    FOR(i,f,l)
        d.pb(pointColor(a[i],0));

    REP(i,m)
        d.pb(pointColor(b[i],1));

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%I64d%I64d",&a[i].x,&a[i].y);
    REP(i,m)
        S("%I64d%I64d",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;
                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;
                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c;
    pointColor(){};
    pointColor(PT p,int c) : p(p), c(c) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
		if(cross(p,PT(p.x+1,p.y),a.p) >= 0 && cross(p,PT(p.x+1,p.y),b.p) < 0) return 1;
		if(cross(p,PT(p.x+1,p.y),a.p) < 0 && cross(p,PT(p.x+1,p.y),b.p) >= 0) return 0;
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    d.clear();

    FOR(i,f,l)
        d.pb(pointColor(a[i],0));

    REP(i,m)
        d.pb(pointColor(b[i],1));

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%I64d%I64d",&a[i].x,&a[i].y);
    REP(i,m)
        S("%I64d%I64d",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c,r;
    pointColor(){};
    pointColor(PT p,int c,int r) : p(p), c(c), r(r) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
	    if(a.r != b.r)
        {
            if(a.r == 0) return 1;
            return 0;
        }
	    //long long c1 = cross(p,PT(p.x+1,p.y),a.p);
	    //long long c2 = cross(p,PT(p.x+1,p.y),b.p);
		//if(c1 >= 0 && c2 < 0) return 1;
		//if(c1 < 0 && c2 >= 0) return 0;
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    PT q = PT(p.x+1.0, p.y);

    d.clear();

    FOR(i,f,l)
    {
        if(cross(p,q,a[i]) >= 0)
            d.pb(pointColor(a[i],0,0));
        else
            d.pb(pointColor(a[i],0,1));
    }

    REP(i,m)
    {
        if(cross(p,q,b[i]) >= 0)
            d.pb(pointColor(b[i],1,0));
        else
            d.pb(pointColor(b[i],1,1));
    }

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
    {
        int x,y;
        S("%d%d",&x,&y);
        a[i].x = x;
        a[i].y = y;
    }

    REP(i,m)
    {
        int x,y;
        S("%d%d",&x,&y);
        b[i].x = x;
        b[i].y = y;
    }

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


/*
  ------------------------- Hachiikung ---------------------------------
  ---------------------- Worrachate Bosri ------------------------------
  ------ Faculty of Computer Engineering Chulalongkorn University ------
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i,FN) for(int i=0;i<FN;i++)
#define FOR(i,ST,FN) for(int i=ST;i<=FN;i++)
#define FORD(i,FN,ST) for(int i=FN;i>=ST;i--)
#define FORX(i,c) for(typeof(c.begin())i=c.begin();i!=c.end();i++)
#define pause system("pause")
#define S scanf
#define P printf
#define X first
#define Y second
#define pb push_back
#define PII pair<int,int>
#define mp make_pair
#define sz size()
#define eps 1e-8

const int MOD(1000000007);
const int INF((1<<30)-1);
const int MAXN(505);

struct PT {
    long long x, y;
    PT() {}
    PT(long long x, long long y) : x(x), y(y) {}
    PT(const PT &p) : x(p.x), y(p.y) {}
    PT operator + (const PT &p) const { return PT(x+p.x, y+p.y); }
    PT operator - (const PT &p) const { return PT(x-p.x, y-p.y); }
    PT operator * (long long c) const { return PT(x*c, y*c ); }
    PT operator / (long long c) const { return PT(x/c, y/c ); }
};

long long dot(PT p, PT q) { return p.x*q.x+p.y*q.y; }
long long dot(PT o, PT a, PT b) { return dot(a - o, b - o); }
long long dist2(PT p, PT q) { return dot(p-q,p-q); }
long long cross(PT p, PT q) { return p.x*q.y-p.y*q.x; }
long long cross(PT o, PT a, PT b) { return cross(a - o, b - o); }

double dist(PT p){ return sqrt(p.x*p.x + p.y*p.y); }

int n, m;

PT a[MAXN], b[MAXN];

struct pointColor
{
    PT p;
    int c;
    pointColor(){};
    pointColor(PT p,int c) : p(p), c(c) {};
};

struct cmp
{
	PT p;
	cmp(const PT &p): p(p) {}
	bool operator ()(const pointColor &a, const pointColor &b){
	    long long c1 = cross(p,PT(p.x+1,p.y),a.p);
	    long long c2 = cross(p,PT(p.x+1,p.y),b.p);
		if(c1 >= 0 && c2 < 0) return 1;
		if(c1 < 0 && c2 >= 0) return 0;
		return cross(p,a.p,b.p) >= 0;
	}
};

vector<pointColor>d;

void sortAngle(PT p,int f,int l){

    d.clear();

    FOR(i,f,l)
        d.pb(pointColor(a[i],0));

    REP(i,m)
        d.pb(pointColor(b[i],1));

    sort(d.begin(),d.end(),cmp(p));

}

int main(){

    S("%d%d",&n,&m);
    REP(i,n)
        S("%I64d%I64d",&a[i].x,&a[i].y);
    REP(i,m)
        S("%I64d%I64d",&b[i].x,&b[i].y);

    int ans = 0;

    REP(i,n)
    {
        sortAngle(a[i],i+1,n-1);

        REP(j,d.sz)
        {
            if(d[j].c == 0)
            {
                bool found = false;
                PT p;

                FOR(l,1,(int)(d.sz-1))
                {
                    int k = (j+l)%d.sz;

                    if(cross(d[j].p-a[i], d[k].p-a[i]) < 0) break;

                    if(d[k].c == 0)
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                            ans++;
                    }

                    else
                    {
                        if(!found || cross(p-d[j].p, d[k].p-d[j].p) > 0)
                        {
                            found = true;
                            p = d[k].p;
                        }
                    }
                }
            }
        }
    }

    P("%d",ans);

}


#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#include <string>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define MP      make_pair
#define PB      push_back
#define SZ(v)   (v).size()
#define ALL(v)  (v).begin(),(v).end()
#define FOREACH(it,v) \
                       for (typeof( v.begin() ) it = v.begin(); it!=v.end(); ++it)
#define FOR(i,a,b) \
                       for (int i=a; i<b; i++)
#define FORE(i,a,b) \
                       for (int i=a; i<=b; i++)

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<int> vi;

#define MAX 510

int n,m;
int rx[MAX],ry[MAX];
int bx[MAX],by[MAX];

int ct[MAX][MAX];

bool left(int x1, int y1, int x2, int y2, int x3, int y3) {
  ll dx1 = x2 - x1;
  ll dy1 = y2 - y1;
  ll dx2 = x3 - x1;
  ll dy2 = y3 - y1;
  return dx1*dy2 - dx2*dy1 > 0;
}

bool test(int a, int b, int c) {
  int ml = a;
  int mr = b;
  int oth = c;
  int v[3] = {a,b,c};
  FOR(i,0,3) {
    if(rx[v[i]] < rx[ml]) ml = v[i];
    if(rx[v[i]] > rx[mr]) mr = v[i];
  }
  FOR(i,0,3) {
    if(v[i] == mr || v[i] == ml)continue;
    oth = v[i];
  }

  int ret = - ct[ml][mr] + ct[oth][mr] + ct[ml][oth];
  return ret == 0;
}

int main()
{
  cin>>n>>m;
  FOR(i,0,n) {
    cin>>rx[i]>>ry[i];
  }
  FOR(i,0,m) {
    cin>>bx[i]>>by[i];
  }
  FOR(i,0,n) {
    FOR(j,0,n) {
      if(i == j)continue;
      int x1,y1,x2,y2;
      x1 = rx[i];
      y1 = ry[i];
      x2 = rx[j];
      y2 = ry[j];
      if(x1 > x2)swap(x1,x2),swap(y1,y2);
      if(x1 == x2)continue;

      FOR(k,0,m) {
    int px = bx[k];
    int py = by[k];
    if(px > x1 && px <= x2) {
      if(!left(x1,y1,x2,y2,px,py)) {
        ct[i][j] ++;
      }
    }
      }
    }
  }
  ll res= 0;
  FOR(i,0,n) {
    FOR(j,0,n) {
      if(i == j)continue;
      FOR(k,0,n) {
    if(k == i || k == j)continue;

    if(test(i,j,k))res++;
      }
    }
  }
  cout<<res/6<<endl;
  return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#include <string>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define MP      make_pair
#define PB      push_back
#define SZ(v)   (v).size()
#define ALL(v)  (v).begin(),(v).end()
#define FOREACH(it,v) \
                       for (typeof( v.begin() ) it = v.begin(); it!=v.end(); ++it)
#define FOR(i,a,b) \
                       for (int i=a; i<b; i++)
#define FORE(i,a,b) \
                       for (int i=a; i<=b; i++)

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<int> vi;

#define MAX 510

int n,m;
int rx[MAX],ry[MAX];
int bx[MAX],by[MAX];

int ct[MAX][MAX];

bool left(int x1, int y1, int x2, int y2, int x3, int y3) {
  ll dx1 = x2 - x1;
  ll dy1 = y2 - y1;
  ll dx2 = x3 - x1;
  ll dy2 = y3 - y1;
  return dx1*dy2 - dx2*dy1 > 0;
}

inline bool test(int a, int b, int c) {
  int ml = a;
  int mr = b;
  int oth = c;
  int v[3] = {a,b,c};
  FOR(i,0,3) {
    if(rx[v[i]] < rx[ml]) ml = v[i];
    if(rx[v[i]] > rx[mr]) mr = v[i];
  }
  FOR(i,0,3) {
    if(v[i] == mr || v[i] == ml)continue;
    oth = v[i];
  }

  int ret = - ct[ml][mr] + ct[oth][mr] + ct[ml][oth];
  return ret == 0;
}

int main()
{
  cin>>n>>m;
  FOR(i,0,n) {
    cin>>rx[i]>>ry[i];
  }
  FOR(i,0,m) {
    cin>>bx[i]>>by[i];
  }
  FOR(i,0,n) {
    FOR(j,i+1,n) {
      if(i == j)continue;
      int x1,y1,x2,y2;
      x1 = rx[i];
      y1 = ry[i];
      x2 = rx[j];
      y2 = ry[j];
      if(x1 > x2)swap(x1,x2),swap(y1,y2);
      if(x1 == x2)continue;

      FOR(k,0,m) {
    int px = bx[k];
    int py = by[k];
    if(px > x1 && px <= x2) {
      if(!left(x1,y1,x2,y2,px,py)) {
        ct[i][j] ++;
        ct[j][i]++;
      }
    }
      }
    }
  }
  ll res= 0;
  FOR(i,0,n) {
    FOR(j,i+1,n) {
      if(i == j)continue;
      FOR(k,j+1,n) {
    if(k == i || k == j)continue;

    if(test(i,j,k))res++;
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long ll;

ll ox, oy;

struct point {
	ll x, y;
	bool blue;
	point() : x(0), y(0), blue(0) {}
	point(const ll x, const ll y) : x(x), y(y) {}

	bool operator < ( const point & Q ) const {
		if (x != Q.x) return x < Q.x;
		return y < Q.y;
	}

	friend ostream & operator << ( ostream & cout, point & Q ) {
		return cout << '[' << Q.x << ", " << Q.y << ']';
	}
} A[500], B[500], C[500], D[500];

inline bool compare( const point & P, const point & Q ) {
	point A( P.x - ox, P.y - oy ), B( Q.x - ox, Q.y - oy );
	if ( A.x * B.y == A.y * B.x ) return P.blue > Q.blue;
	else return A.x * B.y > A.y * B.x;
	//return A.x * B.y > A.y * B.x;
}

int main() {
	//freopen("napredna.in", "r", stdin);
	int n, m, num = 0;
	//scanf("%d%d", &n, &m);
	cin >> n >> m;
	for (int i = 0; i < n; i++) //scanf("%I64d%I64d", &A[i].x, &A[i].y);
		cin >> A[i].x >> A[i].y;
	for (int i = 0; i < m; i++) {
		//scanf("%I64d%I64d", &B[i].x, &B[i].y);
		cin >> B[i].x >> B[i].y;
		B[i].blue = 1;
	}
	sort( A, A + n );
	sort( B, B + m );
	for (int i = 0, zomg = 0; i < n - 2; i++) {
		while ( zomg < m && B[zomg] < A[i] ) zomg++;
		memcpy( C + i + 1, A + i + 1, sizeof(point) * (n - i - 1) );
		memcpy( D + zomg, B + zomg, sizeof(point) * (m - zomg) );
		ox = A[i].x;
		oy = A[i].y;
		sort( C + i + 1, C + n, compare );
		sort( D + zomg, D + m, compare );

		for (int j = i + 1; j < n - 1; j++) {
			ll VX = C[j].x - A[i].x;
			ll VY = C[j].y - A[i].y;

			int k1 = j + 1;
			int k2 = zomg;
			//cout << k1 << ' ' << k2 << endl;
			while ( k1 < n && k2 < m ) {
				if ( compare( C[k1], D[k2] ) ) {
					ll TX = C[k1].x - C[j].x;
					ll TY = C[k1].y - C[j].y;
					if (TX * VY < TY * VX) {
						num++;
						//cout << A[i] << ' ' << C[j] << ' ' << C[k1] << endl;
					}
					k1++;
				}
				else {
					ll TX = D[k2].x - C[j].x;
					ll TY = D[k2].y - C[j].y;
					if (TX * VY < TY * VX) {
						VX = TX;
						VY = TY;
						//printf("Novi vektor pravca: [%d, %d] -> [%d, %d]\n", C[j].x, C[j].y, D[k2].x, D[k2].y);
					}
					k2++;
				}
			}
			while ( k1 < n ) {
				ll TX = C[k1].x - C[j].x;
				ll TY = C[k1].y - C[j].y;
				if (TX * VY < TY * VX) {
					num++;
					//cout << A[i] << ' ' << C[j] << ' ' << C[k1] << endl;
				}
				k1++;
			}
		}
	}
	printf("%d\n", num);
	return 0;
}