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

/*
  AOJ 1077
  Title:The Great Summer Contest
  @kankichi573
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))

/*
    Math
    Greedy
    Geometry
    DP
    Graph
    Other
*/

int n[6];

int solve(int x1,int x2,int x3)
{
  //printf("X123=%d %d %d\n",x1,x2,x3);

  int r1,r2,r3,r4,r;
  r1=r2=r3=r4=0;
  //if(!(x1>0 && x2>0 && x3>0) && x1<3 && x2<3 && x3<3)
  //  return(0);
  
  if(x1>6 && x2>6 && x3>6)
    {
      r=min(min(x1,x2),x3)-6;
      r4=r+solve(x1-r,x2-r,x3-r);
      return(r4);
    }
  if(x1==0)
    return(x2/3 + x3/3);
  if(x2==0)
    return(x1/3 + x3/3);
  if(x2==0)
    return(x1/3 + x2/3);
  if(x1>=3)
    r1=1+solve(x1-3,x2,x3);
  if(x2>=3)
    r2=1+solve(x1,x2-3,x3);
  if(x3>=3)
    r2=1+solve(x1,x2,x3-3);
  if(x1>0 && x2>0 && x3>0)
    r4=1+solve(x1-1,x2-1,x3-1);
  return(max(max(r1,r2),max(r3,r4)));
}
main()
{
  int ret;

  while(scanf("%d %d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5]) &&
	(n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]))
    {
      ret=solve(n[0]+n[3],n[1]+n[4],n[2]+n[5]);
      printf("%d\n",ret);
    }
  return(0);
}
/*
  AOJ 1077
  Title:The Great Summer Contest
  @kankichi573
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))

/*
    Math
    Greedy
    Geometry
    DP
    Graph
    Other
*/

int n[6];

int solve(int x1,int x2,int x3)
{
  //printf("X123=%d %d %d\n",x1,x2,x3);

  int r1,r2,r3,r4,r;
  r1=r2=r3=r4=0;
  //if(!(x1>0 && x2>0 && x3>0) && x1<3 && x2<3 && x3<3)
  //  return(0);
  
  if(x1>6 && x2>6 && x3>6)
    {
      r=min(min(x1,x2),x3)-6;
      r4=r+solve(x1-r,x2-r,x3-r);
      return(r4);
    }
  if(x1==0)
    return(x2/3 + x3/3);
  if(x2==0)
    return(x1/3 + x3/3);
  if(x2==0)
    return(x1/3 + x2/3);
  if(x1>=3)
    r1=1+solve(x1-3,x2,x3);
  if(x2>=3)
    r2=1+solve(x1,x2-3,x3);
  if(x3>=3)
    r2=1+solve(x1,x2,x3-3);
  if(x1>0 && x2>0 && x3>0)
    r4=1+solve(x1-1,x2-1,x3-1);
  return(max(max(r1,r2),max(r3,r4)));
}
main()
{
  int ret;

  while(scanf("%d %d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5]) &&
	(n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]))
    {
      ret=solve(n[0]+n[3],n[1]+n[4],n[2]+n[5]);
      printf("%d\n",ret);
    }
  return(0);
}

Compiler output:
main.c:52:1: error: return type defaults to 'int' [-Wimplicit-int]
   52 | main()
      | ^~~~
main.c:84:5: error: redefinition of 'solve'
   84 | int solve(int x1,int x2,int x3)
      |     ^~~~~
main.c:21:5: note: previous definition of 'solve' with type 'int(int,  int,  int)'
   21 | int solve(int x1,int x2,int x3)
      |     ^~~~~
main.c:115:1: error: return type defaults to 'int' [-Wimplicit-int]
  115 | main()
      | ^~~~
main.c:115:1: error: redefinition of 'main'
main.c:52:1: note: previous definition of 'main' with type 'int()'
   52 | main()
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){

  int mat,gre,geo,dp,gra,oth;
  int suu,aru,jit;
  int mosmin;
  int cnt=0;
  int end=1;

  while(cin>> mat>> gre>> geo>> dp>> gra>> oth){
    if(mat==0&&gre==0&&geo==0&&dp==0&&gra==0&&oth==0){
      break;
    }
   
    suu=mat+dp;
    aru=gre+gra;
    jit=geo+oth;

    cnt=min(suu,aru,jit);

    suu-=cnt;
    aru-=cnt;
    jit-=cnt;

    cnt+=(suu/3+aru/3+jit/3);

    cout<< cnt;
  }
}

