akhauriyash/Code-Regression huggingface dataset:
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,K;
LL x[100000];

LL ans = INF;

void solve(){
    //それぞれ座標0から見て、正の方向と負の方向にあるろうそくを格納
    //ただし0は正とみなす
    vector<LL> positive,negative;
    for(int i=0;i<N;i++){
        if(x[i]<0) negative.push_back(-x[i]);
        else positive.push_back(x[i]);
    }
    reverse(negative.begin(),negative.end());

    //正の方向に行ったっきりな場合
    if(positive.size()>=K) ans = positive[K-1];
    //負の方向に行ったっきりな場合
    if(negative.size()>=K) ans = min(ans,negative[K-1]);

    if(positive.size()==0 || negative.size()==0 || K==1) return;

    LL p = min(K,(LL)positive.size());//正の方向にある、調べる予定のろうそくの数
    LL n = K-p;//負の方向にある、調べる予定のろうそくの数

    while(1){
        if(p<=0 || n>negative.size()) break;
        //正の方向に行ってから負の方向に引き返す場合
        ans = min(ans,positive[p-1]*2 + negative[n-1]);
        //負の方向に行ってから正の方向に引き返す場合
        ans = min(ans,negative[n-1]*2 + positive[p-1]);
        p--;
        n++;
    }
}

