akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 3000000007;
const double INFD = 1e100;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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(){
  ll N;
  cin >> N;
  ll A,B;
  cin >> A >> B;
  if((B-A)%2 == 0){
    cout << (B-A)/2 << endl;
  }else{
    if(N-B > A-1){
      cout << min(B-1, A+(B-A)/2) << endl;
    }else{
      cout << min(N-A,(N-B)+1+(B-A)/2) << endl;
    }
  }

  return 0;
}


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

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

  int n;
  cin >> n;
  vector<int> ans(n + 1);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int f = x * x + y * y + z * z + x * y + x * z + y * z;
        if (f <= n) {
          ans[f]++;
        }
      }
    }
  }  
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  int ans = 0;
  for (int i=0; i<N; i++) {
    cin >> data.at(i);
  }
  
  bool a = true;
  while (a) {
    for (int i=0; i<N; i++) {
      if (data.at(i) % 2 != 0) {
        a = false;
        break;
      }
      else {
        data.at(i) /= 2;
      }
    }
	if (a){
    ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,i,r=0;
char s[51];
int main(){
  scanf("%d%s",&n,s);
  for(i=0;i<n-2;i++)if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')r++;
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 128
n,k=map(int,input().split())
ju=False
for i in range(n):
  if k+i==0:
    ju=True
    break
ans=0
if not ju:
  if k<0:
    for i in range(n-1):
      ans+=k+i
  else:
    for i in range(1,n):
      ans+=k+i
else:
  for i in range(n):
    ans+=k+i
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";

ostream& operator<<(ostream& cerr, vector<ll> aux) {
  cerr << "[";
  for (auto e : aux) cerr << e << ' ';
  cerr << "]";
  return cerr;
}

const int maxN = 211;
const int maxBit = 60;

int n, t;
ll a[maxN];
char s[maxN];

ll curr[maxBit + 1];
ll reduced;

int reduce(ll val) {
  for (int i = maxBit; i >= 0; i--) {
    if (((val >> i) & 1) == 0) continue;
    if (curr[i] == 0) {
      reduced = val;
      return i;
    }
    val ^= curr[i];
  }
  return -1;
}

int solve() {
  memset(curr, 0, sizeof(curr));

  for (int i = n - 1; i >= 0; i--) {
    int lastBit = reduce(a[i]);
    if (lastBit == -1) continue;
    
    if (s[i] == '0') {
      curr[lastBit] = reduced;
    } else {
      return 1;
    }
  }

  return 0;
}

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

  scanf("%d", &t);
  for (int ti = 1; ti <= t; ti++) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
    scanf("\n%s", s);

    printf("%d\n", solve());
  }


  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,q,d;
    list <long long> a;
    list <long long>::iterator itr = a.end();  
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>q;
        if(q==0){
            cin>>d;
            a.insert(itr,d);
            itr--;
        }
        else if(q==1){
            cin>>d;
            advance(itr,d);
        }
        else if(q==2){
            itr=a.erase(itr);
        }
    }
    for(itr = a.begin(); itr != a.end(); itr++) {
        cout << *itr << endl;
    }
    return 0;
}


