Not understanding the errors
I corrected all ur errors. please check them.
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
#define vi vector<int>
#define pii pair<int ,int>
#define all(v) v.begin(), v.end()
#define pub push_back
#define pob pop_back
#define mp make_pair
#define ll long long int
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
// #define OJ \
// freopen("input.txt", "r", stdin); \
// freopen("output.txt", "w", stdout);
// #define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int count = 0;
void rightTriangle(vi a, vi b, int n) {
unordered_map<int, int> mx, my;
int fx[100000] = {0};
int fy[100000] = {0};
for(int i=0; i<n; i++) {
fx[a[i]]++;
fy[b[i]]++;
}
for(int i=0; i<n; i++) {
mx.insert({a[i], fx[a[i]]});
my.insert({b[i], fy[b[i]]});
}
// for(int i=0; i<n; i++) {
// count += (fx[a[i]] - 1) * (fy[a[i]] - 1);
// }
unordered_map<int, int>::iterator i,j;
i = mx.begin();
j = my.begin();
for( ; i != mx.end(); i++ , j++) {
count += (i->second - 1) * (j->second - 1);
}
}
int main() {
// OJ;
int n;
cin >> n;
vi a, b;
for(int i=0; i<n; i++) {
int x;
cin >> x;
a.pub(x);
}
for(int i=0; i<n; i++) {
int y;
cin >> y;
b.pub(y);
}
rightTriangle(a, b, n);
cout << count << endl;
return 0;
}
U need to study properly about iterators and pointers.
Thanks a lot. Surely I will. I looked in stack overflow and got all the more confused.
Btw there’s still a run time error in interviewbit
I am sorry I haven’t solved this question so I am not thorough with the logic …I just acknowledged it to remove the errors and not check the logic.
I am sorry if u r dissatisfied.
I hope I can solve ur next doubt.
Thank you.
Okay! Will any other TA be assigned to me?
How will I get my question answered?
Hello @mohammadabdullahjawwad firstly take mod!
Also see constraints A[i],B[i]<=10^9 so it is bound to give runtime error! as you do f[A[i]]++.
Rest your logic seems fine.
I’m also sharing my code(refer it only when you try your best!)
Yes new TA will be assigned
Even after taking mod it is still showing runtime error. That means I cannot submit this solution? @mayankA47
take care of this as well, if problem still persists share you code.
The runtine error still persists!
Cool that means your approach. Upon inspection I see that I am complicating the issue. Thanks a lot @mayankA47
Happy to help 
you may also mark doubt as resolved if satisfied.