Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	int n;
	cin >> n;

	REP(i, n){

		double p[8];
		REP(i, 8){
			cin >> p[i];
		}

		double dx1 = (p[0] - p[2]);
		double dx2 = (p[4] - p[6]);
		double dy1 = (p[1] - p[3]);
		double dy2 = (p[5] - p[7]);


		if (!dx1||!dx2){
			if (!dy1&&!dy2){
				cout << "YES" << endl;
				continue;
			}
			cout << "NO" << endl;
			continue;
		}

		string ans = (abs(dy2/dx2-dy1/dx1) < 1e-8 ) ? "YES" : "NO";


		cout << ans << 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] = (int)(x[i]*100000);
            Y[i] = (int)(y[i]*100000);
        }
        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 n;
  while (cin >> n) {
    for (int i = 0; i < n; ++i) {
      double x1, y1, x2, y2, x3, y3, x4, y4, g1, g2;
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
      if ((x1-x2)*(y3-y4) == (x3-x4)*(y1-y2))
    cout << "YES" << endl;
      else
    cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF
const double EPS = 1e-10;


inline bool eq(double a, double b) { return fabs(b - a) < EPS;}

struct p_t{
  double x;
  double y;
  double norm() { return x * x + y * y; }
  double abs() { return sqrt(norm()); }
};
struct l_t{
	p_t a, b;
};

double cross(p_t p,p_t q);
p_t line(p_t p,p_t q);

bool asc(p_t left,p_t right) {
    return left.x == right.x ? left.y < right.y : left.x < right.x;
}
int Crosspoint(l_t l,l_t m);

int main(){
  int n;
  cin>>n;
  for(int t=0;t<n;t++){
    p_t p,q,r,k,s;
    cin>>p.x>>p.y>>q.x>>q.y>>r.x>>r.y>>k.x>>k.y>>s.x>>s.y;
    l_t pq,qr,rp,ks;
    pq.a=p;
    pq.b=q;
    qr.a=q;
    qr.b=r;
    rp.a=r;
    rp.b=p;
    ks.a=k;
    ks.b=s;
    int ans=0;
    ans+=Crosspoint(pq,ks);
    ans+=Crosspoint(qr,ks);
    ans+=Crosspoint(rp,ks);
    if(ans==1){
      cout<<"OK"<<endl;
    }
    else{
      cout<<"NG"<<endl;
    }
  }
}


p_t line(p_t p,p_t q){
  p_t z;
  z.x=q.x-p.x;
  z.y=q.y-p.y;
  return z;
}


double cross(p_t p,p_t q){
  return p.x*q.y-p.y*q.x;
}

int Crosspoint(l_t l,l_t m){
  p_t aa,bb,cc,dd;
  aa.x=l.b.x-l.a.x;
  aa.y=l.b.y-l.a.y;
  bb.x=m.b.x-m.a.x;
  bb.y=m.b.y-m.a.y;
  cc=aa;
  dd.x=l.b.x-m.a.x;
  dd.y=l.b.y-m.a.y;
	double A = cross(aa,bb);
	double B = cross(cc,dd);
	if (abs(A) < EPS && abs(B) < EPS) return 0;
  if(B/A>0&&B/A<1) return 1;
  return 0;
}

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

using namespace std;

int main(){
    
  int n;
  cin >> n;
  while(n--){

    double x1,x2,x3,x4;
    double y1,y2,y3,y4;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if( ( y2 - y1 ) / ( x2 - x1 ) == ( y4 - y3 ) / ( x4 - x3 ) ){
      printf("YES\n");
    }
    else printf("NO\n");
  }
}