foo.cc: In function 'int main()':
foo.cc:8:6: error: conflicting declaration 'int max [1001]'
    8 |  int max[1001]={0};
      |      ^~~
foo.cc:5:11: note: previous declaration as 'int max'
    5 |  int n,x1,max=0;
      |           ^~~
foo.cc:9:11: warning: right operand of comma operator has no effect [-Wunused-value]
    9 |  cin>>n,x1;
      |           ^
foo.cc:11:6: error: 'i' was not declared in this scope
   11 |  for(i=2;i<=n;i++)
      |      ^
foo.cc:16:6: error: 'i' was not declared in this scope
   16 |  for(i=1;i<=n;i++)
      |      ^
foo.cc:20:6: error: 'i' was not declared in this scope
   20 |  for(i=1;i<=n;i++)
      |      ^
foo.cc:25:3: error: 'flag' was not declared in this scope
   25 |   flag=i;
      |   ^~~~
   
  
    [Hydro](https://hydro.ac)提供评测服务