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

#include <bits/stdc++.h>
#include <cmath>  
using namespace std;
int main(){
int N;
int answer;

flaot min=0;
cin>>N;
float sum=0;
vector<int> vec(500);
vector<float>vec2(500);
for(i=0;i<N;i++){
cin >>  vec.at(i);
sum=sum+vec.at(i);
}
sum=sum/N;
for(i=0;i<N;i++){
vec2.at(i)=abs(vec.at(i)-sum);
}
for(i=0;i<N;i++){
if(min<vec2.at(i)){
min=vec2.at(i);
}
}
for(i=0;i<N;i++){
if(min==vec2.at(i)){
answer = i;
min=min-1;
}
}
cout << answer;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'flaot' was not declared in this scope; did you mean 'float'?
    8 | flaot min=0;
      | ^~~~~
      | float
a.cc:13:5: error: 'i' was not declared in this scope
   13 | for(i=0;i<N;i++){
      |     ^
a.cc:18:5: error: 'i' was not declared in this scope
   18 | for(i=0;i<N;i++){
      |     ^
a.cc:21:5: error: 'i' was not declared in this scope
   21 | for(i=0;i<N;i++){
      |     ^
a.cc:22:4: error: parse error in template argument list
   22 | if(min<vec2.at(i)){
      |    ^~~~~~~~~~~~~~
a.cc:22:18: error: cannot resolve overloaded function 'min' based on conversion to type 'bool'
   22 | if(min<vec2.at(i)){
      |                  ^
a.cc:26:5: error: 'i' was not declared in this scope
   26 | for(i=0;i<N;i++){
      |     ^
a.cc:29:8: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   29 | min=min-1;
      |     ~~~^~
Language: C

#include <stdio.h>
#include <math.h>
int main()
{
  int N,a[],ans,i;
  double s;
  scanf("%d",&N);
  for (i = 0; i < N; i++) {
    scanf("%d",&a[i]);
  }
  for ( i = 0; i < N; i++) {
    s += a[i];
  }
  s = s/N;
  ans = 0;
    for (i = 0; i < N; i++) {
      if(fabs(ans - s) > fabs(a[i] - s))
      { ans = i;}
  }printf("%d\n",ans);
}


Compiler output:
main.c: In function 'main':
main.c:5:9: error: array size missing in 'a'
    5 |   int N,a[],ans,i;
      |         ^
Language: C++

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

int main(void){
	int n;
	int a[100];	
	int i;
	int ret;

	double min,ave;

	scanf("%d",&n);

	ave = 0;

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

	ave /= n;
	min = 100;
	ret = 0;
	for(i=0;i<n;i++){
		if(min>abs(a[i]-ave)){
			min = abs(a[i]*100-int(ave*100.0)/100.0;
			ret = i;
		}
	}

	if(n==1){
		printf("0\n");
	}
	else{
		printf("%d\n",ret);
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:64: error: expected ')' before ';' token
   28 |                         min = abs(a[i]*100-int(ave*100.0)/100.0;
      |                                  ~                             ^
      |                                                                )
Language: C++

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

int main() {
  float n;cin>>n;
  vector<int> a(n),b(n);
  int l,r;
  float sum=0.0;
  for(int i=0;i<n;++i)cin>>a[i],b[i]=a[i],sum+=a[i];
  float ave=sum/n;

  sort(a.begin(),a.end());
  int temp_ans=0,Temp_ans=101,ans=105;
  //cout<<ave<<endl;
  for(int i=0;i<n;++i){
    if(ave<a[i]){
      l=abs(ave-a[i-1]);
      r=abs(ave-a[i]);
      if(l<r)temp_ans=a[i-1];
      else if(l>r)temp_ans=a[i];
      else temp_ans=a[i],Temp_ans=a[i-1];

      for(int i=0;i<n;++i){
        if(temp_ans==b[i] || Temp_ans==b[i])ans=min(ans,i);
      }

    }
  }
  for(int i=0;i<n;++i){
  	if(temp_ans==b[i] || Temp_ans==b[i])ans=min(ans,i);
  }
  //cout<<temp_ans<<" "<<Temp_ans<<endl;
  //cout<<l<<" "<<r<<endl;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   14 |   sort(a.begin(),a.end());
      |   ^~~~
      |   sqrt
Language: C

#include <stdio.h>
#include <math.h>
int main()
{
  int N,a[],ans,i;
  double s;
  scanf("%d",&N);
  for (i = 0; i < N; i++) {
    scanf("%d",&a[i]);
  }
  for ( i = 0; i < N; i++) {
    s += a[i];
  }
  s = s/N;
  ans = 0;
  if{
    for (i = 0; i < N; i++) {
      if(fabs(ans - s) > fabs(a[i] - s))
      { ans = i;}
  }printf("%d\n",ans);
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: array size missing in 'a'
    5 |   int N,a[],ans,i;
      |         ^
main.c:16:5: error: expected '(' before '{' token
   16 |   if{
      |     ^
      |     (
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
Language: C

#include <stdio.h>
#include <math.h>
int main()
{
  int N,a[],ans;
  double s;
  scanf("%d",&N);
  for (i = 0; i < N; i++) {
    scanf("%d",&a);
  }
  for ( i = 0; i < N; i++) {
    s += a[i];
  }
  s = s/N;
  ans = 0;
  if{
    for (i = 0; i < N; i++) {
      if(fabs(ans - s) > fabs(a[i] - s))
      { ans = i;}
  }printf("%d\n",ans);
}


Compiler output:
main.c: In function 'main':
main.c:5:9: error: array size missing in 'a'
    5 |   int N,a[],ans;
      |         ^
main.c:8:8: error: 'i' undeclared (first use in this function)
    8 |   for (i = 0; i < N; i++) {
      |        ^
main.c:8:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:5: error: expected '(' before '{' token
   16 |   if{
      |     ^
      |     (
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
Language: C

#include <stdio.h>
#include <fabs.h>
int main()
{
  int N,a[],ans;
  double s;
  scanf("%d",&N);
  for (i = 0; i < N; i++) {
    scanf("%d",&a);
  }
  for ( i = 0; i < N; i++) {
    s += a[i];
  }
  s = s/N;
  ans = 0;
  if{
    for (i = 0; i < N; i++) {
      if(fabs(ans - s) > fabs(a[i] - s))
      { ans = i;}
  }printf("%d\n",ans);
}

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

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

int main(){
    int n;
    cin >> n;
    int a[n];

    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }

    double ave = 1. * sum / n;

    int min_index = n;
    double distance_min = 1 << 10;
    for(int i = n-1; i >= 0; i--){
        if(abs((long)ave-a[i]) <= distance_min){
            distance_min = abs((long)ave-a[i]);
            min_index = i;
        }
    }

    cout << min_index << endl;

    return 0;
}


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

#include <stdio.h>
#include <fabs.c>
int main()
{
  int N,a[],ans;
  double s;
  scanf("%d",&N);
  for (i = 0; i < N; i++) {
    scanf("%d",&a);
  }
  for ( i = 0; i < N; i++) {
    s += a[i];
  }
  s = s/N;
  ans = 0;
  if{
    for (i = 0; i < N; i++) {
      if(fabs(ans - s) > fabs(a[i] - s))
      { ans = i;}
  }printf("%d\n",ans);
}

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

#include<iostream> 
#include<string> 
#include<vector>  
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}
	int he = 0;
	double hei = 0;
	for (int i = 0; i < n; i++)
	{
		he += a.at(i);
	}
	hei = he / n;
	double x = 101;
	int ans = 0;
	for (int i = 0; i <n; i++)
	{
		if (fabs(a.at(i) - hei)<x)
		{
			x = fabs(a.at(i) - hei);
			ans = i;
		}

	}
	cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   26 |                 if (fabs(a.at(i) - hei)<x)
      |                     ^~~~
      |                     labs
Language: C++

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

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

const int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	double ave = (double)sum / n;

	rep(i, n) {
		a[i] = fabs(ave - a[i]);
	}

	int mi = (int)1e9;
	int num = (int)1e9;

	rep(i, n) {
		if (mi >= a[i]) {
			if (mi == a[i]) {
				if (num > i) num = i;
			}
			else {
				num = i;
			}
			mi = a[i];
		}
	}

	cout << num << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   23 |                 a[i] = fabs(ave - a[i]);
      |                        ^~~~
      |                        labs
Language: Java


import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        FastScanner sc = new FastScanner();

        int n = sc.nextInt();
        int[] a = new int[n];
        int[] array = new int[n];
        int add = 0;
        double ave = 0;

        for(int i = 0;i < n;i++){

            a[i] = sc.nextInt();
            array[i] = a[i];

            add += a[i];

        }
        

        ave = (double)add / n;
        int index = 0;
        double sub=100;
//        System.out.println(ave);
        for(int i = 0;i < n;i++){
            if(Math.abs(ave - a[i]) < sub){
                index = i;
                sub = Math.abs(ave - a[i]);
            }
        }

        System.out.println(index);






    }
}


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

#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>

using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<auto> v(n);
	int sum = 0;
	for(int i=0;i<n;i++){
		cin >> v[i];
		sum += v[i];
	}
	auto ave = sum / n;
	for(int i=0;i<n;i++){
		v[i] -= (auto)ave;
	}
	auto iter = min_element(v.begin(), v.end());
	cout << distance(v.begin(), iter) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: template argument 1 is invalid
   14 |         vector<auto> v(n);
      |                    ^
a.cc:14:20: error: template argument 2 is invalid
a.cc:17:25: error: invalid types 'int[int]' for array subscript
   17 |                 cin >> v[i];
      |                         ^
a.cc:18:25: error: invalid types 'int[int]' for array subscript
   18 |                 sum += v[i];
      |                         ^
a.cc:22:18: error: invalid types 'int[int]' for array subscript
   22 |                 v[i] -= (auto)ave;
      |                  ^
a.cc:22:26: error: expected primary-expression before 'auto'
   22 |                 v[i] -= (auto)ave;
      |                          ^~~~
a.cc:22:26: error: expected ')' before 'auto'
   22 |                 v[i] -= (auto)ave;
      |                         ~^~~~
      |                          )
a.cc:24:35: error: request for member 'begin' in 'v', which is of non-class type 'int'
   24 |         auto iter = min_element(v.begin(), v.end());
      |                                   ^~~~~
a.cc:24:46: error: request for member 'end' in 'v', which is of non-class type 'int'
   24 |         auto iter = min_element(v.begin(), v.end());
      |                                              ^~~
a.cc:25:28: error: request for member 'begin' in 'v', which is of non-class type 'int'
   25 |         cout << distance(v.begin(), iter) << endl;
      |                            ^~~~~
Language: C++

#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#define rep(i,N) for(int i=0;i<((int)N);i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int main(void){
    int N;
    cin>>N;
    double num=N;
    double a[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    double sum=0;
    for(int i=0;i<N;i++){
      sum+=a[i]; 
    }
    sum=sum/num;
    double min=10000000; double ans=0;
    for(int i=0;i<N;i++){
      if(a[i]>sum) {gap=a[i]-sum ;}
      else {gap=sum-a[i];}
      if(gap<min){ min=gap; ans=i;}
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: 'gap' was not declared in this scope
   25 |       if(a[i]>sum) {gap=a[i]-sum ;}
      |                     ^~~
a.cc:26:13: error: 'gap' was not declared in this scope
   26 |       else {gap=sum-a[i];}
      |             ^~~
a.cc:27:10: error: 'gap' was not declared in this scope
   27 |       if(gap<min){ min=gap; ans=i;}
      |          ^~~
Language: C++

n = int(input())
p = input()
o = p.split()
k = []
for i in range(n):
    k.append(int(o[i]))
a = sum(k)/n
l = 99999
m = None
for i in range(n):
    w = k[i]
    if (abs(w - a) < l):
        m = i
        l = abs(w - a)
print(m)

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

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>

using namespace std;
double a[111];
int main()
{
	int n;
	double sum = 0,mins=999999999;
	int wz=-1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		
		scanf("%lf", &a[i]);
		sum += a[i];
	}
	sum /= n;
	for (int i = 0; i < n; i++)
	{
		if (fabs(sum - a[i]) < mins)
		{
			mins = fabs(sum - a[i]);
			wz = i;
		}
	}
	printf("%d", wz);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   34 |                 if (fabs(sum - a[i]) < mins)
      |                     ^~~~
      |                     labs
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <math.h>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


int gcd(int a, int b) {
	if(a < b) swap(a, b);
	while (b != 0)
		a %= b, swap(a, b);
	return a;
}

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	double sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<float, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:33: error: 'MP' was not declared in this scope
   90 |         REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));
      |                                 ^~
Language: C++

int main()
{
	int N=0;
	int a[100];
	double ave;
	double sa=100000;
	int minnumber;
	scanf("%d",&N);
	for (int i=0;i<N;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i=0;i<N;i++)
	{
		ave+=a[i];
	}
	ave/=(N+1.0);
	for (int i=0;i<N;i++)
	{
		if(sa<a[i]-ave)
		{
			sa=a[i]-ave;
			minnumber=i;
		}
	}
	printf("%d",minnumber);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf' was not declared in this scope
    8 |         scanf("%d",&N);
      |         ^~~~~
a.cc:26:9: error: 'printf' was not declared in this scope
   26 |         printf("%d",minnumber);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main()
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <math.h>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


int gcd(int a, int b) {
	if(a < b) swap(a, b);
	while (b != 0)
		a %= b, swap(a, b);
	return a;
}

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	float sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<float, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:33: error: 'MP' was not declared in this scope
   90 |         REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));
      |                                 ^~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void){
	int n;
	vector<int> v(n);
	cin >> n;
	int sum = 0;
	for(int i=0;i<n;i++){
		cin >> v[i];
		sum += v[i];
	}
	int ave = sum / n;
	for(int i=0;i<n;i++){
		v[i] -= ave;
	}
	auto iter = min_element(v.begin(), v.end());
	cout << distance(v.begin(), iter) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: 'min_element' was not declared in this scope
   19 |         auto iter = min_element(v.begin(), v.end());
      |                     ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>

#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


int gcd(int a, int b) {
	if(a < b) swap(a, b);
	while (b != 0)
		a %= b, swap(a, b);
	return a;
}

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	float sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<float, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:36: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   90 |         REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));
      |                                    ^~~~
      |                                    labs
a.cc:90:33: error: 'MP' was not declared in this scope
   90 |         REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));
      |                                 ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>

#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


int gcd(int a, int b) {
	if(a < b) swap(a, b);
	while (b != 0)
		a %= b, swap(a, b);
	return a;
}

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	float sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<float, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,MP( abs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:33: error: 'MP' was not declared in this scope
   90 |         REP(i, n) Min = min(Min,MP( abs(sum - a[i]), i ));
      |                                 ^~
Language: C++

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

int main(void){

  int n;
  std::vector<int> a;
  std::cin >> n;
  for(int i=0; i<n; i++){
    int temp;
    std::cin >> temp;
    a.push_back(temp);
  }

  double average = std::accumulate(a.begin(), a.end(), 0.0) / a.size();

  std::vector<double> diff;
  for(int i=0; i<n; i++){
    diff.push_back(std::fabs(average-a[i]));
  }

  double smallest = diff[0];
  int idx = 0;
  for(int i=1; i<n; i++){
    if(smallest>diff[i]){
      smallest = diff[i];
      idx = i;
    }
  }
  std::cout << idx << std::endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: 'fabs' is not a member of 'std'; did you mean 'labs'?
   21 |     diff.push_back(std::fabs(average-a[i]));
      |                         ^~~~
      |                         labs
Language: C++

#include<iostream>
#include<string>
using namespace std;
int n;
double a[105];
int main()
{
	cin >> n;
	double sum = 0;
	for (int i = 0; i < n; i++)cin >> a[i],sum+=a[i];
	sum =sum/(1.0* n);
	int ans = 0,min=1000000.0;
	for (int i = 0; i < n; i++)
	{
		if (fabs(a[i] - sum) < min)min = abs(a[i] - sum), ans = i;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   15 |                 if (fabs(a[i] - sum) < min)min = abs(a[i] - sum), ans = i;
      |                     ^~~~
      |                     labs
Language: Java

import java.util.*;

public class MyClass {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), sum = 0;
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
            sum += arr[i];
        }
        
        double avg = (double)sum / n, minDiff = Double.MAX_VALUE;
        int minIndex = 0;
        for (int i = 0; i < n; i++) {
            double diff = Math.abs(avg - arr[i]);
            if (diff < minDiff - 1e-4) {
                minDiff = diff;
                minIndex = i;
            }
        }
        
        System.out.println(minIndex);
    }
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt;
  double c=0,d=1000000;
  cin>>n;
  double a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    c+=a[i];
  }
  c/=n;
  for(int i=0;i<n;i++){
    if(d>abs(c-a[i]){
      d=abs(c-a[i]);
      cnt=i;
    }
  }
  cout<<cnt;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: expected ')' before '{' token
   14 |     if(d>abs(c-a[i]){
      |       ~             ^
      |                     )
a.cc:18:3: error: expected primary-expression before '}' token
   18 |   }
      |   ^
Language: C++

N=int(input())
a=list(map(int,input().split()))
sum=0
for i in range(N):
    sum+=a[i]
ave=sum/N
ans=-1
min=100
for i in range(N):
    if min > abs(a[i]-ave):
        ans=i
        min=abs(a[i]-ave)
print(str(ans))

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


      df = abs(a[i] - avg);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:2:7: error: 'df' does not name a type
    2 |       df = abs(a[i] - avg);
      |       ^~
a.cc:3:7: error: 'ans' does not name a type
    3 |       ans = i;
      |       ^~~
a.cc:4:5: error: expected declaration before '}' token
    4 |     }
      |     ^
a.cc:5:3: error: expected declaration before '}' token
    5 |   }
      |   ^
a.cc:6:3: error: 'cout' does not name a type
    6 |   cout << ans << endl;
      |   ^~~~
a.cc:7:3: error: expected unqualified-id before 'return'
    7 |   return 0;
      |   ^~~~~~
a.cc:8:1: error: expected declaration before '}' token
    8 | }
      | ^
Language: Java

public class Main {
    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<a.length; i++) {
        	a[i] = sc.nextInt();
        }
        sc.close();
        int sum = 0;
        for(int i=0; i<a.length; i++) {
        	sum += a[i];
        }   
        double ave = (double)sum/N;
        double minGap = Math.abs(ave-a[0]);
        int minIndex = 0;
        for(int i=0; i<a.length; i++) {
        	if (minGap > Math.abs(ave-a[i])) {
        		minGap = Math.abs(ave-a[i]);
        		minIndex = i;
        	}
        } 
        System.out.println(minIndex);
    }
}

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;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n;
	int a[100];
	double ave = 0.0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ave += a[i];
	}
	ave /= 1.0 * n;
	int index = -1;
	double dis = inf*1.0;
	for(int i = 0; i < n; i++){
		if(abs(ave - a[i]) < dis){
			dis = abs(ave - a[i]);
			index = i;
		}
	}

	cout << index << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:14: error: invalid operands of types 'int' and 'double' to binary 'operator<<'
    5 | #define inf 1<<30
      |             ~^~
      |             |
      |             int
a.cc:40:22: note: in expansion of macro 'inf'
   40 |         double dis = inf*1.0;
      |                      ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

  int sum;
  vector<int> a(n);

  for(int i = 0;i < n;i++){
    cin >> a[i];
    sum += a[i];
  }

  int ret = 0;
  int min = 10000;

  for(int i = 0;i < n;i++){
    double dif = abs((double)a[i] - (double)sum/n) ;
    if(dif < min){
      min = dif;
      ret = i;
    }
  }

  cout << ret << endl;

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

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

int main() {
  int n;
  cin >> n;
  vector<double> as(n);
  for (auto &a : as) {
    cin >> a;
  }
  double sum = accumulate(as.begin(), as.end()), ave = sum / n;
  int ans = -1;
  double diff = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    if (abs(as[i] - ave) < diff) {
      diff = abs(as[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: no matching function for call to 'accumulate(std::vector<double>::iterator, std::vector<double>::iterator)'
   11 |   double sum = accumulate(as.begin(), as.end()), ave = sum / n;
      |                ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
a.cc:15:21: error: 'ave' was not declared in this scope
   15 |     if (abs(as[i] - ave) < diff) {
      |                     ^~~
Language: C++

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

int maxketa(int n){
  int ret = 1;
  while(n >= ret){
    ret *= 2;
  }
  return ret/2;
}

int main(){
  int maxand = 0;
  
  int N,K;
  cin >> N >> K;
  
  vector<int> num(N);
  for(int i = 0; i < N; ++i){
    cin >> num[i];
  }
  
  vector<int> sum_of_num(N+1);
  sum_of_num[0] = 0;
  for(int i = 1; i < N+1; ++i){
    sum_of_num[i] = sum_of_num[i-1] + num[i-1];
  }
  
  int N_c = N*(N+1)/2
  vector<int> beautiful(N_c);
  int k = 0;
  for(int i = 0; i < N; ++i){
    for(int j = i+1; j < N+1; ++j){
      beautiful[k] = sum_of_num[j]-sum_of_num[i];
    }
  }
  sort(beautiful.begin(),beautiful.end());
  
  int mk = maxketa(beautiful[N_c-1]);
  int new_element
  while(mk > 0){
    if(beautiful[N_c-4] >= mk){
      maxand = beautiful[N_c-1]&beautiful[N_c-2]&beautiful[N_c-3]&beautiful[N_c-4];
      break;
    }
    while(beautiful[N_c-1] >= mk){
      new_element = beautiful[N_c-1]-mk;
      beautiful.insert(std::lower_bound(beautiful.begin(), beautiful.end(), new_element), new_element);
      beautiful.pop_back();
    }
    mk = maxketa(beautiful[N_c-1])
  }
  
  
  cout << maxand << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected ',' or ';' before 'vector'
   30 |   vector<int> beautiful(N_c);
      |   ^~~~~~
a.cc:34:7: error: 'beautiful' was not declared in this scope
   34 |       beautiful[k] = sum_of_num[j]-sum_of_num[i];
      |       ^~~~~~~~~
a.cc:37:8: error: 'beautiful' was not declared in this scope
   37 |   sort(beautiful.begin(),beautiful.end());
      |        ^~~~~~~~~
a.cc:41:3: error: expected initializer before 'while'
   41 |   while(mk > 0){
      |   ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n+1,0);
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)a[i]+=a[i-1];
    vector<int> v;
    for(int i=0;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            v.push_back(a[j]-a[i]);
        }
    }
    int res=0;
    for(int bit=60;bit>=0;bit--){
        int cnt=0;
        int now=(1ll<<bit);
        for(auto it:v){
            if(it&now)cnt++;
        }
        if(cnt>=k){
            //cout<<bit<<endl;
            res+=now
            vector<int> vv;
            for(auto it:v){
                if(it&now)vv.push_back(it);
            }
            v=vv;
        }
    }
    cout<<res<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: expected ';' before 'vector'
   27 |             res+=now
      |                     ^
      |                     ;
   28 |             vector<int> vv;
      |             ~~~~~~   
a.cc:30:27: error: 'vv' was not declared in this scope; did you mean 'v'?
   30 |                 if(it&now)vv.push_back(it);
      |                           ^~
      |                           v
a.cc:32:15: error: 'vv' was not declared in this scope; did you mean 'v'?
   32 |             v=vv;
      |               ^~
      |               v
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n)cin>>a[i];
	vector<ll> sum((n*(n+1))/2);
	ll count = 0;
	rep(i,n){
		ll now = a[i];
		sum[count++] = now;
		For(j,i+1,n){
			now+=a[j];
			sum[count++]=now;
		}
	}
	sort(sum.rbegin(),sum.rend());
	// 2^50を超えるものから順に見ていく。最大でも10^12 
	ll ans = 0;
	for(ll i = 60; i >= 0; i--){
		vector<ll> now(0);
		int cnt = 0;
		rep(j,sum.size()){
			if((sum[j]&(1ll << i))){
				cnt ++;
				now.push_back(sum[j]);
			}
		}
		if(cnt >= k) {
			ans += (1ll << j);
			sum = now;
		}
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:40: error: 'j' was not declared in this scope
   44 |                         ans += (1ll << j);
      |                                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n)cin>>a[i];
	vector<ll> sum((n*(n+1))/2);
	ll count = 0;
	rep(i,n){
		ll now = a[i];
		sum[count++] = now;
		For(j,i+1,n){
			now+=a[j];
			sum[count++]=now;
		}
	}
	sort(sum.rbegin(),sum.rend());
	// 2^50を超えるものから順に見ていく。最大でも10^12 
	ll ans = 0;
	for(ll i = 60; i >= 0; i--){
		vector<ll> now(0);
		int cnt = 0;
		rep(j,sum.size()){
			if((sum[j]&(1ll << i))){
				cnt ++;
				now.push_back(sum[j]);
			}
		}
		if(cnt >= k) {
			ans += (1ll << j);
			v2 = temp;
		}
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:40: error: 'j' was not declared in this scope
   44 |                         ans += (1ll << j);
      |                                        ^
a.cc:45:25: error: 'v2' was not declared in this scope
   45 |                         v2 = temp;
      |                         ^~
a.cc:45:30: error: 'temp' was not declared in this scope; did you mean 'tm'?
   45 |                         v2 = temp;
      |                              ^~~~
      |                              tm
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
avconst int MOD = 1000000007;
 
void solve() {
    int n;
    cin >> n;
 
    int k;
    cin >> k;
 
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    vector<int> sum;
    for (int i = 0; i < n; i++) {
        int sm = 0;
        for (int j = i; j < n; j++) {
            sm += v[j];
            sum.push_back(sm);
        }
    }
    int ans = 0;
    for (int i = 60; i >= 0; i--) {
        int tp = ans | (1ll << i), ct = 0;
        for (auto x: sum) if ((x & tp) == tp)ct++;
        if (ct >= k)ans = tp;
    }
    cout << ans << endl;
}
 
int32_t main() {
 
    int t = 1;
    while (t--)
        solve();
    return 0;
}

Compiler output:
a.cc:4:1: error: 'avconst' does not name a type; did you mean 'const'?
    4 | avconst int MOD = 1000000007;
      | ^~~~~~~
      | const
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>(),K = in<ll>();
    vector<ll> sum(N+1);
    sum[0] = 0;
    REP(i,N){
        sum[i+1] = sum[i] + in<ll>();
    }
    vector<ll> allsum;
    REP(i,N){
        for (size_t j = i+1; j < N+1; j++){
            allsum.push_back(sum[j] - sum[i]);
        }
    }
    ll answer = 0;
    for (int i = 59; i >= 0; i--){
        sort(ALL(allsum),greater<>());
        int count = 0;
        REP(l,allsum.size()){
            if(allsum[l] >> i == 1){
                count++;
            }else{
                break;
            }
        }
        bool oka = count >= K;
        if(oka){
            answer += 1ll << i;
        }
        REP(l,allsum.size()){
            if(allsum[l] >> i == 1){
                allsum[l] -= 1longlong << i;
            }else if(oka){
                allsum[l] = 0;
            }else{
                break;
            }
        }
    }
    cout << answer << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:30: error: unable to find numeric literal operator 'operator""longlong'
   49 |                 allsum[l] -= 1longlong << i;
      |                              ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
  ll n,k;
  cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  vll b(0);
  rep(i,n){
    ll cu=0;
    for(int j=i;j<n;j++){
      cu+=a[j];
      b.pb(cu);
    }
  }
  ll cu=modpow(2,40,INF);
  ll ans=0;
  rep(i,40){
    ll kk=0;
    bitset<50> h(cu+ans);
    rep(j,sz(b)){
      bitset<50> o(b[j]);
      if(h&o=h)kk++;
    }
    if(kk>=k) ans+=cu;
    cu/=2;
  }
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:13: error: could not convert '((* & std::operator&<50>(h, o)) = h)' from 'std::bitset<50>' to 'bool'
   71 |       if(h&o=h)kk++;
      |          ~~~^~
      |             |
      |             std::bitset<50>
Language: C++

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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

int N, K;
ll a[1005];
ll sum[1005];
ll psum[2000000];

long n, m;
long a[1005];
long sum[1005];//累積和
long psum[2000000];//部分和
long bitflag = 1;


int main(){
	scanf("%ld%ld", &n, &m);
	for(int i = 1; i <= n; i++){
		scanf("%ld", &a[i]);
		sum[i] = sum[i-1] + a[i];
	}
	long pcnt = 0;
	for(int i = 0; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			psum[pcnt] = sum[j] - sum[i];
			pcnt++;
		}
	}
	long upmost = 0;
	for(long bitflag = 1; bitflag < 35184372088832; (bitflag <<= 1)){
		int cnt = 0;
		for(int i = 0; i < pcnt; i++){
			if(bitflag & psum[i]){
				cnt++;
			}
		}
		if(cnt >= m){
			upmost = bitflag;
		}
	}
	if(upmost == 0){
		printf("0\n");
		return 0;
	}
	std::set<int> st;
	for(int i = 0; i < pcnt; i++){
		st.insert(i);
	}
	while(upmost > 0){
		int cnt = 0;
		for(auto i = st.begin(); i != st.end(); i++){
			if(psum[*i] & upmost){
				cnt++;
			}
		}
		std::set<int> st2;
		if(cnt >= m){
			for(auto i = st.begin(); i != st.end(); i++){
				if(psum[*i] & upmost){
					st2.insert(*i);
				}
			}
			st = st2;
			st2.clear();
		}
		upmost >>= 1;
	}
	long ans = psum[*st.begin()];
	for(auto i = st.begin(); i != st.end(); i++){
		ans = (ans & psum[*i]);
	}
	printf("%ld\n", ans);
}

Compiler output:
a.cc:29:6: error: conflicting declaration 'long int a [1005]'
   29 | long a[1005];
      |      ^
a.cc:24:4: note: previous declaration as 'll a [1005]'
   24 | ll a[1005];
      |    ^
a.cc:30:6: error: conflicting declaration 'long int sum [1005]'
   30 | long sum[1005];//累積和
      |      ^~~
a.cc:25:4: note: previous declaration as 'll sum [1005]'
   25 | ll sum[1005];
      |    ^~~
a.cc:31:6: error: conflicting declaration 'long int psum [2000000]'
   31 | long psum[2000000];//部分和
      |      ^~~~
a.cc:26:4: note: previous declaration as 'll psum [2000000]'
   26 | ll psum[2000000];
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,K;cin >> N >> K;
  vector<ll> v(N+1,0);
  rep(i,N)cin >> v[i+1];
  rep(i,N) v[i+1] += v[i];

  map<ll,int> mp;
  rep(i,N) repp(j,i+1,N+1) ++mp[v[j] - v[i]];
  int M = 0;
  vector<PLI> w(m.size());
  for(const PLI m : mp) w[M++] = m;
  ll x = 0;
  vector<bool> prv(M,true);
  int n_2 = 0;
  while((1<<n_2) <= v[N]) ++n_2;
  per(n,n_2){
    int count = 0;
    int n_ = 1<<n;
    vector<bool> nxt(M,false);
    rep(i,M){
      if(!prv[i])continue;
      if(w[i].first&n_){
        count+=m.second;
        nxt[i] = true;
      }
    }
    if(count >= K){
      swap(prv,nxt);
      x |= n_;
    }
  }
  cout << x << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'm' was not declared in this scope
   43 |   vector<PLI> w(m.size());
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
   ll n,k;
   cin>>n>>k;
   vector<ll>a(n+1);
   rep(i,n){
       ll aa;cin>>aa;
       a[i+1]=a[i]+aa;
   }
   rep(i,n){
       REP(j,i+1,n+1)b.pb(a[j]-a[i]);
   }
   vector<bool>used(b.size());
   ll cnt=0;
   ll ans=0;
   for(int i=60;i>=0;i--){
       ll cn=0;
       rep(j,b.size()){
           if(used[j]==cnt){
               if((1<<i)&b[j])cn++;
           }
       }
       if(cn>=k){
           ans+=(1<<i);
           rep(j,b.size()){
               if(used[j]==cnt){
                   if((1<<i)&b[j]){
                       used[j]++;
                   }
               }
           }
           cnt++;
       }
   }
   cout<<ans/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'b' was not declared in this scope
   23 |        REP(j,i+1,n+1)b.pb(a[j]-a[i]);
      |                      ^
a.cc:25:21: error: 'b' was not declared in this scope
   25 |    vector<bool>used(b.size());
      |                     ^
a.cc:40:31: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   40 |                        used[j]++;
      |                        ~~~~~~~^~