akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



class UnionFind {
public:
	vector<ll>rank, parent;
	//初期化
	UnionFind(ll size) {
		rank.resize(size, 0);
		parent.resize(size, 0);
		REP(i, size)parent[i] = i;
	}
	//木の根を求める
	ll find(ll x) {
		if(parent[x] == x)return x;
		else return parent[x] = find(parent[x]);
	}
	//xとyの属する集合を併合
	void unite(ll x, ll y) {
		x = find(x);
		y = find(y);
		if(x == y)return;
		if(rank[x] < rank[y])
			parent[x] = y;
		else {
			parent[y] = x;
			if(rank[x] == rank[y])rank[x]++;
		}
	}
	//xとyが同じ集合に属するか否か
	bool same(ll x, ll y) {
		return (find(x) == find(y));
	}
	//parentの内容を出力
	void debug() {
		for(auto num : parent) {
			cout << num << " ";
		}
		cout << "more:" << endl;
		REP(i, parent.size()) {
			cout << find(i) << " ";

		}
		cout << endl << "more:" << endl;
		for(auto num : parent) {
			cout << num << " ";
		}
		cout << endl;
	}
};


ll H, W;
ll count(const vector<ll>& v, const vector<vector<bool>>& s)
{
	ll x = 0;
	ll y = 0;
	for(ll num : v)
	{
		ll h = num / W;
		ll w = num % W;

		if(s[h][w])
		{
			x++;
		}
		else
		{
			y++; 
		}
	}
	return x * y;
}

//メイン関数
int main()
{
	cin >> H >> W;
	vector<vector<bool>> S(H, vector<bool>(W));
	UnionFind uf(H*W);
	REP(i, H)
	{
		string tmp;
		cin >> tmp;
		REP(j, W)S[i][j] = (tmp[j] == '#');
	}

	REP(i, H)REP(j, W)
	{
		if(i != H - 1)if(S[i][j] != S[i + 1][j])
		{
			uf.unite(i*W + j, (i + 1)*W + j);
		}
		if(j != W - 1)if(S[i][j] != S[i][j + 1])
		{
			uf.unite(i*W + j, i*W + j + 1);
		}
	}

	map<ll, vector<ll>> mp;
	REP(i, H)REP(j, W)mp[uf.find(i*W + j)].push_back(i*W + j);

	ll res = 0;
	for(auto itr = mp.begin(); itr != mp.end(); ++itr)
	{
		res += count(itr->second, S);
	}
	cout << res << endl;
	cin >> H;
	return 0;
}


Measured memory_bytes: 17792
#include <iostream>
#include <vector>
#include <set>

using namespace std;

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int N, Q;
    string S;

    cin >> N >> S >> Q;

    set<int> s[26];

    for(int i = 0; i < N; ++i){
        s[S[i]-'a'].insert(i);
    }

    for(int i = 0; i < Q; ++i){
        int com;
        cin >> com;

        if(com == 1){
            int p;
            char c;
            cin >> p >> c;
            --p;

            s[S[p]-'a'].erase(s[S[p]-'a'].find(p));
            S[p] = c;
            s[c-'a'].insert(p);

        }else{
            int l, r;
            cin >> l >> r;
            --l, --r;

            int cnt = 0;
            for(int j = 0; j < 26; ++j){
                auto it = s[j].lower_bound(l);
                if(it != s[j].end() && *it <= r){
                    ++cnt;
                }
            }
            
            cout << cnt << '\n';
        }
    }

    return (0);

}

Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

vector<pii>gr[20];

int main() 
{
    fastio();

    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        for(int j=0;j<a;j++)
        {
            int x,y;
            cin>>x>>y;
            gr[i].pb({x-1,y});
        }
    }

    int ans = 0;
    for(int i=0;i<(1<<n);i++)
    {
        bool ok = true;
        int cnt = 0;
        for(int j=0;j<n;j++)
        {
            if( (i>>j)&1 )
            {
                cnt++;
                for( auto next : gr[j] )
                {
                    int k = next.F;
                    int y = next.S;
                    bool x = ((i>>k)&1);
                    if( y == 1 && x == 0 )
                    {
                        ok = false;
                        break;
                    }
                    else if( y == 0 && x == 1 )
                    {
                        ok = false;
                        break;
                    }
                }
            }
            if( !ok )
                break;
        }
        if( ok )
        {
            ans = max(ans, cnt);
        }
    }
    cout<<ans,nl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
up = list(map(int,input().split()))
down = list(map(int,input().split()))

