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

#include<bits/stdc++.h>

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

using namespace std;

const int IINF = INT_MAX;
const int h = 19;
const int w = 15;

struct Data { 
  int x,y,bitmask,cost;
  bool operator < ( const Data& data ) const { 
    if( cost != data.cost ) return cost < data.cost; 
    if( x != data.x ) return x < data.x;
    if( y != data.y ) return y < data.y;
    if( bitmask != data.bitmask ) return bitmask < data.bitmask;
  }
};

char a[20][20];
//int mindist[1<<20][9];
set<Data> mindist;
int Index[20][20];

bool isValid(int x,int y) { return 0 <= x && x < w && 0 <= y && y < h; }

void compute(){
  int black = 0;
  int sx=-1,sy=-1;
  rep(i,h) rep(j,w) {
    if( a[i][j] == 'X' ) Index[i][j] = black++;
    if( a[i][j] == 'O' ) sx = j, sy = i;
  }
  //rep(i,(1<<black)) rep(j,9) mindist[i][j] = IINF;
  mindist.clear();
  //mindist[(1<<black)-1][4] = 0;
  mindist.insert((Data){sx,sy,(1<<black)-1,0});
  deque<Data> deq;
  deq.push_back((Data){sx,sy,(1<<black)-1,0});
  while( !deq.empty() ){
    Data data = deq.front(); deq.pop_front();
    REP(dx,-1,2){
      REP(dy,-1,2){
        if( dx == 0 && dy == 0 ) continue;
        int nx = data.x + dx, ny = data.y + dy, nbitmask = data.bitmask;
        bool valid = false;
        while( isValid(nx,ny) && ( a[ny][nx] == 'X' && ( data.bitmask & (1<<Index[ny][nx]) ) ) ){
          nbitmask &= ~(1<<Index[ny][nx]);
          nx += dx, ny += dy;
          valid = true;
        }
        if( valid && ( ny >= h || ( ny == h-1 && isValid(nx,ny) ) ) ) {
          //cout << mindist[data.bitmask]+1 << endl;
          cout << data.cost+1 << endl;
          return;
        } else if( !inValid(nx,ny) ) {
          continue;
        }
        if( !valid ) continue;
        //if( mindist[nbitmask] > mindist[data.bitmask] + 1 ) {
        if( !mindist.count((Data){nx,ny,nbitmask,data.cost+1}) ) {
          //mindist[nbitmask] = mindist[data.bitmask] + 1;
          mindist.insert((Data){nx,ny,nbitmask,data.cost+1});
          deq.push_back((Data){nx,ny,nbitmask,data.cost+1});
        }
      }
    }
  }
  puts("-1");
}

int main(){
  rep(i,h) rep(j,w) scanf(" %c",&a[i][j]);
  compute();
  return 0;
}

Compiler output:
a.cc: In function 'void compute()':
a.cc:58:21: error: 'inValid' was not declared in this scope; did you mean 'isValid'?
   58 |         } else if( !inValid(nx,ny) ) {
      |                     ^~~~~~~
      |                     isValid
a.cc: In member function 'bool Data::operator<(const Data&) const':
a.cc:19:3: warning: control reaches end of non-void function [-Wreturn-type]
   19 |   }
      |   ^
Language: C++

#include <map>
#include <queue>
#include <string>
#include <vector>
#include <utility>
#include <iostream>

using namespace std;

