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++: import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		double x1,x2,x3,x4,y1,y2,y3,y4;
		int T=in.nextInt();
		for(int t=1;t<=T;t++){
			x1=in.nextDouble();
			x2=in.nextDouble();
			x3=in.nextDouble();
			x4=in.nextDouble();
			y1=in.nextDouble();
			y2=in.nextDouble();
			y3=in.nextDouble();
			y4=in.nextDouble();
			if(Math.abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.000000000001)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		in.close();
	}
}

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

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

C++: //
//
//
//
//
//
//

#include <iostream>
#include <complex>

using namespace std;
typedef complex<double> xy_t;

double cross_product(complex<double> a, complex<double> b)
{
  return (conj(a) * b).imag();
}

int main()
{
  int n; //??????????????°
  cin >> n;
  while (n > 0) {
    complex<double> a, b, c, d, e, f;
    double real[4], imag[4];
    for (int i = 0; i < 4; i++)
      cin >> real[i] >> imag[i];
    
    a = xy_t(real[0], imag[0]);
    b = xy_t(real[1], imag[1]);
    c = xy_t(real[2], imag[2]);
    d = xy_t(real[3], imag[3]);
    
    /*
    a.real() = array[0];
    a.imag() = array[1];
    b.real() = array[2];
    b.imag() = array[3];
    c.real() = array[4];
    c.imag() = array[5];
    d.real() = array[6];
    d.imag() = array[7];
    */
    
    e = a - b;
    f = c - d;
    double judge = cross_product(e, f);
    if (judge == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    n--;
  }
}

/*
complex?????????????§????????????§???????????????????????????????????§??¨??£???????????????????????????
????????\????????????????????????????????????????????¨???????????????
 */

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

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

using namespace std;
#define EPS 0.0000001
 
 
main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
   
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <sstream>
#include <complex>
using namespace std;
typedef complex<long> xy_t;
long cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
vector<string> StringSplit(const string &str, char sep)
{
	vector<std::string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
	{
		v.push_back(buffer);
	}
	return v;
}
int main()
{
	string num;
	int n;
	cin >> n;
	while (n--)
	{
		long xy[8];
		for (int i = 0; i < 8; i++)
		{
			cin >> num;
			auto num_s = StringSplit(num, '.');
			auto lambda = [&](int dec) {int l = 5 - num_s[1].length(); while (l--) { dec *= 10; }if (num[0] == '-') { dec *= -1; }return dec; };
			int num_i = stoi(num_s[0]) * 100000 + lambda(stoi(num_s[1]));
			xy[i] = num_i;
		}
		long cp = cross_product(xy_t(xy[2] - xy[0], xy[3] - xy[1]), xy_t(xy[6] - xy[4], xy[7] - xy[5]));
		if (cp == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  cin>>n;
  rep(i,n){
    double ax,ay,bx,by,cx,cy,dx,dy;
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;

    //if(by-ay)/(bx-ax)=(dy-cy)/(dx-cx)
    if((ax-bx)*(cy-dy)==(cx-dx)*(ay-by))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

C++: #include <iostream>

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

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

int n;

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		double x[4][2];
		for(int j = 0; j < 4; ++j){
			scanf("%lf%lf", x[j], x[j] + 1);
		}
		double y[2][2] = {
			{x[0][0] - x[1][0], x[0][1] - x[1][1]},
			{x[2][0] - x[3][0], x[2][1] - x[3][1]}
		};

		//printf("%lf\n", y[0][0] * y[1][1] - y[0][1] * y[1][0]);

		if(std::abs(y[0][0] * y[1][1] - y[0][1] * y[1][0]) < DBL_EPSILON){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <deque>
#include <numeric>
#include <algorithm>

using namespace std;

int main() {
  int input;
  deque<int> datas;
  deque<int> sums;

  cin >> input;
  datas.push_back(input);
  while (cin >> input, input != 0) {
    datas.push_back(input);
    sums.push_back(accumulate(datas.begin(), datas.end(), 0));
    datas.pop_front();
  }

  cout << *max_element(sums.begin(), sums.end()) << endl;

  return 0;
}

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

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		complex<double> p1, p2, p3, p4;
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = complex<double>(x1, y1);
		p2 = complex<double>(x2, y2);
		p3 = complex<double>(x3, y3);
		p4 = complex<double>(x4, y4);
		
		if( (arg(p1-p2) - arg(p3-p4))>-EPS && (arg(p1-p2) - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else 
			cout << "NO" << endl;
	}
	return 0;
}

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

int main() {
	typedef complex<double> com;
	const double eps = 1e-11;
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for ( int i = 0; i < n; i++ ) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ( abs( ( conj( com( x2 - x1, y2 - y1 ) ) * com( x4 - x3, y4 - y3 ) ).imag() ) < eps )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main() {
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	double incAB, incCD;
	int count=0;
	while(cin>>count, !cin.eof()) {
		for(int i=0; i<count; i++) {
			cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
			incAB = (x2-x1) / (y2-y1);
			incCD = (x4-x3) / (y4-y3);
			if(incAB == incCD) {
				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 x[4], y[4];
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (((x[3] == x[2]) && (y[3] == y[2])) || (y[1] == y[0] && x[1] == x[0])) {
      cout << "YES" << endl;
    } else if ((x[3] == x[2] && y[1] == y[0]) || (x[1] == x[0] && y[3] == y[2])) {
      cout << "NO" << endl;
    }
    else if (abs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0])) < 1e-15) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    
  }
  return 0;
}