Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
class Problem
{
	private int N;
	private int[] items;
	public Problem()
	{
		using (var sc = new Scan(true))
		{
			sc.Read(out N);
			items = Func.Range(0, N).Select(x => sc.ReadInt()).ToArray();
		}
	}
	private int[] memo;
	public void Solve()
	{
		memo = new int[N];
		memo[0] = 1;
		for (var n = 1; n < N; n++)
		{
			memo[n] = 1;
			for (var m = 0; m < n; m++)
				if (items[m] < items[n])
					memo[n] = Math.Max(memo[n], memo[m] + 1);
		}
		Console.WriteLine(memo.Max());
	}
}
class Program
{
	static void Main()
	{
		new Problem().Solve();
	}
	static IEnumerable<Point> Neighbors(Point point)
	{
		yield return new Point(point.X - 1, point.Y);
		yield return new Point(point.X, point.Y - 1);
		yield return new Point(point.X, point.Y + 1);
		yield return new Point(point.X + 1, point.Y);
	}
}
class PairComparer<S, T> : IComparer<Pair<S, T>>
	where S : IComparable<S>
	where T : IComparable<T>
{
	public PairComparer() { }
	public int Compare(Pair<S, T> x, Pair<S, T> y)
	{
		var p = x.First.CompareTo(y.First);
		if (p != 0) return p;
		else return x.Second.CompareTo(y.Second);
	}
}
class Pair<S, T>
{
	public S First;
	public T Second;
	public Pair() { First = default(S); Second = default(T); }
	public Pair(S s, T t) { First = s; Second = t; }
	public override string ToString() { return "(" + First + ", " + Second + ")"; }
	public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
	public override bool Equals(object obj)
	{
		if (ReferenceEquals(this, obj)) return true;
		else if (obj == null) return false;
		var tmp = obj as Pair<S, T>;
		return (object)tmp != null && First.Equals(tmp.First) && Second.Equals(tmp.Second);
	}
}
class Point : Pair<int, int>
{
	public int X { get { return First; } set { First = value; } }
	public int Y { get { return Second; } set { Second = value; } }
	public Point() : base(0, 0) { }
	public Point(int x, int y) : base(x, y) { }
}
class Scan : IDisposable
{
	private TextReader file;
	public Scan(bool useConsole) { file = useConsole ? Console.In : new StreamReader("input.txt"); }
	public void Dispose() { file.Dispose(); }
	public int ReadInt() { return int.Parse(file.ReadLine()); }
	public uint ReadUInt() { return uint.Parse(file.ReadLine()); }
	public long ReadLong() { return long.Parse(file.ReadLine()); }
	public double ReadDouble() { return double.Parse(file.ReadLine()); }
	public decimal ReadDecimal() { return decimal.Parse(file.ReadLine()); }
	public string ReadString() { return file.ReadLine(); }
	public Pair<S, T> ReadPair<S, T>() { S s; T t; Read(out s, out t); return new Pair<S, T>(s, t); }
	public Point ReadPoint() { int s, t; Read(out s, out t); return new Point(s, t); }
	public void Read<S>(out S s)
	{
		var read = ReadMulti(Type.GetTypeCode(typeof(S))).ToArray();
		s = (S)read[0];
	}
	public void Read<S, T>(out S s, out T t)
	{
		var read = ReadMulti(Type.GetTypeCode(typeof(S)), Type.GetTypeCode(typeof(T))).ToArray();
		s = (S)read[0];
		t = (T)read[1];
	}
	public void Read<S, T, U>(out S s, out T t, out U u)
	{
		var read = ReadMulti(Type.GetTypeCode(typeof(S)), Type.GetTypeCode(typeof(T)), Type.GetTypeCode(typeof(U))).ToArray();
		s = (S)read[0];
		t = (T)read[1];
		u = (U)read[2];
	}
	public void Read<S, T, U, V>(out S s, out T t, out U u, out V v)
	{
		var read = ReadMulti(Type.GetTypeCode(typeof(S)), Type.GetTypeCode(typeof(T)), Type.GetTypeCode(typeof(U)), Type.GetTypeCode(typeof(V))).ToArray();
		s = (S)read[0];
		t = (T)read[1];
		u = (U)read[2];
		v = (V)read[3];
	}
	private IEnumerable<object> ReadMulti(params TypeCode[] types)
	{
		var inp = file.ReadLine().Split(' ');
		for (var i = 0; i < types.Length; i++)
		{
			if (types[i] == TypeCode.Int32) yield return int.Parse(inp[i]);
			else if (types[i] == TypeCode.UInt32) yield return uint.Parse(inp[i]);
			else if (types[i] == TypeCode.Int64) yield return long.Parse(inp[i]);
			else if (types[i] == TypeCode.Double) yield return double.Parse(inp[i]);
			else if (types[i] == TypeCode.Decimal) yield return decimal.Parse(inp[i]);
			else if (types[i] == TypeCode.String) yield return inp[i];
			else throw new Exception();
		}
	}
	public T[,] ReadBoard<T>(int X, int Y, Func<char, int, int, T> selector)
	{
		var array = new T[X, Y];
		for (var y = 0; y < Y; y++)
		{
			var str = ReadString();
			for (var x = 0; x < X; x++) array[x, y] = selector(str[x], x, y);
		}
		return array;
	}
}
static class Func
{
	/// <summary>
	/// Find the first number x such that pred(x) is true
	/// if pred(x) is false for all min&lt;=x&lt;max, then return max
	/// in other words, pred(max) is assumed to be true
	/// </summary>
	/// <param name="min">inclusive lower limit</param>
	/// <param name="max">exclusive upper limit</param>
	/// <param name="pred">monotonous predicate, i.e. if pred(a) and a&lt;b, then pred(b)</param>
	/// <returns>first number such that satisfy pred</returns>
	public static long FirstBinary(long min, long max, Predicate<long> pred)
	{
		var left = min;
		var right = max;
		while (left < right)
		{
			var mid = (left + right) >> 1;
			if (pred(mid)) right = mid;
			else left = mid + 1;
		}
		return left;
	}
	public static void Swap<T>(this T[] array, int i, int j) { var tmp = array[i]; array[i] = array[j]; array[j] = tmp; }
	public static void Swap<T>(this List<T> array, int i, int j) { var tmp = array[i]; array[i] = array[j]; array[j] = tmp; }
	public static IEnumerable<int> Range(int min, int max) { for (var i = min; i < max; i++) yield return i; }
	public static IEnumerable<T> Reverse<T>(this IEnumerable<T> source)
	{
		var list = source.ToArray();
		for (var i = list.Length - 1; i >= 0; i++) yield return list[i];
	}
	public static T IndexAt<T>(this T[,] array, Pair<int, int> index) { return array[index.First, index.Second]; }
	public static bool InRegion(this Pair<int, int> p, int X, int Y) { return p.InRegion(0, X, 0, Y); }
	public static bool InRegion(this Pair<int, int> p, int x, int X, int y, int Y) { return p.First >= x && p.Second >= y && p.First < X && p.Second < Y; }
	/// <summary>
	/// get all permutation of 0, 1, ..., n - 1
	/// </summary>
	/// <param name="n">length of array</param>
	/// <param name="func">if you want to change the elements of the array, you must take a copy</param>
	public static void Permutation(int n, Action<int[]> func)
	{
		var array = new int[n];
		var unused = new bool[n];
		for (var i = 0; i < n; i++) unused[i] = true;
		Permutation(n, 0, array, unused, func);
	}
	private static void Permutation(int n, int i, int[] array, bool[] unused, Action<int[]> func)
	{
		if (i == n) func(array);
		else
			for (var x = 0; x < n; x++)
				if (unused[x])
				{
					array[i] = x;
					unused[x] = false;
					Permutation(n, i + 1, array, unused, func);
					unused[x] = true;
				}
	}
	public static long Fact(int n)
	{
		var fact = 1L;
		for (var i = 2; i <= n; i++) fact *= i;
		return fact;
	}
	public static long LCM(long n, long m) { return Math.Abs((n / GCD(n, m)) * m); }
	public static long Divide(long n, long m) { return (n - Remainder(n, m)) / m; }
	public static long Remainder(long n, long m)
	{
		if (m == 0) throw new DivideByZeroException();
		else if (m < 0) return Remainder(n, -m);
		else
		{
			var r = n % m;
			return r < 0 ? r + m : r;
		}
	}
	public static long GCD(long n, long m)
	{
		var a = Math.Abs(n);
		var b = Math.Abs(m);
		if (a < b) { var c = a; a = b; b = c; }
		while (b > 0)
		{
			var c = a % b;
			a = b;
			b = c;
		}
		return a;
	}
	public static decimal MeasureTime(Action action)
	{
		action();return 0;
	}
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.IO;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Linq;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Text;
      |       ^~~~~~
a.cc:9:16: error: expected ':' before 'int'
    9 |         private int N;
      |                ^~~~
      |                :
a.cc:10:16: error: expected ':' before 'int'
   10 |         private int[] items;
      |                ^~~~
      |                :
a.cc:10:20: error: expected unqualified-id before '[' token
   10 |         private int[] items;
      |                    ^
a.cc:11:15: error: expected ':' before 'Problem'
   11 |         public Problem()
      |               ^~~~~~~~
      |               :
a.cc:19:16: error: expected ':' before 'int'
   19 |         private int[] memo;
      |                ^~~~
      |                :
a.cc:19:20: error: expected unqualified-id before '[' token
   19 |         private int[] memo;
      |                    ^
a.cc:20:15: error: expected ':' before 'void'
   20 |         public void Solve()
      |               ^~~~~
      |               :
a.cc:33:2: error: expected ';' after class definition
   33 | }
      |  ^
      |  ;