Measured memory_bytes: 18544
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const long long MOD_NUM = 1000000007LL;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	int m1, m2, d1, d2;
	get2int(m1, d1);
	get2int(m2, d2);

	if (d2 == 1) {
		printf("1\n");
	}
	else {
		printf("0\n");
	}
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {
    int a, b;
    cin>>a>>b;
    if(a+b==15) cout << "+" << endl;
    else if(a*b==15) cout << '*' << endl;
    else cout << "x" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<map>
#include<functional>
#include<climits>
using namespace std;
int a[101][101],n;
int F(int f,int t)
{
	typedef pair<int,int>P;
	P p;
	priority_queue<P,vector<P>,greater<P> >q;
	int d[101]={0},i,x;
	for(i=0;i<=n;++i)d[i]=INT_MAX;
	q.push(P(0,f));
	while(!q.empty())
	{
		p=q.top();q.pop();
		if(d[p.second]<=p.first)continue;
		d[p.second]=p.first;
		for(i=1;i<=n;++i)
			if(a[p.second][i]!=INT_MAX&&d[i]>(x=p.first+a[p.second][i]))
				q.push(P(x,i));
	}
	return d[t];
}
int main()
{
	int k,s,t,u,r;
	while(scanf("%d%d",&n,&k),n)
	{
		for(s=0;s<=n;++s)for(t=0;t<=n;++t)a[s][t]=INT_MAX;
		while(k--)
		{
			scanf("%d",&r);
			if(r)scanf("%d%d%d",&s,&t,&u),a[s][t]=a[t][s]=(a[s][t]<u?a[s][t]:u);
			else scanf("%d%d",&s,&t),printf("%d\n",(u=F(s,t))-INT_MAX?u:-1);
		}
	}
}

Measured memory_bytes: 876
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  int n;
  cin>>n;
  int arr[n+10],mx=0;
  ll sum=0;
  for(int i=0;i<n;i++)
  {
     cin>>arr[i];
     mx=max(mx,arr[i]);
     sum+=arr[i];
  }
  sum-=mx;
  //cout<<mx<<" "<<sum<<endl;
  if(sum-mx>0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;

}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

bool boin(char A){
    string b="aiueo";
    REP(i,0,5){
        if(A==b[i]) return true;
    }
    return false;
}

vector<string> code_convert(vector<string> airports){
    vector<string> codes(airports.size());
    REP(i,0,airports.size()){
        int idx=0;
        codes[i].push_back(airports[i][0]);
        while (idx < airports[i].size()){
            if(boin(airports[i][idx])) codes[i].push_back(airports[i][idx+1]);
            idx++;
        }
    }
    return codes;
}

//入力された２つの文字列のk番目までが同じだったらtrueを返す
bool code_judge(string A, string B, int k){
    bool flag=true;
    if(min(A.size(),B.size()) < k){
        if(A.size()==B.size()){
            REP(i,0,A.size()) if(A[i]!=B[i]) flag=false;
        }else{
            return false;
        }
    }else{
        REP(i,0,k) if(A[i]!=B[i]) flag=false;
    }
    return flag;
}

int main(){
    int n;
    while(cin >> n && n){
        vector<string> airports(n);
        vector<string> codes;
        REP(i,0,n) cin >> airports[i];
        codes = code_convert(airports);

        int ans=-1;
        REP(i,1,51){
            bool flag=true;
            REP(j,0,codes.size()){
                REP(k,j+1,codes.size()){
                    if(code_judge(codes[j],codes[k],i)) flag=false;
                }
            }
            if(flag){
                ans=i;
                break;
            }
        }
        P(ans);
    }
}


Measured memory_bytes: 3252
import sys

def div(i):
    ans = []
    for d in range(1, i + 1):
        if d ** 2 > i: break
        if i % d == 0:
            if d ** 2 == i: ans.append(d)
            else:
                ans.append(d)
                ans.append(i // d)
    return ans

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    Count = [0] * N
    In = []
    add = 0
    for i in reversed(range(N)):
        if Count[i] % 2 == A[i]: continue
        elif (Count[i] + 1) % 2 == A[i]:
            add += 1
            In.append(i + 1)
            D = div(i + 1)
            for d in D: Count[d - 1] += 1
        else:
            print(-1)
            break
    else:
        print(add)
        print(" ".join(map(str, In)))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 86904
import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        String s = in.nextToken();

        HashSet<Character> set = new HashSet<>();


        for (int i =0; i<s.length();i++)
        {
            char character = s.charAt(i);
            if (set.contains(character))
            {
                System.out.println("no");
                return;
            }
            else
            {
                set.add(character);
            }
        }
        System.out.println("yes");


    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 21204
#include <stdio.h>
#include <stdlib.h>
   
typedef struct{
    int key;
    int left;
    int right;
} Node;
   
void insert(Node*, int, int);
void print1(Node*, int);
void print2(Node*, int);
   
int main()
{
    char s[10];
    Node *t;
    int m;
    int a;
    int i;
   
    scanf("%d", &m);
    t=(Node*)malloc(sizeof(Node)*m);
   
    int count=0;
    for(i=0; i<m; i++){
        scanf("%s", &s);
        if(s[0]=='i'){ scanf("%d", &a); insert(t, count, a); count++; }
        if(s[0]=='p'){
            if(count>0) print1(t, 0);
            printf("\n");
            if(count>0) print2(t, 0);
            printf("\n");
        }
    }
       
    return 0;
   
}
   
void print1(Node *t, int p)
{
    if(t[p].left>=0) print1(t, t[p].left);
    printf(" %d", t[p].key);
    if(t[p].right>=0) print1(t, t[p].right);
}
   
void print2(Node *t, int p)
{
    printf(" %d", t[p].key);
    if(t[p].left>=0) print2(t, t[p].left);
    if(t[p].right>=0) print2(t, t[p].right);
}
   
void insert(Node *t, int count, int z)
{
    int x=0, y;
    if(count<1) x=-1;
   
    t[count].key = z;
    t[count].left = -1;
    t[count].right= -1;
   
    while(x>=0){
        y = x; 
        if(z < t[x].key)
            x = t[x].left; 
        else
            x = t[x].right; 
    }
   
    if(count<1){}
    else if(z < t[y].key){
        t[y].left = count; 
    }
    else {
        t[y].right = count;
    }
}

Measured memory_bytes: 6464
#include<bits/stdc++.h>
using namespace std;
int main (){
  int64_t  X, Y;
  cin >> X >> Y;
  int64_t gap = Y - X + 1LL ;

  int64_t count = 0LL;
  int64_t p = X ;
  while(p < Y+1){
    count++;
    p = p * 2LL ;
    }
    
  cout << count << endl;
}

Measured memory_bytes: 256
from collections import*
n=int(input())
l=[[]for i in range(n)]
ans=[-1 for i in range(n)]
visit=[False for i in range(n)]
ans[0]=0
for i in range(n-1):
    u,v,w=map(int,input().split())
    l[u-1].append((v-1,w))
    l[v-1].append((u-1,w))
      
q=deque()
q.append((0,0,-1))
while q:
    v,d,p=q.popleft()
    if d%2==0:
        ans[v]=0
    else:
        ans[v]=1
    for u,w in l[v]:
        if u==p:
            continue
        q.append((u,d+w,v))
print('\n'.join(map(str, ans)))

Measured memory_bytes: 102552
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

int main()
{
  long long int ans = 0;
  string s;
  while (cin >> s) {
    long long int tmp = 0;
    bool digit = false;
    for (unsigned int i = 0; i < s.size(); ++i) {
      if (isdigit(s[i])) {
	digit = true;
	tmp *= 10;
	tmp += (s[i] - '0');
      } else {
	if (digit) {
	  ans += tmp;
	  digit = false;
	  tmp = 0;
	}
      }
    }
    if (digit)
      ans += tmp;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main() {

	int a, b=0, c=0;

	scanf("%d", &a);

	for (; a >= 3600; b++, a -= 3600)
	{
		
	}

	for (; a >= 60; c++, a -= 60)
	{
	}

	printf("%d:%d:%d\n", b, c, a);

	return 0;
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}


int main()
{
    scanInt(N);
    scanLLInt(A);
    scanLLInt(B);
    scanLLInt(C);
    vector<string> Ss; Ss.reserve(N);
    vector<string> result; result.reserve(N);
    REP(n, N){
        string S;
        cin >> S;
        Ss.emplace_back(S);
    }
    vector<char> success; success.reserve(N);
    auto value = [&](string& S){
        if (S == "AB"){
            return make_pair(&A, &B);
        } else if (S == "AC"){
            return make_pair(&A, &C);
        }else{ // S == "BC"
            return make_pair(&B, &C);
        }
    };
    auto first_next_has = [&](string& S1, string& S2){
        return S1[0] == S2[0] || S1[0] == S2[1];
    };
    auto second_next_has = [&](string& S1, string& S2){
        return S1[1] == S2[0] || S1[1] == S2[1];
    };
    if (A + B + C == 0){
        cout << "No" << endl;
        exit(0);
    }
    REP(n, N){
        auto& Sn = Ss[n];
        auto v = value(Sn);
        auto& first = *(v.first);
        auto& second = *(v.second);
        if (first == 0 && second == 0){
            cout << "No" << endl;
            exit(0);
        }
        if (first == 0 || second == 0){
            if (first == 0){
                success.emplace_back(Sn[0]);
                ++first;
                --second;
                continue;
            }else{ // second == 0
                success.emplace_back(Sn[1]);
                ++second;
                --first;
                continue;
            }
        }
        if (n != N - 1){
            if (first <= 1 && first_next_has(Sn, Ss[n + 1])){
                success.emplace_back(Sn[0]);
                ++first;
                --second;
                continue;
            } else if (second <= 1 && second_next_has(Sn, Ss[n + 1])){
                success.emplace_back(Sn[1]);
                ++second;
                --first;
                continue;
            }
        }
        success.emplace_back(Sn[0]);
        ++first;
        --second;
    }
    cout << "Yes" << endl;
    for (auto& s : success){
        cout << s << endl;
    }
}


Measured memory_bytes: 6724
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val Array(n, _) = sc.nextLine.split(" ").map(_.toInt)
    val words = List.fill(n)(sc.nextLine)
    println(words.sorted.mkString)
  }
}


Measured memory_bytes: 26036
N, A, B = map(int, input().split())
def KetaSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
answer = 0
for i in range(N+1):
    if A <= KetaSum(i) <= B:
        # print(i)
        answer += i
print(answer)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] vs = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			int n = vs[0];
			int x = vs[1];
			int sum = 0;
			vs = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			int cnt = 0;
			for (int i = 0; i < n; i++)
			{
				sum += vs[i];
				if (sum <= x)
				{
					cnt++;
				}
				else
				{
					break;
				}
			}
			Console.WriteLine(cnt + 1);
		}
	}
}


