akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)

#define FOREACH(x,a) for(auto&& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_ll.hpp>
// using namespace boost::multiprecision; // cpp_ll

#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>

#define pb(a) push_back(a)
#define mp make_pair


signed main(){
    SCIN(s);
    int n = s.size();
    int ans = 10000;
    REP(i,n-2){
        int t = 0;
        REP(j,3){
            int tt = 0;
            tt = (s[i + j] - '0');
            REP(k,2-j){
                tt *= 10;
            }
            t += tt;
        }
        ans = min(ans, abs(753-t));
    }
    COUT(ans);

}


Measured memory_bytes: 256
import java.util.BitSet;
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] penalties = new int[N];
		BitSet set = new BitSet(N);
		for (int i = 0; i < M; i++) {
			int p = sc.nextInt() - 1;
			boolean s = sc.next().equals("AC");
			if (s) {
				set.set(p);
			}
			if (!set.get(p)) {
				penalties[p]++;
			}
		}

		int sum = 0;
		for (int i = set.nextSetBit(0); i >= 0; i = set.nextSetBit(i + 1)) {
			sum += penalties[i];
		}
		System.out.println(set.cardinality());
		System.out.println(sum);
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 63732
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    ll n,k;
    cin>>n>>k;
    ll h[n+1];
    FOR(i,1,n)
    {
        cin>>h[i];
    }
    vector<ll> dp(n+1,INT64_MAX);
    dp[0]=0;
    dp[1]=0;
    if(n==1)
    return cout<<0,0;
    dp[2]=abs(h[2]-h[1]);
    if(n==2)
    return cout<<dp[2],0;
    for(int j=3;j<=k;j++)
    {
        for(int i=1;i<j;i++)
        {
            dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
        }
    }
    for(int i=k+1;i<=n;i++)
    {
        for(int j=i-k;j<i;j++)
        {
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n];
  }  
  return 0;
}

Measured memory_bytes: 1792
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(a*n,b); 
	return 0;
}

Measured memory_bytes: 256
a,b,c,d = gets.strip.split(" ").map(&:to_i)

w = c - a
h = d - b

w = -w if w < 0
h = -h if h < 0

if w ==0 or h == 0
  puts 0
end

if (w < h)
  k = w
  w = h
  h = k
end

gcd = w.gcd(h)

original = w + h - 1
base = w / gcd
cross = w / base
puts original - cross + 1

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		int z = scanner.nextInt();

		int cnt = 0;
		x -= z;
		while (x >= y + z) {
			x -= (y + z);
			cnt++;
		}

		System.out.println(cnt);
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int h,w;
  cin>>h>>w;
  char a[h][w];
  int z[27]={};
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a[i][j];
      z[a[i][j]-'a']++;
    }
  }

  int one=0,two=0;
  for(int i=0;i<26;i++){
    if(z[i]%4==2) two++;
    else if(z[i]%4==1) one++;
    else if(z[i]%4==3){
      one++;
      two++;
    }
  }
  
  bool flag=0;
  if(h%2&&w%2){
    if(one<=1&&two<=(h-1)/2+(w-1)/2) flag=1;
  }else if(h%2){
    if(one==0&&two<=w/2) flag=1;
  }else if(w%2){
    if(one==0&&two<=h/2) flag=1;
  }else{
    if(one==0&&two==0) flag=1;
  }

  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
#include<iostream>
using namespace std;

int play(int &P, int &Q){

  if(P%2==1){
    P=P-1;
  }

  P=P/2;
  Q=Q+P;

  //  cout << "lala"<<" P:"<<P<<" Q:"<<Q<<endl;                                 
  return 0;

}


