### Problem

A lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the number of lattice points which lie completely inside of the triangle (points on the edges or vertices of the triangle do not count).

### Code

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

struct Point {
int x, y;
Point(int x = 0, int y = 0):x(x), y(y) {}
Point operator + (Point rhs) const { return Point(x+rhs.x, y+rhs.y); }
Point operator - (Point rhs) const { return Point(x-rhs.x, y-rhs.y); }
int dot(Point rhs) { return x * rhs.x + y * rhs.y; }
int cross(Point rhs) { return x * rhs.y - y * rhs.x; }
};

Point tr[5];

int triArea(Point a, Point b, Point c) {
return abs((b-a).cross(c-a));
}

int borderIntPointNum() {
int num = 0;
tr[3].x = tr[0].x;
tr[3].y = tr[0].y;
for(int i = 0; i < 3; ++i) {
num += __gcd(abs(int(tr[i+1].x - tr[i].x)), abs(int(tr[i+1].y - tr[i].y)));
}
return num;
}

int insideIntPointNum() {
return triArea(tr[0], tr[1], tr[2]) + 2 - borderIntPointNum();
}

int main()
{
while(true) {
bool flag = false;
for(int i = 0; i < 3; ++i) {
scanf("%d%d", &tr[i].x, &tr[i].y);
if(tr[i].x || tr[i].y) flag = true;
}
if(!flag) break;
printf("%d\n", insideIntPointNum() >> 1);
}
return 0;
}
```