AVS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int fn(int i,int j,int x,int y){\n        \n        int ans=j-i;\n        ans=min(j-i,abs(abs(x-i)+1+abs(y-j)));\n                if(x>=i&&j>=y&&x!=y){ans=x-i+1+j-y;}\n                // else ans=min(j-i,1+abs(y-j));\n\n        if(ans==0)ans++;\n        \n        return ans;\n    }\n    vector<int> countOfPairs(int n, int x, int y) {\n        vector<int>ans(n);\n        int p=min(x,y);\n        y=max(x,y);\n        x=p;\n        // int sum=0;\n        // sum=n-1;\n        // sum*=2;\n        // if(x!=y)sum+=2;\n        // ans.push_back(sum);\n        map<int,int>m;\n        for(int i=1;i<=n;i++){\n            for(int j=i+1;j<=n;j++){\n                // cout<<i<<" "<<j<<" "<<fn(i,j,x,y)<<endl;\n                m[fn(i,j,x,y)]++;\n            }\n        }\n        int j=0;\n        for(auto &i:m)ans[j++]=i.second*2;\n        return ans;\n    }\n};\n```
['C++']