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

#include <iostream>

using namespace std;
int fact(int n);
int main() {
    int n,m,sum=0;
    cin>>n>>m;
    sum=fact(n-1)+fact(m-1);
    cout<<sum;
}
long int fact(int n){
    long int res;
    if(!n)
    return 0;
    else    
    res=1;
    for(int i=n;i>1;i--)
    res+=i;
    return res;
}

Compiler output:
a.cc:11:10: error: ambiguating new declaration of 'long int fact(int)'
   11 | long int fact(int n){
      |          ^~~~
a.cc:4:5: note: old declaration 'int fact(int)'
    4 | int fact(int n);
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
 
  if (N==1&&M==1) {
    cout << 0 << endl;
  }
  else if{
    cout << (N*(N-1))/2+(M*(M-1))/2 << endl;
  }
}

 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected '(' before '{' token
   11 |   else if{
      |          ^
      |          (
Language: Java

import java.util.Scanner;

public class nmain {
static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {

		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum =0;
		 if(n==1) {
			 sum+=0;
		 }
		 else
			 sum+=((n)*(n-1))/2;
		 
		 if(m==1)
			 sum+=0;
		 else
			 sum+=((m)*(m-1))/2;
		 
		 System.out.println(sum);

	}

}


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

#include<bits/stdc++.h>
using namesapce std;
int main()
{
  int n,m;
  cin>>n>>m;
  long long sum=0;
  sum=(n*(n-1))/2+(m*(m-1))/1;
  cout<<sum<<endl;
  
  
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n>>m;
      |   ^~~
      |   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:9:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |   cout<<sum<<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:9:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    9 |   cout<<sum<<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)
      |     ^~~~
Language: C++

#include<iostream.h>
int fact(int n)
{
  int s=0;
  if(n>0)
    s=s*n;
  else
    cout<<"invalid input";
  return s;
}
void main()
{
  int n,m,s,p,q,r,g;
  cin>>n>>m;
  s=fact(n);
  p=fact(m);
  q=fact(n-2);
  r=fact(m-2);
  g=(s/(fact(2)*q))+(p/(fact(2)*r));
  cout<<g;
}
  

Compiler output:
a.cc:1:9: fatal error: iostream.h: No such file or directory
    1 | #include<iostream.h>
      |         ^~~~~~~~~~~~
compilation terminated.
Language: Java



import java.util.Scanner;

public class numberevenpairs {
static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {

		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum =0;
		 if(n==1) {
			 sum+=0;
		 }
		 else
			 sum+=((n)*(n-1))/2;
		 
		 if(m==1)
			 sum+=0;
		 else
			 sum+=((m)*(m-1))/2;
		 
		 System.out.println(sum);

	}

}


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

#include<iostream>
using namespace std;
int fac(int n)
{
  ans=1;
  for (int i=1; i<=n; i++)
  {
    ans*=i;
  }
}

int c2(int n)
{
  if (n<2){return 0;}
  else
  {
    return fac(n)/(fac(n-2)*2);
  }
}

int main()
{
  int n, m;
  cin>>n>>m;
  cout<<c2(n)+c2(m);
  return 0;
}
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

Compiler output:
a.cc: In function 'int fac(int)':
a.cc:5:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   ans=1;
      |   ^~~
      |   abs
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
Language: C++

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

int combination(int x) {
    if (x <= 1) {
        return 0;
    }
    unsigned long long ret = 1;
    for(int i = 1; i <= x; i++) {
        ret *= i;
    }
    for(int i = 1; i <= x - 2; i++) {
        ret /= i;
    }
    return ret / 2;
}

int main() {
    int n, m;
    cin >> n >> m;
    cout << combination(n) + combination(m)
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:44: error: expected ';' before '}' token
   21 |     cout << combination(n) + combination(m)
      |                                            ^
      |                                            ;
   22 | }
      | ~
Language: C++

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

int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}
  

int main(){
    int n, m;
    cin >> n >> m;
    cout << nCr(n,2)+nCr(m,2) << le;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:34: error: 'le' was not declared in this scope
   21 |     cout << nCr(n,2)+nCr(m,2) << le;
      |                                  ^~
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int s = 0;
		for (int i = N - 1; i > 0; i--)
			s = s + i;
		for (int i = M - 1; i > 0; i--)
			s = s + i;
		System.out.println("" + s);
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  
  if (N == 0 || M == 0) {
    cout << (N+M)*(N+M-1)/2 <<endl;

  else if (N+M == 2) {
    cout << "0" << endl;
  }

  else if (N+M == 3) {
    cout << "1" << endl;
  }
  
  else{
    cout << N*(N-1)/2+M*(M-1)/2 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected '}' before 'else'
   11 |   else if (N+M == 2) {
      |   ^~~~
a.cc:8:25: note: to match this '{'
    8 |   if (N == 0 || M == 0) {
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  cout << (combination(N,2)+combination(M,2)) << endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: 'combination' was not declared in this scope
    6 |   cout << (combination(N,2)+combination(M,2)) << endl;
      |            ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  
  int A = 1, 
  int B = 1;
  for (int i = 1; i <= N; ++i) {
    A *= i;
  }
  for (int i = 0; i <= M; ++i) {
    B *= i;
  }  
  cout << A + B << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected unqualified-id before 'int'
    9 |   int B = 1;
      |   ^~~
a.cc:14:5: error: 'B' was not declared in this scope
   14 |     B *= i;
      |     ^
a.cc:16:15: error: 'B' was not declared in this scope
   16 |   cout << A + B << endl;
      |               ^
Language: C++

//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
//* vamsicool007    You are never wrong to do the right thing    vamsicool007 *
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define int long long
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const int N=200005;
vector<int>vis(N);
vector<vector<int>>adj(N);
void dfs(int v){vis[v]=1;for(auto i:adj[v]){if(!vis[i]){dfs(i);}}return;}
bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll ans=a>b?a:b;return ans;}
ll min(ll a,ll b){ll ans=a<b?a:b;return ans;}
int root(int a[],int i){while(a[i]!=i){a[i]=a[a[i]];i=a[i];}return i;}
void unionn(int a[],int i,int j){int root_i=root(a,i);int root_j=root(a,j);a[root_i]=root_j;return;}

signed main()
{
    flash;
    //fun();
    int t=1;
    //cin>>t;
    while(t--)
    {
    	int n,m;
    	cin>>n>>m;
    	int s=0;
    	if(n>=2)
    		s=s+nCr(n,2);
    	if(m>=2)
    		s=s+nCr(m,2);
    	cout<<s;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: 'nCr' was not declared in this scope
   43 |                 s=s+nCr(n,2);
      |                     ^~~
a.cc:45:21: error: 'nCr' was not declared in this scope
   45 |                 s=s+nCr(m,2);
      |                     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  cout << (combination(N,2)
           +combination(M,2)) << endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: 'combination' was not declared in this scope
    6 |   cout << (combination(N,2)
      |            ^~~~~~~~~~~
Language: C

#include<stdio.h>
int kaijo(int n)
{
    int kai=1,i;
    if()
    for(i=n;n>0;i--){
        kai *= i;
    }
    return kai;
}
int main(void)
{
    int n.m;
    scanf("%d %d",&n,&m);
    if(n<2)
    {
        printf("%d",kaijo(m)/(2*kaijo(m-2)));
    }
    else if(m<2)
    {
        printf("%d",kaijo(n)/(2*kaijo(n-2)));
    }
    else
    {
        printf("%d",kaijo(n)/(4*kaijo(n-2)) + kaijo(m)/(4*kaijo(m-2)));
    }
    
    return 0;
}

Compiler output:
main.c: In function 'kaijo':
main.c:5:8: error: expected expression before ')' token
    5 |     if()
      |        ^
main.c: In function 'main':
main.c:13:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   13 |     int n.m;
      |          ^
main.c:13:10: error: expected expression before '.' token
main.c:14:20: error: 'n' undeclared (first use in this function)
   14 |     scanf("%d %d",&n,&m);
      |                    ^
main.c:14:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:23: error: 'm' undeclared (first use in this function)
   14 |     scanf("%d %d",&n,&m);
      |                       ^
Language: C++

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

int main(){
  int N;
  int M;
  
  cin >> N >> M;
  
  int patern;
  int count;
  for(int i = 0;i < N; i++){
    for(int j = 0; j < M; j++){
      j++;
      i++;
      count++;
    }
  }
  
  int max_patern; 
  for(int i = 0; i < (N + M);i++){
    max_patern++;
  }
  
  patern = max_patern - count;
  
  cout << patern << endl;
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: expected '}' at end of input
   27 |   cout << patern << endl;
      |                          ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<stdio.h>
int kaijo(int n)
{
    int kai=1,i;
    if()
    for(i=n;n>0;i--){
        kai *= i;
    }
    return kai;
}
int main(void)
{
    int n.m;
    scanf("%d %d",&n,&m);
    if(n<2)
    {
        printf("%d",kaijo(m)/(2*kaijo(m-2)));
    }
    else if(m<2)
    {
        printf("%d",kaijo(n)/(2*kaijo(n-2)));
    }
    else
    {
        printf("%d",kaijo(n)/(4*kaijo(n-2)) + kaijo(m)/(4*kaijo(m-2)));
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int kaijo(int)':
a.cc:5:8: error: expected primary-expression before ')' token
    5 |     if()
      |        ^
a.cc: In function 'int main()':
a.cc:13:10: error: expected initializer before '.' token
   13 |     int n.m;
      |          ^
a.cc:14:20: error: 'n' was not declared in this scope
   14 |     scanf("%d %d",&n,&m);
      |                    ^
a.cc:14:23: error: 'm' was not declared in this scope
   14 |     scanf("%d %d",&n,&m);
      |                       ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  int n, m;
  cin>>n>>m;
  int ans=0;
  int pren=1;
  int prem=1;
  for(int i=n; i>n-2&&i>0; i--){
    pren*=i;4 0 
  }
  pren/=2;
  for(int i=m; i>m-2&&i>0; i--){
    prem*=i;
  }
  prem/=2;
  if(m<2){
    prem=0;
  }
  if (n<2)
  {
    pren=0;
  }
  
  ans+=pren+prem;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: expected ';' before numeric constant
   19 |     pren*=i;4 0
      |              ^~
      |              ;
Language: Java

#include<bits/stdc++.h>
#define debug(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
const int INF = 1<<29;

using namespace std;



int main()
{
	
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	//clock_t time_req;time_req = clock();  
	int n,m;cin>>n>>m;
	int count = 0;
	for(int i = 1 ; i<n;i++) count+=i;
	for(int i = 1 ; i<m;i++) count+=i;
	cout<<count;




	//time_req = clock()- time_req;cout << "Time Compexity:"<< (float)time_req/CLOCKS_PER_SEC << " seconds" << endl; 
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<bits/stdc++.h>
        ^
Main.java:2: error: illegal character: '#'
#define debug(x) cout << '>' << #x << ':' << x << endl;
^
Main.java:2: error: illegal character: '#'
#define debug(x) cout << '>' << #x << ':' << x << endl;
                                ^
Main.java:3: error: class, interface, enum, or record expected
typedef long long ll;
^
Main.java:4: error: class, interface, enum, or record expected
const int INF = 1<<29;
^
Main.java:6: error: class, interface, enum, or record expected
using namespace std;
^
Main.java:15: error: not a statement
	int n,m;cin>>n>>m;
	              ^
Main.java:19: error: not a statement
	cout<<count;
	    ^
Main.java:10: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
  (use --enable-preview to enable unnamed classes)
10 errors
Language: C++

include<stdio.h>
int main(){
int N,M,a;
scanf("%ld%ld",&N,&M);
a=(N*(N-1)+M*(M-1))/2;
printf("%d\n",a);
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long int
// C++ implementation to find nCr 
#include <bits/stdc++.h> 
using namespace std; 

// Function to find the nCr 
void printNcR(int n, int r) 
{ 

	// p holds the value of n*(n-1)*(n-2)..., 
	// k holds the value of r*(r-1)... 
	long long p = 1, k = 1; 

	// C(n, r) == C(n, n-r), 
	// choosing the smaller value 
	if (n - r < r) 
		r = n - r; 

	if (r != 0) { 
		while (r) { 
			p *= n; 
			k *= r; 

			// gcd of p, k 
			long long m = __gcd(p, k); 

			// dividing by gcd, to simplify product 
			// division by their gcd saves from the overflow 
			p /= m; 
			k /= m; 

			n--; 
			r--; 
		} 

		// k should be simplified to 1 
		// as C(n, r) is a natural number 
		// (denominator should be 1 ) . 
	} 

	else
		p = 1; 

	// if our approach is correct p = ans and k =1 
	return p; 
} 


 main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //#define int long long int
    int n,m;
    cin>>n>>m;
    int e=printNcR(n,2)+printNcR(m,2);
    cout<<e<<endl;


    return 0;
}


Compiler output:
a.cc: In function 'void printNcR(long long int, long long int)':
a.cc:47:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   47 |         return p;
      |                ^
a.cc: At global scope:
a.cc:51:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   51 |  main()
      |  ^~~~
a.cc: In function 'int main()':
a.cc:57:24: error: invalid operands of types 'void' and 'void' to binary 'operator+'
   57 |     int e=printNcR(n,2)+printNcR(m,2);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~
      |                   |             |
      |                   void          void
Language: C

#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n,m;
    cin >> n >> m;
  
  	int ans=0;
  	for(int i=0;i<n;i++) ans += i;
  	for(int i=0;i<m;i++) ans += i;
  
    cout << ans;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    int n,m;
    int rn,rm;
    cin >> n >> m;
    int ne = 1;
    int me = 1;
    for(int i=1;i<=n;i++){
        ne *= i;
    }

        for(int i=1;i<=m;i++){
        me *= i;
    }

    int rne = 1;
    for(int i=1;i<=n-2;i++){
        rne *= i;
    }

    int rme = 1;
    for(int i=1;i<=m-2;i++){
        rme *= i;
    }
    if(!rme){rme=1;}
    if(!rne){rne=1;}
    rn = (ne / rne)/2;
    rm = (me / rme)/2;
    if(n==1){rn=0;}
    if(m==1){rm=0;}
    cout << rn + rm << endl;
}#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    int n,m;
    int rn,rm;
    cin >> n >> m;
    int ne = 1;
    int me = 1;
    for(int i=1;i<=n;i++){
        ne *= i;
    }

        for(int i=1;i<=m;i++){
        me *= i;
    }

    int rne = 1;
    for(int i=1;i<=n-2;i++){
        rne *= i;
    }

    int rme = 1;
    for(int i=1;i<=m-2;i++){
        rme *= i;
    }
    if(!rme){rme=1;}
    if(!rne){rne=1;}
    rn = (ne / rne)/2;
    rm = (me / rme)/2;
    if(n==1){rn=0;}
    if(m==1){rm=0;}
    cout << rn + rm << endl;
}

Compiler output:
a.cc:38:2: error: stray '#' in program
   38 | }#include <iostream>
      |  ^
a.cc:38:3: error: 'include' does not name a type
   38 | }#include <iostream>
      |   ^~~~~~~
a.cc:45:8: error: redefinition of 'int main()'
   45 | signed main(){
      |        ^~~~
a.cc:8:8: note: 'int main()' previously defined here
    8 | signed main(){
      |        ^~~~
Language: C++

N, M = map(int, input().split())
if N == 1:
    print(int((M*(M-1))/2))
elif M == 1:
    print(int((N*(N-1))/2))
else:
    print(int((N*(N-1))/2)+int((M*(M-1))/2))

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

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

int main(){
  int N,M;
  cin>>N>>M;
  
  if(N!=0 && M!=0){
    cout<<N(N-1)+M(M-1)<<endl;
  }
  else if(N==0 && M!=0){
    cout<<M(M-1)<<endl;
  }
  else if(N!=0 && M==0){
    cout<<N(N-1)<<endl;
  }
  else{
    cout<<0<<endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'N' cannot be used as a function
    9 |     cout<<N(N-1)+M(M-1)<<endl;
      |           ~^~~~~
a.cc:9:19: error: 'M' cannot be used as a function
    9 |     cout<<N(N-1)+M(M-1)<<endl;
      |                  ~^~~~~
a.cc:12:12: error: 'M' cannot be used as a function
   12 |     cout<<M(M-1)<<endl;
      |           ~^~~~~
a.cc:15:12: error: 'N' cannot be used as a function
   15 |     cout<<N(N-1)<<endl;
      |           ~^~~~~
Language: Java

package app;
import java.util.*;

/*
問題文
N+M個のボールがあります。各ボールには整数が 
1つ書かれています。
これらのボールに書かれている数について、
N個のボールに書かれている数は偶数
M個のボールに書かれている数は奇数
であることがわかっています。

これらの N+M個のボールの中から 2つ選んで、書かれた数の和が偶数になる方法の数を求めてください。選ぶ順序は考慮しません。

なお、この方法の数はボールに書かれている整数の実際の値によらないことが示せます。

制約
0≤N,M≤100
2≤N+M
入力はすべて整数である。
*/



public class App {
    public static void main(String[] args){

        //スキャン
        Scanner s = new Scanner(System.in);
        int n =  s.nextInt();
        int m = s.nextInt();

        int hoge = (n * (n-1) + m * (m-1))/2;
        
        System.out.println(hoge);
    }

    
}


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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin >> N >> M;
  cout << (combination(N,2))+(combination(M,2)) << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: 'combination' was not declared in this scope
    6 |   cout << (combination(N,2))+(combination(M,2)) << endl;
      |            ^~~~~~~~~~~
Language: C

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

int main()
{
	int n,m,p,q;
  	cin>>n>>m;
  	if(n<2&&m<2)cout<<0<<endl;
  	else
    {
      p=(n>2)?(n*(n-1)/2):1;
      q=(m>2)?(m*(m-1)/2):1;
      if(n==0)p=0;
      if(m==0)q=0;
      cout<<p+q;
    }
}	

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

package app;
import java.util.*;

/*
問題文
N+M個のボールがあります。各ボールには整数が 
1つ書かれています。
これらのボールに書かれている数について、
N個のボールに書かれている数は偶数
M個のボールに書かれている数は奇数
であることがわかっています。

これらの N+M個のボールの中から 2つ選んで、書かれた数の和が偶数になる方法の数を求めてください。選ぶ順序は考慮しません。

なお、この方法の数はボールに書かれている整数の実際の値によらないことが示せます。

制約
0≤N,M≤100
2≤N+M
入力はすべて整数である。
*/



public class App {
    public static void main(String[] args){

        //スキャン
        Scanner s = new Scanner(System.in);
        int n =  s.nextInt();
        int m = s.nextInt();

        int hoge = (n * (n-1) + m * (m-1))/2;
        
        System.out.println(hoge);
    }

    
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package app;
      | ^~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:25:1: error: expected unqualified-id before 'public'
   25 | public class App {
      | ^~~~~~
Language: C++

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

int main(){
    int N, M;
    cin >> N >> M;
    int counter = 0;
     counter = counter + (N/2) * (N-1)
     counter = counter +(M/2)*(M-1);

     cout << counter << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:39: error: expected ';' before 'counter'
    8 |      counter = counter + (N/2) * (N-1)
      |                                       ^
      |                                       ;
    9 |      counter = counter +(M/2)*(M-1);
      |      ~~~~~~~
Language: C

#include <stdio.h>

int main(){
  int i,x,y,z;
  x=0;y=0;z=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    x+=z;
    z++;
  }
  z=0;
  for(i=0;i<m;i++){
    y+=z;
    z++;
  }
  printf("%d\n",x+y);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:18: error: 'n' undeclared (first use in this function)
    6 |   scanf("%d %d",&n,&m);
      |                  ^
main.c:6:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:21: error: 'm' undeclared (first use in this function)
    6 |   scanf("%d %d",&n,&m);
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int main()	{
  int n,m;
  cin>>n>>m;
  int c=n+m;
  int d=0,e=0;
  rep(i,c){
    if(i%2==0){
      d++;
    }
    else{
      e++;
    }
  }
  int sum=d*(d-1)/2+e(e-1)/2;
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: 'e' cannot be used as a function
   21 |   int sum=d*(d-1)/2+e(e-1)/2;
      |                     ~^~~~~
Language: C++

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

int main() {
  int N,M;
  cin >> N >> M;
  int A=N*(N-1)/2 
  int B=M*(M-1)/2 
  cin >> A >>B;
  
  if (N+M == 2) {
    cout << "0" << endl;
  }

  if (N+M == 3) {
    cout << "1" << endl;
  }
  
  else{
    cout <<A+B<< endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'int'
    8 |   int B=M*(M-1)/2
      |   ^~~
a.cc:20:14: error: 'B' was not declared in this scope
   20 |     cout <<A+B<< endl;
      |              ^
Language: Java

import java.util.*;
static long combination(long n,long r)
    {
        long ans=1;
        for(long i=0;i<r;i++)
        {
            ans=(ans*(n-i))/(i+1);
        }
        return ans;
    }
public class Main {// Main
    public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
    	long e=sc.nextLong();
      	long o=sc.nextLong();
      	if(e>=2){
          ans+=combination(e,2);
        }
      	if(o>=2){
          ans+=combination(o,2);
        }
      System.out.println(ans);
    }
}

Compiler output:
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
static long combination(long n,long r)
       ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#define tnum long long

#define loop(i,end) for(int i = 0; i < end; i++)

int main(int argc, char *argv[]) {
	int n, m;
	tnum res;

	scanf("%d %d", &n, &m);
	res = n * (n - 1) / 2 + m * (m - 1) / 2;
	printf("%lld", res);

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:9:9: error: 'scanf' was not declared in this scope
    9 |         scanf("%d %d", &n, &m);
      |         ^~~~~
a.cc:11:9: error: 'printf' was not declared in this scope
   11 |         printf("%lld", res);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define tnum long long
Language: C++

#include<bits/stdc++.h>
using namespace std;
ll nCr(ll n, ll r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}

int main() {
	ll n, m;
	cin >> n >> m;
	if (n > 1) {
		n = nCr(n, 2);
	}
	else {
		n = 0;
	}
	if (m > 1) {
	m = nCr(m, 2);
	}
	else {
		m = 0;
	}
	//cout << n << " " << m << endl;
	cout << n + m << endl;
	return 0;
}

Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll nCr(ll n, ll r) {
      | ^~
a.cc: In function 'int main()':
a.cc:15:9: error: 'll' was not declared in this scope
   15 |         ll n, m;
      |         ^~
a.cc:16:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 |         cin >> n >> m;
      |                ^
      |                yn
a.cc:16:21: error: 'm' was not declared in this scope; did you mean 'tm'?
   16 |         cin >> n >> m;
      |                     ^
      |                     tm
a.cc:18:21: error: 'nCr' was not declared in this scope
   18 |                 n = nCr(n, 2);
      |                     ^~~
a.cc:24:13: error: 'nCr' was not declared in this scope
   24 |         m = nCr(m, 2);
      |             ^~~
Language: C++

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

int main(){
  int N,M;
  cin>>N>>M;
  cout<<N(N-1)/2+M(M-1)/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'N' cannot be used as a function
    7 |   cout<<N(N-1)/2+M(M-1)/2<<endl;
      |         ~^~~~~
a.cc:7:19: error: 'M' cannot be used as a function
    7 |   cout<<N(N-1)/2+M(M-1)/2<<endl;
      |                  ~^~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define PI 3.1415926535897932384
#define MAX 100000
#define MOD 10000007
using namespace std;

///OMI
int main()
{

   int m,n,count=0;

   cin>>m>>n;
     m--;n--;
  int even=(m*(m+1))/2
  int odd=(n*(n+1))/2;

  int res=odd+even;

  cout<<res<<endl;

  

return 0;

   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: expected ',' or ';' before 'int'
   17 |   int odd=(n*(n+1))/2;
      |   ^~~
a.cc:19:11: error: 'odd' was not declared in this scope
   19 |   int res=odd+even;
      |           ^~~
Language: C

#include<stdio.h
int main()
{
  int N,M,A;
  scanf("%d %d", &N, &M);
  
  A = N*(N+1)/2+M*(M+1)/2;
  
  printf("%d\n", A);
return 0;
}

Compiler output:
main.c:1:17: error: missing terminating > character
    1 | #include<stdio.h
      |                 ^
Language: C

N, M = map(int, input().split())

total  = M*(M-1)/2
total += N*(N-1)/2

total = int(total)

print(total)


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N, M = map(int, input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:4: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
    1 | N, M = map(int, input().split())
      |    ^
main.c:1:8: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N, M = map(int, input().split())
      |        ^~~
main.c:1:12: error: expected expression before 'int'
    1 | N, M = map(int, input().split())
      |            ^~~
main.c:3:1: error: expected ',' or ';' before 'total'
    3 | total  = M*(M-1)/2
      | ^~~~~
Language: Java

import java.util.*;
public class Main  {
   public static void main(String[] args) throws java.lang.Exception  {
      Scanner sc = new Scanner(System.in);
      
      int  m = sc.next();
      int  n = sc.next(); 
      
      int mm = m*(m-1)/2;
      int nn = n*(n-1)/2;
      int answer = mm + nn;
      System.out.println(answer);
   }        
}

Compiler output:
Main.java:6: error: incompatible types: String cannot be converted to int
      int  m = sc.next();
                      ^
Main.java:7: error: incompatible types: String cannot be converted to int
      int  n = sc.next(); 
                      ^
2 errors
Language: C

#include <stdio.h>

int main(){
  int i,x=0,y=0,z=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    x+=z;
    z++;
  }
  z=0;
  for(i=0;i<m;i++){
    y+=z;
    z++;
  }
  printf("%d\n",x+y);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:18: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d %d",&n,&m);
      |                  ^
main.c:5:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:21: error: 'm' undeclared (first use in this function)
    5 |   scanf("%d %d",&n,&m);
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007


ll findpow(ll a,ll b){
    ll cnt=0,i,j;
    while(a>1){
        a=a/b;
        cnt++;
    }
    return cnt;
}


int main(){
    ll i,j,k,sum=0,n,sum1=0,t,ans=1000000000,p,max1=0,l=0,m;
    string c;
    cin>>n>>m;
    cout<<(n*(n-1)/2)+(m*(m-1)/2)<<endl;
    
    }
    
   
   
   
    
    
	return 0;
}

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

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

int main()
{
 int n.m;
  cin>>n>>m;
  cout<<n*(n-1)/2+m*(m-1)/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected initializer before '.' token
    6 |  int n.m;
      |       ^
a.cc:7:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin>>n>>m;
      |        ^
      |        yn
a.cc:7:11: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |   cin>>n>>m;
      |           ^
      |           tm
Language: C++

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

#define ll long long 
#define int ll

int32_t main() {
    int n, m; cin >> n >> m;
    cout << (n * (n - 1)) / 2) + (m * (m - 1)) / 2) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:9:30: error: expected ';' before ')' token
    9 |     cout << (n * (n - 1)) / 2) + (m * (m - 1)) / 2) << endl;
      |                              ^
      |                              ;
Language: C

#include <stdio>

int main(){
  int m,n;
  scanf("%d%d",&m,&n);
  printf("%d\n",m*(m-1)*n*(n-1)/4);
  return 0;
}

Compiler output:
main.c:1:10: fatal error: stdio: No such file or directory
    1 | #include <stdio>
      |          ^~~~~~~
compilation terminated.
Language: C++

n, m = map(int, input().split())

from math import factorial

cn = 0
cm = 0

if n >= 2:
    cn = factorial(n) // (factorial(n - 2) * factorial(2))

if m >= 2:
    cm = factorial(m) // (factorial(m - 2) * factorial(2))

print(int(cn+cm))

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

import java.util.*;
public class Main  {
   public static void main(String[] args) throws java.lang.Exception  {
      Scanner sc = new Scanner(System.in);
      
      int  m = sc.next();
      int  n = sc.next(); 
      
      int mm = m*(m-1)/2;
      int nn = n*(n-1)/2;
      int answer = mm + nn;
      System.out.println(answer);
   }        
}


Compiler output:
Main.java:6: error: incompatible types: String cannot be converted to int
      int  m = sc.next();
                      ^
Main.java:7: error: incompatible types: String cannot be converted to int
      int  n = sc.next(); 
                      ^
2 errors
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    inr m = sc.nextInt();
    System.out.println((n * (n - 1) / 2) + (m * (m - 1))/2);
  }
}

Compiler output:
Main.java:6: error: cannot find symbol
    inr m = sc.nextInt();
    ^
  symbol:   class inr
  location: class Main
1 error
Language: Java

import java.io.*;
import java.util.*;
public class evenpairs {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int N = inputs.nextInt();
		int M = inputs.nextInt();
		int sum = 0;
		if(N>=2) {
			sum+=comb(N,2);
		}
		if(M>=2) {
			sum+=comb(M,2);
		}
		System.out.println(sum);
	}
	static int comb(int n , int r)
	{
		if( r== 0 || n == r)
			return 1;
		else
			return comb(n-1,r)+comb(n-1,r-1);
	}
}


Compiler output:
Main.java:3: error: class evenpairs is public, should be declared in a file named evenpairs.java
public class evenpairs {
       ^
1 error
Language: Java

import java.io.*;
import java.util.*;
public class Codeforces {
	static Scanner sc;
	static PrintWriter out;
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int n,m;
		n = sc.nextInt();m = sc.nextInt();
		long ans = n*(n-1)/2 + m*(m-1)/2;
		out.println(ans);
		out.flush();
	} 
	static class Scanner{
		private BufferedReader br;
		private StringTokenizer st;
		public Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		public String next() throws IOException{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException{
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException{
			return Double.parseDouble(next());
		}
		public int[] inArr(int n) throws Exception{
			int a [] = new int[n];
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				a[i] = Integer.parseInt(st.nextToken());
			}
			return a;
		}
	}
}

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

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

int main(){
 int n,m;
 cin >> n >> m;
  
 while(n > 0 && m > 0){
  cout << n * (n - 1) / 2 << endl;
  cout << m * (m - 1) / 2 << endl;
}


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

    /* HARDWORK IS THE KEY TO SUCCESS.
       RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/
    #include <bits/stdc++.h>
    #define pragma
    using namespace std;
    #define ll long long
    #define ld long double
    #define T ll t = 1; cin>>t; while(t--)
    #define vin ll n; cin>>n; vector<ll>x(n); for(ll i=0; i<n; i++) cin>>x[i]
    #define vout for(ll i=0; i<n; i++) cout<<x[i]<<" "
    #define ain ll n,k,i; cin>>n; ll a[n]; for( i=0; i<n; i++) cin>>a[i]
    #define aout for(ll i=0; i<n; i++) cout<<a[i]<<" "
    #define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1] ; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
    #define matout for(ll i=0;i<m;i++){for(ll j=0;j<n;j++) cout<<a[i][j]<<" "; cout<<"\n";}
    #define sin set<ll>s; ll n; cin>>n; ll tmp; for(ll i=0;i<n;i++){cin>>tmp; s.I(tmp);}
    #define sout for(auto it=s.begin();it!=s.end();++it) cout<<*it<<" "
    #define F first
    #define S second
    #define I insert
    #define pb push_back
    #define ppb pop_back
    #define AISORT sort(a,a+n)
    #define ADSORT sort(a,a+n,greater<ll>())
    #define VISORT sort(x.begin(),x.end())
    #define VDSORT sort(x.begin(),x.end(),greater<ll>())

    const ll maxs = 1e5+3;
    const ll maxs1 = 1e3+4;
    const ll mod = 1e9 + 7;

    //MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

    //POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

    //MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}

//     ll n;
//     ll a[maxs];
//     ll tree[maxs];
    bool vis[maxs];
    vector<ll>graph[maxs];
    //ALWAYS CLEAR THEM WHEN TESTCASES ARE GIVEN
    //ALWAYS RETURN WHEN ST == ED CONDITION IN SEGMENT TREES


    int main()
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
      ll n,m;
        cin >> n >> m;
        if(n == 1 && m == 1)
        {
            cout << 0 ;
            return;
        }
        ll ans = n * (n - 1) / 2;
        cout << ans + m;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:62:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   62 |             return;
      |             ^~~~~~
Language: C

#include <iostream>
#include <vector>

using namespace std;

int main(){

    long long n, m; cin >> n; cin >> m;

    long long ans;
    ans = (((m*m)-m) + ((n*n)-n))/2;
    cout << ans << endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

n,m=map(int,input().split())
print(((n<2)if 0 else (n*(n-1)//2))+((m<2) if 0 else (m*(m-1)//2)))

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m=map(int,input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | n,m=map(int,input().split())
      |   ^
main.c:1:5: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n,m=map(int,input().split())
      |     ^~~
main.c:1:9: error: expected expression before 'int'
    1 | n,m=map(int,input().split())
      |         ^~~
main.c:2:1: error: expected ',' or ';' before 'print'
    2 | print(((n<2)if 0 else (n*(n-1)//2))+((m<2) if 0 else (m*(m-1)//2)))
      | ^~~~~
Language: C++

import sys
# sys.stdin = open('input.txt')

import math

n,m = map(int, input().split())
def c(n):
    return int(math.factorial(n) / math.factorial(n-2) / math.factorial(2))

if n == 1 and m == 1:
    print(0)
else:
    print(c(n)+c(m))

Compiler output:
a.cc:2:3: error: invalid preprocessing directive #sys
    2 | # sys.stdin = open('input.txt')
      |   ^~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
    cs;
    int n,m,t=0;
    cin>>n>>m;
    if(n>=2) t+=n*(n-1)/2;
    if(m>=2) t+=m*(m-1)/2;
    cout<<t;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cs' was not declared in this scope; did you mean 'cos'?
    6 |     cs;
      |     ^~
      |     cos
Language: C++

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

int main(){
  int M,N;
  
  cin>>M;
  cin>>N;
    
  cout<<M(M-1)/2+N(N-1)/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'M' cannot be used as a function
   10 |   cout<<M(M-1)/2+N(N-1)/2<<endl;
      |         ~^~~~~
a.cc:10:19: error: 'N' cannot be used as a function
   10 |   cout<<M(M-1)/2+N(N-1)/2<<endl;
      |                  ~^~~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class ABC159A {

    public static void main(String[] args) {

//        long start1 = System.currentTimeMillis();
//        long end1 = System.currentTimeMillis();
//        System.out.println("time1: " + (end1 - start1));

        Scanner scanner = new Scanner(System.in);

        String[] inputs = scanner.nextLine().split(" ");

        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        int result = n * (n - 1) / 2 + m * (m - 1) / 2;

        System.out.println(result);
    }
}

Compiler output:
Main.java:4: error: class ABC159A is public, should be declared in a file named ABC159A.java
public class ABC159A {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=  new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int num=0;
        if (n > 0) {
            num += n * (n-1)/2;
        } if (m > 0) {
            num +=m * (m-1)/2;
        }
        System.out.println(num);
    }
}

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

// In the name of god
#include <bits/stdC++.h>
#pragma GCC optimize("02")
using namespace std;
const int maxn=1e5+5;
long long n,m,x; 

int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n>>m;
	cout<<(n*(n-1)/2)+(m*(m-1)/2);
}


Compiler output:
a.cc:2:10: fatal error: bits/stdC++.h: No such file or directory
    2 | #include <bits/stdC++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int func(int n)
{
  return (n*(n-1))/2);
}
int main()
{
 	int n,m,a,b;
  cin>>n>>m;
  	a = func(n);
    b = func(m);
    cout<<a+b;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:6:21: error: expected ';' before ')' token
    6 |   return (n*(n-1))/2);
      |                     ^
      |                     ;
a.cc:6:21: error: expected primary-expression before ')' token
Language: C++

#include <iostream>
using namespace stdl
int main() {
  int n, m;
  cin >> n >> m;
  cout << n * (n - 1) / 2 + m * (m - 1) / 2;
  return 0;
}

Compiler output:
a.cc:2:17: error: 'stdl' is not a namespace-name
    2 | using namespace stdl
      |                 ^~~~
a.cc:2:21: error: expected ';' before 'int'
    2 | using namespace stdl
      |                     ^
      |                     ;
    3 | int main() {
      | ~~~                  
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> n >> m;
      |   ^~~
      |   std::cin
In file included 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:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |   cout << n * (n - 1) / 2 + m * (m - 1) / 2;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

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

void comb(vector<vector <int> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

int main(){
    int N, M;
    cin >> N >> M;
    int a = comb(N, 2), b = comb(M, 2);
    cout << a + b << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: invalid initialization of reference of type 'std::vector<std::vector<int> >&' from expression of type 'int'
   19 |     int a = comb(N, 2), b = comb(M, 2);
      |                  ^
a.cc:4:34: note: in passing argument 1 of 'void comb(std::vector<std::vector<int> >&)'
    4 | void comb(vector<vector <int> > &v){
      |           ~~~~~~~~~~~~~~~~~~~~~~~^
a.cc:20:17: error: 'b' was not declared in this scope
   20 |     cout << a + b << endl;
      |                 ^
Language: C++

#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c=0,d=0;
  cin>>a>>b;4
    rep(i,a){
    c+=i;
  } 
  rep(i,b){
    d+=i;
  }
  cout<<c+d;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ';' before 'for'
    7 |   cin>>a>>b;4
      |              ^
      |              ;
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i,a){
      |         ^
a.cc:4:39: note: in definition of macro 'rep'
    4 | #define rep(i, n)        for(int i=0; i<(int)(n); ++i)
      |                                       ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int C[105][105];
int n;
int main()
{
    n = 100;
    memset(C, 0, sizeof(C));
    for (int i = 0; i <= n; i++)
    {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++)
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
	int t, m;
	cin >> t >> m;
	cout << C[t][2] + C[m][2];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'memset' was not declared in this scope
    9 |     memset(C, 0, sizeof(C));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <bis/stdc++.h>
#define pb push_back

using namespace std;

    int n, m, a;

int main(){

    cin >> n >> m;
    
    for(int i=1; i<n; i++)
        a += i;
    
    for(int i=1; i<m; i++)
        a += i;
    
    cout << a;

    return 0;
}


Compiler output:
a.cc:1:10: fatal error: bis/stdc++.h: No such file or directory
    1 | #include <bis/stdc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

int main(){
	int N,M;
  	cin >> N >> M;
  	int c;
  	c = N*(N-1) + M*(M-1)
    cout << c/2 << endl;
  	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:30: error: expected ';' before 'cout'
    8 |         c = N*(N-1) + M*(M-1)
      |                              ^
      |                              ;
    9 |     cout << c/2 << endl;
      |     ~~~~