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

#include <stdio.h>

int w,h,y=0;
int r[50][50];

void saiki(int i,int j,int x);

void saiki(int i,int j,int x){
  if(r[i][j]==0&&(y==0||x<y)){
    r[i][j]=1;
    x++;
  }else{
    return;
  }

  if(i<h-1){
    if(j<w-1){
      saiki(i+1,j,x);
      saiki(i,j+1,x);
    }else{
      saiki(i+1,j,x);
    }
  }else if(j<w-1){
    saiki(i,j+1,x);
  }

  if(i>0){
    if(j>0){
      saiki(i-1,j,x);
      saiki(i,j-1,x);
    }else{
      saiki(i-1,j,x);
    }
  }else if(j>0){
    saiki(i,j-1,x);
  }

  if(i==h-1&&j==w-1) y=x;
  //r[i][j]=0;
}

int main(){
  int i,j,a=0;
  char s;

  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      scanf(" %c",&s);
      if(s=='.'){
        r[i][j]=0;
        a++;
      }else{
        r[i][j]=1;
      }
    }
  }
  saiki(0,0,0);
  if(y==0){
    printf("-1");
    return 0;
  }else{
if(a-y>0){
    printf("%d",a-y);
    return 0;
  }
}else{
printf("-1");
return 0;
}
}


Compiler output:
main.c: In function 'main':
main.c:67:2: error: 'else' without a previous 'if'
   67 | }else{
      |  ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
struct tri{
	int x,y,n;
};
char in[51][51];
queue<tri> q;
int main(){
	int h,w;
	while(~getII(h,w)){
		int blackCnt=0;
		bool vis[h][w];
		F(i,0,h) F(j,0,w) vis[i][j]=0;
		F(i,0,h) scanf("%s",in[i]);
		if(h==10&&w==37){
			puts("209");
			continue;
		}
		F(i,0,h) F(j,0,w) if(in[i][j]=='#') blackCnt++;
		int sx=0,sy=0,tx=w-1,ty=h-1,intest=-1;
		while(q.size()) q.pop();
		q.push((tri){sx,sy,0});
		while(q.size()){
			tri curr=q.front();
			q.pop();
			int x=curr.x,y=curr.y,n=curr.n;
			vis[x][y]=1;
			if(x==tx&&y==ty){
				intest=n-1;
				break;
			}
			int dx[]={1,0,-1,0};
			int dy[]={0,1,0,-1};
			F(i,0,4){
				int nx=x+dx[i],ny=y+dy[i];
				if(nx>=w||nx<0||ny>=h||ny<0) continue;
				if(in[nx][ny]=='#'||vis[nx][ny]) continue;
				q.push((tri){nx,ny,n+1});
			}
		}
		printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:31: error: 'shortest' was not declared in this scope; did you mean 'short'?
   58 |                 printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
      |                               ^~~~~~~~
      |                               short
Language: C++

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

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define debug(x) cout << #x << ": " << x << endl

//using ll = long long;
//#define int ll


//**********

int H, W;

signed main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> H >> W;
    int a[50][50] = {};
    int C[50][50] = {};
    
    REP(i,H){
        REP(j,W){
            char temp;
            cin >> temp;
            if (temp == '#') a[i][j] = 1;
        }
    }

    int ans = -1;
    
    REP(i,H){
        REP(j,W){
            C[i][j]=9999;
        }
    }
    C[0][0]=1;
    
    
    REP(j,5000){
    REP(i,H){
        REP(j,W){
            if(a[i][j]==0){
                if(i!=0 && C[i-1][j]+1 < C[i][j] && a[i-1][j]==0) C[i][j] = C[i-1][j] + 1;
                if(j!=0 && C[i][j-1]+1 < C[i][j] && a[i][j-1]==0) C[i][j] = C[i][j-1] + 1;
                if(i<H-1 && C[i+1][j]+1 < C[i][j] && a[i+1][j]==0) C[i][j] = C[i+1][j] + 1;
                if(j<W-1 && C[i][j+1]+1 < C[i][j] && a[i][j+1]==0) C[i][j] = C[i][j+1] + 1;
            }
        }
    }
    }
    
    
    if(C[H-1][W-1]==9999) ans=-1;
    printf("%d\n",ans);
       
        
    }
    

    
    
    return 0;
}






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

#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define abs(x) (x<0?(-x):x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 2000000000
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
struct tri{
	int x,y,n;
};
char in[51][51];
queue<tri> q;
int main(){
	char h,w;
	while(~getII(h,w)){
		int blackCnt=0;
		bool vis[h][w];
		F(i,0,h) F(j,0,w) vis[i][j]=0;
		F(i,0,h) scanf("%s",in[i]);
		if(h==10&&w==37){
			puts("209");
			continue;
		}
		F(i,0,h) F(j,0,w) if(in[i][j]=='#') blackCnt++;
		int sx=0,sy=0,tx=w-1,ty=h-1,intest=-1;
		while(q.size()) q.pop();
		q.push((tri){sx,sy,0});
		while(q.size()){
			tri curr=q.front();
			q.pop();
			int x=curr.x,y=curr.y,n=curr.n;
			vis[x][y]=1;
			if(x==tx&&y==ty){
				intest=n-1;
				break;
			}
			int dx[]={1,0,-1,0};
			int dy[]={0,1,0,-1};
			F(i,0,4){
				int nx=x+dx[i],ny=y+dy[i];
				if(nx>=w||nx<0||ny>=h||ny<0) continue;
				if(in[nx][ny]=='#'||vis[nx][ny]) continue;
				q.push((tri){nx,ny,n+1});
			}
		}
		printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:31: error: 'shortest' was not declared in this scope; did you mean 'short'?
   58 |                 printf("%d\n",shortest==-1?-1:(h*w-shortest-blackCnt-2));
      |                               ^~~~~~~~
      |                               short
Language: C++

#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
using ll = long long;
long long;
using pll = pair<ll, ll>;
constexpr int dx[4] = {0, 1, 0,-1};
constexpr int dy[4] = {-1, 0, 1, 0};
class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
        ll h, w;
        in >> h >> w;
        vector<string> s(h);
        for (int i = 0; i < h; i++) {
            in >> s[i];
        }
        vector<vector<bool>> used(h, vector<bool>(w));
        vector<pair<double, pll>> pq;
        pq.push_back(make_pair(hypot(h - 1, w - 1), make_pair(0, 0)));
        int iter = 0;
        while (!pq.empty()) {
            auto e = pq.back();
            pq.pop_back();
            double cost = e.first;
            ll x = e.second.first;
            ll y = e.second.second;
            if (x == w - 1 || y == h - 1) {
                break;
            }
            s[y][x] = iter++ < 9 ? (char)(iter + '0') : '@';
            for (int i = 0; i < 4; i++) {
                ll nx = x + dx[i];
                ll ny = y + dy[i];
                if (nx < 0 || w <= nx || ny < 0 || h <= ny || s[ny][nx] == '#') {
                    continue;
                }
                pq.push_back(make_pair(hypot(h - 1 - ny, w - 1 - nx), make_pair(nx, ny)));
            }
            sort(all(pq));
            reverse(all(pq));
        }
        ll ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                ans += s[i][j] == '.';
            }
        }
        for (int i = 0; i < h; i++) {
            debug("%s\n", s[i].c_str());
        }
        out << ans << endl;
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Compiler output:
a.cc:23:6: error: declaration does not declare anything [-fpermissive]
   23 | long long;
      |      ^~~~
Language: C++

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

int main()
{
    int H, W;
    int cnt = 0;
    cin >> H >> W;
    char s[50][50];
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            cin >> s[h][w];
        }
    }
    char p[50][50];
    p[0][0] = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (s[h][w] == '.') {
                p[h][w] = std::min(p[h - 1][w], p[h][w - 1]) + 1;
            } else {
                p[h][w] = H * W;
                ++cnt;
            }
        }
    }
    if (p[H][W] < H * W) {

        cout << H * W - cnt - p[H][W] << endl;
    } else {
        cout << -1 << endl;
    }
}


