akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

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

const int MAXN = 2e5 + 5;

string s;
int n, m, cnt;
int a[MAXN], b[MAXN];
int d[2][MAXN], val[MAXN];
queue <int> Q;
vector <int> E[MAXN];
bool bio[MAXN];

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

    cin >> n >> m;
    cin >> s;
    REP(i, n)
        val[i] = s[i] - 'A';

    REP(i, m){
        cin >> a[i] >> b[i];
        a[i] --; b[i] --;
        E[a[i]].pb(b[i]);
        E[b[i]].pb(a[i]);

        d[val[a[i]]][b[i]] ++; d[val[b[i]]][a[i]] ++;
    }

    REP(i, n){
        if(!d[0][i] || !d[1][i]){
            Q.push(i);
            bio[i] = true;
            cnt ++;
        }
    }

    while(!Q.empty()){
        int x = Q.front();
        Q.pop();

        for(auto it : E[x]){
            d[val[x]][it] --;
            if(!d[val[x]][it] && !bio[it]){
                bio[it] = true;
                Q.push(it);
                cnt ++;
            }
        }
    }

    if(cnt == n)
        cout << "No";
    else
        cout << "Yes";
}


Measured memory_bytes: 14928
#include<iostream>
#include<queue>

typedef std::pair<int, int>P;

