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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

// ll stoll(string const& s){
//     ll res = 0;
//     rep(i,s.size()){
//         res*=10;
//         res+=s[i]-'0';
//     }
//     return res;
// }

ll input(){
    string s; cin>>s;
    size_t p=0;
    int sign = s[0]=='-' ? -1 : 1;
    if(sign==-1) s.erase(s.begin());
    while(p<s.size() && s[p]!='.') p++;
    while(s.size()-p < 6) s += '0';
    s.erase(s.begin()+p);
    dump(s);
    return sign*stoll(s);
}

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                x[i][j] = input();
                y[i][j] = input();
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int n;
	double p[8];

	cin >> n;

	while (n--){
		for (int i = 0; i < 8; i++){
			cin >> p[i];
		}

		if ((p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4])) cout << "YES" << endl;
		else cout << "NO" << endl;


	}


	return 0;
}

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

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(dx1==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(dy1/dx1 == dy2/dx2)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

int main() {
    double n,xx[4],yy[4],x,y;
    cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++) cin>>xx[j]>>yy[j];
        x=(yy[1]-yy[0])/(xx[1]-xx[0]);
        y=(yy[3]-yy[2])/(xx[3]-xx[2]);
        if(x==y)cout << "YES";
        else cout << "NO";
        cout << endl;
    }
}

C++: #include <iostream>

using namespace std;

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

  double x1,y1,x2,y2,x3,y3,x4,y4;
  for (int dataset_i = 0; dataset_i < n; dataset_i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x2-x1 == 0 && x4-x3 == 0)
      cout << "YES";
    else if (y2-y1 == 0 && y4-y3 == 0)
      cout << "YES";
    else if (x2-x1 == 0 || y2-y1 == 0)
      cout << "NO";
    else if ((x4-x3)/(x2-x1) == (y4-y3)/(y2-y1))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }

  return 0;
}

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

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 && x3 == x4){
			cout << "YES" << endl;
		}
		else if (x1 == x2 || x3 == x4){
			cout << "NO" << endl;
		}
		else if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
  int n;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double a,b,c,d;
    a=y2-y1;
    b=y4-y3;
    c=x2-x1;
    d=x4-x3;
    if(a*c==b*d)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}

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

int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(abs((x4-x3)*(y2-y1) - (x2-x1)*(y4-y3)) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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

class vec2d {
public:
  double x,y;
  vec2d() {
    this->x = 0;
    this->y = 0;
  }
  void set(double x,double y) {
    this->x = x - this->x;
    this->y = y - this->y;
  }
};

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x,y;
    vec2d p[4];
    for(int i=0;i<4;i++) {
      cin >> x >> y;
      p[i].set(x,y);
    }
    double tanAB = (p[1].x - p[0].x) / (p[1].y - p[0].y);
    double tanCD = (p[3].x - p[2].x) / (p[3].y - p[2].y);
    if((tanAB - tanCD)*(tanAB - tanCD) < 10e-9) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <stdio.h>
 
int main(void) {
    int kaisu,i,j;
    double x[4],y[4];

    scanf("%d",&kaisu);
    for(i=0;i<kaisu;i++)
	{
        for(j=0;j<4;j++)
			scanf("%lf %lf",&x[j],&y[j]);
        if(x[0]==x[1]) 
		{
            if(x[2]==x[3])
				printf("YES\n");
            else 
				printf("NO\n");
        } 
		else if(x[2]==x[3])
			printf("NO\n");
        else 
		{
            if((y[1]-y[0])/(x[1]-x[0])==(y[3]-y[2])/(x[3]-x[2]))
                printf("YES\n");
            else 
				printf("NO\n");
        }
    }
    return 0;
}