Measured memory_bytes: 13396
H, W = map(int, input().split())
S = ['.'*(W+2)] + ['.'+input()+'.' for _ in range(H)] + ['.'*(W+2)]

for hi in range(1, H+1):
  ans = ''
  for wi in range(1, W+1):
    if S[hi][wi] == '#':
      ans += '#'
    else:
      now = 0
      for hii in [-1, 0, 1]:
        for wii in [-1, 0, 1]:
          if S[hi+hii][wi+wii] == '#':
            now += 1
      ans += str(now)
  print(ans)

Measured memory_bytes: 3064
#include<cstdio>

int main(){
    char str[55];
    int a[35] = {0};
    scanf("%s",str);
    for(int i = 0;str[i] != '\0';i++)
        a[str[i]-'a']++;

    for(int i = 0;i < 26;i++)
        if(a[i] > 1)
            return 0 * printf("no\n");
    printf("yes\n");
    return 0;
}


Measured memory_bytes: 128
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]
dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))


Measured memory_bytes: 62168
#include <iostream>
#include <algorithm>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>

using namespace std;



int wa(int n) {

	int result = 0;

	while (n > 0) {
		result += n % 10;
		n /= 10;
	}

	return result;


}


int main()
{
    
	long long int k, n;
	cin >> k >> n;

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

	sort(a.begin(), a.end());

	long long int maxi = a[0] + (k - a[a.size() - 1]);

	for (int i = 0; i < a.size() - 1; i++) {
		maxi = max(maxi, a[i + 1] - a[i]);




	}

	long long int ans = k - maxi;

	cout << ans << endl;



	return 0;

}




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