a.cc: In constructor 'Problem::Problem()':
a.cc:13:23: error: expected nested-name-specifier before '(' token
   13 |                 using (var sc = new Scan(true))
      |                       ^
a.cc: In member function 'void Problem::Solve()':
a.cc:22:17: error: 'memo' was not declared in this scope
   22 |                 memo = new int[N];
      |                 ^~~~
a.cc:24:22: error: 'var' was not declared in this scope
   24 |                 for (var n = 1; n < N; n++)
      |                      ^~~
a.cc:24:33: error: 'n' was not declared in this scope
   24 |                 for (var n = 1; n < N; n++)
      |                                 ^
a.cc:27:34: error: expected ';' before 'm'
   27 |                         for (var m = 0; m < n; m++)
      |                                  ^
a.cc:27:41: error: 'm' was not declared in this scope
   27 |                         for (var m = 0; m < n; m++)
      |                                         ^
a.cc:28:37: error: 'items' was not declared in this scope
   28 |                                 if (items[m] < items[n])
      |                                     ^~~~~
a.cc:29:51: error: 'Math' was not declared in this scope
   29 |                                         memo[n] = Math.Max(memo[n], memo[m] + 1);
      |                                                   ^~~~
a.cc:31:17: error: 'Console' was not declared in this scope
   31 |                 Console.WriteLine(memo.Max());
      |                 ^~~~~~~
