akhauriyash/Code-Regression huggingface dataset:
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
int main() {
    cout.precision(15);
    cout << fixed;
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    REP(i,N)
        cin>>A[i]>>B[i];
    sort(ALL(A));
    sort(ALL(B));
    if (N%2==0) {
        ll tb=B[N/2]+B[N/2-1];
        ll ta=A[N/2]+A[N/2-1];
        cout<<tb-ta+1<<endl;
    }else {
        cout<<B[N/2]-A[N/2]+1<<endl;
    }
}


Measured memory_bytes: 6348
#include<iostream>

using namespace std;
int main()
{ long long int h,a;
  cin>>h>>a;
  int sum=0,i,k[a];
  for(i=0;i<a;i++)
  {
      cin>>k[i];
      sum +=k[i];
  }
    if(sum>=h)
        cout<<"Yes";
    else
        cout<<"No";



return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int p=998244353;
int n,ans,cnt;
int x[1010],y[1010],m[1010];
bool check(int i,int j,int k)
{return (y[i]-y[j])*(x[i]-x[k])==(x[i]-x[j])*(y[i]-y[k]);}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&x[i],&y[i]);
	m[0]=1;
	for(int i=1;i<=n;i++) m[i]=(m[i-1]<<1)%p;
	ans=m[n]-n-1;
	for(int i=1;i<=n;i++) for(int j=1;j<=n&&j!=i;j++){
		cnt=0;
		for(int k=1;k<=n&&k!=i&&k!=j;k++) if(check(i,j,k)) cnt++;
		ans=(ans-m[cnt]+p)%p;
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

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

    int len=s.size();
    if(len<=n) cout<<s<<endl;
    else{
        for(int i=0; i<n; i++) cout<<s[i];
        cout<<"..."<<endl;
    }

    return 0;
}


Measured memory_bytes: 3692
num, min, max = gets.chomp.split(' ').map(&:to_i)
result = 0

(1..num).each do |n|
  tmp = n
  sum = 0
  while tmp > 0
    sum += tmp % 10
    tmp /= 10
  end
  if sum >= min && sum <= max
    result += n
  end
end

p result


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    ll ans=0;
    for(int i=0;i<n;i++){
        ll a;cin>>a;
        ans+=a-1;
    }
    cout<<ans;
}

Measured memory_bytes: 256
a = [input().split() for l in range(2)]
count = 0
N = int(a[0][0])
for i in range(N):
    for j in range(i):
        for k in range(j):
           if int(a[1][i]) != int(a[1][j]) and int(a[1][j]) != int(a[1][k]) and int(a[1][k]) != int(a[1][i]):
                if int(a[1][i]) > abs(int(a[1][j])-int(a[1][k])) and int(a[1][i]) < int(a[1][j])+int(a[1][k]):
                    count = count + 1
print(count)


Measured memory_bytes: 9168
#include <iostream>
#include <vector>
#include <stdio.h>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
#define intl long long
#define mp make_pair

int main(){
int a,b,c;
cin>>a>>b>>c;
if(a+b>=c){
	cout<<"Yes"<<endl;	
}
else{
	cout<<"No"<<endl;
}
return 0;
}

Measured memory_bytes: 256
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

int dp[3010][3010];
string s, t;

int solve(int i, int j) {
    if(i >= s.size() || j >= t.size()) return dp[i][j] = 0;
    if(dp[i][j] != -1) return dp[i][j];
    return dp[i][j] = max({(s[i] == t[j]) + solve(i+1, j+1), solve(i+1, j), solve(i, j+1)});
}

int main() {
    ios_base::sync_with_stdio(false);
    memset(dp, -1, sizeof dp);
    cin >> s >> t;
    int size = solve(0,0);

    string ans = "";
    int i = 0;
    int j = 0;
    while(dp[i][j] > 0) {
        if(dp[i+1][j+1] >= dp[i+1][j] && dp[i+1][j+1] >= dp[i][j+1]) {
            if(s[i] == t[j])
                ans += s[i];
            i++;
            j++;
        }else if(dp[i+1][j] > dp[i][j+1]){
            i++;
        }else {
            j++;
        }
    }
    assert(ans.size() == size);
    cout << ans << "\n";
}