const int dx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
const int dy[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

int BFS(vector<string> v)
{
	map<vector<string>, int> d; d[v] = 1;

	queue<pair<vector<string>, int> > que; que.push(make_pair(v, 1));

	for (int i = 0; i < 15; i++)
	{
		if (v[18][i] == 'O')
		{
			return 0;
		}
	}

	while (!que.empty())
	{
		vector<string> v1 = que.front().first;

		int dist = que.front().second; que.pop();

		int sx = -1, sy = -1;

		for (int i = 0; i < 19; i++)
		{
			for (int j = 0; j < 15; j++)
			{
				if (v1[i][j] == 'O')
				{
					sx = j; sy = i;
				}
			}
		}

		for (int dir = 0; dir < 8; dir++)
		{
			if (0 <= sx + dx[dir] && sx + dx[dir] < 15 && 0 <= sy + dy[dir] && sy + dy[dir] < 19)
			{
				if (v1[sy + dy[dir]][sx + dx[dir]] == 'X')
				{
					int x = sx + dx[dir] * 2;
					int y = sy + dy[dir] * 2;

					while (0 <= x && x < 15 && 0 <= y)
					{
						if (y > 17) { return dist; }

						if (v1[y][x] == '.')
						{
							vector<string> v2 = v1;

							int rx = sx, ry = sy;

							for (; x != rx || y != ry;)
							{
								v2[ry][rx] = '.';

								rx += dx[dir];
								ry += dy[dir];
							}
							
							v2[y][x] = 'O'

							if (d[v2] == 0)
							{
								d[v2] = dist + 1;

								que.push(make_pair(v2, dist + 1));

								goto Exit;
							}
						}

						x += dx[dir];
						y += dy[dir];
					}
				}
			}

		Exit:;
		}
	}

	return -1;
}

int main()
{
	vector<string> v(19);

	for (int i = 0; i < 19; i++) { cin >> v[i]; }

	cout << BFS(v) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int BFS(std::vector<std::__cxx11::basic_string<char> >)':
a.cc:73:71: error: expected ';' before 'if'
   73 |                                                         v2[y][x] = 'O'
      |                                                                       ^
      |                                                                       ;
   74 | 
   75 |                                                         if (d[v2] == 0)
      |                                                         ~~
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define r(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<P,int>P2;

string s[21];
int h=21,w=17,sx,sy;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={-1,-1,0,1,1,1,0,-1};
int d[21][19][1<<20];

map<pair<int,int>,int>M1;
map<int,pair<int,int> >M2;
int cnt;

int main(){
  s[0]=s[20]=".................";
  r(i,h-2){
    cin>>s[i+1];
    s[i+1]="."+s[i+1]+".";
  }
  r(i,h)r(j,w)if(s[i][j]=='O'){
    sx=j;
    sy=i;
    s[i][j]='.';
  }else if(s[i][j]=='X'){
    M2[cnt]=P(i,j);
    M1[P(i,j)]=cnt++;
  }
  queue<P2>q;
  memset(d,-1,sizeof(d));
  d[sy][sx][0]=0;
  q.push(P2(P(sy*1000+sx,0),0));
  while(!q.empty()){
    P2 p=q.front();q.pop();
    int y=p.first.first/1000;
    int x=p.first.first%1000;
    int cost=p.first.second;
    int bit=p.second;
    r(i,8){
      int ny=y+dy[i];
      int nx=x+dx[i];
      int b=bit;
      if(ny<0||nx<0||ny>=h||nx>=w)continue;
      if(s[ny][nx]=='.')continue;
      if((1<<M1[P(ny,nx)])&b)continue;
      while(s[ny][nx]=='X'){
	int c=M1[P(ny,nx)];
	if((1<<c)&b)break;
	b|=(1<<c);
	ny+=dy[i];
	nx+=dx[i];
      }
      if(d[ny][nx][b]!=-1)continue;
      d[ny][nx][b]=cost+1;
      q.push(P2(P(ny*1000+nx,cost+1),b));
      if(ny==20){
	cout<<b<<endl;
	cout<<cost+1<<endl;
	return 0;
      }
    }
  }
  cout<<-1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'memset' was not declared in this scope
   37 |   memset(d,-1,sizeof(d));
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <map>
  +++ |+#include <cstring>
    5 | #define r(i,n) for(int i=0;i<n;i++)
Language: C++

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<P,int>P2;

string s[21];
int h=21,w=17,sx,sy;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={-1,-1,0,1,1,1,0,-1};
bool d[21][19][1<<20];

map<pair<int,int>,int>M1;
map<int,pair<int,int> >M2;
int cnt;

int main(){
  s[0]=s[20]=".................";
  r(i,h-2){
    cin>>s[i+1];
    s[i+1]="."+s[i+1]+".";
  }
  r(i,h)r(j,w)if(s[i][j]=='O'){
    sx=j;
    sy=i;
    s[i][j]='.';
  }else if(s[i][j]=='X'){
    M2[cnt]=P(i,j);
    M1[P(i,j)]=cnt++;
  }
  queue<P2>q;
  d[sy][sx][0]=1;
  q.push(P2(P(sy*1000+sx,0),0));
  while(!q.empty()){
    P2 p=q.front();q.pop();
    int y=p.first.first/1000;
    int x=p.first.first%1000;
    int cost=p.first.second;
    int bit=p.second;
    r(i,8){
      int ny=y+dy[i];
      int nx=x+dx[i];
      int b=bit;
      if(ny<=0||nx<=0||ny>=h||nx>=w-1)continue;
      if(s[ny][nx]=='.')continue;
      if((1<<M1[P(ny,nx)])&b)continue;
      while(s[ny][nx]=='X'){
	int c=M1[P(ny,nx)];
	if((1<<c)&b)break;
	b+=(1<<c);
	ny+=dy[i];
	nx+=dx[i];
      
      if(ny<19&&(nx==0||nx==w-1))continue;
      if(d[ny][nx][b]==1)continue;
      d[ny][nx][b]=1;
      q.push(P2(P(ny*1000+nx,cost+1),b));
      if(ny>=19){
	cout<<cost+1<<endl;
	return 0;
      }
    }
  }
  cout<<-1<<endl;
}



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

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<P,int>P2;

string s[21];
int h=21,w=17,sx,sy;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={-1,-1,0,1,1,1,0,-1};
bool d[21][19][1<<20];

map<pair<int,int>,int>M1;
map<int,pair<int,int> >M2;
int cnt;

int main(){
  s[0]=s[20]=".................";
  r(i,h-2){
    cin>>s[i+1];
    s[i+1]="."+s[i+1]+".";
  }
  r(i,h)r(j,w)if(s[i][j]=='O'){
    sx=j;
    sy=i;
    s[i][j]='.';
  }else if(s[i][j]=='X'){
    M2[cnt]=P(i,j);
    M1[P(i,j)]=cnt++;
  }
  queue<P2>q;
  d[sy][sx][0]=1;
  q.push(P2(P(sy*1000+sx,0),0));
  while(!q.empty()){
    P2 p=q.front();q.pop();
    int y=p.first.first/1000;
    int x=p.first.first%1000;
    int cost=p.first.second;
    int bit=p.second;
    r(i,8){
      int ny=y+dy[i];
      int nx=x+dx[i];
      int b=bit;
      if(ny<=0||nx<=0||ny>=h||nx>=w-1)continue;
      if(s[ny][nx]=='.')continue;
      if((1<<M1[P(ny,nx)])&b)continue;
      while(s[ny][nx]=='X'){
	int c=M1[P(ny,nx)];
	if((1<<c)&b)break;
	b+=(1<<c);
	ny+=dy[i];
	nx+=dx[i];
      
      if(ny<19&&(nx==0||nx==w-1))continue;
      if(d[ny][nx][b]==1)continue;
      d[ny][nx][b]=1;
      q.push(P2(P(ny*1000+nx,cost+1),b));
      if(ny>=19&&!(ny==19&&nx==14)){
	cout<<cost+1<<endl;
	return 0;
      }
    }
  }
  cout<<-1<<endl;
}



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

#include<iostream>
#include<string>
#include<cctype>
#include<array>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long Int;
typedef string::const_iterator Itr;

array<int,3> flag;

Int ctoi(const char &c)
{
	return c - '0';
}

Int expression(Itr &);
Int term(Itr &);
Int term2(Itr &);
Int factor(Itr &);
Int number(Itr &);

Int expression(Itr &itr)
{
	Int ret = term(itr);

	while (true)
	{
		if (*itr == '+' && flag[0]==0)
		{
			itr++;
			ret += term(itr);
		}
		else if (*itr == '-'&& flag[1] == 0)
		{
			itr++;
			ret -= term(itr);
		}
		else if (*itr == '*'&& flag[2] == 0)
		{
			itr++;
			ret *= term(itr);
		}
		else
		{
			break;
		}
	}

	return ret;
}

Int term(Itr &itr)
{
	Int ret = term2(itr);

	while (true)
	{
		if (*itr == '+'&& flag[0] == 1)
		{
			itr++;
			ret += term2(itr);
		}
		else if (*itr == '-'&& flag[1] == 1)
		{
			itr++;
			ret -= term2(itr);
		}
		else if (*itr == '*'&& flag[2] == 1)
		{
			itr++;
			ret *= term2(itr);
		}
		else
		{
			break;
		}
	}

	return ret;
}

Int term2(Itr &itr)
{
	Int ret = factor(itr);

	while (true)
	{
		if (*itr == '+'&& flag[0] == 2)
		{
			itr++;
			ret += factor(itr);
		}
		else if (*itr == '-'&& flag[1] == 2)
		{
			itr++;
			ret -= factor(itr);
		}
		else if (*itr == '*'&& flag[2] == 2)
		{
			itr++;
			ret *= factor(itr);
		}
		else
		{
			break;
		}
	}

	return ret;
}

Int factor(Itr &itr)
{
	Int ret;

	if (*itr == '(')
	{
		itr++;
		ret = expression(itr);
		itr++;
	}
	else
	{
		ret = number(itr);
	}

	return ret;
}

Int number(Itr &itr)
{
	Int ret = 0;

	while (isdigit(*itr))
	{
		ret *= 10;
		ret += ctoi(*itr);
		itr++;
	}

	return ret;
}

int main()
{
	string s;
	getline(cin, s);
	s.append("_");

	Int max_ans = -LLONG_MIN;

	REP(i,3)REP(j,3)REP(k,3)
	{
		flag[0] = i;
		flag[1] = j;
		flag[2] = k;
		Itr begin = s.begin();
		Int ans = expression(begin);
		if (max_ans < ans)
		{
			max_ans = ans;
		}
	}
	cout << max_ans << endl;
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:151:24: error: 'LLONG_MIN' was not declared in this scope
  151 |         Int max_ans = -LLONG_MIN;
      |                        ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<array>
  +++ |+#include <climits>
    5 | #define REP(i,n) for(int i=0;i<(n);i++)
Language: C++

#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

def calc(lst, pos, pr):
    ret = []
    while True:
        if pos >= len(lst):
            break
        if lst[pos] == '(':
            val, pos = calc(lst, pos + 1, pr)
            ret.append(val)
        elif lst[pos] == ')':
            pos += 1
            break
        else:
            ret.append(lst[pos])
            pos += 1
    lst = ret
    for p in pr:
        i = 0
        ret = []
        while i < len(lst):
            if lst[i] in p:
                ret[-1] = eval(str(ret[-1]) + lst[i] + str(lst[i + 1]))
                i += 2
            else:
                ret.append(lst[i])
                i += 1
    return ret[0], pos

S = raw_input()

lst = []
ss = ''
for c in S:
    if c in ['+', '-', '*', '(', ')']:
        if ss != '':
            lst.append(int(ss))
        lst.append(c)
        ss = ''
    else:
        ss += c
if ss != '':
    lst.append(int(ss))

ans = -(10 ** 30)
for i, j, k in it.product([0, 1, 2], repeat = 3):
    pr = [[], [], []]
    pr[i].append('+')
    pr[j].append('-')
    pr[k].append('*')
    ans = max(ans, calc(lst, 0, pr)[0])

print ans


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:40:6: error: empty character constant
   40 | ss = ''
      |      ^~
a.cc:43:18: error: empty character constant
   43 |         if ss != '':
      |                  ^~
a.cc:46:14: error: empty character constant
   46 |         ss = ''
      |              ^~
a.cc:49:10: error: empty character constant
   49 | if ss != '':
      |          ^~
a.cc:3:1: error: 'import' does not name a type
    3 | import sys
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <string>
#include <vector>
#include <iostream>
using namespace std;
string S; int junjo[4];
long long calc(int L,int R){
    int K=0;
    vector<int>junjo2[4];
    for(int i=0;i<4;i++){
        junjo2[junjo[i]].push_back(i);
    }
    for(int i=0;i<4;i++){
        if(junjo2[i].size()>=1){
            for(int j=R-1;j>=L;j--){
                if(S[j]=='('){K++;}
                if(S[j]==')'){K--;}
                for(int k=0;k<junjo2[i].size();k++){
                    if(junjo2[i][k]==0){
                        if(S[j]=='+' && K==0){
                            return calc(L,j)+calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==1){
                        if(S[j]=='-' && K==0){
                            return calc(L,j)-calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==2){
                        if(S[j]=='*' && K==0){
                            return calc(L,j)*calc(j+1,R);
                        }
                    }
                    if(junjo2[i][k]==3){
                        if(S[j]=='/' && K==0){
                            return calc(L,j)/calc(j+1,R);
                        }
                    }
                }
            }
        }
    }
    if(S[L]=='(' && S[R-1]==')'){return calc(L+1,R-1);}
    return stoll(S.substr(L,R-L));
}
int main() {
	cin >> s; long long ret = 0;
	for(int i = 0; i < 4; i++) {
		for(int j = 0; j < 4; j++) {
			for(int k = 0; k < 4; k++) {
				junjo[0] = i, junjo[1] = j, junjo[2] = k;
				ret = max(ret, calc(0, s.size() - 1));
			}
		}
	}
	printf("%lld\n", ret);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:16: error: 's' was not declared in this scope
   46 |         cin >> s; long long ret = 0;
      |                ^
Language: C++

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

char op[3];
int64_t expr0(string &S, int &i);
int64_t expr1(string &S, int &i);
int64_t expr2(string &S, int &i);
int64_t factor(string &S, int &i);
int64_t number(string &S, int &i);

int64_t expr0(string &S, int &i){
    int64_t ret = expr1(S,i);
    while(true){
        if(S[i]==op[0]){
            i++;
            switch(op[0]){
                case '+':
                    ret+=expr1(S,i);
                    break;
                case '-':
                    ret-=expr1(S,i);
                    break;
                case '*':
                    ret*=expr1(S,i);
                    break;
            }
        }else{
            break;
        }
    }
    // cout<<'A'<<ret<<endl;
    return ret;
}
int64_t expr1(string &S, int &i){
    int64_t ret = expr2(S,i);
    while(true){
        if(S[i]==op[1]){
            i++;
            switch(op[1]){
                case '+':
                    ret+=expr2(S,i);
                    break;
                case '-':
                    ret-=expr2(S,i);
                    break;
                case '*':
                    ret*=expr2(S,i);
                    break;
            }
        }else{
            break;
        }
    }
    // cout<<'B'<<ret<<endl;
    return ret;
}
int64_t expr2(string &S, int &i){
    int64_t ret = factor(S,i);
    while(true){
        if(S[i]==op[2]){
            i++;
            switch(op[2]){
                case '+':
                    ret+=factor(S,i);
                    break;
                case '-':
                    ret-=factor(S,i);
                    break;
                case '*':
                    ret*=factor(S,i);
                    break;
            }
        }else{
            break;
        }
    }
    // cout<<'C'<<ret<<endl;
    return ret;
}

int64_t factor(string &S, int &i){
    int64_t ret;
    if(S[i]=='('){
        i++;
        ret = expr0(S,i);
        i++;
    }else{
        ret = number(S,i);
    }
    return ret;
}

int64_t number(string &S, int &i){
    int64_t ret = 0;
    while(isdigit(S[i])){
        ret*=10;
        ret+=S[i]-'0';
        i++;
    }
    return ret;
}

int main(){
    string S;
    cin>>S;
    vector<char> V;
    V.push_back('+');
    V.push_back('-');
    V.push_back('*');
    sort(V.begin(), V.end());
    int64_t ans=LONG_MIN;
    do{
        for(int i=0;i<3;i++) op[i]=V[i];
        int i=0;
        ans = max(ans, expr0(S,i));
    }while(next_permutation(V.begin(),V.end()));
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:114:17: error: 'LONG_MIN' was not declared in this scope
  114 |     int64_t ans=LONG_MIN;
      |                 ^~~~~~~~
a.cc:5:1: note: 'LONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <cctype>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <climits>
#define rep(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define inf long_min
using namespace std;
typedef long long ll;

string s;
bool op_pri[3][256];
int p;

ll calc(ll n1, char op, ll n2) {
  switch(op) {
    case '*': return n1 * n2;
    case '+': return n1 + n2;
    case '-': return n1 - n2;
  }
  return 0;
}

ll number() {
  ll ret = 0;
  while(p < s.size() && '0' <= s[p] && s[p] <= '9') ret = ret * 10 + (s[p++] - '0');
  return ret;
}

ll expr(int level) {
  ll ret;
  char op;
  if(level < 3) {
    ret = expr(level + 1);
    while(p < s.size() && op_pri[level][s[p]]) {
      op = s[p++];
      ret = calc(ret, op, expr(level + 1));
    }
  } else {
    if(s[p] == '(') {
      p++;
      ret = expr(0);
      p++;
    } else {
      ret = number();
    }
  }
  return ret;
}

int main(void) {
  cin >> s;

  string pri = "*+-||";
  ll ans = -inf;
  ll ret;
  do {
    rep(i, 0, 3) rep(j, 0, 256) op_pri[i][j] = false;
    int k = 0;
    bool f = true;
    int cnt = 0;
    rep(i, 0, pri.size()) {
      if(pri[i] != '|') {
        op_pri[2 - k][pri[i]] = true;
        cnt++;
      } else {
        k++;
      }
    }

    p = 0;
    ret = expr(0);
    ans = max(ans, ret);
  } while(next_permutation(pri.begin(), pri.end()));
  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: 'long_min' was not declared in this scope
    5 | #define inf long_min
      |             ^~~~~~~~
a.cc:53:13: note: in expansion of macro 'inf'
   53 |   ll ans = -inf;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
ll B=1e8+7;
vector<int> hs;
bool ok[300000];
string s,t;
int N,K;
void solve(ll mod){
	ll ex=1,exh=1;
	rep(i,K) exh=exh*B%mod;
	rep(i,N){
		for(int j=-25;j<=25;j++){
			if(j==0) continue;
			ll x=ex*j%mod;
			if(x<0) x+=mod;
			hs.pb(x);
		}
		ex=ex*B%mod;
	}
	sort(all(hs));
	ll H=0;
	rep(i,K) H=(H*B+t[i])%mod;
	ll h=0;
	rep(i,K) h=(h*B+s[i])%mod;
	rep(i,N-K+1){
		ll d=(H-h)%mod;
		if(d<0) d+=mod;
		if(!binary_search(all(hs),d)) ok[i]=0;
		h=h*B-exh*s[i]+s[i+K];
		h%=mod;
		if(h<0) h+=mod;
	}
}
int main(){
	cin>>s>>t;
	N=s.size(),K=t.size();
	rep(i,N-K+1) ok[i]=1;
	int mods[2]={1e9+7,1e9+9};
	rep(i,2){
		hs.clear();
		solve(mods[i]);
	}
	int ans=0;
	rep(i,N-K+1) if(ok[i]) ans++;
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:25: error: narrowing conversion of '1.000000007e+9' from 'double' to 'int' [-Wnarrowing]
   48 |         int mods[2]={1e9+7,1e9+9};
      |                      ~~~^~
a.cc:48:31: error: narrowing conversion of '1.000000009e+9' from 'double' to 'int' [-Wnarrowing]
   48 |         int mods[2]={1e9+7,1e9+9};
      |                            ~~~^~
Language: C++

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

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()

vector<int> calc_z(string s) {
	int n = s.size();
	vector<int> z(n, 0);
	int l = 0, r = 0;
	for(int i = 1; i < s.size(); i++) {
		if(i > r) {
			l = r = i;
			while(r < n && s[r - l] == s[r]) r++;
			z[i] = r - l;
			r--;
		}
		else {
			if(z[i - l] < r - i + 1) {
				z[i] = z[i - l];
			}
			else {
				l = i;
				r++;
				while(r < n && s[r - l] == s[r]) r++;
				z[i] = r - l;
				r--;
			}
		}
	}
	return z;
}
int main() {
	string s, t;
	cin >> s >> t;
	string a = t + s;
	nn = a.size();
	int n = s.size();
	int m = t.size();
	int ans = 0;
	reverse(ALL(t));
	reverse(ALL(s));
	string b = t + s;
	vector<int> z1 = calc_z(a);
	vector<int> z2 = calc_z(b);
	rep(i, n) {
		if(i + m - 1 >= n) break;
		int l = z1[m + i];
		int r = z2[n - i];
		if(l + r + 1 == m) ans++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'nn' was not declared in this scope; did you mean 'yn'?
   38 |         nn = a.size();
      |         ^~
      |         yn
Language: C++

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

#ifdef BTK
#include<dvector.h>
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define DEBUG if(0)
#endif

#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

namespace roll{
    using H = unsigned long long;
    constexpr H mod = 14414443;
                     //0123456789
    constexpr H p[] = {90001,
                       1000000007,
                       90001};
    constexpr int MX = 1123456;
    H hs[3][MX];
    H rh[3][MX];
    template<int m = 1>
    void build(const string s){
        const int n = s.size();
        REP(i,m){
            hs[i][0] = 0;
            rh[i][0] = 1;
            REP(i,m)REP(j,n){
                hs[i][j+1] = (hs[i][j]*p[i] + s[j])%mod;
                rh[i][j+1] = (rh[i][j]*p[i])%mod;
            }
        }
    }
    template<int m = 1>
    H get(const int l,const int r){
        H ret = 0;
        REP(i,m){
            ret ^= (mod+hs[i][r] - hs[i][l] * rh[i][r-l]%mod)%mod;
        }
        return ret;
    }
}
typedef roll::H H;
int n,m;
int main(){
    string s,t;
    cin>>s>>t;
    n=s.size();
    m=t.size();
    roll::build(t);
    H base = roll::get(0,m);
    roll::build(s);
    LL ret=0;
    unordered_map<H,int> memo;
    REP(i,n-m+1){
        memo[(roll::mod+roll::get(i,i+m)-base)%roll::mod]++;
    }
    string u(m,'b'-'a');
    roll::build(u);
    REP(i,m){
        H diff = (roll::mod+roll::get(0,i+1)-roll::get(0,i))roll::%mod;
        FOR(k,'a','z'+1)if(k!=t[i]){
            H td = (roll::mod+diff*k%roll::mod-diff*t[i]%roll::mod)%roll::mod;
            if(memo.count(td)){
                ret+=memo[td];
            }
        }
    }
    cout<<ret<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:61: error: expected ',' or ';' before 'roll'
   85 |         H diff = (roll::mod+roll::get(0,i+1)-roll::get(0,i))roll::%mod;
      |                                                             ^~~~
Language: C++

#include <map>
#include <queue>
#include <algorithm>
#include <cstdio>
using namespace std;
#define INF 99999999

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef map<int,Edges> Graph;

void shortestPath(Graph &g, int s,
    map<int,Weight> &dist, map<int,int> &prev) {
  int n = g.size();
  for(auto &f:g)dist[f.first]=INF; dist[s] = 0;
  priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
    Edge e = Q.top(); Q.pop();
    if (prev.find(e.dst) != prev.end()) continue;
    prev[e.dst] = e.src;
    for(auto &f:g[e.dst]) {
      if (dist[f.dst] > e.weight+f.weight) {
        dist[f.dst] = e.weight+f.weight;
        Q.push(Edge(f.src, f.dst, e.weight+f.weight));
      }
    }
  }
}

char buf[101];
int W;
int coor(int x,int y){return (y)*(W*2+2)+x;}
int main(){
	int H,N,X1,Y1,X2,Y2;
	scanf("%d%d%d%d%d%d%d",&H,&W,&N,&X1,&Y1,&X2,&Y2);
	X1=coor(X1*2,Y1*2),X2=coor(X2*2,Y2*2);
	vector<vector<int> >m(H*2+1);
	for(auto &&e:m)e.resize(W*2+1);
	for(int i=0;i<N;i++){
		int x,y,t,l;
		scanf("%d%d%d%s",&x,&y,&t,buf);
		l=strlen(buf);
		x=2*x+1,y=2*y+1;
		for(int j=0;j<t;j++){
			for(int k=0;k<l;k++){
				int c=buf[k];
				if(c=='L'&&1<x)m[y][x-1]++,x-=2;
				if(c=='U'&&1<y)m[y-1][x]++,y-=2;
				if(c=='R'&&x<W*2)m[y][x+1]++,x+=2;
				if(c=='D'&&y<H*2)m[y+1][x]++,y+=2;
			}
		}
	}
	Graph g;
	for(int h=0;h<=H*2;h+=2)for(int w=0;w<=W*2;w+=2){
		int a=coor(w,h),b;
		if(h<H*2)b=coor(w,h+2),g[a].push_back(Edge(a,b,m[h+1][w])),g[b].push_back(Edge(b,a,m[h+1][w]));
		if(w<W*2)b=coor(w+2,h),g[a].push_back(Edge(a,b,m[h][w+1])),g[b].push_back(Edge(b,a,m[h][w+1]));
	}
	map<int,Weight> dist;
	map<int,int> prev;
	shortestPath(g,X1,dist,prev);
	printf("%d\n",dist[X2]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:19: error: 'strlen' was not declared in this scope
   52 |                 l=strlen(buf);
      |                   ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <cstdio>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

n = gets.to_i
c = Hash.new(0)
n.times do
    x, y, w = gets.split.map(&:to_i)
    c[[x,y]] = w
end
max = 0
c.each do |k,v|
    sum = v + c[[k[0]+1, k[1]]] + c[[k[0], k[1]+1]] + c[[k[0]+1, k[1]+1]]
    max = sum if sum > max
end
puts "#{max} / 1"

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.to_i
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;tuple<int,int,int>x[1<<17];int n,m,a,b,c,s,h,i,j,k;int dx[2][3]={{1,1,0},{0,-1,-1}},dy[2][3]={{0,1,1},{1,1,0}};main(){cin>>n;for(i=0;i<n;i++){cin>>a>>b>>c;x[i]=make_tuple(a,b,c);}sort(x,x+n);for(i=0;i<n;i++){for(h=0;h<2;h++){for(j=0;j<8;j++){s=0;for(k=0;k<3;k++){if((j/(1<<k))%2==0){c=lower_bound(x,x+n,make_tuple(get<0>(x[i])+dx[h][k],get<1>(x[i])+dy[h][k],0))-x;if(get<0>(x[c])==get<0>(x[i])+dx[h][k]&&get<1>(x[c])==get<1>(x[i])+dy[h][k]){s+=get<2>(x[c]);}}}m=max(maxn,s+get<2>(x[i]));}}}cout<<m<<" / 1"<<endl;}

Compiler output:
a.cc:2:132: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;tuple<int,int,int>x[1<<17];int n,m,a,b,c,s,h,i,j,k;int dx[2][3]={{1,1,0},{0,-1,-1}},dy[2][3]={{0,1,1},{1,1,0}};main(){cin>>n;for(i=0;i<n;i++){cin>>a>>b>>c;x[i]=make_tuple(a,b,c);}sort(x,x+n);for(i=0;i<n;i++){for(h=0;h<2;h++){for(j=0;j<8;j++){s=0;for(k=0;k<3;k++){if((j/(1<<k))%2==0){c=lower_bound(x,x+n,make_tuple(get<0>(x[i])+dx[h][k],get<1>(x[i])+dy[h][k],0))-x;if(get<0>(x[c])==get<0>(x[i])+dx[h][k]&&get<1>(x[c])==get<1>(x[i])+dy[h][k]){s+=get<2>(x[c]);}}}m=max(maxn,s+get<2>(x[i]));}}}cout<<m<<" / 1"<<endl;}
      |                                                                                                                                    ^~~~
a.cc: In function 'int main()':
a.cc:2:487: error: 'maxn' was not declared in this scope; did you mean 'main'?
    2 | using namespace std;tuple<int,int,int>x[1<<17];int n,m,a,b,c,s,h,i,j,k;int dx[2][3]={{1,1,0},{0,-1,-1}},dy[2][3]={{0,1,1},{1,1,0}};main(){cin>>n;for(i=0;i<n;i++){cin>>a>>b>>c;x[i]=make_tuple(a,b,c);}sort(x,x+n);for(i=0;i<n;i++){for(h=0;h<2;h++){for(j=0;j<8;j++){s=0;for(k=0;k<3;k++){if((j/(1<<k))%2==0){c=lower_bound(x,x+n,make_tuple(get<0>(x[i])+dx[h][k],get<1>(x[i])+dy[h][k],0))-x;if(get<0>(x[c])==get<0>(x[i])+dx[h][k]&&get<1>(x[c])==get<1>(x[i])+dy[h][k]){s+=get<2>(x[c]);}}}m=max(maxn,s+get<2>(x[i]));}}}cout<<m<<" / 1"<<endl;}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ^~~~
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       main
Language: C++

#include <bits/stdc++.h>using namespace std;int main(){int N;cin >> N;map<pair<int, int>, int> mp;for (int i = 0, y, x, w; i < N; i++) cin >> y >> x >> w, mp[{y, x}] += w, mp[{y - 1, x}] += w, mp[{y, x - 1}] += w, mp[{y - 1, x - 1}] += w;int ans = 0;for (const auto& p : mp) ans = max(ans, p.second);cout << ans << " / " << 1 << endl;return 0;}


Compiler output:
a.cc:1:31: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>using namespace std;int main(){int N;cin >> N;map<pair<int, int>, int> mp;for (int i = 0, y, x, w; i < N; i++) cin >> y >> x >> w, mp[{y, x}] += w, mp[{y - 1, x}] += w, mp[{y, x - 1}] += w, mp[{y - 1, x - 1}] += w;int ans = 0;for (const auto& p : mp) ans = max(ans, p.second);cout << ans << " / " << 1 << endl;return 0;}
      |                               ^~~~~~~~~
a.cc:1:10: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include <bits/stdc++.h>using namespace std;int main(){int N;cin >> N;map<pair<int, int>, int> mp;for (int i = 0, y, x, w; i < N; i++) cin >> y >> x >> w, mp[{y, x}] += w, mp[{y - 1, x}] += w, mp[{y, x - 1}] += w, mp[{y - 1, x - 1}] += w;int ans = 0;for (const auto& p : mp) ans = max(ans, p.second);cout << ans << " / " << 1 << endl;return 0;}
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

struct Node {
	int value;
	vector<int>edges;
	Node() :value(0), edges() {

	}
};
struct aa {
	int value;
	int amin;
	int amax;
};
map<int, int>mp;

aa memo[100][202][202];
aa getans(const int now,const vector<Node>&ns,const int alp,const int bet) {
	if (memo[now][mp[alp]][mp[bet]].amax != -1)return memo[now][mp[alp]][mp[bet]];
	else {
		Node no(ns[now]);
		if (no.edges.empty())return memo[now][mp[alp]][mp[bet]]=aa{ ns[now].value,1,1 };
		else {
			int realvalue = -1e9;
			{
				int nalp = alp;
				int nbet = bet;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[i], ns, -nbet, -nalp);
					realvalue = max(realvalue, -ans.value);
				}
			}
			aa ret{ realvalue,1e9,-1e9 };
			vector<int>perms(no.edges.size());
			iota(perms.begin(), perms.end(), 0);
			do {
				int amintime = 0;
				int nalp = alp;
				int nbet = bet;
				int amaxtime = 0;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[perms[i]], ns, -nbet, -nalp);
					amintime += ans.amin;
					amaxtime += ans.amax;
					if (-ans.value >= nbet) {
						break;
					}
					else if (-ans.value > nalp) {
						nalp = -ans.value;
					}
				}
				ret.amin = min(ret.amin, amintime);
				ret.amax = max(ret.amax, amaxtime);
			} while (next_permutation(perms.begin(), perms.end()));
			return memo[now][mp[alp]][mp[bet]]=ret;
		}
	}
}

int main() {
	int N; cin >> N;
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 202; ++j) {
			for (int k = 0; k < 202; ++k) {
				memo[i][j][k] = aa{ -1,-1,-1 };
			}
		}
	}
	vector<Node>nodes(N);
	vector<int>nums;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		nodes[i].value = a;
		nums.emplace_back(a);
		nums.emplace_back(-a);
	}
	nums.emplace_back(int(1e9));
	nums.emplace_back(int(-1e9));
	sort(nums.begin(), nums.end());
	nums.erase(unique(nums.begin(), nums.end()), nums.end());
	for (int i = 0; i < nums.size(); ++i) {
		mp[nums[i]] = i;
	}
	for (int i = 0; i < N; ++i) {
		int k; cin >> k;
		for (int j = 0; j < k; ++j) {
			int a; cin >> a; a--;
			nodes[i].edges.push_back(a);
		}
	}
	aa ans=getans(0, nodes, -1e9, 1e9);
	cout << ans.amin <<" "<< ans.amax<< endl; 
	return 0;
}

Compiler output:
a.cc: In function 'aa getans(int, const std::vector<Node>&, int, int)':
a.cc:43:43: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   43 |                         aa ret{ realvalue,1e9,-1e9 };
      |                                           ^~~
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

struct Node {
	int value;
	vector<int>edges;
	Node() :value(0), edges() {

	}
};
struct aa {
	int value;
	int amin;
	int amax;
};
map<int, int>mp;

aa memo[100][202][202];
aa getans(const int now,const vector<Node>&ns,const int alp,const int bet) {
	if (memo[now][mp[alp]][mp[bet]].amax != -1)return memo[now][mp[alp]][mp[bet]];
	else {
		Node no(ns[now]);
		if (no.edges.empty())return memo[now][mp[alp]][mp[bet]]=aa{ ns[now].value,1,1 };
		else {
			int realvalue = -1e9;
			{
				int nalp = alp;
				int nbet = bet;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[i], ns, -nbet, -nalp);
					realvalue = max(realvalue, -ans.value);
				}
			}
			aa ret{ realvalue,1e9,-1e9 };
			vector<int>perms(no.edges.size());
			iota(perms.begin(), perms.end(), 0);
			do {
				int amintime = 0;
				int nalp = alp;
				int nbet = bet;
				int amaxtime = 0;
				for (int i = 0; i < no.edges.size(); ++i) {
					aa ans = getans(no.edges[perms[i]], ns, -nbet, -nalp);
					amintime += ans.amin;
					amaxtime += ans.amax;
					if (-ans.value >= nbet) {
						break;
					}
					else if (-ans.value > nalp) {
						nalp = -ans.value;
					}
				}
				ret.amin = min(ret.amin, amintime);
				ret.amax = max(ret.amax, amaxtime);
			} while (next_permutation(perms.begin(), perms.end()));
			return memo[now][mp[alp]][mp[bet]]=ret;
		}
	}
}

int main() {
	int N; cin >> N;
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 202; ++j) {
			for (int k = 0; k < 202; ++k) {
				memo[i][j][k] = aa{ -1,-1,-1 };
			}
		}
	}
	vector<Node>nodes(N);
	vector<int>nums;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		nodes[i].value = a;
		nums.emplace_back(a);
		nums.emplace_back(-a);
	}
	nums.emplace_back(int(1e9));
	nums.emplace_back(int(-1e9));
	sort(nums.begin(), nums.end());
	nums.erase(unique(nums.begin(), nums.end()), nums.end());
	for (int i = 0; i < nums.size(); ++i) {
		mp[nums[i]] = i;
	}
	for (int i = 0; i < N; ++i) {
		int k; cin >> k;
		for (int j = 0; j < k; ++j) {
			int a; cin >> a; a--;
			nodes[i].edges.push_back(a);
		}
	}
	aa ans=getans(0, nodes, int(-1e9), int(1e9));
	cout << ans.amin <<" "<< ans.amax<< endl; 
	return 0;
}

Compiler output:
a.cc: In function 'aa getans(int, const std::vector<Node>&, int, int)':
a.cc:43:43: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   43 |                         aa ret{ realvalue,1e9,-1e9 };
      |                                           ^~~
Language: C++

#include <map>
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
int n, p[109]; vector<int> G[109];
void calc_evaluation(int pos) {
	if (G[pos].size() == 0) return;
	p[pos] = -999999999;
	for (int i : G[pos]) {
		calc_evaluation(i);
		p[pos] = max(p[pos], -p[i]);
	}
}
map<vector<int>, int> dp1, dp2;
void solve(int pos, int alpha, int beta) {
	if (G[pos].size() == 0) {
		dp1[{pos, alpha, beta}] = 1;
		dp2[{pos, alpha, beta}] = 1;
		return;
	}
	vector<int> perm(G[pos].size());
	for (int i = 0; i < perm.size(); i++) perm[i] = i;
	int ret1 = 999999999, ret2 = 0;
	do {
		int alpha2 = alpha, beta2 = beta, cnt_min = 0, cnt_max = 0;
		for (int i = 0; i < perm.size(); i++) {
			int chl = G[pos][perm[i]];
			int val = -p[chl];
			solve(chl, -beta2, -alpha2);
			cnt_min += dp1[{chl, -beta2, -alpha2}];
			cnt_max += dp2[{chl, -beta2, -alpha2}];
			if (val >= beta2) break;
			alpha2 = max(val, alpha2);
		}
		ret1 = min(ret1, cnt_min);
		ret2 = max(ret2, cnt_max);
	} while (next_permutation(perm.begin(), perm.end()));
	dp1[{pos, alpha, beta}] = ret1;
	dp2[{pos, alpha, beta}] = ret2;
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> p[i];
	for (int i = 0; i < n; i++) {
		int c, x; cin >> c;
		for (int j = 0; j < c; j++) {
			cin >> x; x--;
			G[i].push_back(x);
		}
	}
	calc_evaluation(0);
	solve(0, -999999999, 999999999);
	cout << dp1[{0, -999999999, 999999999}] << ' ' << dp2[{0, -999999999, 999999999}];
	return 0;
}

Compiler output:
a.cc: In function 'void solve(int, int, int)':
a.cc:38:18: error: 'next_permutation' was not declared in this scope
   38 |         } while (next_permutation(perm.begin(), perm.end()));
      |                  ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef int ll;
typedef pair<ll,ll> P;

const ll INF = 1e8;
struct edge{ll to,cap,cost,rev;};

ll V,E,tmpE;
vector<edge> g[1100];
ll dist[1100];
ll prevv[1100], preve[1100];
bool use[1100][1100];

void add_edge(ll from, ll to, ll cap, ll cost){
  g[from].push_back((edge){to, cap, cost, g[to].size()});
  g[to].push_back((edge){from, 0, -cost, g[from].size()-1});
}

ll min_cost_flow(ll s, ll t){
  ll res = 0;
  while(true){
    fill(dist,dist+V+1,INF);
    dist[s] = 0;

    queue<P> q;
    q.push(P(0,s));
    while(q.size()){
      P p = q.front(); q.pop();
      int v = p.second;
      if(dist[v] > p.first)break;

      update = false;
      for(int v=0;v<=V;v++){
	if(dist[v] == INF)continue;
	for(int i=0;i<(int)g[v].size();i++){
	  edge &e = g[v][i];
	  if(e.cap > 0 && dist[e.to] > dist[v] + e.cost){
	    dist[e.to] = dist[v] + e.cost;
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    update = true;
	  }
	}
      }
    }

    if(dist[t]>=0)return res + INF*E;

    ll d = INF;
    for(int v=t;v!=s;v=prevv[v]){
      d = min(d, g[prevv[v]][preve[v]].cap);
    }

    res += d*dist[t];
    for(int v=t;v!=s;v=prevv[v]){
      edge &e = g[prevv[v]][preve[v]];
      e.cap -= d;
      g[v][e.rev].cap += d;
    }
  }
  return res;
}

ll k[1100];
ll t[1100][55], c[1100][55];

int main(){
  cin >> V;
  E = 0;
  for(int i=0;i<V;i++){
    cin >> k[i];
    E += k[i];
    for(int j=0;j<k[i];j++){
      cin >> t[i][j] >> c[i][j];
      add_edge(i+1,t[i][j],INF,c[i][j]);
      add_edge(i+1,t[i][j],1,c[i][j] - INF);
    }
    add_edge(i+1,0,INF,0);
  }

  ll res = min_cost_flow(1,0);
  cout << res << endl;
}

Compiler output:
a.cc: In function 'void add_edge(ll, ll, ll, ll)':
a.cc:20:53: warning: narrowing conversion of 'g[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'll' {aka 'int'} [-Wnarrowing]
   20 |   g[from].push_back((edge){to, cap, cost, g[to].size()});
      |                                           ~~~~~~~~~~^~
a.cc:21:56: warning: narrowing conversion of '(g[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'll' {aka 'int'} [-Wnarrowing]
   21 |   g[to].push_back((edge){from, 0, -cost, g[from].size()-1});
      |                                          ~~~~~~~~~~~~~~^~
a.cc: In function 'll min_cost_flow(ll, ll)':
a.cc:37:7: error: 'update' was not declared in this scope
   37 |       update = false;
      |       ^~~~~~
Language: C

#include <stdio.h>
#include <math.h>
int main(){
	double d;
	scanf("%lf",&d);
	c=sqrt(d);
	if(c<sqrt(d*d+1)&&c<d+1)c=d+1;
	printf("%f\n",c);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:9: error: 'c' undeclared (first use in this function)
    6 |         c=sqrt(d);
      |         ^
main.c:6:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    double d;
    cin >> d;
    double ans = max(d * sqrt(2), (int)d + 1.0);
 
    printf("%.12f\n", ans);
}


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

#include<bits/stdc++.h>
using namespace std;double n;
main(){cin>>n;printf("%d9f\n",max(2,n*sqrt(2)));}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){cin>>n;printf("%d9f\n",max(2,n*sqrt(2)));}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:34: error: no matching function for call to 'max(int, double)'
    3 | main(){cin>>n;printf("%d9f\n",max(2,n*sqrt(2)));}
      |                               ~~~^~~~~~~~~~~~~
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: '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:3:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
    3 | main(){cin>>n;printf("%d9f\n",max(2,n*sqrt(2)));}
      |                               ~~~^~~~~~~~~~~~~
/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:3:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    3 | main(){cin>>n;printf("%d9f\n",max(2,n*sqrt(2)));}
      |                               ~~~^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;double n;
main(){cin>>n;printf("%d99f\n",max(2,n*sqrt(2)));}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){cin>>n;printf("%d99f\n",max(2,n*sqrt(2)));}
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:35: error: no matching function for call to 'max(int, double)'
    3 | main(){cin>>n;printf("%d99f\n",max(2,n*sqrt(2)));}
      |                                ~~~^~~~~~~~~~~~~
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: '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:3:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
    3 | main(){cin>>n;printf("%d99f\n",max(2,n*sqrt(2)));}
      |                                ~~~^~~~~~~~~~~~~
/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:3:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    3 | main(){cin>>n;printf("%d99f\n",max(2,n*sqrt(2)));}
      |                                ~~~^~~~~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
ld eps = 1e-9;

int main() {
	ld d; cin >> d;
	ld ans = d*sqrt(2);
	for (int i = 0; i < d+eps; ++i) {
		ld x = sqrt(d*d - i*i);
		ans = max(ans, ld(i) + 1);
	}
	cout << setprecision(22) << fixed<<ans<< << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:50: error: expected primary-expression before '<<' token
   18 |         cout << setprecision(22) << fixed<<ans<< << endl;
      |                                                  ^~