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

#include<stdio.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  int ans;
  
  if(N % 2 == 0){
    ans = N;
  }else{
    ans = N * 2;
  }
  
  cout << ans << endl;
}

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

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

long max4(long *);
long min4(long *);
long min(long *, long);

long main()
{
  long n, a[200000];
  long s[4], b0, b1, b2, score[199997];
  long i, j, b0c, b2c;

  scanf("%ld", &n);

  for (i = 0; i < n; ++i)
  {
    scanf("%ld", &(a[i]));
  }

  for (i = 0; i < n - 1; ++i)
  {
    a[i + 1] = a[i] + a[i + 1];
  }

  b0 = 0;
  b1 = 0;
  b2 = 2;
  for (i = 0; i < n - 3; ++i)
  {
    ++b1;
    b0c = b0;
    for (j = 0; j < b1 - b0c - 1; ++j)
    {
      b0 = b0 + 1;
      if (abs(a[b1] - a[b0] * 2) > abs(a[b1] - a[b0 - 1] * 2))
      {
        b0 = b0 - 1;
        break;
      }
    }
    s[0] = a[b0];
    s[1] = a[b1] - a[b0];

    b2c = b2;
    for (j = 0; j < n - b2c - 2; ++j)
    {
      b2 = b2 + 1;
      if (abs(a[n - 1] - a[b2] * 2 + a[b1]) > abs(a[n - 1] - a[b2 - 1] * 2 + a[b1]))
      {
        b2 = b2 - 1;
        break;
      }
    }
    s[2] = a[b2] - a[b1];
    s[3] = a[n - 1] - a[b2];

//    prlongf("b0 b1 b2: %ld %ld %ld\n", b0, b1, b2);
//    prlongf("    s0 s1 s2 s3: %ld %ld %ld %ld\n", s[0], s[1], s[2], s[3]);

    score[i] = max4(s) - min4(s);
  }

  prlongf("%ld\n", min(score, n - 3));

  return 0;
}

long max4(long *a)
{
  long ans = a[0], i;
  for (i = 0; i < 3; ++i)
  {
    if (a[i + 1] > ans)
    {
      ans = a[i + 1];
    }
  }
  return ans;
}

long min4(long *a)
{
  long ans = a[0], i;
  for (i = 0; i < 3; ++i)
  {
    if (a[i + 1] < ans)
    {
      ans = a[i + 1];
    }
  }
  return ans;
}

long min(long *a, long size)
{
  long ans = a[0], i;
  for (i = 0; i < size - 1; ++i)
  {
    if (a[i + 1] < ans)
    {
      ans = a[i + 1];
    }
  }
  return ans;
}


Compiler output:
main.c: In function 'main':
main.c:64:3: error: implicit declaration of function 'prlongf' [-Wimplicit-function-declaration]
   64 |   prlongf("%ld\n", min(score, n - 3));
      |   ^~~~~~~
Language: C++

// last.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include <cmath>
#include <string>
#include <float.h>
using namespace std;