Measured memory_bytes: 35840
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		String A = scan.next();
		String B = scan.next();

		char[] ac = A.toCharArray();
		char[] bc = B.toCharArray();

		//ArrayList<String> list = new ArrayList<String>();
		String a = "";

		for(int i = 0; i< N; i++) {
			a += String.valueOf(ac[i]);
			a += String.valueOf(bc[i]);
		}
		
		System.out.println(a);


	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
using namespace std;


int main(){
	int N, T, A;
	cin >> N >> T >> A;
	int H[N];
	for (int i=0;i<N;i++){
		cin >> H[i];
	}
	double best = 10000000.0;
	int besti = -1;
	for(int i=0;i<N;i++){
		if(abs(T - H[i] * 0.006 - A) <= best){
			best = abs(T - H[i] * 0.006 - A);
			besti = i;
		}
	}
	cout << besti + 1 << endl;
}

Measured memory_bytes: 256
/** author: __nishad__ **/

#include<bits/stdc++.h>
using namespace std;


typedef long long ll ;
typedef vector<ll> vll ;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define pb push_back
#define pi 3.14159265358979323
#define endl "\n"

int main()
{
    IOS;

    string s;
    cin>>s;
    int n = s.size(), i;
    bool ans = true;

    string str1 = s.substr(2,s.size()-3);
    int c = count(str1.begin(), str1.end(), 'C');

    if(s[0] == 'A'){
        if(s.find('C') >=2 && s.find('C') <n-1 && c == 1){
            for(i=0; i<n; i++){
                if(s[i] == 'A' || s[i] == 'C'){
                    continue;
                }
                else if(s[i] < 'a' || s[i] > 'z')
                    ans =false;
            }
        }
        else ans = false;
    }
    else ans = false;

    cout<<(ans? "AC" : "WA");

}



Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(){
	int d,x=0,i=0;
    cin >> d;
    while(true){
      x=x+i;
      if(x>=d) break;
      i++;
    }
    cout << i << endl;
}

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

