akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;





int main(){
    ll N; cin >> N;
    vector<ll> A;
    ll cache = -1;
    for(int i = 0; i < N; i++){
        ll x; cin >> x;
        if(x != cache) A.push_back(x);
        cache = x;
    }
    N = A.size();
    vector<ll> DP(N); DP[0] = 0;
    vector<ll> DP2(N+2);
    map<ll, pair<ll, ll>> M; // {num, {cnt, idx}}
    for(int i = 0; i < N; i++){
        ll x = A[i];
        auto p = M[x];
        ll c = p.first;
        ll idx = p.second;
        if(i != 0) DP[i] += DP[i-1]; 
        DP[i] %= MOD;
        DP[i] += c; 
        DP[i] %= MOD;
        if(c != 0 && idx-1 >= 0) {
            DP2[x] += DP[idx-1];
            DP[i] += DP2[x]; 
        }
        DP[i] %= MOD;

        M[x].first++;
        M[x].second = i;




    }
    cout << DP[N-1]+1 << endl;
     


}


Measured memory_bytes: 17392
/**
 *   created: 02 August 2020 (Sunday)  18:23:53
**/
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define int long long

void solve(){
	int n; cin>>n;
	string s; cin>>s;
	string k=s;
	sort(k.begin(),k.end());
	int cnt=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='W' && k[i]=='R')
			cnt++;
	}
	cout<<cnt;
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int t=1; while(t--) solve();
    return 0;
}

Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {

	private static int count = 0;

	public static class Card{
		public String sort;
		public int num;
		public Card(String sort, int num){
			this.sort = sort;
			this.num = num;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
		int n = sc.nextInt();
		String[] A = new String[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.next();
		}

		Card[] cards = createCards(A, n);
		Card[] cardsM = createCards(A, n);
		quickSort(cards,0, n-1);
		mergeSort(cardsM,0,n);

		boolean stable = true;
		for (int i = 0; i < n; i++) {
			if(!(cards[i].sort).equals(cardsM[i].sort)){stable = false;}
		}

		if(stable){
			System.out.println("Stable");
		}else{
			System.out.println("Not stable");
		}

		for (int i = 0; i < n; i++) {
			System.out.println(cards[i].sort + " " + cards[i].num);
		}

	}

	private static void mergeSort(Card[] A, int left, int right) {
		if(left+1 < right){
			int mid = (left+right)/2;
			mergeSort(A,left,mid);
			mergeSort(A, mid, right);
			merge(A,left,mid,right);
		}

	}

	private static void merge(Card[] a, int left, int mid, int right) {
		final int MAX = 2147483647;
		int n1 = mid - left;
		int n2 = right -mid;
		Card[] l1 = new Card[n1+1];
		Card[] r1 = new Card[n2+1];
		for(int i=0; i<n1; i++){
			l1[i] = a[left+i];
		}
		for(int i=0; i<n2; i++){
			r1[i] = a[mid+i];
		}
		l1[n1] = new Card("X",MAX);
		r1[n2] = new Card("X",MAX);
		int i=0;
		int j=0;
		for(int k=left; k<right; k++){
			if(l1[i].num <= r1[j].num){
				a[k] = l1[i++];
			}else{
				a[k] = r1[j++];
			}
		}
	}


	private static void quickSort(Card[] cards, int p, int r) {
		if(p<r){
			//???????????????
			int q = partition(cards, p, r);
			//??????????????????????????????????????????????????????
			quickSort(cards, p, q-1);
			//??????????????????????????????????????????????????????
			quickSort(cards, q+1, r);
		}

	}


	private static Card[] createCards(String[] a, int n) {
		Card[] cards = new Card[n];
		for (int i = 0; i < n; i++) {
			String sort = a[i].split(" ")[0];
			int num = Integer.parseInt(a[i].split(" ")[1]);
			cards[i] = new Card(sort, num);

		}
		return cards;
	}


	private static int partition(Card[] a, int p, int r) {
		//??????????±??????????????????????????´???????????????????
		int x = a[r].num;
		//????????????????°????????????°???????????????????????????????????????????´?
		int i = p-1;

		//?????????2?????????????´????????????????????´?????????????????????§????????????
		for(int j=p; j<r; j++){
			//????????????????°?????????£??????????°?????????°?????????????§????
			if(a[j].num<=x){
				i++;
				Card tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
		//????????????????°?????????°?????????????????????????¬?????????¨?????????????????????
		Card tmp = a[i+1];
		a[i+1] = a[r];
		a[r] = tmp;

		return i+1;

	}


	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


}

Measured memory_bytes: 130184
#include<stdio.h>

int main(){
	 int n,i;
 	 long long int sum=1;

    scanf("%d",&n);
    for(i=1;i<=n;i++){
        sum *=  i;
      if(sum >= 1000000007){
      		sum = sum % 1000000007;
    	}
    }
    printf("%lld",sum);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
bool cmp(int a,int b)
{
	return a>b;
}
int n,m[100001],k,ans;
using namespace std;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>m[i];
	}
	sort(m+1,m+1+n,cmp);
	for(int i=1;i<=k;i++)
	{
		ans+=m[i];
	}
	cout<<ans<<endl;
	
	
	
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var k = s.Length;
            var r = (15 - k) + s.Count(x => x == 'o') >= 8
                ? "YES"
                : "NO";
            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 11220
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define gap                        ' '
#define EPS                        1e-9
#define mod                        1e9+7
#define P_INF                      1e9+17
#define N_INF                     -1e9+17
#define PI                         2*acos(0.0)
#define IFORI(Name)                for(auto &data : Name)
#define IFORO(Name)                for(auto data : Name)
#define FOR(start, end)            for(int i=start; i<end; i++)
#define FORR(start, end)           for(int j=start; j<end; j++)
#define RFOR(start, end)           for(int k=start-1; k>=end; k--)
#define unique(a)                  a.resize(unique(a.begin(), a.end()) - a.begin())
#define precision(n)               fixed << setprecision(n)

typedef double ld;
typedef long long int ll;
typedef unsigned long long int ul;
using namespace std;

class CMaximumVolume {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        ld one = (ld) n / 3;
        ld res = ld(one * one * one);
        out << precision(12) << res << endl;
    }
};


int main() {
     std::ios_base::sync_with_stdio(0);
     std::cin.tie(nullptr);
     CMaximumVolume solver;
     std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
     return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int h = sc.nextInt();
      int w = sc.nextInt();
      char[][] grid = new char[h][w];
      for(int i = 0; i < h; i++) {
        grid[i] = sc.next().toCharArray();
      }
      int cnt = 0;
      for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++)
          if(grid[i][j] == '#')
            cnt++;
      }
      int row = 0, col = 0;
      int curCnt = 0;
      while(row < h && col < w && grid[row][col] != '.') {
        curCnt++;
        if(row+1 < h && grid[row+1][col] == '#')
          row++;
        else if(col+1 < w && grid[row][col+1] == '#')
          col++;
        else break;
      }
      System.out.println(cnt == curCnt ? "Possible" : "Impossible");
  }
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    ;
    int a, b, c, s;
    cin >> s;
    c = s % 10;
    s /= 10;
    b = s % 10;
    s /= 10;
    a = s % 10;
    if (a >= b)
    {
        if (b >= c)
        {
            cout << a * 100 + a * 10 + a << endl;
            return 0;
        }
        if (a == b && b < c)
        {
            cout << (a + 1) * 100 + (a + 1) * 10 + a + 1 << endl;
            return 0;
        }
        else
        {
            cout << a * 100 + a * 10 + a << endl;
            return 0;
        }
    }
    else
    {
        cout << (a + 1) * 100 + (a + 1) * 10 + a + 1 << endl;
        return 0;
    }

    return 0;
}