int main(){
  int A, B, K;
  cin >> A >> B >> K;

  for(int i(0);i<K;i++){
    if(i%2 == 0){//高橋くん                                                     
      play(A,B);
    }
    else{//青木くん                                                             
      play(B,A);
    }
  }

  cout <<A <<" "<< B <<endl;
  //  cout <<K <<" "<< B <<" "<< A <<endl;                                      
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n,a,b;
  cin>>n;
  cin>>a>>b;

  int x=0,y=0,z=0;
  for(int i=0;i<n;i++){
    int p;
    cin>>p;
    if(p<=a) x++;
    else if(p<=b) y++;
    else z++;
  }

  cout<<min(min(x,y),z)<<endl;

  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 n = sc.nextInt();
		for(int i=0;i<n;i++){
			if(i!=0) System.out.println();
			int m = sc.nextInt();
			int[][]  map = new int[m][m];
			int d = 0;
			int x = 0;
			int y = m-1;
			for(int j=0;j<m;j++){
				if(d==0){
					d = 1;
					for(int k=y;k>=0;k--){
						map[k][x] = 1;
						if(j!=0 && map[k-2][x]==1){
							y = k;
							break;
						}
						y = k;
					}
				}else if(d==1){
					d = 2;
					for(int k=x;k<m;k++){
						map[y][k] = 1;
						if(j!=1 && map[y][k+2]==1){
							x = k;
							break;
						}
						x = k;
					}
				}else if(d==2){
					d = 3;
					for(int k=y;k<m;k++){
						map[k][x] = 1;
						if(j!=2 && map[k+2][x]==1){
							y = k;
							break;
						}
						y = k;
					}
				}else if(d==3){
					d = 0;
					for(int k=x;k>=0;k--){
						map[y][k] = 1;
						if(map[y][k-2]==1){
							x = k;
							break;
						}
						x = k;
					}
				}
			}
			for(int j=0;j<m;j++){
				for(int k=0;k<m;k++){
					if(map[j][k]==0) System.out.print(" ");
					else System.out.print("#");
				}
				System.out.println();
			}
			
		}
	}	
}

Measured memory_bytes: 24720
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
from collections import Counter
dic=Counter(a)
dic=sorted(dic.items(),key=lambda x:x[1])

ans=0
cnt=0
l=max(len(dic)-k,0)
for i in dic:
  if cnt==l:
    break
  ans=ans+i[1]
  cnt=cnt+1
print(ans)


Measured memory_bytes: 42996
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <algorithm>

using namespace std;
#define n_max 100000
#define M_max 50
#define N_max 50


