Copy and paste are handled by applications and the OS shell
Any program is free to define the formats it is willing to copy or paste - like mime types.
Software sucks, not because its bad, but because people wont implement things
Maybe I'm really dumb, but it should be obvious that replacing a section of rope in one knot with another, is intuitively not going to simply "add the unknotting numbers"
Remember "The Zen of Code Optimization" by Michael Abrash in the 90s?
This word count challenge was the first one he described.
The table driven approach was discussed, but was not necessarily the fastest due to the large cache overflowing (on 90s processors) table needed.
I used the same example in a chapter I wrote for a C++ book
Anyone who does any basic algorithmic CS stuff would have been exposed to sorting algorithms, their variations, sorting networks and so on.
There are already superoptimizers who use genetic algorithms to find the most optimal code sequence for small easily verifiable tasks. That is also a form of reinforcement learning in a way
https://schmantics.blogspot.com/2011/12/third-circle.html