akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, C;
    cin >> N >> C;
    vector<vector<ll>> D(C, vector<ll>(C)), c(N, vector<ll>(N));
    for (ll i = 0; i < C; i++) {
        for (ll j = 0; j < C; j++) {
            cin >> D[i][j];
        }
    }

    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            cin >> c[i][j];
            c[i][j]--;
        }
    }

    vector<vector<ll>> num(3, vector<ll>(C, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            num[(i + j) % 3][c[i][j]]++;
        }
    }

    ll ans = INT_MAX;
    for (int c1 = 0; c1 < C; c1++) {
        for (int c2 = 0; c2 < C; c2++) {
            if (c2 == c1) {
                continue;
            }
            for (int c3 = 0; c3 < C; c3++) {
                if (c3 == c1 || c3 == c2) {
                    continue;
                }

                ll tmp = 0;
                for (int cs = 0; cs < C; cs++) {
                    tmp += num[0][cs] * D[cs][c1];
                    tmp += num[1][cs] * D[cs][c2];
                    tmp += num[2][cs] * D[cs][c3];
                }
                ans = min(ans, tmp);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 2176
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    a = Input()
    sorted_a = sorted(a)
    point = max(a)//2
    center_index = len(a)//2
    right = sorted_a[center_index:]
    left = sorted_a[:center_index]
    print((point) - max(left) + min(right)-point)



main()

Measured memory_bytes: 20768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int N = Integer.parseInt(sc.next());
			long[] Square = new long[N];
			for(int i=0;i<N;i++) {
				Square[i] = Integer.parseInt(sc.next());
			}
			long count = 0;
			for(int i=0;i<=N-1;i++) {
				if(!(i%2==1)) {
					if((Square[i]%2==1)) {
						count++;
					}
				}
			}
			System.out.println(count);
		}	
	}
}


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

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


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

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

        int n = scan.nextInt();
        int k = scan.nextInt();
        int[] p = new int[n];

        Arrays.setAll(p, x -> scan.nextInt());
        Arrays.sort(p);

        int sum = 0;
        for (int x = 0; x < k; x++) {
            sum += p[x];
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 39076
#include <iostream>
#include <algorithm>
#include <string>
#include <typeinfo>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007
using namespace std;

int main(void){
	int n;
	cin>>n;
	rep(i,9){
		if(n<=(i+1)*111){
			cout<<(i+1)*111<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  
  ll sum = A[0];
  FOR(i,1,N){
    sum^=A[i];
  }

  REP(i,N){
    ll x = sum^A[i];
    if(i!=N-1){
      cout << x << " ";
    }else{
      cout << x;
    }
  }
  cout << endl;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
const int MOD = 2019;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int L, R;
    cin >> L >> R;
    int dist = R - L;
    L = L % MOD;
    R = R % MOD;
    if (L >= R) {
        cout << 0 << endl;
    }
    else if (dist > MOD) {
        cout << 0 << endl;;
    }
    else {
        int answer = 10e8;
        for (int i = L; i < R+1; i++) {
            for (int j = i+1; j < R+1; j++) {
                answer = min(answer, (i * j) % MOD);
            }
        }
        cout << answer << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 20:53:16 2019

@author: Yamazaki Kenichi
"""

N, K = map(int,input().split())
mod = 10**9+7

def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)

R = N - K
ans = []
for i in range(K):
    b = cmb(K-1,i,mod)
    r = cmb(R-i+i+1,i+1,mod)
    ans.append(b*r%mod)
for i in range(K):
    print(ans[i]%mod)



Measured memory_bytes: 3572
n = int(input())
a = list(map(int , input().strip().split()))
students = {}
ans = []

for i in range(len(a)):
  students[i] = a[i]
students= sorted(students.items(), key=lambda x:x[1])

for i in range(n):
  ans.append(str(students[i][0] + 1))

print(' '.join(ans))

Measured memory_bytes: 25536
a[200],b[200];
main(n,m,c,i){
  scanf("%d%d",&n,&m);
  for(i=0;i<2*n;i++)a[i]=i+1;
  for(;m;m--){
    scanf("%d",&c);
    if(!c)
      for(i=0;i<n;i++)
        b[2*i]=a[i],b[2*i+1]=a[n+i];
    else{
      for(i=0;i<c;i++)
        b[2*n-c+i]=a[i];
      for(;i<2*n;i++)
        b[i-c]=a[i];
    }
    memcpy(a,b,8*n);
  }
  for(i=0;i<2*n;i++)printf("%d\n",a[i]);
  exit(0);
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
const long long MOD = 1000000007;
typedef long long ll;

ll n;
string s,t;
ll a[100005],b[100005],c[100005];

int main() {
  cin >> n;
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll ans=0,sum=0; 
  rep(i,n){
    c[i]=a[i]-b[i];
    if(c[i]<0) ans++,sum+=c[i];
  }
  sort(c,c+n,greater<ll>());
  rep(i,n)if(c[i]>0 && sum<0) sum+=c[i], ans++;
  cout << (sum>=0 ? ans : -1) << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <tuple>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

struct BIND {int s, t, v; };

template<typename T> struct UnionFind {
   vector<T> data;
   UnionFind(T size):data(size){
      for(T i=0;i<size;i++) {
         data[i] = i;
      }
   }
   bool unite(T x, T y) {
      x = root(x); y = root(y);
      if (x != y) {
         data[y] = x;
      }
      return x != y;
   }
   bool same(T x, T y) {
      return root(x) == root(y);
   }
   bool sameall() {
      bool istrue = true;
      for (T i=0;i<data.size();i++) {
         istrue &= same(0, i);
      }
      return istrue;
   }

   T root(T x) {
      return (data[x] == x) ? x: data[x] = root(data[x]);
   }
};

int main() {
   int N, M;
   cin >> N >> M;
   vector<int> a(M), b(M);
   rep(i, M) {
      cin >> a[i] >> b[i];
      a[i]--;
      b[i]--;
   }

   int cnt = 0;
   rep(i, M) {
      UnionFind<int> uf(N);
      rep(j, M) {
         if (i == j) continue;
         uf.unite(a[j], b[j]);
      }
      cnt += !uf.sameall();
   }
   cout << cnt << endl;
}
/*
   vector<BIND> bs;
   rep(i, N) {
      bs.push_back((BIND){s[i], s[i+1], v[i]});
   }
   bs.push_back((BIND){0,0,0});
   bs.push_back((BIND){s[N],s[N],0});

   int prev_v = 0; int dist = 0;
   for (int u=2;u<=s[N];u+=2) {
      int minval = 10000000;
      rep(i, N+2) {
         BIND b = bs[i];
         if (u < b.s) {
            minval = min(minval, b.v + b.s - u);
         } else if (u > b.t) {
            minval = min(minval, b.v + u-b.t);
         } else {
            minval = min(minval, b.v);
         }
      }
      dist += prev_v + minval;
      prev_v = minval;
   }
   printf("%.91f\n", dist/16.0);*/

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

typedef long long ll;

ll gcd(ll n, ll m) {
	return n % m ? gcd(m, n % m) : m;
}
ll lcm(ll n, ll m) {
	return n * m / gcd(n, m);
}

int main() {
	int n;
	while(cin >> n, n) {
		vector<ll> d, v;
		for(int i = 0; i < n; i++) {
			ll a, b;
			cin >> a >> b;
			d.push_back(a);
			v.push_back(b);
		}

		vector<pair<ll,ll> > w;
		long long a = gcd(v[0]*d[1],v[1]*d[0]);
		w.push_back(pair<ll,ll>(d[1]*v[0] / a, d[0]*v[1] / a));
		for(int i = 2; i < n; i++) {
			a = gcd(d[i]*v[0], d[0]*v[i]);
			w.push_back(pair<ll,ll>(d[i]*v[0]/a, d[0]*v[i]/a));
		}

		ll l = 1;
		for(int i = 0; i < w.size(); i++) {
			l = lcm(l, w[i].first);
		}
		cout << l << endl;
		for(int i = 0; i < w.size(); i++) {
			cout << l / w[i].first * w[i].second << endl;
		}
	}
}

Measured memory_bytes: 1224
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    string S;
    cin >> S;
    string prev = "";
    string tmp = "";
    int res = 0;
    for(int i=0;i<S.size();i++){
        tmp = tmp + S[i];
        if(prev!=tmp){
            res++;
            prev = tmp;
            tmp = "";
        }
    }
    if(tmp.size()>1)res++;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int len;
char line[26];
void C(void){
    char temp=line[0];
    int i=1;
    while(line[i]){
        line[i-1]=line[i];
        i++;
    }
    line[i-1]=temp;
}
void J(void){
    int i=len-2;
    char temp=line[len-1];
    while(i!=-1){
        line[i+1]=line[i];
        i--;
    }
    line[0]=temp;
}
void E(void){
    int t=0,i;
    char temp1[14];
    for(i=0;i<len/2;i++)
        temp1[i]=line[i];
    temp1[i]=0;
    len%2?(i=len/2+1):(i=len/2);
    for(;line[i];i++){
        line[t++]=line[i];
    }
    len%2?(t++):(t=t);
    for(i=0;temp1[i];i++)
        line[t++]=temp1[i];
}
void A(void){
    int i,len1=len-1;
    char temp;
    for(i=0;i<len1;i++,len1--){
        temp=line[i];
        line[i]=line[len1];
        line[len1]=temp;
    }
}
void P(void){
    int i=0;
    while(line[i]){
        if(isdigit(line[i])){
            if(line[i] == '0')
                line[i]='9';
            else
                line[i]--;
        }
        i++;
    }
}
void M(void){
    int i=0;
    while(line[i]){
        if(isdigit(line[i])){
            if(line[i]=='9')
                line[i]='0';
            else
                line[i]++;
        }
        i++;
    }
}
int main(void){
    int num,i,o,len1;
    char ope[7];
    scanf("%d",&num);
    for(i=0;i<num;i++){
        scanf("%s %s",ope,line);
        len=strlen(line);
        len1=strlen(ope);
        for(o=len1-1;o>=0;o--){
            switch(ope[o]){
                case 'J':J();break;
                case 'C':C();break;
                case 'E':E();break;
                case 'A':A();break;
                case 'P':P();break;
                case 'M':M();break;
            }
        }
        puts(line);
    }
    return 0;
}

Measured memory_bytes: 580
A, B = map(int, input().split())


def floor_inv(x, f):
    res = int(x / f)
    if int(res * f) < x:
        res += 1
    return res


lb1 = floor_inv(A, 0.08)
ub1 = floor_inv(A + 1, 0.08)

lb2 = floor_inv(B, 0.10)
ub2 = floor_inv(B + 1, 0.10)

if ub1 <= lb2 or ub2 <= lb1:
    print(-1)
else:
    print(max(lb1, lb2))


Measured memory_bytes: 61924
// 解説前
#include <iostream>

// $i = N$のとき、$M_N = N - 1$が最大値 ⇒ $P_i = N - 1$
// $i = N - 1$のとき、$M_{N-1} = N - 2$が最大値 ⇒ $P_i = N - 2$
// ...
// $i = 2$のとき、$M_2 = 1$が最大値 ⇒ $P_i = 1$
// $i = 1$のとき、$M_1 = 0$が最大値 ⇒ 何でも良いが、消去法で$P_i = N$
// したがって、$\sum_{i=1}^N M_i = \sum_{i=1}^{N-1} i = \frac{1}{2} N (N - 1)$
int solve_D() {
  size_t N = 0;
  std::cin >> N;

  std::cout << (N * (N - 1) / 2);
  return 0;
}

int main() { return solve_D(); }


Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int x = b[i];
        auto pos_a = lower_bound(a.begin(), a.end(), x);
        auto pos_c = upper_bound(c.begin(), c.end(), x);
        long long cnt = distance(a.begin(), pos_a) * distance(pos_c, c.end());
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1916
readline = open(0).readline

N, W = map(int, readline().split())

R = []

for i in range(N):
    v, w = map(int, readline().split())
    R.append((v / w, v, w))

R.sort(reverse = 1)
ans = 0

for _, v, w, in R:
    c = min(w, W)
    W -= c
    ans += c * v / w

open(1, 'w').write("%.010f\n" % ans)


Measured memory_bytes: 22240
N, M = map(int, input().split())
B = [0] * M
for i in range(M):
  B[i] = list(map(int, input().split()))
  
B = sorted(B, key = lambda x:x[1])
remove = []
#print(B)
for i in range(M):
  a, b = B[i][0], B[i][1]
  if remove == []:
    remove.append(b - 1)
  elif max(remove) >= a:
    continue
  else:
    remove.append(b - 1)
  #print(remove)  
print(len(remove))    




Measured memory_bytes: 29352
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}


macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: String,
    }
    let ans = match s.as_str() {
        "SUN" => 7,
        "MON" => 6,
        "TUE" => 5,
        "WED" => 4,
        "THU" => 3,
        "FRI" => 2,
        "SAT" => 1,
        _     => -1,
    };
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include "stdio.h"

int N, M;
char letter[1000001] = {};
int num[1000001] = {};
int ans;

int main() {
	scanf("%d", &N);
	while (N != 0) {
		scanf("%d", &M);
		ans = 0;
		for (int i = 0; i < M; i++) {
			num[i] = 0;
		}
		scanf("%s", letter);
		for (int i = 0; i < M-2; i++) {
			if (letter[i] == 'I') {
				for (int j = 1; i + j < M; j++) {
					if (j % 2 == 1) {
						if (letter[i + j] != 'O')break;
					}
					else {
						if (letter[i + j] != 'I')break;
						num[i]++;
					}
				}
				if (num[i] > 0) {
					i += num[i] * 2;
				}
			}
		}
		for (int i = 0; i < M; i++) {
			if (num[i] >= N) {
				ans += num[i] - N + 1;
			}
		}
		printf("%d\n", ans);
		scanf("%d", &N);
	}
	return 0;
}

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

using namespace std;

int main() {
    int M,D; cin>>M>>D;

    int cnt=0;
    for (int m=1;m<=M;m++) {
        for (int d=10;d<=D;d++) {
            //cout << "m=" << m << ",d=" << d << endl;
            int d1=d%10;
            int d10=(d-d1)/10;
            if (d1>=2 && d10>=2 && m == d1*d10) {
                cnt++;
            }
        }
        
    }

    cout << cnt << endl;

    return 0;
}

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

#define x first
#define y second
#define PII pair<int,int>
#define LL long long
#define pb push_back
#define pqp priority_queue<PII,vector<PII>,greater<PII>>
#define pqi priority_queue<int,vector<int>,greater<int>>
#define PSS pair<string,string>

using namespace std;

const int N = 2e5+10;

int a[N];
vector<int> e[N];
int dist[N];
int book[N],book2[N];
int dx[]=  {0,-1,0,1,0,0},dy[]= {-1,0,1,0,0,0},dz[] = {0,0,0,0,-1,1};
int t;
int n,m, res;

void bfs()
{
    queue<int> q;
    q.push(1);
    dist[1] = 1;

    while(!q.empty())
    {
        int t = q.front(); q.pop();

        for(auto x : e[t])
        {
            if(dist[x] == 0)
            {
                dist[x] = t;
                q.push(x);
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    for(int i = 1 ; i <= m; i ++)
    {
        int a,b; cin >> a >> b;
        e[a].pb(b);
        e[b].pb(a);
    }

    bfs();

    for(int i = 2 ; i <= n;i ++)
    {
        if(!dist[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << "\n";
    for(int i = 2 ;i <= n; i ++) cout << dist[i] <<endl;

    return 0;

}


Measured memory_bytes: 12856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,d,c=0;
  cin>>n>>d;
  while(n--)
  {
    ll x,y;
    cin>>x>>y;
    if(sqrt((x*x)+(y*y))<=d)
      c++;
  }
  cout<<c;
}

Measured memory_bytes: 3636
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    
    int length = s.length();
    int halfLength = s.length()/2;
    int count = 0;
    for (int i=0; i<halfLength; i++) {
      if (s.charAt(i)!=s.charAt(length-(i+1))) {
        count ++ ;
      }
    }
    
    System.out.println(count);
  }
}


Measured memory_bytes: 23252
#!/usr/bin/env python

def main():
    A, B, C, K = map(int, input().split())
    tmp = min(K, A)
    K = K - min(K, A)
    if K == 0:
        print(tmp)
        exit()
    K = K - min(K, B)
    if K == 0:
        print(tmp)
        exit()
    print(A-K)

if __name__ == '__main__':
    main()



Measured memory_bytes: 9188
// https://atcoder.jp/contests/abc049/tasks/abc049_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  char c;
  string v = "aieou";

  cin >> c;

  string result = v.find(c) != string::npos ? "vowel" : "consonant";

  cout << result << "\n";

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] boss = new int[N];

        for(int i= 0 ; i < N-1 ; i++) {
            boss[sc.nextInt()-1]++;
        }
        for(int i = 0 ; i < N ; i++) {
            System.out.println(boss[i]);
        }
    }
}


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

int main() {
  int X, ans = 0;
  cin >> X;
  for(int i = 1; i <= floor(sqrt(X)); i++) {
    for(int j = 1; j <= 10; j++){
      int n = pow(i, j);
      if(n <= X && n > ans) {
        ans = n;
      }
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) ((a+b-1)/(b))
using namespace std;

const int MAX = 200000;
const int MOD = 1000000007;
const int INF = 1e8;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;

// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
//

int logv[MAX+1];
void make_log() {
    logv[1] = 0; // pre-computar tabela de log
    for (int i = 2; i <= MAX; i++)
        logv[i] = logv[i/2] + 1;
}

struct Sparse {
    int n;
    vector<vector<int>> st;

    Sparse(int n, vi array) {
        this->n = n;
        int k = logv[n];
        st.assign(n+1, vector<int>(k+1, 0));

        for (int i = 0; i < n; i++)
            st[i][0] = array[i];

        for (int j = 1; j <= k; j++)
            for (int i = 0; i + (1 << j) <= n; i++)
                st[i][j] = f(st[i][j-1], st[i + (1 << (j - 1))][j - 1]);
    }

    int f(int a, int b) {
        return __gcd(a, b);
    }

    int query(int L, int R) {
        if(L > R or L < 0 or R >= n) return 0;
        int j = logv[R - L + 1];
        int res = f(st[L][j], st[R - (1 << j) + 1][j]);
        return res;
    }
};

int main() {
    int n;
    cin >> n;

    make_log();

    vi v(n);
    forn(i, n)
        cin >> v[i];

    if(n == 1) {
        cout << v[0] << endl;
    }
    else if(n == 2) {
        cout << max(v[0], v[1]) << endl;
    }
    else {
        Sparse st = Sparse(n, v);

        int val = 0, res = 0;
        for(int i = 0; i < n; i++) {
            if(st.query(0, i-1) or st.query(i+1, n-1)) {
                val = __gcd(st.query(0, i-1), st.query(i+1, n-1));
                res = max(res, val);
            }
        }

        cout << res << endl;
    }


    return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
  
int main(){
  int a,b,c,k;
  int ans=0;
  cin>>a>>b>>c>>k;
  Rep(i,k){
    if(a>0){
      ans++;
      a--;
      continue;
    }
    if(b>0){
      b--;
      continue;
    }
    if(c>0){
      ans--;
      c--;
      continue;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
#define pii pair<ll, vector<ll>>
const double pi = acos(-1);
ll n;
double e = 0.000001;
int cuts;
bool bs(double maxi, vector<int>&a) {
	int k = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] <= maxi) continue;
		int d = a[i] / maxi;
		if(abs((double)a[i] - (double)d*maxi) <= e) {
			k += d - 1;
		}
		else {
			k += d;
		}
	}
	return k <= cuts;
}
int solve() {
	cin>>n>>cuts;
	vector<int>a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	double l = 0, r = 10e9;
	while(abs(r-l) >= e) {
		double mid = (r - l)/2 + l;
		//cout<<l<<' '<<r<<' '<<mid<<endl;
		if(bs(mid, a)) {
			r = mid;
		}	
		else l = mid;
	}
	return ceil(l);
}
int main() {
	io
	int t = 1;
	//cin>>t;
	while(t--) {
		cout<<solve()<<endl;
	}
}






Measured memory_bytes: 3972
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const long long maxn=200000+10;
long long vis[maxn],n,a[maxn];
int main()
{
	cin>>n;
	long long maxx=0;
	for(long long i=1;i<=n;i++)
	{
		cin>>a[i];
		vis[a[i]]++;
		maxx=max(maxx,a[i]);
	}
	long long ans=0;
	for(long long i=1;i<=maxx;i++)
	{
		if(vis[i]>=2)
		{
			ans=ans+vis[i]*(vis[i]-1)/2;
		}
	}
	for(long long i=1;i<=n;i++)
	{
		if(vis[a[i]]<=1)
		{
			cout<<ans<<endl;
			continue;
		}
		long long Ans=ans-(vis[a[i]]-1);
		cout<<Ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define dbg(x) cerr<<#x" = "<<x<<endl
#define rep(i,a,b) for(register int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(register int i=(a),i##_st=(b);i>=i##_st;--i)
#define rpg(i,x) for(register int i=fir[x];i;i=e[i].nxt)
#define ull unsigned long long
#define fi first
#define se second
#define pb push_back
#define bin(i) (1<<i)
#define cls(x,y) memset(x,y,sizeof x)
typedef pair<int,int> pa;
typedef long long LL;
const int INF = 0x7fffffff;
const int oo = 0x3f3f3f3f;
inline char nc()
{
    static char buf[100000],*p1=buf,*p2=buf;
    if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
    return *p1++;
}
//#define  getchar() nc()
template <typename T>
inline void rd(T &x)
{
    x = 0; int f = 1; char CH = getchar();
    while(CH<'0'||CH>'9') {if(CH=='-')f=0;CH=getchar();}
    while(CH>='0'&&CH<='9') {x=(x<<3)+(x<<1)+(CH-48);CH=getchar();}
    return;
}
const int N = 200020;
int a[N],n,k,cnt,book[N],vcnt,ans,fuck[N]; 
int main()
{
	rd(n),rd(k);
	rep(i,1,n) {
		rd(a[i]); 
		if(!book[a[i]]) cnt++;
		book[a[i]]++;
	}
	int t=cnt-k;
	if(t<=0) return printf("%d\n",ans),0;
	rep(i,1,N) if(book[i]) fuck[++vcnt]=book[i];
	sort(fuck+1,fuck+vcnt);
	rep(i,1,t) ans+=fuck[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
int main(void){
    int k,s;
    scanf("%d%d",&k,&s);
    int count = 0;
    for(int i=0;i<k+1;i++)
    {
        for(int j=0;j<k+1;j++)
        {
            if(0<=s-i-j && s-i-j<=k)
            {
                count++;
            }
        }
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128
n, a, b = map(int, input().split())
if a%2==b%2:
    print((b-a)//2); exit()
ans1 = 0
c = a
aa = 1
bb = b-a
ans1 = c
if aa!=bb:
    ans1 += (bb-aa)//2
ans2 = 0
c = n-b+1
bb = n
aa = a+c
ans2 = c
if aa!=bb:
    ans2 += (bb-aa)//2
print(min(ans1, ans2))

Measured memory_bytes: 3064
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.StringTokenizer;

public class Main {
    private static void solve() throws Exception {
       int n = fs.nextInt();
       int[] A = fs.readArray(n);
       int cur = A[0];
       long ans = 0;
       for (int i = 1; i < n; i ++ ) {
           ans += Math.max(cur-A[i],0);
           cur = Math.max(cur, A[i]);
       }
       out.println(ans);
    }

    private static FastScanner fs = new FastScanner();
    private static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws Exception {
        int T = 1;
        for (int t = 0; t < T; t++) {
            solve();
        }
        out.close();
    }

    static void debug(Object... O) {
        System.err.print("DEBUG ");
        System.err.println(Arrays.deepToString(O));
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

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

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

        String nextString() {
            return next();
        }
    }
}


Measured memory_bytes: 55628
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
const int mxN=2e5;
int n, m;
ll k, a[mxN+1], b[mxN+1];
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
 
	cin >> n >> m >> k;
	for(int i=0; i<n; ++i) {
		cin >> a[i+1];
		a[i+1]+=a[i];
	}
	for(int i=0; i<m; ++i) {
		cin >> b[i+1];
		b[i+1]+=b[i];
	}
	int ans=0;
	for(int i=0, j=m; i<=n; ++i) {
		if(a[i]>k)
			break;
		while(a[i]+b[j]>k)
			--j;
		ans=max(i+j, ans);
	}
	cout << ans;
}

Measured memory_bytes: 6660
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

struct Point {
	long long x, y;
	int count;
	int pos;
};

Point pts[200010];
int n;

bool compare(Point &a, Point &b) {
	return a.x < b.x;
}

bool comparePos(Point &a, Point &b) {
	return a.pos < b.pos;
}

bool isUsed[200010];

int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++) {
		scanf("%lld%lld", &(pts[i].x), &(pts[i].y));
		pts[i].count = 0;
		pts[i].pos = i;
	}
	
	sort(pts, pts + n, compare);
	memset(isUsed, false, sizeof(isUsed));
	
	int minY;
	int maxY = n;
	int l = 0;
	int h = 0;
	int sz;
	while (l < n) {
		h = l;
		minY = pts[l].y;
		
		while (h < n) {
			if (pts[h].y < minY) {
				minY = pts[h].y;
			}
			
			if (pts[h].y >= maxY) {
				break;
			}
			h++;
		}
		
		sz = h - l + 1;
		int dist = (maxY - minY) + 1;
		while (dist > sz) {
			h++;
			sz++;
			if (pts[h].y < minY) {
				minY = pts[h].y;
			}
			dist = (maxY - minY) + 1;
		}
		
		
		if (h >= n) {
			h--;
		}
		
		
		
		for (int p = l ; p <= h ; p++) {
			pts[p].count = sz;
			isUsed[pts[p].y] = true;
		}
		
		while (isUsed[maxY] == true) {
			maxY--;
		}
		
		l = h + 1;
	}
	
	sort(pts, pts + n, comparePos);
	
	for (int i = 0 ; i < n ; i++) {
		printf("%d\n", pts[i].count);
	}
	

	return 0;
}


Measured memory_bytes: 6620
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    ll K, A, B; cin >> K >> A >> B;
    if(K < A){
    	cout << K << endl;
    	return 0;
    }

    ll res = A;
    K -= (A - 1);
    if(K % 2 == 1) res++, K--;

    res += max(K, (B - A) * K / 2);

    cout << res << endl;

    return 0;
}


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

int N;
int dp[101010][3];

int main(){
    cin >> N;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j < 3; j++){
            int a;
            cin >> a;
            for(int k = 0; k < 3; k++){
                if(j == k)continue;
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + a);
            }
        }
    }
    cout << max(max(dp[N][0], dp[N][1]), dp[N][2]) << endl;
    return 0;
}


Measured memory_bytes: 1408
import itertools
import math
import fractions
import functools
import copy

n = int(input())
a = list(map(int, input().split()))

pm = [0,0]

for i in range(n):
    if a[i] == 0:
        print(sum(list(map(abs,a))))
        quit()
    elif a[i] > 0:
        pm[0] += 1
    else:
        pm[1] += 1
if pm[1] % 2 != 0:
    print(sum(list(map(abs,a))) - 2 * min(list(map(abs,a))))
else:
    print(sum(list(map(abs,a))))

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

typedef pair<int,int> ii;

const int MAXN = 1002;

queue<int> fila[MAXN];
vector<int> proximo;
set<ii> pares;
int N, D;

ii get_pair(int i){
	int j = fila[i].front();
	return ii(min(i, j), max(i, j));
}

int main(){

	scanf("%d", &N);
	for(int i = 1;i<=N;i++){
		for(int j = 1;j<N;j++){
			int k;
			scanf("%d", &k);
			fila[i].push(k);
		}
		proximo.push_back(i);
	}

	while(true){

		vector<int> ainda_depois;

		for(int i : proximo){
			if(fila[i].empty()) continue;
			ii meu_par = get_pair(i);

			if(pares.count(meu_par)){
				pares.erase(meu_par);
				ainda_depois.push_back(meu_par.first);
				ainda_depois.push_back(meu_par.second);
			}
			else{
				pares.insert(meu_par);
			}

		}

		if(ainda_depois.empty()) break;

		for(int i : ainda_depois){
			fila[i].pop();
		}

		D++;
		swap(proximo, ainda_depois);

	}

	for(int i = 1;i<=N;i++) if(!fila[i].empty()) D = -1;

	printf("%d\n", D);

	return 0;

}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define reQv(a) reverse(all(a)
#define ld long double
const ll mod=1e9+7;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
int main() {
    IOS;
    ll k,n;
    cin >> k >> n;
    ll a[n];
    ll sum=0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum+=a[i];
    }
    if(k<sum) cout <<-1 << endl;
    else cout << k-sum << endl;
	return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
const int M = 200005;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
using namespace std ;
const int N =  50  ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
int main (){
  vector<string> a ( { } )  ;
 string s  ;
  cin >> s ;

 if (s.compare ("Sunny") == 0  )
    cout << "Cloudy" ;
else  if ( s.compare ( "Cloudy") == 0 )
cout << "Rainy" ;
else
    cout << "Sunny";

return 0 ;

}


Measured memory_bytes: 256
f=(r=(0...n=gets.to_i)).map{(gets.split*'').to_i 2}
q=r.map{gets.split.map &:to_i}
p (1..1023).map{|b|
    eval r.map{|i|q[i][(b&f[i]).to_s(2).count ?1]}*?+
}.max

Measured memory_bytes: 2556
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=200000;
const int MAXQ=200000;

int n,nq;
int a[MAXN];

int cnt[MAXN+1];
int cov[MAXN],sumcov;

void inc(int x) {
	++cnt[x];
	int idx=x-cnt[x];
	if(idx>=0&&++cov[idx]==1) ++sumcov;
}
void dec(int x) {
	int idx=x-cnt[x];
	if(idx>=0&&--cov[idx]==0) --sumcov;
	--cnt[x];
}

void run() {
	scanf("%d%d",&n,&nq);
	REP(i,n) scanf("%d",&a[i]);

	FORE(i,1,n) cnt[i]=0; REP(i,n) cov[i]=0; sumcov=0;
	REP(i,n) inc(a[i]);

	REP(i,nq) {
		int idx,val; scanf("%d%d",&idx,&val); --idx;
		dec(a[idx]); a[idx]=val; inc(a[idx]);
		printf("%d\n",n-sumcov);
	}
}

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


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

void Main() {
  Cin(int, n, m, c);

  vector<int> b(m);
  for (auto& e : b) cin >> e;

  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  }

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int correct = 0;
    for (int j = 0; j < m; ++j) correct += a[i][j] * b[j];
    correct += c;
    if (correct > 0) ans++;
  }
  cout << ans << endl;
  return;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
 

class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int A = sc.nextInt();
       int B = sc.nextInt();
       int C = sc.nextInt();
       String ans="No";
       
       if(A==B) {
    	   if(A!=C) {
    		   ans="Yes";
    	   }
       }
       if(C==B) {
    	   if(A!=C) {
    		   ans="Yes";
    	   }
       }
       if(C==A) {
    	   if(A!=B) {
    		   ans="Yes";
    	   }
       }
       
       
       System.out.println(ans); 	
              		
   }

}

Measured memory_bytes: 23764
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    char s[5];
    scanf("%s",s);
    if(s[0]!=s[1]&&s[1]!=s[2]&&s[2]!=s[3])
    printf("Good");
    else{printf("Bad");}
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    rep(i,x) cin >> a[i];
    rep(i,y) cin >> b[i];
    rep(i,z) cin >> c[i];

    sort(all(a)); sort(all(b)); sort(all(c));

    ll l,r;
    l = 0;      // ok
    r = LINF;   // ng
    while(r-l>1){
        ll m = (l+r)/2; // m 以上の個数

        ll sum = 0;
        rep(i,x){
            rep(j,y){
                ll rem = m - a[i] - b[j];
                int idx = lower_bound(all(c), rem) - c.begin();
                ll cnt = z - idx;
                sum += cnt;
            }
        }

        if(sum >= k){
            l = m;
        }else{
            r = m;
        }
    }

    vector<ll> ans;
    rep(i,x){
        rep(j,y){
            ll rem = l - a[i] - b[j];
            int idx = lower_bound(all(c), rem) - c.begin();
            for(int k=idx;k<z;k++){
                ans.emplace_back(a[i]+b[j]+c[k]);
            }
        }
    }
    sort(all(ans));
    reverse(all(ans));
    for(int i=0;i<k;i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 134476
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W = map(int, input().split())
    maze = [[_ for _ in input()] for _ in range(W)]
    INF = 10 ** 5
    # dp[i][j]:=(i,j)に到達するまでに黒壁を壊す回数の最小値
    dp = [[INF] * W for _ in range(H)]

    if maze[0][0] == '#':
        dp[0][0] = 1
    else:
        dp[0][0] = 0

    for i in range(H):
        for j in range(W):
            for [dy, dx] in [[1, 0], [0, 1]]:
                ny, nx = i + dy, j + dx
                if ny >= H or nx >= W:
                    continue
                else:
                    if maze[i][j] == '.' and maze[ny][nx] == '#':
                        dp[ny][nx] = min(dp[ny][nx], dp[i][j] + 1)
                    else:
                        dp[ny][nx] = min(dp[ny][nx], dp[i][j])
    print(dp[H - 1][W - 1])


resolve()

Measured memory_bytes: 41712
<?php
# B - Ordinary Number

fscanf(STDIN, "%d", $N);
$array = explode(' ', fgets(STDIN));
for ($i=0;$i<$N;$i++) {
    $array[$i] = intval($array[$i]);
}

$count = 0;
for ( $i = 1; $i < $N - 1; $i++ ) {
    if ($array[$i-1] < $array[$i] && $array[$i] < $array[$i+1]) {
        $count++;
    } elseif ($array[$i-1] > $array[$i] && $array[$i] > $array[$i+1]) {
        $count++;
    } elseif ($array[$i-1] == $array[$i] && $array[$i+1] > $array[$i]) {
        $count++;
    } elseif ($array[$i+1] == $array[$i] && $array[$i-1] > $array[$i]) {
        $count++;
    } 
}

echo $count . PHP_EOL;


Measured memory_bytes: 4604
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');

            int N = int.Parse(s1[0]);
            int Q = int.Parse(s1[1]);

            string s = Console.ReadLine();

            char[] c = s.ToCharArray();

            int[] ans = new int[Q];
            System.Collections.ArrayList array = new System.Collections.ArrayList();


            for (int i =0;i<c.Length-1;i++)
            {
                if(c[i] == 'A' && c[i+1] == 'C')
                {
                    array.Add(i+1);
                }
            }

            if(array.Count == 0)
            {
                for (int i = 0; i < Q; i++)
                    Console.WriteLine("0");
                return;
            }

            for(int i=0;i<Q;i++)
            {
                string[] s2 = Console.ReadLine().Split(' ');
                int Start = int.Parse(s2[0]);
                int End = int.Parse(s2[1]);
                ans[i] = search(array, End-1) - search(array, Start-1);
            }

            for(int i=0;i<Q;i++)
                Console.WriteLine(ans[i].ToString());
        }

        private static int search(System.Collections.ArrayList array, int value)
        {
            int mid;
            int Start = 0;
            int End = array.Count - 1;

            if (value < (int)array[Start] )
                return 0;
            if ((int)array[Start] == value)
                return 1;
            if ((int)array[End] <= value)
                return array.Count;

            while (true)
            {
                mid = Start + (End - Start) / 2;

                if(value < (int)array[mid])
                {
                    if ((int)array[mid - 1] < value)
                        return mid;
                    End = mid;
                }
                else if((int)array[mid] < value)
                {
                    if (value < (int)array[mid + 1])
                        return mid + 1;
                    Start = mid;
                }
                else
                {
                    return mid + 1;
                }
            }

        }
    }
}


Measured memory_bytes: 22848