int main(void){
    string a,b;
    cin>>a;
    cin>>b;

    int i;
    for(i=0;i<b.size();i++){
        cout<<a[i]<<b[i];
    }
    if(a.size() > b.size()){
        cout<<a[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,ans;
int main() {
	scanf("%d",&n);
	for (register int i=1;i<=n;++i) {
		double g=log10(i);
		if (ceil(g)==g) g+=1;
		else g=ceil(g);
		int t=g;
		if (t&1) ++ans;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int main() {
	string MARCH = "MARCH";
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	string s[100010];
	ll c[5] = { 0 };
	cin >> N;
	REP(i, N) {
		cin >> s[i];
		REP(j, MARCH.length()) {
			if (s[i][0] == MARCH[j]) {
				c[j]++; 
				break;
			}
		}
	}
	ll ans = 0;
	REP(i, 5) {
		REPL(j,i+1, 5) {
			REPL(k,j+1, 5) {
				ans += c[i] * c[j] * c[k];
			}
		}
	}

	cout << ans << endl;
	return 0;
}


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

int main() {
    string S, T;
    cin >> S >> T;
    auto solve = [&](string s, string t) {
        map<char, char> ma;
        rep(i, 0, s.size()) {
            if(!ma[s[i]]) ma[s[i]] = t[i];
            if(ma[s[i]] != t[i]) return false;
        }
        return true;
    };
    cout << (solve(S, T) && solve(T, S) ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 1544
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;

    cout << min({P + Q, Q + R, R + P}) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int n;
    int m;
    int l;
  
 
   cin >> n >> m >> l;
  
   if(n <= l && l <= m){

     cout << "Yes" << endl;
     
   }else{
     
     cout << "No" << endl;
     
   }
  

  
  return 0;
}

Measured memory_bytes: 256
def canWinNim(n: int, stones: list):
    states = [False] * (n+1)
    for i in range(1, n+1):
        for step in stones:
            if not states[i-step] and i-step >= 0:
                states[i] = True
    return 'First' if states[-1] else 'Second'

N, K = tuple(map(int, input().split()))
stones = list(map(int, input().split()))
print(canWinNim(K, stones))

Measured memory_bytes: 3828
import java.io.*;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    private static StringTokenizer st;

    private static String readToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public static void main(String[] args) throws IOException {
        char[] S = readToken().toCharArray();
        char[] T = readToken().toCharArray();

        int count = 0;
        for (int i = 0; i < S.length; i++) {
            if (S[i] != T[i]) count++;
        }
        pw.println(count);
        pw.close();
    }
}


Measured memory_bytes: 37640
import java.util.Scanner;

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

    int N = scanner.nextInt();
    long tm = 1, am = 1;
    for (int i = 0; i < N; i++) {
      long t = scanner.nextInt();
      long a = scanner.nextInt();
      long k = Math.max((tm - 1) / t, (am - 1) / a);
      tm = (k + 1) * t;
      am = (k + 1) * a;
    }
    System.out.println(tm + am);
  }
}


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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int r;
    cin >> r;
    cout << (r >= 2800 ? "AGC" : (r >= 1200 ? "ARC" : "ABC")) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define f first
#define s second
ll a,b,c,d,h,w;
ll xDir[4]={0,0,-1,1};
ll yDir[4]={1,-1,0,0};
bool mat[1005][1005];
bool visited[1005][1005];
string s;
bool isValid(ll x,ll y)
{
    return x>=0 && x<h && y>=0 && y<w;
}
void solve()
{
    deque<pair<pair<ll,ll>,ll> > q;
    q.push_front(make_pair(make_pair(a,b),0));
    while(!q.empty())
    {
        pair<pair<ll,ll>,ll > best=q.front();
        q.pop_front();
        pair<ll,ll> pos=best.f;
        if(visited[pos.f][pos.s])   continue;
        visited[pos.f][pos.s]=1;
        if(pos.f==c && pos.s==d)
        {
            cout<<best.s<<"\n";
            return;
        }
        for(ll i=0;i<4;i++)
        {
            ll newX=pos.f+xDir[i];
            ll newY=pos.s+yDir[i];
            if(isValid(newX,newY)&&!visited[newX][newY]&&mat[newX][newY])
                q.push_front(make_pair(make_pair(newX,newY),best.s));
        }
        for(ll dx=-2;dx<=2;dx++)
        {
            for(ll dy=-2;dy<=2;dy++)
            {
                ll newX=pos.f+dx;
                ll newY=pos.s+dy;
                if(isValid(newX,newY)&&mat[newX][newY]&&!visited[newX][newY])
                   q.push_back(make_pair(make_pair(newX,newY),best.s+1));
            }
        }
    }
    cout<<"-1\n";
    return;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>h>>w;
    cin>>a>>b>>c>>d;
    a--;
    b--;
    c--;
    d--;
    for(ll i=0;i<h;i++)
    {
        cin>>s;
        for(ll j=0;j<w;j++)
           mat[i][j]=(s[j]=='.');
    }
    solve();
    return 0;
}

Measured memory_bytes: 6860
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T> void print(T x) {std::cout << x << '\n';}
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {
  REP(i, v.size()) {
    if (i != 0) std::cout << s;
    std::cout << v[i];
  }
  std::cout << '\n';
}

/* }}} */

signed main()
{
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> A(n); REP(i, n) cin >> A[i];
  vector<ll> dp(n + 1, LINF);
  dp[0] = 0;

  REP(i, n) {
    ll a = -LINF, b = LINF;
    for (int j = 1; j <= m && i + j <= n; ++j) {
      a = max(a, A[i + j - 1]);
      b = min(b, A[i + j - 1]);
      dp[i + j] = min(dp[i + j], dp[i] + k + j * (a - b));
    }
  }
  print(dp[n]);

  return 0;
}

Measured memory_bytes: 3240
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N, Q;
	string S;
	cin >>N>>Q>> S;

	VI sum(N, 0);
	REP(i, N-1) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			sum[i + 1]++;
		}
	}
	REP(i, N - 1) {
		sum[i + 1] += sum[i];
	}

	//REP(i, N)cout << sum[i];

	REP(i, Q) {
		int a, b;
		cin >> a >> b;

		cout << sum[b-1] - sum[a - 1] << endl;
	}
	//cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1872
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N;
  cin>>N;
  cout<<1110-N<<endl;
return 0;}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  string S;
  cin >> S;
  
  vl alp(26, 0);
  ll N = S.size();
  
  rep(i, N){
    alp[S[i] - 'a']++;
  }

  rep(i, 26){
    if(alp[i] == 0){
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }

  cout << "None" << endl;
  
  return 0;
}


Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)
	as := make(map[int]bool)
	for i := 0; i < m; i++ {
		var a int
		fmt.Scanf("%d\n", &a)
		as[a] = true
	}
	fmt.Println(solve(0, n, as))
}