alst = []
for i in range(N-1):
	up[i+1] += up[i]
	down[-i-2] += down[-i-1]

for i in range(N):
	alst.append(up[i]+down[i])

print(max(alst))

Measured memory_bytes: 3064
#include<stdio.h>

static const int N = 1000000;

void trace(int A[], int n){
  int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf("\n");
    printf("%d", A[i]);
  }
  printf("\n");
}

void trace_rev(int A[], int n){
  int i;
  int start = n -1;
  for ( i = n-1; i >=0; i--){
    if ( i < start ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int cnt = 0;

void insertionSort(int A[], int n, int g) {
  int i, v, j;
  for(i=g;i<n;i++) {
    v = A[i];
    j = i - g;
    while (j >=0 && A[j] > v) {
      A[j+g] = A[j];
      j = j - g;
      cnt++;
    }
	A[j+g] = v;
  }
}

void shellSort(int A[], int n) {
  int i;
  int m = 1;
  int G[100];
  int nG = 1;
  G[0] = 1;
  
  while ((m = 3 * m + 1) < n) {
    G[nG] = m;
	nG++;
  }
  printf("%d\n", nG);
  trace_rev(G,nG);
  for(i=nG-1;i>=0;i--) {
    insertionSort(A, n, G[i]);
  }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  shellSort(A, n);
  printf("%d\n", cnt);
  trace(A, n);
  return 0;
}



Measured memory_bytes: 5660
#include <cstdio>

char data[128][128];
int res, h, w;

void dfs(char c, int x, int y);

int main(void)
{
	while (scanf("%d %d", &h, &w)){
		if (h == 0 && w == 0) break;
		
		for (int i = 0; i < h + 10; i++){
			for (int j = 0; j < w + 10; j++){
				data[i][j] = '0';
			}
		}
		res = 0;
		
		for (int i = 0; i < h; i++){
			scanf("%s", data[i]);
		}
		
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				if (data[i][j] != '0'){
					dfs(data[i][j], i, j);
					res++;
				}
			}
		}
		
		printf("%d\n", res);
	}
	
	return (0);
}

void dfs(char c, int x, int y)
{
	data[x][y] = '0';
	
	if (data[x + 1][y] == c){
		dfs(data[x + 1][y], x + 1, y);
	}
	if (data[x - 1][y] == c && 0 <= (x - 1)){
		dfs(data[x - 1][y], x - 1, y);
	}
	if (data[x][y + 1] == c){
		dfs(data[x][y + 1], x, y + 1);
	}
	if (data[x][y - 1] == c && 0 <= (y - 1)){
		dfs(data[x][y - 1], x, y - 1);
	}
	
	return;
}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> vec(n);
  
  for(int i=0; i<n; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  
  int sum=0;
  for(int i=0; i<k; i++){
    sum += vec.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    vector<int> A(N),B(N),C(N-1);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N-1) cin >> C[i];
    int ans = 0;
    rep(i,N){
        ans += B[A[i]-1];
        if(i<N-1)if(A[i+1]-A[i]==1){ans+=C[A[i]-1]; }
    }
    cout << ans << nn;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#define pi 3.14159265358979323846
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		long double a, b, h, m;
		cin >> a >> b >> h >> m;
		//calculating deg
		long double hdeg = h * 30;
		long double mdeg = m * 6;
		hdeg += mdeg / 12;
		long double deg = abs(hdeg - mdeg);

		//apply law of cosines
		long double cosdeg = cos(deg * pi / 180);
		long double asqr = a * a;
		long double bsqr = b * b;
		long double c = sqrt(asqr + bsqr - 2 * a * b * cosdeg);
		cout << fixed << showpoint;
		cout << setprecision(20);
		cout << c << endl;
		return 0;

	}
	return 0;
}


Measured memory_bytes: 4164
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#define mp make_pair
typedef long long ll;
using namespace std;
int a,b,k;
string str[105];
int main(){
cin>>a>>b;
b--;
a--;
for (int i=0;i<99;i++){
str[0]+='#';
}
k=2;
while (a>0){
for (int i=0;i<33;i++){
str[k]+="###";
if (a>0){
a--;
str[k-1]+="#.#";
}else{
str[k-1]+="###";
}
}
k+=2;
}
k--;
for (int i=0;i<99;i++){
str[k]+='.';
}
k+=2;
while (b>0){
for (int i=0;i<33;i++){
str[k]+="...";
if (b>0){
b--;
str[k-1]+=".#.";
}else{
str[k-1]+="...";
}
}
k+=2;
}
cout<<k-1<<' '<<99<<endl;
for (int i=0;i<k-1;i++){
cout<<str[i]<<endl;
}
system ("pause");
return 0;
} 

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

