<commit_before>﻿using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Solution
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var works = new Work[N];
		for (int i = 0; i < N; i++)
		{
			string[] inputs = Console.ReadLine().Split(' ');
			int J = int.Parse(inputs[0]);
			int D = int.Parse(inputs[1]);
			works[i] = new Work { Starts = J, Ends = J + D - 1 };
		}

		var sortedWorks = works.OrderBy(x => x.Starts).ThenBy(x => x.Ends).ToArray();

		var maxSolutions = solutions(0, sortedWorks);


		// Write an action using Console.WriteLine()
		// To debug: Console.Error.WriteLine("Debug messages...");

		Console.WriteLine(maxSolutions);
	}

	private static int solutions(int lastOccupiedDay, Work[] works)
	{
		var max = 0;
		for (var i = 0; i < works.Count(); i++)
		{
			var work = works[i];
			if (work.Starts > lastOccupiedDay)
			{
				var count = solutions(work.Ends, works.Skip(i + 1).ToArray()) + 1;
				if (count > max)
					max = count;
			}
		}
		return max;
	}
}

class Work
{
	public int Starts { get; set; }
	public int Ends { get; set; }
}<commit_msg>Passes all tests by sorting by end time<commit_after>﻿using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Solution
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var works = new Work[N];
		for (int i = 0; i < N; i++)
		{
			string[] inputs = Console.ReadLine().Split(' ');
			int J = int.Parse(inputs[0]);
			int D = int.Parse(inputs[1]);
			works[i] = new Work { Starts = J, Ends = J + D - 1 };
		}

		var sortedWorks = works.OrderBy(x => x.Ends).ThenBy(x => x.Starts).ToArray();

		var lastEnd = 0;
		var count = 0;
		for (int i = 0; i < sortedWorks.Length; i++)
		{
			if (sortedWorks[i].Starts > lastEnd)
			{
				count++;
				lastEnd = sortedWorks[i].Ends;
			}
		}

		Console.WriteLine(count);
	}
}

class Work
{
	public int Starts { get; set; }
	public int Ends { get; set; }
}
{'fraction_non_alphanumeric': 0.15186615186615188, 'fraction_numerical': 0.006864006864006864, 'mean_word_length': 3.201801801801802, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2097716', 'n_tokens_mistral': 913, 'n_tokens_neox': 814, 'n_words': 243}