criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace styd;
int main() {
  int a,b,count=0; cin >> a >> b;
  int x[a][b];
  for(int i=0;i<a;i++) {
    for (int j=0;j<b;j++) {
      cin >> x[i][j];
    }
  }
  for(int i=0;i<a-1;i++) {
    double ans=0;
    for (int j=0;j<b-1;j++) {
      ans=x[i][j]+x[i+1][j+1];
    }
    ans=sqrt(ans);
    if(ans-(int)ans==0) {
      count++;
    }
  cout << count << endl;
}

Compiler output:
a.cc:2:17: error: 'styd' is not a namespace-name
    2 | using namespace styd;
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:4:20: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |   int a,b,count=0; cin >> a >> b;
      |                    ^~~
      |                    std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |   cout << count << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:20:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   20 |   cout << count << endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#define sqr(x) (x)*(x)
using namespace std;
int n, d, ans;
int x[15][15];
 
long double D(int a, int b) {
	long double res = 0.0000;
	for (int i = 1; i <= d; ++i) res += sqr(x[a][i] - x[b][i]);
	return sqrt(res);
}
 
int main() {
	scanf("%d%d", &n, &d);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= d; ++j)
			scanf("%d", &x[i][j]);
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if ((int)D(i, j) == D(i, j)) ++ans;
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'long double D(int, int)':
a.cc:9:16: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
    9 |         return sqrt(res);
      |                ^~~~
      |                sqr
a.cc: In function 'int main()':
a.cc:13:9: error: 'scanf' was not declared in this scope
   13 |         scanf("%d%d", &n, &d);
      |         ^~~~~
a.cc:20:9: error: 'printf' was not declared in this scope
   20 |         printf("%d\n", ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define sqr(x) (x)*(x)
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double dist(double *a, double *b, int d){
	double sum = 0;
	for(int i = 0; i < d; i++)
		sum += (a[i] - b[i]) * (a[i] - b[i]);
	return sqrt(sum);
}

int main(void){
	int n, d;
	scanf("%d %d", &n, &d);
	double **x = malloc(sizeof(double*) * n);
	for(int i = 0; i < n; i++){
		x[i] = malloc(sizeof(double) * d);
		for(int j = 0; j < d; j++){
			scanf("%lf", x[i] + j);
		}
	}
	int count = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0 ; j < i; j++){
			double d = dist(x[i], x[j]);
			if(d == (int)d)
				count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:25:36: error: too few arguments to function 'dist'
   25 |                         double d = dist(x[i], x[j]);
      |                                    ^~~~
main.c:5:8: note: declared here
    5 | double dist(double *a, double *b, int d){
      |        ^~~~
Language: C++

use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let d: usize = read();
    let x: Vec<Vec<i64>> = (0..n).map(|_| (0..d).map(|_| read()).collect()).collect();

    let mut ans = 0;
    for i in 0..n {
        for j in i+1..n {
            let mut sum = 0;
            for k in 0..d {
                let po = x[i][k] - x[j][k];
                sum += po * po;
            }
            let sqrt = (sum as f64).sqrt() as i64;
            if sqrt*sqrt == sum {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Compiler output:
a.cc:7:29: error: too many decimal points in number
    7 |     let x: Vec<Vec<i64>> = (0..n).map(|_| (0..d).map(|_| read()).collect()).collect();
      |                             ^~~~
a.cc:7:44: error: too many decimal points in number
    7 |     let x: Vec<Vec<i64>> = (0..n).map(|_| (0..d).map(|_| read()).collect()).collect();
      |                                            ^~~~
a.cc:10:14: error: too many decimal points in number
   10 |     for i in 0..n {
      |              ^~~~
a.cc:11:20: error: too many decimal points in number
   11 |         for j in i+1..n {
      |                    ^~~~
a.cc:13:22: error: too many decimal points in number
   13 |             for k in 0..d {
      |                      ^~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::io::*;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::str::FromStr;
      | ^~~
a.cc:4:1: error: 'fn' does not name a type
    4 | fn main() {
      | ^~
a.cc:26:1: error: 'fn' does not name a type
   26 | fn read<T: FromStr>() -> T {
      | ^~
Language: C++

#include <cmath>

using namespace std;
int main(){
  int N, D;
  cin >> N>> D;
  int X[N][D];
  int counter = 0;
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin >> X[i][j];
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      //cout << X[i][j]<<' ';
    }
    //cout << endl;
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      //cout << "i:" << i << "j:"<<j << endl;
      int distance_2=0;
      for(int k=0;k<D;k++){
        distance_2 += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
      }
      if( ( static_cast<int>(sqrt(distance_2))*static_cast<int>(sqrt(distance_2)) ) == distance_2){
        counter++;
      }
    }
  }
  cout << counter << endl;
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> N>> D;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cmath>
  +++ |+#include <iostream>
    2 | 
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout << counter << endl;
      |   ^~~~
a.cc:32:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:22: error: 'endl' was not declared in this scope
   32 |   cout << counter << endl;
      |                      ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cmath>
  +++ |+#include <ostream>
    2 |
Language: C++

#include <string>
#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;

int main(void) {
	int n, d, tmp, sum, cnt = 0;
	vector<int> D;

	scanf("%d%d", &n, &d);
	

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			scanf("%d",&tmp);
			D.push_back(tmp);
		}
	}
	
	for (int i = 0; i < n -1; i++) {
		for (int j = i + 1; j < n; j++) {
			sum = 0;
			for (int k = 0; k < d; k++) {
				tmp = D.at(i*d+k) - D.at((j*d)+k);
				sum += (tmp * tmp);
			}
			double t = sqrt((double)sum);
			if (ceil(t) == floor(t)) {
				cnt++;
			}
		}
	}

	printf("%d", cnt);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:36: error: 'sqrt' was not declared in this scope
   28 |                         double t = sqrt((double)sum);
      |                                    ^~~~
a.cc:29:29: error: 'ceil' was not declared in this scope
   29 |                         if (ceil(t) == floor(t)) {
      |                             ^~~~
a.cc:29:40: error: 'floor' was not declared in this scope
   29 |                         if (ceil(t) == floor(t)) {
      |                                        ^~~~~
Language: C++

#include <cstdio>
#include <algorithm>

using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
	int n, d;
	int cnt = 0;
	scanf("%d", &n);
	scanf("%d", &d);
	int x[10][10];
	rep(i, n) {
		rep(j, d) {
			scanf("%d", &x[i][j]);
		}
	}
	
	rep(i, n-1) {
		for (int j = i + 1; j < n; j++) {
			int sum = 0;
			rep(k, d) {
				sum += (x[j][k] - x[i][k]) * (x[j][k] - x[i][k]);
			}
			if (std::sqrt(sum) == int(std::sqrt(sum))) {
				cnt++;
			}
		}
	}

	printf("%d\n",cnt);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   27 |                         if (std::sqrt(sum) == int(std::sqrt(sum))) {
      |                                  ^~~~
      |                                  sort
a.cc:27:56: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   27 |                         if (std::sqrt(sum) == int(std::sqrt(sum))) {
      |                                                        ^~~~
      |                                                        sort
Language: C++

#include <iostream>
#include <vector>
using namespace std;

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

	vector<int> vec(n * d);

	for (int i = 0; i < n * d; i++) {
		cin >> vec.at(i);
	}

	int out = 0;

	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			int distance = 0;
			for (int k = 0; k < d; k++) {
				distance += (vec.at(i * d + k) - vec.at(j * d + k)) * (vec.at(i * d + k) - vec.at(j * d + k));
			}
			double distance2 = sqrt(distance);
			if (ceil(distance2) == floor(distance2)) {
				out++;
			}
		}
	}

	cout << out << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:44: error: 'sqrt' was not declared in this scope
   24 |                         double distance2 = sqrt(distance);
      |                                            ^~~~
a.cc:25:29: error: 'ceil' was not declared in this scope
   25 |                         if (ceil(distance2) == floor(distance2)) {
      |                             ^~~~
a.cc:25:48: error: 'floor' was not declared in this scope
   25 |                         if (ceil(distance2) == floor(distance2)) {
      |                                                ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

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

	vector<int> vec(n * d);

	for (int i = 0; i < n * d; i++) {
		cin >> vec.at(i);
	}

	int out = 0;

	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			int distance = 0;
			for (int k = 0; k < d; k++) {
				distance += (vec.at(i * d + k) - vec.at(j * d + k)) * (vec.at(i * d + k) - vec.at(j * d + k));
			}
			double distance2 = sqrt(distance);
			if (ceil(distance2) == floor(distance2)) {
				out++;
			}
		}
	}

	cout << out << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:44: error: 'sqrt' was not declared in this scope
   24 |                         double distance2 = sqrt(distance);
      |                                            ^~~~
a.cc:25:29: error: 'ceil' was not declared in this scope
   25 |                         if (ceil(distance2) == floor(distance2)) {
      |                             ^~~~
a.cc:25:48: error: 'floor' was not declared in this scope
   25 |                         if (ceil(distance2) == floor(distance2)) {
      |                                                ^~~~~
Language: C++

void func_B(int N, int D) {
	int** X = new int* [N];
	for (int i = 0; i < N; i++)
		X[i] = new int[D];

	for (int i = 0; i < N; i++)
		for (int j = 0; j < D; j++)
			std::cin >> X[i][j];

	int cnt = 0;
	for (int i = 1; i < N; i++) {
		double dist = 0;
		for (int j = 0; j < D; j++) {
			dist += abs(pow(X[i - 1][j] - X[i][j], 2));
		}
		dist = sqrt(dist);
		if (ceil(dist) == floor(dist))
			cnt++;
	}
	std::cout<<cnt;

	for (int i = 0; i < N; i++)
		free(X[i]);
	free(X);
}


int main() {
	int N, D;
	std::cin >> N >> D;
	func_B(N, D);
	return 0;
}

Compiler output:
a.cc: In function 'void func_B(int, int)':
a.cc:8:30: error: 'cin' is not a member of 'std'
    8 |                         std::cin >> X[i][j];
      |                              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | void func_B(int N, int D) {
a.cc:14:37: error: 'pow' was not declared in this scope
   14 |                         dist += abs(pow(X[i - 1][j] - X[i][j], 2));
      |                                     ^~~
a.cc:14:33: error: 'abs' was not declared in this scope
   14 |                         dist += abs(pow(X[i - 1][j] - X[i][j], 2));
      |                                 ^~~
a.cc:16:24: error: 'sqrt' was not declared in this scope
   16 |                 dist = sqrt(dist);
      |                        ^~~~
a.cc:17:21: error: 'ceil' was not declared in this scope
   17 |                 if (ceil(dist) == floor(dist))
      |                     ^~~~
a.cc:17:35: error: 'floor' was not declared in this scope
   17 |                 if (ceil(dist) == floor(dist))
      |                                   ^~~~~
a.cc:20:14: error: 'cout' is not a member of 'std'
   20 |         std::cout<<cnt;
      |              ^~~~
a.cc:20:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:17: error: 'free' was not declared in this scope
   23 |                 free(X[i]);
      |                 ^~~~
a.cc:1:1: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | void func_B(int N, int D) {
a.cc:24:9: error: 'free' was not declared in this scope
   24 |         free(X);
      |         ^~~~
a.cc:24:9: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
a.cc: In function 'int main()':
a.cc:30:14: error: 'cin' is not a member of 'std'
   30 |         std::cin >> N >> D;
      |              ^~~
a.cc:30:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>

using namespace std;
int main() {
	int N, D;
	int ans = 0;
	cin >> N >> D;
	int x[10][10];

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			cin >> x[i][j];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			int s = 0;
			int t = 0;
			for (int k = 0; k < D; k++) {
				int s = x[i][k] - x[j][k];
				t += s * s;
			}
			if (ceil(sqrt(t)) == floor(sqrt(t))) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: 'sqrt' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                                  ^~~~
a.cc:23:29: error: 'ceil' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                             ^~~~
a.cc:23:46: error: 'floor' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                                              ^~~~~
Language: C++

#include<iostream>

using namespace std;
int main() {
	int N, D;
	int ans = 0;
	cin >> N >> D;
	int x[30][30];

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < D; j++) {
			cin >> x[i][j];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			int s = 0;
			int t = 0;
			for (int k = 0; k < D; k++) {
				int s = x[i][k] - x[j][k];
				t += s * s;
			}
			if (ceil(sqrt(t)) == floor(sqrt(t))) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: 'sqrt' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                                  ^~~~
a.cc:23:29: error: 'ceil' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                             ^~~~
a.cc:23:46: error: 'floor' was not declared in this scope
   23 |                         if (ceil(sqrt(t)) == floor(sqrt(t))) {
      |                                              ^~~~~
Language: C++

n, d = map(int, input().split(" "))
xs = set(tuple(map(int, input().split(" "))) for i in range(n))
ys = set(xs)
ans = 0
for x in xs:
    ys.remove(x)
    for y in ys:
        d2 = sum(abs(xx - yy) ** 2 for xx,yy in zip(x, y))
        j = 1
        while j ** 2 < d2:
            j += 1
        if j ** 2 == d2:
            ans += 1
print(ans)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, d = map(int, input().split(" "))
      | ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n , m , cnt = 0;
  cin >> n >> m;
  vector<vector<long long>>v(n,vector<long long>(0));
  for(int i = 0 ; i < n ; ++i){
   	for(int j = 0; j < m ; ++j){
     	cin >> v[i][j]; 
    }
  }
  for(int i = 0 ; i < n ; ++i){
	for(int j = i+1 ; j < n ; ++j){
    	long long d = 0;
          	for(int k = 0 ; k < m ; ++k){
             	d += pow(abs(v[i][k]-v[j][k]),2); 
            }
        	long long y = sqrt(d);
          if(y*y == d){
           	cnt++; 
          }
    
    }
  }
  cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<vector<long long>>v(n,vector<long long>(0));
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:17: error: expected primary-expression before 'long'
    7 |   vector<vector<long long>>v(n,vector<long long>(0));
      |                 ^~~~
a.cc:10:16: error: 'v' was not declared in this scope
   10 |         cin >> v[i][j];
      |                ^
a.cc:17:30: error: 'v' was not declared in this scope
   17 |                 d += pow(abs(v[i][k]-v[j][k]),2);
      |                              ^
a.cc:17:22: error: 'pow' was not declared in this scope
   17 |                 d += pow(abs(v[i][k]-v[j][k]),2);
      |                      ^~~
a.cc:19:31: error: 'sqrt' was not declared in this scope
   19 |                 long long y = sqrt(d);
      |                               ^~~~
Language: C++

咯评论，坡口机哦·

Compiler output:
a.cc:1:1: error: '\U000054af\U00008bc4\U00008bba\U0000ff0c\U00005761\U000053e3\U0000673a\U000054e6\U000000b7' does not name a type
    1 | 咯评论，坡口机哦·
      | ^~~~~~~~~~~~~~~~~
Language: Java

package codilitytest;

import java.util.Scanner;

public class BDistance {

	public static void main(String[] args){
	
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int D = input.nextInt();
      
		int X[][] = new int[N][D];
	
		for(int i = 0; i < N; i++){
			for(int j = 0; j < D; j++){
				X[i][j] = input.nextInt();
			}
		}
		int totalInt = 0;
		for(int k = 0; k < N; k++){
			
			for(int l = k+1; l < N; l++){
				int sum = 0; 
				for(int j = 0; j < D; j++){
					sum += Math.pow((X[k][j]-X[l][j]), 2);
				}
				double dist = Math.pow(sum, .5);
				if(dist == (int)dist){
					totalInt++;
				}
			}
				
		}
		System.out.println(totalInt);
		
		
	}	
}


Compiler output:
Main.java:5: error: class BDistance is public, should be declared in a file named BDistance.java
public class BDistance {
       ^
1 error
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int dyf[11][11];
int main()
{
	int n, d,ans=0;
	double asdf; 
	cin>>n>>d;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=d;j++)
		{
			cin>>dyf[i][j];	
		{
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			asdf=0;
			for(int k=1;k<=d;k++)
			{
				asdf+=(dyf[i][k]-dyf[j][k])*(dyf[i][k]-dyf[j][k]);
			}
			asdf=sqrt(asdf);
			if(floor(asdf)==asdf)
				ans++;
		}
	}
	cout<<ans;
	return 0;
	
}        

Compiler output:
a.cc: In function 'int main()':
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:12:17: note: to match this '{'
   12 |                 {
      |                 ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,d;
  cin >> n >> d;
  
  vector<vector<int>> x(n,vector<int>(d));
  for (int i=0; i<n; i++){
    for (int j=0; j<d; j++){
      cin >> x.at(i).at(j);
    }
  }
  
  int cnt = 0;
  for (int i=0; i<n; i++){
    for (int j=0; j<n-i; j++){
    long long int kyori1=0;
    long doble kyori2=0;
      for (int k=0; k<d; k++){
        kyori1 += (x.at(i).at(k) - x.at(j).at(k))*(x.at(i).at(k) - x.at(j).at(k));
        kyori2 += (x.at(i).at(k) - x.at(j).at(k))*(x.at(i).at(k) - x.at(j).at(k));
      }
      kyori1 = sqrt(kyori1);
      kyori2 = sqrt(kyori2);
      if (kyori1 == kyori2) cnt++;
    }
  }
  
  cout << cnt << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: expected initializer before 'kyori2'
   19 |     long doble kyori2=0;
      |                ^~~~~~
a.cc:22:9: error: 'kyori2' was not declared in this scope; did you mean 'kyori1'?
   22 |         kyori2 += (x.at(i).at(k) - x.at(j).at(k))*(x.at(i).at(k) - x.at(j).at(k));
      |         ^~~~~~
      |         kyori1
a.cc:25:7: error: 'kyori2' was not declared in this scope; did you mean 'kyori1'?
   25 |       kyori2 = sqrt(kyori2);
      |       ^~~~~~
      |       kyori1
Language: C++

 #include <bits/stdc++.h>

 using namespace std;

 int main() {
 int N, D; cin >> N >> D;
 vector<vector<int>> X(N, vector<int>(D));
 for (int i = 0; i < N; ++i) {
 for (int j = 0; j < D; ++j) {
0 cin >> X[i][j];
 }
 }
 int ans = 0;
 for (int i = 0; i < N; ++i) {
 for (int j = i+1; j < N; ++j) {
 int norm = 0;
 for (int k = 0; k < D; ++k) {
 int diff = abs(X[i][k] - X[j][k]);
 norm += diff * diff;
 }
 // check whether norm = k for some k
 bool flag = false;
 for (int k = 0; k <= norm; ++k) {
 if (k * k == norm) {
 flag = true;
 }
 }
 if (flag) ++ans;
 }
 }
 cout << ans << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: expected ';' before 'cin'
   10 | 0 cin >> X[i][j];
      |  ^~~~
      |  ;
Language: C++

#include <bits/stdc++.h>
using namespace std;

int abs(int a){
  int ans;
  ans = (a<0) ? -a : a;
  return ans;
}

}
int main() {
 int N,D;
 cin >> N >> D;

 int aa[D*N]; int l;
  for(int i=0; i<D*N; i++){
   cin >> l;
   aa[i] = l;
  }

 int dsum = 0; int k=0; int ans = 0;
  for(int a=0; a<N-1; a++){
   for(int b=a+1; b<N; b++){
    for(int i=0; i<D; i++){
     dsum += abs(aa[i+a*D] - aa[i+b*D]) * abs(aa[i+a*D] - aa[i+b*D]);
    }
    while(k*k<dsum){
      if(k*k == dsum){
        ans++;
        break;
      }
      k++;
    }
   }
  }
cout << ans << endl;
}


Compiler output:
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    int N, D; cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D)); //N*Dの配列宣言(初期値省略)
    for(int i=0; i<N; ++i){
        for(int j=0; j<D; ++j){
            cin >> X[i][j]; //引数で初期化
        }
    }
    int ans = 0;
    for(int i=0; i<N; ++i){
        for(int j=0; j<D; ++j){
            int norm = 0;
            for(int k=0; k<D; ++k){
                int diff = abs(X[i][k] - X[j][k]);
                norm += diff * diff;
            }
        }

        bool flag = false;
        for(int k=0; k<=norm; ++k){
            if(k*k==norm){
                flag = true;
            }
        }
        if(flag) ++ans;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   24 |         for(int k=0; k<=norm; ++k){
      |                      ~^~~~~~
a.cc:25:19: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator=='
   25 |             if(k*k==norm){
      |                ~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
2
3 using namespace std;
4
5 int main() {
6 int N, D; cin >> N >> D;
7 vector<vector<int>> X(N, vector<int>(D));
8 for (int i = 0; i < N; ++i) {
9 for (int j = 0; j < D; ++j) {
10 cin >> X[i][j];
11 }
12 }
13 int ans = 0;
14 for (int i = 0; i < N; ++i) {
15 for (int j = i+1; j < N; ++j) {
16 int norm = 0;
17 for (int k = 0; k < D; ++k) {
18 int diff = abs(X[i][k] - X[j][k]);
19 norm += diff * diff;
20 }
21 // check whether norm = k for some k
22 bool flag = false;
23 for (int k = 0; k <= norm; ++k) {
24 if (k * k == norm) {
25 flag = true;
26 }
27 }
28 if (flag) ++ans;
29 }
30 }
31 cout << ans << endl;
32 }

Compiler output:
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2
      | ^
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N ,D ,ans=0;
    cin >> N >> D;
    vector<vector<int> > X(N,vector<int>(D)) ;
    for (int i= 0; i < N ;i++){
    for (int i= 0; j < D ;j++){
        cin >> X[i][j]
    }    
    }
    int ans=0;
    for (int i= 0; i < N ;i++){
    for (int j =i+1 ; j < N ;j++){
        int norm=0;
        for (int k= 0; k < D ;k++){
        int diff = abs(X[i][k]-X[j][k]);
        norm += diff * diff;
    }    
    bool flag=false
    for (int k= 0; k <=norm; k++){
        if (k*k == norm){
            flag = true;
        }
    }
    if (flag){
        ans++;
    }    
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: 'j' was not declared in this scope
    9 |     for (int i= 0; j < D ;j++){
      |                    ^
a.cc:13:9: error: redeclaration of 'int ans'
   13 |     int ans=0;
      |         ^~~
a.cc:5:15: note: 'int ans' previously declared here
    5 |     int N ,D ,ans=0;
      |               ^~~
a.cc:22:5: error: expected ',' or ';' before 'for'
   22 |     for (int k= 0; k <=norm; k++){
      |     ^~~
a.cc:22:20: error: 'k' was not declared in this scope
   22 |     for (int k= 0; k <=norm; k++){
      |                    ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i, j, k) for (int (i) = (j); (i) < (k); ++(i))
#define repr(i, j, k) for (int (i) = (j); (i) <= (k); ++(i))

using namespace std;

vector<vector<int>> nodes;

int main()
{
	int n, d;
	cin >> n >> d;
	rep(i, 0, n) {
		vector<int> node;
		rep(j, 0, d) {
			int tmp;
			cin >> tmp;
			node.push_back(tmp);
		}
		nodes.push_back(node);
	}
	
	int count = 0;
	rep(i, 0, n) {
		rep(j, i+1, n) {
			int sum = 0;
			rep(k, 0, d) {
				sum += pow((nodes[i][k] - nodes[j][k]), 2);
			}
			int sq = sqrt(sum);
			if (sq*sq == sum) {
				++count;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: 'pow' was not declared in this scope
   31 |                                 sum += pow((nodes[i][k] - nodes[j][k]), 2);
      |                                        ^~~
a.cc:33:34: error: 'sqrt' was not declared in this scope; did you mean 'sq'?
   33 |                         int sq = sqrt(sum);
      |                                  ^~~~
      |                                  sq
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int N, D;
	cin >> N >> d;
	vector<vector<int>> x(N, vector<int>(D));
	
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < D; ++j) {
			cin >> x[i][j]:
		}
	}
	
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i+1; j < N; ++j) {
			int norm = 0; 
			for (int k = 0; k < D; ++k) {
				int diff = abs(x[i][k] - x[j][k]);
				norm += diff * diff;
			}
			
			bool flag = false;
			for (int k = 0; k <= norm; ++k) {
				if (k * k == norm) {
					flag = true;
				}
			}
			
			if (flag) ++ans;
		}
	}
	
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: 'd' was not declared in this scope
   10 |         cin >> N >> d;
      |                     ^
a.cc:15:39: error: expected ';' before ':' token
   15 |                         cin >> x[i][j]:
      |                                       ^
      |                                       ;
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int main(){
  int N,D;
  cin >> N >> D;
  int arr[N][D];
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++){
      cin >> arr[i][j];
    }
  }
  int dist;
  int ans=0;
  for(int i = 0; i < N; i++){
	for(int j = i+1; j < N; j++{
	  dist=0;
      for(int k = 0; k < D; k++){
		dist+=pow(arr[i][k]-arr[j][k],2);
      }
      if(power((int)sqrt(dist),2)==dist)ans++;
    }
  }
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:36: error: expected ')' before '{' token
   17 |         for(int j = i+1; j < N; j++{
      |            ~                       ^
      |                                    )
a.cc:22:10: error: 'power' was not declared in this scope
   22 |       if(power((int)sqrt(dist),2)==dist)ans++;
      |          ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,D;
  cin >> N >> D;
  int arr[N][D];
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++{
      cin >> arr[i][j];
    }
  }
  int dist;
  int ans=0;
  for(int i = 0; i < N; i++){
	for(int j = i+1; j < N; j++{
	  dist=0;
      for(int k = 0; k < D; k++{
		dist+=pow(arr[i][k]-arr[j][k],2);
      }
      if(power((int)sqrt(dist),2)==dist)ans++;
    }
  }
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:30: error: expected ')' before '{' token
    9 |     for(int j = 0; j < D; j++{
      |        ~                     ^
      |                              )
a.cc:16:36: error: expected ')' before '{' token
   16 |         for(int j = i+1; j < N; j++{
      |            ~                       ^
      |                                    )
a.cc:18:32: error: expected ')' before '{' token
   18 |       for(int k = 0; k < D; k++{
      |          ~                     ^
      |                                )
a.cc:19:23: error: 'pow' was not declared in this scope
   19 |                 dist+=pow(arr[i][k]-arr[j][k],2);
      |                       ^~~
a.cc:21:21: error: 'sqrt' was not declared in this scope
   21 |       if(power((int)sqrt(dist),2)==dist)ans++;
      |                     ^~~~
a.cc:21:10: error: 'power' was not declared in this scope
   21 |       if(power((int)sqrt(dist),2)==dist)ans++;
      |          ^~~~~
Language: C++

#include<iostream>
#include<cmath>

using namespace std;

int sumsqr(double *a, double *b){
  int i;
  double d, dis;
  for(i = 0; i < sizeof(a)/sizeof(double); i++){
    dis += pow((a[i] - b[i]), 2);
  }
  dis = sqrt(dis);
  modf(dis, &d);
  if(dis > 0){
    return 0;
  } else {
    return 1;
  }
}

int main(){
  int N, D, num, i, j;
  cin >> N >> D;
  double X[N][D];
  for(i = 0; i < N; i++){
    for(j = i + 1; j < N; j++){
      cin >> X[i][j];
      }
    }
  }
  for(i = 0; i < N; i++){
    for(j = i + 1; j < N; j++){
      if(sumsqr(X[i], X[j])){
        num++;
      }
    }
  }
  cout << num;
}

Compiler output:
a.cc:31:3: error: expected unqualified-id before 'for'
   31 |   for(i = 0; i < N; i++){
      |   ^~~
a.cc:31:14: error: 'i' does not name a type
   31 |   for(i = 0; i < N; i++){
      |              ^
a.cc:31:21: error: 'i' does not name a type
   31 |   for(i = 0; i < N; i++){
      |                     ^
a.cc:38:3: error: 'cout' does not name a type
   38 |   cout << num;
      |   ^~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

#include<iostream>
#include<cmath>

using namespace std;

int sumsqr(double *a, double *b){
  int i;
  double d, dis;
  for(i = 0; i < sizeof(a)/sizeof(double); i++){
    dis += pow((a[i] - b[i]), 2);
  }
  modf(dis, &d);
  if(dis > 0){
    return 0;
  } else {
    return 1;
  }
}

int main(){
  int N, D, num, i, j;
  cin >> N >> D;
  int X[N][D];
  for(i = 0; i < N; i++){
    for(j = i + 1; j < N; j++){
      if(sumsqr(X[i], X[j])){
        num++;
      }
    }
  }
  cout << num;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: cannot convert 'int*' to 'double*'
   26 |       if(sumsqr(X[i], X[j])){
      |                 ~~~^
      |                    |
      |                    int*
a.cc:6:20: note:   initializing argument 1 of 'int sumsqr(double*, double*)'
    6 | int sumsqr(double *a, double *b){
      |            ~~~~~~~~^
Language: C++

#include<iostream>
#include<cmath>

using namespace std;

int sumsqr(double *a, double *b){
  int i, d;
  double dis;
  for(i = 0; i < sizeof(a)/sizeof(double); i++){
    dis += pow((a[i] - b[i]), 2);
  }
  modf(dis, &d);
  if(dis > 0){
    return 0;
  } else {
    return 1;
  }
}

int main(){
  int N, D, num, i, j;
  cin >> N >> D;
  int X[N][D];
  for(i = 0; i < N; i++){
    for(j = i + 1; j < N; j++){
      if(sumsqr(X[i], X[j])){
        num++;
      }
    }
  }
  cout << num;
}

Compiler output:
a.cc: In function 'int sumsqr(double*, double*)':
a.cc:12:7: error: no matching function for call to 'modf(double&, int*)'
   12 |   modf(dis, &d);
      |   ~~~~^~~~~~~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:128:1: note: candidate: 'double modf(double, double*)'
  128 | __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
      | ^~~~~~~~~~
In file included from /usr/include/math.h:275,
                 from /usr/include/c++/14/cmath:47,
                 from a.cc:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:128:1: note:   no known conversion for argument 2 from 'int*' to 'double*'
  128 | __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
      | ^
/usr/include/c++/14/cmath:368:3: note: candidate: 'long double std::modf(long double, long double*)'
  368 |   modf(long double __x, long double* __iptr)
      |   ^~~~
/usr/include/c++/14/cmath:368:38: note:   no known conversion for argument 2 from 'int*' to 'long double*'
  368 |   modf(long double __x, long double* __iptr)
      |                         ~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/cmath:364:3: note: candidate: 'float std::modf(float, float*)'
  364 |   modf(float __x, float* __iptr)
      |   ^~~~
/usr/include/c++/14/cmath:364:26: note:   no known conversion for argument 2 from 'int*' to 'float*'
  364 |   modf(float __x, float* __iptr)
      |                   ~~~~~~~^~~~~~
a.cc: In function 'int main()':
a.cc:26:20: error: cannot convert 'int*' to 'double*'
   26 |       if(sumsqr(X[i], X[j])){
      |                 ~~~^
      |                    |
      |                    int*
a.cc:6:20: note:   initializing argument 1 of 'int sumsqr(double*, double*)'
    6 | int sumsqr(double *a, double *b){
      |            ~~~~~~~~^
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define rep(i,f,n) for(int i = (f); i < (int)(n); i++)

#define re2(i,f,n) for(int i <= (f); i < (int)(n); i++)


int main(){


    int N,D; cin >> N >> D;
    int record[N][D];
    rep(i,0,N){
        rep(j,0,D){
            cin >> record[i][j];
        }
    }

    int ans=0;

    for(int i=0; i < N; i++){
    for(int j=i+1; j < N; j++){
        int euc=0;
        for(int k=0; k < D; k++){
            int point = record[i][k]-record[j][k];
            euc += point*point; 
        }
        re2(i,0,euc){
            if(i*i==euc){
                ans++;
            }
        }
    }
    }

    cout << ans << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: expected ';' before '<=' token
    6 | #define re2(i,f,n) for(int i <= (f); i < (int)(n); i++)
      |                              ^~
a.cc:29:9: note: in expansion of macro 're2'
   29 |         re2(i,0,euc){
      |         ^~~
a.cc:6:30: error: expected primary-expression before '<=' token
    6 | #define re2(i,f,n) for(int i <= (f); i < (int)(n); i++)
      |                              ^~
a.cc:29:9: note: in expansion of macro 're2'
   29 |         re2(i,0,euc){
      |         ^~~
a.cc:6:50: error: expected ')' before ';' token
    6 | #define re2(i,f,n) for(int i <= (f); i < (int)(n); i++)
      |                       ~                          ^
a.cc:29:9: note: in expansion of macro 're2'
   29 |         re2(i,0,euc){
      |         ^~~
a.cc:6:55: error: expected ';' before ')' token
    6 | #define re2(i,f,n) for(int i <= (f); i < (int)(n); i++)
      |                                                       ^
a.cc:29:9: note: in expansion of macro 're2'
   29 |         re2(i,0,euc){
      |         ^~~
Language: C++

// 133_B_Good_Distance.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<string>
#include <vector>
#include<math.h>

using namespace std;

int main()
{
	int N, D = 0;

	cin >> N >> D;

	vector<vector<int>> X;

	for (int i = 0; i < N; i++)
	{
		vector<int> row;

		for (int j = 0; j < D; j++)
		{	
			int value = 0;
			cin >> value;
			row.push_back(value);
		}

		X.push_back(row);
	}

	int count = 0;

	//計算
	for (int i = 0; i < N; i++)
	{
		vector<int> row1 = X.at(i);

		for (int j = i + 1; j < N; j++) {

			vector<int> row2 = X.at(j);

			int sum = 0;
			for (int k = 0; k < D; k++)
			{
				//2乗和
				sum += (row1.at(k) - row2.at(k)) ^ 2;
			}

			double distance = sqrt((double)sum);

			//整数判定
			if (fabs(distance - floor(distance)) <= DBL_EPSILON)
			{
				count++;
			}
		}
	}

	cout << count;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:65: error: 'DBL_EPSILON' was not declared in this scope
   54 |                         if (fabs(distance - floor(distance)) <= DBL_EPSILON)
      |                                                                 ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d;
  cin >> n >> d;
  int x[n][d];
  int ans=0;
  for (int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      double d=0;
      for(int k=0; k<d; k++){
        d += (x[i][k] - x[j][k])^2;
      }
      if (sqrt(d)*sqrt(d) == d) count++;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:38: error: no post-increment operator for type
   14 |       if (sqrt(d)*sqrt(d) == d) count++;
      |                                      ^~
Language: C++

#include <math.h>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    // スペース区切りの整数の入力
    int d;
  cin >> d;
  int data[n][d];
  int a;
  for(int i = 0;i<n;i++){
      for(int j = 0;j<d;j++){
    cin >> a;
    data[i][j] = a;
  	}  
  }
  
  
  int count = 0;
  for(int i = 0;i< n ;i++){
      for(int j = i+1;j<n;j++){
           double sum =0;
         for(int m = 0;m<d;m++){
    sum = (data[i][m] - data[j][m])*(data[i][m] - data[j][m]);
         }
        
   
      
    bool flag = false;
 	for (int k = 0; k <= sum; ++k) {
 	if (k * k == sum) {
 	flag = true;
	 }
	}
if (flag) ++count;
  }
  }
  cout<<count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout<<count;
      |   ^~~~
a.cc:40:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <math.h>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    // スペース区切りの整数の入力
    int d;
  cin >> d;
  int data[n][d];
  int a;
  for(int i = 0;i<n;i++){
      for(int j = 0;j<d;j++){
    cin >> a;
    data[i][j] = a;
  	}  
  }
  
  
  int count = 0;
  for(int i = 0;i< n ;i++){
      for(int j = i+1;j<n;j++){
           int sum =0;
         for(int m = 0;m<d;m++){
    sum = (data[i][m] - data[j][m])*(data[i][m] - data[j][m]);
         }
        
   
      
    bool flag = false;
 	for (int k = 0; k <= sum; ++k) {
 	if (k * k == sum) {
 	flag = true;
	 }
	}
if (flag) ++count;
  }
  }
  cout<<count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout<<count;
      |   ^~~~
a.cc:40:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
#include <math.h>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    // スペース区切りの整数の入力
    int d;
  cin >> d;
  int data[n][d];
  int a;
  for(int i = 0;i<n;i++){
      for(int j = 0;j<d;j++){
    cin >> a;
    data[i][j] = a;
  	}  
  }
  
 int ans = 0;
 for (int i = 0; i < n; ++i) {
 for (int j = i+1; j < n; ++j) {
 int norm = 0;
 for (int k = 0; k < d; ++k) {
 int diff = abs(data[i][k] - data[j][k]);
 norm += diff * diff;
 }
 // check whether norm = k for some k
 bool flag = false;
 for (int k = 0; k <= norm; ++k) {
 if (k * k == norm) {
 flag = true;
 }
 }
 if (flag) ++ans;
 }
 }
 cout << ans << endl;
 }
  
  
    return 0;
}

Compiler output:
a.cc:43:5: error: expected unqualified-id before 'return'
   43 |     return 0;
      |     ^~~~~~
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C++

#include<iostream>
#include <math.h>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    // スペース区切りの整数の入力
    int d;
  cin >> d;
  int data[n][d];
  int a;
  for(int i = 0;i<n;i++){
      for(int j = 0;j<d;j++){
    cin >> a;
    data[i][j] = a;
  	}  
  }
  
 int ans = 0;
 for (int i = 0; i < N; ++i) {
 for (int j = i+1; j < N; ++j) {
 int norm = 0;
 for (int k = 0; k < D; ++k) {
 int diff = abs(data[i][k] - data[j][k]);
 norm += diff * diff;
 }
 // check whether norm = k for some k
 bool flag = false;
 for (int k = 0; k <= norm; ++k) {
 if (k * k == norm) {
 flag = true;
 }
 }
 if (flag) ++ans;
 }
 }
 cout << ans << endl;
 }
  
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: 'N' was not declared in this scope
   22 |  for (int i = 0; i < N; ++i) {
      |                      ^
a.cc:25:22: error: 'D' was not declared in this scope
   25 |  for (int k = 0; k < D; ++k) {
      |                      ^
a.cc: At global scope:
a.cc:43:5: error: expected unqualified-id before 'return'
   43 |     return 0;
      |     ^~~~~~
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C++

#include<iostream>
#include <math.h>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    // スペース区切りの整数の入力
    int d;
  cin >> d;
  int data[n][d];
  int a;
  for(int i = 0;i<n;i++){
      for(int j = 0;j<d;j++){
    cin >> a;
    data[i][j] = a;
  	}  
  }
  
  int count = 0;
  for(int i = 0;i<(n - 1);i++){
      for(int j = i+1;j<n;j++){
           int sum =0;
         for(int m = 0;m<d;m++){
    sum = (data[i][m] - data[j][m])^2;
         }
        
   
      } 
    bool flag = false;
 	for (int k = 0; k <= sum; ++k) {
 	if (k * k == sum) {
 	flag = true;
	 }
	}
if (flag) ++count;
  }
  
  cout<<count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: 'sum' was not declared in this scope
   32 |         for (int k = 0; k <= sum; ++k) {
      |                              ^~~
Language: C++

// 133_B_Good_Distance.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<string>
#include <vector>
#include<math.h>

using namespace std;

int main()
{
	int N, D = 0;

	cin >> N >> D;

	vector<vector<int>> X;

	for (int i = 0; i < N; i++)
	{
		vector<int> row;

		for (int j = 0; j < D; j++)
		{	
			int value = 0;
			cin >> value;
			row.push_back(value);
		}

		X.push_back(row);
	}

	int count = 0;

	//計算
	for (int i = 0; i < N; i++)
	{
		vector<int> row1 = X.at(i);

		for (int j = i + 1; j < N; j++) {

			vector<int> row2 = X.at(j);

			double sum = 0;
			for (int k = 0; k < D; k++)
			{
				sum += row1.at[k] + row2.at[k];
			}

			double distance = sqrt(sum);

			//整数判定
			if (distance == floor(distance))
			{
				count++;
			}
		}
	}

	cout << count;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   47 |                                 sum += row1.at[k] + row2.at[k];
      |                                               ^
a.cc:47:60: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   47 |                                 sum += row1.at[k] + row2.at[k];
      |                                                            ^
Language: C++

#include<bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;


int main(){
  int n,d;
  cin>>n>>d;
  vector<vector<int>> x(n,vector<int>(d));
  REP(i,n){
    REP(j,d)cin>>x[i][j];
  }
  int ans=0;
  REP(i,n){
    REP(j,i){//j<i
      int sq=0;
      REP(k,d){
        int s=x[i][k]-x[j][k];
        sq+=s*s;
      }
    }
    int s=sqrt(sq)*0.5;//int キャストは切り捨てなので0.5たしとく
    if(s*s==sq)ans++;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 'sq' was not declared in this scope; did you mean 's'?
   25 |     int s=sqrt(sq)*0.5;//int キャストは切り捨てなので0.5たしとく
      |                ^~
      |                s
Language: C++

#include<bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;


int main(){
  int n,d;
  cin>>n>>d;
  vector<vector<int>> x(n,vector<int>(d));
  REP(i,n){
    REP(j,d)cin>>c[i][j];
  }
  int ans=0;
  REP(i,n){
    REP(j,i){//j<i
      int sq=0;
      REP(k,d){
        int s=c[i][k]-x[j][k];
        sq+=s*s;
      }
      int s=sqrt(sq)*0.5;//int キャストは切り捨てなので0.5たしとく
      if(s*s==sq)ans++;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'c' was not declared in this scope
   14 |     REP(j,d)cin>>c[i][j];
      |                  ^
a.cc:21:15: error: 'c' was not declared in this scope
   21 |         int s=c[i][k]-x[j][k];
      |               ^