int main()
{
    int N, M; 
    int num[N_max][N_max];
    int p[M_max][2];
    int path[N_max];

    cin >> N >> M;
    
    for(int i = 0; i < N; i++) {
        path[i] = 0;
        for(int j = 0; j < N; j++) {
            num[i][j] = 0;
        } 
    }

    for(int i = 0; i < M; i++) {
        cin >> p[i][0] >> p[i][1]; 
    }

    for(int i = 0; i < M; i++) {
        num[p[i][0] - 1][p[i][1] - 1]++;
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            //if(num[i][j] || num[j][i]) path[i]++;
            path[i] += num[i][j];
            path[i] += num[j][i];
        }
    }

    for(int i = 0; i < N; i++) {
        cout << path[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
from math import sqrt,floor
k=1
divisor = []
sq = floor(sqrt(m))+2
while k < sq:
    if m%k==0:
        divisor += [k]
    k+=1

for v in divisor:
    if v >= n:
        print(m//v)
        exit()
divisor.reverse()
for v in divisor:
    if v <= m//n:
        print(v)
        exit()


Measured memory_bytes: 3060
use proconio::input;

fn main() {
    input!{
        s: String,
    }
    let sv = s.as_bytes().to_vec();
    let mut tally: Vec<bool> = vec![false; 26];
    for c in sv.iter() {
        let i: usize = (c - b'a').into();
        assert!(i < 26);
        tally[i] = true;
    }
    let mut i: u8 = 0;
    for b in tally.iter() {
        if !*b {
            let c: char = (b'a' + i) as char;
            println!("{}", c);
            return ();
        }
        i += 1;
    }
    println!("None");
}


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

// macros
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define INT_IN(a) int a; cin >> a
#define STR_IN(s) string s; cin >> s
#define PRINTLN(s) cout << s << endl
#define PRINTDOUBLELN(s) cout << setprecision(12) << (s) << endl;

// util functions
template<class T> inline T sqr(T x) {return x*x;}

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template <typename T>inline T max(vector<T> v){T max=v[0]; FOR(i, 1, v.size())max=MAX(v[i], max); return max;}
template <typename T>inline T min(vector<T> v){T min=v[0]; FOR(i, 1, v.size())min=MIN(v[i], min); return min;}
template <typename T>inline vector<T> concat(vector<T> a, vector<T> b){vector<T> ab; ab.reserve(a.size()+b.size());ab.insert(ab.end(),a.begin(),a.end());ab.insert(ab.end(),b.begin(),b.end());return ab;}

// types
typedef long long LL;

// consts
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//debug
#define dump(x)  #x << " = " << (x) << endl
#define debug(x) #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl


int main(){
    STR_IN(s);
    int N = s.size();
    vector<bool> tcd(N, false);
    REP(i, N){
        if(s[i] == 'p')tcd[i] = true;
    }

    vector<bool> acd(N, false);
    vector<int> paperStock(N, 0);
    int pS = 0;

    // try getting as much same choice as possible
    REP(i, N){
        if(tcd[i] and pS){
            pS--;
            acd[i] = true;
        }else{
            pS++;
        }
        paperStock[i] = pS;
    }

    vector<int> infPS(N);
    int min = paperStock[N - 1];
    REP(i, N){
        if(paperStock[N - 1 - i] < min) min = paperStock[N - 1 - i];
        infPS[N - 1 - i] = min;
    }

    int usedPaperOffset = 0;
    REP(i, N){
        if(!tcd[i] and !acd[i] and infPS[i] > usedPaperOffset + 1){
            acd[i] = true;
            usedPaperOffset += 2;
        }
    }

    int aScore = 0;
    REP(i, N){
        if(tcd[i] and !acd[i]) aScore--;
        else if(!tcd[i] and acd[i]) aScore++;
    }
    PRINTLN(aScore);
    return 0;
}



Measured memory_bytes: 1280
using System;

namespace atcorder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int A = int.Parse(s.Split(' ')[0]);
            int B = int.Parse(s.Split(' ')[1]);
            int C = int.Parse(s.Split(' ')[2]);
            int X = int.Parse(s.Split(' ')[3]);
            int Y = int.Parse(s.Split(' ')[4]);

            //2*X個half買う場合(足りないときはBを買う
            int a = 0;
            a += 2 * X * C;
            if (Y > X) a += (Y - X) * B;

            //2*Y個half買う場合(足りないときはAを買う
            int b = 0;
            b += 2 * Y * C;
            if (X > Y) b += (X - Y) * A;

            //全て普通に買う
            int c = X * A + Y * B;

            Console.WriteLine(Math.Min(a, Math.Min(b, c)));
        }
    }
}


Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var a = ReadSplitLong();
            for (int i = a.Count - 1; i > 0; i--)
            {
                if (a[i] < a[i-1] && a[i-1] - a[i] >= 2)
                {
                    Println("No");
                    return;
                } 
                else if (a[i] < a[i - 1])
                {
                    a[i - 1]--;
                }
            }

            Println("Yes");
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 28636
#include<iostream>
using namespace std;
int main(){
	int k, s;
	int count = 0;
	cin >> k >> s;
	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			int z = s - x - y;
			if(z<=k&&z>=0){
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
struct Robot
{
    ll l,r;
    Robot(ll pos,ll L)
    {
        l = pos - L;
        r = pos + L;
    }
    bool operator<(const Robot&o)const
    {
        return r < o.r;
    }
};
void solve(long long N, std::vector<long long> X, std::vector<long long> L){
    vector<Robot> robots;
    for(int i=0;i<N;++i)
    {
        Robot r(X[i],L[i]);
        robots.emplace_back(r);
    }
    sort(robots.begin(),robots.end());
    ll last = -1e18;
    int ans = 0;
    for(int i=0;i<N;++i)
    {
        if(robots[i].l >= last)
        {
            ans++;
            last = robots[i].r;
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(X), std::move(L));
    return 0;
}


Measured memory_bytes: 3956
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int i,n,rs;
string s;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>s;
	n=(int)s.size();
	for(i=0;i<n/2;i++)if(s[i]!=s[n-i-1])rs++;
	cout<<rs<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b;
    cin>>a>>b;
    cout<<(a+b)%24<<endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> A(N);
	for (auto& e: A) scanf("%d", &e);
	std::set<std::pair<int, int>> appeared;
	appeared.insert({1, -1});
	for (int i{}; i < N; i++)
	{
		if (-A[i] < appeared.rbegin()->first)
			appeared.erase(appeared.upper_bound({-A[i], 1 << 30}));
		appeared.insert({-A[i], i});
	}
	printf("%d\n", appeared.size());

	return 0;
}

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, k, d;
    cin >> x >> k >> d;
    ll ax = abs(x);
    ll q = ax / d;
    if (q < k) {
        ll y = ax - q * d;
        // kokonaosu
        k -= q;
        if (k % 2 == 1) {
            out(abs(y - d));
        } else {
            out(y);
        }
    } else {
        out(ax - k * d);
    }

    return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<algorithm>
#include<vector>
#include<bitset>
using namespace std;
vector<int>E[1010];
int D[5010], n, w[1010], chk;
bool DFS(int a) {
	int i;
	if (E[a].empty()) {
		D[a] = 0;
		return true;
	}
	int s = 0, r = 0;
	bitset<5100>T;
	T[0] = 1;
	for (auto &x : E[a]) {
		if (!DFS(x))return false;
		s += w[x] + D[x];
		r += min(w[x], D[x]);
		T = (T << w[x]) | (T << D[x]);
	}
	if (r > w[a]) return false;
	for (i = w[a]; i >= 0; i--)if (T[i])break;
	int pv = i;
	D[a] = s - pv;
	return true;
}
int main() {
	int i, a;
	scanf("%d", &n);
	for (i = 2; i <= n; i++) {
		scanf("%d", &a);
		E[a].push_back(i);
	}
	for (i = 1; i <= n; i++)scanf("%d", &w[i]);
	if (!DFS(1))puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}

Measured memory_bytes: 1664
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    PS=[None]*m
    for i in range(m):
        p,s=input().split()
        PS[i]=int(p)-1,s

    AC=[False]*n
    WA=[0]*n

    ac=0
    wa=0
    for p,s in PS:
        if(AC[p]): continue
        if(s=='WA'):
            WA[p]+=1
        else:
            ac+=1
            wa+=WA[p]
            AC[p]=True

    print(ac,wa)
resolve()

Measured memory_bytes: 53084
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << max(max(a,b),c) - min(min(a,b),c) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ll n;
	cin >> n;
	ll k = 2;
	while (true) {
		if (k * (k - 1) / 2 == n) {
			break;
		}
		else if (k * (k - 1) / 2 > n) {
			cout << "No" << endl;
			return 0;
		}
		++k;
	}
	ll cnt = 1;
	vector<vector<ll>> ans(k);
	for (ll i = 0; i < k; ++i) {
		for (ll j = i + 1; j < k; ++j) {
			ans[i].push_back(cnt);
			ans[j].push_back(cnt);
			++cnt;
		}
	}
	assert(cnt == n + 1);
	cout << "Yes" << endl;
	cout << k << endl;
	for (vector<ll> v : ans) {
		cout << v.size();
		for (ll x : v) {
			cout << " " << x;
		}
		cout << endl;
	}
}

Measured memory_bytes: 5140
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
    }

    bool flag = 1;
    int cou = 0;
    while(flag) {
        flag = 0;
        for(int j = n-1; j > 0; j--) {
            if(a[j] < a[j-1]) {
                swap(a[j], a[j-1]);
                flag = 1;
                cou++;
            }
        }
    }

    rep(i, n) {
        cout << a[i] << (i == n-1 ? '\n':' ');
    }
    cout << cou << endl;
}


Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
using namespace std;

