akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <sstream>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())

#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

using namespace std;

typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;

const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;

int main() {
#ifdef XCODE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m, k; cin >> n >> m >> k;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            int z = (n - i) * j + i * (m - j);
            if (z == k) {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
typedef long long ll;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    string s; cin >> s;
    int q; cin >> q;

    vector<tuple<int, int, char>> vc;
    while(q--) {
        int t, f;
        char c;
        cin >> t;
        if (t == 2) {
            cin >> f >> c;
        } else {
            f = 0; c = '0';
        }
        vc.emplace_back(t, f, c);
    }
    q = vc.size();

    string before;
    string after;

    int acum = 0;
    for( auto x : vc )
    {
        int t = get<0>( x );
        int f = get<1>( x );
        char c = get<2>( x );
        if (t == 1) {
            acum += 1;
        } else {
            if ((acum + f) % 2 == 1) {
                before = c + before;
            } else {
                after += c;
            }
        }
    }

    string result = before + s + after;

    if (acum % 2 == 1) {
        reverse(result.begin(), result.end());
    }

    cout << result << endl;


    return 0;
}


Measured memory_bytes: 5044
n, m = map(int,input().split())
p = [[] for x in range(n)]
r = [-2] + [-1] * (n - 1)
for _ in range(m):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    p[a].append(b)
    p[b].append(a)

from collections import deque
dq = deque()
dq.append(0)

def bfs(room):
    l = []
    global r
    for iroom in p[room]:
        if r[iroom] == -1:
            r[iroom] = room
            l.append(iroom)
    return l

while len(dq) > 0:
    c = dq.popleft()
    ll = bfs(c)
    dq.extend(ll)

if -1 in r:
    print('No')
else:
    print('Yes')
    for i in r[1:]:
        print(i+1)

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

int main() {
 int N = 0; 
 cin >> N; //カードの枚数を指定

//カードを大きい順に並べる
 vector<int> vec(N);
 for(int i = 0;i < N;i++){
     cin >> vec.at(i);
 }
 sort(vec.begin(),vec.end());
 reverse(vec.begin(),vec.end());

 int sum1 = 0; //Alice
 int sum2 = 0; //Bob

 for(int i = 0;i < N;i+=2){
     sum1 += vec.at(i);
 }

 for(int i = 1;i < N;i+=2){
     sum2 += vec.at(i);
 }

 cout << sum1 - sum2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    string s1,s2,s3;cin>>s1>>s2>>s3;
    cout << s1[0] << s2[1] << s3[2] << ednl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
long long COM(int n, int k){
    return 1LL*n*(n-1)/2;
}

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ull n;cin>>n;
    vector<ull>a(n);
    map<ull,ull>m;
    for(ull i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    ull total=0;
    for(ull i=1;i<=n;i++){
        if(m[i]>=2)
        total+=COM(m[i],2);
    }

    for(ull k=1;k<=n;k++){
        ull tmp=total;
        if(m[a[k-1]]>=2)
        tmp-=COM(m[a[k-1]],2);
        if(m[a[k-1]]>=3)
        tmp+=COM(m[a[k-1]]-1,2);
        cout<<tmp<<endl;
    }

    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































Measured memory_bytes: 16640
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max({x,y,z})
#define MX4(x,y,z,p) max({x,y,z,p})
#define MX5(x,y,z,p,q) max({x,y,z,p,q})
#define MN3(x,y,z) min({x,y,z})
#define MN4(x,y,z,p) min({x,y,z,p})
#define MN5(x,y,z,p,q) min({x,y,z,p,q})
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################

string arr[10] = {"", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};

void solve() {

    string tmp;
    cin>>tmp;    
    for(int i = 1 ; i<= 7 ; i++) {
        if(tmp == arr[i]){
            printf("%d\n", i);
            return;
        }
    }

}

void init() {
    


}

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


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
H.append(0) #H[-1]の処理専用
ans = 0

while sum(H) > 0:
    i = 0
    memo = []
    while i < N+1:
        if H[i] > 0:
            memo.append(i)
        if H[i] == 0:
            if len(memo):
                for i in memo:
                    H[i] -= 1
                memo = []
                ans += 1
        i += 1

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a>0) cout << "Positive" << endl;
  else if (b<0){
    if ((b-a)%2 != 0) cout << "Positive" << endl;
    else cout << "Negative" << endl;
  }
  else if (a==0||b==0) cout << "Zero" << endl;
  else if (a<0&&b>0) cout << "Zero" << endl;
}

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

int main(void)
{
    int c,n,m,t;

    cin>>n>>m>>c;

    int b[m];

    for (int i = 0; i <m; i++)
        cin >> b[i];

    int cont=0;

    for(int i=0;i<n; i++)
    {
        int ans=0;
        for(int j=0;j<m; j++)
        {
            cin>>t;
            ans=ans+t*b[j];
        }
        if(ans+c>0)
            cont++;

    }
    cout<<cont;
    return 0;
}


Measured memory_bytes: 3564
A = [ord(a)-97 for a in input()]
N = len(A)
X = [0] * 26
Y = [0] * (N + 2)
NE = [0] * N
R = [N] * 26
s = 0
t = 1
for i in range(N)[::-1]:
    a = A[i]
    if X[a] == 0:
        X[a] = 1
        s += 1
        if s == 26:
            s = 0
            X = [0] * 26
            t += 1
    Y[i] = t
    NE[i] = R[a]
    R[a] = i

ANS = []
ii = 0
for i, a in enumerate(A):
    if i == ii:
        for j in range(26):
            if Y[R[j]+1] < Y[i]:
                ANS.append(j)
                ii = R[j]+1
                break
    R[a] = NE[i]

print("".join([chr(a+97) for a in ANS]))

Measured memory_bytes: 56544
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 X(): return list(input())
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)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

