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 <iostream>
#include <math.h>
using namespace std;

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double slope_ab, slope_cd;
	int loop;
	int i = 0;

	cin >> loop;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4){

		++i;

		slope_ab = (y2 - y1) / (x2 - x1);
		slope_cd = (y4 - y3) / (x4 - x3);

		if (slope_ab == slope_cd){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

		if (i == loop) break;
	}
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int i,num;
	float x[4],y[4];
	cin >> num;

	for ( i = 0 ; i< num; i++ ) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		if( abs( (x[0]-x[1])*(y[2]-y[3]) - (y[0]-y[1])*(x[2]-x[3]) ) < 1e-10 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
	int N; cin >> N;
	while(N--)
	{
		double x1,x2,x3,x4,y1,y2,y3,y4;
		cin >> x1 >> y1 >> x2 >> y2;
		cin >> x3 >> y3 >> x4 >> y4;

		x2 -= x1; y2 -= y1;
		x4 -= x3; y4 -= y3;


		cout << ( fabs(x2*y4-x4*y2)<1e-10 ? "YES" : "NO") << endl;

	}
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
typedef complex<double> xy_t;

const double eps = 1e-11;
double x[4], y[4];
int n;

double dot_product(xy_t a, xy_t b)
{
    return (conj(a) * b).real();
}

double cross_product(xy_t a, xy_t b)
{
    return (conj(a) * b).imag();
}

int main()
{
    cin >> n;
    rep(t, n)
    {
        rep(i, 4) cin >> x[i] >> y[i];
        xy_t a[2] = {
            xy_t(x[0], y[0]) - xy_t(x[1], y[1]),
            xy_t(x[2], y[2]) - xy_t(x[3], y[3])};
        bool p = abs(cross_product(a[0], a[1])) < eps;
        cout << (p ? "YES" : "NO") << endl;
    }
    return 0;
}

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];
	double k1, k2;

	cin >> n;

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

		if (p[0] == p[2] || p[4] == p[6]){
			if (p[0] == p[2] && p[4] == p[6])cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else{
			k1 = (p[3] - p[1]) / (p[2] - p[0]);
			k2 = (p[7] - p[5]) / (p[6] - p[4]);
			if ((k1 -k2 )* (k1 -k2) < 0.000000001) cout << "YES" << endl;
			else cout << "NO" << endl;
		}


	}


	return 0;
}

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d;
	double e, f, g, h,x1,x2,x3,x4,y1,y2,y3,y4;
	scanf("%d", &a);
	for (int i = 0; i < a; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		e = (y1 - y2) / (x1 - x2);
		f = (y3 - y4) / (x3 - x4);
		if (e==f)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int n;
    double x[4],y[4];
    cin>>n;
    for(;n--;){
        for(int i=0;i<4;i++){
            cin>>x[i];
            cin>>y[i];
        }
        if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main(void)
{
    double x1,x2,x3,x4,y1,y2,y3,y4,p1,p2;
    int n;
     
    cin >> n;
     
    rep(i,n)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        p1 = (y2-y1)/(x2-x1);
        p2 = (y4-y3)/(x4-x3);
        if(p1 == p2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
     
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(abs((c[1]-c[0])*(c[7]-c[6])-(c[3]-c[2])*(c[5]-c[4]))<0.000001)printf("YES\n");
    else printf("NO\n");
    }
}

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

using namespace std;

int main(void){
	int n, i;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	scanf("%d",&n);
	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) * (x4 - x3) == (x2 - x1) * (y4 - y3)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include<cmath>
using namespace std;
 
int main(){
    double x1,x2,x3,x4,y1,y2,y3,y4;
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
 
        if(abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000000001){ //I copied yutaka watabe's code here
            printf("YES\n");
        }else{
            printf("NO\n");
        }
 
    }
    return 0;
}

C++: // inami 氏の回答

#include <iostream>
using namespace std;
 
struct cd{ //coordinate : 座標
    double x,y;
};
 
int main(){
    int n;
    struct cd a[4];
 
    cin>>n;
    for(int i=0; i<n; i++){
        for(int i=0; i<4; i++){
            cin>>a[i].x>>a[i].y;
        }
 
        //tilt : 傾き
        double tilt1=(a[1].y-a[0].y) / (a[1].x-a[0].x);
        double tilt2=(a[3].y-a[2].y) / (a[3].x-a[2].x);
 
        if(tilt1==tilt2) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
     
    return 0;
}

C++: #include <stdio.h>

int main(){
	float x1,y1,x2,y2,x3,y3,x4,y4;
	float del1,del2;
	
	int n;
	scanf("%d",&n);
	int i;
	
	for(i = 0;i < n;i++){
		scanf("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	
		if(x1-x2 == 0&&x3-x4 == 0){
			printf("YES\n");
		}else if(x1-x2 == 0||x3-x4 == 0){
			printf("NO\n");
		}else{
			del1 = (y1-y2)/(x1-x2);
			del2 = (y3-y4)/(x3-x4);
		
			if(del1 == del2){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d;
	double e, f, g, h,x1,x2,x3,x4,y1,y2,y3,y4;
	scanf("%d", &a);
	for (size_t i = 0; i < a; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		e = (y1 - y2) / (x1 - x2);
		f = (y3 - y4) / (x3 - x4);
		if (e==f)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main() {
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,det;
  double vect1[2],vect2[2];

  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    vect1[0] = x2-x1;
    vect1[1] = y2-y1;
    vect2[0] = x4-x3;
    vect2[1] = y4-y3;
    det = vect1[0] * vect2[1] - vect1[1] * vect2[0];
    if(det == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  string ans[n];
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4) and (y1-y3)/(x1-x3)!=(y1-y2)/(x1-x2)){
      ans[i]="YES";
    }else{
      ans[i]="NO";
    }
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << endl;
  }
  return 0;
}