Language: C++

#include <bits/stdc++.h>
#include <atcoder/maxflow>

using namespace std;
using namespace atcoder;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  REP(i, SZ(v)) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, m;
  cin >> n >> m;
  vector<string> s(n);
  REP(i, n) {
    cin >> s[i];
  }

  mf_graph<int> flow(2 * n * m + 2);

  vi dx = {-1, 1, 0, 0};
  vi dy = {0, 0, -1, 1};
  REP(i, n) {
    REP(j, m) {
      if (s[i][j] == '#') continue;
      REP(k, 4) {
        int ni = i + dx[k], nj = j + dy[k];
        if (!(0 <= ni && ni < n && 0 <= nj && nj < m)) continue;
        if (s[ni][nj] == '#') continue;

        if ((i + j) % 2 == 0) flow.add_edge(1 + i * m + j, n * m + 1 + ni * m + nj, 1);
        else flow.add_edge(1 + ni * m + nj, n * m + 1 + i * m + j, 1);
      }
    }
  }

  REP(i, n) {
    REP(j, m) {
      if (s[i][j] == '#') continue;
      flow.add_edge(0, 1 + i * m + j, 1);
      flow.add_edge(n * m + 1 + i * m + j, 2 * n * m + 1, 1);
    }
  }

  int val = flow.flow(0, 2 * n * m + 1);
  //cout << val << endl;

  auto g = flow.edges();
  for(auto &e: g) {
    if(e.from == 0) continue;
    if(e.flow == 0) continue;
    int div = (e.from - 1) / (n * m);
    if(div != 0) continue;

    int i1 = (e.from-1) / m, j1 = (e.from - 1) % m;
    int i2 = (e.to - 1 - n*m) / m, j2 = (e.to - 1 - n*m) % m;

    //cout << i1 << " " << j1 << endl;
    //cout << i2 << " " << j2 << endl;
    //cout << endl;

    REP(k, 4) {
      int ni = i1+dx[k], nj = j1+dy[k];
      if(i2 == ni && j2 == nj) {
        if(k == 0) {
          s[i1][j1] = '^';
          s[i2][j2] = 'v';
        } else if(k == 1) {
          s[i1][j1] = 'v';
          s[i2][j2] = '^';
        } else if(k == 2) {
          s[i1][j1] = '<';
          s[i2][j2] = '>';
        } else {
          s[i1][j1] = '>';
          s[i2][j2] = '<';
        }
        break;
      }
    }
  }

  REP(i, n) {
    cout << s[i] << endl;
  }

  return 0;
}

Compiler output:
a.cc:2:10: fatal error: atcoder/maxflow: No such file or directory
    2 | #include <atcoder/maxflow>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.