codeparrot/codecomplex huggingface dataset:
// Problem: 15_A. Cottage Village
// Time complexity: nlogn


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Scanner;

public class A {
    static InputStreamReader in = new InputStreamReader(System.in);
    static BufferedReader bf = new BufferedReader(in);
    static StreamTokenizer st = new StreamTokenizer(bf);
    static Scanner sc = new Scanner(System.in);

    static class Sort implements Comparable<Sort> {
        int x, a;

        public int compareTo(Sort arg0) {
            if (this.x > arg0.x)
                return 1;
            return 0;
        }
    }

    public static void main(String[] args) throws IOException {
        int n = nextInt();
        double t = nextInt();
        Sort[] p = new Sort[n];

        for (int i = 0; i < n; i++) {
            p[i] = new Sort();
            p[i].x = nextInt();
            p[i].a = nextInt();
        }
        int ans = 2;
        Arrays.sort(p);
        for (int i = 1; i < p.length; i++) {
            double k = p[i].x - p[i].a / 2.0 - p[i - 1].x - p[i - 1].a / 2.0;
            if (t == k)
                ans++;
            else if (k > t)
                ans += 2;
        }
        System.out.println(ans);
    }

    private static String nextString() throws IOException {
        st.nextToken();
        return st.sval;
    }

    private static int nextInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn

import java.io.*;
import java.util.*;

public class CottageVillage
{
	public Scanner in = new Scanner(System.in);
	public PrintStream out = System.out;

	public int n, t;
	public Pair[] v;
	
	public void main()
	{
		n = in.nextInt();
		t = in.nextInt();
		
		int i;
		v = new Pair[n];
		for(i=0;i<n;++i) v[i] = new Pair(in.nextInt() * 2, in.nextInt());
		
		Arrays.sort(v);
		
		int res = 2;
		for(i=0;i+1<n;++i)
		{
			if(v[i].x + v[i].y + 2*t == v[i+1].x - v[i+1].y) ++res;
			else if(v[i].x+v[i].y+2*t < v[i+1].x-v[i+1].y) res +=2;
		}
		
		out.println(res);
	}//end public void main()

	//int pair
	private class Pair implements Comparable<Pair>
	{
		public int x, y;
		public Pair(int xx, int yy) { x = xx; y = yy; }

		public int compareTo(Pair u)
		{
			if(x!=u.x) return x-u.x;
			return y-u.y;
		}

		public String toString() { return "(" + x + "," + y + ")"; }
	}
	
	public static void main(String[] args)
	{
		(new CottageVillage()).main();
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.Arrays;
import java.util.Scanner;


public class A
{

	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int t=in.nextInt();
		pt[] P=new pt[n];
		for (int i=0; i<n; ++i)
			P[i]=new pt(in.nextInt(), in.nextInt());
		Arrays.sort(P);
		int res=2;
		for (int i=0; i+1<n; ++i)
		{
			double d=P[i+1].x-P[i].x-P[i+1].a/2.-P[i].a/2.;
			if (Math.abs(d-t) <= 1e-11)
				++res;
			else if (d>t)
				res+=2;
		}
		System.out.println(res);
	}

	
}

class pt implements Comparable<pt>
{
	int x,a;
	pt(int x, int a)
	{
		this.x=x;
		this.a=a;
	}
	