var memo map[int]int = make(map[int]int)

func solve(i, n int, as map[int]bool) int {
	if x, ok := memo[i]; ok {
		return x
	}
	if i == n {
		memo[i] = 1
		return 1
	}
	if i > n {
		memo[i] = 0
		return 0
	}
	if _, ok := as[i]; ok {
		memo[i] = 0
		return 0
	}
	var ans int
	ans += solve(i+1, n, as)
	ans %= 1000000007
	ans += solve(i+2, n, as)
	ans %= 1000000007
	memo[i] = ans
	return ans
}


Measured memory_bytes: 18816
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define lol long long
#define in(n,s) insert(n,s)//ノート参照
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int gcd(int x,int y){//最大公約数
  if(y>x) swap(x,y);
  int r=x%y;
  while(r!=0){
    x=y;
    y=r;
    r=x%y;
  }
  return y;
}
int Lcm(int x,int y){//最小公倍数
  int t=x*y;
  return t/gcd(x,y);
}
priority_queue<int> i[300000];
bool ma[100],ma2[100];
lol a,b,c,d,g,h;
bool can(int n,int m){
  if(n<0) return false;
  if(m<0) return false;
  if(n>=a) return false;
  if(m>=b) return false;
  return true;
}
int dfs(int n,int m){
  if(n==g&&m==h) return true;
  //if(i[n][m]!=i[c][d]||!can(n,m)||ii[n][m]) return false;
  //ii[n][m]=true;
  return dfs(n+1,m)+dfs(n,m+1)+dfs(n-1,m)+dfs(n,m-1);
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long e=0,f=0,j=1;
  string w,p;
  char hann[100],hann2[100];
  bool ans=true,ans2=true;
  cin >>w>>p;
  for(int n=0;n<w.size();n++){
    int tas=p[n]-'a';
    if(ma[tas]){
      if(hann[tas]!=w[n]) ans=false;
    }
    else{
      ma[tas]=true;
      hann[tas]=w[n];
    }
    tas=w[n]-'a';
    if(ma2[tas]){
      if(hann2[tas]!=p[n]) ans2=false;
    }
    else{
      ma2[tas]=true;
      hann2[tas]=p[n];
    }
  }
  if(ans&&ans2) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}


Measured memory_bytes: 10260
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#define SF scanf
#define PF printf
#define MAXN 300010
#define INF 0x3FFFFFFF
using namespace std;
typedef long long ll;
int n,x,ans,suma,sumb;
set<int> a,b;
int main(){
	SF("%d",&n);
	for(int i=1;i<=n;i++){
		SF("%d",&x);
		if(i%2==1)
			a.insert(x);
		else
			b.insert(x);
	}
	a.insert(INF);
	b.insert(INF);
	for(int i=1;i<=n;i++){
		if(i%2==1){
			if(*a.begin()>*b.begin()){
				suma++;
				int x=*b.begin();
				b.erase(x);	
			}
			else{
				int x=*a.begin();
				a.erase(x);	
			}
		}
		else{
			if(*a.begin()<*b.begin()){
				sumb++;
				int x=*a.begin();
				a.erase(x);	
			}
			else{
				int x=*b.begin();
				b.erase(x);	
			}
		}
	}
	PF("%d",max(suma,sumb));
}

Measured memory_bytes: 4864
#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

template<class T>
inline bool chmax(T& a, const T b) { return a < b && (a = b, true); }

