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 <stdio.h>
#include <math.h>

int main(void){
    int n;
    cin >> n;
    rep(itn j = 0,j< n,j++) {

    double x[4],y[4],a,b,c,d,p,q,det,ansx,ansy;
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        scanf("%lf" ,&x[i]);
        scanf("%lf" ,&y[i]);
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    p = x[1]*y[0]-x[0]*y[1];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    q = x[3]*y[2]-x[2]*y[3];
    //係数についての行列式
    det = a*d-c*b;
    if(det == 0) puts("YES");
    else puts("NO");
    /*
    //det=0で解は存在しない(この問題については２線分は同一直線上にないから)
    if(fabs(det) < 0.00001) puts("YES");
    //逆行列を用いて解を導出
    else {
        /*
        ansx = (d*p - b*q)/det;
        ansy = (-c*p + a*q)/det;
        //ansxがどちらの線分のx座標範囲にも含まれるかを判定
        if((x[0] - ansx)*(x[1] - ansx) <= 0.00001 && (x[2] - ansx)*(x[3] - ansx) <= 0.00001 ) {
            printf("YES (%lf, %lf)\n",ansx,ansy);
        } else puts("NO");
        
       puts("NO");
    }
    */
    }
}

C++: #include<iostream>
#define INF 10000000
using namespace std;
int main(){
  int n;
  double lI,lII,x1,y1,x2,y2,x3,y3,x4,y4;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    lI = lII = INF;
    if(x1!=x2) lI = (y2-y1)/(x2-x1);
    if(x3!=x4) lII = (y4-y3)/(x4-x3);
    cout << (lI==lII ?"YES":"NO") << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float xa, ya, xb, yb, xc, yc, xd, yd;
	cin >> n;
	while(n--){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		if(((yb-ya)==0.0&&(xd-xc)==0.0)||((xb-xa)==0.0&&(yd-yc)==0.0)){
			cout << "YES" << endl;
		} else if((xb-xa)==0.0&&(xd-xc)==0.0){
			cout << "NO" << endl;
		} else if(((yb-ya)/(xb-xa))*((yd-yc)/(xd-xc)) == 1.0){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <complex>
#include <utility>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;
static const double PI=3.141592653589793;

using Point=complex<double>;

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

bool is_parallel(const Line &l, const Line &m) {
    return abs(cross_prod(l.second-l.first, m.second-m.first)) < EPS;
}

bool testcase_ends() {
    double x, y;
    if (scanf("%lf %lf", &x, &y) == EOF)
        return 1;

    Point A(x, y);
    scanf("%lf %lf", &x, &y);
    Point B(x, y);
    scanf("%lf %lf", &x, &y);
    Point C(x, y);
    scanf("%lf %lf", &x, &y);
    Point D(x, y);

    printf("%s\n", is_parallel(Line(A, B), Line(C, D))? "YES":"NO");
    return 0;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    for (size_t i=0; i<n; ++i)
        if (testcase_ends())
            return 1;

    return 0;
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;

	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(((y2-y1) != 0 && (y4-y3) != 0 && (x2-x1)/(y2-y1) == (x4-x3)/(y4-y3)) || ((y2-y1) == 0 && (y4-y3) == 0)) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;

int main(){
  double a,b,c,d,e,f,g,h;
  int t;

  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    
    c -= a,d -= b,g -= e,h -= f;
    
    cout << (c*g-d*h ? "NO" : "YES") << endl;
  }
  
  return 0;
}

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

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;
double EPS = 1e-9;
// BEGIN //////////////////////////////////////////////////////////////


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 (x2 - x1 < EPS || x4 - x3 < EPS) {
			if (y2 - y1 < EPS && y4 - y3 < EPS) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		} else {
			if ((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) < EPS) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		}
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include<iostream>
using namespace std;
 
char changeSmallToLarge(char str){
 
    if(str>='a' && str<='z'){
        return str - 32;
    }
    else{
        return str;
    }
}
 
int main(){
     
    char str[1000];
 
    cin.getline(str,1000);
 
    for(int i=0;str[i]!='\0';i++){
        str[i] = changeSmallToLarge(str[i]);
    }
 
    cout<<str<<endl;
 
    return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	
	vector<double> x(4);
	vector<double> y(4);
	for(int i=0;i<4;i++){
		cin>> x[i]>> y[i];
	}
	double a,b;
	a = (y[1]-y[0]) / (x[1]-x[0]);
	b = (y[3]-y[2]) / (x[3]-x[2]);
	
	if(a==b){
		cout<< "YES"<< endl;
	}else{
		cout<< "NO"<< endl;
	}
	

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}

	return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	for(int x=0;x<n;++x){
		float m1,m2;
		float x1,x2,y1,y2;
		scanf("%f %f %f %f",&x1,&y1,&x2,&y2);
		m1 = (y2-y1)/(x2-x1);
		scanf("%f %f %f %f",&x1,&y1,&x2,&y2);
		m2 = (y2-y1)/(x2-x1);
		if(m1==m2){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}