A budget too small for the answer
Two unrelated documents cost O((n+m)*d) to compare, and on chain the caller picks d. With the budget set to 2 the search gives up and returns a correct non-minimal script instead of burning the gas or panicking.
The diff
Context: 2 line(s).
1@@ -1,5 +1,5 @@
2-red
3-orange
4-yellow
5-green
6-blue
7+one
8+two
9+three
10+four
11+five
The script
| property | value |
|---|---|
| inserted lines | 5 |
| deleted lines | 5 |
| unchanged lines | 0 |
| minimal | no |
Replaying it on the left document reproduces the right one yes, which is the property that holds even when the script is not minimal.