int main() {

	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	int M = 0;
	lint ans = 0;
	for (int i = 0; i < N - 1; i++) {
		chmax(M, A[i]);
		ans += max(M - A[i + 1], 0);
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3988
#include <iostream>
#include <algorithm>

using namespace std;

long long a,b,c;

int main()
{
    cin >> a >> b >> c;
    if (c%2 == 0 || b%2 == 0 || a%2 == 0) cout << 0;
    else 
        cout << min(min(a,b),c)*(a+b+c-max(max(a,b),c)-min(min(a,b),c));
}

Measured memory_bytes: 256
#include <iostream>

long distance(long x, long y) { return x * x + y * y; }

int main(int argc, char *argv[]) {
  long n, d;
  std::cin >> n >> d;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int x, y;
    std::cin >> x >> y;
    if (distance(x, y) <= d * d)
      cnt++;
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		
		int b = sc.nextInt();
		
		System.out.println(a * b + " " + (a + b) * 2);
		
	}

}



Measured memory_bytes: 25984
n,p=map(int,input().split())
if n==1:
    print(p)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m = m//i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]**(d.count(s[i])//n)
    #print(d)
    print(ans)


Measured memory_bytes: 5048
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long

int cmpfunc (const void * a, const void * b)
{
    return ( *(int*)a - *(int*)b );
}


int main()
{

    int N ;
    scanf("%d",&N);
    int array[N];

    for (int i = 0; i<N; i++)
        scanf("%d",&array[i]);
    int div=0;
    int remain=0;
    int min = array[0];

    qsort(array, N, sizeof(int), cmpfunc);
    int i = 1;
    while(1)
    {
        if (array[1]>array[0])
        {
            div=array[1]/array[0];
            remain = array[1]%array[0];

            if (remain!=0)
            {
                array[1]=array[1]-div*array[0];
            }
            else if (remain==0)
            {
                array[1]=array[0];
                break;
            }
        }
        else
        {
            div=array[0]/array[1];
            remain = array[0]%array[1];

            if (remain!=0)
            {
                array[0]=array[0]-div*array[1];
            }
            else if (remain==0)
            {
                array[0]=array[1];
                break;
            }

        }

    }



if (N!=2)
{

    for (int i = 1; i<N; i++)
    {
        div=array[i]/array[i-1];
        remain = array[i]%array[i-1];
        if (remain!=0)
        {
            array[i]=array[i]-div*array[i-1];
        }
        else if (remain==0)
            array[i]=array[i-1];
    }
}
    for (int i = 0; i<N; i++)
    {
        if (min>array[i])
            min=array[i];

    }

    printf("%d",min);


    return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;

  if (S == "AAA" || S == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
L = [int(s) for s in input().rstrip().split(' ')]
m = 0 #min
k = 0
for i in range(len(L)):
  if i == 0:
    m = L[0]
    k += 1
  else:
    if L[i] <= m:
      m = L[i]
      k += 1
print(k)

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

int main()
{
	int64_t h, w;
	cin >> h >> w;

	if (h == 1 || w == 1)
	{
		cout << 1 << endl;
		return 0;
	}

	cout << (h * w + 1) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int resultArray[] = new int[num];

		for(int i = 0; i < num; i++) {
			int existStudentNum = sc.nextInt();
			resultArray[existStudentNum-1] = i+1;
		}

		for (int result : resultArray) {
		    System.out.print(result + " ");
		}
		sc.close();
	}
}


Measured memory_bytes: 61232
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#define mp make_pair
#define pb push_back
using namespace std;
const int N = 1e2 + 5;

int n;
int a[N];

int dp[N][2];


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];

    dp[1][0] = 0;
    dp[1][1] = 1;
    for(int i = 2; i <= n; i++)
    {
        if(a[i] != a[i - 1])
            dp[i][0] = min(dp[i - 1][1], dp[i - 1][0]);
        else
            dp[i][0] = dp[i - 1][1];

        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + 1;

       // cerr << dp[i][0] << " " << dp[i][1] << endl;
    }

    cout << min(dp[n][0], dp[n][1]) << endl;

    return 0;
}


Measured memory_bytes: 256
import math
N=int(input())
xy=[]
nagasas=[]
for i in range(N):
  x = list(map(int, input().split()))
  xy.append(x)

for i in range(N-1):
  for j in range(i+1, N):
    kari=(xy[i][0]-xy[j][0])*(xy[i][0]-xy[j][0])+(xy[i][1]-xy[j][1])*(xy[i][1]-xy[j][1])
    nagasa=math.sqrt(kari)
    nagasas.append(nagasa)