struct data {
	int x;
	int y;
	int h;
};

int main() {
	int n;
	cin >> n;
	data dat[n];
	int pos;
	for (int i = 0; i < n; i++) {
		cin >> dat[i].x >> dat[i].y >> dat[i].h;
		if (dat[i].h) pos = i;
	}
	for (int cx = 0; cx < 101; cx++) {
		for (int cy = 0; cy < 101; cy++) {
			int h = dat[pos].h + abs(dat[pos].x - cx) + abs(dat[pos].y - cy);
			bool flag = true;
			for (int i = 0; i < n; i++) {
				if (max(0, h - abs(dat[i].x - cx) - abs(dat[i].y - cy)) != dat[i].h) flag = false;
			}
			if (flag) {
				cout << cx << " " << cy << " " << h << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
def cal_temperture(x):
    return abs((t - x * 0.006) - a)


n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
cal_temp = list(map(cal_temperture, h))

print(cal_temp.index(min(cal_temp))+1)


Measured memory_bytes: 3060
import sys
readline = sys.stdin.readline
class Tree:
    __slots__ = ['id', 'p', 'sibling', 'degree', 'depth', 'height', 'type', 'c']
    def __init__(self, id):
        self.id = id
        self.p = -1
        self.sibling = -1
        self.degree = 0
        self.depth = 0
        self.height = 0
        self.type = "leaf"
        self.c = []
    def __str__(self):
        return f"node {self.id}: parent = {self.p}, sibling = {self.sibling}, degree = {self.degree}, depth = {self.depth}, height = {self.height}, {self.type}"
n = int(input())
tree = tuple(Tree(i) for i in range(n))
for _ in range(n):
    id, *c = map(int, readline().replace("-1", "").split())
    if c != []:
        tree[id].type = "internal node"
        tree[id].c = c
        for j in c:
            tree[j].p = id
        len_c = len(c)
        tree[id].degree = len_c
        if len_c == 2:
            tree[c[0]].sibling = c[1]
            tree[c[1]].sibling = c[0]
root = 0
while tree[root].p != -1:
    root = tree[root].p
tree[root].type = "root"
def depth_height_check(id, d):
    d += 1
    height = 0
    for i in tree[id].c:
        tree[i].depth = d
        if tree[i].type != "leaf":
            tree[i].height = depth_height_check(i, d)
            height = max(height, tree[i].height)
    return height + 1
tree[root].height = depth_height_check(root, 0) if n > 1 else 0
print("\n".join(map(str, tree)))



Measured memory_bytes: 5632
d: object
L,R, d = map(int, input().split())


num_list = list()

for x in range(L, R + 1):
    num_list.append(x)

dmul_list = list()
for i in num_list:
    x = i%d
    if x == 0:
        dmul_list.append(i)

print(len(dmul_list))

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

const int Nmax=200010;

int main() {
	int a,b;
	cin >> a >> b;
	if(a*b % 2 == 1) cout << "Odd" << endl;
	else cout << "Even" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	ll a;
	long double b;
	cin >> a >> b;

	ll c = a * b;
	cout << c << endl;
}



Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
 
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)
 
template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
 
#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif
 
const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
pair<ll, ll> A[2000];
ll dp[2005][2005];
int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N){
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A, A + N, greater<pair<ll,ll>>());
    rep(i, N){
        rep(l,i+1){
            int r = i - l;
            chmax(dp[l + 1][r], dp[l][r] + A[i].first * (A[i].second - l));
            chmax(dp[l][r + 1], dp[l][r] + A[i].first * (N - r - A[i].second - 1));
        }
    }
 
    ll ans = -INF;
    rep(i, N + 1) chmax(ans, dp[i][N - i]);
    cout << ans << endl;
    
    
}

Measured memory_bytes: 26312
import java.util.*;

public class Main {
    private static final Scanner sc = new Scanner(System.in);

    private void solve() {
        int th = sc.nextInt();
        int ts = sc.nextInt();
        int ah = sc.nextInt();
        int as = sc.nextInt();

        int turn = 0;
        while (th > 0 && ah > 0) {
            if (turn == 0) {
                ah -= ts;
            } else {
                th -= as;
            }
            turn ^= 1;
        }

        if (ah <= 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

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

Measured memory_bytes: 35832
from sys import stdin

n = int(stdin.readline())
h = list(map(int, stdin.readline().split()))

dp = [10 ** 9] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):

    h1 = dp[i - 1] + abs(h[i] - h[i - 1])
    dp[i] = h1 if h1 < dp[i] else dp[i]

    h2 = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = h2 if h2 < dp[i] else dp[i]

print(dp[-1])

Measured memory_bytes: 13712
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

X,Y,Z = I()
print((X-Z)//(Y+Z))

Measured memory_bytes: 72348
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(sc.hasNext()) {
      String str = sc.nextLine();
      str = str.replace("apple","temp");
      str = str.replace("peach","apple");
      str = str.replace("temp","peach");
      System.out.println(str);
    }
  }
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;
const long double pi = 3.14159265;
const long long mod =1e9+7;


int main(){
    
    string S;
    cin >> S;
    S[3] = '8';
        cout << S << endl;
    


    return 0;
}
 

Measured memory_bytes: 256
#include<stdio.h>

int n;
int A[100];

int solve(int,int);

int main( ){
  int i,j,k;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&k);
  for(i = 0; i < k; i++){
    scanf("%d",&j);
    if(solve(0,j)){
      printf("yes\n");
    }
    else printf("no\n");
    
  }
  return 0;
}

int solve(int a, int b){
  if(b == 0) return 1;
  if(a >= n) return 0;

  
  int res = solve(a + 1, b) || solve(a + 1, b - A[a]);
  return res;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

struct UnionFind{
    vector<int> parent, rank;
    UnionFind(int n){ parent = vector<int>(n, -1); rank = vector<int>(n, 0); }
    int find(int x){
        if(parent[x] == -1) return x;
        else return (parent[x] = find(parent[x]));
    }
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(rank[x] < rank[y])
            parent[x] = y;
        else
            parent[y] = x;
        if(rank[x] == rank[y])
            ++rank[x];
        return true;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

signed main(){
	int N, K, L;
	cin >> N >> K >> L;
	UnionFind uf1(N), uf2(N);
	for(int i = 0; i < K; ++i) {
		int p, q;
		cin >> p >> q;
		uf1.unite(p - 1, q - 1);
	}
	for(int i = 0; i < L; ++i) {
		int r, s;
		cin >> r >> s;
		uf2.unite(r - 1, s - 1);
	}
	map<int, map<int,int>> mp;
	for(int i = 0; i < N; ++i) {
		mp[uf1.find(i)][uf2.find(i)]++;
	}
	for(int i = 0; i < N; ++i) {
		cout << mp[uf1.find(i)][uf2.find(i)] << (i == N - 1 ? "\n": " ");
	}
	return 0;
}


Measured memory_bytes: 35200
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define x first
#define y second
typedef pair<int,int> pii;
const int MAXN=105;

int n,m;
int sumr[MAXN][MAXN],sumc[MAXN][MAXN],f[MAXN][MAXN][MAXN];
char s[MAXN][MAXN];
pii ed;

int main(){
    //freopen("robot.in","r",stdin);
    //freopen("robot.out","w",stdout);

    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%s",s[i]+1);
        for(int j=1;j<=m;j++){
            sumr[i][j]=sumr[i-1][j];
            sumc[i][j]=sumc[i][j-1];
            if(s[i][j]=='o') sumr[i][j]++,sumc[i][j]++;
            if(s[i][j]=='E') ed.x=i,ed.y=j;
        }
    }
    int ans=0;
    memset(f,-1,sizeof f);
    f[0][0][0]=0;
    int U=ed.x-1,D=n-ed.x,L=ed.y-1,R=m-ed.y;
    for(int l=0;l<=L;l++)
        for(int r=0;r<=R;r++)
            for(int u=0;u<=U;u++)
                for(int d=0;d<=D;d++){
                    if(f[r][u][d]==-1) continue;
                    ans=max(ans,f[r][u][d]);
                    int left=max(r+1,ed.y-l),right=min(m-l,ed.y+r);
                    int up=max(d+1,ed.x-u),down=min(n-u,ed.x+d);
                    if(left>right||up>down) continue;
                    int temp;
                    if(u<U-d){
                        temp=sumc[ed.x-u-1][right]-sumc[ed.x-u-1][left-1];
                        f[r][u+1][d]=max(f[r][u+1][d],f[r][u][d]+temp);
                    }
                    if(d<D-u){
                        temp=sumc[ed.x+d+1][right]-sumc[ed.x+d+1][left-1];
                        f[r][u][d+1]=max(f[r][u][d+1],f[r][u][d]+temp);
                    }
                    if(r<R-l){
                        temp=sumr[down][ed.y+r+1]-sumr[up-1][ed.y+r+1];
                        f[r+1][u][d]=max(f[r+1][u][d],f[r][u][d]+temp);
                    }
                    if(l<L-r){
                        temp=sumr[down][ed.y-l-1]-sumr[up-1][ed.y-l-1];
                        f[r][u][d]=max(f[r][u][d],f[r][u][d]+temp);
                    }
                }
    printf("%d",ans);

    fclose(stdin);
    fclose(stdout);
}


Measured memory_bytes: 4736
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int w,n,i;
cin>>w>>n;
int l[w];
for(i=0;i<w;i++){
l[i]=i;
}
for(i=0;i<n;i++){
int a,b,t;
scanf("%d,%d",&a,&b);
t=l[a-1];
l[a-1]=l[b-1];
l[b-1]=t;
}
for(i=0;i<w;i++){
printf("%d\n",l[i]+1);
}
return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i,a,b) for(int i=a;i<=b;i++)
#define g(i,a,b) for(int i=a;i>=b;i--)
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
#define bits(x) __builtin_popcountll(x)
#define op(x) cout<<"Case #"<<x<<": "
using namespace std;
ll mod = 1000000007;
ll INF = 1000000000000000000;
ll n;
lld a[3000];
lld dp[3000][3000];

lld foo(ll idx, ll num)
{
	if (idx == n)
	{
		if (num > (n - num)) return 1.0;
		return 0;
	}

	if (dp[idx][num] != -1.0) return dp[idx][num];

	lld res = 1;

	res = a[idx] * foo(idx + 1, num + 1) + (1.0 - a[idx]) * foo(idx + 1, num);

	return dp[idx][num] = res;
}
void solve(int t)
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	for (int i = 0; i < 3000; i++) for (int j = 0; j < 3000; j++) dp[i][j] = -1.0;

	cout << fixed << setprecision(11) << foo(0, 0) << endl;


}

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




	int t = 1;
	//cin >> t;

	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}
}


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

