akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
int su = 0;
void solve() {  
    int n;
    cin >> n;
    const int M = 1e9 + 7;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        ans += (x * su) % M;
        ans %= M;
        su += x;
        su %= M;
    }
    cout << ans;
}       

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  reverse(all(s));
  ll i = 0;
  bool ans = true;

  while(i < s.size()) {
    if(s.size() - i >= 7) {
      string s7 = s.substr(i, 7);
      reverse(all(s7));
      if(s7 == "dreamer") {
        i += 7;
        continue;
      }
    }
    if(s.size() - i >= 6) {
      string s6 = s.substr(i, 6);
      reverse(all(s6));
      if(s6 == "eraser") {
        i += 6;
        continue;
      }
    }
    if(s.size() - i >= 5) {
      string s5 = s.substr(i, 5);
      reverse(all(s5));
      if(s5 == "dream" || s5 == "erase") {
        i += 5;
        continue;
      }
    }
    ans = false;
    break;
  }
  cout << (ans ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int a, b, c;
	vector<bool>d(b);
	cin >> a >> b >> c;
	for (int i = 1;i < 1010;++i) {
		int target = a * i;
		int amari = target % b;
		if (d[amari]) {
			break;
		}
		d[amari] = true;
	}
	if (d[c])puts("YES");
	else puts("NO");
	return 0;
}


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

int main ()
{
   ll n,k;cin>>n;ll a[n],b[n],c[n];
   ll dp[n][3];
    fr(i,n)cin>>a[i]>>b[i]>>c[i];
   dp[0][0]=a[0];
   dp[0][1]=b[0];
   dp[0][2]=c[0];
    for(ll i=1;i<n;i++)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c[i]; 
    }
    cout<<max(dp[n-1][2],max(dp[n-1][0],dp[n-1][1]))<<endl;
    return 0;
}

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

using namespace std;

string s, t;
int n, i;

int a[222];
int b[222];

int main()
{

    cin >> s >> t;

    n = s.size();
    for(i = 0; i < n; i ++)
    {
        a[ s[i] ]++;
        b[ t[i] ]++;
    }
    sort(a + 'a', a + 'z' + 1);
    sort(b + 'a', b + 'z' + 1);
    for(i = 'a'; i <= 'z'; i ++)
    {
        if(a[i] != b[i])
        {
                cout << "No";
                return 0;
        }
    }

    cout << "Yes";
    return 0;
    //sort(s.begin(), s.end());
    //sort(t.begin(), t.end());

    return 0;
}


Measured memory_bytes: 776
"use strict"
var x = require('fs').readFileSync('/dev/stdin','utf8');
var arr=x.split(' ');
let a=parseInt(arr[0]);
let b=parseInt(arr[1]);
let s = '==';
if (a < b) s='<';
if (a>b) s='>';
console.log('a ' + s + ' b');



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

int main() {
  int start, end;
  string s;
  cin >> s;

  for(int i = 0; i < s.size(); i++) {
    if(s.at(i) == 'A') {
      start = i;
      break;
    }
  }
  for(int i = s.size() - 1; i >= 0; i--) {
    if(s.at(i) == 'Z') {
      end = i;
      break;
    }
  }
  if(end - start > 0) cout << end - start + 1 << endl;
  else                cout << 0 << endl;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()

int main() {

	//clock_t start, end;
	//start = clock();

	int M;
	cin >> M;

	cout << 48 - M << endl;

	//end = clock();
	//printf("%f sec.\n", double(end - start) / CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define elif else if
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string

signed main(){
  int N,M,O,P=0,c=0,c2=0,crash=0,nowtab=1;
  double D,D2;
  char C;
  str S,T,U;
  vint v(0);
  cin>>N;
  vint A(N);
  vint B(N);
  rep(0,N){
    cin>>A[i];
    B[i]=A[i];
    if(c<A[i]){
      c=A[i];
      c2=i;
    }
  }
  sort(all(B));
  rep(0,N){
    if(c2!=i)cout<<c<<endl;
    else cout<<B[N-2]<<endl;
  }
}


Measured memory_bytes: 4736
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [_, k] <- getIntList
    hs <- getIntList
    print . length $ filter (>= k) hs

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll x,n;cin>>x>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll c=0;
    while(true){
        ll flag=x-c;
        bool b=true;
        rep(i,0,n-1){
            if(a[i]==flag){
                b=false;
                break;
            }
        }
        if(b){
            cout<<flag<<endl;
            return 0;
        }
        flag=x+c;
        b=true;
        rep(i,0,n-1){
            if(a[i]==flag){
                b=false;
                break;
            }
        }
        if(b){
            cout<<flag<<endl;
            return 0;
        }
        c++;
    }
    
    return 0;
}





Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define maxn 300005
#define maxa 2000005
#define MOD    100000000  //1000000007 //998244353
#define INF 1000000000000000000
#define ll long long

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << " "; cout << endl;}