Measured memory_bytes: 256
type 'a tree =
    Leaf
  | Node of 'a tree * 'a * 'a tree

let empty = Leaf
          
let rec insert (x, i) t =
  match t with
    Leaf -> Node (Leaf, (x, i) , Leaf)
  | Node (l, (y, j), r) ->
     if x < y then
       Node (insert (x, i) l, (y, j), r)
     else
       Node (l, (y, j), insert (x, i) r)

let rec print_tree_int t =
  match t with
    Leaf -> ()
  | Node (l, (x, i), r) ->
     print_tree_int l;
     print_int i;
     print_char ' ' ;
     print_tree_int r
                
let i_inp_list : unit -> (int * int) list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.mapi (fun i x -> (int_of_string x, i + 1)) (inp_split)
  
let () =
  let _ = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let l = i_inp_list () in
  let ans = List.fold_left (fun t x -> insert x t) empty l in
  print_tree_int ans;
  print_newline ()


Measured memory_bytes: 21692
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int K = scan.nextInt();
int X = scan.nextInt();
int sum = 500 * K;
if (sum >= X) {
  System.out.println("Yes");
}
else{
  System.out.println("No");
}
}
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int n,d,ans=0,count=0;
  cin>>n>>d;
  vector<vector<int>> v(n,vector<int>(d));
  rep(i,n) rep(j,d) cin>>v[i][j];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=0;k<d;k++){
        ans+=(int)pow(v[i][k]-v[j][k],2);
      }
      
      if(int(sqrt(ans))*int(sqrt(ans))==ans){
        count++;
      }
      ans=0;
    }
  }
  
  cout<<count<<endl;
  
  
  
  
  
}