int main()
{
    int l;
    cin>>l;
    int* num = new int[l];
    int* hik = new int[l];
    int b = 0;
    int kanasimi=0;

    
    for (int i = 0;i<l;i++){
        cin>>num[i];
        hik[i]=num[i]-i;
    }

    std::sort(hik, hik+l);
    if(l%2){
        b=hik[(l-1)/2];
    }else{
        b=(hik[l/2]+hik[(l/2)-1])/2;
    }
    for(int i = 0;i<l;i++){
        kanasimi=kanasimi+abs(num[i]-i-b);
    }
    
    cout<<kanasimi;
    
    delete num;
    delete hik;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'sqrt'?
   24 |     std::sort(hik, hik+l);
      |          ^~~~
      |          sqrt
Language: C++

#include <iosteram>

using namespace std;

int main() {
  int N;
  cin >> N;
  if (N % 2 == 0) {
    cout << N << endl;
  } else {
    cout << 2 * N << endl;
  }
  return 0;
}

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

//Note:The template file will be copied to a new file. When you change the 
#include <iostream> 
#include <string>
using namespace std;

void main(){
    int n;
    cin >> n;
    while(n % 2 == 0)n/=2;
    cout << n * 2 << endl;
    return 0;
}

Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | void main(){
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll N;
	cin>>N;
	for(ll i=2;i<=N;i++)
	{
		if(n%2==0)
		{
			cout<<N;
			break;
		}
		else n=n*2;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: 'n' was not declared in this scope
   10 |                 if(n%2==0)
      |                    ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int i;
    int ans;
    if (n % 2 == 0) {
        i = n;
    }
    else {
        i = n-1;
    }

    while(1)
    {
        if (i % n == 0) {
            ans = i;
            break;
        }
        i = i+2;
    }
    cout << ans << endl;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: expected '}' at end of input
   30 |     return 0;
      |              ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

/*input
3
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

lol n, ans;

int main() {
    cin >> n;
    ans = n * 2 / __gcd(n, 2);

    cout << ans << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: no matching function for call to '__gcd(lol&, int)'
   12 |     ans = n * 2 / __gcd(n, 2);
      |                   ~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:12:24: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   12 |     ans = n * 2 / __gcd(n, 2);
      |                   ~~~~~^~~~~~
Language: C++

#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n;
  scanf("%d", &n);
  int r = n;
  while(r%2 != 0 || r%n != 0) {
    r += n;
  }
  printf("%d\n", ret);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:18: error: 'ret' was not declared in this scope
   49 |   printf("%d\n", ret);
      |                  ^~~
Language: C

#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    
    if(n == 1){
        printf("%d\n", 2);
    }else{
        if(n % 2 == 0){
            printf("%d\n", n);
        }else{
            printf("%d", n * 2);
        }
    }
}*

Compiler output:
main.c:17:1: error: expected identifier or '(' at end of input
   17 | }*
      | ^
Language: Java

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if(n % 2 == 0) {
			System.out.println(n);
			return;
		}
		else (
			System.out.println(2 * n);
		)
	}
}


Compiler output:
Main.java:11: error: ')' expected
			System.out.println(2 * n);
			                         ^
Main.java:10: error: not a statement
		else (
		     ^
Main.java:12: error: illegal start of expression
		)
		^
3 errors
Language: C++

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

int main(void){
  int n;
  
  cin >> n;
  
  cout << (n%2)?n*2:n << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   11 |   cout << (n%2)?n*2:n << endl;
      |                     ~~^~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << (n % 2 == 0) ? n : 2 * n << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:38: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    9 |     cout << (n % 2 == 0) ? n : 2 * n << endl;
      |                                ~~~~~~^~~~~~~
Language: C++

#include <iostream>
using name space std;
int main()
{
  int n;
  cin >> n;
  return n % 2 == 0 ? n : 2 * n;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'name'
    2 | using name space 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;
      |   ^~~
      |   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
      |                  ^~~
Language: C++

#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    if(n%2==0)cout<<n<<endl
    else cout<<n*2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: expected ';' before 'else'
    8 |     if(n%2==0)cout<<n<<endl
      |                            ^
      |                            ;
    9 |     else cout<<n*2<<endl;
      |     ~~~~
Language: C++

#include <iostream>

int main () {
    int n;
    std::cin >> n;
    if (n == 0) {
        std::cout << n << std::endl;
    }
    else if (n % 2 == 1) {
        std::cout << n * 2 << std::endl;
    }
    else {
        for (;n % 2 == 0) {
            n = n / 2;
        }
        std::cout << n * 2 << std::endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ';' before ')' token
   13 |         for (;n % 2 == 0) {
      |                         ^
      |                         ;
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
 
using namespace std;
 
int ans(vector<int> v, int b){
  int sum = 0;
  for(int i = 0; i < v.size(); i++){
    sum += abs(v.at(i) - b);
  }
  return sum;
}
 
int main(){
  int mid;
  int n;
  int t, sum = 0;
  int index, a, b;
  
  vector<int> v;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> t; v.push_back(t - (i + 1));
  }
  sort(v.begin(), v.end());
  if(v.size() % 2 != 0){
    index = v.at(v.size() / 2);
  }
  else
    index = (v.at(v.size() / 2) + v.at(v.size() / 2 + 1) ) / 2;
  }
  a = ans(v, index);
  cout << a << endl;
}

Compiler output:
a.cc:35:3: error: 'a' does not name a type
   35 |   a = ans(v, index);
      |   ^
a.cc:36:3: error: 'cout' does not name a type
   36 |   cout << a << endl;
      |   ^~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

import<ios>
int a;main(){scanf("%d",&a);printf("%d",a+a%2*a);}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import<ios>
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | int a;main(){scanf("%d",&a);printf("%d",a+a%2*a);}
      |       ^~~~
a.cc: In function 'int main()':
a.cc:2:26: error: 'a' was not declared in this scope
    2 | int a;main(){scanf("%d",&a);printf("%d",a+a%2*a);}
      |                          ^
a.cc:2:14: error: 'scanf' was not declared in this scope
    2 | int a;main(){scanf("%d",&a);printf("%d",a+a%2*a);}
      |              ^~~~~
a.cc:2:29: error: 'printf' was not declared in this scope
    2 | int a;main(){scanf("%d",&a);printf("%d",a+a%2*a);}
      |                             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | import<ios>
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
 
using namespace std;

int ans(vector<int> v, int b){
  int sum = 0;
  for(int i = 0; i < v.size(); i++){
    sum += abs(v.at(i) - b);
  }
  return sum;
}

int main(){
  int mid;
  int n;
  int t, sum = 0;
  int index, a, b;
  
  vector<int> v;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> t; v.push_back(t - (i + 1));
  }
  sort(v.begin(), v.end());
  index = v.at(v.size() / 2);
  a = ans(v, index);
  for(int i = -vec.size(); i < vec.size(); i++){
    index = v.at(v.size() / 2 + i);
    b = ans(v, index);
    a = a > b ? b : a;
  }
  cout << a << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'vec' was not declared in this scope
   31 |   for(int i = -vec.size(); i < vec.size(); i++){
      |                ^~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
 
using namespace std;

int ans(vector<int> v, int b){
  int sum = 0;
  for(int i = 0; i < v.size(); i++){
    sum += abs(v.at(i) - b);
  }
  return sum;
}

int main(){
  int mid;
  int n;
  int t, sum = 0;
  int index, a, b;
  
  vector<int> v;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> t; v.push_back(t - (i + 1));
  }
  sort(v.begin(), v.end());
  index = v.at(v.size() / 2);
  a = ans(v, index);
  if(v.size() % 2 == 0) {
    index = v.at(v.size() / 2 + 1);
    b = ans(v, index)
    a = a > b ? b : a;
  }
  cout << a << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:22: error: expected ';' before 'a'
   33 |     b = ans(v, index)
      |                      ^
      |                      ;
   34 |     a = a > b ? b : a;
      |     ~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
 
using namespace std;

int ans(vector<int> v, int b){
  int sum = 0;
  for(int i = 0; i < v.size(); i++){
    sum += abs(v.at(i) - b);
  }
  return sum;
}

int main(){
  int mid;
  int n;
  int t, sum = 0;
  int index, a, b;
  
  vector<int> v;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> t; v.push_back(t - (i + 1));
  }
  sort(v.begin(), v.end());
  index = v.at(v.size() / 2);
  a = ans(v, index) 
  if(v.size() % 2 == 0) {
    index = v.at(v.size() / 2 + 1);
    b = ans(v, index)
    a = a > b ? b : a;
  }
  cout << a << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: expected ';' before 'if'
   30 |   a = ans(v, index)
      |                    ^
      |                    ;
   31 |   if(v.size() % 2 == 0) {
      |   ~~
Language: C++

#include<bits/stdc++.h>
int main(){
    int a;
    cin>>a;
    if(a%2==0)cout<<a;
    else cout<<a*2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |     cin>>a;
      |     ^~~
      |     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:5:15: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 |     if(a%2==0)cout<<a;
      |               ^~~~
      |               std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:6:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |     else cout<<a*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 <iostream>
using namespace std;
int main()
{
	long long n,i,minv;
	cin>>n;
	minv=2*n;
	for (i=max(2,n);i<=2*n;i++)
		if (i<minv&&i%n==0&&i%2==0)
			minv=i;
	cout<<minv;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: no matching function for call to 'max(int, long long int&)'
    8 |         for (i=max(2,n);i<=2*n;i++)
      |                ~~~^~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:8:19: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
    8 |         for (i=max(2,n);i<=2*n;i++)
      |                ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<iostream>
using namespace std;

// A
int main(){
    int N;
    cin>>N, ans;
    for (int i=N; i<=1000000000; i++){
        if ((i%N == 0)&&(i%2 == 0)){
            ans = i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |     cin>>N, ans;
      |             ^~~
      |             abs
Language: C++

#include <stdio.h>

int main(){
  int N;
  scanf("%d",&N);
  if (N%2 == 0){
    printf("%d",N);
  }else
    printf("%d",N*2);
  }
  return 0;
}

Compiler output:
a.cc:11:3: error: expected unqualified-id before 'return'
   11 |   return 0;
      |   ^~~~~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^
Language: C

#include <stdio.h>

long long abs(long long);

int main() {
  long long N, temp, A[200000], kouho, sa[3] = {0, 0, 0}, ans;
  long long sum = 0;
  scanf("%lld", &N);
  for (long i = 0; i < N; i++) {
    scanf("%lld", &temp);
    temp -= i　+ 1;
    A[i] = temp;
    sum += temp;
  }
  kouho = sum / N;
  for (long long i = 0; i < N; i++) {
    sa[0] += abs(A[i] - kouho - 1);
  }
  for (long long i = 0; i < N; i++) {
    sa[1] += abs(A[i] - kouho);
  }
  for (long long i = 0; i < N; i++) {
    sa[2] += abs(A[i] - kouho + 1);
  }
  ans = (sa[0] < sa[1]) ? sa[0] : sa[1];
  ans = (ans < sa[2]) ? ans : sa[2];
  printf("%lld", ans);

  return 0;
}

long long abs(long long N) {
  if (N < 0) N *= -1;
  return N;
}

Compiler output:
main.c:3:11: warning: conflicting types for built-in function 'abs'; expected 'int(int)' [-Wbuiltin-declaration-mismatch]
    3 | long long abs(long long);
      |           ^~~
main.c:2:1: note: 'abs' is declared in header '<stdlib.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c: In function 'main':
main.c:11:14: error: stray '\343' in program
   11 |     temp -= i<U+3000>+ 1;
      |              ^~~~~~~~
Language: C

#include <stdio.h>
int main(void){
  int N;
  scanf("%d",&N);
  
  if(N % 2 == 0){
    printf("%d",N);
  }else if(n % 2 == 1){
    printf("%d",N*2);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:12: error: 'n' undeclared (first use in this function)
    8 |   }else if(n % 2 == 1){
      |            ^
main.c:8:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N,g=1,h=0;
  cin>>N;
  for(int i=0;i<N;i++){
  cin>>A[i];
    int s=A[100];
    if(s>h){
      h=s;
    }if(s<g){
      g=s;
    }
  }
    cout<<h-g<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'A' was not declared in this scope
    7 |   cin>>A[i];
      |        ^
Language: C++

#include <iostream>

using namespace std;

int main()
{
    int N;
    int ans;

    cin >> ans;

    if (N % 2 == 0) {
        ans = N;
    }
    else if {
        ans = N * 2;
    }

    cout << ans << andl;

    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: expected '(' before '{' token
   15 |     else if {
      |             ^
      |             (
a.cc:19:20: error: 'andl' was not declared in this scope
   19 |     cout << ans << andl;
      |                    ^~~~
Language: C

#include <iostream>

using namespace std;

int main()
{
    int N;
    int ans;

    cin >> ans;

    if (N % 2 == 0) {
        ans = N;
    }
    else if {
        ans = N * 2;
    }

    cout << ans << andl;

    return (0);
}

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

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

int main() {
	int n, a;
	cin >> n;
	a = n
	while(a % 2 != 0 || a % n != 0){
		a++;
	}
	cout << a << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ';' before 'while'
    7 |         a = n
      |              ^
      |              ;
    8 |         while(a % 2 != 0 || a % n != 0){
      |         ~~~~~
Language: C++

#include "stdafx.h"
#include<iostream>


int main()
{
	unsigned int N;
	unsigned int out;

	std::cin >> N;
	if (N % 2 == 0)out = N;
	else out = N * 2;
	std::cout << out << std::endl;



	return 0;
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
using namespace std;
typedef long long i64;

#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);(i)++)
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);(i)--)
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int main(){
    int N;
    cin>>N;

    if(N % 2 == 1) put(2*N);
    else put(ans);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     else put(ans);
      |              ^~~
a.cc:11:23: note: in definition of macro 'put'
   11 | #define put(n) cout<<(n)<<"\n"
      |                       ^
Language: C++

unsigned int N;
	unsigned int out;

	std::cin >> N;
	if (N % 2 == 0)out = N;
	else out = N * 2;
	std::cout << out << std::endl;

Compiler output:
a.cc:4:14: error: 'cin' in namespace 'std' does not name a type
    4 |         std::cin >> N;
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | unsigned int N;
a.cc:5:9: error: expected unqualified-id before 'if'
    5 |         if (N % 2 == 0)out = N;
      |         ^~
a.cc:6:9: error: expected unqualified-id before 'else'
    6 |         else out = N * 2;
      |         ^~~~
a.cc:7:14: error: 'cout' in namespace 'std' does not name a type
    7 |         std::cout << out << std::endl;
      |              ^~~~
a.cc:7:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 |         std::cout << out << std::endl;
      |         ^~~
Language: Java

import java.util.Scanner;

public class Multiple_of_2_and_N {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner br = new Scanner(System.in);
		int N = br.nextInt();
		for(int i=2;i<=(2*N);i=i+2)
		{
			if(i%N==0)
			{
				System.out.println(i);
				break;
			}
		}
		
	}

}


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

/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read();
	if (n % 2 == 0)
		printf("%d\n", n);
		else printf("%d\n", n * 2); 
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   20 |         n = read();
      |         ^
      |         yn
Language: Java

import java.util.*;

public class NewClass4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n%2==0){
            System.out.println(n);
        }
        else{
            System.out.println(n*2);
        }
    }    
}

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

#include<stdio.h>

int main(void){
  
	int N;
  
	scanf("%d", &N);
  
  if(N % 2 = 0){
    printf("%d", N):
  }
  else{
    printf("%d", N*2);
  }
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:12: error: lvalue required as left operand of assignment
    9 |   if(N % 2 = 0){
      |            ^
main.c:10:20: error: expected ';' before ':' token
   10 |     printf("%d", N):
      |                    ^
      |                    ;
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int num;

	num = 2;

	int n;

	cout << "nを入力\n";

	cin >> n;

	int m;

	if (n % 2)
	{
		int nmin;
		for (n % 2 >= 0;)
		{
			nmin = n / 2;
		}
		m = num * nmin;

	}
	else
	{
		m = num * n;
	}

	cout << "最小の整数値は" << m << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: expected primary-expression before ')' token
   21 |                 for (n % 2 >= 0;)
      |                                 ^
a.cc:21:33: error: expected ';' before ')' token
   21 |                 for (n % 2 >= 0;)
      |                                 ^
      |                                 ;
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int num;

	num = 2;

	int n;

	cout << "nを入力\n";

	cin >> n;

	int m;

	if (n % 2)
	{
		m = num * n;
	}
	else
	{
		int nmin;
		for(n % 2 = 0;)
		{
			nmin = n / 2;
		}
		m = num * nmin;
	}

	cout << "最小の整数値は" << m << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: lvalue required as left operand of assignment
   25 |                 for(n % 2 = 0;)
      |                     ~~^~~
a.cc:25:31: error: expected primary-expression before ')' token
   25 |                 for(n % 2 = 0;)
      |                               ^
a.cc:25:31: error: expected ';' before ')' token
   25 |                 for(n % 2 = 0;)
      |                               ^
      |                               ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;
	scanf("%lld",&a);
	if(a%2==0)
	{
		printf("%lld",a)
	}
	else
	{
		printf("%lld",a*2)
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:33: error: expected ';' before '}' token
    9 |                 printf("%lld",a)
      |                                 ^
      |                                 ;
   10 |         }
      |         ~                        
a.cc:13:35: error: expected ';' before '}' token
   13 |                 printf("%lld",a*2)
      |                                   ^
      |                                   ;
   14 |         }
      |         ~
Language: C++

#include<iostream>

using namespace std;

int main()
{
    int N;

    cin >> N;

    if((N % 2) != 0))
    {
        cout << N *2 << endl; 
    }
    else 
    {
        cout << N << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected primary-expression before ')' token
   11 |     if((N % 2) != 0))
      |                     ^
Language: C++

#include<algorithm>

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	long long N;
	cin >> N;

	if (N % 2 == 0)
		cout << N << endl;
	else
		cout << N * 2 << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin.tie(0);
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | 
a.cc:7:9: error: 'ios' has not been declared
    7 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:14:17: error: 'cout' was not declared in this scope
   14 |                 cout << N << endl;
      |                 ^~~~
a.cc:14:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:30: error: 'endl' was not declared in this scope
   14 |                 cout << N << endl;
      |                              ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 | 
a.cc:16:17: error: 'cout' was not declared in this scope
   16 |                 cout << N * 2 << endl;
      |                 ^~~~
a.cc:16:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:34: error: 'endl' was not declared in this scope
   16 |                 cout << N * 2 << endl;
      |                                  ^~~~
a.cc:16:34: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<iostream>

usin namespace std;

int main()
{
    int N;

    cin >> N;

    if((N % 2) != 0))
    {
        cout << N *2 << endl; 
    }
    else 
    {
        cout << N << endl;
    }
}

Compiler output:
a.cc:3:1: error: 'usin' does not name a type
    3 | usin namespace std;
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |     cin >> N;
      |     ^~~
      |     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:11:21: error: expected primary-expression before ')' token
   11 |     if((N % 2) != 0))
      |                     ^
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |         cout << N << 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:17:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |         cout << N << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream> 
#include<cstdio>
#include<cmath>
using namespace std; 
void main() 
{ 
	int m,n=2,r,t; 
	//cout<<"请输入两个值，求最小公倍数"<<endl; 
	//cin>>m>>n; 
	scanf("%d",&m);
	int a = m;  //先把m、n保存一份 
	int b = n; 
	if(m<n) 
	{ 
		t=m;  //用分号 
		m=n;  //用分号 
		n=t; 
	} 
	while((r=m%n)!=0) 
	{ 
		m=n; 
		n=r; 
	} 
	//cout<<"最大公约数="<< n << endl; 
	//最后这样打印 
	printf("%d\n",a * b / n )
}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:34: error: expected ';' before '}' token
   26 |         printf("%d\n",a * b / n )
      |                                  ^
      |                                  ;
   27 | }
      | ~
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main(){
  int input;
  int two = 2;
  int i;
  cin >> input;
  for(i = 2; ; i += 2 {
    if(i % input == 0 ) break;
  }
  cout << i << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: expected ')' before '{' token
   11 |   for(i = 2; ; i += 2 {
      |      ~               ^~
      |                      )
Language: C

#include<stdio.h>
int main(void)
{
  int N;
  scanf("%d",&N);
  int b=2;
  int r;
  int x=N*b;
  if(N<b){
    tmp=N;
    N=b;
    b=tmp;
  }
  r=N%b;
  while(r!=0)
  {
    N=b;
    b=r;
    r=N%b;
  }
  printf("%d",x/b);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'tmp' undeclared (first use in this function)
   10 |     tmp=N;
      |     ^~~
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

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

#include<stdio.h>
int main(void)
{
  int N;
  scanf("%d",&N);//degは10倍
  int b=2;
  int x=N*b;
  if(N<b){
    tmp=N;
    N=b;
    b=tmp;
  }
  r=N%b;
  while(r!=0)
  {
    N=b;
    b=r;
    r=N%b;
  }
  printf("%d",x/b);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:5: error: 'tmp' undeclared (first use in this function)
    9 |     tmp=N;
      |     ^~~
main.c:9:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:3: error: 'r' undeclared (first use in this function)
   13 |   r=N%b;
      |   ^
Language: C++

#include <stdio.h>

int main(void){
  int n;

  scanf("%d",&n);
  if(n%2==1){
    printf("%d"2*n);
  }else{
    printf("%d",n);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: expected ')' before numeric constant
    8 |     printf("%d"2*n);
      |           ~    ^
      |                )
Language: C++

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

int main()
{
	int x;
	int answer = 1;
	scanf_s("%d", &x);

		if (x % 2 == 0)
		{
			answer = x;
			goto exit;
		}
		else
		{
			answer = 2 * x;
		}
exit:
	printf("%d", answer);


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    8 |         scanf_s("%d", &x);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
using namespace std;
int main()
{
	int N;
        cin >> N;
	if (N%2=0){
	cout << N << '\n';
}
else
cout << N*2 << '\n';


}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: lvalue required as left operand of assignment
    7 |         if (N%2=0){
      |             ~^~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  int N;
  cin >> N;
  if(N%2==0){
    cou << N << endl;
    return 0;
  }
  else{
    cout << 2*N << endl;
  }
  return 0;
}

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

#include <vector>
#include <string>
using namespace std;
 
int main(){
  int input;
  int two = 2;
  int tmp;
  int r;
  int x;
  cin >> input;
  x = input * 2;
  if(input < two){
    tmp = input;
    input = two;
    two = input;
  }
  r = input % two;
  while(r!=0){
    input = two;
    two = r;
    r = input % two;
  }
  cout << x / two << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> input;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <string>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << x / two << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:22: error: 'endl' was not declared in this scope
   24 |   cout << x / two << endl;
      |                      ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <string>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include <iostream>
using namespace std; 

int koubai(int,int);
int kouyaku(int, int);

int main(void){
	long int n;
	int m = 2;

	cin >> n;
	cout << koubai(m,n);

	return 0;
}

int koubai(x,y){
	return(x * y / kouyaku(x,y));
}

int kouyaku(x,y){
	int z;

	while((z = x % y) != 0){
		x = y;
		y = z;
	}
	
	return y;
}

Compiler output:
a.cc:17:12: error: 'int koubai' redeclared as different kind of entity
   17 | int koubai(x,y){
      |            ^
a.cc:4:5: note: previous declaration 'int koubai(int, int)'
    4 | int koubai(int,int);
      |     ^~~~~~
a.cc:17:12: error: 'x' was not declared in this scope
   17 | int koubai(x,y){
      |            ^
a.cc:17:14: error: 'y' was not declared in this scope
   17 | int koubai(x,y){
      |              ^
a.cc:21:13: error: 'int kouyaku' redeclared as different kind of entity
   21 | int kouyaku(x,y){
      |             ^
a.cc:5:5: note: previous declaration 'int kouyaku(int, int)'
    5 | int kouyaku(int, int);
      |     ^~~~~~~
a.cc:21:13: error: 'x' was not declared in this scope
   21 | int kouyaku(x,y){
      |             ^
a.cc:21:15: error: 'y' was not declared in this scope
   21 | int kouyaku(x,y){
      |               ^
Language: C++

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>

int main()
{
    int n,;
    scanf("%d",&n);
    if (n%2==0) printf("%d\n",n);
    else printf("%d\n",n*2);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: expected unqualified-id before ';' token
   10 |     int n,;
      |           ^
Language: C

#include<stdio.h>
int main(){
int N;
int i;
int a;
scan("%d",&N);

do{
N%2!=a
if(a!=0){
i = 0;
}
else{
print("%d",N);
}

}while(i==0);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:1: error: implicit declaration of function 'scan'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    6 | scan("%d",&N);
      | ^~~~
      | scanf
main.c:9:7: error: expected ';' before 'if'
    9 | N%2!=a
      |       ^
      |       ;
   10 | if(a!=0){
      | ~~
Language: C

#include <stdio.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  if (N % 2 == 0) {
    printf("%d", N);
  } else {
    N *= 2
    printf("%d", N);
  }
}

Compiler output:
main.c: In function 'main':
main.c:10:11: error: expected ';' before 'printf'
   10 |     N *= 2
      |           ^
      |           ;
   11 |     printf("%d", N);
      |     ~~~~~~
Language: C

#include <stdio.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  if (N % 2 == 0) {
    printf("%d", N);
  } else if {
    N *= 2
    printf("%d", N);
  }
}


Compiler output:
main.c: In function 'main':
main.c:9:13: error: expected '(' before '{' token
    9 |   } else if {
      |             ^
      |             (
Language: C++


#include <bits/stdc++.h>

using namespace std;
int main()
{
    long long int n;
    
    cin>>n;
    
    if(i%2==0){

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'i' was not declared in this scope
   11 |     if(i%2==0){
      |        ^
a.cc:14:2: error: expected '}' at end of input
   14 | }
      |  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

いっけな～い！遅刻遅刻！

Compiler output:
a.cc:1:1: error: '\U00003044\U00003063\U00003051\U0000306a\U0000ff5e\U00003044\U0000ff01\U00009045\U0000523b\U00009045\U0000523b\U0000ff01' does not name a type
    1 | いっけな～い！遅刻遅刻！
      | ^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: expected '(' before '{' token
    8 |     }else if {
      |              ^
      |              (
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  cout << a.at(n - 1) - a.at(0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'vec' was not declared in this scope
   13 |   sort(vec.begin(), vec.end());
      |        ^~~
Language: C++


#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;

int main()
{
	int N;
	cin >> N;
	if (N % 2 == 1) {
		cout << N*2 << endl;
	}
	else {
		cout << N << endl;
	}
    return 0;
}



Compiler output:
a.cc:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import Java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		long result;
		if (n % 2 == 0) {
			result = n;
		} else {
			result = n * 2;
		}
		System.out.println(result);
	}
}

Compiler output:
Main.java:1: error: package Java.util does not exist
import Java.util.*;
^
Main.java:5: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
3 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;
public class Question102 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];

		for(int i=0; i<N; i++) {
			A[i] = sc.nextInt();
		}Arrays.sort(A);

		System.out.println(A[N-1]-A[0]);

	}

}


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

#include<stdio.h>

int main(void) {
	long int n;
	scanf_s("%d", &n);
	if (n % 2 == 0) printf("%d", n);
	else printf("%d", 2 * n);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstdio> 
using namespace std;
int main(){

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: expected '}' at end of input
   13 | int main(){
      |           ~^
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define INF 10000000
const int maxn = 2e5+ 5;

int n;
int a[110];
int main()
{
    ios::sync_with_stdio(false),cin.tie(0);
    cin>>n;
    for(int i=n;i+=n)
    if(i%2==0)
    {
        cout<<i;
        exit(0);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before ')' token
   13 |     for(int i=n;i+=n)
      |                     ^
      |                     ;
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int result;
		if (n % 2 == 0) {
			result = n;
		} else {
			result = n * 2;
		}
		System.out.println(result);
	}
}

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

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

int main(){
	cin >> n;
	if( n%2  == 0 )
		cout << n << endl;
	else
		cout << 2*n << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         cin >> n;
      |                ^
      |                yn
Language: C++

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

int main(){
	
	int N;
	
	cin >> N;
	
	if(N%2==0) then cout<<N<<endl;
	else cout << 2*N << endl;
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'then' was not declared in this scope
   12 |         if(N%2==0) then cout<<N<<endl;
      |                    ^~~~
Language: C++

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

int main(){
  int n;
  cin>>n;
  if(n%2==0){
    cout<<n<<endl;
    }
  }
  else{
    cout<<n*2<<endl;
  }
}

Compiler output:
a.cc:12:3: error: expected unqualified-id before 'else'
   12 |   else{
      |   ^~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;


int main(){
    int N;
    cin >> N;0
    if (N % 2 == 0){
        cout << N << endl;
    } else {
        cout << N * 2 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: expected ';' before 'if'
   22 |     cin >> N;0
      |               ^
      |               ;
   23 |     if (N % 2 == 0){
      |     ~~         
a.cc:25:7: error: 'else' without a previous 'if'
   25 |     } else {
      |       ^~~~
Language: C

#include <stdio.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  if (N % 2 == 0) {
    printf("%d", N);
  } else if {
    N *= 2
    printf("%d", N)
  }
}


Compiler output:
main.c: In function 'main':
main.c:9:13: error: expected '(' before '{' token
    9 |   } else if {
      |             ^
      |             (