void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve(){
    ll n, a, b;
    cin >> n >> a >> b;

    for(ll i = a; i <= b; i++){
        if(i%n == 0){
            ANS("OK")
        }
    }
    ANS("NG")

}

main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3652
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int ans=0;
    for(int i=0;i<s.size();i++)
    {
        ans += s[i]-'0';
    }
    if(ans%9==0)    cout << "Yes";
    else
    {
        cout << "No";
    }
    
    return 0;
}

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

typedef long long ll;
ll x[100010];

int main() {
	// your code goes here
	int i, j, n;
	ll a, b;
	cin>>n>>a>>b;
	ll ans=0;
	for(i=1; i<=n; ++i)	cin>>x[i];
	for(i=1; i<n; ++i) {
		if((x[i+1]-x[i])*a>b)	ans+=b;
		else	ans+=(x[i+1]-x[i])*a;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;
void swap(ll &a,ll &b){
    ll temp=a;
    a=b;
    b=temp;
}
ll gcd(ll a,ll b){
    while(b){
        a%=b;
        swap(a,b);
    }
    return a;
}

ll lcm(ll a,ll b){
    ll ans=(a*b)/gcd(a,b);
    return ans;
}

void solve(){
    int N;
    int K;
    cin>>N>>K;
    vpi e1,e2;
    FOR(i,2,N+1){
        e1.emplace_back(1,i);
    }
    for(int i=2;i<=N;i++){
        for(int j=i+1;j<=N;j++){
            e2.emplace_back(i,j);
        }
    }
    if(K>e2.size()){
        out(-1);
        return;
    }
    for(int i=0;i<K;i++){
        e2.pop_back();
    }
    out(e1.size()+e2.size());
    for(int i=0;i<e1.size();i++){
        cout<<e1[i].first<<" "<<e1[i].second<<endl;
    }
    for(int i=0;i<e2.size();i++){
        cout<<e2[i].first<<" "<<e2[i].second<<endl;
    }
    return;


}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	string s;
	cin>>s;
	ll i=0,j=s.size()-1;
	for(;i<s.size();i++)
	{
		if(s[i]=='A')
			break;
	}
	for(;j>=0;j--)
	{
		if(s[j]=='Z')
			break;
	}
	cout<<max(0ll,j-i+1);
	return;
}

int main()
{
	fast;
	ll q=1;
	// cin>>q;
	while(q--)
		solve();
	return 0;
}



Measured memory_bytes: 3760
s = int(input())
m = 1000000
a = set()
a.add(s)
ans = 0
for i in range(1,m+5):
    tmp = 0
    if s%2==0:
        tmp = s//2
    else:
        tmp = 3*s+1
    if tmp in a:
        ans = i+1
        break
    s = tmp
    a.add(s)
print(ans)

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 

int main(void) {
	ll a,b,c;  cin >>a>>b>>c;
	vll d(3);
	d[0]=abs(a-b);
	d[1]=abs(c-b);
	d[2]=abs(a-c);
	sort(all(d));
	
	cout <<d[0]+d[1] <<endl;
	
	
    return 0;
}

Measured memory_bytes: 256
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/27 11:51:19 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	n;
	string	s;
	cin >> n >> s;

	vector<int>	V(n);

	int wv;
	wv = 0;
	for (int i = 1; i < n; i++)
	{
		if (s.at(i - 1) == 'W')
			wv++;
		V.at(i) = wv;
	}
	int ev;
	ev = 0;
	int	minv;
	minv = V.at(n - 1);
	for (int i = n - 2; i >= 0; i--)
	{
		if (s.at(i + 1) == 'E')
			ev++;
		minv = min(minv, V.at(i) + ev);
	}
	cout << minv << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


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

int main(){
    string s,t;
    cin >> s >> t;

    bool yes_e = true, yes_o = true;
    int idx_e=-1, idx_o=-1;
    int len = t.length();
    for(int i=0; i<(int)s.length(); i+=2){
        idx_e++;
        while(idx_e<len && t[idx_e]!=s[i]) idx_e++;
        if(idx_e>=len){
            yes_e = false;
            break;
        }
    }
    for(int i=1; i<(int)s.length(); i+=2){
        idx_o++;
        while(idx_o<len && t[idx_o]!=s[i]) idx_o++;
        if(idx_o>=len){
            yes_o = false;
            break;
        }
    }

    if(yes_e || yes_o){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

const long MOD = 998244353;
int cnt[100003];
int A[100003];

int main()
{
	// freopen("input.in", "r", stdin);

	bool bol = 1;

	int n; scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{	
		int x; scanf("%d", &x);
		A[i] = x;
		if(i == 1 && x) bol = 0;
		if(i != 1 && x == 0) bol = 0;
		cnt[x]++;
	}
	if(!bol) printf("0\n");
	else
	{
		long res = 1;
		for(int i = 2; i <= n; i++)
			res = (res*cnt[A[i]-1])%MOD;

		printf("%lld\n", res);
	}
}

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

int main() {
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    int C0=0;
    int C1=0;
    int C2=0;
    int C3=0;
    string R;
    
    for (int i=0;i<N;i++) {
        cin >> R;
        if (R=="AC") {
            C0++;
        }else if (R=="WA") {
            C1++;
        }else if (R=="TLE") {
            C2++;
        }else if (R=="RE") {
            C3++;
        }
    }
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;




}

Measured memory_bytes: 3592
#include<stdio.h>
#define N 100
void printStatus(int,int[]);
int main(void)
{
  int A[100];//array
  int i,j;//counter
  int n;//the number of elements
  int mini;//indication of min. element
  int tmp;//temporary valuable for swapping
  int count=0;//counter of swap operations
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  for(i=0;i<n;i++)
    {
      mini=i;
      for(j=i;j<n;j++)
	{
	  if(A[j]<A[mini]) mini=j;
	}
      if(i!=mini)
	{
          tmp=A[i];
          A[i]=A[mini];
          A[mini]=tmp;
          count++;
	}
    }
  printStatus(n,A);
  printf("%d\n",count);
  return 0;
}
void printStatus(int n,int A[])
{
  int i;
  for(i=0;i<n;i++)
    {
      if(i>0) printf(" ");
      printf("%d",A[i]);
    }
  printf("\n");
}



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

int main(){
  int n, a, b, i,sum=0;
  
  cin >> n >> a >> b;
  
  for(i=1; i <= n; i++){
      int num=i, sumB=0;
      
      while(num > 0){
          sumB += num % 10;
          num = num / 10;
      }
      
      if(sumB >= a && sumB <= b){
          sum += i;
      }
  }
  
  cout << sum;
  return 0;
}

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

#define rep(i,a,n) for(int i=a;i<n;++i)

const int N=1e2+5;
vector<int>a;
int f[N][N];

int main(){
    ios::sync_with_stdio(0);
    int n,h,w;
    cin>>h>>w>>n;
    a.resize(n);
    rep(i,0,n){
        cin>>a[i];
    }
    int i,j,dir,k=0,cnt=a[0];
    i=0;
    j=0;
    dir=1;
    while(i<h){
        if(cnt==0){
            ++k;
            cnt=a[k];
        }
        f[i][j]=k+1;
        --cnt;
        j+=dir;
        if(j==w||j==-1){
            dir*=-1;
            j+=dir;
            ++i;
        }
    }
    rep(i,0,h) {
        rep(j,0,w) cout<<f[i][j]<<' ';
        cout<<endl;
    }
    return 0;

}


Measured memory_bytes: 384
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		ArrayList<Integer> train=new ArrayList<Integer>();
		int n;
		while(sc.hasNext()){
			if((n=sc.nextInt())!=0) train.add(n);
			else{	//末尾を出力、削除
				int size=train.size()-1;
				System.out.println(train.get(size));
				train.remove(size);
			}
		}
	}
}

Measured memory_bytes: 17220
from collections import Counter
N = int(input())
s1 = [input() for i in range(N)]
M = int(input())
s2 = [input() for i in range(M)]
c1 = Counter(s1)
c2 = Counter(s2)
ans = 0
for k in c1.keys():
    ans = max(ans, c1[k] - c2[k])
print(ans)

Measured memory_bytes: 3444
a,b,c = map(int, input().split())
if a%2 == 1 or b%2 == 1 or c%2 == 1:
    print(0)
    exit()
if a == b == c: 
    print(-1)
    exit()
else:
    count = 0
    while True:
        if a%2 == 1 or b%2 == 1 or c%2 == 1:
            print(count)
            exit()
        else:
            count += 1
            x = (b+c)//2
            y = (c+a)//2
            z = (a+b)//2
            a = x
            b = y
            c = z


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <chrono>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> Pl;

ll dist[100005];
vector<Pl> graph[100005];

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

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int l, r;
        ll c;
        cin >> l >> r >> c;
        --l, --r;
        graph[l].push_back(Pl(r, c));
    }
    for(int i = 0; i < n-1; ++i){
        graph[i+1].push_back(Pl(i, 0));
    }
    
    fill(dist, dist+n, (ll)1e+17);
    dist[0] = 0;
    priority_queue<Pl, vector<Pl>, greater<Pl>> que;
    que.push(Pl(0, 0));
    while(!que.empty()){
        Pl p = que.top();
        que.pop();
        ll d = p.first;
        int u = p.second;
        if(dist[u] < d)     continue;
        for(int i = 0; i < (int)graph[u].size(); ++i){
            int v = graph[u][i].first;
            ll cost = graph[u][i].second;
            if(dist[v] > dist[u] + cost){
                dist[v] = dist[u] + cost;
                que.push(Pl(dist[v], v));
            }
        }
    }
    if(dist[n-1] == (ll)1e+17)  dist[n-1] = -1;
    cout << dist[n-1] << "\n";
}


