Hints

X will become president case is trivial

For the case of X may become president

Assign X to all cities where he might win

Now model a graph with other candidates on left side and cities on right side

If X was assigned to L cities , add a weight of capacity L - 1 from a source to all other candidates , Add edges between candidates and cities of weight 1 and an edge of weight 1 from cities to a sink

Find Max flow, it should be equal to number of remaining cities for X to become president.