I found the story in a written record of an ancient audio lesson of Sheikh 'Omar 'Abdulkafy on the series "Ad-Dar al-'Aakihra سلسلة الدار الآخرة المنجيات عند الميزان entitled the saving things when the deeds are presented on the balance (see here in Arabic). As sadly usual there's no source for this mentioned and in a thread here (in Arabic) the answer actually says there's no known source for this story, as everybody will be happy at that stage to get back the rights and claims he had on others.
The closest thing I could make out is the definition of the people called al-'Araaf (the name of the 7th surah) you may find in tafsir ibn Kathir:
Ibn Jarir recorded that Hudhayfah was asked about the people of Al-A'raf and he said, "A people whose good and bad deeds are equal. Their evil deeds prevented them from qualifying to enter Paradise, and their good deeds qualified them to avoid the Fire. Therefore, they are stopped there on the wall until Allah judges them."
Ma`mar said that Al-Hasan recited this Ayah,
(and at that time they will not yet have entered it (Paradise), but they will hope to enter (it).)
Then he said, "By Allah! Allah did not put this hope in their hearts, except for an honor that He intends to bestow on them." Qatadah said; "Those who hope are those among you whom Allah informed of their places." (Source qtafsir)
So most scholars of tafsir call those people whom on judgment day have an equality between bad and good deeds as al-'Araaf. In the story typewritten lesson I found the author also refers to these two men as wanting to become from among al-'Araaf, so maybe you may find a hint of this story in a tafsir for the verses 7:46- ..., as far as I can tell I couldn't find it mentioned anywhere.
Note that this story seems to contradict with the Qur'an and Sahih Sunnah, as at a stage non would recognize the other or even think of sharing with any other in that situation, but to the contrary everybody would be happy if he got some good deeds of a person who for example harmed him/her in this life. Imam al-Qurtobi for example quoted as a interpretation of ibn Masu'd:
In the following I'm translating from Arabic, as this is my own translation take it carefully
وقال أبو عمر زاذان : دخلت على ابن مسعود فوجدت أصحاب الخير واليمنة قد سبقوني إليه ، فناديت بأعلى صوتي : يا عبد الله بن مسعود ! من أجل أني رجل أعجمي أدنيت هؤلاء وأقصيتني ! فقال : ادنه ؛
Abu 'Amr Za'adan said: I entered (visited) ibn Mas'ud and found all the people of good and right (already to be) around him (they came earliere). So I called with my highest voice and said: O 'Abdullah ibn Mas'ud! For the fact that I'm a non Arabic ('Ajami) you've taken those close to you and left me aside! He said: come close:
فدنوت ، حتى ما كان بيني وبينه جليس فسمعته يقول : يؤخذ بيد العبد أو الأمة يوم القيامة فينصب على رءوس الأولين والآخرين ثم ينادي مناد : هذا فلان بن فلان ، من كان له حق فليأت إلى حقه ؛ فتفرح المرأة أن يدور لها الحق على أبيها ، أو على زوجها ، أو على أخيها ، أو على ابنها ؛
so I went close to him until there was no one sitting between me and him and listened to him saying: the servant and female servant will be taken by the hand of the day of Judgment and the earliest and latest will be standing (placed facing) in direction and a caller will call: this is so and so son of so and so, if any has a claim then he should come with it, so a woman may get happy as she might get back from her father, or her husband or her brother or her son
ثم قرأ ابن مسعود : فلا أنساب بينهم يومئذ ولا يتساءلون فيقول الرب سبحانه وتعالى ( آت هؤلاء حقوقهم ) فيقول : يا رب قد فنيت الدنيا فمن أين أوتيهم ؛ فيقول الرب للملائكة : ( خذوا من حسناته فأعطوا كل إنسان بقدر طلبته ) فإن كان وليا لله فضلت من حسناته مثقال حبة من خردل فيضاعفها الله تعالى حتى يدخله بها الجنة ،
Then ibn Mas'ud recieted (So when the Horn is blown, no relationship will there be among them that Day, nor will they ask about one another. 23:101), then the Lord glorified and exalted be He says (Give those their claims (rights)), they will answer: the dunya (this life) has ended so from where/what will I give them?; The Lord then will say to his angels: (Take from his good deeds and give every person based on what they asked for) if this person was a waly (ally) of Allah the weight of a mustard seed will stay and Allah the almighty will multiply it and he will access Jannah (Paradise).
ثم قرأ ابن مسعود ( إن الله لا يظلم مثقال ذرة وإن تك حسنة يضاعفها ويؤت من لدنه أجرا عظيما ) . وإن كان شقيا قالت الملائكة : رب ! فنيت حسناته وبقي طالبون ؛ فيقول الله تعالى : ( خذوا من أعمالهم فأضيفوها إلى سيئاته وصكوا له صكا إلى جهنم ) .
The ibn Mas'ud recited:(Indeed, Allah does not do injustice, [even] as much as an atom's weight; while if there is a good deed, He multiplies it and gives from Himself a great reward. 4:40). While if he was a wretched (person) the angels will say: (O) Lord! His good deeds have gone, but some demanders are left; Then Allah the alighty will say. (Take from their (bad) deeds and add it to his bad deeds and strike him to Jahannam (Hell)) (Source Tafsir al-Qurtobi for 23:101 in Arabic, see here)
This goes ahead with the sahih hadith:
Do you know who is poor? They (the Companions of the Holy Prophet) said: A poor man amongst us is one who has neither dirham with him nor wealth. He (the Holy Prophet) said: The poor of my Umma would be he who would come on the Day of Resurrection with prayers and fasts and Zakat but (he would find himself bankrupt on that day as he would have exhausted his funds of virtues) since he hurled abuses upon others, brought calumny against others and unlawfully consumed the wealth of others and shed the blood of others and beat others, and his virtues would be credited to the account of one (who suffered at his hand). And if his good deeds fall short to clear the account, then his sins would be entered in (his account) and he would be thrown in the Hell-Fire. (Sahih Muslim)