wa=sum(nagasas)
n_kumiawase=N*(N-1)/2
kumiawase=math.factorial(N)
n_set=kumiawase/n_kumiawase
kotae=wa*n_set*(N-1)/kumiawase
print(kotae)


Measured memory_bytes: 3064
#include<stdio.h>
int main (void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b && b<c)
    {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;

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; }

int main() {
    int x[2] = {};
    int y[2] = {};
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    int dx = x[1]-x[0];
    int dy = y[1]-y[0];
    rep(i,2){
        int ty = dx;
        int tx = -dy;
        x[1] += tx;
        y[1] += ty;
        dx = tx;
        dy = ty;
        cout << x[1] << " " << y[1] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[105],n,m,sum,num;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	double x=sum/(4.0*m);
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=x)num++;
	}
	if(num>=m)
	  cout<<"Yes";
	else
	  cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=998244353ll;

vector<long long> tr;

void add(int ind, long long val){
    ind++;
    while(ind<tr.size()){
        tr[ind]=(tr[ind]+val)%MOD;
        ind+=(ind&(-ind));
    }
}

long long get(int ind){
    ind++;
    long long ans=0;
    while(ind>0){
        ans+=tr[ind];
        ind-=(ind&(-ind));
    }
    return ans%MOD;
}

long long get_range(int l, int r){
    return (MOD+get(r)-get(l-1))%MOD;
}

void solve(){
    int n,k;
    cin>>n>>k;
    tr=vector<long long>(n+10,0ll);
    add(1,1);
    vector<pair<int,int>> kvec(k,{0,0});
    for(auto &x:kvec) cin>>x.first>>x.second;  

    long long diff=0;
    for(int j=1;j<=n;j++){
        // for(int i=0;i<=n;i++) cout<<get_range(i,i)<<(i<n?" ":"\n");
        for(int i=0;i<k;i++){
            diff=get_range(j-kvec[i].second,j-kvec[i].first);
            add(j,diff);
        }
        // for(int i=0;i<=n;i++) cout<<get_range(i,i)<<(i<n?" ":"\n");
    }
    cout<<get_range(n,n)<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    i64 N, K, S;
    cin >> N >> K >> S;
    i64 a = 1e9;
    if(S > 1e5) a = 1;
    vector<int> A(N, a);
    rep(i, K) A[i] = S;
    rep(i, N) {
        cout << A[i] << "  \n"[i == N-1];
    }
}

Measured memory_bytes: 1664
s = list(str(input()))
ans = "Yes"
for i, n in enumerate(s):
  if i % 2 == 0:
    if n == "R" or n == "U" or n == "D":
      continue
    else:
      ans = "No"
  else:
    if n == "L" or n == "U" or n == "D":
      continue
    else:
      ans = "No"
print(ans)

Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  int m, n;
  char s[9];
  while(scanf("%d%d", &m, &n) && m && n){
      vector<bool>mem(m);
      rep(i, m) mem[i] = false;
      int p = 0, c = 1;
      FOR(i, 1, n+1){
	scanf("%s", s);
	if(c < m){
	  int f = 0;
	  if(i % 15 == 0){
	    if(strcmp(s, "FizzBuzz")) f = 1;
	  }else if(i % 5 == 0){
	    if(strcmp(s, "Buzz")) f = 1;
	  }else if(i % 3 == 0){
	    if(strcmp(s, "Fizz")) f = 1;
	  }else{
	    if(i != atoi(s)) f = 1;
	  }
	
	  if(f) mem[p] = 1, ++c;
	  do{
	    p = (p+1)%m;
	  }while(mem[p]);
	}
      }
      int f = 0;
      rep(i, m){
	if(!mem[i]){
	  printf(f ? " %d":"%d", i + 1);
	  f = 1;
	}
      }
      puts("");
  }
  return 0;
}

