getting wrong answer

i got wrong answer plz help me
problem link:http://codeforces.com/contest/56/problem/E
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(i=a;i<b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i–)
#define AFOR(i,a,b) for(i=a;i<=b;i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define ll long long int
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD 1000000007
#define CLR(a) memset(a,0,sizeof(a))
#define ABS(x) ( (x)>0?(x):(-(x)) )
#define ub(X,v) upper_bound(X.begin(),X.end(),v)
#define lb(X,v) lower_bound(X.begin(),X.end(),v)
typedef pair< int ,int > PP;
typedef map< string ,int > MM;
typedef vector V;
typedef map<int,int>M;
int main()
{
int n,i;
PP ans[100001];
cin>>n;
FOR(i,0,n)
{
cin>>ans[i].F >> ans[i].S;
}
V v;
v.clear();
FOR(i,0,n)
{
v.PB(ans[i].F);
}
sort(v.begin(),v.end());
int x,y;
FOR(i,0,n)
{
x=ans[i].F+1;
y=ans[i].F+ans[i].S-1;
int res=ub(v,y)-lb(v,x);
cout<<res+1<<" ";
}

}

//