int main(){
    cin >> N >> K;
    for(int i=0;i<N;i++){
        cin >> x[i];
    }
 
    solve();

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

Measured memory_bytes: 2424
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
const int maxn=3e3+5,mo=1e9+7;
int i,j,n,a,b,m,ri[maxn];
int sum[maxn],f[maxn][maxn];
char s[maxn];
void mod(int &x){
	x-=(x>=mo)?mo:0;
}
int main(){
	scanf("%d%d",&n,&m);
	scanf("%s",s+1);
	fo(i,1,n) sum[i]=sum[i-1]+(s[i]=='1'),ri[i]=i;
	fo(i,1,m){
		scanf("%d%d",&a,&b);
		ri[a]=max(ri[a],b);
	}
	fo(i,1,n) ri[i]=max(ri[i-1],ri[i]);
	f[1][sum[ri[1]]]=1,ri[n+1]=n;
	fo(i,1,n){
		int ad=sum[ri[i+1]]-sum[ri[i]];
		fo(j,0,n-i+1) if (f[i][j]){
			int s=f[i][j];
			if (j)mod(f[i+1][j-1+ad]+=s);
			if (ri[i]-i+1>j)mod(f[i+1][j+ad]+=s);
		}
	}
	printf("%d\n",f[n+1][0]);
}

Measured memory_bytes: 33920
def main():
    from string import ascii_lowercase

    N = int(input())

    def rec(n):
        if n == 0: return ''
        n -= 1
        n, r = divmod(n, 26)
        return rec(n) + ascii_lowercase[r]

    print(rec(N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9888
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

struct restraunt{
    std::string name;
    int score;
    int num;
};

int main(){
    using namespace std;
    int n;
    cin >> n;
    vector<struct restraunt> s;
    for(int i=0; i<n; i++){
        struct restraunt tmp;
        cin >> tmp.name >> tmp.score;
        tmp.num = i+1;
        s.push_back(tmp);
    }

    sort(s.begin(),s.end(),[](const restraunt &a, const restraunt &b){ 
            return (a.name < b.name) ||
            (a.name == b.name && a.score > b.score) ;});
    
    for(int i=0; i<n; i++){
        cout << s[i].num << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_limit=(n); i<i##_limit; ++i)
#define FOR(i, a, b) for (int i=(a), i##_limit=(b); i<i##_limit; ++i)
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    int H[N];
    REP(i, N) cin >> H[i];

    int ret[N];
    ret[0] = 0;
    ret[1] = abs(H[1]-H[0]);

    FOR(i, 2, N)
        ret[i] = min(abs(H[i]-H[i-1])+ret[i-1], abs(H[i]-H[i-2])+ret[i-2]);

    cout << ret[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
int main()
{
	ll x,t;
	scanf("%lld%lld",&x,&t);
	if(t>=x) cout<<"0"<<endl;
	else cout<<x-t<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
using B = bitset<60>;

long solve(){
  long a,b;
  cin>>a>>b;
// dbg(B(a));
// dbg(B(b));

  if(a==b) return 1;

  int p = 60;
  while(p>0 && (a>>p)==(b>>p)) p--;

  if(p==0) return 2;

  long ret = 0;

  long ma = a & ((1L<<p) - 1);
  ret += (1L<<p) - ma; // [A] ~ ..0111111

  long mb = b & ((1L<<p) - 1);

  int np = p-1;
  while(np>0 && ((b>>np)&1)==0) np--;
  mb |= (1L<<np)-1;

  if(mb >= ma) ret += (1L<<p);
  else {
    ret += mb + 1;
    ret += (1L<<p) - ma;
  }
// dbg(B(ma));dbg(B(mb));dbg(B(ret));
  return ret;
}

int main(){
  cout << solve() << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 INF = 1LL << 60;
int N;
long long h[100010];

long long dp[100010];
int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];
    for (int i = 0; i < 100010; ++i) dp[i] = INF;
    dp[0] = 0;
    for (int i = 0; i < N-1; ++i) {
        chmin(dp[i+1], dp[i] + abs(h[i] - h[i + 1]));
        chmin(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    }
    cout << dp[N-1] << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<string> blue(N);
  for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
  }
  int M;
  cin >> M;
  vector<string> red(M);
  for (int i = 0; i < M; i++) {
    cin >> red.at(i);
  }
  int ben = 0;
  for (int i = 0; i < N; i++) {
    string x = blue.at(i);
    int ben_at_x = 0;
    for (int j = 0; j < N; j++) {
      if (blue.at(j) == x) {
        ben_at_x++;
      }
    }
    for (int j = 0; j < M; j++) {
      if (red.at(j) == x) {
        ben_at_x--;
      }
    }
  ben = max(ben, ben_at_x);
  }
  cout << ben << endl;
}


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

int main () {

  int n, ans; cin >> n;
  vector<int>a(n);
  for (int i=0; i<n; i++) {
     cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i=0; i<n; i++) {
    if (a[i] == a[i+1]) 
    {
      cout << "NO" << endl;
      return 0;
    }
  }
    cout << "YES" << endl;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        int t = 1;
        while (t --> 0) solver.solve(1, scan, out);
        out.close();
    }

    static class Task {

        public void solve(int testNumber, FastReader scan, PrintWriter out) {
            int n = scan.nextInt();
            int curr = 1;
            for(int i = 0; i < n; i++) {
                if(scan.nextInt() == curr) curr++;
            }
            out.print(curr == 1 ? -1 : n-curr+1);
        }
    }

    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

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

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 43388
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c,n;
	cin>>a>>b>>c>>n;
	for(int i=0;i<=n;i++){
		for(int j=0;i+j<=n;j++){
			for(int k=0;i+j+k<=n;k++){
				if((c<<i)>(b<<j)&&(b<<j)>(a<<k))return puts("Yes"),0;
			}
		}
	}
	puts("No");
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long 
using namespace std;
const int HA=998244353;
const int N = 1e5 + 10;
int n , maxs = -1;
int buck[N];
inline int ksm ( int x , int y ) {
	int res = 1;
	while ( y ) {
		if ( y & 1 ) 
			res = ( x * res ) % HA;
		x = ( x * x ) % HA;
		y >>= 1; 
	}
	return res % HA;
}
signed main ( void ) {
	ios :: sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if ( i == 1 && x != 0 ) 
			return puts ( "0" ) , 0;
		if ( i != 1 && x == 0 ) 
			return puts ( "0" ) , 0;
		buck[x]++;
		maxs = max ( maxs , x );
	}
	int rec = 1;
	for ( int i = 0 ; i < maxs ; i++ ) 
		rec = ( rec * ksm ( buck[i] , buck[i + 1] ) ) %HA;
	printf ( "%lld\n" , rec );
	return 0;
} 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
vector<string>s;
int n;
string t,ans;
main(){
	while(cin>>n,n){
		set<string>ss;
		ans="zzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
		int p=0;
		vector<int>v;
		s.clear();
		r(i,n){
			cin>>t;
			if(!ss.count(t)){
				s.push_back(t);
				ss.insert(t);
			}
		}
		r(i,s.size())r(j,s.size())if(i!=j&&s[i].size()>=s[j].size()){
			r(k,s[i].size()){
				int sum=0;
				if(k+s[j].size()<=s[i].size()){
				for(int l=k;l-k<s[j].size();l++)
					if(s[i][l]==s[j][l-k])sum++;
				if(sum==s[j].size()){
					v.push_back(j);
					break;
				}
			}}
		}
		sort(v.begin(),v.end());
		v.erase(unique(v.begin(),v.end()),v.end());
		r(i,v.size()){
			s.erase(s.begin()+v[i]+p);
			p--;n--;
		}
		sort(s.begin(),s.end());
		do{
			t="";
			t+=s[0];
			for(int i=1;i<s.size();i++){
				int sum=0;
				for(int j=s[i-1].size()-1;j>=0;j--){
					int sum2=0,cnt=0;
					for(int k=0;;k++){
						if(k+j>=s[i-1].size())break;
						if(s[i][k]==s[i-1][j+k])sum2++;
						else goto L;
					}
					if(!cnt)sum=max(sum,sum2);L:;
				}
				t+=s[i].substr(sum);
			}
			if(ans.size()>t.size())ans=t;
			else if(ans.size()==t.size()) ans=min(ans,t);
		}while(next_permutation(s.begin(),s.end()));
		cout<<ans<<endl;
	}
}

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

using namespace std;


int a,b,c;

typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<double> vdb;
typedef vector<bool> vbol;
typedef vector<string> vstr;

#define vvll(a,b,c) vector<vector<long long>> c(a,vector<long long>(b,0))
#define vvit(a,b,c) vector<vector<int>> c(a,vector<int>(b,0))
#define vvstr(a,b,c) vector<vector<string>> c(a,vector<string>(b,0))
#define vvbol(a,b,c) vector<vector<bool>> c(a,vector<bool>(b,0))
#define vvdb(a,b,c) vector<vector<double>> c(a,vector<double>(b,0))
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define f_i(a,b) for(int i=0;i<=b;i++)
#define f_j(a,b) for(int j=0;j<=b;j++)


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

    int a;
    cin >> a;
    if(a!=0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
    
    return(0);

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

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

const int MAX = 100010;

int n;
ll dp[MAX];

int main()
{
    int n;
    cin >> n;
    vector<int> coin;
    int six = 6;
    while (six <= n)
    {
        coin.push_back(six);
        six *= 6;
    }
    int nine = 9;
    while (nine <= n)
    {
        coin.push_back(nine);
        nine *= 9;
    }
    sort(coin.begin(), coin.end());
    for (int i = 0; i <= n; i++)
    {
        dp[i] = i;
    }
    for (int c : coin)
    {
        for (int i = 0; i <= n; i++)
        {
            if (i >= c)
            {
                dp[i] = min(dp[i], dp[i - c] + 1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 4416
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

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

#define inf 10000000000

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

    ll x, a, b;
    cin >> x >> a >> b;
    cout << ((abs(x - a) < abs(x - b)) ? 'A' : 'B') << endl;
}


Measured memory_bytes: 256
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int a[][22],int b[][22],int x,int y){
  int sm=0;
  if(b[x][y]==0&&a[x][y]!=-1){
    b[x][y]=1;
    sm++;
    sm+=f(a,b,x-1,y);
    sm+=f(a,b,x,y-1);
    sm+=f(a,b,x+1,y);
    sm+=f(a,b,x,y+1);
  }
  return sm;
}
int main(){
  int i,j;
  int a[22][22],b[22][22],x,y,w,h;
  char c;
  while(cin>>w>>h&&w+h){
    memset(a,-1,sizeof(a));
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	cin>>c;
	if(c=='#')
	  a[j+1][i+1]=-1;
	else{
	  a[j+1][i+1]=0;
	  if(c=='@'){
	    x=j+1;
	    y=i+1;
	  }
	}
      }
    }
    memset(b,0,sizeof(b));
    cout<<f(a,b,x,y)<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;

typedef long long ll;
typedef long double ld;
const int N = 3e5;

int n, a[N], ans;
map <int, int> m;

bool gd(int x) {
    int cnt = 0;

    for (int i = 1; i * i <= x; i++) {
        if (x % i)
            continue;

        cnt += m[i];

        if (i != x / i)
            cnt += m[x / i];
    }

    return (cnt == 1);
}

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

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

    for (int i = 0; i < n; i++)
        ans += gd(a[i]);

    cout << ans;
}


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

int solve(vector<int>&v,int k)
{
    int n=v.size();
    int dp[n+1];
    for(int i=0; i<=n; i++)
        dp[i]=INT_MAX;
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    for(int i=2; i<n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
            if(i==j)
                break;
        }
    }
    return dp[n-1];
}


int main()
{
    int n;
    cin>>n;
    int k;
    cin>>k;
    vector<int> v(n);
    for(int i=0; i<n; i++)
        cin>>v[i];
    cout<<solve(v,k);
}

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


int main(){
	string S;
	cin >> S;
	int N = S.size();
	int tmp = 999;
	rep(i,N-2){
		string T = S.substr(i,3);
		rep(j,3){
			int num = (T[0]-'0')*100 + (T[1]-'0')*10 + (T[2]-'0');
		    if(tmp>abs(753-num)) {
				tmp = abs(753-num);
			}
		}
	}
	cout << tmp << endl;
}










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

int main(){
  int cnt,n;
  char f[3],st;
  while (1){
    cin >> n;
    if (n==0)return 0;
    cnt=0;
    st='-';
    for (int i=0;i<n;i++) {
      cin >> f;
      if (st=='-')st=f[0];
      else{
	if (st!=f[0]) {
	  cnt++;
	}
	st='-';
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 2984
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = std::vector<int>;
using VI2D = std::vector<vector<int>>;
using VLL = std::vector<long long>;
using VLL2D = std::vector<vector<long long>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

// 終了判定
template <typename T,
		  typename enable_if<is_integral<T>::value>::type* = nullptr>
bool finds(T left, T right) {
	return right - left > 1;
}

// 二分探索
template <typename T>
T bin_search(T left, T right, auto pred) {
	while(finds<T>(left, right)) {
		T middle = (left + right) / 2;
		if(pred(middle)) {
			left = middle;
		} else {
			right = middle;
		}
	}
	return left;
}

int main() {
	int n, k;
	cin >> n >> k;
	VLL a(n);
	REP(i, n) { cin >> a[i]; }

	ll a_max = 0;
	REP(i, n) { chmax(a_max, a[i]); }
	ll result = bin_search(0LL, a_max + 1LL, [&](int b) {
		int sum = 0;
		REP(i, n) { sum += (a[i] + b - 1) / b - 1; }
		return k < sum;
	});
	cout << result + 1 << endl;
	return 0;
}


Measured memory_bytes: 4644
--editorial

import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Data.Ord

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


toTup [a,b] = (a,b)

main :: IO ()
main = do
    [n,m] <- r'
    as <- sort <$> r'
    bcs<- sortBy (flip $ comparing snd) <$> replicateM m rp
    let folded = concat (map (uncurry replicate) bcs) ++ repeat 0
    let res = zipWith max folded as
    print $ sum res



Measured memory_bytes: 51580
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

typedef long long ll;

int main(){
	string S;
	int w;
	cin>>S>>w;
	REP(i,(int)(S.length()+w-1)/w){
		cout<<S[i*w];
	}
	cout<<endl;
	return 0;
}

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

const int INF = 9999999;

int N;
vector<int> h;
vector<int> dp;

int main(){
    cin >> N;
    h.resize(N);
    dp.resize(N+1,0);
    for(int i = 0;i < N;++i)cin >> h[i];

    dp[N-1] = 0;
    dp[N-2] = abs(h[N-2]-h[N-1]);

    for(int i = N-3;i >= 0;--i){
        dp[i] = min(abs(h[i]-h[i+1])+dp[i+1],abs(h[i]-h[i+2])+dp[i+2]);
    }
    cout << dp[0] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

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

  if(a+b==15){
    cout << "+" << endl;
  }else if(a*b==15){
    cout << "*" << endl;
  }else {
    cout << "x" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
S = int(input())
XX = S // 100
YY = S % 100

if   1 <=XX<=12 and 1 <= YY <= 12:print("AMBIGUOUS")
elif 1 <= YY <= 12:print("YYMM")
elif 1 <= XX <= 12:print("MMYY")
else :print("NA")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N, M;
constexpr int Nmax = 200000;
int A[Nmax];
int count_[Nmax + 1];
int dup[Nmax + 1];

int main()
{
    cin >> N >> M;
    memset(count_, 0, sizeof(count_));
    memset(dup, 0, sizeof(dup));
    REP(i, N)
    {
        cin >> A[i];
        if (A[i] - count_[A[i]] > 0) dup[A[i] - count_[A[i]]]++;
        count_[A[i]]++;
    }

    int invans = 0;
    REP(i, N) if (dup[i + 1]) invans++;

    REP(_, M)
    {
        int X, Y;
        cin >> X >> Y;

        int del = A[X - 1];
        count_[del]--;
        if (del - count_[del] > 0)
        {
            dup[del - count_[del]]--;
            if (dup[del - count_[del]] == 0) invans--;
        }
 
        A[X - 1] = Y;
        if (Y - count_[Y] > 0)
        {
            dup[Y - count_[Y]]++;
            if (dup[Y - count_[Y]] == 1) invans++;
        }
        count_[Y]++;

        cout << N - invans << endl;
    }
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b==0) return a;
	else return gcd(b,a%b);
}

//最小公倍数, 複数の時はlcm(a,lcm(b,c))みたいな感じで
template <class T>
T lcm(T a,T b){
	return a*(b/gcd(a,b));
}

template<typename Monoid,typename F>
class SegmentTree{
private:
    int n;
    vector<Monoid> node;
    const F op;//演算
    const Monoid e;//単位元
public:
    SegmentTree(int sz,const F op,const Monoid &e):op(op),e(e){
        n=1;
        while(n<sz) n*=2;
        node.assign(2*n,e);
    }
    void build(const vector<Monoid> &v){
        int m=v.size();
        for(int i=0;i<m;i++) node[n-1+i]=v[i];
        for(int i=n-1;i>=0;i--) node[i]=op(node[2*i+1],node[2*i+2]);
    }
    void update(int k,const Monoid &x){
        k+=n-1;
        node[k]=x;
        while(k>0){
            k=(k-1)/2;
            node[k]=op(node[2*k+1],node[2*k+2]);
        }
    }
    Monoid query(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0) r=n;
		if(r<=a || b<=l) return e;
		if(a<=l && r<=b) return node[k];
		else{
			Monoid vl=query(a,b,2*k+1,l,(l+r)/2);
			Monoid vr=query(a,b,2*k+2,(l+r)/2,r);
			return op(vl,vr);
		}
    }
    Monoid operator[](const int &k)const{
        return node[k+n];
    }
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	ll e=1;
	vector<ll> a(n);
	rep(i,n){
		cin>>a[i];
		e=lcm(e,a[i]);
	}
	auto f=[&](ll a,ll b){return gcd(a,b);};
	SegmentTree<ll,decltype(f)> seg(n,f,e);
	seg.build(a);
	ll ans=0;
	rep(i,n){
		seg.update(i,e);
		chmax(ans,seg.query(0,n));
		seg.update(i,a[i]);
	}
	cout<<ans<<endl;
}

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

int n;
string A[100000];
string B[100000];

string iso="Isono-kun";
string naka="Nakajima-kun";
string hiki="Hikiwake-kun";

string solve(){
  int ca=0,cb=0;
  for(int i=0;i<n;i++){

    if(ca>5)ca=5;
    if(cb>5)cb=5;

    if(A[i]=="tameru"){
      if(B[i]=="tameru"){
	ca++;
	cb++;
      }else if(B[i]=="kougekida"){
	ca++;
	if(cb==0)return iso;
	else return naka;
      }else if(B[i]=="mamoru"){
	ca++;
      }
    }

    if(A[i]=="kougekida"){
      if(B[i]=="tameru"){
	cb++;
	if(ca==0)return naka;
	else return iso;
	ca=0;
      }
      if(B[i]=="kougekida"){
	if(ca>cb)return iso;
	if(ca<cb)return naka;
	ca=cb=0;
      }
      if(B[i]=="mamoru"){
	if(ca==0)return naka;
	if(ca==5)return iso;
	ca=0;
      }
    }

    if(A[i]=="mamoru"){
      if(B[i]=="tameru"){
	cb++;
      }else if(B[i]=="kougekida"){
	if(cb==0)return iso;
	if(cb==5)return naka;
	cb=0;
      }else if(B[i]=="mamoru"){
      
      }
    }
  }
  return hiki;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  for(int i=0;i<n;i++){
    cin>>B[i];
  }
  cout<<solve()<<endl;
  return 0;
}

Measured memory_bytes: 2784
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;


ll beki(ll x, ll n){
  ll res = 1;
  while(n > 0){
    if(n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

ll ncr(ll n, ll r){
  ll X = 1, Y = 1;
  for(int i = n - r + 1; i <= n ; i++){
    X = X * i % MOD;
  }
  for(int i = 1; i <= r; i++){
    Y = Y * i % MOD;
  }
  Y = beki(Y, MOD - 2);
  return X * Y % MOD;
}

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

    ll n, a, b; cin >> n >> a >> b;
    ll sum = beki(2, n) - 1;
    ll A, B;
    A = ncr(n, a);
    B = ncr(n, b);
    ll ans = sum - A - B;
    while(ans < 0) ans += MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef pair<ll , pair<ll, ll> > pi;
int pow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}   
struct Compare {
    constexpr bool operator()(pi const & a,
                              pi const & b) const noexcept
    { return a.first < b.first || (a.first == b.first && a.second.first > b.second.first); }
 
};
void prefix_function( string s,ll arr[] )
{
     long long border=0; arr[0]=0;
    for(long long i=1;i<s.size();i++)
    {
      while(border>0 && s[i]!=s[border])
        border=arr[border-1];
     
     if(s[i]==s[border])
         border++;
      else
       border=0;
      
      arr[i]=border;
    }
}//send mod-2 for a^-1 if mod is a prime number

ll mod=998244353;
ll add( ll a , ll b)
{
    return (((a%mod)+(b%mod))%mod);
}
ll mul(ll a,ll b)
{
  return (((a%mod)*(b%mod))%mod);
}
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}
ll subs(ll a,ll b)
{
    return (((a%mod)-(b%mod)+mod)%mod);
}
ll dv(ll a,ll b)
{
    ll inv=binpow(b,mod-2);
    return mul(a,inv);
}

ll dsu_arr[100000];
ll dsu_sz[100000];
void dsu(ll n)
{
    for(ll i=0;i<=n;i++)
    {
        dsu_arr[i]=i;
        dsu_sz[i]=1;
    }
}
ll find(ll x)
{
     ll root=x;
    while (root!=dsu_arr[root])
    {
        root=dsu_arr[root];
    }
    while(x!=dsu_arr[x])
    {
        dsu_arr[x]=root;
        x=dsu_arr[x];
    }
    return root;
}
ll merge(ll x,ll y)
{
    ll root1=find(x);
    ll root2=find(y);
    
    if(root1==root2)
    return 0ll;
 
    if(dsu_sz[x]>dsu_sz[y]){
    dsu_arr[root2]=root1;
    dsu_sz[root1]+=dsu_sz[root2];
    }
    else
    {
         dsu_sz[root2]+=dsu_sz[root1];
        dsu_arr[root1]=root2;
    }
    return 1ll;
}
/*
vector<ll>adj[100005];
bool vis[100005];
ll dist[100005];
void bfs(ll c)
{
  vis[c]=true;
  dist[c]=0;
  q.push(c);
while(!q.empty())
{
    ll x=q.front();
    q.pop();
   
    for(ll i=0;i<adj[x].size();i++)
    {
        ll y=adj[x][i];
        if(!vis[y])
        {
            vis[y]=true;
            dist[y]=dist[x]+1;
            
            q.push(y);
        }
    }
 
}
}
*/

int main()
{
    Fast
 ll x;
 cin>>x;
 if(!x)
 cout<<1<<endl;
 else
 {
     cout<<0<<endl;
 }
 


}



   
      
    
        



Measured memory_bytes: 3648
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int n;
  cin>>n;

  vi a(n);
  cin>>a;

  int ans=0;

  REP(i,n-1) ans+= (a[i]-a[i+1])*(a[i]-a[i+1]>0);

  cout<<ans+a[n-1]<<endl;

  return 0;

}


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

// change maximum
// aよりbが大きかったら、aの値をbの値に置き換えて、trueを返す
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i, n) cin >> a.at(i) >> b.at(i) >> c.at(i);

    long long int dp[110000][3];
    rep(i, 110000)
    {
        dp[i][0] = 0;
        dp[i][1] = 0;
        dp[i][2] = 0;
    }

    for (int i = 0; i < n; i++)
    {
        chmax(dp[i + 1][0], max(dp[i][1] + b.at(i), dp[i][2] + c.at(i)));
        chmax(dp[i + 1][1], max(dp[i][0] + a.at(i), dp[i][2] + c.at(i)));
        chmax(dp[i + 1][2], max(dp[i][0] + a.at(i), dp[i][1] + b.at(i)));
    }

    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
}

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

int main(){
    int n,l;
    cin >> n >> l;
    string s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s,s+n);
    for(int i=0;i<n;i++){
        cout << s[i];
    }
    cout << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int MAX = 3100000;

ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if(n < k)
    return 0;
  if(n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modpow(ll x, ll n) {
  ll ans = 1;
  while(n > 0) {
    if(n % 2 == 1) {
      ans *= x;
      ans %= MOD;
    }
    x *= x;
    x %= MOD;
    n >>= 1;
  }
  return ans;
}

int main() {
  int k;
  string s;
  cin >> k >> s;
  int n = s.length();
  ll ans = 0;
  COMinit();
  for(int i = n - 1; i < n + k; i++) {
    int x = n + k - i - 1;
    ans += COM(n + k - x - 1, n - 1) * modpow(25, k - x) % MOD * modpow(26, x);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 77084
#include<bits/stdc++.h>
using namespace std;
char a[5]={'a','e','i','o','u'};
int main(){
    char c;
    c=getchar();
    for(int i=0;i<5;i++)
        if(c==a[i]){
            cout<<"vowel"<<endl;
            return 0;
        }
    cout<<"consonant"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	string s;
	cin >> s;

	vector<string> all_pins(1000);
	for (int i = 0; i <= 999; ++i) {
		string curr;
		if (i < 10) {
			curr = "00" + to_string(i);
		}
		else if (i < 100) {
			curr = '0' + to_string(i);
		} else {
			curr = to_string(i);
		}

		all_pins[i] = curr;
	}

	int sz = s.size();

	int pins = 0;
	for (int i = 0; i <= 999; ++i) {
		bool found = false;
		for (int j = 0; j < sz; ++j) {
			if (s[j] == all_pins[i][0]) {
				for (int k = j + 1; k < sz; ++k) {
					if (s[k] == all_pins[i][1]) {
						for (int l = k + 1; l < sz; ++l) {
							if (s[l] == all_pins[i][2]) {
								found = true;
								++pins;
								break;
							}
						}

						break;
					}
				}

				break;
			}
		}
	}

	cout << pins << "\n";

	return 0;

}

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

int main()
{
	int n, m;

	cin >> n >> m;

	vector<int> x(m), d(m);

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

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

	for (int i = 0; i < m - 1; i++)
		d[i] = x[i + 1] - x[i];

	sort(d.begin(), d.end(), greater<int>());

	if (n >= m)
		cout << 0 << endl;
	else {
		long long s = x.back() - x.front();

		for (int i = 0; i < n - 1; i++)
			s -= d[i];

		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define vi vector<long long int>
#define vs vector<string>
#define mii map<long long int, long long int>

void show(auto a){
  long long int i = 0;
  while(i < a.size()){
    cout<<a[i]<<" ";
    i++;
  }
  cout<<endl;
}


int main(){
  ios_base::sync_with_stdio(false);

  long long int n, W;
  cin>>n>>W;

  vi wt(n), val(n);

  for(long long int i = 0; i < n; i++) cin>>wt[i]>>val[i];


  long long int dp[n+1][W+1];


  for(long long int i = 0; i <= n; i++){
  	for(long long int j = 0; j<= W; j++){
  		if( i == 0 || j == 0) dp[i][j] = 0;
  		else{
  			dp[i][j] = dp[i-1][j];

  			if(wt[i-1] <= j) dp[i][j] = max(dp[i][j], val[i-1] + dp[i-1][j-wt[i-1]]);
  		} 
  	}
  }


  cout<<dp[n][W]<<endl;
  
}

Measured memory_bytes: 79232
import sys
sys.setrecursionlimit(10**9)

s = input()
n = len(s) + 1
tmp = [0]*n

def rec(i, prev=None):
    if i == n-1:
        if prev == ">":
            tmp[i] = 0
        else:
            tmp[i] = tmp[i-1]+1
        return tmp[i]
    if prev is None:
        if s[i] == "<":
            tmp[i] = 0
            rec(i+1,prev="<")
        else:
            tmp[i] = rec(i+1,prev=">")+1
    else:
        if s[i] == "<":
            if prev == ">":
                tmp[i] = 0
                rec(i+1,prev="<")
            else:
                tmp[i] = tmp[i-1]+1
                rec(i+1,prev="<")
        else:
            if prev == ">":
                tmp[i] = rec(i+1,prev=s[i])+1
            else:
                tmp[i] = max(tmp[i-1], rec(i+1,s[i]))+1
    return tmp[i]

rec(0)
#print(tmp)
print(sum(tmp))

Measured memory_bytes: 547004
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 1要素の場合は1
        int n = Integer.parseInt(scanner.nextLine());
        if (n == 1) {
            System.out.println(1);
            System.exit(0);
        }
        int[] a = new int[n];

        int i = 0;
        for (String ai: scanner.nextLine().split(" ")) {
            a[i++] = Integer.parseInt(ai);
        }

        int x = 1;
        int plus = 0;

        for (i = 0; i < n - 1; i++) {
            if (a[i] > a[i + 1]) {
                if (plus == -1) {
                    x++;
                    plus = 0;
                } else if (plus == 0) {
                    plus = 1;
                }
            } else if (a[i] < a[i + 1]) {
                if (plus == 1) {
                    x++;
                    plus = 0;
                } else if (plus == 0){
                    plus = -1;
                }
            }
        }

        System.out.println(x);
    }
}

Measured memory_bytes: 48472
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define inl(a) cin >> a
#define prl(a) cout << a << " "
#define outl(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<int,pair<int,int> > >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define N 100005
int dp[N];
int main()
{
    int n,i,j;
    in(n);
    vi v(n);
    read(v,i,n);
    fill(dp+1,dp+n,M);
    lp(i,0,n)
    {
        lp(j,1,3)
        {
            if(i+j<n)
                dp[i+j]=min(dp[i+j],dp[i]+abs(v[i]-v[i+j]));
        }
    }
    out(dp[n-1]);

}


Measured memory_bytes: 1024
package main

/*
   N
*/
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	if n >= 30 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1776
import sys

if __name__ == "__main__":
    args = sys.stdin.read().split()
    count_of_500_coins, count_of_100_coins, count_of_50_coins, sum_of_price = tuple(map(int, args))

    cnt = 0
    for num_500_coins in range(0, count_of_500_coins + 1):
        remaining_price = sum_of_price - 500 * num_500_coins
        if remaining_price < 0:
            break

        for num_100_coins in range(0, count_of_100_coins + 1):
            remaining_price = sum_of_price - 500 * num_500_coins - 100 * num_100_coins
            if remaining_price < 0:
                break

            necessary_num_50_coins = remaining_price / 50
            if 0 <= necessary_num_50_coins <= count_of_50_coins:
                cnt += 1

    print(cnt)



Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
"""
Created on Thu Sep  3 20:46:45 2020

@author: liang
"""


class UnionFind():
    def __init__(self, N):
        self.N = N
        self.par = [-1]*N
    
    def find(self, x):
        if self.par[x] < 0:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]
    
    def union(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return self
        if self.par[a] > self.par[b]:
            a, b = b, a
        self.par[a] += self.par[b]
        self.par[b] = a
    
    def same(self, a, b):
        a = self.find(a)
        b = self.find(b)
        return a == b
    
N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int,input().split())
    uf.union(a-1, b-1)

ans = -min(uf.par)
print(ans)  

Measured memory_bytes: 14288
#include <iostream>
#include<string>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if (n == 25)
	{
		cout << "Christmas\n";
	}
	else if (n == 24)
	{
		cout << "Christmas Eve\n";
	}
	else if (n == 23)
	{
		cout << "Christmas Eve Eve\n";
	}
	else
	{
		cout << "Christmas Eve Eve Eve\n";
	}

	return 0;
}


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

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

    vector<int> a(n+2);
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    a[0] = 0; a[n+1] = 0;

    int num = 0;
    for(int i=0; i<n+1; i++){
        num += abs(a[i] - a[i+1]);
    }

    for(int i=1; i<=n; i++){
        cout << num - (abs(a[i-1] - a[i]) + abs(a[i] - a[i+1])) + abs(a[i-1] - a[i+1]) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <math.h>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif

int main()
{
	int a, b, c;
	std::cin >> a >> b >> c;

	double r = static_cast<double>(c)*M_PI / 180;

	double area = static_cast<double>(a)*b*sin(r) / 2;
	double perimeter = a + b + sqrt(pow(a,2)+ pow(b,2) - 2*a*b*cos(r));
	double height = b*sin(r);
	std::cout << std::setprecision(5) << std::fixed << area << "\n";
	std::cout << std::setprecision(5) << std::fixed << perimeter << "\n";
	std::cout << std::setprecision(5) << std::fixed << height << "\n";


    return 0;
}




Measured memory_bytes: 3540