	public int compareTo(pt o)
	{
		return x-o.x;
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.util.*;
import java.io.*;

public class a {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int[][] xa = new int[n][2];
		for(int i=0; i<n; ++i) {
			xa[i][0] = sc.nextInt();
			xa[i][1] = sc.nextInt();
		}
	    Arrays.sort(xa, new Comparator<int[]>(){
            @Override
            public int compare(int[] a0, int[] a1){
                return a0[0]-a1[0];
            }
        });
		  int ans=2;
	        for(int i=0; i<n-1; i++){
	            int s=(xa[i+1][0]*2-xa[i+1][1])-(xa[i][0]*2+xa[i][1]);
	            if(s>t*2){
	                ans+=2;
	            }else if(s==t*2){
	                ans++;
	            }
	        }
	        System.out.println(ans+"");
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import static java.lang.System.out;

public class Flatville
{
    public static void main( String args[] )
    {
        class SquareHouse implements Comparable<SquareHouse>
        {
            public SquareHouse( double posLeft, double sideLen )
            { 
                _posLeft = posLeft;
                _sideLen = sideLen;
            }

            public double posLeft()
            { return _posLeft; }

            public double posRight()
            { return _posLeft + _sideLen; }

            public int compareTo( SquareHouse house )
            {
                double dist = _posLeft - house.posLeft();
                if ( dist < 0 )
                    return -1;
                else if ( dist > 0 )
                    return 1;
                else return 0;
            }

            private double _posLeft;
            private double _sideLen;
        }

        Scanner scanner = new Scanner( System.in );

        // Read the header
        final int nHouses    = scanner.nextInt();
        final double sideLen = scanner.nextDouble();

        ArrayList<SquareHouse> houses = new ArrayList<SquareHouse>();

        // Read the houses
        for ( int iHouse = 0; iHouse < nHouses; ++iHouse )
        {
            double pos  = scanner.nextDouble();
            double size = scanner.nextDouble();
            double posLeft = pos - size / 2.0;
            houses.add( new SquareHouse( posLeft, size ) );
        }

        // Sort the houses
        Collections.sort( houses );

        int nPositions = 2;
        for ( int iHouse = 0; iHouse < nHouses - 1; ++iHouse )
        {
            double space = houses.get( iHouse + 1 ).posLeft() - houses.get( iHouse ).posRight();
            if ( sideLen < space )
                nPositions += 2;
            else if ( sideLen == space )
                nPositions++;
        }

        out.println( nPositions );
    }
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Date 22.11.2011
 * Time 17:49:45
 * Author Woodey
 * $
 */

public class A15 {
	
	final double eps = 10e-9;
	
	class Pair implements Comparable<Pair>{
		int x;
		int length;
		
		Pair(int x, int length) {
			this.x = x;
			this.length = length;
		}

		public int compareTo(Pair p) {
			return x - p.x;
		}
	}
	
	private void Solution() throws IOException {
		int n = nextInt(), t = nextInt(), ans = 2;
		Pair[] pairs = new Pair[n];
		for (int i = 0; i < n; i ++) {
			int x = nextInt(), length = nextInt();
			pairs[i] = new Pair(x, length);
		}
		Arrays.sort(pairs);
		for (int i = 0; i < n-1; i ++) {
			double place = pairs[i+1].x - pairs[i].x - (double) pairs[i+1].length/2 - (double) pairs[i].length/2;
			if (place > t)
				ans += 2; else
					if ((int) (place+eps) == t)
						ans ++;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new A15().run();
	}

	BufferedReader in;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			Solution();
			in.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(in.readLine());
		return tokenizer.nextToken();
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Prob015A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int numHouses = scan.nextInt();
        int side = scan.nextInt() * 2;

        ArrayList<Integer> sides = new ArrayList<Integer>();
        for ( int x = 0; x < numHouses; x++ )
        {
            int c = scan.nextInt() * 2;
            int s = scan.nextInt();

            int l = c - s;
            int r = c + s;

            int li = Collections.binarySearch( sides, l );
            int ri = Collections.binarySearch( sides, r );

            if ( li >= 0 && ri >= 0 )
            {
                sides.remove( li );
                sides.remove( li );
            }
            else if ( li >= 0 )
                sides.set( li, r );
            else if ( ri >= 0 )
                sides.set( ri, l );
            else
            {
                sides.add( -li - 1, r );
                sides.add( -li - 1, l );
            }
        }

        int possibilities = 2;
        for ( int x = 1; x < sides.size() - 1; x += 2 )
            if ( sides.get( x + 1 ) - sides.get( x ) > side )
                possibilities += 2;
            else if ( sides.get( x + 1 ) - sides.get( x ) == side )
                possibilities += 1;

        System.out.println( possibilities );
    }
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
//package round15;


import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Scanner;

public class A {
	private Scanner in;
	private PrintWriter out;
	
	public void solve()
	{
		int n = ni();
		int t = ni();
		Pair[] p = new Pair[n];
		for(int i = 0;i < n;i++){
			p[i] = new Pair();
			p[i].x = ni();
			p[i].a = ni();
		}
		Arrays.sort(p);
		
		int ct = 2;
		for(int i = 0;i < n - 1;i++){
			float d = p[i + 1].x - (float)p[i + 1].a / 2 - p[i].x - (float)p[i].a / 2;
			if(Math.abs(d - t) < EPS){
				ct++;
			}else if(d > t){
				ct += 2;
			}
		}
		
		out.println(ct);
	}

	double EPS = 0.0001;
	
	private static class Pair implements Comparable<Pair>
	{
		public int x;
		public int a;
		
		@Override
		public int compareTo(Pair o) {
			return x - o.x;
		}
	}	
	public void run() throws Exception
	{
//		in = new Scanner(new StringReader("2 3 0 4 5 2"));
		in = new Scanner(System.in);
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		out = new PrintWriter(System.out);
		
//		int n = in.nextInt();
		int n = 1;
		for(int i = 1;i <= n;i++){
			long t = System.currentTimeMillis();
			solve();
			out.flush();
//			System.err.printf("%04d/%04d %7d%n", i, n, System.currentTimeMillis() - t);
		}
	}
	
	
	public static void main(String[] args) throws Exception
	{
		new A().run();
	}
	
	private int ni() { return Integer.parseInt(in.next()); }
	private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); }
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
//package round15;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class A {

	static StreamTokenizer in =
		new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	
	static int nextInt() throws IOException{
		in.nextToken();
		return (int)in.nval;
	}
	
	static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) throws IOException{
		int n = nextInt(),
			t = nextInt(),
			x[] = new int[n],
			a[] = new int[n];
		
		for (int i=0; i<n; i++){
			x[i] = nextInt();
			a[i] = nextInt();
		}
		
		for (int i=0; i<n-1; i++)
			for (int j=i+1; j<n; j++)
				if (x[i] > x[j]){
					int p = x[i]; x[i] = x[j]; x[j] = p;
						p = a[i]; a[i] = a[j]; a[j] = p;
				}
		
		double l[] = new double[n];
		double r[] = new double[n];
		for (int i=0; i<n; i++){
			l[i] = x[i]-a[i]/2.0;
			r[i] = x[i]+a[i]/2.0;
		}
		
		int res = 2;
		for (int i=1; i<n; i++){
			if (Math.abs(l[i]-r[i-1]-t) < 0.000001) res++;
			else if (l[i]-r[i-1] > t) res += 2;
		}
		
		out.println(res);
		out.flush();
	}

}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.io.*;
import java.util.*;

public class Solution {
	
	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	static class House implements Comparable<House> {
		int x, a;

		@Override
		public int compareTo(House o) {
			return x - o.x;
		}

		public House(int x, int a) {
			this.x = x;
			this.a = a;
		}
	}
	
	void solve() throws IOException {
		int n = nextInt();
		int t = nextInt();
		House[] hs = new House[n];
		for (int i = 0; i < n; ++i) {
			hs[i] = new House(nextInt(), nextInt());
		}
		Arrays.sort(hs);
		int ans = 2;
		for (int i = 0; i < n - 1; ++i) {
			if (hs[i].a + hs[i + 1].a + 2 * t < 2 * (hs[i + 1].x - hs[i].x)) {
				ans += 2;
			} else if (hs[i].a + hs[i + 1].a + 2 * t == 2 * (hs[i + 1].x - hs[i].x)) {
				ans++;
			}
		}
		out.println(ans);
	}

	Solution() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		eat("");
		
		solve();
		
		in.close();
		out.close();
	}
	
	private void eat(String str) {
		st = new StringTokenizer(str);
	}
	
	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		new Solution();
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.util.Arrays;
import java.util.Scanner;


public class Main {
    static double eps = 1e-8;
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        
        int n = r.nextInt();
        int t = r.nextInt();
        
        House[] a = new House[n];
        for(int i = 0; i < n; i++){
            double c = r.nextInt();
            double l = r.nextInt();
            a[i] = new House(c-l/2, l);
        }
        
        Arrays.sort(a);
        
        int res = 0;
        for(int i = 0; i < n-1; i++){
            double dist = a[i+1].s - (a[i].s+a[i].l);
            
            if(Math.abs(dist - t) < eps)res++;
            else if(dist > t)res += 2;
        }
        
        System.out.println(res+2);
    }
}

class House implements Comparable<House>{
    double s, l;
    public House(double si, double li){
        s = si;
        l = li;
    }
    @Override
    public int compareTo(House b) {
        if(s < b.s)return -1;
        else return 1;
    }
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
//~ 22:04:48
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		String out = "";
		String[] p = br.readLine().split("[ ]");
		int n = Integer.valueOf(p[0]);
		double t = Double.valueOf(p[1]);
		