Measured memory_bytes: 9464
l=int(input())
for i in range(1,21):
	if 2**i>l:
		r=i-1
		break
ans=[]
for i in range(r):
	ans.append((i+1,i+2,0))
	ans.append((i+1,i+2,2**i))
now=2**r-1
for i in range(r,0,-1):
	if 2**(i-1)+now<=l-1:
		ans.append((i,r+1,now+1))
		now+=2**(i-1)
print(r+1,len(ans))
for x in ans:
	print(*x)

Measured memory_bytes: 9152
from collections import Counter

h,w = map(int, input().split())
e_mod4 = (h//2) * (w//2)
e_mod2 = (h%2) * w//2 + (w%2) * h//2
e_mod1 = (h%2) * (w%2)

ca = Counter([j for i in range(h) for j in list(input())])

mod4, mod2, mod1 = 0, 0, 0
for i in ca.values():
     mod4 += i // 4
     i %= 4
     mod2 += i // 2
     i %= 2
     mod1 += i

if mod4 > e_mod4:
    mod2 += (mod4 - e_mod4) * 2
    mod4 = e_mod4

print("Yes" if e_mod4 == mod4 and e_mod2 == mod2 and e_mod1 == mod1 else "No")

Measured memory_bytes: 3444
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	x := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < N; i++ {
		x[i] = nextInt(sc)
	}
	// やりたいこと - Xとxiの距離の最大公約数を求める
	ans := 0
	for i := 0; i < N; i++ {
		d := abs(X - x[i])
		if ans == 0 {
			ans = d
		} else {
			ans = gcd(ans, d)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2944
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 99999999999999999;


long long int N,W,dp[20000]={},v[105],w[105];
int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>W;
    for(long long int i = 1; i <= N; i++){
        cin>>v[i]>>w[i];
    }

    for(long long int j = W; j > 0; j--){
        
        for(long long int i = 1; i <= N; i++){
            if(j>=w[i])dp[j-w[i]] = max(dp[j-w[i]],dp[j]+v[i]);
        }
    }  
        
        
    
    cout<<dp[0]<<endl;
}




Measured memory_bytes: 3168
#include<iostream>
const long long INF = 2147483647;
using namespace std;
long long n, W, w[105], v[105], dp[105][100005], mw=INF;
int main(){
	cin >> n >> W;
	for(int i=1;i<=n;i++)
		cin >> w[i] >> v[i], dp[i][v[i]]=w[i];
	for (int i=0;i<100005;i++)
		dp[0][i]=INF;
	for (int i=0;i<=n;i++) 
		dp[i][0] = 0; 
	for (int i=1;i<=n;i++){
		for (long long j=0;j<100005;j++){
			long long bo;
			if (j-v[i]<0) bo=INF;
			else bo=dp[i-1][j-v[i]]+w[i];
			dp[i][j]=min(dp[i-1][j], bo);	
		} 
	}
	for(int i=100004;i>=0;i--){
		if (dp[n][i]<=W){
			cout << i;
			break;
		}
	}
} 

Measured memory_bytes: 80128
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
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; }






int main() {



	int x,a;
	cin >> x >> a;
	if(x<a)
	cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}


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

// void printarray(ll arr[])
// {
// 	ll l=sizeof(arr)/sizeof(arr[0]);
// 	for(ll i=0;i<l;i++)
// 		cout << arr[i] <<" ";
// 	cout << "\n";
// }

void solve()
{
	int n;
	cin >> n;
	ll a[n];
	for(int i=0;i<n;i++)
		cin >> a[i];
	sort(a,a+n);
	int c=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(a[i]!=a[j] && a[j]!=a[k])
				{
					if(a[i]+a[j]>a[k])
						c=c+1;
				}
			}
		}
	}
	cout << c;
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("ouput.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 3628
//
//  main.cpp
//  Short Phrase
//
//  Created by x15071xx on 2017/06/18.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>
#include <string>
#include <cstdio>

using namespace std;
int main(int argc, const char * argv[]) {
    
    while (1) {
        int n,i,j;
        vector<string> str;
        cin >> n;
        
        if (n == 0) {
            break;
        }
        
        string tmp;
        for (i = 0; i < n; i++) {
            
            cin >> tmp;
            str.push_back(tmp);
            
        }
        
        for (i = 0; i < n; i++) {
            int flag = 0;
            j = 0;
            int numsum = 0;
            while (1) {
                if (flag == -1) {
                    break;
                }
                
                if (flag == 5) {
                    cout << i+1 << endl;
                    break;
                }
                
                
                numsum+=str[i+j].length();
                
//                if (i == 5) {
//                    cout << numsum << str[i+j] <<endl;
//                }
                if (flag == 0 || flag == 2) {
                    
                    if (numsum > 5) {
                        flag = -1;
                    } else if (numsum < 5){
                        j++;
                    } else if (numsum == 5) {
                        flag++;
                        numsum = 0;
                        j++;
                    }
                } else {
                    if (numsum > 7) {
                        flag = -1;
                    } else if (numsum < 7) {
                        j++;
                    } else if (numsum == 7) {
                        flag++;
                        numsum = 0;
                        j++;
                    }
                }
            }
            
            if (flag == 5) {
                break;
            }
        }
        
    }
    return 0;
}

Measured memory_bytes: 3144
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    string s;
    scan(s);

    if (s.canFind("AC")) {
        writeln("Yes");
    }
    else {
        writeln("No");
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import math


def read():
    N = int(input().strip())
    A = (map(int, input().strip().split()))
    return N, A

def solve(N, A):
    A = sorted(A, reverse=True)
    alice = 0
    bob = 0
    alice_turn = True
    for a in A:
        if alice_turn:
            alice += a
        else:
            bob += a
        alice_turn = not alice_turn
    return alice - bob


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
template <class Type>
class BIT {
private:
	int size_; Type *v;
	Type sum(int r) { Type ret = 0; while (r > 0) ret += v[r], r -= r & -r; return ret; }
public:
	BIT() {};
	BIT(int size__) {
		for (size_ = 1; size_ < size__;) size_ <<= 1;
		v = (Type *)malloc(sizeof(Type) * (size_ + 1));
		for (int i = 0; i <= size_; i++) v[i] = 0;
	}
	void add(int i, Type x) { i++; while (i <= size_) v[i] += x, i += i & -i; }
	Type sum(int l, int r) { return sum(r) - sum(l); }
};
int n, q, c, x, y;
int main() {
	cin >> n >> q;
	BIT<int> b(n);
	for (int i = 0; i < q; i++) {
		scanf("%d%d%d", &c, &x, &y);
		if (!c) b.add(x - 1, y);
		else printf("%d\n", b.sum(x - 1, y));
	}
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;


int main() {
  ll n;
  cin >> n;
  ll num = 0;
  ll l = 0;
  for(ll i = 1; i <= n; ++i) {
    ll t = i * (i + 1) / 2;
    if(t == n) {
      l = i;
      break;
    }
  }
  if(l == 0) {
    cout << "No" << endl;
    return 0;
  }

  vector<vector<int>> ans(l + 1);
  rep(i, l + 1) ans[i].push_back(l);
  ll sum = 1;
  for (int k = l; k >= 1; --k) {
    for(int i = 0; i < k; ++i) {
      ans[l - k].push_back(sum + i);
      ans[l - k + i + 1].push_back(sum + i);
    }
    sum += k;
  }
  cout << "Yes" << endl;
  cout << l + 1 << endl;
  rep(i, l + 1) {
    rep(l, ans.size()) printf("%d%c", ans[i][l], (l == ans.size() - 1 ? '\n' : ' '));
  }
}

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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = m - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  vector<ll>b(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n)cin>>b[i];
  ll ret=0;
  vector<bool>t(50);
  ll maxbuf=51;
  while(1){
    auto v=vec(51,51,INF);
    rep(i,0,51)v[i][i]=0;
    rrep(i,1,51){
      if(!t[i])continue;
      rep(j,0,51){
        rep(o,0,51){
          if(v[j][o]!=INF){
            chmin(v[j][o%i],v[j][o]);
          }
        }
      }
    } 
    
    rrep(i,1,maxbuf){
      rep(j,0,51){
        rep(o,0,51){
          if(v[j][o]!=INF){
            chmin(v[j][o%i],max(v[j][o],i));
          }
        }
      }
    } 
    ll x=0;
    rep(i,0,n){
      if(v[a[i]][b[i]]==INF)judge=false;
      else chmax(x,v[a[i]][b[i]]);
    }
    //cout<<x<<endl;
    //debug(v,51,51);
    if(!judge)break;
    if(x==0)break;
    ret|=1LL<<x;
    maxbuf=x;
    t[maxbuf]=true;
  }
  if(judge)cout<<ret<<endl;
  else cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())

A_list_str = input()
A_list_strs = A_list_str.split()
X = [int(x) for x in A_list_strs]
HP = 0
HP_b = 0

center = sum(X)//N
center_b = center + 1

for x in X:
    tmp = (x - center) ** 2
    HP = HP + tmp
    tmp1 = (x- center_b) ** 2
    HP_b = HP_b + tmp1

if HP_b < HP:
    print (HP_b)
else:
    print(HP)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void) {
	int n, h[200];
	int process[200], ncnt = 0;
	int a, first, end, cnt = 0;
	int i, j, k;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		process[i] = 0;
	}

	while (1) {
		ncnt = 0;
		first = -99;
		end = -99;
		for (i = 0; i < n; i++) {
			if (process[i] < h[i]) {
				if (ncnt == 0) {
					first = i;
				}
				ncnt++;
			}
			else {
				if (ncnt >= 1) {
					end = i - 1;
					break;
				}
			}
		}
		if (end == -99) {
			end = n - 1;
		}

		if (ncnt == 0) {
			break;
		}
		cnt++;

		for (i = first; i <= end; i++) {
			//printf("1\n");
			process[i]++;
		}
		for (i = 0; i < n; i++) {
			//printf("process[%d]==%d\n", i, process[i]);
		}
	}

	printf("%d\n", cnt);
	return 0;



}

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