int main() 
{
    int m, n, i, j;
    int o = 0;
    int p = 0;
    cin >> m;
    for (i=0;i<m;i++){
        cin >> n;
        if(n >= o){
            p = p + 1;
            o = n;
        }
    }
    cout << p;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
using System;
using System.Linq;

namespace arc066_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long ret = 1;
            Array.Sort(x);
            if (n % 2 == 0)
            {
                bool ok = true;
                for (int i = 0; i < n / 2; i++)
                {
                    if (x[i * 2] != i * 2 + 1 || x[i * 2 + 1] != i * 2 + 1) ok = false;
                    ret *= 2; ret %= 1000000007;
                }
                Console.WriteLine(ok ? ret : 0);
            }
            else
            {
                bool ok = x[0] == 0;
                for (int i = 0; i < n / 2; i++)
                {
                    if (x[i * 2 + 1] != (i + 1) * 2 || x[i * 2 + 2] != (i + 1) * 2) ok = false;
                    ret *= 2; ret %= 1000000007;
                }
                Console.WriteLine(ok ? ret : 0);
            }
        }
    }
}

Measured memory_bytes: 18144
# https://atcoder.jp/contests/abc098/submissions/5418660
N = int(input())
S = input()
ans = 0
moji = 'abcdefghijklmnopqrstuvwxyz'
for i in range(1, N):
  l, r = S[:i], S[i:]
  cnt = 0
  for c in moji:
    if c in l and c in r:
      cnt += 1
  ans = max(ans, cnt)
  
print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  int n, m;
  cin>>n>>m;
  vector<int> v(m, 0);
  for(int i=0; i<n; i++) {
    int x;
    cin>>x;
    for(int j=0; j<x; j++) {
      int y;
      cin>>y;
      v[y-1]++;
    }
  }
  int c=0;
  for(auto i=v.begin(); i!=v.end(); i++) {
    if(*i==n)
      c++;
  }
  std::cout << c << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
		
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,a;
    cin>>n;
    cin>>a;
    if((n%500)>a){
    	cout<<"No";
	}
	else{
		cout<<"Yes";
	}
    return 0;
}

Measured memory_bytes: 256
# AOJ 0028 Mode Value
# Python3 2018.6.13 bal4u

import sys

cnt = [0 for i in range(101)]
max = 0
for _ in sys.stdin:
	i = int(_)
	cnt[i] += 1
	if cnt[i] > max:
		max = cnt[i]
for i in range(101):
	if cnt[i] == max:
		print(i)



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B,M,p{100000},q{100000},mi{200000},x,y,c;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for (auto &e: a) {
    cin >> e;
    if(e<p) p = e;
  }
  for (auto &e: b) {
    cin >> e;
    if(e<q) q = e;
  }
  mi = p+q;
  while(cin >> x >> y >> c) {
    mi = min(mi,a[x-1]+b[y-1]-c);
  }
  cout << mi << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int total=0;
  vector<int> T(N);
  for (int i=0; i<N; i++) {
    cin >> T.at(i);
    total+=T.at(i);
  }
  int M;
  cin >> M;
  vector<pair<int,int>> P(M);
  for (int i=0; i<M; i++) {
    cin >> P.at(i).first >> P.at(i).second;
  }
  for (int i=0; i<M; i++) {
    cout << total-T.at(P.at(i).first-1)+P.at(i).second << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; string s; cin >> n >> s;
	int x = 0; int out = 0;
	rep(i, n) {
		if (s[i] == 'I')x++;
		if (s[i] == 'D')x--;
		out = max(out, x);
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

ll dp[55][3000][55];
int main(){
  int N,A;
  cin >> N >> A;
  vector<int> x(N);
  for(int i=0;i<N;++i) cin >> x[i];
  memset(dp,0,sizeof(dp));
  dp[0][0][0] = 1;
  for(int i=0;i<N;++i){
    for(int s = 0;s<=N*A;++s){
      for(int k=0;k<=N;++k){
        if(dp[i][s][k] == 0) continue;
        dp[i+1][s][k] += dp[i][s][k];//選ばない
        dp[i+1][s+x[i]][k+1] += dp[i][s][k];//選ぶ
      }
    }
  }
  ll res = 0;
  for(int k=1;k<=N;++k) res+=dp[N][A*k][k];
  cout << res << endl;
}

Measured memory_bytes: 74532
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
   // cin>>t;
    while(t--)
    { 
       int n,r;
       cin>>n>>r;
       int x=0;
       if(n<=9)
       x=100*(10-n);
       cout<<r+x;
       
    }
}
    
// 🍪 🍪 🍪


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

using namespace std;

const int N = 310;

template<int MOD>
struct Modular {
  int value;
  Modular(const Modular& k) : value(k.value) {}
 
  template<typename V>
  Modular(const V& v) : value(v % MOD) {
    if (value < 0) {
      value += MOD;
    }
  }
  
  Modular() : Modular(0) {}
 
  Modular& operator+=(Modular const& b) { value += b.value; if (value >= MOD) value -= MOD; return *this; } 
  Modular& operator-=(Modular const& b) { value -= b.value; if (value < 0) value += MOD; return *this; }
  Modular& operator*=(Modular const& b) { value = (long long)value * b.value % MOD; return *this; }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { return *this += 1; }
  Modular operator--(int) { return *this -= 1; }

  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }
  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) { return os << a.value; }
  friend bool operator==(Modular const& a, Modular const& b) { return a.value == b.value; }
  friend bool operator!=(Modular const& a, Modular const& b) { return a.value != b.value; }
};