Q,H,S,D = I()
N = i()

a = N // 2
b = N // 1
c = N // 0.5
d = N // 0.25

H = min(H, Q*2)
S = min(S, H*2)
D = min(D, S*2)

if N % 2 == 0:
    print(D*(N//2))
else:
    print(D*(N//2)+S)


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

int main() {
    int X;
    cin >> X;
    int tmp = X/500;
    ll ans = 1000*tmp;
    X -= 500*tmp;
    ans += 5*(X/5);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int h, w, n, k, ans;

int pot[50*50];

int query(int y1, int y2, int x1, int x2)
{
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	int ans;
	cin >> ans;
	return ans;
}

void solve(int y1, int y2, int x1, int x2, int cnt, int split)
{
	if(cnt==0)
		return;

	if(cnt==(y2-y1+1)*(x2-x1+1))
	{
		for(int i = y1; i <= y2; ++i)
		{
			for(int j = x1; j <= x2; ++j)
			{
				ans += pot[i*w+j];
				ans %= k;
			}
		}

		return;
	}

	if(y1!=y2)//split)
	{
		int m = (y1+y2)/2;
		int h = query(y1, m, x1, x2);
		solve(y1, m, x1, x2, h, split^1);
		solve(m+1, y2, x1, x2, cnt-h, split^1);
	}
	else
	{
		int m = (x1+x2)/2;
		int h = query(y1, y2, x1, m);
		solve(y1, y2, x1, m, h, split^1);
		solve(y1, y2, m+1, x2, cnt-h, split^1);
	}
}

int32_t main()
{
	cin >> h >> w >> n >> k;

	pot[0] = 1;

	for(int i = 1; i < 50*50; ++i)
	{
		pot[i] = pot[i-1]*2%k;
	}

	for(int j = 0; j < w; j += 5)
	{
		solve(0, h-1, j, j+4, query(0, w-1, j, j+4), 1);
	}

	/*for(int i = 0; i < h; i += 5)
	{
		for(int j = 0; j < w; j += 5)
		{
			solve(i, i+4, j, j+4, query(i, i+4, j, j+4), 1);
		}
	}*/

	//solve(0, h-1, 0, w-1, n, 1);

	cout << "! " << ans << endl;
}

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

int main() {
  double a, b, c;
  cin >> a >> b >> c;
  double rad = c * acos(-1) / 180;
  double S = a * b * sin(rad) / 2;
  double L = sqrt(a * a + b * b - 2 * a * b * cos(rad)) + a + b;
  double h = 2 * S / a;
  cout << fixed << setprecision(8)
       << S << "\n" << L << "\n" << h << "\n";
}


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


int main() {
    int S, W;
    cin >> S >> W;

    if (W >= S) cout << "unsafe" << endl;
    else cout << "safe" << endl;

    return 0;
}



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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<"."
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<"."
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"."
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d<<"."
#define da(arr,N){if(isDebugMode){rep(i,N){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N){rep(j,M){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
int x;

void solve(){
	if(x==3||x==5||x==7) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

int main(){
	cin>>x;
	solve();
	return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<math.h>

int main(){
  int n,i,j,k,l=0;
  int a[10000];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    k=0;
    if(a[i]<2)continue;
    if(a[i]==2){
      l++;
      continue;
    }
    if(a[i]%2==0)continue;
    for(j=3;j<=sqrt(a[i]);j+=2)
      {
	if(a[i]%j==0){
	  k=1;
	  break;
      }
      }
	if(k==0)l++;
  }
  
  printf("%d\n",l);
}



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


int main(void) {
  string s;
  cin >> s;

  vector<int> v(26, 0);
  rep(i, s.length()) {
    v[s[i] - 'a']++;
  }

  bool ok = true;
  rep(i, v.size()) {
    if (v[i] > 1) ok = false;
  }

  if (ok) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long k = sc.NextLong();
        long s = sc.NextLong();

        List<long> answers = new List<long>();

        long count = 0;
        for (int i = 0; i < n; i++)
        {
            if (count == k)
            {
                if (s == 1000000000)
                {
                    answers.Add(1);
                }
                else
                {
                    answers.Add(1000000000);
                }
            }
            else
            {
                answers.Add(s);
                count++;
            }
        }

        Console.WriteLine(string.Join(" ", answers));
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for( int i = l; i <= r; i++ )
    {
        if( i % d == 0 ) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3628
#include <stdio.h>

int combination(int,int);

int n, A[20];

int main()
{
  int q, m[200], i;

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

int combination(int m, int i)
{
  if (m == 0)
    return 1;
  else if (i >= n)
    return 0;
  else
    return combination(m-A[i],i+1) || combination(m,i+1);
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
int main(){
int k,s,z;
cin>>k>>s;
int c=0;
for(int i=0;i<=k;i++){
for(int j=0;j<=k;j++){
	z=s-i-j; 
	if(s==(i+j+z))
if(z>=0&&z<=k)
c+=1;
}}
cout<<c;
return 0;
}

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

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<set<int>>obs(H+1);
    for (int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        obs[x].insert(y);
    }

    // 高橋君がx=iで詰んだら答えはi
    // 左から見ていって各xごとに移動可能なyの値を更新する
    int ans = -1;
    int yb = 1;
    for (int i = 1; i < H; ++i) {
        if(obs[i+1].size() == 0 || *obs[i+1].begin() > yb+1){
            yb++;
        } else if(*obs[i+1].begin() <= yb){
            ans = i;
            break;
        }
    }
    if(ans == -1) ans = H;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 18944
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, d;
  cin >> n >> d;
  Field(int) z(n, vector<int>(d));
  rep(i, 0, n) rep(j, 0, d) cin >> z[i][j];
  int ans = 0;
  rep(i, 0, n - 1) rep(j, i + 1, n) {
    int check = 0;
    rep(k, 0, d) check += (z[i][k] - z[j][k]) * (z[i][k] - z[j][k]);
    if (sqrt(check) == (int)sqrt(check)) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

int N, K;
bool S[200000];
int T; bool F; int H;

void output() {
  for(int i = 0; i < N; ++i) {
    cout << (S[(H + i) % N] != F ? 'A' : 'B');
  }
  cout << endl;
}
int main() {
  cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    char c; cin >> c; S[i] = c == 'A';
  }
  while(H != N) {
    if(S[H] != F) {
      S[H] = !S[H];
    } else {
      ++H; F = !F;
    }
    ++T;
    if(T == K) {
      output(); return 0;
    }
  }
  H = 0;
  if(N % 2 == 1 && (K - T) % 2 == 1) {
    S[H] = !S[H];
  }
  output();
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, w;
    while(cin >> n >> w, n){
        array<int, 15> v{};
        for (int i = 0; i < n; ++i) {
            int x; cin >> x;
            v[x/w]++;
        }
        int x = 0;
        for (int i = 0; i < 15; ++i) {
            if(v[i]) x = i;
        }
        x++;
        double ans = 0, y = *max_element(v.begin(),v.end());
        for (int i = 0; i < x; ++i) {
            ans += (double)v[i]/y*(x-i-1)/(x-1);
        }
        cout << setprecision(15) << ans+0.01 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3256
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
#from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N = In.int()

A = 1
summed = 0
N-=1
while N//A>0:
    amt = N//A
    summed+=amt
    A+=1

Out.int(summed)

######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 68124
import java.util.*;

public class Main{
    
    public static final int MOD = (int)1e9+7;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(a);
        
        Combination comb = new Combination((int)1e5*2, MOD);
        
        long ans = 0;
        for(int i=0; i<n-k+1; i++){
            long minc = comb.c(n-i-1, k-1);
            minc = (minc*a[i])%MOD;
            ans = ((ans+MOD)-minc)%MOD;
            
            long maxc = comb.c(i+(k-1), k-1);
            maxc = (maxc*a[i+(k-1)])%MOD;
            ans = (ans+maxc)%MOD;
        }
        
        System.out.println(ans);
        
    }
}

class Combination{
    int mod;
    long[] fact;
    long[] rfact;
    
    public Combination(int max, int mod){
        this.mod = mod;
        fact = new long[max];
        rfact = new long[max];
        fact[0] = 1;
        rfact[0] = 1;
        for(int i=1; i<max; i++){
            fact[i] = (fact[i-1]*i)%mod;
            rfact[i] = mod_inverse(fact[i], mod);
        }
    }
    
    public static long mod_pow(long x, long p, long m){
        long a = 1;
        while(p>0){
            if(p%2==1){
                a = a*x%m;
            }
            x = x*x%m;
            p /= 2;
        }
        return a;
    }
    
    public static long mod_inverse(long a, long m){
        return mod_pow(a, m-2, m);
    }
    
    public long p(int n, int r){
        if(r < 0 || n < r) return 0;
        return fact[n] * rfact[r]%mod;
    }
    
    public long c(int n, int r){
        if(r < 0 || n < r) return 0;
        return fact[n] * rfact[r]%mod * rfact[n-r]%mod;
    }
    
    public long h(int n, int r){
        if(n < 0 || r < 0) return 0;
        return r==0 ? 1 : c(n+r-1, r);
    }
}


Measured memory_bytes: 47472
import bisect


def solve():
    N = int(input())
    Ls = list(map(int, input().split()))
    Ls.sort()
    ans = 0
    for a_i in range(N):
        for b_i in range(a_i+1, N):
            c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
            if c_i > b_i:
                ans += c_i - b_i - 1
            else:
                pass
    print(ans)


if __name__ == "__main__":
    solve()


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

int main() {
  int N;
  cin >> N;
  vector<double> v(N);
  double ans = 0.0;
  for (int i=0; i<N; i++) {
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  double n2 = 0.5;
  for (int i=0; i<N; i++) {
    if (i == N-1) {
      ans += v[i] * n2 * 2;
    }
    else {
      ans += v[i] * n2;
    }
    n2 /= 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

/**
 * B
 */
public class Main {

    public void run() {

        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int[] A = new int[H+1];

        for(int i=1; i<=H; i++) {
            A[i] = sc.nextInt();
        }

        for(int i=H/2; i>=1; i--) {
            maxHeapify(A, i);
        }

        for(int i=1; i<=H; i++) {

            if (i == H) {
                System.out.println(" "+A[i]);
                break;
            }
            System.out.print(" "+A[i]);

        }


    }

    protected void maxHeapify(int[] A, int i) {

        int H = A.length-1;

        int l = left(i);
        int r = right(i);

        int largest;

        if(l<=H && A[l]>A[i]) {
            largest = l;
        } else {
            largest = i;
        }

        if(r<=H && A[r]>A[largest]) {
            largest = r;
        }

        if(largest != i) {

            int tmp = A[i];

            A[i] = A[largest];
            A[largest] = tmp;

            maxHeapify(A, largest);

        }
        
    }

    protected int left(int i) {

        int res = i*2;

        return res;
    }

    protected int right(int i) {

        int res = i*2+1;

        return res;
    }

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


Measured memory_bytes: 167204
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

vector<int> a, b, c;
void mainp()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        int aa;
        cin>>aa;
        a.push_back(aa);
    }
    for(int i=0; i<n; i++)
    {
        int aa;
        cin>>aa;
        b.push_back(aa);
    }
    for(int i=0; i<n; i++)
    {
        int aa;
        cin>>aa;
        c.push_back(aa);
    }
    
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());
    
    long long ret=0;
    for(int i=0; i<n; i++)
    {
        int l=0, r=n-1, ans=-1;
        
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<b[i])
            {
                ans=mid;
                l=mid+1;
            }
            else r=mid-1;
        }
        ans++;
        
        l=0, r=n-1;
        int ans2=n;
        
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(c[mid]>b[i])
            {
                ans2=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        
        ans2=n-ans2;
        
        ret+=ans*1ll*ans2;
    }
    
    cout<<ret<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mainp();
    return 0;
}

Measured memory_bytes: 1784
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iostream>
using namespace std;

int s[10]={0};
int main ()
{
	int n;
	scanf("%d",&n);
	int a = n % 10;
	n=n/10;
	int b= n%10;
	n/=10;
	int c=n%10;
	n/=10;
	int d=n%10;
	if(a==b && b==c && a==c) printf("Yes\n");
	else if(b==c && b==d && c==d) printf("Yes\n");
	else if(a==b && a==c && a==d && b==c && b==d && c==d) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n+n; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    while(v.size() > 0) {
        v.pop_back();
        ans += v.back();
        v.pop_back();
    }
    cout << ans << endl;

    return 0;
}



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

#define ll long long
#define PB push_back
#define PF push_front
#define L size
#define vi vector<int>
#define MOD 1000000007
#define mp make_pair
#define fi first
#define se second


using namespace std;
ll fib(int n);
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int cnt=0;
    while(n)
    {
        if(n%10==2)cnt++;
        n/=10;
    }
    cout << cnt;
    
}
ll fib(int n)
{
    vector<ll> a;
    a.PB(0);a.PB(1);
    for(int i=2;i<=n+1;i++)
       a.PB(a[i-1]+a[i-2]);
    return a.back();
}

Measured memory_bytes: 3660
/*
 * Atcoder Grand Contest 022
 * rank:A(300)
 */

#include <iostream>
#include <string>
using namespace std;

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

	const int max = 26;

	if(str.length() < max)
	{
		bool a[max] = {false};
		for(int i = 0; i < str.length(); i++) a[str[i]-'a'] = true;
		for(int i = 0; i < max; i++)
		{
			if(!a[i])
			{
				cout << str + (char)('a'+i) << endl;
				return 0;
			}
		}
	}

	bool flag = true;
	int num = 0;
	for(int i = max-1; flag && i > 0; i--)
	{
		if(str[i-1] < str[i])
		{
			flag = false;
			num = i;
		}
	}

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

	bool a[max] = {false};
	for(int i = num; i < max; i++) if(str[num-1] < str[i]) a[str[i]-'a'] = true;
	string q;
	for(int i = 0; i < max; i++)
	{
		if(a[i])
		{
			q = 'a'+i;
			i += max; // exit for
		}	
	}

	cout << str.substr(0, num-1) + q << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
    int c = a%500;
    if(b>=c){
      		System.out.println("Yes");
    }
    else{
		System.out.println("No");
  }
	}
}


Measured memory_bytes: 23124
import scala.io.StdIn._
import scala.math._

object Main extends App with StdInHelper {
  val Array(a, b, c, k) = readLongs

  var ans = 0L
  if (k >= a) {
    ans += a
  } else if (k < a) {
    ans += k
  }

  if (k - a - b >= 0) {
    ans -= k - a - b
  }

  println(ans)
}

trait StdInHelper {
  def readInts = readLine.split(" ").map(_.toInt)
  def readLongs = readLine.split(" ").map(_.toLong)
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int xor_all = a[n-1];
  rep(i, n-1) xor_all ^= a[i];

  rep(i, n) {
    cout << (xor_all ^ a[i]) << endl;
  }

  return 0;
}

/*
*/


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

using namespace std;

#define MOD 1000000007
template<int mod>
struct ModInt{
   int x;
   ModInt():x(0){}
   ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
   ModInt &operator+=(const ModInt &p){
       if((x+=p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator-=(const ModInt &p){
       if((x+=mod-p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator*=(const ModInt &p){
       x=(int)(1LL*x*p.x%mod);
       return *this;
   }
   ModInt &operator/=(const ModInt &p){
       *this*=p.inverse();
       return *this;
   }
   ModInt &operator^=(long long p){
       ModInt res = 1;
       for (; p; p >>= 1) {
           if (p & 1) res *= *this;
           *this *= *this;
       }
       return *this = res;
   }
   ModInt operator-()const{return ModInt(-x);}
   ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
   ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
   ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
   ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
   ModInt operator^(long long p)const{return ModInt(*this)^=p;}
   bool operator==(const ModInt &p)const{return x==p.x;}
   bool operator!=(const ModInt &p)const{return x!=p.x;}
   explicit operator int() const { return x; }
   ModInt operator=(const int p) {x = p; return ModInt(*this);}
   ModInt inverse()const{
       int a=x,b=mod,u=1,v=0,t;
       while(b>0){
           t=a/b;
           a-=t*b;
           std::swap(a,b);
           u-=t*v;
           std::swap(u,v);
       }
       return ModInt(u);
   }
   friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
       return os<<p.x;
   }
   friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
       long long x;
       is>>x;
       a=ModInt<mod>(x);
       return (is);
   }
};
typedef ModInt<MOD> mint;

using ll = mint;


int main()
{
    int n, k; cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    if(k == 0) {
        cout << 1 << endl;
        return 0;
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(k + 1)); //dp[i][j] := i人目までみた時にすでにj個使っているときの通り数
    for(int i = 0; i <= k; i++)dp[0][i] = 1;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= k; j++) {

            dp[i + 1][j] += dp[i][j] - (j - a[i] - 1 >= 0 ? dp[i][j - a[i] - 1] : 0);
            if(j != 0)dp[i + 1][j] += dp[i + 1][j - 1];

        }
    }

    cout << dp[n][k] - dp[n][k - 1] << endl;
}

Measured memory_bytes: 42888
/* C++標準ヘッダファイル */
/* 文字列ライブラリ */
#include <string>

/* コンテナライブラリ */
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>

/* アルゴリズムライブラリ */
#include <algorithm>

/* 数値演算ライブラリ */
#include <cmath>
#include <math.h>

/* 入出力ライブラリ */
#include <iostream>

/* std使用<-namespace */
using namespace std;

/* define */
#define rpt(i, n) for(ll i = 0; i < (n); i++)  // リピート
#define PI (acos(-1))  // 円周率pi

/* typedef */
// long long
typedef long long ll;

// pair
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<double, double> d_d;

/* main関数 */
int main(void) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; s[i] != '\0'; i++) {
		s[i] = (s[i] - 65 + n) % 26 + 65;
	}
	cout << s;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

const ll INF = 1e17;
ll N, M, L, Q;
ll fuel[305][305];
ll dist[305][305];
ll s[105000], t[105000];
ll A[100000], B[100000], C[100000];


int main() {
  cin >> N >> M >> L;
  for(int i = 1; i <= M; i++) cin >> A[i] >> B[i] >> C[i];
  cin >> Q;
  for(int i = 1; i <= Q; i++) cin >> s[i] >> t[i];

  for(int i = 1; i <= N; i++) {
      for(int j = 1; j <= N; j++) {
          fuel[i][j] = INF;
          dist[i][j] = INF;
      }
      fuel[i][i] = 0;
      dist[i][i] = 0;
  }
  for(int i = 1; i <= M; i++) {
      if(fuel[A[i]][B[i]]>C[i]){
        fuel[A[i]][B[i]]=C[i];
      }
      if(fuel[B[i]][A[i]]>C[i]){
        fuel[B[i]][A[i]]=C[i];
      }
  }
  for(int i = 1; i <= N; i++) {
      for(int j = 1; j <= N; j++) {
          for(int k = 1; k <= N; k++) {
              if(fuel[j][k]> fuel[j][i] + fuel[i][k]){
                fuel[j][k]= fuel[j][i] + fuel[i][k];
              }
          }
      }
  }
  for(int i = 1; i <= N; i++) {
      for(int j = 1; j <= N; j++) {
          if(i == j) continue;
          if(fuel[i][j] <= L) {
            if(dist[i][j]>1LL){
              dist[i][j]=1LL;
            }
          }
      }
  }
  for(int i = 1; i <= N; i++) {
      for(int j = 1; j <= N; j++) {
          for(int k = 1; k <= N; k++) {
            if(dist[j][k]> dist[j][i] + dist[i][k]){
              dist[j][k]=dist[j][i] + dist[i][k];
            }
          }
      }
  }
  for(int i = 1; i <= Q; i++) {
      if(dist[t[i]][s[i]] < INF) cout << dist[t[i]][s[i]] - 1 << "\n";
      else cout << -1 << "\n";
  }

  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; ++i) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  int tmp = d.at(0);
  int count = 1;
  for (int i = 1; i < N; ++i) {
    if (d.at(i) != tmp) count++;
    tmp = d.at(i);
  }
  cout << count << endl;

  return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
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 (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    string S;
    cin >> S;
    ll z = 0;
    REP(i, S.size()) if(S[i]=='0') z++;
    cout << 2*min(z, (int)S.size()-z) << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
int main()
{
	char a[5],b[5];
	scanf("%s%s",a,b);
	int x,y;
	x=strlen(a);
	y=strlen(b);
	int lose=0;
	if(x==y)
	{
		for(int i=0;i<x;i++)
			if(a[i]!=b[x-1-i])
				lose=1;
	}
	if(lose)
		printf("NO\n");
	else
		printf("YES\n");
	
	return 0;
 } 

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;

int main(){
    fastio;
    int n, m, x, sum = 0;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        cin >> x;
        sum += x;
    }
    n -= sum;
    if(n < 0) cout << "-1\n";
    else cout << n << "\n";
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

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

		
		String b = sc.next();

		if(b.equals("a")||b.equals("u")||b.equals("i")||b.equals("e")||b.equals("o")){
			System.out.println("vowel");
		}else{
			System.out.println("consonant");
		}

	}
}

Measured memory_bytes: 21716
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

int lower_bound_sub(vector<int>* a,int k,int min,int max){
  if(min > max){
    return a->size();
  }
  else{
    int mid = min + (max - min) / 2;
    if(a->at(mid) >= k && mid == 0){
      return mid;
    }
    else if(a->at(mid) >= k && a->at(mid-1) < k){
      return mid;
    }
    else if(a->at(mid) >= k){
      return lower_bound_sub(a,k,min,mid-1);
    }
    else {
      return lower_bound_sub(a,k,mid+1,max);
    }

  }

}

int lower_bound(vector<int>* a,int k){
  return lower_bound_sub(a,k,0,a->size()-1);
}

int main(){
  long ii,jj,kk,n,q;
  int k;
  vector<int> a;

  cin >> n;

  a.resize(n);

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

  cin >> q;
  int ret;
  for(ii=0;ii<q;ii++){
    cin >> k;
    //ret = lower_bound(&a,k);
    cout << lower_bound(&a,k) << endl;
  }
  
  //for(ii=0;ii<q;ii++){
  //  cin >> k;
  //  if(binSearch(&a,k)){
  //    cout << "1" << endl;
  //  }
  //  else{
  //    cout << "0" << endl;
  //  }
  //}
  
  return 0;
}



Measured memory_bytes: 3124
"use strict";

const main = (arg) => {
  const array = arg.trim().split("");
  const lastNumber = array[array.length - 1];
  if (lastNumber == 3) {
    console.log("bon");
  } else if (
    lastNumber == 0 ||
    lastNumber == 1 ||
    lastNumber == 6 ||
    lastNumber == 8
  ) {
    console.log("pon");
  } else {
    console.log("hon");
  }
};
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("183");
// https://atcoder.jp/contests/abc168/tasks/abc168_a


Measured memory_bytes: 29500
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long 
    #define ull unsigned long long 
    #define ld long double
    #define fi first
    #define se second
    #define pb push_back
    #define mp make_pair
    ll mod=1e9+7;
 
     ll a[200005];
       ll b[200005];
 
     ll idx[100005][2];
    // ll cnt[200005];
     ll pre[200005];
    // ll end[200005];
     map<ll,ll> m;
 
    bool comp(const pair<ll,ll>& a, const pair<ll,ll>& b){
      return (a.fi-a.se)>(b.fi-b.se);
    }
 
    bool revcomp(const pair<ll,ll>& a, const pair<ll,ll>& b){
      return (a.fi)>(b.fi);
    }
 
 
    ll ceil1(ll a, ll b){
      if(a%b!=0)return a/b+1;
      else return a/b;
    }
    ll power(ll a,ll b,ll n){ll ans=1;while(b>0){if(b%2==1)ans=(ans*a)%n;a=(a*a)%n;b/=2;}return ans;}
 
    ll count1=0;
 
 
    ll gcd(ll a, ll b){
      //if(a<b)swap(a,b);
      if(b==0)return a;
      return gcd(b,a%b);
    }
 
  ll primepos(ll fact, ll p) 
  { 
      ll res = 0; 
      while (fact > 0) {         
          res += fact / p; 
          fact /= p;  
      } 
    
      return res; 
  } 
 
  // void dfs(ll n, ll p){
  //   if(vis[n]!=0){
  //     return;
  //   }
  //   else{
  //     vis[n]=1;
  //     b[n]=p;
  //     for(int i=0;i<v[n].size();i++){
  //       dfs(v[n][i],p);
  //     }
  //   }
  // }

   int vis[200005];
   vector<int> v[200005];
   int max1[200005];

   int dfs(int n){
    if(vis[n]==0){
      vis[n]=1;
      int temp=0;
      for(int i=0;i<v[n].size();i++){
        temp=max(temp,dfs(v[n][i]));
      }
      max1[n]=1+temp;
      return 1+temp;
    }
    else{
      return max1[n];
    }
   }

   int main(){

      ios::sync_with_stdio(0);
      int n,m;
      cin>>n>>m;
      memset(vis,0,sizeof vis);
      memset(max1,0,sizeof max1);
      for(int i=0;i<m;i++){
        ll x,y;
        cin>>x>>y;
        v[x].push_back(y);
      }
      int ans=0;
      for(int i=1;i<=n;i++){
        ans=max(ans,dfs(i));
      }
      cout<<ans-1<<endl;
      return 0;
}

Measured memory_bytes: 13568
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <vector>

int main() {
  std::string s, t;
  std::cin >> s;
  std::cin >> t;
  std::vector<int > index_vec[26];
  for (int i=0; i<s.length(); i++){
    int value = int(s[i])-int('a');
    index_vec[value].push_back(i);
    //printf("push index_vec[%d] to %d\n", value, i);
  }
  long long ans = 0;
  int current_position = -1;
  for (int i=0; i<t.length(); i++){
    int value = int(t[i])-int('a');    
    if (index_vec[value].size()==0){
      printf("-1\n");
      return 0;
    }
    auto itr = std::upper_bound(index_vec[value].begin(), index_vec[value].end(), current_position);
    if (itr==index_vec[value].end()){
      ans += index_vec[value][0]+int(s.length())-current_position;
      current_position = index_vec[value][0];
    } else {
      //int index = itr-index_vec[value].begin();
      //ans +=  index_vec[value][index]-current_position;
      //current_position = index_vec[value][index];
      ans += *itr - current_position;
      current_position = *itr;
    }
    /*bool exist_current_set = false;
    for (int j=0; j<index_vec[value].size(); j++){
      if (current_position<index_vec[value][j]){
        exist_current_set = true;
        ans += index_vec[value][j]-current_position;
        //printf("ans+=%d-%d=%d\n", index_vec[value][j], current_position, index_vec[value][j]-current_position);
        current_position = index_vec[value][j];
        break;
      }
    }
    if (!exist_current_set){
      ans += index_vec[value][0]+int(s.length())-current_position;
      current_position = index_vec[value][0];
      }*/
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1148
#include<stdio.h>
#include<string.h>

int main()
{
	int i;
	char ch;
	int cnt[26]={0};
	
	while((ch = getchar()) != EOF){
		ch=tolower(ch);
		
		if(ch >='a' && ch <='z')
			cnt[ch - 'a']++;
	}
	
	for(i=0;i<26;i++)
	
		printf("%c : %d\n",'a'+i,cnt[i]);
		
		return 0;
}


Measured memory_bytes: 2044
#include <iostream>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

void route(int x1, int y1, int x2, int y2){
    if(y2 - y1 > 0)
        rep(i, y2 - y1) cout << "U";
    else
        rep(i, y1 - y2) cout << "D";
    if(x2 - x1 > 0)
        rep(i, x2 - x1) cout << "R";
    else
        rep(i, x1 - x2) cout << "L";
    return;
}

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    route(sx, sy, tx, ty);
    route(tx, ty, sx, sy);
    cout << "L";
    route(sx - 1, sy, tx, ty + 1);
    cout << "DR";
    route(tx + 1, ty, sx, sy - 1);
    cout << "U" << endl;

    return 0;
}

Measured memory_bytes: 256