Measured memory_bytes: 256
#include "iostream"
#include "string"
#include "algorithm"
using namespace std;
 
int main() {
	int n;
	long a[100005], b[100004];
	cin >> n;
	for (int i = 0; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	long long cnt = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] + a[i + 1] < b[i]) {
			cnt += a[i] + a[i + 1];
			a[i + 1] = 0;
		}
		else if (a[i] < b[i]) {
			a[i + 1] -= b[i] - a[i];
			cnt += b[i];
		}
		else {
			cnt += b[i];
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
 
int main()
{
    int a,b,c,d;
  cin>>a>>b>>c>>d;
  int flag,i=0;
   while(1)
   {
     if(i%2==0)
     { c-=b;if(c<=0){flag=1;break;}}
     else 
     { a-=d;if(a<=0){flag=0;break;}}
     i++;
   }
  if(flag==1)
 cout<<"Yes";
    else cout<<"No";
  cout<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    vi imos(n+1,0);
    rep(i,m){
        int l,r; cin>>l>>r; l--; r--;
        imos[l]++;
        imos[r+1]--;
    }
    rep(i,n){
        imos[i+1]+=imos[i];
    }
    int ans=0;
    rep(i,n){
        if (imos[i]==m) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> G[500500];
int N;

long long dp1[500500],dp2[500500];
int sz[500500];
int dep[500500];

int main(){
	scanf("%d",&N);
	for(int i=0;i<N-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		G[i+1].push_back(a);
		G[i+1].push_back(b);
	}
	dep[1]=0;
	for(int v=1;v<N;v++){
		for(int i=0;i<2;i++){
			if(G[v][i]==N) continue;
			dep[G[v][i]]=dep[v]+1;
		}
	}
	dp1[N]=0;
	dp2[N]=0;
	sz[N]=1;
	for(int v=N-1;v>=1;v--){
		sz[v]=0;
		dp1[v]=0;
		for(int i=0;i<2;i++){
			sz[v]+=sz[G[v][i]];
			dp1[v]+=dp1[G[v][i]];
			dp1[v]+=sz[G[v][i]];
		}
		dp2[v]=dp1[v];
		for(int i=0;i<2;i++){
			int j=i^1;
			long long tmp=0;
			tmp+=sz[G[v][i]];
			tmp+=dp1[G[v][i]];
			tmp+=1;
			tmp+=dp2[G[v][j]];
			dp2[v]=min(dp2[v],tmp);
		}
		long long tmp=0;
		for(int i=0;i<2;i++){
			tmp+=dp2[G[v][i]];
		}
		tmp+=dep[v]+2;
		dp2[v]=min(dp2[v],tmp);
	}
	printf("%lld\n",dp2[1]);
	return 0;
}

Measured memory_bytes: 40128
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;
class Graph2 {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	private int[] discover; //discover time stamp, -1 for undiscovered
	private int[] finish; //finish time stamp
	public Graph2() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1; //-1, index
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1; //-1, index
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public int DFS(int v, int t0) {
		discover[v] = t0;
		LinkedList<Integer> nb = adjList.get(v);
		Iterator<Integer> it = nb.iterator();
		int t = t0;
		while(it.hasNext()) {
			int w = it.next();
			if(discover[w] == -1) {
				t ++; //one forward step
				t = DFS(w, t);
			}
		}
		finish[v] = t + 1; //+1 for backtrack step
		return t + 1;
		}
	public void timeStamp() {
		int v;
		discover = new int[totalVertex];
		finish = new int[totalVertex];
		for(v = 0; v < totalVertex; v ++) discover[v] = -1; //-1: not discovered
		int t = 0;
		for(v = 0; v < totalVertex; v ++) {
			if(discover[v] == -1) { //for disconnected graph, restart from an unvisited node
				t = DFS(v, t);
				t ++;
			}
		}//display the result
		for(v = 0; v < totalVertex; v ++) {
			System.out.println((v + 1) + " " + (discover[v] + 1) + " " + (finish[v] + 1));
			//+1, node 0 -> 1, 1 -> 2, etc
		}
	}
}
public class Main {
	public static void main(String argv[]) {
		Graph2 g = new Graph2();
		g.loadAdjList();
		g.timeStamp();
	}
}


Measured memory_bytes: 28720
#include <bits/stdc++.h>
using namespace std;

int main() {
  string num;
  cin >> num;
  if (num.at(0)==num.at(1) && num.at(1)==num.at(2) && num.at(2)==num.at(3))
    cout << "Yes" << endl;
  else if (num.at(0)==num.at(1) && num.at(1)==num.at(2))
    cout << "Yes" << endl;
  else if (num.at(1)==num.at(2) && num.at(2)==num.at(3))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int x; readV(x);
  writeln(x < 1200 ? "ABC" : "ARC");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);
//桁数に注意 long long　にする

int main() {
  
  int n,m,c;
  cin >> n>>m>>c;
  
  vector<int> b(m);
  rep(i,m) {
  cin >> b[i];
  }
  
  vector<vector<int>> a(n, vector<int>(m));
  rep(i,n) {
    rep(j,m) {
      cin >> a.at(i).at(j);
    }
  }
  
  int ans = 0;
  
  rep(i,n) {
  int sum = c;
    rep(j,m) {
    sum+=a.at(i).at(j)*b[j];
    }
    if(sum>0) ans++;
  }
     
  cout << ans << endl;
  
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

x,y = m()

co = 0

for i in range(x):
    po = input()
    co += po.count("#")
print("Possible" if x+y - 1 == co else "Impossible")

Measured memory_bytes: 3316
import std.stdio, std.algorithm, std.string, std.conv, std.range;

void main(){
    string line;
    while(line = readln.chomp, line.length){
        auto d = line.to!int;
		int s;
		for(int x = 0; x < 600; x += d){
            s += x * x * d;
        }
		s.writeln;
        //reduce!((a, b) => a + b * b * d)(0, iota(d, 600, d)).writeln;
    }
}

Measured memory_bytes: 972
#!/usr/bin/env python

S = input()
S_copy = S
T = []
words = ['dream', 'dreamer', 'erase', 'eraser']

while True:
    match = False
    word_matched = ''
    # check if S_copy ends with word in words
    for word in words:
        if S_copy.endswith(word):
            match = True
            # print('S_copy is', f'{S_copy}')
            # print('ends with', f'{word}')
            if len(word) > len(word_matched):
                # print('this word is longer than previous word_matched')
                # print('word:', f'{word}')
                # print('previous word_matched:', f'{word_matched}')
                word_matched = word

    if match:
        T.insert(0, word_matched)
        # ends with dreamer
        # erasedreamer => erase
        S_copy = S_copy[:-len(word_matched)]
    else:
        break

# print(S)
# print(''.join(T))
if S == ''.join(T):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3508
#include<bits/stdc++.h>
using namespace std;

int main(void){
    char c[100][100];
    int a[100][100] = {};
    int h,w;
    cin >> h >> w;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++)cin >> c[i][j];
    }
    
    for(int i = 0;i < h;i++){
        bool check = true;
        for(int j = 0;j < w;j++){
            if(c[i][j] == '#')check = false;
        }
        if(check == true){
            for(int j = 0;j < w;j++)a[i][j] = 1;
        }
    }
    
    for(int i = 0;i < w;i++){
        bool check = true;
        for(int j = 0;j < h;j++){
            if(c[j][i] == '#')check = false;
        }
        if(check == true){
            for(int j = 0;j < h;j++)a[j][i] = 2;
        }
    }
    for(int i = 0;i < h;i++){
        if(a[i][0] == 1)continue;
        for(int j = 0;j < w;j++){
            if(a[i][j] == 0)cout << c[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

typedef vector<P> VP;
typedef vector<VP> VVP;

const int INF = 1e9;
const int di[] = {-1, 1, 0, 0}, dj[] = {0, 0, -1, 1};

int main(void){
    int h, w, k, si, sj, gi, gj;
    cin >> h >> w >> k >> si >> sj >> gi >> gj;
    si--;
    sj--;
    gi--;
    gj--;
    VVI wall(h, VI(w));
    REP(i,h){
        string s;
        cin >> s;
        REP(j,w){
            if (s[j] == '@') wall[i][j] = 1;
        }
    }
    vector<VVP> dist(h, VVP(w, VP(4, P(INF, INF))));
    queue<pair<P, int>> que;
    REP(k,4){
        dist[si][sj][k] = P(1, 0);
        que.push(make_pair(P(si, sj), k));
    }
    while (!que.empty()){
        pair<P, int> state = que.front();
        que.pop();
        int i = state.first.first;
        int j = state.first.second;
        int dir = state.second;
        int c = dist[i][j][dir].first;
        int d = dist[i][j][dir].second;

        // cout << i << " " << j << " " << dir << " " << c << " " << d << endl;
        REP(k,4){
            P p(c + 1, 0);
            if (p < dist[i][j][k]){
                dist[i][j][k] = p;
                que.push(make_pair(P(i, j), k));
            }
        }
        int ii = i + di[dir], jj = j + dj[dir];
        if (ii >= 0 && ii < h && jj >= 0 && jj < w && !wall[ii][jj]){
            P p(c, d + 1);
            if (p.second > k){
                p.first++;
                p.second = 1;
            }
            if (p < dist[ii][jj][dir]){
                dist[ii][jj][dir] = p;
                que.push(make_pair(P(ii, jj), dir));
            }
        }
    }
    int ans = INF;
    REP(k,4) chmin(ans, dist[gi][gj][k].first);
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 147688
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    int res = 1;
    char tmp = s[0];
    for (int i = 1; i < n; ++i) {
        if(tmp == s[i]) continue;
        tmp = s[i];
        res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables **************/
int n, m;
vector<int> x, y;
vector<P> p;
/**********************************************/

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n >> m;
    x.resize(m);
    y.resize(m);
    REP(i, m){
        cin >> x[i] >> y[i];
        x[i]--, y[i]--;
    }

    p.assign(n, P(0, 1));
    p[0].first = 1;

    REP(i, m){
        if(p[x[i]].first == 1 && p[x[i]].second == 1){
            p[x[i]].first = 0; p[x[i]].second = 0;
            p[y[i]].first = 1; p[y[i]].second++;
        }else if(p[x[i]].first == 1 && p[x[i]].second > 1){
            p[x[i]].second--;
            p[y[i]].first = 1; p[y[i]].second++;
        }else{
            p[x[i]].second--;
            p[y[i]].second++;
        }
    }
    int ans = 0;
    REP(i, n) if(p[i].first == 1) ans++;
    cout << ans << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;

    vector<vector<int>> dp(N + 1, vector<int>(4, 0));
    dp[0][0] = 1;
    REP(i, 0, N) {
        REP(j, 0, 4) {
            REP(k, 0, 10) {
                if (k == 0) {
                    dp[i + 1][j | 1] += dp[i][j];
                    dp[i + 1][j | 1] %= MOD;
                } else if (k == 9) {
                    dp[i + 1][j | 2] += dp[i][j];
                    dp[i + 1][j | 2] %= MOD;
                } else {
                    dp[i + 1][j] += dp[i][j];
                    dp[i + 1][j] %= MOD;
                }
            }
        }
    }
    cout << dp[N][3] << endl;
    return 0;
}

Measured memory_bytes: 57816
#include <cstdio>
#include <cstdint>
#include <cctype>
#include <cassert>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>

void preprocess(const std::string &s, std::string &t) {
  std::string u;
  for (char ch: s)
    if (!isspace(ch)) u += ch;

  t.clear();
  for (size_t i=0; i<u.length(); ++i) {
    if (u[i] == 'S') {
      ++i;
      assert(u[i] == '<');
      t += '(';
    } else if (isdigit(u[i])) {
      t += u[i];
    } else if (u[i] == '>') {
      if (i+2 < u.length() && u[i+1] == '>') {
        if (isdigit(u[i+2])) {
          t += '>';
          t += u[i+=2];
        } else if (u[i+2] == 'S') {
          t += '>';
          ++i;
        } else {
          t += ')';
        }
      } else {
        t += ')';
      }
    } else {
      assert(false);
    }
  }
}

const intmax_t MOD=1e9+7;

intmax_t parse(const std::string &s, size_t &i, size_t preced=0) {
  if (preced == 1) {
    if (s[i] == '(') {
      intmax_t res=parse(s, ++i, 0);
      assert(s[i] == ')');
      ++i;
      return res*res%MOD;
    } else if (isdigit(s[i])) {
      intmax_t res=s[i]-'0';
      while (++i < s.length() && isdigit(s[i]))
        res = res*10+s[i]-'0';
      return res;
    }
    assert(false);
  }
  intmax_t lhs=parse(s, i, preced+1);
  while (i < s.length()) {
    char op=s[i];
    if (op != '>') break;
    intmax_t rhs=parse(s, ++i, preced+1);
    (rhs<63? lhs>>=rhs:lhs=0);
  }
  return lhs;
}

int testcase_ends() {
  char buf[2000010];
  fgets(buf, sizeof buf, stdin);
  std::string s=std::move(buf), t;
  if (s == "#\n") return 1;

  preprocess(s, t);
  size_t i=0;
  printf("%jd\n", parse(t, i));
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 6144
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    x = I()
    n = 100
    c=0
    while n<x:
        n *=101
        n //=100
        c+=1
    print(c)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9580
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define DEBUG(debug_x) cerr <<#debug_x<<": "<<debug_x<<endl;
#define DEBUG2(debug_x, debug_y) cerr <<#debug_x<<":"<<debug_x<<" "<<#debug_y<<":"<<debug_y<<endl;
#define DEBUG3(debug_x, debug_y, debug_z) cerr <<#debug_x<<":"<<debug_x<<" "<<#debug_y<<":"<<debug_y<<" "<<#debug_z<<":"<<debug_z<<endl;
#define DEBUGVC(debug_x) cerr <<#debug_x<<": "; for(auto a:debug_x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(debug_x) cerr <<#debug_x<<":"<<endl; for(auto a:debug_x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (200005)
#define INF (1LL << 60)
const int MOD = (int)1e9+7;
typedef pair<int,int> Pii;
typedef pair<double,double> Pdd;


int N, Q;
vector<int> G[MAX_N];
vector<bool> F(MAX_N,false);
vector<int> V(MAX_N,0);

void dfs(int s, int c){
    F[s]=true;
    V[s] = c;
    for(int i=0; i<G[s].size(); i++){
        int u = G[s][i];
        if(F[u]) continue;
        dfs(u,c+V[u]);
    }
}
 
signed main() {
    int N, Q;
    cin >> N >> Q;

    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    for(int i=0; i<Q; i++){
        int p, x;
        cin >> p >> x;
        p--;
        V[p] += x;
    }

    dfs(0,V[0]);

    for(int i=0; i<N; i++) cout << V[i] <<" "; cout << endl;

}


Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main(){
  int n;
  int sum = 0;
  int data[100];
  int minv;
  int m;
  cin >> n;
  for(int i = 0;i < n;++i){
    cin >> data[i];
  }
  for(int i = 0;i < n - 1;i++){
    minv = INF;
    for(int j = i;j < n;j++){
      if(minv > data[j]){
	minv = data[j];
	m = j;
      }
    }
    if(m != i){
      swap(data[m],data[i]);
      sum++;
    }
    cout << data[i] << " ";
  }
  cout << data[n - 1] << endl << sum << endl;
  return(0);
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  char a;
  cin >> a;
  if ('A' <= a && a <= 'Z')
    cout << 'A' << endl;
  else
    cout << 'a' << endl;
  return 0;
}


Measured memory_bytes: 3604
// 6/30 解き直し
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

Graph G;
vector<int> points;
vector<int> ans;

void dfs(int v, int sum, int p) {
    ans[v] = sum + points[v];
    for (auto nv : G[v]) {
        if (nv == p) continue;
        dfs(nv, ans[v], v);
    }
    return;
}

int main() {
    int N, Q;
    cin >> N >> Q;
    G.resize(N);
    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    points.resize(N, 0);

    while (Q--) {
        int p, x;
        cin >> p >> x;
        p--;
        points[p] += x;
    }

    ans.resize(N, 0);

    dfs(0, 0, -1);

    for (auto a : ans) cout << a << endl;
}

Measured memory_bytes: 25100
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
vector<int>g[200001];
int vis[200001];
vector<int>comp[200001];
int x=0;
void dfs(int node)
{
    vis[node]=1;
    comp[x].push_back(node);
    for(auto i:g[node])
    {
        if(!vis[i])
            dfs(i);
    }
}
int main()
{
    ll n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(int i=1;i<=n;i++)
        vis[i]=0;
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
            dfs(i);
        x++;
    }
    int ans=0;
    for(int i=0;i<x;i++)
        ans=max(ans,(int)comp[i].size());
    cout<<ans<<endl;
}

Measured memory_bytes: 29944
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ubo upper_bound
#define lbo lower_bound
#define VI vector<int>
#define VL vector<ll>
#define VP vector<pii >
#define all(x) x.begin(), x.end()
#define M vector<VI >

using namespace std;

int main(){

	int n;
	cin >> n;
	VI a(n);
	for(int &i : a) cin >> i;

	ll ans = 0;
	sort(a.rbegin(), a.rend());

	priority_queue<ll> q;
	q.push(a[0]);

	for(int i=1; i<n; i++){
		ans += q.top();
		q.pop();
		q.push(a[i]);
		q.push(a[i]);
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pl=pair<ll,ll>;
using vi=vector<int>;
using vl=vector<ll>;
using vvi=vector<vi>;
using vvl=vector<vl>;
using vs=vector<string>;

void solve() {
    int N,M;
    cin >> N >> M;
    dsu d(N);
    int a,b;
    rep(i,M){
        cin >> a >> b;
        a--;
        b--;
        d.merge(a,b);
    }
    print(d.groups().size()-1);
}   

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 9044
#include "bits/stdc++.h"
using namespace std;

int main() {
	
	long long n, ind;
	cin >> n >> ind;
	vector<pair<long long, long long> > vc;
	
	for (int i=0; i<n; i++) {
		long long val, cn;
		cin >> val >> cn;
		vc.push_back(make_pair(val, cn));
	}
	
	sort(vc.begin(), vc.end());
	
	for (int i=0; i<n; i++) {
		if (ind <= 0) {
			cout << vc[i-1].first << endl;
			exit(0);
		}
		ind -= vc[i].second;
	}
	cout << vc[n-1].first << endl;
	
}

Measured memory_bytes: 2420
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		int a,d;
		Scanner sc=new Scanner(System.in);
		a=sc.nextInt();
		int c=sc.nextInt();
		for(int i=0;i<c;i++)
		{
			d=sc.nextInt();
			a=a-d;
			
		}
		if(a<=0)
		{System.out.println("Yes");}
		else
		{System.out.println("No");}
	
	}
}

Measured memory_bytes: 45808
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		StringBuffer sb = new StringBuffer();
		String line = sc.nextLine().toUpperCase();
		String[] lines = line.split(" ");
		for(int i=0; i<3; i++) {
			sb.append(lines[i].charAt(0));
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 35352
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    vector<int> v(5);
    rep(i, 5) cin >> v[i];
    int i = distance(v.begin(), find(v.begin(), v.end(), 0));
    cout << i + 1 << endl;
}


Measured memory_bytes: 3596
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		string s = GetString();
		for(int i = 0; i < s.Length; i++)
		{
			if((i < s.Length - 1) && (s[i] == s[i+1]))
			{
				Console.WriteLine($"{i+1} {i+2}");
				return;
			}
			if((i < s.Length - 2) && (s[i] == s[i+2]))
			{
				Console.WriteLine($"{i+1} {i+3}");
				return;
			}
		}
		Console.WriteLine("-1 -1");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 13908
<?php
list($w, $h, $n) = ints();
$x0 = $y0 = 0;
$x1 = $w;
$y1 = $h;
for ($i = 0; $i < $n; ++$i) {
    list($x, $y, $a) = ints();
    if ($a === 1) $x0 = max($x0, $x);
    if ($a === 2) $x1 = min($x1, $x);
    if ($a === 3) $y0 = max($y0, $y);
    if ($a === 4) $y1 = min($y1, $y);
}
echo max(0, $x1 - $x0) * max(0, $y1 - $y0);
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll N,ans = 1;
	cin >> N;
	vector<char> v;
	for (ll i = 0;i < N;i++){
		char l;
		cin >> l;
		v.pb(l);
	}
	for (ll i = 1;i < N;i++){
		if(v[i] != v[i - 1]){
			ans++;
		}
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n/2-1 << endl;
    }
    else{
        cout << n/2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  std::cin >> a;

  std::multiset<int64_t> ans;
  ans.insert(a[0]);

  for (int64_t i = 1; i < n; i++) {
    auto itr = ans.lower_bound(a[i]);
    if (itr == ans.begin()) {
      ans.insert(a[i]);
    } else {
      ans.erase(--itr);
      ans.insert(a[i]);
    }
  }
  std::cout << ans.size() << std::endl;
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define repi(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
using namespace std;
typedef long long ll;

int main() {
  string s; cin >> s;
  for (char c : s) {
    if(c=='1') cout << 9;
    else cout << 1;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <cmath>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;

int main() {
	int n;
	cin >> n;
	int odd = 0, even = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a % 2 == 1) {
			odd++;
		} else {
			even++;
		}
	}
	while (odd > 1 || even > 1) {
		even += odd / 2;
		odd %= 2;
		even = even % 2 + even / 2;
	}
	if (odd + even == 1) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
}






Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int N, M;
    cin >> N >> M;
    bool edge[9][9];
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            edge[i][j] = false;
        }
    }
    for(int i=0;i<M;i++){
       int a, b;
       cin >> a >> b;
       edge[a][b] = edge[b][a] = true;
    }

    int p[8];
    iota(p, p+8, 1);
    int ans = 0;

    do{
        for(int i=0;i<N-1;i++){
            if(!edge[p[i]][p[i+1]]) goto next;
        }
        ans++;
        next: ;
    }while(next_permutation(p+1, p+N));
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
from collections import deque


def main():
    ans = []
    while True:
        W, H = map(int, input().split())
        if W == 0 == H:
            break
        ipts = [input() if i % 2 == 1 else input()+" " for i in range(2*H-1)]
        v_wall = [[[False, False, False, False] for _ in range(W)] for _ in range(H)]
        for y in range(0, 2*H-1, 2):
            for x in range(0, 2*W-1, 2):
                for k in range(4):
                    dy, dx = moves[k]
                    ny, nx = y+dy, x+dx
                    if 0 <= ny < 2*H-1 and 0 <= nx < 2*W-1 and ipts[ny][nx] == "1":
                        v_wall[y//2][x//2][k] = True
        gd = 0
        que = deque([(0, 0, 1)])
        visited = set()
        visited.add((0, 0))
        while que:
            y, x, d = que.popleft()
            if y == H-1 and x == W-1:
                gd = d
                break
            for i in range(4):
                dy, dx = moves[i]
                ny, nx = y+dy, x+dx
                if 0 <= ny < H and 0 <= nx < W and not v_wall[y][x][i] and (ny, nx) not in visited:
                    que.append((ny, nx, d+1))
                    visited.add((ny, nx))
        ans.append(gd)
    for a in ans:
        print(a)


if __name__ == "__main__":
    moves = [(1, 0), (-1, 0), (0, 1), (0, -1)]
    main()


Measured memory_bytes: 6180
'''
https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    m = int(input())
    res, total = 0, 0

    for _ in range(m):
        d,c = map(int, input().split())
        total += d*c
        res += c
    res -= 1
    res += (total-1)//9
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
#define RENT 100000
int main(){
	int n;
	while(cin>>n){
		int ans=0;
		for(int a=0;a<10;a++){
			for(int b=0;b<10;b++){
				for(int c=0;c<10;c++){
					for(int d=0;d<10;d++){
						if(a+b+c+d==n)ans++;
					}
				}
			}
		}
		
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1160
# include <bits/stdc++.h>
 
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
# define forn(i, n) for (ll i = 0; i < int(n); i++)
# define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
# define all(V) V.begin(), V.end()
# define rall(V) V.rbegin(), V.rend()
# define len(V) (int)V.size()
# define ll long long
# define ld long double
# define ff first
# define ss second
# define pb push_back
# define mp make_pair
# define endl '\n'
# define M_PI 3.14159265358979323846
 
void solve()
{
        ll n, m; cin >> n >> m;
        if(n == 1 || m == 1) cout << 1 << endl;
        else cout << ((n * m) % 2 == 1 ? (n * m) / 2LL + 1 : (n * m) / 2LL);
}
 
int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        solve();
}

Measured memory_bytes: 256