using Mint = Modular<998244353>;

Mint dp[N][N][N][2];

template <int T, typename V>
Modular<T> mexp(Modular<T> a, V e) {
  if (a == 0) return e == 0 ? 1 : 0; 
  Modular<T> res = 1; 
  while (e) { 
    if (e & 1) 
      res *= a; 
    a *= a; 
    e >>= 1; 
  }
  return res;
}

void Run() {
  string s;
  int k;
  cin >> s >> k;
  const int n = s.size();
  k = min(k, n);
  vector<int> buckets;
  int nz = n;
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '0') {
      buckets.push_back(nz - i - 1);
      nz = i;
    }
  }
  buckets.push_back(nz);
  reverse(buckets.begin(), buckets.end());
  const int b = buckets.size();
  for (int i = k; i >= 0; --i)
    dp[b][i][i][0] = dp[b][i][i][1] = 1;
  for (int i = b - 1; i >= 0; --i) {
    for (int moves = k; moves >= 0; --moves) {
      for (int rep = k; rep >= 0; --rep) {
        for (int take = 1; take <= min(buckets[i], moves - rep); ++take)
          dp[i][moves][rep][0] += dp[i + 1][moves][rep + take][0]; // replacement.
        dp[i][moves][rep][0] += dp[i][moves + 1][rep][1]; // make move
        dp[i][moves][rep][0] += dp[i + 1][moves][rep][0]; // dont make move
        dp[i][moves][rep][1] += dp[i][moves + 1][rep][1]; // make another move
        dp[i][moves][rep][1] += dp[i + 1][moves][rep][0]; // done making moves
      }
    }
  }
  cout << dp[0][0][0][0] << '\n';
}

int main() {
  srand(time(0));
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  Run();
  return 0;
}

Measured memory_bytes: 236408
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
int max(const void *a, const void *b){return *(int*)b - *(int*)a;}

char s[100001];
int ans[100001]={0};