void merge(vector<int> &A, int left, int mid, int right, int &count) {
  int n1 = mid - left;
  int n2 = right - mid;
  vector<int> L(n1+1);
  vector<int> R(n2+1);
  for (int i = 0; i < n1; i++)
    L.at(i) = A.at(left+i);
  for (int i = 0; i < n2; i++) 
    R.at(i) = A.at(mid+i);
  L.at(n1) = 2147483647;
  R.at(n2) = 2147483647;
  int i = 0, j = 0;
  for(int k = left; k < right; k++) {
    if (L.at(i) <= R.at(j)) {
      A.at(k) = L.at(i);
      i++;
      count++;
    } else {
      A.at(k) = R.at(j);
      j++;
      count++;
    }
  }
}

void mergeSort(vector<int> &A, int left, int right, int &count) {
  if (left+1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid, count);
    mergeSort(A, mid, right, count);
    merge(A, left, mid, right, count);
  }
}

void display(vector<int> A) {
  for (int i = 0; i < A.size(); i++) {
    cout << A.at(i);
    if (i != A.size()-1) 
    cout << " ";
  }
  cout << endl;
}
int main(void) {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++)
    cin >> A.at(i);
  int count = 0;
  mergeSort(A, 0, n, count);
  display(A);
  cout << count << endl;
}