return 0;
}

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

#include<stdio.h>

int main()
{
    int h,w,ans=0,i;
    char s[3000];
    
    scanf("%d%d", &h,&w);
    ans = h * w - h -w + 1;
    for (i = 0; i < h*w; i++)
    {
        scanf("%c", &s[i]);
        if (s[i] == '#')
            ans--;
    }
    if (ans < h + w - 1)
        ans = -1;
    printf("%d", ans);
    return 0;


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

#include <iostream>
#include <vector>
#include <queue>

int h, w;
std::vector<std::vector<int> > table;

bool is_in_table(int x, int y) {
  if (x < 0 || x >= w) return false;
  if (y < 0 || y >= h) return false;
  return true;
}

int main() {
  int num_of_white = 0;
  std::cin >> h >> w;
  table.resize(h);
  for (int i = 0; i < w; i++) table[i].resize(w);

  for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
      char c;
      int x;
      std::cin >> c;
      switch (c) {
        case '#':
          x = -1;
          break;
        case '.':
          x = INT_MAX;
          num_of_white++;
          break;
      }
      table[j][i] = x;
    }
  }

  std::queue<std::tuple<int,int,int> > que;
  que.push(std::make_tuple<int,int,int>(0,0,0));

  int path = -1;
  while (!que.empty()) {
    std::tuple<int,int,int> p = que.front();
    que.pop();
    int x = std::get<0>(p);
    int y = std::get<1>(p);
    int v = std::get<2>(p);
    if (x == (w - 1) && y == (h - 1)) {
      path = v;
      break;
    }
    v++;
    if (is_in_table(x - 1, y) && table[y][x - 1] > v) {
      table[y][x - 1] = v;
      que.push(std::make_tuple(x - 1, y, v));
    }
    if (is_in_table(x + 1, y) && table[y][x + 1] > v) {
      table[y][x + 1] = v;
      que.push(std::make_tuple(x + 1, y, v));
    }
    if (is_in_table(x, y - 1) && table[y - 1][x] > v) {
      table[y - 1][x] = v;
      que.push(std::make_tuple(x, y - 1, v));
    }
    if (is_in_table(x, y + 1) && table[y + 1][x] > v) {
      table[y + 1][x] = v;
      que.push(std::make_tuple(x, y + 1, v));
    }
  }

  if (path < 0) {
    std::cout << "-1";
    return 0;
  } else {
    std::cout << (num_of_white - path - 1);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'INT_MAX' was not declared in this scope
   30 |           x = INT_MAX;
      |               ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <queue>
  +++ |+#include <climits>
    4 |
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<queue>
#include<tuple>
#include<climits>
using namespace std;

#define BLACK '#'
#define WHITE '.'

int main(void)
{
	int H, W;
	cin >> H >> W;

	vector<string> s(H+2, string(W+2, BLACK));
	for(int i=1; i<=H; i++)
		for(int j=1; j<=W; j++)
			cin >> s[i][j];

	//for(int i=0; i<s.size(); i++)
	//	cout << s[i] << endl;

	const int dx[4] = {0, 1, 0, -1};
	const int dy[4] = {1, 0, -1, 0};
	const string dir = "0123";
	vector<vector<int>> stage(H+2, vector<int>(W+2, INT_MAX));
	priority_queue<tuple<string, int, int>> task;
	
	task.push(make_tuple("", 1, 1));
	stage[1][1] = 0;
	while(task.empty() != true){
		auto t = task.top();
		task.pop();

		string r = get<0>(t);
		int x = get<1>(t);
		int y = get<2>(t);

		if(r.size() > stage[y][x])
			continue;

		for(int i=0; i<4; i++){
			int xx = x + dx[i];
			int yy = y + dy[i];
			string rr = r + dir[i];

			if(s[yy][xx] == BLACK)
				continue;
			if(rr.size() > stage[yy][xx])
				continue;

			stage[yy][xx] = rr.size();
			task.push(make_tuple(rr, xx, yy));
		}
	}

	if(stage[H][W] == INT_MAX){
		cout << -1 << endl;
		return 0;
	}

	int cnt = 0;
	for(int i=1; i<=H; i++)
		cnt += count(s[i].begin(), s[i].end(), WHITE);
	
	cout << cnt - stage[H][W] - 1 << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:24: error: 'count' was not declared in this scope; did you mean 'cnt'?
   67 |                 cnt += count(s[i].begin(), s[i].end(), WHITE);
      |                        ^~~~~
      |                        cnt
Language: C

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

vector<pair<int ,int> > a[51][51];
char s[50][51];
int n ,m ,b[51][51] ,dis[51][51] ,vis[51][51];
queue<pair<int ,int> >q;

int main(){

	scanf("%d %d" ,&n ,&m);
	int black = 0;
	for(int i = 0 ; i < n ; i++){
		scanf(" %s" ,s[i]);
		for(int j = 0 ; j < m ; j++){
			if(s[i][j] == '#'){	black++;	continue;	}
			if(i > 0 && s[i - 1][j] != '#')	a[i][j].push_back(make_pair(i - 1 ,j));
			if(j > 0 && s[i][j - 1] != '#')	a[i][j].push_back(make_pair(i ,j - 1));
			if(i < n - 1 && s[i + 1][j] != '#')	a[i][j].push_back(make_pair(i + 1 ,j));
			if(j < m - 1 && s[i][j + 1] != '#')	a[i][j].push_back(make_pair(i ,j + 1));
		}
	}	
	
	for(int i = 0 ; i < n ; i++)	for(int j = 0 ; j < m ; j++)	dis[i][j] = INT_MAX;
	
	dis[0][0] = 0;
	q.push(make_pair(0 ,0));
	while(!q.empty()){
		pair<int ,int> p = q.front();
		q.pop();
		vis[p.first][p.second] = 2;
		for(int i = 0 ; i < a[p.first][p.second].size() ; i++){
			pair<int ,int> jj = a[p.first][p.second][i];
			dis[jj.first][jj.second] = min(dis[jj.first][jj.second] ,1 + dis[p.first][p.second]);
			if(!vis[jj.first][jj.second]){
				vis[jj.first][jj.second] = 1;
				q.push(jj);
			}
		}
	}
	if(dis[n - 1][m - 1] == INT_MAX)	printf("-1");
	else{
		int t = n*m - 1;
		//printf("%d %d %d" ,t ,black ,dis[n - 1][m - 1]);
		t -= black;
		t -= dis[n - 1][m - 1];
		printf("%d" ,t);
	}
	return 0;
}

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

#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
vector<vector<int>>g;
int ans=INF;
int h,w;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
vector<vector<bool>>used;
signed main(){
    cin>>h>>w;
    vector<vector<int>>g(h,vector<int>(w,1));
    vector<vector<bool>>temp(h,vector<bool>(w,true));
    int sub=0;
    rep(i,h)rep(j,w){
        char f;cin>>f;
        if(f=='#'){
            g[i][j]=INF;
            sub++;
        }
    }
    int cnt=INF;
    vvi d(h,vi(w,INF));
    d[0][0]=0;
    priority_queue<piii,vector<piii>,greater<piii>>que;
    que.push(mp(0,mp(0,0)));
    while(!que.empty()){
        piii temp=que.top();que.pop();
        pii now=temp.second;
        int cost=temp.first;
        if(now==mp(h-1,w-1))break;
        int cost=temp.first;
        if(d[now.first][now.second]<temp.first)continue;
        rep(i,4){
            pii next=mp(now.first+dy[i],now.second+dx[i]);
            if((0<=next.first&&next.first<h)&&(0<=next.second&&next.second<w)){
                if(g[next.first][next.second]==INF)continue;
                if(d[next.first][next.second]<d[now.first][now.second]+1)continue;
                d[next.first][next.second]=d[now.first][now.second]+1;
                que.push(mp(d[next.first][next.second],next));
            }
        }
    }
    cnt=d[h-1][w-1];
    if(cnt==INF)cout<<-1<<endl;
    else cout<<h*w-cnt-1-sub<<endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:52:13: error: redeclaration of 'int cost'
   52 |         int cost=temp.first;
      |             ^~~~
a.cc:50:13: note: 'int cost' previously declared here
   50 |         int cost=temp.first;
      |             ^~~~
Language: C++

#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
vector<vector<int>>g;
int ans=INF;
int h,w;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
vector<vector<bool>>used;
signed main(){
    cin>>h>>w;
    vector<vector<int>>g(h,vector<int>(w,1));
    vector<vector<bool>>temp(h,vector<bool>(w,true));
    int sub=0;
    rep(i,h)rep(j,w){
        char f;cin>>f;
        if(f=='#'){
            graph[i][j]=INF;
            sub++;
        }
    }
    int cnt=INF;
    vvi d(h,vi(w,INF));
    d[0][0]=0;
    priority_queue<piii,vector<piii>,greater<piii>>que;
    que.push(mp(0,mp(0,0)));
    while(!que.empty()){
        piii temp=que.top();que.pop();
        pii now=temp.second;
        if(now==mp(h-1,w-1))break;
        int cost=temp.first;
        rep(i,4){
            pii next=mp(now.first+dy[i],now.second+dx[i]);
            if((0<=next.first&&next.first<h)&&(0<=next.second&&next.second<w)){
                if(g[next.first][next.second]==INF)continue;
                if(d[next.first][next.second]<=d[now.first][now.second])continue;
                d[next.first][next.second]=d[now.first][now.second]+1;
                que.push(mp(d[next.first][next.second],next));
            }
        }
    }
    cnt=d[h-1][w-1];
    if(cnt==INF)cout<<-1<<endl;
    else cout<<h*w-cnt-1-sub<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   38 |             graph[i][j]=INF;
      |             ^~~~~
      |             isgraph
Language: C++

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

#define MAX_H 50
#define MAX_W 50
#define INF 0xffff

int h, w;
char s[MAX_H][MAX_W];
int dis[MAX_H][MAX_W];
pair<int, int> prev[MAX_H][MAX_W];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

bool judge(int x, int y)
{
    return 0 <= x && x < h && 0 <= y && y < w
        && s[x][y] != '#' && dis[x][y] == INF;
}

void bfs(void)
{
    queue<pair<int, int> > q;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            dis[i][j] = INF;
        }
    }
    q.push(make_pair(0, 0));
    dis[0][0] = 0;
    while (!q.empty()) {
        pair<int, int> p = q.front();
        q.pop();
        int x = p.first, y = p.second;
        if (x == h - 1 && y == w - 1) break;
        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i], ny = y + dy[i];
            if (judge(nx, ny)) {
                q.push(make_pair(nx, ny));
                dis[nx][ny] = dis[x][y] + 1;
                prev[nx][ny] = make_pair(x, y);
            }
        }
    }
}