a.cc: At global scope:
a.cc:40:16: error: 'IEnumerable' does not name a type
   40 |         static IEnumerable<Point> Neighbors(Point point)
      |                ^~~~~~~~~~~
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:38:30: error: expected ';' before '.' token
   38 |                 new Problem().Solve();
      |                              ^
a.cc: At global scope:
a.cc:48:7: error: 'PairComparer' is not a class template
   48 | class PairComparer<S, T> : IComparer<Pair<S, T>>
      |       ^~~~~~~~~~~~
a.cc:48:20: error: 'S' was not declared in this scope
   48 | class PairComparer<S, T> : IComparer<Pair<S, T>>
      |                    ^
a.cc:48:23: error: 'T' was not declared in this scope
   48 | class PairComparer<S, T> : IComparer<Pair<S, T>>
      |                       ^
a.cc:48:37: error: expected template-name before '<' token
   48 | class PairComparer<S, T> : IComparer<Pair<S, T>>
      |                                     ^
a.cc:48:37: error: expected '{' before '<' token
a.cc:48:37: error: expected unqualified-id before '<' token
a.cc:60:7: error: 'Pair' is not a class template
   60 | class Pair<S, T>
      |       ^~~~
a.cc:60:12: error: 'S' was not declared in this scope
   60 | class Pair<S, T>
      |            ^
a.cc:60:15: error: 'T' was not declared in this scope
   60 | class Pair<S, T>
      |               ^
a.cc:62:15: error: expected ':' before 'S'
   62 |         public S First;
      |               ^~
      |               :
a.cc:62:16: error: 'S' does not name a type
   62 |         public S First;
      |                ^
a.cc:63:15: error: expected ':' before 'T'
   63 |         public T Second;
      |               ^~
      |               :
a.cc:63:16: error: 'T' does not name a type
   63 |         public T Second;
      |                ^
a.cc:64:15: error: expected ':' before 'Pair'
   64 |         public Pair() { First = default(S); Second = default(T); }
      |               ^~~~~
      |               :
a.cc:65:15: error: expected ':' before 'Pair'
   65 |         public Pair(S s, T t) { First = s; Second = t; }
      |               ^~~~~
      |               :