int main(void)
{
    int t,len,odd,even;
    scanf("%s",s);
    len = strlen(s);

    odd = 0;
    even = 0;
    
    for(int i=0;i<len;i++)
    {
        if(s[i] == 'R')
        {
            int tmp;
            tmp = odd;
            odd = even;
            even = tmp + 1;
        }else
        {
            ans[i] += odd; /* 前回奇数 */
            ans[i-1] += even;
            odd = 0;
            even = 0;
        }
    }
    odd = 0;
    even = 0;
    for(int i=len-1;i>=0;i--)
    {
        if(s[i] == 'L')
        {
           int tmp;
            tmp = odd;
            odd = even;
            even = tmp + 1;
        }else
        {
            ans[i] += odd; /* 前回奇数 */
            ans[i+1] += even;
            odd = 0;
            even = 0;
        }
    }

   for(int i=0;i<len;i++)
    {
        printf("%d ",ans[i]);
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 896
import math

A, B, H, M = map(int,input().split())
Theta = 0 ##度を代入する
a_radian=30*H+ 0.5*M
b_radian= 6*M
Theta=b_radian-a_radian
cosine_Theta=math.cos(math.radians(Theta))

x= math.sqrt( A**2 + B**2 - 2*A*B*cosine_Theta)

print(str(x))


Measured memory_bytes: 9432
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> x(n);
  for(int i=0;i<n;i++)cin>>x[i];
  vector<int>y=x;
  sort(x.begin(),x.end());
  int a=x[n/2-1],b=x[n/2];
  for(int i=0;i<n;i++){
    if(y[i]<=a)cout<<b<<endl;
    else cout<<a<<endl;
  }
}

Measured memory_bytes: 3712
def check(board)
  flag = true
  board.map! do |line|
    if ret = erase(line)
      flag = false
      ret
    else
      line
    end
  end
  flag
end

def erase(line)
  (1..9).each do |i|
    5.downto(3).each do |j|
      unless (sc = line.scan(/#{i.to_s}{#{j}}/)).empty?
        return line.gsub(sc[0], '0'*j)
      end
    end
  end
  nil
end

def sum(board)
  board.flat_map{ |l| l.split('') }.map(&:to_i).reduce(:+)
end

def fall(board)
  ret = @h.times.map{ '00000' }
  5.times do |i|
    idx = @h - 1
    (@h - 1).downto(0) do |j|
      if board[j][i] != '0'
        ret[idx][i] = board[j][i]
        idx -= 1
      end
    end
  end
  ret
end

def solve(board)
  loop do
    break if check(board)
    board = fall(board)
  end
  sum(board)
end

while (@h = gets.to_i) != 0
  board = @h.times.map{ gets.chomp.delete(' ') }
  score = sum(board)
  puts score - solve(board)
end

Measured memory_bytes: 10780
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"

using namespace std;

const int N = int(10e5 + 5);

int main() {
	FIO
	int A, B, C; cin >> A >> B >> C;
	int k; cin >> k;
	int cnt = 0;
	while (A >= B) {
		cnt++;
		B *= 2;
	}
	while (B >= C) {
		cnt++;
		C *= 2;
	}
	(cnt <= k) ? cout << "Yes" : cout << "No";
	return 0;
}

Measured memory_bytes: 3596
require 'complex'

# 10000
n = gets.to_i

ans = (1..Math.sqrt(n).to_i).flat_map do |a|
  if n%a == 0 then
    [[a, n/a]]
  else
    []
  end
end.map{|x| x.max.to_s.length}.min

puts ans

Measured memory_bytes: 3836
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
    int a[10];
    int i;

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

    sort(a, a+10);

    cout<<a[9]<<endl;
    cout<<a[8]<<endl;
    cout<<a[7]<<endl;

    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
string solve(int a, int b, int c, int d, char A, char B) {
	int L = (a + b) / (b + 1);
	int lb = 0, rb = a / L;
	while (lb < rb) {
		int md = (lb + rb + 1) >> 1;
		if (md * L + (b - md) / L <= a) lb = md;
		else rb = md - 1;
	}
	int x = lb, y = (b - lb) / L;
	string ans;
	for (int i = c; i <= d; ++ i) {
		if (i <= x * (L + 1)) ans += i % (L + 1) == 0 ? B : A;
		else if (a + b - i + 1 <= y * (L + 1)) ans += (a + b - i + 1) % (L + 1) == 0 ? A : B;
		else ans += i <= x * (L + 1) + a - x * L - y ? A : B;
	}
	return ans;
}
int main() {
	int q; scanf("%d", &q);
	while (q --) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		string s;
		if (a < b) {
			s = solve(b, a, a + b - d + 1, a + b - c + 1, 'B', 'A');
			reverse(s.begin(), s.end());
		} else s = solve(a, b, c, d, 'A', 'B');
		printf("%s\n", s.c_str());
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = 1; i < (ll)(n); i++)
typedef long long ll;

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


int main(){
  string s;
  map<char, int> mp;
  while(cin >> s){
    for(int i = 0; i < s.size(); i++){
      if('a' <= s[i] && s[i] <= 'z'){
        mp[s[i]]++;
      }
      else if('A' <= s[i] && s[i] <= 'Z'){
        mp[s[i]-'A'+'a']++;
      }
    }
  }

  for(char c = 'a'; c <= 'z'; c++){
    printf("%c : %d\n", c, mp[c]);
  }
}






Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<bl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.b()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<bl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll fib(ll n)
{
    if(n < 2)
        return n;
    ll a = 0,b = 1,ans;
    int i = 1;
    while(i < n)
    {
        ans = (a+b) % MOD;
        a = b;
        b = ans;
        i++;
    }
    return ans;
} 
int main()
  {
      fastio();
      int n,k;
      cin>>n>>k;
      int snuke[n+1];
      fill(snuke,snuke+n+1,0);
      for(int i=1;i<=k;i++)
      {
          int d;
          cin>>d;
          for(int i=1;i<=d;i++)
          {
              int per;
              cin>>per;
              snuke[per]++;
          }
      }
      int count=0;
      for(int i=1;i<=n;i++)
      {
          if(snuke[i]==0)
            count++;
      }
      cout<<count<<"\n";
      
  }


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int t1,t2;
	t1=a/d;
	if (a%d) t1++;
	t2=c/b;
	if (c%b) t2++;
	if (t1>=t2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

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

Measured memory_bytes: 256
import java.util.*;

public class Main {
	final int INF = 1 << 24;
	private void doit(){
		Scanner sc = new Scanner (System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();
			if(n == 0 && m == 0 && l == 0) break;
			int [][] pass = new int[n][n];
			int [][] money = new int[n][n];
			for(int i=0; i < n; i++){
				Arrays.fill(pass[i], INF);
				Arrays.fill(money[i], INF);
			}
			for(int i = 0;i < m; i++){
				int from = sc.nextInt() - 1;
				int to = sc.nextInt() -1 ;
				int dis = sc.nextInt();
				int num = sc.nextInt();
				pass[from][to] = num;
				pass[to][from] = num;
				money[from][to] = dis;
				money[to][from] = dis;
			}
			PriorityQueue<C> open = new PriorityQueue<C>();
			open.add(new C(0,l,0));
			int [][] close = new int[n][l+1];
			for(int i=0; i < n; i++){
				for(int j = 0; j < l + 1; j++){
					close[i][j] = INF;
				}
			}
			Arrays.fill(close[0],INF);
			int ans = INF;
			while(! open.isEmpty()){
				C now = open.poll();
				int from = now.now;
				//goal
				if(from == n-1){
					ans = Math.min(ans, now.num);
					continue;
				}
				for(int i= 0; i < n; i++){
					if(pass[from][i] == INF){
						continue;
					}
					//use
					int nextnum = now.num;
					int nextmoney = now.money - money[from][i];
					if(now.money >= money[from][i]){
						if(close[i][nextmoney] > nextnum){
							open.add(new C(i, nextmoney, nextnum));
							close[i][nextmoney] = nextnum;
						}
					}
					//not use
					nextnum = now.num + pass[from][i];
					nextmoney = now.money;
					if(close[i][nextmoney] > nextnum){
						open.add(new C(i, nextmoney, nextnum));
						close[i][nextmoney] = nextnum;
					}
				}
			}
			//System.out.print("ANS= ");
			System.out.println(ans);
		}
	}

	private class C implements Comparable<C>{
		int now,money,num;
		public C(int now, int money, int num) {
			this.now = now;	this.money = money;	this.num = num;
		}
		public int compareTo(C o) {
			if(num < o.num) return -1;
			if(num > o.num) return 1;
			return 0;
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 13000
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        System.out.println(A + B + C <= 21 ? "win" : "bust");
    }
}


Measured memory_bytes: 23380
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	string s;
	cin >> s;
	if (s == "Sunny")
		print("Cloudy");
	else if (s == "Cloudy")
		print("Rainy");
	else
		print("Sunny");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <math.h>
#include <assert.h>

#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& v) {
    return is >> v.first >> v.second;
}

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
    for (T& i: v) is >> i;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& v) {
    return os << v.first << " " << v.second;
}

template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
    int n = (int) v.size();
    for (int i = 0; i < n; ++i) os << v[i] << (i == n - 1 ? "" : " ");
    return os;
}

template <typename T>
void in(T& x) {
    std::cin >> x;
}

template <typename T>
void out(const T H) {
    std::cout << (H);
}

template <typename T1, typename... T2>
void out(const T1 H, const T2... T) {
    std::cout << (H) << " "; out(T...);
}

template <typename T>
void eout(const char *s, const T H) {
    std::cerr << s << "=" << H << "\n";
}

template <typename T1, typename... T2>
void eout(const char *s, const T1 H, const T2... T) {
    while (*s != ',') std::cerr << *s++;
    std::cerr << "=" << H << " | "; eout(++s, T...);
}

#define nl                std::cout << "\n"
#define err(args...)      eout(#args, args)

#define rep(i, n)         for (int i =  0 ; i < (n); ++i)
#define per(i, n)         for (int i = (n) - 1; i > -1; --i)
#define repr(i, l, r)     for (int i = (l); i < (r); ++i)

#define sz(v)             ((int) v.size())
#define all(v)            (v).begin(), (v).end()
#define lla(v)            (v).rbegin(), (v).rend()

#define no                std::cout << "NO\n"
#define yes               std::cout << "YES\n"

const int INF           = 2147483647;
const long long int LNF = 9223372036854775807LL;

using ll  = long long int;
using vi  = std::vector<int>;
using vb  = std::vector<bool>;
using ii  = std::pair<int, int>;
using iii = std::pair< ii, int>;
using vii = std::vector<ii>;

const int N  = 505050;
const int MD = 1000*1000*1000 + 7;

int solve();
int main() {
    std::ios_base::sync_with_stdio(0); std::cin.tie(0);
    //std::cout.tie(0);

    //int t; in(t); repr(tc, 1, t + 1)
    solve();

    return 0;
}

int solve() {
    int n; in(n);
    int a[n][n - 1]; rep(i, n) rep(j, n - 1) {
        in(a[i][j]); --a[i][j];
    }

    int ans = 0;
    vi f(n, 0);
    vi new_d(n, 0); rep(i, n) new_d[i] = i;
    while (1) {
        ++ans;
        vb played(n, false);
        for (int i: new_d) if (!played[i] and f[i] < n - 1) {
            int op = a[i][f[i]];
            if (!played[op] and f[op] < n - 1 and a[op][f[op]] == i) {
                played[i] = played[op] = 1;
                ++f[i]; ++f[op];
            }
        }

        bool stop = 1;
        rep(i, n) stop &= (f[i] == n - 1);
        if (stop) break;

        new_d.clear();
        bool any = 0;
        rep(i, n) if (played[i]) any = 1, new_d.push_back(i);
        if (!any) return out(-1), 0;
    }
    out(ans);
    return 0;
}


Measured memory_bytes: 4224
package main

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

func powInt(x, y int) int {
	ret := 1
	for i := 0; i < y; i++ {
		ret *= x
		ret %= 998244353
	}
	return ret
}

func pow(base int, exponent int) int {
	if exponent == 0 {
		return 1
	}

	result := 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			result %= 998244353
		}
		exponent >>= 1
		base *= base
	}
	return result
}