Measured memory_bytes: 1048
#include<iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
    // 整数の入力
    int a, b ,c, d;
    cin >> a >> b;
    c = abs(a - b)/2;
    d = min(a,b) + c;
    if(a%2 == b%2){
      cout << d;
    }else{
      cout << "IMPOSSIBLE";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
string S; 
int N;
int Ans=0;
int Cnt3=1,Cnt5=1,Cnt7=1;
int bit=1;
string T="357";
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>S;
	N=atoi(S.c_str());
	if(N>777777753) N=777777753;
	int Len=S.length();
	for(int i=0;i<Len-3;i++) T='0'+T;
	while(atoi(T.c_str())<=N)
	{
		if(Cnt3&&Cnt5&&Cnt7) ++Ans;
		char ch=T[Len-1];
		if(ch=='0')
		{
			++Cnt3;
			T[Len-1]='3';
		}
		else if(ch=='3')
		{
			--Cnt3,++Cnt5;
			T[Len-1]='5'; 
		}
		else if(ch=='5')
		{
			--Cnt5,++Cnt7;
			T[Len-1]='7'; 
		}
		else
		{
			bit=1;
			while(T[Len-bit]=='7')
			{
				--Cnt7,++Cnt3;
				T[Len-bit]='3';
				++bit;
			}
			ch=T[Len-bit];
			if(ch=='0')
			{
				++Cnt3;
				T[Len-bit]='3';
			}
			else if(ch=='3')
			{
				--Cnt3,++Cnt5;
				T[Len-bit]='5'; 
			}
			else if(ch=='5')
			{
				--Cnt5,++Cnt7;
				T[Len-bit]='7'; 
			}
		}
	}
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define MP make_pair
#define PB push_back
#define in int
#define ll long long
#define ull unsigned long long
#define vc vector
#define SQ(j) (j)*(j)
#define x first
#define y second
//
//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define pdd pair<dbl,dbl>
#define sz(xxx) ((int)(xxx.size()))
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

//#define printf(...) (0)
#define db(x) if(DEBUG) {cout << #x << " = " << x << endl;}
#define dbCont(x) if(DEBUG) {cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout<<endl;}

using namespace std;

template<class K, class V>
ostream &operator<<(ostream &out, pair<K, V> &elem) {
    out << "{" << elem.first << "," << elem.second << "}";
    return out;
}

// 4:13

int DEBUG = 0;

using namespace std;

const int N = 100 * 1000 + 5;
const ll MOD = 1000 * 1000 * 1000 + 7;

int main() {

    ll h, n;
    cin >> h >> n;

    ll sum = 0;
    loop(i,n){
        ll e;
        cin >> e;
        sum += e;
    }

    if(sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

#define MAX_N 100001
int n;

int a[MAX_N+1];
int dp2[MAX_N+1];

void solve2(){/*長さに対する最小の最終要素*/
    
    fill(dp2,dp2+n,INF);
    for(int i = 0;i < n;i++){
        *lower_bound(dp2,dp2+n,a[i]) = a[i];
    }
    cout << lower_bound(dp2,dp2+n,INF)-dp2 << endl;
    
    }
    

int main(){

    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    
    solve2();

    return 0;
}


Measured memory_bytes: 3868
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main()
{
   string S,T;
   int cnt=0;
   cin>> S;
   cin>> T;
   for(int i=0;i<S.length();i++){
    if(S[i]!=T[i])cnt++;
   }
   cout<<cnt<<endl;
    return 0;
}

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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    cout << (a <= c && c <= b ? "Yes" : "No") << nl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define um unordered_map
#define us unordered_set
#define f first
#define s second
#define pb push_back
#define MOD 998244353
#define eps 1e-9
#define INF 1000000002

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pii> piii;
const int N = 1001;


int n, m;
vector<int> unlock[N];
int cost[N], dp[N][1<<12];

int solve(int i, int mask) {
    if(mask == (1<<n)-1)
        return 0;
    if(i == m)
        return INF;
    if(dp[i][mask])
        return dp[i][mask];
    int ans = solve(i+1, mask);
    int newMask = mask;
    for(int j : unlock[i])
        newMask = newMask | (1<<j);
    return dp[i][mask] = min(ans, cost[i] + solve(i+1, newMask));
}

int main() {
    cin>>n>>m;
    for(int i = 0;i<m;i++) {
        int x;
        cin>>cost[i]>>x;
        while(x--) {
            int y;
            cin>>y;
            unlock[i].pb(--y);
        }
    }
    int ans = solve(0, 0);
    cout<<(ans == INF?-1:ans);
    return 0;
}


Measured memory_bytes: 16384
n = int(input())
X = [0]*(10**4+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            t = (x+y)**2+(y+z)**2+(z+x)**2
            if t%2 == 0:
                if 0 <= t//2 <= 10**4:
                    X[t//2] += 1

for i in range(1, n+1):
    print(X[i])


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

int main(){
    int N, M; cin >> N >> M;
    vector<ll> A(N);
    for( ll &k : A ) cin >> k;
    sort(A.begin(),A.end());

    ll B, C;
    vector<pair<ll,ll>> coms;
    coms.push_back(make_pair(0,1000000000)); 
    while(cin >> B >> C){
        coms.push_back(make_pair(C,B));
    }
    sort(coms.begin(),coms.end());
    reverse(coms.begin(),coms.end());

    ll i = 0, j = 0, ans = 0;
    while(i != N){
        ans += max(coms[j].first,A[i]);
        i++; coms[j].second--;
        if(coms[j].second == 0){
            j++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; 
	cin >> n;
	double a;
	string s;
	double all=0;
	vector<pair<double,string>> pairs(n);
	for(int i=0;i<n;i++){
	cin >> a >> s;
	pairs[i]=make_pair(a,s);}
	for(int i=0;i<n;i++){
	if(pairs[i].second=="BTC"){
	all+=380000.0*pairs[i].first;
	}
	
	if(pairs[i].second=="JPY")
		all+=pairs[i].first;
	
	
	}

	cout << all << endl;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

int main(){
  string s; cin >> s;
  int N = s.size();

  ll ans = 0, cnt = 0;
  rep(i,N){
    if (s[i]=='A'){
      cnt++;
    }
    else if (i<N-1 && s.substr(i,2)=="BC"){
      ans += cnt;
      i++;
    }
    else cnt = 0;
  }
  cout << ans << endl;


  
  // cout << fixed << setprecision(10);
  
  return 0;
}


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

using namespace std;

#define INF INT_MAX
#define F first
#define S second

typedef long long ll;
typedef pair<int,int>P;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22) cout<<"bust"<<endl;
  else cout<<"win"<<endl;
      
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    
    vector<vector<P>> G(n);
    rep(i, n-1) {
        ll a, b, cost;
        cin >> a >> b >> cost;
        a--;  b--;
        G[a].pb(make_pair(b, cost));
        G[b].pb(make_pair(a, cost));
    }

    ll q, k;
    cin >> q >> k;
    k--;
    
    vl dist(n, -1);  // dist[v] : 頂点vの根からの距離
    queue<ll> Q;
    const ll root = k;  // デフォルトで根は頂点0
    dist[root] = 0;
    Q.push(root);
    while(!Q.empty()) {
        ll v = Q.front();
        Q.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist[u] != -1) {
                continue;
            }
            dist[u] = dist[v] + cost;
            Q.push(u);
        }
    }

    vl ans(q);
    rep(i, q) {
        ll x, y;
        cin >> x >> y;
        x--;  y--;
        ans[i] = dist[x] + dist[y];
    }

    rep(i, q) {
        out(ans[i]);
    }
    
    re0;
}

Measured memory_bytes: 10752
#include <stdio.h>
#include <string.h>
#define MAX 80

int main(void){
	int sum=0, i, t; char a[MAX+1];
	
	while(~scanf("%s",a)){
		for(i=0; i<strlen(a); i++){
			if('0'<=a[i] && a[i]<='9'){
				t=a[i]-'0', i++;
				while('0'<=a[i] && a[i]<='9') t=t*10+a[i]-'0', i++;
				sum+=t;
			}
		}
	}
	
	printf("%d\n",sum);
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  cout << "ABC";
  cout << n << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h> 
int main (int argc,char **argv)
{
	char a[2],b[2];
	int c = 0,d = 0;

	scanf("%s%s",a,b);

	c = strcmp(a,"H");
	d = strcmp(b,"H");

	if ((c == 0) && (d == 0))
	{
		printf("H\n");
	}

	else if ((c == 0) && (d != 0))
	{
		printf("D\n");
	}

	else if ((c != 0) && (d == 0))
	{
		printf("D\n");
	}

	else
	{
		printf("H\n");
	}

	return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int a,b ;
   cin >> a >> b ;
   if((a-b*2)<0)
     cout << 0 << endl;
   else
     cout << a-b*2 << endl;    
  
    return 0;
}


Measured memory_bytes: 256