		int offset = 5000;
		boolean[] flags = new boolean[offset+5000];
		for(int i=0;i<n;i++){
			int[] q = toIntArray(br.readLine());
			int c = 2*q[0];
			for(int j=-q[1];j<q[1];j++){
				flags[c+offset+j] = true;
				//~ System.out.println(c+offset+j);
			}
		}
		int buf = 0;
		int last = -1;
		int index = 0;
		for(;index<flags.length;index++){
			if(flags[index]){
				if(last==-1){
					buf++;
				}else{
					//~ System.out.println(last);
					//~ System.out.println(index);
					if(Math.abs(index-last-(2*t+1))<1e-10) buf++;
					else if(index-last>2*t+1) buf+=2;
				}
				last = index;
			}
		}
		buf ++;
		out = ""+buf+"\r\n";
		bw.write(out,0,out.length());
		br.close();
		bw.close();
	}
	static int[] toIntArray(String line){
		String[] p = line.trim().split("\\s+");
		int[] out = new int[p.length];
		for(int i=0;i<out.length;i++) out[i] = Integer.valueOf(p[i]);
		return out;
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.io.*;
import java.util.*;


public class CottageVillage
{
	Scanner in;
	PrintWriter out;
	
	CottageVillage()
	{
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
	}
	
	public void finalize()
	{
		out.flush();
		in.close();
		out.close();
	}
	
	int ans(House a, House b, int t)
	{
		int diff = b.cordl - a.cordr;
		
		if(diff < t) return 0;
		if(diff == t) return 1;
		return 2;
	}
	
	void solve()
	{
		int
			n = in.nextInt(),
			t = in.nextInt() * 2;
		House[] hs = new House[n];
		
		for(int i = 0; i < n; ++i)
		{
			int
				c = in.nextInt(),
				l = in.nextInt();
			hs[i] = new House(2 * c - l, 2 * c + l);
		}
		
		Arrays.sort(hs);
		
		//atleast 2 possible configs
		int co = 2;
		for(int i = 0; i < n - 1; ++i)
			co += ans(hs[i], hs[i + 1], t);
		
		out.println(co);
	}
	
	public static void main(String[] args) throws FileNotFoundException
	{
		CottageVillage t = new CottageVillage();
		t.solve();
		t.finalize();
	}
}

class House implements Comparable<House>
{
	public int cordl, cordr;
	
	public House(int c, int l)
	{
		cordl = c;
		cordr = l;
	}
	
	@Override
	public int compareTo(House h)
	{
		return cordl - h.cordl;
	}
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.io.*;
import java.util.*;

public class Main implements Runnable {
	class House implements Comparable<House> {
		int x;
		int a;

		public House(int x, int a) {
			this.x = x;
			this.a = a;
		}

		@Override
		public int compareTo(House other) {
			return x - other.x;
		}
	}

	// private void solution() throws IOException {
	// int t = in.nextInt();
	// while (t-- > 0) {
	// int n =in.nextInt();
	// int m = in.nextInt();
	// int x1 = in.nextInt();
	// int y1 = in.nextInt();
	// int x2 = in.nextInt();
	// int y2 = in.nextInt();
	//			
	// }
	// }
	private void solution() throws IOException {
		int n = in.nextInt();
		int t = in.nextInt();
		House[] h = new House[n];
		for (int i = 0; i < h.length; ++i) {
			h[i] = new House(in.nextInt(), in.nextInt());
		}
		Arrays.sort(h);
		int res = 2;
		for (int i = 0; i < h.length - 1; ++i) {
			double dist = h[i + 1].x - h[i + 1].a / 2.0 - (h[i].x + h[i].a / 2.0);
			if (dist >= t) {
				if (dist == t) {
					++res;
				} else {
					res += 2;
				}
			}
		}
		out.println(res);
	}

	public void run() {
		try {
			solution();
			in.reader.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	private class Scanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public Scanner(Reader reader) {
			this.reader = new BufferedReader(reader);
			this.tokenizer = new StringTokenizer("");
		}

		public boolean hasNext() throws IOException {
			while (!tokenizer.hasMoreTokens()) {
				String next = reader.readLine();
				if (next == null) {
					return false;
				}
				tokenizer = new StringTokenizer(next);
			}
			return true;
		}

		public String next() throws IOException {
			hasNext();
			return tokenizer.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public String nextLine() throws IOException {
			tokenizer = new StringTokenizer("");
			return reader.readLine();
		}
	}

	public static void main(String[] args) throws IOException {
		new Thread(null, new Main(), "", 1 << 28).start();
	}
	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	Scanner in = new Scanner(new InputStreamReader(System.in));
}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class a {

	private void solve() throws Exception {
		int n = nextInt(), t = nextInt();
		int[] x = new int[n], a = new int[n];
		for (int i = 0; i < n; ++i){
			x[i] = nextInt();
			a[i] = nextInt();
		}
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n - 1; ++j){
				if (x[j] > x[j + 1]){
					int tmp = x[j];
					x[j] = x[j + 1];
					x[j + 1] = tmp;
					
					tmp = a[j];
					a[j] = a[j + 1];
					a[j + 1] = tmp;
				}
			}
		int res = 2;
		for (int i = 1; i < n; ++i){
			int betw = (x[i] - x[i - 1]) * 2 - a[i] - a[i - 1];
			if (betw == t * 2)
				++res;
			else if (betw > t * 2)
				res += 2;
		}
		out.print(res);
	}

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			NOO(e);
		} finally {
			out.close();
		}
	}

	PrintWriter out;
	BufferedReader in;
	StringTokenizer St;

	void NOO(Exception e) {
		e.printStackTrace();
		System.exit(1);
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	String nextToken() {
		while (!St.hasMoreTokens()) {
			try {
				String line = in.readLine();
				St = new StringTokenizer(line);
			} catch (Exception e) {
				NOO(e);
			}
		}
		return St.nextToken();
	}

	private a(String name) {
		try {
			in = new BufferedReader(new FileReader(name + ".in"));
			St = new StringTokenizer("");
			out = new PrintWriter(new FileWriter(name + ".out"));
		} catch (Exception e) {
			NOO(e);
		}
	}

	private a() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			St = new StringTokenizer("");
			out = new PrintWriter(System.out);
		} catch (Exception e) {
			NOO(e);
		}
	}

	public static void main(String[] args) {
		new a().run();
	}

}
// Problem: 15_A. Cottage Village
// Time complexity: nlogn
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;
    
        
    void solve() throws IOException {
        int n=ni();//have bult yet
        int t=ni();//new house
        
        int[] center=new int[n];
        int[] width=new int[n];
        for(int i=0;i<n;i++){
            center[i]=ni();
            width[i]=ni();
        }
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                if(center[i]>center[j]){
                    int cent=center[i];
                    int wid=width[i];
                    center[i]=center[j];
                    width[i]=width[j];
                    center[j]=cent;
                    width[j]=wid;
                }
            }
        }
        int count=2;
        for(int i=0;i<n-1;i++){
            //min way
            double ideal=(double)width[i]/2+(double)width[i+1]/2+t;

            //real way
            double real=center[i+1]-center[i];
            //out.println(ideal);
            //out.println(real);
            if(ideal==real)count++;
            else{
                if(ideal<real)count=count+2;
            }
        }
        out.println(count);
        
    }
    
    public Main() throws IOException {
        Locale.setDefault(Locale.US);
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    String ns() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.valueOf(ns());
    }

    long nl() throws IOException {
        return Long.valueOf(ns());
    }

    double nd() throws IOException {
        return Double.valueOf(ns());
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }
}