Measured memory_bytes: 6916
#include<stdio.h>
signed main(){
    int x[5],i;
    for(i=0;i<5;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<5;i++){
        if(x[i]==0){
            printf("%d\n",i+1);
        }
    }
    return(0);
}

Measured memory_bytes: 1728
s=input()
a=int(s[:2])
b=int(s[2:])
if(0<a<13):
  if(0<b<13):
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if(0<b<13):
    print("YYMM")
  else:
    print("NA")

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n; cin >> n;
    string s; cin >> s;

    int ans = 0;

    for (int i = 0; i < 1000; ++i) {
        int c[3] = {i / 100, (i / 10) % 10, i % 10};

        int f = 0;
        for (int j = 0; j < n; ++j) {
            if (s[j] == c[f] + '0') {
                ++f;
            }

            if (f == 3) {
                ++ans;
                break;
            }
        }
    }

    cout << ans << endl;
}

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


int main() {
    int64_t a;
    string b;
    cin >> a >> b;

    string B;

    if(b.size() == 5){
        B.push_back(b.at(0));
        B.push_back(b.at(1));
        B.push_back(b.at(3));
        B.push_back(b.at(4));
    }else{
        B.push_back(b.at(0));
        B.push_back(b.at(2));
        B.push_back(b.at(3));
    }

    int _b = stoi(B);

    int64_t sum = a * _b / 100;

    cout << sum << endl;
    
}

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

