<｜begin▁of▁sentence｜>### Instruction:
Given in-degree sequence [2, 2, 2, 1, 1] and out-degree sequence [2, 2, 1, 2, 1], how can you construct a directed graph using the Havel-Hakimi algorithm provided by NetworkX?
### Response:
import networkx as nx

# Define the in-degree and out-degree sequences
in_deg_sequence = [2, 2, 2, 1, 1]
out_deg_sequence = [2, 2, 1, 2, 1]

# Generate the directed graph
G = nx.directed_havel_hakimi_graph(in_deg_sequence, out_deg_sequence)

# Draw the graph
import matplotlib.pyplot as plt
nx.draw(G, with_labels=True)
plt.show()
<|EOT|>
