Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;

int main(){
	int N;
	vd a(8);
	cin >> N;
	rep(i,N){
		rep(i,8){
			cin>>a[i];
		}
		if(((a[1]-a[3])*(a[4]-a[6])-(a[5]-a[7])*(a[0]-a[2]))<0.0000001){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(fabs(m1-m2)<(1e-10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10

double a,b,c,d,e,f,g,h;
double det(){
	double dx1,dy1,dx2,dy2;
	dx1 = a-c;
	dy1 = b-d;
	dx2 = e-g;
	dy2 = f-h;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

int main(){
	
	int n;
	
	float x[4], y[4];
	
	cin >> n;
	
	for(int loop = 0; loop < n; loop++){
		for(int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
		}
		x[1] -= x[0];
		y[1] -= y[0];
		x[3] -= x[2];
		y[3] -= y[2];
		if(x[3] * y[1] == y[3] * x[1]){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a[100], b[100], c[100], d[100];
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a[i]=xy_t(x, y);
		cin >> x >> y;
		b[i]=xy_t(x, y);
		cin >> x >> y;
		c[i]=xy_t(x, y);
		cin >> x >> y;
		d[i]=xy_t(x, y);
	}
	for(int i=0; i<n; i++)
	{
		if(abs((conj(b[i]-a[i])*(d[i]-c[i])).imag())<0.000000001)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> P;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
		printf("%s\n", (is_parallel(a, b ,c ,d)) ? "YES" : "NO");
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
    int n;
    int i;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    scanf("%d",&n);
    //printf("%llf",1e-10);
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
            puts("YES");
        }
        else puts("NO");
    }
    return 0;
}

C++: #include <stdio.h>

int main(void) {

  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int i;
  char c;
  
  scanf("%d",&n);

  //c=getchar();

  for(i=0;i<n;i++) {
    
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

    if(x2-x1==0.0) {
      if(x4-x3==0.0) printf("YES\n");
      else printf("NO\n");
    }

    else if((x2-x1)*(y4-y3)==(x4-x3)*(y2-y1)) printf("YES\n");
    else printf("NO\n");

  }

  return 0;

}

C++: #include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main(){
	int N;
	float xx,yy;
	float X[5],Y[5];
	string res[110];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if((X[2]-X[1])*(Y[4]-Y[3])==(X[4]-X[3])*(Y[2]-Y[1])){
			res[j]="YES";
		}
		else{
			res[j]="NO";
		}
	}
	for(int i=1;i<=N;i++){
		cout<<res[i]<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <iostream>
 
 
using namespace std;
 
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        double x[4], y[4];
        for (int j = 0; j < 4; ++j)
            scanf("%lf %lf", x+j, y+j);
 
        double dx1 = x[1] - x[0];
        double dy1 = y[1] - y[0];
        double dx2 = x[3] - x[2];
        double dy2 = y[3] - y[2];
        if (dy1/dx1 == dy2/dx2)
            puts("YES");
        else
            puts("NO");
    }
 
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.0000000001;
	bool same(double a,double b){
		if(abs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double x[5],y[5];
    long long X[5],Y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&x[i],&y[i]);
            X[i] = (long long)(x[i]*1000000);
            Y[i] = (long long)(y[i]*1000000);
        }
        if((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1])){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

C++: #include <iostream>
using namespace std ;

int main()
{
	int num ;
	double ax, ay, bx, by, cx, cy, dx, dy ;

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		if( (by-ay)/(bx-ax) == (dy-cy)/(dx-cx) )
		{
			cout << "YES\n" ;
		}
		else cout << "NO\n" ;
	}
	return 0;
}