namespace AtCoderBeginnerContest178
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = int.Parse(Console.ReadLine());

			var dist = new int[input];
			var rDist = new int[input];
			var max = (int)Math.Pow(10, 9);

			for(var i = 0; i < input; i++)
			{
				var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				dist[i] = inputs[0] + inputs[1];
				rDist[i] = inputs[0] + max - inputs[1];
			}

			Console.WriteLine(Math.Max(dist.Max() - dist.Min(), rDist.Max() - rDist.Min()));
		}
	}
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

map<ll,ll> elist;

void Mkelist(ll x){
  if(x <= 1) return;
  for(ll i = 2; i*i <= x; ++i){
    if(x % i == 0){
      Mkelist(i);
      Mkelist(x/i);
      return;
    }
  }
  elist[x]++;
}

int main(){
  ll n; cin >> n;  
  Mkelist(n);
  ll ans = 0;
  for(auto e:elist){
    for(int i = 1; i < 10000; ++i){
      e.second -= i;
      if(e.second >= 0)ans++;
      else break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  long long N;
  std::cin >> N;

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

  std::reverse(A.begin(), A.end());

  // for (int i = 0; i < N; ++i)
  //   std::cout << A[i] << " ";

  std::vector<long long> dp(N, LINF);
  // dp[i] = 増加部分列の長さが i + 1 の場合の、最終要素の最小値

  for (int i = 0; i < N; ++i)
    // *std::lower_bound(dp.data(), dp.data() + N, A[i]) = A[i];
    *std::upper_bound(dp.data(), dp.data() + N, A[i]) = A[i];

  std::cout << std::lower_bound(dp.data(), dp.data() + N, LINF) - dp.data() << std::endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

const int maxn = 2e5 + 10;

int main(){
	ios_base::sync_with_stdio(false);
	int h, w, n;
	cin >> h >> w >> n;
	int x, y;
	cin >> x >> y;
	string s, t;
	cin >> s >> t;
	int tmp = x;
	for (int i = 0; i < n; i++){
		if (s[i] == 'D')
			tmp ++;
		if (tmp > h)
			return cout << "NO\n", 0;
		if (t[i] == 'U')
			tmp --;
		tmp = max(tmp, 1);
	}
	tmp = x;
	for (int i = 0; i < n; i++){
		if (s[i] == 'U')
			tmp --;
		if (tmp == 0)
			return cout << "NO\n", 0;
		if (t[i] == 'D')
			tmp ++;
		tmp = min(tmp, h);
	}
	tmp = y;
	for (int i = 0; i < n; i++){
		if (s[i] == 'R')
			tmp ++;
		if (tmp > w)
			return cout << "NO\n", 0;
		if (t[i] == 'L')
			tmp --;
		tmp = max(tmp, 1);
	}
	tmp = y;
	for (int i = 0; i < n; i++){
		if (s[i] == 'L')
			tmp --;
		if (tmp == 0)
			return cout << "NO\n", 0;
		if (t[i] == 'R')
			tmp ++;
		tmp = min(tmp, w);
	}
	cout << "YES\n";
}


Measured memory_bytes: 920
N = int(input())
H = list(map(int, input().split())) + [0]
res = 0
mv = 0
for i in range(1, N):
    if H[i-1] >= H[i]:
        mv += 1
    else:
        res = max(res, mv)
        mv = 0
res = max(res, mv)
print(res)

Measured memory_bytes: 14224
#pragma GCC optimize (2)
#include<bits/stdc++.h>
using namespace std;
int arr[100005];
int main()
{
	int n;	
	scanf("%d",&n);
	if(n>=400&&n<=599)
	printf("8");
	else if(n>=600&&n<=799)
	printf("7");
	else if(n>=800&&n<=999)
	printf("6");
	else if(n>=1000&&n<=1199)
	printf("5");
	else if(n>=1200&&n<=1399)
	printf("4");
	else if(n>=1400&&n<=1599)
	printf("3");
	else if(n>=1600&&n<=1799)
	printf("2");
	else if(n>=1800&&n<=1999)
	printf("1");
}

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

namespace solver{
  void solve(){
    int64_t X, K, D; std::cin >> X >> K >> D;
    int64_t ans = LLONG_MAX;

    if(X < 0) X = -X;

    
    if((__int128)K * D <= X){
      ans = X - K * D;
    }else{
      int64_t a = K - (X / D);

      if(a % 2 == 0){
        ans = X % D;
      }else{
        ans = std::abs(X % D - D);
      }
    }

    
    std::cout << ans << "\n";
  }
}

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


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
int main(){
	char str[1205];
	int alpha[26]={};
	int sum;
	int i=0,e=1;
	//fgets(str,1205,stdin);
	while(fgets(str,1205,stdin)!=NULL){
	for(int i=0;i<strlen(str);i++){
		if((str[i]>=65&&str[i]<=90))alpha[str[i]-65]++;
		else if(str[i]>=97&&str[i]<=122)alpha[str[i]-97]++;
	}
	}
	for(int i=0;i<26;i++)printf("%c : %d\n",i+97,alpha[i]);
	return 0;
}


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

void fff(string s = "") {
	if (s == "1") cin >> s;
	if ((int)s.size() >= 4) {
		freopen(s.c_str(),"r",stdin);
	}
}

struct Eins {
	vector<int> st;
	int n;
	Eins(int n) : n(n) {
		st.resize(n << 2 | 1);
	}
	void modify(int id,int l,int r,int pos,int val) {
		if (l == r) {
			st[id] = max(st[id],val);
			return ;
		}
		int mid = l + r >> 1;
		if (pos <= mid) modify(id << 1,l,mid,pos,val);
		else modify(id << 1|1,mid+1,r,pos,val);
		st[id] = max(st[id << 1],st[id << 1|1]);
	}
	int get(int id,int l,int r,int L,int R) {
		if (L <= l && r <= R) return st[id];
		int mid = l + r >> 1;
		if (R <= mid) return get(id << 1,l,mid,L,R);
		if (L > mid) return get(id << 1|1,mid+1,r,L,R);
		return max(get(id << 1,l,mid,L,R),get(id << 1|1,mid+1,r,L,R));
	}
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fff("");
  int n,k;
  cin >> n >> k;
  const int N = (int)3e5;
  Eins Tree(N);
  for (int i = 1; i <= n; i++) {
  	int x;
  	cin >> x;
  	int val = Tree.get(1,0,N,max(0,x - k),min(N,x + k)) + 1;
  	Tree.modify(1,0,N,x,val);
	}
	cout << Tree.st[1];
} 

Measured memory_bytes: 7956
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  int N;
  cin >> N;
  if (N == 0) {
    cout << 1 << endl;
    return 0;
  }
  cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
	string s; cin>>s;
	cout<<s[0];
	cout<<s.size()-2;
	cout<<s[s.size()-1]<<endl;
	return 0;
}


Measured memory_bytes: 256