int main(){

	int n;

	while (std::cin >> n, n){
		std::priority_queue<P>que;

		for (int i = 0; i < n; i++){
			int p, d1, d2;
			std::cin >> p >> d1 >> d2;
			que.push(P(d1 + d2, p));
		}

		std::cout << que.top().second << " " << que.top().first << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1324
n=int(input())
s=input()
d=[set([]) for i in range(10)]
for i in range(n):
    x=int(s[i])
    d[x].add(i)
ans=0
#print(d)
#exit()
for i in range(1000):
    a=b=c=-1
    x=i//100
    y=(i%100)//10
    z=i%10
    if len(d[x])>0:
        a=min(d[x])
    if len(d[z])>0:
        c=max(d[z])
    if a!=-1 and c!=-1:
        for j in range(a+1,c):
            #print(a,c)
            if j in d[y]:
                ans+=1
                break
print(ans)

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

int main()
{
ll n,m,ans=0,temp=0;
cin>>n>>m;
ll h[n],i;
for(i=0;i<n;i++)
cin>>h[i];
vector<ll>s[n];
for(i=0;i<m;i++)
{
ll a,b;
cin>>a>>b;
s[a-1].push_back(b-1);
s[b-1].push_back(a-1);
}
for(i=0;i<n;i++)
{
temp=0;
for(ll j=0;j<s[i].size();j++)
{
if(h[i]<=h[s[i][j]])
{temp=1;
break;
}
}
if(temp==0)
ans++;
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 10220
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

char in[1050];
int main() {
	int ans = 0;
	scanf("%s", in);
	for (int i = 0; in[i]; i++) {
		if (in[i] == '+') ans++;
		else ans--;
	}
	return !printf("%d\n", ans);
}

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

using namespace std;

using ll = long long;

ll solve(ll a, ll b, ll c, ll d) {
    if (a < b) return -1;
    ll cur = a - b;
    if (cur > c) {
        cur -= (cur - c) / b * b;
        if (cur == c) {
            return cur + d;
        }
        if (cur < b) return -1;
        cur -= b;
        cur += d;
    } else {
        cur += d;
    }
    return cur;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        
        if (a < b || b > d) {
            cout << "No" << endl;
            continue;
        }

        if (c >= b) {
            cout << "Yes" << endl;
            continue;
        }

        ll g = __gcd(b, d);
        cout << (b - g + a % g > c ? "No" : "Yes") << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

class RMQ{
public:
  int n;
  P dat[555555];
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    rep(i,2*n) dat[i]=P(MAX,-1);
  }
  void update(int k,P a){
    k+=n-1;dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  P query(int a,int b){return query(a,b,0,0,n);}
  P query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return P(MAX,-1);
    if(a<=l&&r<=b) return dat[k];
    P vl=query(a,b,k*2+1,l,(l+r)/2);
    P vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};

RMQ r[26];

void Main() {
  string s,t;
  cin >> s >> t;
  rep(i,26) r[i].init(s.size()*2);
  rep(i,s.size()) {
    r[s[i]-'a'].update(i,P(0,i));
    r[s[i]-'a'].update(i+s.size(),P(0,i+s.size()));
  }
  ll k=-1,ans=0;
  rep(i,t.size()) {
    P p=r[t[i]-'a'].query(k+1,s.size()*2);
    if(p.F==MAX) {
      pr(-1);
      return;
    }
    ans+=p.S-k;
    k=p.S%s.size();
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    long long int ans = LLINF, temp = 0;
    ;

    rep(p, 100)
    {
        temp = 0;
        rep(i, n)
        {
            long long int num = (a[i] - p) * (a[i] - p);
            temp += num;
        }
        ans = min(ans, temp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
s=input()
n=len(s)
t=[]
x="x"
for i in range(n):
    if s[i]!=x:
        t.append([s[i],i])
m=len(t)
resl=0
resr=n-1
ans=0
for i in range((m+1)//2):
    lt,l=t[i]
    rt,r=t[m-1-i]
    if lt==rt:
        ans+=abs((l-resl)-(resr-r))
        resl=l
        resr=r
    else:
        print(-1)
        exit()
print(ans)

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;
const int N_MAX=1e5;
vector<vector<P>>g(N_MAX);
vector<ll>color(N_MAX,0);

void dfs(ll u,ll p=-1){
    for(auto v:g[u]){
        if(v.first==p)continue;
        if(v.second%2)color[v.first]=1-color[u];
        else color[v.first]=color[u];
        dfs(v.first,u);
    }
}
int main(){
    ll n;cin >>n;
    for (int i = 0; i < n - 1; ++i) {
        ll u,v,w;cin >>u>>v>>w;u--;v--;
        g[u].push_back({v,w});
        g[v].push_back({u,w});
    }
    dfs(0);
    for (int i = 0; i < n; ++i) {
        cout <<color[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 13624
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

int main(void){
   long long N,K;
   cin>>N>>K;
   vector<int> a(N),b(N);
   for(int i=0;i<N;i++){
      cin>>a[i]>>b[i];
   }
   map<int,long long> result;
   for(int i=0;i<N;i++){
      result[a[i]]+=b[i];
   }
   for(auto x:result){
      K=K-x.second;
      if(K<=0){
         cout<<x.first<<endl;
         break;
      }
   }
   return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int nmax=212345;
ll h[nmax],cnt[nmax],s[nmax];
pair<long double,ll> df[nmax];
int main()
{
    ll n,c,l,r,lmax=0,rmax=0,pos=0;
    long double df2;
    scanf("%lld %lld",&n,&c);
   for(ll i=0; i<n; ++i)
        scanf("%lld",&h[i]);
    ll i=1;
    s[0]=h[0]*h[0];
    while(i<n)
    {
        while(lmax<=rmax && df[lmax].first<=h[i])++lmax;
        --lmax;
        pos=lmax;
        cnt[i]=cnt[df[pos].second]+(h[i]-h[df[pos].second])*(h[i]-h[df[pos].second])+c;
        s[i]=cnt[i]+h[i]*h[i];
        df2=(long double)(s[i]-s[df[rmax].second])/(h[i]-h[df[rmax].second])/2;
        if(pos==rmax || df2>df[rmax].first)
        {
            ++rmax;
            df[rmax]=make_pair(df2,i);
        }
        else
        {
            l=pos;
            r=rmax;
            while(l<=r)
            {
                pos=(l+r)/2;
                df2=(long double)(s[i]-s[df[pos].second])/(h[i]-h[df[pos].second])/2;
                if(df[pos].first<df2)l=pos+1;else r=pos-1;
            }
            df2=(long double)(s[i]-s[df[r].second])/(h[i]-h[df[r].second])/2;
            if(df2<=df[l].first)
            {
                df[l]=make_pair(df2,i);
                rmax=l;
            }
        }
        ++i;
    }
    printf("%lld\n",cnt[n-1]);
    return 0;
}


Measured memory_bytes: 11776
fun main() {
    val s = readString()
    if (s == "ABC") println("ARC")
    else println("ABC")
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

Measured memory_bytes: 34368
#include<iostream>
#include<cstdio>

int N,M,K;

int main()
{
	int i,j;
	scanf("%d%d%d",&N,&M,&K);
	bool ans=false;
	for(i=1;i<=N;i++)
		for(j=1;j<=M;j++)
			if(i*j+(N-i)*(M-j)==K)
				ans=true;
	if(!K)ans=true;
	if(ans) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.List

maxNum :: Int
maxNum = 100000

data Seat = Seat Int Int

readPair :: IO Seat
readPair = do
    s <- words <$> getLine
    let [l, r] = map read s :: [Int]
    return (Seat l r)

calcSeats :: Seat -> Int
calcSeats (Seat l r) = r - l + 1

calcTotalSeats :: [Seat] -> Int
calcTotalSeats [] = 0
calcTotalSeats (x:xs) = 
    (calcSeats x) + (calcTotalSeats xs)


main :: IO()
main = do
    n <- readLn :: IO Int
    seats <- replicateM n readPair
    let ans = calcTotalSeats seats
    print ans 


Measured memory_bytes: 1788
/*
    ____        __
   / __ \____  / /_  ____ _____ ___
  / /_/ / __ \/ __ \/ __ `/ __ `__ \
 / _, _/ /_/ / / / / /_/ / / / / / /
/_/ |_|\____/_/ /_/\__,_/_/ /_/ /_/
*/
#include<bits/stdc++.h>

typedef long long ll ;

#define X   first
#define Y   second
#define mp  make_pair
#define pii pair<int , int>
#define vec vector
#define vpii vector<pair<int , int>>
#define i_n   int i = 0 ; i< n ; i++
#define cn  int n ; cin>>n
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define cina int a[n] ; for(int i = 0 ; i < n ; i++) cin>>a[i]
#define pb push_back
#define SZ(x) ll(x.size())

using namespace std;
const int maxn = 1000*100+5 ;

int main()
{
	migmig ;
	int a[3]  ;
	 cin>>a[0]>>a[1]>>a[2] ; 
	 sort(a , a+3) ; 
	 cout<<a[1] - a[0] + a[2] - a[1] ; 
}
//////
////////
///////////



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

int input(){
  int temp;
  cin>>temp;
  return temp;
}

int main(){
  int temp,shu,tai,jikan;
  for(int i=0;i<3;i++){
    shu=input()*60*60;
    shu+=input()*60;
    shu+=input();
    tai=input()*60*60;
    tai+=input()*60;
    tai+=input();
    jikan=tai-shu;
    cout<<(jikan/60/60)<<" ";
    cout<<(jikan/60%60)<<" ";
    cout<<(jikan%60)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3032
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] a = in.nextIntArray(n);

			int[] sum = new int[n+1];
			int[] xor = new int[n+1];

			for (int i = 0; i < n; i++) {
				sum[i+1] = sum[i] + a[i];
				xor[i+1] = xor[i] ^ a[i];
			}

			long ans = 0;
			for (int i = 0; i < n; i++) {
				int l = i, r = n+1;
				while (r - l > 1) {
					int m = (l+r)/2;
					if ((xor[m] ^ xor[i]) == sum[m] - sum[i]) {
						l = m;
					} else {
						r = m;
					}
				}
				ans += l - i;
			}

			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 42920
N = int(input())
S = input()

diff = []
e = 0
w = 0
for si in S:
    if si == 'E':
        e += 1
    else:
        w += 1
    diff.append(e - w)

i = diff.index(max(diff))
# print(i)

ans = S[:i].count('W') + S[i+1:].count('E')
print(ans)

Measured memory_bytes: 15520
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;


struct RSQ{
    int n;
    vector<int> dat;
    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        dat.resize(2 * n - 1, 0);
        // rep(i, 0, 2 * n - 1) dat[i] = MAX;
    }
    void add(int k, int a){
        k += n - 1;
        dat[k] += a;
        while(k > 0){
            k = (k - 1) / 2;
            dat[k] = dat[2 * k + 1] + dat[2 * k + 2];
        }
    }
    //min[a, b) query(a, b, 0, 0, rq.n)
    int getsum(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return dat[k];
        int vl = getsum(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = getsum(a, b, k * 2 + 2, (l + r) / 2, r);
        return vl + vr;
    }
};

signed main(){
    int n, q;
    cin >> n >> q;
    RSQ r;
    r.init(n);
    rep(i, 0, q){
        int c, x, y;
        cin >> c >> x >> y;
        if(c == 0){
            r.add(x - 1, y);
        }else{
            cout << r.getsum(x - 1, y, 0, 0, r.n) << endl;
        }
    }
    // rep(i, 0, 15){
    //     cout << i << ' ' << r.dat[i] << endl;
    // }
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
    ll N;
    cin >> N;
    map<string, int> mp;
    ll ans = 0;
    rep(i, N) {
        string s;
        cin >> s;
        sort(all(s));
        mp[s]++;
        ans += (mp[s] - 1);
    }

    cout << ans << endl;
}

Measured memory_bytes: 11136
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let [x1, y1, x2, y2] = lines[0].split(" ").map(Number);
  console.log(
    Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)).toFixed(5)
  );
});



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

int main(){
    int n;
    cin >> n;
    vector<ll> h(n, 0);
    rep(i, n){
        cin >> h.at(i);
    }
    bool flag = 1;
    vector<ll> nwh = h;
    sort(nwh.begin(), nwh.end());
    rep(i, n){
        if (abs(h[i] - nwh[i]) > 1){
            flag = 0;
            break;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;
namespace {

	void chmin(long long& x, long long y)
	{
		if (x > y || x < 0)
			x = y;
	}

	void chmax(long long& x, long long y)
	{
		if (x < y)
			x = y;
	}

	bool isSevenContained(long N)
	{
		int three = N / 100;
		if (three == 7)
			return true;
		N -= three * 100;
		int two = N / 10;
		if (two == 7)
			return true;
		N -= two * 10;
		return N == 7;
	}

	void core()
	{
		long N;
		cin >> N;

		long long ret(0);
		for (long i = 1; i <= N; ++i)
		{
			if (i % 3 == 0 || i % 5 ==0)
			{
				;
			}
			else
			{
				ret += i;
			}
		}

		cout << ret;
	}
}

//int main()
//{
//	core();
//
//	return 0;
//}
//
int main()
{
		core();
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>

using namespace std;

int main() {
	string c;
	cin >> c;
	if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o")cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)

int min(int a,int b){
  if(a<=b) return a;
  else return b;
}

int main(void){
  char s[1000],t[1000];
  scanf("%s",s);
  scanf("%s",t);
  int ans = strlen(t);
  rep(i,0,strlen(s)-strlen(t)+1){
    int diff = 0;
    rep(j,0,strlen(t)){
      if(t[j] != s[i+j]){
	diff++;
      }
    }
    ans = min(ans,diff);
  }
  printf("%d",ans);
return 0;
}

Measured memory_bytes: 1696
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = Integer.parseInt(scanner.next());
    int[] h = new int[N];
    for (int i = 0; i < N; i++) {
      h[i] = Integer.parseInt(scanner.next());
    }
    scanner.close();
    int[] dp = new int[N];
    dp[0] = 0;
    dp[1] = Math.abs(h[0] - h[1]);
    for (int i = 2; i < N; i++) {
      dp[i] = Math.min(dp[i - 1] + Math.abs(h[i - 1] - h[i]), dp[i - 2] + Math.abs(h[i - 2] - h[i]));
    }
    System.out.println(dp[N - 1]);
  }

}


Measured memory_bytes: 49492
n,m = map(int,input().split())
Ship = [list(map(int,input().split())) for i in range(m)]

Ship1 = []
Ship2 = []

for i in Ship:
    if i[0] == 1:
        Ship1 += [i[1]]
    elif i[1] == n:
        Ship2 += [i[0]]
if set(Ship1) & set(Ship2):#もし同じ値があったらPOSSIBLE、なかったらINPOSSIBLEと表示させる
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 61020
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, l, q, d[328][328] = {}, u, v, w;
    cin >> n >> m >> l;
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (i != j) d[i][j] = mod;
    while (m--) cin >> u >> v >> w, d[u][v] = d[v][u] = w;
    for (int k = 1; k <= n; k++) for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) {
        if (d[i][j] <= l) d[i][j] = 1;
        else d[i][j] = mod;
    }
    for (int k = 1; k <= n; k++) for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    cin >> q;
    while (q--) {
        cin >> u >> v;
        if (d[u][v] != mod) cout << d[u][v] - 1 << '\n';
        else cout << -1 << '\n';
    }
}


Measured memory_bytes: 4076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

struct Dice {
    ll a[6];
    void swap4(ll i1,ll i2,ll i3,ll i4){
        ll tmp=a[i1];
        a[i1]=a[i2];
        a[i2]=a[i3];
        a[i3]=a[i4];
        a[i4]=tmp;
    }
    void rotateE(){
        swap4(2,0,3,5);
    }
    void rotateN(){
        swap4(4,0,1,5);
    }
    void rotateS(){
        swap4(1,0,4,5);
    }
    void rotateW(){
        swap4(3,0,2,5);
    }
    bool sameA(Dice d){
        rep(i,6){
            if(a[i]!=d.a[i])return false;
        }
        return true;
    }
    bool same(Dice d){
        rep(i,2){
            rep(j,4){
                rep(k,4){
                    if(sameA(d))return true;
                    rotateE();
                }
                rotateS();
            }
            rotateE();
        }
        return false;
    }
};

void solve(){
    Dice d1,d2;
    rep(i,6)cin>>d1.a[i];
    rep(i,6)cin>>d2.a[i];
    cout<<(d1.same(d2)?"Yes":"No")<<endl;
}

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



Measured memory_bytes: 3208
import copy
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
total = 0
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
    
for v in c.values():
    if v >= 2:
        total += cmb(v, 2)
# print(total)

for ai in a:
    if c[ai] >= 2:
        # print('Y')
        ans = total - cmb(c[ai], 2)
        if c[ai] - 1 >= 2:
            ans += cmb(c[ai] - 1, 2)
    else:
        ans = total
    print(ans)
    # ans = 0
    # temp = copy.copy(c)
    # temp[ai] = temp[ai] - 1

    # for v in temp.values():
    #     # print(v)
    #     if v >= 2:
    #         ans += cmb(v, 2)
    # print(ans)
# temp = copy.copy(c)
# temp[1] = temp[1] - 1
# print(c)
# print(temp)

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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  for(lint i=0;i<(int)t.size();i++) {
    if(t[i] == '?') { t[i] = 'D'; }
  }

  cout << t << endl;
  return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

vector<int> L;

int N, A, B, C;
int INF = 1000 * 8;

int rec(int i, int a, int b, int c) {
    if (i == N) {
        if (!a || !b || !c) return INF; // A, B, C いずれも竹は 1 本は必ず使ってないとダメ
        return abs(a - A) + abs(b - B) + abs(c - C); // 合体してできた a, b, c を A, B, C にするコスト
    }

    // 今ある竹を採用しない場合
    int res = rec(i + 1, a, b, c);

    // A, B, C を使う場合。
    // (a ? 10 : 0) とかは、最初の 1 本目は合体コストなし、2 本目からはコスト 10 かかることを意味する
    chmin(res, rec(i + 1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(res, rec(i + 1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(res, rec(i + 1, a, b, c + L[i]) + (c ? 10 : 0));

    return res;
}

int main() {
    cin >> N >> A >> B >> C;
    L.resize(N);
    rep(i, N) cin >> L[i];

    cout <<  rec(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b;
    cin >> a >> b;
    if(a==1||b==1)
        cout << 1;
    else{
    long long int c;
    c=a*b;
    if(c%2==0)
        cout << c/2;
    else
        cout << c/2+1;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  int N,M,Q;
  cin>>N>>M>>Q;
  vector<vector<int> > data(N+2,vector<int>(N+2,0));
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    data[A][B]++;
  }
  for (int i = 0; i < N+1; i++)
  {
    for (int j = 0; j < N+1; j++)
    {
      data[i][j+1] += data[i][j];
    }
  }
  for (int i = 0; i < N+1; i++)
  {
    for (int j = 0; j <= N+1; j++)
    {
      data[i+1][j] += data[i][j];
    }
  }
  // DEBUG(data);
  for (int q = 0; q < Q; q++)
  {
    int A,B;
    cin>>A>>B;
    cout<<data[B][B] + data[A-1][A-1] - data[A-1][B] - data[B][A-1] <<endl;
  }
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

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

    if(a>b){
        cout<<0<<endl;
        return 0;
    }

    if(n==1 && a!=b){
        cout<<0<<endl;
        return 0;
    }

    ll mi=a*(n-1)+b;
    ll ma=a+b*(n-1);
    cout<<ma-mi+1<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main()
{

	int n, m;
	int mat1[100][100];
	int mat2[100];
	int result[100];
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> mat1[i][j];
		}
	}

	for (int i = 0; i < m; i++)
	{
		cin >> mat2[i];
		result[i] = 0;
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			result[i] += mat1[i][j] * mat2[j];
		}
	}

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


Measured memory_bytes: 3128
n, a, b = map(int, input().split())
s = input()

cnt_all = 0
cnt_for = 0
ans = []
for i in range(n):
    c = "No"
    if s[i] == "a" and cnt_all < a + b:
        cnt_all += 1
        c = "Yes"
    if s[i] == "b" and cnt_all < a + b and cnt_for+1 <= b:
        cnt_for += 1
        cnt_all += 1
        c = "Yes"
    ans.append(c)
print("\n".join(ans))

Measured memory_bytes: 48880
#include <stdio.h>

using namespace std;

int main()
{
    int n,d;

    scanf("%d %d",&n,&d);

    int c=0;
    for(int i=1; i<=n; i+=(2*d)){
        c++;
        i++;
    }

    printf("%d",c);

    return 0;
}


Measured memory_bytes: 128
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){var e=t.in(),r=t.inr();if(e%2!=1){for(var n=Math.floor(e/2),i=r.slice(n),o=0;o<n;o++)if(r[o]!=i[o])return void console.log("No");console.log("Yes")}else console.log("No")}}]);

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n; cin >> n;
  map<ii, int> mp;
  vector<int> x(n), y(n);
  REP (i, n) cin >> x[i] >> y[i];
  REP (i, n) {
    REPI (j, i + 1, n) {
      int dx = x[i] - x[j];
      int dy = y[i] - y[j];
      if (dx < 0 || (dx == 0 && dy < 0)) {
        dx = -dx, dy = -dy;
      }
      mp[{dx, dy}]++;
    }
  }
  int ma = 0;
  for (auto p : mp) {
    chmax(ma, p.se);
  }
  cout << n - ma << endl;
}


Measured memory_bytes: 384
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define Pig (OO)

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int n;
string s;

bool chk(int mid)
{
	for(int i=0;i+mid-1<n;i++)
	{
		string TryFind=s.substr(i,mid);
		string LeftString1=s.substr(0,i);
		string LeftString2=s.substr(i+mid);
		
		if(LeftString1.find(TryFind)!=string::npos)return 1;
		if(LeftString2.find(TryFind)!=string::npos)return 1;
	}
	
	return 0;
} 

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	cin>>s;
	
	n=s.size();
	
	int L=1,R=n;
	
	while(L<=R)
	{
		int mid=(L+R)>>1;
		
		if(chk(mid))L=mid+1;
		else R=mid-1;
	}
	
	cout<<R;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 384
x1, y1, x2, y2 = map(int, input().split())
d_x = x2 - x1
d_y = y2 - y1
x3 = x2 - (d_y)
y3 = y2 + (d_x)
x4 = x3 - d_x
y4 = y3 - d_y

print(x3, y3, x4, y4)


Measured memory_bytes: 38256
#include <stdio.h>

int main(){
    int N,K;

    scanf("%d %d",&N,&K);
    char s[N];
    scanf("%s",s);
    if(s[K-1]>=97&&s[K]<=122){
        s[K-1]=s[K-1]-32;
    }else{
        s[K-1]=s[K-1]+32;
    }
    for(int i=0;i<N;i++){
        printf("%c",s[i]);
    }
    return 0;
}

Measured memory_bytes: 128
import sys 
cnt = {} 
for line in sys.stdin:
    for l in line:
        if l.isalpha():
            c = l.lower()
            cnt[c] = cnt.get(c,0)+1
for i in range(26):
    c = chr(ord('a')+i)
    print(f'{c} : {cnt.get(c,0)}')


Measured memory_bytes: 5580
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

string s;
int n;
ll dp[105][5][2];

ll solve(int i, int k, bool flg) {
    if (!k) return 1;
    if (i>=n) return 0;

    if (dp[i][k][flg]) return dp[i][k][flg];

    ll res = 0;
    if (flg) {
        res += solve(i+1, k, true);
        res += solve(i+1, k-1, true)*9;
        return res;
    }
    if (s[i]=='0') return solve(i+1, k, false);
    res += solve(i+1, k, true);
    res += solve(i+1, k-1, false);
    res += solve(i+1, k-1, true)*(s[i]-'1');
    return res;
}

int main() {
    int k;
    cin >> s >> k;

    n = s.length();

    ll ans = solve(0, k, false);

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = Integer.parseInt(sc.next());
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());

    int max = Math.min(A, B);
    int min = Math.max(A + B - N, 0);
    System.out.println(max + " " + min);

  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    int sum = 0;
    int maxl = 0;
    for(int i = 0; i < n; i++){
        cin >> l[i];
        sum += l[i];
        maxl = max(maxl, l[i]);
    }
    if(maxl < sum - maxl){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>

int main(int argc, char *argv[]) {
  int a, b;
  std::cin >> a >> b;
  int keta = 10;
  while (b / keta > 0)
    keta *= 10;
  int a2 = a * keta + b;
  int v = sqrt(a2);
  if (v * v == a2)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    int x, n;
    cin(x); cin(n);

    vector<bool> p(200, false);
    rep2(i, n) {
        int temp;
        cin(temp);

        p[temp - 1] = true;
    }

    int result = 0;
    rep2(i, 200) {
        bool flag = p[i];

        if (flag) continue;

        if (abs(x - (i + 1)) < abs(x - result)) {
            result = i + 1;
        }
    }
    print(result);
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

class UnionFind
{
public:
    vector<int> par;
    vector<int> sz;

    UnionFind(int N){
        par = vector<int>(N);
        REP(i, N) par[i] = i;
        sz = vector<int>(N, 1);
    }

    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(sz[x] < sz[y]) swap(x, y);

        par[y] = x;
        sz[x] += sz[y];
    }

    bool is_union(int x, int y){
        x = find(x);
        y = find(y);
        return x == y;
    }

    int union_size(int x){
        return sz[find(x)];
    }

};

signed main(){

    int N, M, K; cin >> N >> M >> K;
    vec c(N); readv_m1(c);
    int K0 = K;
    REP(i, N) if(c[i] == -1) c[i] = K0++;

    vec a(M), b(M), w(M);
    vector<PiP> p(M);
    REP(i, M){
        cin >> a[i] >> b[i] >> w[i];
        a[i]--; b[i]--;
        p[i] = PiP(w[i], Pii(a[i], b[i]));
    }
    Sort(p);

    if(K == 1){
        cout << 0 << endl;
        return 0;
    }

    int ans = -1, tmp = 0;
    int t = 0;
    UnionFind UF(K0);
    REP(i, M){
        if(!UF.is_union(c[p[i].s.f], c[p[i].s.s])){
            t++;
            tmp += p[i].f;
            UF.unite(c[p[i].s.f], c[p[i].s.s]);
        }
        if(t >= K - 1){
            ans = tmp;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* dlm = "";
  for(const auto& x:v) os << exchange(dlm, " ") << x;
  return os;
}
struct UnionFind{
  using val_t=size_t;
  vector<val_t> par;
  explicit UnionFind(size_t n): par(n){
    init(n);
  }
  void init(size_t n){
    iota(begin(par), end(par), 0);
  }
  val_t root(val_t s){
    if(par[s]!=s) par[s]=root(par[s]);
    return par[s];
  }
  void unite(val_t s, val_t t){
    par[root(s)]=root(t);
  }
  bool same(val_t s, val_t t){
    return root(s)==root(t);
  }
};
int32_t main(){
  size_t n,q; cin>>n>>q;
  UnionFind tree(n);
  size_t c,x,y;
  for(size_t i=0; i<q; ++i){
    cin>>c>>x>>y;
    if(c==0) tree.unite(x,y);
    else cout<<(tree.same(x,y)?1:0)<<'\n';
  }
}


Measured memory_bytes: 3316