a.cc:65:22: error: expected ')' before 's'
   65 |         public Pair(S s, T t) { First = s; Second = t; }
      |                    ~ ^~
      |                      )
a.cc:66:15: error: expected ':' before 'override'
   66 |         public override string ToString() { return "(" + First + ", " + Second + ")"; }
      |               ^~~~~~~~~
      |               :
a.cc:66:16: error: 'override' does not name a type
   66 |         public override string ToString() { return "(" + First + ", " + Second + ")"; }
      |                ^~~~~~~~
a.cc:67:15: error: expected ':' before 'override'
   67 |         public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
      |               ^~~~~~~~~
      |               :
a.cc:67:16: error: 'override' does not name a type
   67 |         public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
      |                ^~~~~~~~
a.cc:68:15: error: expected ':' before 'override'
   68 |         public override bool Equals(object obj)
      |               ^~~~~~~~~
      |               :
a.cc:68:16: error: 'override' does not name a type
   68 |         public override bool Equals(object obj)
      |                ^~~~~~~~
a.cc:75:2: error: expected ';' after class definition
   75 | }
      |  ^
      |  ;
a.cc: In constructor 'Pair::Pair()':
a.cc:64:25: error: 'First' was not declared in this scope
   64 |         public Pair() { First = default(S); Second = default(T); }
      |                         ^~~~~
a.cc:64:33: error: expected primary-expression before 'default'
   64 |         public Pair() { First = default(S); Second = default(T); }
      |                                 ^~~~~~~
a.cc:64:45: error: 'Second' was not declared in this scope
   64 |         public Pair() { First = default(S); Second = default(T); }
      |                                             ^~~~~~
a.cc:64:54: error: expected primary-expression before 'default'
   64 |         public Pair() { First = default(S); Second = default(T); }
      |                                                      ^~~~~~~
a.cc: At global scope:
a.cc:76:19: error: expected template-name before '<' token
   76 | class Point : Pair<int, int>
      |                   ^
a.cc:76:19: error: expected '{' before '<' token
a.cc:76:19: error: expected unqualified-id before '<' token
a.cc:84:1: error: expected class-name before '{' token
   84 | {
      | ^
a.cc:85:16: error: expected ':' before 'TextReader'
   85 |         private TextReader file;
      |                ^~~~~~~~~~~
      |                :
a.cc:85:17: error: 'TextReader' does not name a type
   85 |         private TextReader file;
      |                 ^~~~~~~~~~
a.cc:86:15: error: expected ':' before 'Scan'
   86 |         public Scan(bool useConsole) { file = useConsole ? Console.In : new StreamReader("input.txt"); }
      |               ^~~~~
      |               :
a.cc:87:15: error: expected ':' before 'void'
   87 |         public void Dispose() { file.Dispose(); }
      |               ^~~~~
      |               :
a.cc:88:15: error: expected ':' before 'int'
   88 |         public int ReadInt() { return int.Parse(file.ReadLine()); }
      |               ^~~~
      |               :
a.cc:89:15: error: expected ':' before 'uint'
   89 |         public uint ReadUInt() { return uint.Parse(file.ReadLine()); }
      |               ^~~~~
      |               :
a.cc:89:16: error: 'uint' does not name a type; did you mean 'int'?
   89 |         public uint ReadUInt() { return uint.Parse(file.ReadLine()); }
      |                ^~~~
      |                int
a.cc:90:15: error: expected ':' before 'long'
   90 |         public long ReadLong() { return long.Parse(file.ReadLine()); }
      |               ^~~~~
      |               :
a.cc:91:15: error: expected ':' before 'double'
   91 |         public double ReadDouble() { return double.Parse(file.ReadLine()); }
      |               ^~~~~~~
      |               :
a.cc:92:15: error: expected ':' before 'decimal'
   92 |         public decimal ReadDecimal() { return decimal.Parse(file.ReadLine()); }
      |               ^~~~~~~~
      |               :
a.cc:92:16: error: 'decimal' does not name a type
   92 |         public decimal ReadDecimal() { return decimal.Parse(file.ReadLine()); }
      |                ^~~~~~~
a.cc:93:15: error: expected ':' before 'string'
   93 |         public string ReadString() { return file.ReadLine(); }
      |               ^~~~~~~
      |               :
a.cc:93:16: error: 'string' does not name a type
   93 |         public string ReadString() { return file.ReadLine(); }
      |                ^~~~~~
a.cc:94:15: error: expected ':' before 'Pair'
   94 |         publi