func main() {
	N := readInt()
	D := readInts(N)

	if D[0] != 0 {
		fmt.Println(0)
		return
	}

	c := map[int]int{}
	maxD := 0
	for _, i := range D {
		c[i]++
		if i > maxD {
			maxD = i
		}
	}

	if c[0] != 1 {
		fmt.Println(0)
		return
	}

	result := 1
	for i := 1; i <= maxD; i++ {
		if _, ok := c[i]; !ok {
			fmt.Println(0)
			return
		}
		result = result * powInt(c[i-1], c[i]) % 998244353
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

func readInts(n int) []int {
	result := make([]int, n)
	for i := 0; i < n; i++ {
		result[i] = readInt()
	}
	return result
}


Measured memory_bytes: 8192
/**In the name of Allah, the Most Merciful, the Most Merciful.**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define INF 9223372036854775806
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 2*acos(0.0)
#define EPS 1e-9
ll max(ll a,ll b) {if(a>b) return a; else return b;}
ll min(ll a,ll b) {if(a<b) return a; else return b;}
int tree[1300000];
int A[300005];
void update(int node,int b,int e,int i,int value)
{
    //cout<<"update "<<i<<" "<<value<<endl;
    if(i<b || i>e) return;
    else if(i==b && b==e)
    {
        tree[node]=value;
        return;
    }
    int left=node*2; int right=left+1; int mid=(b+e)/2;
    if(i<=mid) update(left,b,mid,i,value);
    else update(right,mid+1,e,i,value);
    tree[node]=max(tree[right],tree[left]);
}
int query(int node,int b,int e,int i,int j)
{
    if(e<i || b>j) return 0;
    else if(b>=i && e<=j) return tree[node];
    int mid=(b+e)/2; int left=node*2; int right=left+1;
    int P1=query(left,b,mid,i,j);
    int P2=query(right,mid+1,e,i,j);
     return max(P1,P2);
}
int dp[300005];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>A[i];
    int ans=0;
    for(int i=1;i<=n;i++){
        int l=max(0,A[i]-k);
        int r=min(300000,A[i]+k);
        int x=query(1,0,300000,l,A[i]);
        int y=query(1,0,300000,A[i],r);
        //cout<<i<<" "<<A[i]<<" "<<x<<endl;
        dp[A[i]]=max(x,y)+1;
        ans=max(ans,dp[A[i]]);
        update(1,0,300000,A[i],dp[A[i]]);
        //cout<<i<<" "<<A[i]<<" "<<x<<" "<<dp[A[i]]<<endl;
    }
    cout<<ans<<endl;

    return 0;
}




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

#define endl '\n'

using namespace std;

bool used[10];

vector<int>node[10];

int N,M;

int ans(int i,int cnt){

  if(cnt==N-1){
    return 1;
  }

  int ret=0;

  used[i]=1;
  
  for(int j=0;j<node[i].size();j++){
    if(used[node[i][j]]!=1){
      ret+=ans(node[i][j],cnt+1);
    }
  }

  used[i]=0;

  return ret;

}
int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  cin>>N>>M;

  int a,b;
  
  for(int i=0;i<M;i++){

    cin>>a>>b;

    node[a].push_back(b);
    node[b].push_back(a);
    
  }

  cout<<ans(1,0)<<endl;
  
  return 0;

}


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

int main() {
  int n;
  cin>>n;
  vector<int> p(n);
  for (int i=0; i<n; i++)
    cin>>p.at(i);
  
  int z=0;
  for (int i=1; i<n-1; i++) {
    if ((p.at(i-1)<p.at(i) && p.at(i)<p.at(i+1)) || (p.at(i-1)>p.at(i) && p.at(i)>p.at(i+1)))
      z++;
  }
  cout<< z <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<string.h>
using namespace std;
int main() {
    long int K;
    cin >> K;
    string S;
    cin >> S;
    if (K>=S.size()){
        cout << S << endl;
    }
    else{
            for (int i=0; i<K; i++){
                cout << S[i];
            }
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
const int inf = 1<<30, maxn = 1<<20;
using ll = long long;
const int mod = 1e9 + 7;
ll dp[45][3][3];
void norm(int &n, int &x) {
	if(x == -2) x = 0, n = -1;
	if(x == -1) x = 1, n = -1;
	if(x == 2) x = 0, n = 1;
	if(x == 3) x = 1, n = 1;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	ll n, a, b, x = 0;
	cin >> n >> a >> b;
	for(ll t = 0, i = 2; i < n; i++) cin >> t, x ^= t;
	for(int i = 0; i <= 44; i++)
		for(int c0 = 0; c0 < 3; c0++)
			for(int c1 = 0; c1 < 3; c1++) {
				dp[i][c0][c1] = 1ll<<50;}
	dp[0][1][1] = 0;
	for(int i = 0; i < 44; i++) {
		for(int c0 = 0; c0 < 3; c0++)
			for(int c1 = 0; c1 < 3; c1++) {
				for(int m = 0; m < 2; m++) {
						int x0 = c0-1 + ((a>>i)&1);
						int x1 = c1-1 + ((b>>i)&1);		
						if(m) x0--, x1++;
						int n0 = 0, n1 = 0;
						norm(n0, x0);
						norm(n1, x1);
						if((x0^x1) == ((x>>i)&1)) dp[i+1][n0+1][n1+1] = min(dp[i+1][n0+1][n1+1], dp[i][c0][c1] + (((ll)m)<<i)); 
				}
			}
	}
	ll t = dp[44][1][1];			
	if(t < a) cout << t;
	else cout << -1;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
  string s;
  std::cin >> s;
  std::vector<int> v(26);
  rep(i,s.size()){
    v[(int)s[i]-97]++;
  }
  rep(i,v.size()){
    if(v[i]==0){
      std::cout << (char)(i+97) << '\n';
      return 0;
    }
  }
  std::cout << "None" << '\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


Int calc(vector<string> &mp, Int a, Int b){
  Int H = mp.size();
  Int W = mp[0].size();

  Int cnt = 0;
  for(Int i=0;i<H;i++)
    for(Int j=0;j<W;j++){
      if((a>>i&1) || (b>>j&1)) continue;
      cnt += mp[i][j] == '#';
    }
  return cnt;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int H, W, K;
  cin>>H>>W>>K;

  vector<string>mp(H);
  cin>>mp;



  Int ans = 0;
  for(Int i=0;i<(1LL<<H);i++)
    for(Int j=0;j<(1LL<<W);j++){
      Int num = calc(mp, i, j);
      ans += num == K;
    }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3652