Need help to solve this problem

In the world of Amazon’s vast inventory management, you face a challenge of optimizing two inventories, inv1 and inv2, each containing n elements.

Your goal is to maximize the similarity between these inventories. The similarity is measured by the number of indices i (0 ≤ i < n) where inv1[i] equals inv2[i].

Amazon provides a unique tool, the “Inventory Optimizer”. This tool allows you to perform the following operation:

  1. Select two distinct indices i and j (where 0 ≤ i, j < n and i ≠ j), provided that the jth element of inv1 is positive.
  2. Apply the operation: add 1 to inv1[i] and subtract 1 from inv1[j].

Using the Inventory Optimizer, you can perform this operation any number of times (including zero) to maximize the similarity between inv1 and inv2.

Constraints
1<=n<=1e5
1<=inv1[i],inv2[i]<=1e4

Sir/Mam these are the questions in which lot of people can have similar solution even I submitted a different solution before it. Then I submitted the solution mentioned above I haven’t cheated even the lot of of differences are there u can go through it once again plzz sir

Plzz sir review my code once it’s different