How to pass minimum count of apples so that every one around the table has same amount of apples? With three ($A_1,A_2 and A_3)$ people sitting around the table, each having $a_1=2,a_2=3,a_3=4 $ apples,to ensure each one has equal amount of 3 apples,  A3 just  gives A1 one apple A3 $\to$ A1 =1. In this case, the minimum count of ample exchanged is 1.
With four ($A_1,A_2,A_3 and A_4)$ people sitting around the table, each having $a_1=2,a_2=3,a_3=6,a_3=9 $ apples, to ensure each one has equal amount of 5 apples,  A1 $\to$  A2 =0, A2 $\to$ A3 =-2,  A3 $\to$ A4 ==-1, A4 $\to$ A1 =3. In this case, the minimum count of apples exchanged is 0+2+1+3=6.
Question : With n people $A_i$(i from 1 to n) having  $a_i$ apples initially, what  the minimum count of apples exchanged needed so that each will have  same amount of apples in the end? (please note the question is about the minimum count of apples exchanged, not the minimum count of apple exchanges: we are counting the apples, not the exchanges.
Clarification:   The exchange can only happen between 2 neighbors. For any person  $A_i$, you can  give away $x_i$ to $A_{i+1}$ and take in $x_{i-1}$ from $ A_{i-1}$. $x_{i-1}$ and $x_{i+1}$ can be any integers (including 0).
 A: Think of everyone who has too many piling the excess in the center of the table.  Those who don't have enough take the number they need.  This is the minimum number of apples that need to be exchanged.
A: We assume that the total number of apples is divisible by the number of people. Say there are k apples per person.
I think your question isn't that through very well. It seems the only transfer that is possible is from lower indexed to higher indexed persons, so if a1 < k, or a1 + a2 < 2k, or a1 + a2 + a3 < 3k etc. there is no solution.
So I assume instead that we are going around in a circle, and person n can give to person 1. There is no "exchange", only passing apples. Any person with more than k apples needs to pass all but k apples on, as does any person who received apples putting their number over k.
We will start with one person j. If aj > k then we pass aj - k apples to person j+1 (or to 1 if j = n) and count 1 passing, then do the same for a(j+1), a(j+2) etc. If we encounter anyone with fewer than n apples then person j was not suitable.
We try this for j = 1, 2, ..., n and pick the j that leads to the smallest number of passings.
If everyone can give apples to their left or right neighbour or both then the problem gets really interesting.
A: First assume it is a linear table where $1$ can pass to $2$, $n$ can pass to $n-1$ but everyone else can pass to the person to their left or right.
Use induction strategy.
Let $n$ be the number of people at the table and assume it is known how many apple passes it takes to make everybody have the same number of apples for all numbers of people less than $n$.
$k=\frac{1}{n}\sum_{i=m+1}^n a_i$ is the number of apples you want everyone to eventually end up with.
If the first person has $k$ apples, leave that person out and solve the known problem of re-distributing among the remaining $n-1$ people.
If the first person has more than $k$ apples, they will have to pass the excess apples to person $2$ and now the problem has be reduced to a known answer with $n-1$ people remaining.
What happens if the first person has less than $k$ apples?
Find the smallest $j$ such that $\sum_{i=1}^j a_i \ge k$.
Have those people $2$ through $j-1$ pass all their apples to person $1$ and have person $j$ pass as much as needed so that person $1$ will end up having exactly $k$.
Then, solve the problem of making the remaining $n-1$ people each have $k$ apples.
By induction, this strategy always does it in the minimum number of apples passes possible.
Now, solve the circular table problem.
It seems like if you try each linear strategy treating persons $1$ through $n$ as at the head of the line of the linear table and minimize that over all of them, you will get the minimum for the circular table too. That assumes the mimium for the circular table has at least one pair of people sitting next to each other that don't have to pass apples to each other. At any rate, you have an upper bound for the minimum.
I would be interested if anyone can find an initial configuration such that the minimum for the circular table method is lower than the minimum of all possible linear solutions putting persons $1$ through $n$ as the first seat of the linear table.