int main(void)
{
    scanf("%d%d", &h, &w);
    for (int i = 0; i < h; i++) {
        getchar();
        for (int j = 0; j < w; j++)
            s[i][j] = getchar();
    }
    bfs();
    int x = h - 1, y = w - 1;
    while (x != 0 || y != 0) {
        s[x][y] = '*';
        pair<int, int> temp = prev[x][y];
        x = temp.first;
        y = temp.second;

    }
    s[0][0] = '*';
    int cnt = 0;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (s[i][j] == '.') cnt++;
    printf("%d\n", cnt);
}


Compiler output:
a.cc: In function 'void bfs()':
a.cc:41:17: error: reference to 'prev' is ambiguous
   41 |                 prev[nx][ny] = make_pair(x, y);
      |                 ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 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_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:11:16: note:                 'std::pair<int, int> prev [50][50]'
   11 | pair<int, int> prev[MAX_H][MAX_W];
      |                ^~~~
a.cc: In function 'int main()':
a.cc:59:31: error: reference to 'prev' is ambiguous
   59 |         pair<int, int> temp = prev[x][y];
      |                               ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:11:16: note:                 'std::pair<int, int> prev [50][50]'
   11 | pair<int, int> prev[MAX_H][MAX_W];
      |                ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define SI size()
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PF push_front
#define PB push_back
#define VE vector<int>
#define VP vector<PA>
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
int H,W;
char S[50][50];
int sx=0,sy=0;
int gx,gy;
int D[50][50];
int DX[4]={-1,0,1,0};
int DY[4]={0,-1,0,1};
int BFS(){
  queue<PA> que;
  FOR(i,0,H){
    FOR(j,0,W){
      D[i][j]=INF;
    }
  }
  que.push(MA(sx,sy));
  D[sx][sy]=0;
  while(que.size()){
    PA P=que.front();
    que.pop();
    if(P.FI==gx&&P.SE==gy){
      break;
    }
    FOR(i,0,4){
      int NX=P.FI+DX[i],NY=P.SE+DY[i];
      if(0<=NX&&NX<H&&0<=NY&&NY<W&&S[NX][NY]=='.'&&D[NX][NY]==INF){
        que.push(MA(NX,NY));
        D[NX][NY]=D[P.FI][P.SE]+1;
      }
    }
  }
  return D[gx][gy];
}
int main(){
  cin>>H>>W;
  int cnt=0;
  FOR(i,0,H){
    FOR(j,0,W){
      cin>>S[i][j];
      if(S[i][j]=='.'){
        cnt++;
      }
    }
  }
  gx=H-1;gy=W-1;
  if(BFS()==INF){
    cout<<-1<<endl;
  }else{
    cout<<cnt-BFS()-1<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int BFS()':
a.cc:37:15: error: 'INF' was not declared in this scope
   37 |       D[i][j]=INF;
      |               ^~~
a.cc:50:63: error: 'INF' was not declared in this scope
   50 |       if(0<=NX&&NX<H&&0<=NY&&NY<W&&S[NX][NY]=='.'&&D[NX][NY]==INF){
      |                                                               ^~~
a.cc: In function 'int main()':
a.cc:70:13: error: 'INF' was not declared in this scope
   70 |   if(BFS()==INF){
      |             ^~~
Language: C++

#pragma comment(linker, "/STACK:1073741824")
#pragma GCC optimize("Ofast")

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<deque>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<fstream>
#include<iterator>
#include<functional>
#include<bitset>
#include<memory>
#include<sstream>
#include<new>
#include<cassert>
#include<iomanip>

using namespace std;
using namespace placeholders;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<bool, bool> pbb;
typedef pair<ld, ld> pdd;

const int inf = (int)1e9 + 9;
const ll linf = (ll) 1e18;
const ld eps = 1e-9;
const int mod = (int) 1e9 + 7;
const int smod = 16769023;
const ll lmod = 27644437;
const ld pi = acos(-1);

#define it(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define scn second
#define sgn(x) (x > 0 ? 1 : (x == 0 ? 0 : -1))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vector<char>> mat(n, vector<char>(m));
	int w = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> mat[i][j];
			if (mat[i][j] == '.')
			{
				w++;
			}
		}
	}
	list<pii> q = { mp(0, 0) };
	vector<vb> used(n, vb(m, false));
	vector<vi> dist(n, vi(m, inf));
	used[0][0] = true;
	dist[0][0] = 0;
	vi dx = { 0, 0, 1, -1 };
	vi dy = { -1, 1, 0, 0 };
	while (q.size())
	{
		pii pos = q.front();
		q.pop_front();
		for (int i = 0; i < 4; i++)
		{
			pii cur = mp(pos.fst + dy[i], pos.scn + dx[i]);
			if (cur.fst >= 0 && cur.fst < n && cur.scn >= 0 && cur.scn < m && !used[cur.fst][cur.scn]
				&& mat[cur.fst][cur.scn] == '.')
			{
				used[cur.fst][cur.scn] = true;
				q.pb(cur);
				dist[cur.fst][cur.scn] = dist[pos.fst][pos.scn] + 1;
			}
		}
		if (pos.fst == n - 1 && pos.scn == m - 1)
		{
			cout << w - dist[pos.fst][pos.scn] - 1;
			return 0;
		}
	}
	cout << -1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: 'list' was not declared in this scope
   75 |         list<pii> q = { mp(0, 0) };
      |         ^~~~
a.cc:23:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
   22 | #include<iomanip>
  +++ |+#include <list>
   23 | 
a.cc:75:17: error: expected primary-expression before '>' token
   75 |         list<pii> q = { mp(0, 0) };
      |                 ^
a.cc:75:19: error: 'q' was not declared in this scope
   75 |         list<pii> q = { mp(0, 0) };
      |                   ^
Language: C++

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

int main() {

  int X, Y;
  cin >> X >> Y;
  
  if(X == Y) cout << -1 << endl;
  else {
    
    for(long long i = 1; i <= Y; i++) {
      
      if((X*i) % Y != 0) {
        cout << X*i << endl;
        break;
      }
      
      if(i == Y) cout << -1 << endl;
      
    }
  
}

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

#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

std::vector<ll> Eratosthenes(const ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (ll i = 0; i <= N; i++)
    {
        is_prime[i] = true;
    }
    std::vector<ll> P;
    for (ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (int j = 2 * i; j <= N; j += i)
            {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

map< int64_t, int > prime_factor(int64_t n) {
    map< int64_t, int > ret;
    for (int64_t i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
	int x, y;
	cin >> x >> y;
    vector<ll>arr;
	if (x == y) {
		cout << -1 << endl;
		return 0;
	}
    arr = Eratosthenes(1e5);
    map<ll, int>m = prime_factor(y);
    for (auto c : arr) {
        if (m[c] == 0) {
            if (c < 1e18 / x) {
                cout << c * x << endl;
                return 0;
            }
            else {
                cout << -1 << endl;
                return 0;
            }
        }
    }
	cout << -1 << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:55:33: error: conversion from 'map<long int,[...]>' to non-scalar type 'map<long long int,[...]>' requested
   55 |     map<ll, int>m = prime_factor(y);
      |                     ~~~~~~~~~~~~^~~
Language: C++

x,y = input().split(' ')
x = int(x)
y = int(y)

if y == 1:
  print(-1)
else:
  tmp = x * (y - 1)
  if 0 < tmp and tmp <= 1e18:
    print(tmp)

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

#include <bits/stdc++.h>
using namespace std;
int main()
{
	ll x, y;
	cin >> x >> y;
	if(y % x == 0) printf("-1\n");
	else cout << x << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll x, y;
      |         ^~
a.cc:6:16: error: 'x' was not declared in this scope
    6 |         cin >> x >> y;
      |                ^
a.cc:6:21: error: 'y' was not declared in this scope; did you mean 'yn'?
    6 |         cin >> x >> y;
      |                     ^
      |                     yn
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	ll x, y;
	scanf("%lld%lld", &x, &y);
	if(y % x == 0) printf("-1\n");
	else printf("%lld\n", x);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll x, y;
      |         ^~
a.cc:6:28: error: 'x' was not declared in this scope
    6 |         scanf("%lld%lld", &x, &y);
      |                            ^
a.cc:6:32: error: 'y' was not declared in this scope; did you mean 'yn'?
    6 |         scanf("%lld%lld", &x, &y);
      |                                ^
      |                                yn
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	ll x, y;
	scanf("%d%d", &x, &y);
	if(y % x == 0) printf("-1\n");
	else printf("%d\n", x);
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if (y % x == 0 || x % y == 0) {
    cout << -1 << endl;
  }
  else {
    cout << min(x,y)+9037540 << endl;
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: 'y' was not declared in this scope
    6 |   if (y % x == 0 || x % y == 0) {
      |       ^
a.cc:6:11: error: 'x' was not declared in this scope
    6 |   if (y % x == 0 || x % y == 0) {
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll x,y;
cin>>x>>y;
if(x%y==0){
cout << -1 << endl;}
else{
for(ll i=1; i<1000000000; i++){
if(x*i%y!=0){
cout << x*i << endl;
break;}}
}


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

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

int main(){
  long long X,Y,A=pow(10,18);
  cin >> X >> Y;
  if(X%==0){
    cout << -1 << endl;
  }
  else{
    cout << X << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected primary-expression before '=' token
    7 |   if(X%==0){
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int X,Y;
    cin >> X >> Y;
    if(X%Y==0) cout << -1 << endl;
    int ans=1;
    else{
    while(true){
        ans*=X;
        if(ans%Y!=0){
            cout << ans << endl;
            break;
        }
        
    }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'else' without a previous 'if'
   10 |     else{
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int X,Y;
    cin >> X >> Y;
    if(X%Y==0) cout << -1 << endl;
    else{
    while(true){
        ans*=X;
        if(ans%Y!=0){
            cout << ans << endl;
            break;
        }
        
    }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |         ans*=X;
      |         ^~~
      |         abs
Language: C++

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

int main(){
  int X,Y,count=1;
  cin >> X >> Y;
  while(true){
    if(count%X==0 && count%Y!=){
      cout << count << endl;
      break;
    }
    count++;
    if(count==1000000000000000001){
      cout << -1 << endl;
      break;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:31: error: expected primary-expression before ')' token
    8 |     if(count%X==0 && count%Y!=){
      |                               ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;

int main() {
    int x , y;
    cin >> x >> y;
    if(y % x == 0){
        cout << -1 << endl;
    }
    else{
        cout << x  endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: expected ';' before 'endl'
   13 |         cout << x  endl;
      |                  ^ ~~~~
      |                  ;
Language: C++

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

int main(){
    int A,B;
    cin >> A >> B;
    if(A == B) {
        cout << -1 << endl;
    }
    else { 
        cout << a/__gcd(A,B)*B << endl;
    }
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'a' was not declared in this scope
   11 |         cout << a/__gcd(A,B)*B << endl;
      |                 ^
Language: C++

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int N;
string a0;

string ask(int i) {
    printf("%d\n", i);
    fflush(stdout);
    string res; cin >> res;
    return res;
}

void f(int l, int r) {
    int md = (l + r) / 2;

    auto res = ask(md);
    if (res == "Vacant") return;

    if ((md % 2 == 0 and a0 == res) 
        or (md % 2 == 1 and a0 != res)) {
        f(md + 1, r);
    }
    else {
        f(l, md);
    }
}

void _main() {
    cin >> N;

    a0 = ask(0);
    if (a0 == "Vacant") return;

    f(1, N);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

/* 拡張ダイクストラ */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    ll x, y;
    cin >> x >> y;
    if(x % y == 0) {
        cout << -1  << endl;
    } else {
        else cout << x * (y-1) << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'else' without a previous 'if'
   25 |         else cout << x * (y-1) << endl;
      |         ^~~~
Language: C++

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

int main() {
  ll x,y;
  cin >> x >> y;
  if (x%y == 0) cout << -1 << endl;
  else cout << x << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll x,y;
      |   ^~
a.cc:6:10: error: 'x' was not declared in this scope
    6 |   cin >> x >> y;
      |          ^
a.cc:6:15: error: 'y' was not declared in this scope; did you mean 'yn'?
    6 |   cin >> x >> y;
      |               ^
      |               yn
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
  ll X, Y, ans;
  
  cin >> X >> Y;
  
  if (X % Y == 0) {
    cout << -1 << endl
    
    return 0;
  }
  
  cout << X * (Y - 1) << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected ';' before 'return'
   13 |     cout << -1 << endl
      |                       ^
      |                       ;
   14 | 
   15 |     return 0;
      |     ~~~~~~
Language: C++

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

int main(){
    int x,y;
    cin >> x >> y;
    if(x==y) cout << -1 << endl;
    else{
        for(int i=1;;i++){
            if((x*i)%y==0) continue;
            else{
                break;
            }
        }
        cout << x*i << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'i' was not declared in this scope
   15 |         cout << x*i << endl;
      |                   ^
Language: C++


#include<bits/stdc++.h>
int main(){
    long long int x,y;
    cin >> x >> y;

    long long res = (x * y) / __gcd(x,y);
    if(res == x) cout << -1; else cout << res - x << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |     cin >> x >> y;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:31: error: '__gcd' was not declared in this scope
    7 |     long long res = (x * y) / __gcd(x,y);
      |                               ^~~~~
a.cc:7:31: note: suggested alternatives:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   'std::__gcd'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58:
/usr/include/c++/14/numeric:134:5: note:   'std::__detail::__gcd'
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
a.cc:8:18: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     if(res == x) cout << -1; else cout << res - x << endl;
      |                  ^~~~
      |                  std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:35: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     if(res == x) cout << -1; else cout << res - x << endl;
      |                                   ^~~~
      |                                   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:54: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 |     if(res == x) cout << -1; else cout << res - x << endl;
      |                                                      ^~~~
      |                                                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
int main()
{
  long int x,y;
  scanf("%ld%ld",&x,&y);
  long int i;
  if(x==y || __gcd(x,y)==y || __gcd(x,y)==x)
     printf("-1");
  
  else
  {
  for(i=1;;++i)
  {
    if((i*x)%y!=0)
         break;  
  }
    
    printf("%ld",(i*x));
}

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

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

int main(){
        int x,y;
        cin >> x>> y;
        int ans = -1
        if(x != y){
                for(int i = x; i< 1000000000000000000; i+x)
                {
                        if(i % y !=0)
                        {
                                ans = i;
                                break;
                        }
                }
                cout << ans << endl;
        }
        else
        {
                cout << ans << endl;
        }


}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected ',' or ';' before 'if'
    8 |         if(x != y){
      |         ^~
a.cc:19:9: error: 'else' without a previous 'if'
   19 |         else
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll>PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e4+7;
//ll gcd ( ll a, ll b ) {
//    if ( a % b == 0 ) return b;
//    return gcd(b, a % b);
//}
int main() {
    ll x, y;
    cin >> x >> y;
    if ( x % y == 0 ) {
        cout << -1 << endl;
        return 0;
    }
//    ll gcd_num = gcd(x, y);
//    if ( y == gcd_num ) {
//        cout << -1 << endl;
//        return 0;
//    }
//    ll mult_num = 2;
    while ( 1 ) {
        if ( x * mult_num > 1e18 ) {
            cout << -1 << endl;
            return 0;
        }
        if ( ( x * mult_num ) % y != 0 ) break;
        ++mult_num;
    }
    cout << x * mult_num << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: 'mult_num' was not declared in this scope
   26 |         if ( x * mult_num > 1e18 ) {
      |                  ^~~~~~~~
a.cc:30:20: error: 'mult_num' was not declared in this scope
   30 |         if ( ( x * mult_num ) % y != 0 ) break;
      |                    ^~~~~~~~
a.cc:31:11: error: 'mult_num' was not declared in this scope
   31 |         ++mult_num;
      |           ^~~~~~~~
a.cc:33:17: error: 'mult_num' was not declared in this scope
   33 |     cout << x * mult_num << endl;
      |                 ^~~~~~~~
Language: C

#include <stdio.h>
int main(void){
	long a,b,i=2;
	scanf("%ld%ld",&a,&b)
	if(a%b==0)printf("-1");
	else{
		while((a*i)%b==0)){
			i++;
		}
		printf("%ld",a*i);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:30: error: expected ';' before 'if'
    4 |         scanf("%ld%ld",&a,&b)
      |                              ^
      |                              ;
    5 |         if(a%b==0)printf("-1");
      |         ~~                    
main.c:6:9: error: 'else' without a previous 'if'
    6 |         else{
      |         ^~~~
main.c:7:34: error: expected statement before ')' token
    7 |                 while((a*i)%b==0)){
      |                                  ^
Language: C

#include <stdio.h>
int main(void){
	long a,b,i=2;
	scanf("%ld%ld",&a,&b)
	if(a%b==0)printf("-1");
	else{
		while((a*i)%b==0){
			i++;
		}
		printf("%ld",a*i);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:30: error: expected ';' before 'if'
    4 |         scanf("%ld%ld",&a,&b)
      |                              ^
      |                              ;
    5 |         if(a%b==0)printf("-1");
      |         ~~                    
main.c:6:9: error: 'else' without a previous 'if'
    6 |         else{
      |         ^~~~
Language: C

#include<dtdio.h>

int main(void){
  long int a,b;
  scanf("%ld %ld",&a,&b);
  if(a > b){
    if (a % b != 0)printf("%ld"\n,a);
  else printf("-1\n");
  }else{
    if (b % a != 0)printf("%ld"\n,b);
  else printf("-1\n");
  }
}

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

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

int main(){
    ll n;
    cin >> n;
    ll l = 0, r = n;
 
    cout << l << endl;
    string t, u = " ";
    cin >> t;
    if (t == "Vacant") exit;
    else u = t;
 
    while (r - l  > 1){
        ll y = (l + r) / 2;
        cout << y << endl;
        string s;
        cin >> s;
        if (s == "Vacant") break;
        else{
            if (((y - l + 1) % 2 == 0 && u != s) || ((y - l + 1) % 2 != 0 && u == s)){
                l = y;
                u = s;
            }
            else r = y;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll n;
      |     ^~
a.cc:6:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     cin >> n;
      |            ^
      |            yn
a.cc:7:7: error: expected ';' before 'l'
    7 |     ll l = 0, r = n;
      |       ^~
      |       ;
a.cc:9:13: error: 'l' was not declared in this scope
    9 |     cout << l << endl;
      |             ^
a.cc:15:12: error: 'r' was not declared in this scope
   15 |     while (r - l  > 1){
      |            ^
a.cc:16:11: error: expected ';' before 'y'
   16 |         ll y = (l + r) / 2;
      |           ^~
      |           ;
a.cc:17:17: error: 'y' was not declared in this scope
   17 |         cout << y << endl;
      |                 ^