Language: C++

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>

int main(){
  while(1){
    int h,w;
    cin>>w>>h;
    if(h==0&&w==0) break;
    char a[h][w];
    queue<pair<int,int>> q;
    bool used[h][w];
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin>>a[i][j];
        used[i][j]=0;
        if(a[i][j]=='@') q.push(make_pair(i,j));
      }
    }
    int ans=0;
    while(!q.empty()){
      pair<int,int> p=q.front();
      q.pop();
      int x=p.first, y=p.second;
      if(used[x][y]) continue;
      used[x][y]=1;
      ans++;
      if(x>0){
        if(!used[x-1][y]&&a[x-1][y]=='.'){
          q.push(make_pair(x-1,y));
        }
      }
      if(x<h-1){
        if(!used[x+1][y]&&a[x+1][y]=='.'){
          q.push(make_pair(x+1,y));
        }
      }
      if(y>0){
        if(!used[x][y-1]&&a[x][y-1]=='.'){
          q.push(make_pair(x,y-1));
        }
      }
      if(y<w-1){
        if(!used[x][y+1]&&a[x][y+1]=='.'){
          q.push(make_pair(x,y+1));
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'cin' was not declared in this scope; did you mean 'sin'?
   21 |     cin>>w>>h;
      |     ^~~
      |     sin
a.cc:24:5: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   24 |     queue<pair<int,int>> q;
      |     ^~~~~
      |     std::queue
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:24:11: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   24 |     queue<pair<int,int>> q;
      |           ^~~~
      |           std::pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:24:16: error: expected primary-expression before 'int'
   24 |     queue<pair<int,int>> q;
      |                ^~~
a.cc:30:26: error: 'q' was not declared in this scope
   30 |         if(a[i][j]=='@') q.push(make_pair(i,j));
      |                          ^
a.cc:30:33: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   30 |         if(a[i][j]=='@') q.push(make_pair(i,j));
      |                                 ^~~~~~~~~
      |                                 std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:34:12: error: 'q' was not declared in this scope
   34 |     while(!q.empty()){
      |            ^
a.cc:35:12: error: expected primary-expression before 'int'
   35 |       pair<int,int> p=q.front();
      |            ^~~
a.cc:37:13: error: 'p' was not declared in this scope
   37 |       int x=p.first, y=p.second;
      |             ^
a.cc:38:18: error: 'y' was not declared in this scope
   38 |       if(used[x][y]) continue;
      |                  ^
a.cc:39:15: error: 'y' was not declared in this scope
   39 |       used[x][y]=1;
      |               ^
a.cc:43:18: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   43 |           q.push(make_pair(x-1,y));
      |                  ^~~~~~~~~
      |                  std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:48:18: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   48 |           q.push(make_pair(x+1,y));
      |                  ^~~~~~~~~
      |                  std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:53:18: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   53 |           q.push(make_pair(x,y-1));
      |                  ^~~~~~~~~
      |                  std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:58:18: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   58 |           q.push(make_pair(x,y+1));
      |                  ^~~~~~~~~
      |                  std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:62:5: error: 'cout' was not declared in this scope
   62 |     cout<<ans<<endl;
      |     ^~~~
a.cc:62:16: error: 'endl' was not declared in this scope
   62 |     cout<<ans<<endl;
      |                ^~~~