Compiler output:
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:20:12:   required from here
   20 |     cnt=min(suu,aru,jit);
      |         ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int main(){

  int mat,gre,geo,dp,gra,oth;
  int suu,aru,jit;
  int mosmin;

  while(cin>> mat>> gre>> geo>> dp>> gra>> oth,mat+gre+geo+dp+gra+oth){
   
    suu=mat+dp;
    aru=gre+gra;
    jit=geo+oth;

    cnt=min(suu,aru);
    cnt=min(cnt,jit);

    suu-=cnt;
    aru-=cnt;
    jit-=cnt;

    cnt+=(suu/3+aru/3+jit/3);

    cout<< cnt<< endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |     cnt=min(suu,aru);
      |     ^~~
      |     int
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int main(){

  int mat,gre,geo,dp,gra,oth;
  int suu,aru,jit;
  int mosmin;
  int cnt=0;

  while(cin>> mat>> gre>> geo>> dp>> gra>> oth,){
    if((a|b|c|d|e|f) == 0) break;
    suu=mat+dp;
    aru=gre+gra;
    jit=geo+oth;

    cnt=min(suu,aru);
    cnt=min(cnt,jit);

    suu-=cnt;
    aru-=cnt;
    jit-=cnt;

    cnt+=(suu/3+aru/3+jit/3);

    cout<< cnt<< endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:48: error: expected primary-expression before ')' token
   11 |   while(cin>> mat>> gre>> geo>> dp>> gra>> oth,){
      |                                                ^
a.cc:12:9: error: 'a' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |         ^
a.cc:12:11: error: 'b' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |           ^
a.cc:12:13: error: 'c' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |             ^
a.cc:12:15: error: 'd' was not declared in this scope; did you mean 'dp'?
   12 |     if((a|b|c|d|e|f) == 0) break;
      |               ^
      |               dp
a.cc:12:17: error: 'e' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |                 ^
a.cc:12:19: error: 'f' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |                   ^
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int main(){

  int mat,gre,geo,dp,gra,oth;
  int suu,aru,jit;
  int mosmin;
  int cnt=0;

  while(cin>> mat>> gre>> geo>> dp>> gra>> oth){
    if((a|b|c|d|e|f) == 0) break;
    suu=mat+dp;
    aru=gre+gra;
    jit=geo+oth;

    cnt=min(suu,aru);
    cnt=min(cnt,jit);

    suu-=cnt;
    aru-=cnt;
    jit-=cnt;

    cnt+=(suu/3+aru/3+jit/3);

    cout<< cnt<< endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'a' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |         ^
a.cc:12:11: error: 'b' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |           ^
a.cc:12:13: error: 'c' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |             ^
a.cc:12:15: error: 'd' was not declared in this scope; did you mean 'dp'?
   12 |     if((a|b|c|d|e|f) == 0) break;
      |               ^
      |               dp
a.cc:12:17: error: 'e' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |                 ^
a.cc:12:19: error: 'f' was not declared in this scope
   12 |     if((a|b|c|d|e|f) == 0) break;
      |                   ^
Language: C++

int main(){
	cout << 1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'cout' was not declared in this scope
    2 |         cout << 1 << endl;
      |         ^~~~
a.cc:2:22: error: 'endl' was not declared in this scope
    2 |         cout << 1 << endl;
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,s1,s2,s3,s,p;
int main() {
	while(1){
		s=0;
		cin>>a>>b>>c>>d>>e>>f;
		s1=a+d;
		s2=b+e;
		s3=c+f;
		if(s1+s2+s3==0){break;}
		p=min(s1,min(s2,s3))
		for(i=max(0,p-9);i<=p;i++){
			s=max(s,i+(s1-i)/3+(s2-i)/3+(s3-i)/3);
		}
		cout<<s<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:37: error: expected ';' before 'for'
   12 |                 p=min(s1,min(s2,s3))
      |                                     ^
      |                                     ;
   13 |                 for(i=max(0,p-9);i<=p;i++){
      |                 ~~~                  
a.cc:13:34: error: 'i' was not declared in this scope
   13 |                 for(i=max(0,p-9);i<=p;i++){
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,s1,s2,s3,s,p;
int main() {
	while(1){
		s=0;
		cin>>a>>b>>c>>d>>e>>f;
		s1=a+d;
		s2=b+e;
		s3=c+f;
		if(s1+s2+s3==0){break;}
		p=min(s1,min(s2,s3));
		for(i=max(0,p-9);i<=p;i++){
			s=max(s,i+(s1-i)/3+(s2-i)/3+(s3-i)/3);
		}
		cout<<s<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'i' was not declared in this scope
   13 |                 for(i=max(0,p-9);i<=p;i++){
      |                     ^
Language: C++

#include <iostream>
using namespace std;

template<typename First, typename Second, typename... Rest>
int min(First first, Second second, Rest... rest)
{
	if (first < second) return min(first, rest...);
	else return min(second, rest...);
}
int min(int first, int second)
{
	if (first < second) return first;
	else return second;
}


int main()
{	
	while (true)
	{
		int problem[6];
		int n[3] = {0};
		int ans = 0;
		bool DoBreak = true;

		for (int i = 0; i < 6; ++i)
		{
			cin >> problem[i];
			if (problem[i] != 0) DoBreak = false;
		}
		if (DoBreak) break;

		for (int i = 0; i < 3; ++i)
		{
			n[i] = problem[i] + problem[3 + i]; //2??????1?????¢????????¨??????
		}

		//??????????????? 1, 2, 3
		for (int i = 0; i < 3; ++i)
		{
			ans += n[i] / 3;
			n[i] = n[i] % 3;
		}

		//??????????????? 4
		{
			ans += min(n[0], n[1], n[2]);
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:47:14:   required from here
   47 |                         ans += min(n[0], n[1], n[2]);
      |                                ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

int main()
{
  int a,b,c,d,e,f,ad,be,cf,ans,sum;

  while(1){
    cin>>a>>b>>c>>d>>e>>f;
    if(a+b+c+d+e+f==0)break;
    ans=0;
    ad=a+d;
    be=b+e;
    cf=c+f;
    ans+=min(min(ad,be),cf);
    ad-=ans;
    be-=ans;
    cf-=ans;
    ans+=ad/3;
    ans+=be/3;
    ans+=cf/3;

    sum=0;
    ad=a+d;
    be=b+e;
    cf=c+f;
    sum+=ad/3;
    ad=ad%3;
    sum+=be/3;
    be=be%3;
    sum+=cf/3;
    cf=cf%3;
    sum+=min(min(ad,be),cf);

    cout<<max(ans,max)<<endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:14: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)'
   35 |     cout<<max(ans,max)<<endl;
      |           ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:36: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/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
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |     cout<<max(ans,max)<<endl;
      |           ~~~^~~~~~~~~
Language: C++

loop do
    a = gets.split.map(&:to_i)
    break if a.all? {|x| x == 0}
    x, y, z = a[0] + a[3], a[1] + a[4], a[2] + a[5]
    n = 0
    if x > 0
        n += x / 3
        x %= 3
        if x == 0
            n -= 1
            x = 3
        end
    end
    if y > 0
        n += y / 3
        y %= 3
        if y == 0
            n -= 1
            y = 3
        end
    end
    if z > 0
        n += z / 3
        z %= 3
        if z == 0
            n -= 1
            z = 3
        end
    end
    r = [x, y, z].sort
    if r[0] == 3
        n += 3
    elsif r[0] == 2
        n += 2
    elsif r[0] == 1 && r[1] <= 2
        n += 1
    else
        n += 1 if r[1] == 3
        n += 1 if r[2] == 3
    end
    puts n
end


Compiler output:
a.cc:1:1: error: 'loop' does not name a type
    1 | loop do
      | ^~~~
a.cc:4:5: error: 'x' does not name a type
    4 |     x, y, z = a[0] + a[3], a[1] + a[4], a[2] + a[5]
      |     ^
Language: C++

//02
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f,a|b|c|d|e|f;){
    int x=a+d;
    int y=b+e;
    int z=c+f;
    int xt=(x-1)/3;
    int yt=(y-1)/3;
    int zt=(z-1)/3;
    x-=xt*3;
    y-=yt*3;
    z-=zt*3;
    int ar[]={x,y,z};
    sort(ar,ar+3);
    int ex=max(ar[0],count(ar,ar+3,3));
    cout<<xt+yt+zt+ex<<endl;
  }
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
   20 |     int ex=max(ar[0],count(ar,ar+3,3));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:20:15: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
   20 |     int ex=max(ar[0],count(ar,ar+3,3));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:20:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |     int ex=max(ar[0],count(ar,ar+3,3));
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
	while(true){
		vector<int> vi(3);
		for(int i=0; i<6; ++i){
			int tmp;
			cin >> tmp;
			vi[i%3]+=tmp;
		}
		bool flag=true;
		for(int i=0; i<3; ++i){
			if(vi[i]!=0) flag=false;
		}
		if(flag) break;
		int ans=0;
		for(int i=0; i<3; ++i){
			vector<int> hoge=vi;
			int sum=0;
			{
				int tmp=min(hoge[0],min(i,min(hoge[1],hoge[2])));a
				for(int j=0; j<3; ++j) hoge[j]-=tmp;
				sum+=tmp;
			}
			for(int j=0; j<3; ++j){
				int tmp=hoge[j]/3;
				hoge[j]-=tmp*3;
				sum+=tmp;
			}
			ans=max(ans,sum);
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:82: error: 'a' was not declared in this scope
   24 |                                 int tmp=min(hoge[0],min(i,min(hoge[1],hoge[2])));a
      |                                                                                  ^
a.cc:25:46: error: 'j' was not declared in this scope
   25 |                                 for(int j=0; j<3; ++j) hoge[j]-=tmp;
      |                                              ^
Language: C++

#include <vector>
#include <string>
#include <iostream>
#include <cstdio>
using namespace std;
string x,y;

vector<string> split(string &str, const char *delim){
	vector<string> result;
	int cutAt;
	while( (cutAt = str.find_first_of(delim)) != str.npos ){
		if(cutAt > 0){
			result.push_back(str.substr(0, cutAt));
		}
		str = str.substr(cutAt + 1);
	}
	if(str.length() > 0){
		result.push_back(str);
	}
	return result;
}

void solve(string &exp){
	int i=0,j,r;
	vector<string> token = split(exp,"|");
	for(;i<token.size();i++){
		string t=token[i].substr(1,token[i].size()-2);
		vector<string> prob = split(t,"&");
		for(r=j=0;j<prob.size();j++){
			if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
		}
		if(!r)break;
	}
	puts(i==token.size()?"no":"yes");
}
int main(){x="#",y="~";for(string str;getline(cin,str),str!=x;solve(str));}

Compiler output:
a.cc: In function 'void solve(std::string&)':
a.cc:30:49: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::__cxx11::basic_string<char>)'
   30 |                         if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
      |                                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:30:49: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
   30 |                         if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
      |                                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int r,c,q;
	int a[10000],b[10000],o[10000];
	int nrow,ncol;
    long int out;
	bool row[50000],col[50000];

	while( cin >> r >> c >> q, (r||c||q))
	{
		for( int i = 0; i < q ;  i++)
		{
			cin>>a[q-i-1]>>b[q-i-1]>>o[q-i-1];
		}
		
		memset(row, 0, sizeof(row));
		memset(col, 0, sizeof(col));
		out = 0;
		nrow = 0;
		ncol = 0;
		
		for( int i = 0; i < q ;  i++)
		{
			
			if(a[i] == 0)
			{
				if(row[b[i]]) 
					continue;
	
				row[b[i]] = 1;
				nrow++;
				if(o[i] == 1)
					out += c-ncol;
			}
			else
			{
				if(col[b[i]]) 
					continue;

				col[b[i]] = 1;
				ncol++;
				if(o[i] == 1)
					out += r-nrow;
			}
		}
		cout << out << endl;
	}

	return 0;
}

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

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
static const int MOD = 100000007;
typedef __int64 ll;

ll dp[6][100001];

ll divide(char prev, int count)
{
    int limit;
    ll ans;
    
    limit = 5;
    
    if (prev == '0' || prev == '8'){
        limit = 3;
    }
    
    ans = 0;
    
    while (count > 0){
        ans = (ans + dp[limit][count]) % MOD;
        count -= limit;
    }
    
    return (ans);
}

int main()
{
	static char str[100001];
	int i, j;
	int count;
	char prev;
	ll ans;
	
    dp[3][0] = dp[5][0] = 1;
    
    for (i = 1; i <= 100000; i++){
        for (j = 1; j <= 5; j++){
            if (i - j >= 0){
                dp[5][i] = (dp[5][i] + dp[5][i - j]) % MOD;
            }
        }
        for (j = 1; j <= 3; j++){
            if (i - j >= 0){
                dp[3][i] = (dp[3][i] + dp[3][i - j]) % MOD;
            }
        }
    }
    
	while (1){
		scanf("%s", str);
		if (str[0] == '#'){
			break;
		}
		
		ans = 1;
		prev = str[0];
		count = 1;
		i = 1;
		
		while (str[i] != '\0'){
			if (str[i] == prev){
				count++;
			}
			else {
				ans = (ans * divide(prev, count)) % MOD;
				prev = str[i];
				count = 1;
			}
			i++;
		}
        
		ans = (ans * divide(prev, count)) % MOD;
		printf("%lld\n", ans);
	}
	return (0);
}

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

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

int main(){
  int q,lim,query,x;

  while(1){
    deque<int> l;
    cin >> q >> lim;
    if(!q && !lim)break;
    for(int i=0;i<q;i++){
      cin >> query >> x;

      if(query==0){
	l.push_back(x);
	if((int)l.size()>lim)l.pop_front();
      }
      if(query==1)l.erase(l.begin()+x-1);
      if(query==2)cout << *(l.begin()+x-1) << endl;
      if(query==3)l.erase(find(l.begin(),l.end(),x));
    }
    cout << "end" << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: no matching function for call to 'find(std::deque<int>::iterator, std::deque<int>::iterator, int&)'
   21 |       if(query==3)l.erase(find(l.begin(),l.end(),x));
      |                           ~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:21:31: note:   'std::_Deque_iterator<int, int&, int*>' is not derived from 'std::istreambuf_iterator<_CharT>'
   21 |       if(query==3)l.erase(find(l.begin(),l.end(),x));
      |                           ~~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<vector>
main(){for(int Q,L,q,x;scanf("%d%d",&Q,&L),Q;puts("end"))for(std::vector<int>v;Q--;){
	if(v.size()>L)v.erase(v.begin());
	if(scanf("%d%d",&q,&x),!q)v.push_back(x);
	if(q==1)v.erase(v.begin()+x-1);
	if(q==2)printf("%d\n",v[x-1]);
	if(q==3)v.erase(std::find(v.begin(),v.end(),x));
}}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){for(int Q,L,q,x;scanf("%d%d",&Q,&L),Q;puts("end"))for(std::vector<int>v;Q--;){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:30: error: 'find' is not a member of 'std'
    8 |         if(q==3)v.erase(std::find(v.begin(),v.end(),x));
      |                              ^~~~
Language: C++

#include <cstdio>
#include <map>

#define MAX_Q (400000)

using namespace std;

typedef long long lint;


int bit[MAX_Q + 1];

void add(int pos, int val)
{
	while (pos <= MAX_Q){
		bit[pos] += val;
		pos += pos & -pos;
	}
}

int sum(int pos)
{
	int ret = 0;
	
	while (pos){
		ret += bit[pos];
		pos &= (pos - 1);
	}
	
	return (ret);
}

void print(int x, map<int, lint> val)
{
	int l = 0, r = MAX_Q;
	
	while (l != r){
		int center = (l + r) / 2;
		
		if (sum(center) < x){
			l = center + 1;
		}
		else {
			r = center;
		}
	}
	
	printf("%lld\n", val[r]);
}

void erase(int x)
{
	int l = 0, r = MAX_Q;
	
	while (l != r){
		int center = (l + r) / 2;
		
		if (sum(center) < x){
			l = center + 1;
		}
		else {
			r = center;
		}
	}
	
	add(r, -1);
}

int main()
{
	int q, lim;
	
	while (scanf("%d %d", &q, &lim), lim){
		memset(bit, 0, sizeof(bit));
		map<lint, int> pos;
		map<int, lint> val;
		
		int p = 1;
		
		while (q--){
			int qtype, x;
			scanf("%d %lld", &qtype, &x);
			
			if (qtype == 0){
				add(p, 1);
				pos[x] = p;
				val[p++] = x;
				if (sum(MAX_Q) > lim){
					erase(1);
				}
			}
			if (qtype == 1){
				erase(x);
			}
			if (qtype == 2){
				print(x, val);
			}
			if (qtype == 3){
				add(pos[x], -1);
			}
		}
		
		printf("end\n");
	}
	
	return (0);
}

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

#include <cstdio>
#include <map>
#include <cstring>

#define MAX_Q (400000)

using namespace std;

typedef long long lint;


int bit[MAX_Q + 1];
lint val[MAX_Q + 1];

void add(int pos, int val)
{
    while (pos <= MAX_Q){
        bit[pos] += val;
        pos += pos & -pos;
    }
}

int sum(int pos)
{
    int ret = 0;
     
    while (pos){
        ret += bit[pos];
        pos &= (pos - 1);
    }
     
    return (ret);
}

int valid(int x)
{
    int l = 0, r = MAX_Q;
     
    while (l != r){
        int center = (l + r) / 2;
         
        if (sum(center) < x){
            l = center + 1;
        }
        else {
            r = center;
        }
    }
     
    return (r);
}

int main()
{
    int q, lim;
     
    while (scanf("%d %d", &q, &lim), lim){
        memset(bit, 0, sizeof(bit));
        memset(val, 0, sizeof(val));
         
        map<lint, int> pos;
         
        int p = 1;
         
        while (q--){
            int qtype, x;
            scanf("%d %lld", &qtype, &x);
             
            if (qtype == 0){
                add(p, 1);
                pos[x] = p;
                val[p++] = x;
                if (sum(MAX_Q) > lim){
                    erase(1);
                }
            }
            if (qtype == 1){
                add(valid(x), -1);
            }
            if (qtype == 2){
                printf("%d\n", val[valid(x)]);
            }
            if (qtype == 3){
                add(pos[x], -1);
            }
        }
         
        printf("end\n");
    }
     
    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:21: error: 'erase' was not declared in this scope
   74 |                     erase(1);
      |                     ^~~~~
Language: C++

//O(N^2 * NK)やる。
#include<iostream>
using namespace std;

int n, p;
int c[114];

int getscore() {
	int ret = 0;
	int i, j;
	for( i = 0; i < n; i++ ) {
		int score = 1;
		for( j = 0; j < p; j++ ) {
			if ( i + j >= n )
				break;
			score *= c[i+j];
		}
		if ( j == p )
			ret = max(score, ret);
	}
	return ret;
}

void solve() {
	int i, j;
	for( i = 0; i < n; i++ )
		cin >> c[i];

	int Score = getscore();
	int ans = -1;
	for( i = 0; i < n; i++ ) {
		for( j = i+1; j < n; j++ ) {
			c[i] = c[i] + c[j];
			c[j] = c[i] - c[j];
			c[i] = c[i] - c[j];
			
			int score = getscore();
			ans = max(ans, score - Score);

			c[i] = c[i] + c[j];
			c[j] = c[i] - c[j];
			c[i] = c[i] - c[j];
		}
	}
	if ( ans == -1 )
		cout << "NO GAME" << endl;
	else 
		cout << ans << endl;
	}
}
int main() {
	while( cin >> n >> p ) {
		solve();
	}
	return 0;
}

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

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

int main() {

  int n,k;
  while(1) {
    cin >> n >> k;
    if(n == 0 && k == 0) break;

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

    int ck = -1;
    int site = 0;
    for(int i=0;i<=n-k;i++) {
      int t = 1;
      for(int j=0;j<k;j++) t*= a[j+i];
      if(ck <t) ck = t, site = i;
    }

    int nmin=100000;
    int site2=0;
    for(int i=0;i<k;i++) 
      if(a[site+i] < nmin) nmin = a[site+i],site2 = i+site;


    int amax = a[site2];
    for(int i=0;i<n;i++) {
      if( site <= i && i<=site+k) continue;
      if(amax < a[i]) amax = a[i];
    }
    //  cout << a[site2] << endl;
    //cout << amax <<endl;
    int ck2 = (ck/a[site2])*amax;
    //cout << ck <<" "<<ck2<<endl;
    //if(ck2-ck <= 0 && n-k<2) cout <<"NO GAME"<<endl;
    else cout << ck2-ck <<endl;
  
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: 'else' without a previous 'if'
   40 |     else cout << ck2-ck <<endl;
      |     ^~~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int n, m, c[100];
inline int solve() {
	int ret = 0, u = 1;
	for(int i = 0; i < m - 1; i++) u *= c[i];
	for(int i = m - 1; i < n; i++) u *= c[i], ret = max(ret, u), c /= c[i - m + 1];
	return ret;
}
int main() {
	while(scanf("%d%d", &n, &m), n) {
		for(int i = 0; i < n; i++) scanf("%d", c + i);
		int ret = 0, res = solve();
		for(int i = 0; i < n; i++) {
			for(int j = i + 1; j < n; j++) {
				swap(c[i], c[j]);
				ret = max(ret, solve());
				swap(c[i], c[j]);
			}
		}
		if(ret < res) puts("NO GAME");
		else printf("%d\n", ret - res);
	}
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:8:72: error: invalid operands of types 'int [100]' and 'int' to binary 'operator/'
    8 |         for(int i = m - 1; i < n; i++) u *= c[i], ret = max(ret, u), c /= c[i - m + 1];
      |                                                                      ~~^~~~~~~~~~~~~~~
a.cc:8:72: note:   in evaluation of 'operator/=(int [100], int)'
Language: C++

#include <iostream>
using namespace std;
template <class T> void swap(T& x,T& y){
  T tmp=x;y=x;x=tmp;
}
int main(){
  while(true){
    int n,k;
    cin>>n>>k;
    if(n==0)return 0;
    int c[100];
    for(int i=0;i<n;i++)
      cin>>c[i];
    int nowc=calc(c,k,n);
    int cmax;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j)continue;
	swap(c[i],c[j]);
	int cprime=calc(c,k,n);
	cmax=max(cprime,cmax);
	swap(c[i],c[j]);
      }
    }
      if(cmax<nowc)
	cout<<"NO GAME";
      else
	cout<<cmax-nowc;
  }
  return 0;
}
int calc(int* c,int k,int n){
  int m=0;
  for(int i=0;i<n-k;i++){
    int v=1;
    for(int j=0;j<k;j++){
      v*=c[i+j];
    }
    m=max(v,m);
  }
  return m;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'calc' was not declared in this scope; did you mean 'calloc'?
   14 |     int nowc=calc(c,k,n);
      |              ^~~~
      |              calloc
a.cc:19:13: error: call of overloaded 'swap(int&, int&)' is ambiguous
   19 |         swap(c[i],c[j]);
      |         ~~~~^~~~~~~~~~~
a.cc:3:25: note: candidate: 'void swap(T&, T&) [with T = int]'
    3 | template <class T> void swap(T& x,T& y){
      |                         ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
a.cc:22:13: error: call of overloaded 'swap(int&, int&)' is ambiguous
   22 |         swap(c[i],c[j]);
      |         ~~~~^~~~~~~~~~~
a.cc:3:25: note: candidate: 'void swap(T&, T&) [with T = int]'
    3 | template <class T> void swap(T& x,T& y){
      |                         ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
template <class T> void swap(T& x,T& y){
  T tmp=x;y=x;x=tmp;
}
int calc(int*,int,int);
int main(){
  while(true){
    int n,k;
    cin>>n>>k;
    if(n==0)return 0;
    int c[100];
    for(int i=0;i<n;i++)
      cin>>c[i];
    int nowc=calc(c,k,n);
    int cmax;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j)continue;
	swap(c[i],c[j]);
	int cprime=calc(c,k,n);
	cmax=max(cprime,cmax);
	swap(c[i],c[j]);
      }
    }
      if(cmax<nowc)
	cout<<"NO GAME";
      else
	cout<<cmax-nowc;
  }
  return 0;
}
int calc(int* c,int k,int n){
  int m=0;
  for(int i=0;i<n-k;i++){
    int v=1;
    for(int j=0;j<k;j++){
      v*=c[i+j];
    }
    m=max(v,m);
  }
  return m;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: call of overloaded 'swap(int&, int&)' is ambiguous
   20 |         swap(c[i],c[j]);
      |         ~~~~^~~~~~~~~~~
a.cc:3:25: note: candidate: 'void swap(T&, T&) [with T = int]'
    3 | template <class T> void swap(T& x,T& y){
      |                         ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
a.cc:23:13: error: call of overloaded 'swap(int&, int&)' is ambiguous
   23 |         swap(c[i],c[j]);
      |         ~~~~^~~~~~~~~~~
a.cc:3:25: note: candidate: 'void swap(T&, T&) [with T = int]'
    3 | template <class T> void swap(T& x,T& y){
      |                         ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
Language: C++


#include <iostream>
using namespace std;
int calc(int*,int,int);
int main(){
  while(true){
    int n,k;
    cin>>n>>k;
    if(n==0)return 0;
    int c[100];
    for(int i=0;i<n;i++)
      cin>>c[i];
    int nowc=calc(c,k,n);
    cerr<<nowc<<endl;
    int cmax=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j)continue;
	swap(c[i],c[j]);
	int cprime=calc(c,k,n);
	cmax=max(cprime,cmax);
	swap(c[i],c[j]);
      }
    }
      if(cmax<nowc)
	cout<<"NO GAME"<<endl;
      else
	cout<<cmax-nowc<<endl;
  }
  return 0;
}
int calc(int* c,int k,int n){
  int m=0;
  for(int i=0;i<n-k+1;i++){
    

Compiler output:
a.cc: In function 'int calc(int*, int, int)':
a.cc:34:28: error: expected '}' at end of input
   34 |   for(int i=0;i<n-k+1;i++){
      |                           ~^
a.cc:34:28: error: expected '}' at end of input
a.cc:32:29: note: to match this '{'
   32 | int calc(int* c,int k,int n){
      |                             ^
a.cc:34:28: warning: no return statement in function returning non-void [-Wreturn-type]
   34 |   for(int i=0;i<n-k+1;i++){
      |                            ^
Language: C++

while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = []
    for i in range(n):
        r.append(input())
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
           if r[i] + r[j] > S:
               ans += 1
    print ans

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while True:
      | ^~~~~
Language: C++

#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int n,s;
    while(cin>>n>>s){
        if(n==0 && s==0)break;
        
        vi in;
        rep(i,n){
            int a;
            cin>>a;
            in.pb(a);
        }
        
        
        sort(all(in));
        
        int sum=0;
        rep(i,n-1){
            for(int j=i+1;j<n;j++){
                if(in[i]+in[j]>s){
                    sum+=n-j;
            }
        }
        
        cout<<sum<<endl;
        
        
    }
    
    return 0;
}

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

#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;

int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003

int dp[353][353]={0};
int bow[353][353]={0};

set<string> a;

int main(){
	
	int n,S;
	
	while(cin>>n>>S,n!=0||S!=0){
		int r[120]={0};
		int a;
		rep(i,n){
			cin>>a;
			r[a]++;
		}
		long long ans=0;
		REP(i,1,101){
			REP(j,i,101){
				if(i+j>S&&r[i]>0&&r[j]>0){
					if(i==j)
					ans+=r[i]*(r[i]-1)/2
					else
					ans+=r[i]*r[j];
				}
			}
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:61: error: expected ';' before 'else'
   69 |                                         ans+=r[i]*(r[i]-1)/2
      |                                                             ^
      |                                                             ;
   70 |                                         else
      |                                         ~~~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int n, s;
int main() {
	while(scanf("%d%d", &n, &s), n) {
		int a[102] = {0};
		for(int i = 0; i < n; i++) scanf("%d", &r), a[r]++;
		int ret = 0;
		for(int i = 1; i <= 100; i++) {
			for(int j = max(i, s - i + 1); j <= 100; j++) {
				ret += a[i] * a[j];
			}
		}
		for(int i = s / 2 + 1; i <= 100; i++) ret -= (a[i] * a[i] + a[i]) / 2;
		printf("%d\n", ret);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:57: error: 'r' was not declared in this scope
    8 |                 for(int i = 0; i < n; i++) scanf("%d", &r), a[r]++;
      |                                                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a,b;
int c[20000];
while(cin>>a>>b,a|b){
    for(int d=0;d<a;d++)cin>>c[d];
    sort(c,c+a);
    int s=0;
    for(int e=0;e<a-1;e++){
	s+=c+a-lower_bound(c+e;1,c+a,b-c[e]);
	}
	printf("%d\n",s);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: expected ')' before ';' token
   12 |         s+=c+a-lower_bound(c+e;1,c+a,b-c[e]);
      |                           ~   ^
      |                               )
a.cc:12:44: error: expected ';' before ')' token
   12 |         s+=c+a-lower_bound(c+e;1,c+a,b-c[e]);
      |                                            ^
      |                                            ;
Language: C++

#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
int in(){ int a; scanf("%d",&a); return a; }
int main(){
	int n,S;
	while(n=in(),S=in(),(n||S)){
		int w[101]={};
		int ans = 0;
		for(int i = 0 ; i < n ; i++) w[in()]++;
		
		for(int i = 0 ; i <= 100 ; i++){
			if(w[i]==0)continue;
			for(int j = i ; j <= 100 ; j++){
				if(i+j>S){
					if(i==j) ans+=w[i]*(w[i]-1)/2;
					else ans += w[i]*w[j];
				}
			}
		}
		printf("%d%c",ans,10);
	}
}#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
int in(){ int a; scanf("%d",&a); return a; }
int main(){
	int n,S;
	while(n=in(),S=in(),(n||S)){
		int w[101]={};
		int ans = 0;
		for(int i = 0 ; i < n ; i++) w[in()]++;
		
		for(int i = 0 ; i <= 100 ; i++){
			if(w[i]==0)continue;
			for(int j = i ; j <= 100 ; j++){
				if(i+j>S){
					if(i==j) ans+=w[i]*(w[i]-1)/2;
					else ans += w[i]*w[j];
				}
			}
		}
		printf("%d%c",ans,10);
	}
}

Compiler output:
a.cc:24:2: error: stray '#' in program
   24 | }#include <cstdio>
      |  ^
a.cc:24:3: error: 'include' does not name a type
   24 | }#include <cstdio>
      |   ^~~~~~~
a.cc:28:5: error: redefinition of 'int in()'
   28 | int in(){ int a; scanf("%d",&a); return a; }
      |     ^~
a.cc:5:5: note: 'int in()' previously defined here
    5 | int in(){ int a; scanf("%d",&a); return a; }
      |     ^~
a.cc:29:5: error: redefinition of 'int main()'
   29 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  while(true){  
    int n,S;
    cin >> n >> S;
    vector<int> R(n);
    for(int i=0;i<n;i++) cin >> R[i];
    if(n==0)return 0;
    sort(R.begin(),R.end());
    vector<int> Rcount(101);

    for(int i=1;i<101;i++){
      Rcount[i] = upper_bound(R.begin(),R.end(),i) 
                - lower_bound(R.begin(),R.end(),i);
    }

    vector<int> Rsum(101);
    for(int i=1;i<=100;i++){
      Rsum[i] = Rsum[i-1] + Rcount[i];
    }
    int retval=0;
    for(int i=0;i<S-1;i++){
      retval+=Rcount(i)*(Rsum(100)-Rsum(S-i-1));
    }
    for(int i=S;i<101;i++){
      retval+=Rcount(i)*Rsum(100);
    }
    cout<<retval;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: no match for call to '(std::vector<int>) (int&)'
   26 |       retval+=Rcount(i)*(Rsum(100)-Rsum(S-i-1));
      |               ~~~~~~^~~
a.cc:26:30: error: no match for call to '(std::vector<int>) (int)'
   26 |       retval+=Rcount(i)*(Rsum(100)-Rsum(S-i-1));
      |                          ~~~~^~~~~
a.cc:26:40: error: no match for call to '(std::vector<int>) (int)'
   26 |       retval+=Rcount(i)*(Rsum(100)-Rsum(S-i-1));
      |                                    ~~~~^~~~~~~
a.cc:29:21: error: no match for call to '(std::vector<int>) (int&)'
   29 |       retval+=Rcount(i)*Rsum(100);
      |               ~~~~~~^~~
a.cc:29:29: error: no match for call to '(std::vector<int>) (int)'
   29 |       retval+=Rcount(i)*Rsum(100);
      |                         ~~~~^~~~~
Language: C++

import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			int S=in.nextInt();
			if((n|S)==0)
				return;
			int a[]=new int[n];
			int cnt=0;
			ArrayList<Integer>AL=new ArrayList<Integer>();
			for(int i=0;i<n;i++)
				a[i]=in.nextInt();
			for(int i=0;i<n;i++)
				for(int j=i+1;j<n;j++)
				{
					if(i==j)
						continue;
					AL.add(a[i]+a[j]);
				}
			for(int p:AL)
				if(p>S)
					cnt++;
			System.out.println(cnt);
		}
	}
}

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

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int c,d,w,x;
	while(cin>>c>>d>>w>>x,c||d||w||x){
		int e[20][35],f[20][35];
		for(int i=0;i<c;i++)
		for(int j=0;j<d;j++)
			cin>>e[i][j];
		for(int i=0;i<c;i++)
		for(int j=0;j<d;j++)
			cin>>f[i][j];
		int dp[35][55][10];
		memset(dp,-1,sizeof(dp));
		dp[0][0][0]=0;
		for(int i=0;i<d;i++){
			for(int j=0;j<=w;j++)
			for(int k=0;k<=x;k++){
				if(dp[i][j][k]==-1)
					continue;
				for(int l=0;l<c;l++){
					int now=l,nx=k,nw=j,nowe=dp[i][j][k];
					while(now<c){
						nowe+=e[now][i],nw+=f[now][i];
						if(!e[now][i]||x<nx||w<nw)
							break;
						dp[i+1][nw][nx]=max(dp[i+1][nw][nx],nowe);
						
						now++;
						nx=k+1;
					}
					
				}
				dp[i+1][j][k]=max(dp[i][j][k],dp[i+1][j][k]);
			}
			
			
		}
		int ans=0;
		for(int i=0;i<=w;i++)
		for(int j=0;j<=x;j++)
			ans=max(ans,dp[d][i][j]);
		cout<<ans<<endl;
	}
	
	return 0;
}

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