const double PI=acos(-1);

int main(){
    string s;
    int d[4] = {0};
    cin >> s;

    for(int i = 0; i < s.length(); i++){
        if(s[i] == 'N') d[0]++;
        else if(s[i] == 'S') d[1]++;
        else if(s[i] == 'W') d[2]++;
        else if(s[i] == 'E') d[3]++;
    }

    if((d[0] == 0 && d[1] > 0) || (d[1] == 0 && d[0] > 0) || (d[2] == 0 && d[3] > 0) || (d[3] == 0 && d[2] > 0))
        cout << "No" << endl;
    else 
        cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
who_have=[]
while(K!=0):
    k=int(input())
    someone_have=list(map(int,input().split()))
    if(len(someone_have)!=0):
        for i in someone_have:
            if(i in range(1,N+1)):
                who_have.append(i)
    K-=1
print(N-len(set(who_have)))

Measured memory_bytes: 9192
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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



int main() {
  int r, g, b;
  cin >> r >> g >> b;
  if((100*r + 10*g + b) % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;



int main()
{
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if (s == u){
        cout << a-1<< " " <<b << endl;
    }
    else if (t == u){
        cout << a <<" "<<b-1<< endl;
        
    }
    else {
        cout << "ERROR" << endl;
    }
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
// #define __LOCAL
#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
 
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }

void solve(){

    ll N,K,R,S,P;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;
    string best="";

    for(auto t:T){
        if(t=='r') best+='p';
        if(t=='s') best+='r';
        if(t=='p') best+='s';
    }
    
    ull score=0;
    for(ll i=0;i<N;i++){
        if((i-K>=0)&(best[i]==best[i-K])){best[i]='x'; continue;}
        else if(best[i]=='r'){score+=R;}
        else if(best[i]=='s'){score+=S;}
        else if(best[i]=='p'){score+=P;}
    }
    DBG(best);
    cout << score << endl;

}
int main()
{
    fast_io();
    solve();
}


Measured memory_bytes: 640
import sys

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

n, m = nil()

a = []
b = []
c = []
d = []

x = []
ans = []

for i in range(n):
    u, v = nil()
    a.append(u)
    b.append(v)
for i in range(m):
    u, v = nil()
    c.append(u)
    d.append(v)

for i in range(n):
    x.append(INF)
    ans.append(0)
    for j in range(m):
        t = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if(x[i] > t):
            ans[i] = j
            x[i] = t

for i in ans:
    print(i+1)


Measured memory_bytes: 3064
h,w=map(int,input().split())

a=[]
for i in range(h):
  a.append(input())

alpha=[0 for i in range(26)]

for i in range(h):
  for j in range(w):
    alpha[ord(a[i][j])-ord("a")]+=1


l=[0,0,0]
for i in range(26):
  l[0]+=alpha[i]//4
  alpha[i]=alpha[i]%4
  l[1]+=alpha[i]//2
  alpha[i]=alpha[i]%2
  l[2]+=alpha[i]
  alpha[i]=0

if l[1]<=(h//2)*(w%2)+(w//2)*(h%2) and l[2]==(h%2)*(w%2):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9224
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47336
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
        }
    return digit;
    }

ll F(ll x,ll y){
    return max(GetDigit(x),GetDigit(y));
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    for(ll i=0;i<N;i++){
        cin>>A[i]
    ;}
    Map m;
    ll counter=0;
    for(ll i=0;i<N;i++){
        m[A[i]]++;
        if(m[A[i]]>1)counter++;
    ;}
    /*vector<P> vec(0);
    for(auto p: map){
        if(p.second>1){
            vec.emplace_back(p);
        }
    ;}
    ll siz=vec.size()
    auto l=vec.begin();
    auto r=vec.end()-1;*/
    if(counter%2==1){cout<<N-counter-1<<endl;return 0;}
    cout<<N-counter<<endl;


    //cout<<N-(ll)(counter/2)<<endl;

    return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <cstring>
#define fre
#define DEBUG
using namespace std;
int a[105];
int main()
{
    int n, ans = 100000000, sum;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    for (int i = -100; i <= 100; ++i) 
    {
        sum = 0;
        for (int j = 0; j < n; ++j) sum += (a[j] - i) * (a[j] - i);
        ans = min(ans, sum);
    }
    printf("%d\n", ans);
}

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

#define int long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define all(c) (c).begin(),(c).end()
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const ld PI = acos(-1.0);

int32_t main(){
	fast;
	int n,a;
	cin >> n >> a;
	cout << ceil(n/(ld)a);
	
}



Measured memory_bytes: 256
def rec(li, ri, ln, rn, hand):
    if hand == 0:
        win = 1
        if li < 5:
            if ln < 5: win = min(win, rec(li, ri, li + ln, rn, 1 - hand))
            if rn < 5: win = min(win, rec(li, ri, ln, li + rn, 1 - hand))
        if ri < 5:
            if ln < 5: win = min(win, rec(li, ri, ri + ln, rn, 1 - hand))
            if rn < 5: win = min(win, rec(li, ri, ln, ri + rn, 1 - hand))
    else:
        win = 0
        if ln < 5:
            if li < 5: win = max(win, rec(li + ln, ri, ln, rn, 1 - hand))
            if ri < 5: win = max(win, rec(li, ri + ln, ln, rn, 1 - hand))
        if rn < 5:
            if li < 5: win = max(win, rec(li + rn, ri, ln, rn, 1 - hand))
            if ri < 5: win = max(win, rec(li, ri + rn, ln, rn, 1 - hand))
    return win
                
Li, Ri = map(int, raw_input().split())
Ln, Rn = map(int, raw_input().split())

print "ISONO" if rec(Li, Ri, Ln, Rn, 0) == 0 else "NAKAJIMA"

Measured memory_bytes: 6444
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(int i=0;i<(int)v.size();i++) cout<<" "<<v[i]; cout<<endl;
int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int t=1;
	//cin>>t;
	while(t--){
		int c;
		cin>>c;
		if(c<=599)
			cout<<8<<endl;
		else if(c>599&&c<800)
			cout<<7<<endl;
		else if(c>=800&&c<1000)
			cout<<6<<endl;
		else if(c>=1000&&c<1200)
			cout<<5<<endl;
		else if(c>=1200&&c<1400)
			cout<<4<<endl;
		else if(c>=1400&&c<1600)
			cout<<3<<endl;
		else if(c>=1600&&c<1800)
			cout<<2<<endl;
		else
			cout<<1<<endl;
	}
}



Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() {
    int n=1e5, m[100001], q;
    bool s[100001];
    s[0]=s[1]=false;
    for(int i=2;i<=n;i++){
        s[i]=true;
        for(int j=2;j*j<=i;j++){
            if(i%j==0){
                s[i]=false;
                continue;
            }
        }
    }
    m[0]=m[1]=m[2]=0;
    for(int i=3;i<=n;i++){
        m[i]=m[i-1];
        if(s[i]&&s[(i+1)/2]){
            m[i]++;
        }
    }
    cin>>q;
    for(int i=0;i<q;i++){
        int l, r;
        cin>>l>>r;
        cout<<m[r]-m[l-1]<<endl;
    }
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

unsigned int randxor()
{
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}


int main() {

	double t, x;
	cin >> t >> x;
	cout << t / x << endl;
	

	return 0;
}





Measured memory_bytes: 256
N, M = map(int, input().split())
AB = [(a, b) for _ in range(N) for a, b in [map(int, input().split())] if M - a >= 0]

AB = sorted(sorted(AB, key=lambda x: x[0], reverse=False), key=lambda x: x[1], reverse=True)
x = [0] * M
p = [x for x in range(M)]

cnt = 0
for a, b in AB:
    i = M-a

    s = []
    while i >= 0 and p[i] != i:
        s.append(i)
        i = p[i]
    for j in s:
        p[j] = i - 1

    if i >= 0:
        x[i] = b
        p[i] = i - 1

print(sum(x))


Measured memory_bytes: 69592
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#include<climits>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<(n);i++)
//#define end(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
    
    ll s,d,q,h,n;
    cin>>q>>h>>s>>d;
    cin>>n;
    s=min(s,min(q*4,h*2));
    if(d>s*2){
    	cout<<n*s<<endl;
	}
	else{
		cout<<n/2*d+n%2*s<<endl;;
	}
    
	return 0;
}


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

using namespace std;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second

struct segment_tree
{
	int n;
	vector<int> a;

	segment_tree(int n) : n(n), a(2 * n) {}

	void update(int p, int v)
	{
		for (a[p += n] = v; p /= 2;)
			a[p] = min(a[2 * p], a[2 * p + 1]);
	}

	int query(int l, int r)
	{
		int g = 1<<30;

		for (l += n, r += n; l < r; l /= 2, r /= 2)
		{
			if (l & 1) g = min(g, a[l++]);
			if (r & 1) g = min(g, a[--r]);
		}

		return g;
	}
};

vector<int> lis(const vector<int> &a)
{
	vector<int> l, who(a.size()), where(a.size());
	for (auto &i : a)
	{
		auto it = upper_bound(l.begin(), l.end(), i) - l.begin();
		where[&i-&a[0]] = !it ? -1 : who[it-1];
		if (it == l.size()) l.emplace_back();
		l[it] = i, who[it] = &i-&a[0];
	}

	vector<int> ans;
	for (int p = who[l.size()-1]; p != -1; p = where[p])
		ans.push_back(p);

	reverse(ans.begin(), ans.end());
	return ans;
}

int main()
{
	#ifdef TurnRed
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;
	vector<int> a(n);
	for (auto &i : a) cin >> i;

	for (auto &i : a) i *= -1;
	cout << lis(a).size() << "\n";

//	segment_tree st(n);
//	for (int i = 0; i < n; ++i)
//		st.update(i, a[i]);
//
//	int ans = n;
//	for (int i = n-1; i >= 1; --i)
//	{
//		int l = 0, r = i-1;
//		while (l < r)
//		{
//			int m = (l + r + 1) >> 1;
//			if (st.query(m, i) < a[i])
//				l = m;
//			else
//				r = m-1;
//		}
//		if (st.query(l, l+1) < a[i])
//		{
//			--ans;
//			st.update(l, 1<<30);
//		}
//	}
//	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 2552
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
    ll n, k, b, ans = 0;

    cin >> n >> k;

    if (k == 0) {
        cout << n * n << endl;
        return 0;
    }

    for (b = k + 1; b <= n; b++) {
        ans += (ll)(b - k) * (n / b);
        ans += max(0ll, n % b - k + 1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int m=0;
    int ans=a+b+c;
    chmax(m,a);
    chmax(m, b);
    chmax(m, c);
    ans-=m;
    ans+=m*int(pow(2,k));
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5 + 5)

N = int(input())

g = {i: [] for i in range(1, N+1)}

for _ in range(N-1):
    a, b, c = map(int, input().split())
    g[a].append((b, c))
    g[b].append((a, c))

Q, K = map(int, input().split())
xy = []
for _ in range(Q):
    xy.append(tuple(map(int, input().split())))

d = [-1 for _ in range(N+1)]


def dfs(s: int):
    for v, c in g[s]:
        if d[v] == -1:
            d[v] = d[s] + c
            dfs(v)


d[K] = 0
dfs(K)

for x, y in xy:
    print(d[x]+d[y])

Measured memory_bytes: 153648
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	vector<pair<int, int>> v;
	int mx = 0, mn = 1e9 + 1;
	vector<int> x(n), y(n);
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &x[i], &y[i]);
		if (x[i] < y[i]) swap(x[i], y[i]);
		v.push_back({x[i], i});
		v.push_back({y[i], i});
		mx = max(mx, x[i]);
		mx = max(mx, y[i]);
		mn = min(mn, x[i]);
		mn = min(mn, y[i]);
	}
	int dx = *max_element(x.begin(), x.end()) - *min_element(x.begin(), x.end());
	int dy = *max_element(y.begin(), y.end()) - *min_element(y.begin(), y.end());
	ll ans = (ll)dx * dy;
	sort(v.begin(), v.end());
	int tot = 0;
	vector<int> cnt(n);
	ll diff = mx - mn;
	int j = 1;
	for (int i = 1; i < v.size(); ++i) {
		while (tot < n && j < v.size()) {
			if (++cnt[v[j].second] == 1) {
				++tot;
			}
			++j;
		}
		assert(j > i);
		if (tot == n) ans = min(ans, diff * (v[j - 1].first - v[i].first));
		if (--cnt[v[i].second] == 0) --tot;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 8048
#include<stdio.h>
int main(){
	double a;
	double p;
	double x;
	double y;
	p=3.141592653589;//pは円周率
	scanf("%lf",&a);
	x=a*a*p;
	y=2*a*p;
	printf("%.6lf %.6lf\n",x,y);
	return 0;
}

Measured memory_bytes: 652
H , W = map(int,input().split())
c = [list(map(int,input().split())) for i in range(10)]
for k in range(10):
  for i in range(10):
    for j in range(10):
      if c[i][j] > c[i][k] + c[k][j]:
        c[i][j] = c[i][k] + c[k][j]
s = 0
for i in range(H):
  a = list(map(int,input().split()))
  for j in range(W):
    if a[j] == -1:
      a[j] = 1
    s += c[a[j]][1]
print(s)    

Measured memory_bytes: 9200
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  int K;
  cin >> N >> K;
  int count = 0;
  for(int i = 0; i < N; ++i) {
    int h;
    cin >> h;
    if (h >= K) { ++count; }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)
#if ds[int(N/2)] == ds[int(N/2)+1]:
#  print("0")
#else:
print(ds[int(N/2)]-ds[int(N/2)-1])

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

using namespace std;
using LL = long long;
using P = pair<int,int>;
const int INF=1e9;

int main(){
	int N;
	cin >> N;
	vector<int> B(N+1);
	rep(i,N-1) cin >> B[i+1];
	B[0]=INF, B[N]=INF;
	int ans=0;
	rep(i,N) ans+=min(B[i],B[i+1]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
ll n,k;
cin>>n>>k;
vector<int>p(n);
vector<int>c(n);
rep(i,n)cin>>p[i];
rep(i,n)cin>>c[i];
rep(i,n)p[i]--;
ll ans=-1e18;
rep(si,n)
{
ll x=si;
ll tot=0;
vector<int>s;
while(1)
{
x=p[x];
tot+=c[x];
s.push_back(c[x]);
if(x==si)break;
}
int l=s.size();
ll t=0;
rep(i,l)
{
t+=s[i];
if(i+1>k)break;
ll now=t;
if(tot>0)
{
ll e =(k-(i+1))/l;
now+=e*tot;


}
ans=max(ans,now);
}



}
cout <<ans;
}

Measured memory_bytes: 3628