Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>

void C_109()
{
  int N, X;
  cin >> N >> X;

  vector<int> city_dis(N);
  for (int i = 0; i < N; ++i)
  {
    int city;
    cin >> city;
    city_dis[i] = abs(city - X);
  }

  int min_dis = *min_element(city_dis.begin(), city_dis.end());


  for (int i = min_dis; i >= 1; ++i)
  {
    //min_disの約数でないならcontinue
    if (min_dis % i != 0) continue;

    //min_disの約数が他の約数となるか？
    for (int j = 0; j < N; ++j)
    {
      if (city_dis[j] % i != 0) break;
      if (j == N - 1)
      {
        cout << i << endl;
        return;
      }
    }
  }
  cout << "1" << endl;
}

int main()
{
  C_109();
}

Compiler output:
a.cc: In function 'void C_109()':
a.cc:12:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |   cin >> N >> X;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<int> city_dis(N);
      |   ^~~~~~
a.cc:14:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> city_dis(N);
      |          ^~~
a.cc:19:5: error: 'city_dis' was not declared in this scope
   19 |     city_dis[i] = abs(city - X);
      |     ^~~~~~~~
a.cc:22:30: error: 'city_dis' was not declared in this scope
   22 |   int min_dis = *min_element(city_dis.begin(), city_dis.end());
      |                              ^~~~~~~~
a.cc:22:18: error: 'min_element' was not declared in this scope; did you mean 'std::min_element'?
   22 |   int min_dis = *min_element(city_dis.begin(), city_dis.end());
      |                  ^~~~~~~~~~~
      |                  std::min_element
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:7:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: 'std::min_element' declared here
  520 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~~~~~~
a.cc:36:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   36 |         cout << i << 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:36:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   36 |         cout << i << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:41:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   41 |   cout << "1" << 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:41:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   41 |   cout << "1" << endl;
      |                  ^~~~
      |                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~