int w, h;
int c[55][55];

void dfs(int y, int x)
{
	if(c[y][x]==0) return;
	c[y][x] = 0;
	for (int i = -1; i < 2; ++i)
	{
		for (int j = -1; j < 2; ++j)
		{
			if(i==0&&j==0) continue;
			if(y+i>=0&&y+i<h&&x+j>=0&&x+j<w) dfs(y+i, x+j);
		}
	}
	return;
}

int main(int argc, char const *argv[])
{
	while(1)
	{
		cin >> w >> h;
		if(w==0&&h==0) break;
		for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) cin >> c[i][j];

		int ans = 0;
		for (int i = 0; i < h; ++i)
		{
			for (int j = 0; j < w; ++j)
			{
				if(c[i][j]==1)
				{
					++ans;
					dfs(i, j);
				} 
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e10;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	for(auto &a : A) cin >> a;
	vector<ll> vec;
	vec.push_back(-A[0]);
	for(int i=1;i<N;i++) {
		auto itr = upper_bound(vec.begin(), vec.end(), -A[i]);
		// 存在しなかった
		if(itr == vec.end()) {
			// A[i]を挿入
			vec.push_back(-A[i]);
		} else {
			*itr = -A[i];
		}
	}
	cout << vec.size() << endl;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <iomanip> 
using namespace std; 
#define rep(i,a,b)		for(long int i=a;i<=b;i++)
#define MOD 1e9+7

int n,temp;
set<int> s;
int main() 
{ 
	ios::sync_with_stdio(false);
    cin.tie(NULL);  
    
	cin>>n;
	while(n--)
		cin>>temp,s.insert(temp);
	cout<<s.size();

}
	

Measured memory_bytes: 3652
#include <cstdio>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include<tuple>

using namespace std;
#define N_MAX 200000
typedef long long ll;

int main(){
    string s;
    cin >> s;
    ll k1[N_MAX];
    ll k2[N_MAX];
    ll n=s.length();

    ll c11,c12,c21,c22;

    for(ll i=n-1;i>=0;i--){
        if(i==n-1){
            c11=1;
            c12=1;
        }else{
            if(s[i]==s[i+1]){
                c11=0;
            }else{
                c11=k1[i+1]+1;
            }
            if(i==n-2){
                c12=0;
            }else{
                c12=k2[i+1]+1;
            }
        }

        if(i==n-1){
            c21=0;
            c22=0;
        }else if(i==n-2){
            c21=1;
            c22=1;
        }else{
            c21=k1[i+2]+1;
            if(i==n-3){
                c22=0;
            }else if(s[i]==s[i+2]&&s[i+1]==s[i+3]){
                c22=0;
            }else{
                c22=k2[i+2]+1;
            }
        }

        k1[i]=max(c11,c12);
        k2[i]=max(c21,c22);
 //       cout<<k1[i]<<","<<k2[i]<<endl;
    }

    cout<<max(k1[0],k2[0])<<endl;

    return 0;
}

Measured memory_bytes: 3716
## constant

MAX_DIST = 1 << 30

### subroutines

def paint(x, y, n, m, chmap, armap, aid)
  ch = chmap[y][x]
  area = [aid, ch, false]
  armap[y][x] = area

  queue = [[x, y]]
  while ! queue.empty?
    x0, y0 = queue.shift
    cands = []
    if x0 > 0
      cands << [x0 - 1, y0]
    else
      area[2] = true
    end
    if x0 < n - 1
      cands << [x0 + 1, y0]
    else
      area[2] = true
    end
    if y0 > 0
      cands << [x0, y0 - 1]
    else
      area[2] = true
    end
    if y0 < m - 1
      cands << [x0, y0 + 1]
    else
      area[2] = true
    end

    for c in cands
      nx, ny = c
      if armap[ny][nx].nil? && chmap[ny][nx] == ch
        armap[ny][nx] = area
        queue << [nx, ny]
      end
    end
  end

  area
end

def gen_areas(n, m, chmap, armap)
  areas = []
  aid = 0

  for y in (0...m)
    for x in (0...n)
      if armap[y][x].nil?
        area = paint(x, y, n, m, chmap, armap, aid)
        areas << area
        aid += 1
      end
    end
  end

  areas
end

def gen_nbrs(n, m, armap, areas)
  nbrs = (0...areas.length).map{[]}

  for y in (0...m)
    for x in (0...n)
      aid, ach = armap[y][x]
      cands = []
      cands << armap[y][x - 1] if x > 0
      cands << armap[y][x + 1] if x < n - 1
      cands << armap[y - 1][x] if y > 0
      cands << armap[y + 1][x] if y < m - 1

      for ar0 in cands
        nbrs[aid] << ar0[0] if ! nbrs[aid].include? ar0[0]
      end
    end
  end

  nbrs
end

### main

while true
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if n == 0 && m == 0

  chmap = []
  armap = []

  m.times.each do
    hl = gets.strip
    chmap << hl
    armap << ([nil] * n)
  end

  areas = gen_areas(n, m, chmap, armap)
  an = areas.length
  nbrs = gen_nbrs(n, m, armap, areas)

  st = nil
  for area in areas
    if area[1] == '&'
      st = area[0]
      break
    end
  end

  dist = areas.map{MAX_DIST}
  dist[st] = 0
  prev = areas.map{nil}
  queue = areas.map{|ar| ar[0]}

  while ! queue.empty?
    u = queue.min{|a, b| dist[a] <=> dist[b]}
    queue.delete u

    for v in nbrs[u]
      ndist = dist[u] + ((areas[v][1] == '#') ? 2 : 1)
      if dist[v] > ndist
        dist[v] = ndist
        prev[v] = u
      end
    end
  end

  gl = (0...an).select{|i| areas[i][2]}.min{|a, b| dist[a] <=> dist[b]}

  count = 0
  v = gl
  while v != st
    if areas[v][1] == '#'
      count += 1
    end
    v = prev[v]
  end

  puts count
end

Measured memory_bytes: 8272
import java.util.Scanner;
class Main{
  private static Scanner sc = new Scanner(System.in);
  public static void main(String[] args) {
    int age = sc.nextInt();
    if(age == 3 || age == 5 || age ==7){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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 int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

struct edge { ll from, to, cost; };

const ll MAXE = 2005;
edge es[MAXE];          // 辺. edge struct

const ll MAXV = 1005;
ll d[MAXV];            // 最短距離格納用
ll V, E;               // 頂点数, 辺数

bool nega=false;

// s番目の頂点から各頂点への最短経路を求める
void shortest_path(ll s){
  
  for(ll i = 0; i < V; i++) d[i] = LINF;
  d[s] = 0;
  
  rep(i,V*2+1){
    
    bool update = false; // コストが更新されたかの判定用
    
    // esの先頭から順に辺を取り出す. 頂点sをfromとする辺から計算が始まる
    for(ll j = 0; j < E; j++){
      edge e = es[j]; // 辺を取り出す
      // 辺のfrom側の頂点がINFではない(つまり初期化もしくは計算済み)、かつ、辺のto側の頂点がfromからのコストより大きい場合、そのコストを更新する
      if(d[e.from] != LINF && d[e.to] > d[e.from] + e.cost){ // 負の閉路があるならば、d[e.to] > d[e.from] + e.cost が常にtrueとなる無限ループとなる
        d[e.to] = d[e.from] + e.cost;
        if(e.to == V-1 && i==V*2) nega=true;
      }
    }
  }
}

// 負の閉路が存在するかを判定する
bool find_negative_loop(){
  memset(d, 0, sizeof(d));
  
  // 負の閉路が存在しないならば、V-1(頂点数-1)回のループで更新は発生しなくなる. 
  // 1回のイテレーションでは、少なくとも1つの頂点が定まる. このうち始点となる頂点は初めからコストが定めているため、負閉路がない場合のループ回数はV-1回となる
  for(ll i = 0; i < V; i++){
    for(ll j =0; j < E; j++){
      edge e = es[j];
      if(d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        
        // V回目のループは全頂点についてのコスト計算を終え、2周目を意味する
        // 2周目で更新があるという事は、常にコストが減少し続ける負閉路が存在することになる
        if(i == V-1) return true;
      }
    }
  }
  return false;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>V>>E;
  rep(i,E){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--; c*=-1;
    es[i]=edge{a,b,c};
  }
  
  shortest_path(0);
  
  if(nega){
    puts("inf");
  }else{
    cout<<-d[V-1]<<endl;
  }
  
}

Measured memory_bytes: 256