akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>
#include<string.h>
int main()
{
	using namespace std;
    char d[10]="dream";
    char e[10]="erase";
    char str[100000];
    int test=1,len=0;
    scanf("%s",&str);
    len=strlen(str);
    for(int i=0;i<len;i++)
    {
        if(str[i]=='d')
        {

            int j;
            for(j=i;j<i+5;j++)
            {
                //cout<<j<<endl;
                if(j>=len||str[j]!=d[j-i])
                {
                    test=0;
                    break;
                }

            }
            if(j==i+5)
                {
                    //cout<<"!"<<endl;
                    i=j-1;
                    if(str[i+1]=='e'&&str[i+2]=='r'&&str[i+3]!='a')
                    {
                        i=j+1;
                    }
                }
        }
        else if(str[i]=='e')
        {
            int j;
            for(j=i;j<i+5;j++)
            {
                //cout<<j<<endl;
                if(j>=len||str[j]!=e[j-i])
                {
                    test=0;
                    break;
                }

            }
            if(j==i+5)
                {
                    i=j-1;
                    if(str[j]=='r')
                    {
                        i=j;
                    }
                    else
                    {
                        i=j-1;
                    }
                }
        }
        else
        {
            test=0;
        }
        //cout<<i<<endl;
    }
    if(test==0)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
        }

    return 0;
}


Measured memory_bytes: 384
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add_self(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int add(int a,int b){
	int c=a+b;
	if(c>=mod){
		c-=mod;
	}
	return c;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;


void solve(){
	int n,a,b;
	cin>>n>>a>>b;
	if((b-a-1)%2){
		cout<<"Alice";
	}
	else{
		cout<<"Borys";
	}
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
A = list(map(int, input().split()))

X = [0] * N
for i, a in enumerate(A):
    j = (N - 1 - a) // 2
    X[j] += 1

for i, x in enumerate(X):
    if x == 1 and not (i == (N + 1) // 2 - 1):
        print(0)
        exit()
    if x > 2:
        print(0)
        exit()

ans = 1
for x in X:
    if x == 0:
        break
    ans *= x
    ans %= MOD
print(ans)



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

int n; // number of vertices 
int P[20200], A[20200], B[20200], C[20200];
pair<int, int> D[20200]; // Weights and coordinates 

int root(int a) { // find the root of a
  if (P[a] == a) return a; // a is the root
  return  (P[a] = root(P[a])); // find root of a, make it a's parent
}

bool is_same_set(int a, int b) { // a and b are in the same group?
  return root(a) == root(b);
}

void unite(int a, int b) { // put a and b in same group
  P[root(a)] = root(b);
}


int main() {
  cin >> n; // the number of vertices
  for (int i=0; i<n; ++i) {
    P[i] = i; // Initialize vertices to disjoint sets
    for (int j=0; j<n; ++j) {
      A[(n * i) + j] = i;
      B[(n * i) + j] = j;
      cin >> C[(n * i) + j];
    }
  }
  for (int i=0; i < n*n; i++) {
    D[i].first = C[i];
    D[i].second = i;
  }
  sort(D, D+n*n);
  int sum = 0;

  for (int i=0; i<n*n; ++i) {
    if (D[i].first >= 0) { // Assuming the weight is not -1
      if (!is_same_set(A[D[i].second], B[D[i].second])) {
	unite(A[D[i].second], B[D[i].second]);
	sum += D[i].first;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 1452
#include <stdio.h>
#define N 100

int main()
{

int n, A[N], i, j, k, l, num, count=0;

scanf("%d", &n);
for(i = 0; i < n; i++) scanf("%d", &A[i]);

for(i = 0; i < n-1; i++){
k = i;
for(j = i; j < n; j++){
if(A[j] < A[k]) k = j;
}
num = A[i];
A[i] = A[k];
A[k] = num;
if(i != k) count++;
}

for(l = 0; l < n; l++){
if(l == n-1) printf("%d", A[l]);
else printf("%d ", A[l]);
}
printf("\n%d\n", count);

return 0;
}

Measured memory_bytes: 600
n = int(input())
a = list(map(int, input().split()))
x = 0
m = sum(a)
for i in range(len(a)-1):
    m = (m-a[i])%(10**9+7)
    x += a[i]*m
    x = x%(10**9+7)
print(x%(10**9+7))

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

int main(){
    int N;  cin >> N;
    vector<ll> A(N+1, 0), B(N, 0);
    for(int i=0; i<=N; i++)
        cin >> A[i];
    for(int i=0; i<N; i++)
        cin >> B[i];
    
    ll ans = 0;
    for(int i=0; i<N; i++){
        if(B[i] > 0 && A[i] > 0){
            ll cnt = min(B[i], A[i]);
            B[i] -= cnt;
            ans += cnt;
        }
        if(B[i] > 0 && A[i+1] > 0){
            ll cnt = min(B[i], A[i+1]);
            B[i] -= cnt;
            A[i+1] -= cnt;
            ans += cnt;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			
			if(h == 0) break;
			
			for(int j=0; j<h; j++) {
				for(int i=0; i<w; i++) {
					System.out.print("#");
				}	
				System.out.println("");
			}
			
			System.out.println("");
		}		
		
		
	}
}


Measured memory_bytes: 33240
x,y = map(int, input().split())
list = []
ans = 0
for i in range(x) :
    list.append(4)

if sum(list) == y:
    print('Yes')
    ans = 1

else :
    for i in range(x) :
        list.remove(4)
        list.append(2)
        if sum(list) == y:
            print('Yes')
            ans = 1
            break

    if ans == 0:
        print('No')


Measured memory_bytes: 9128
/*---Bismillahir Rahmanir Rahim---*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std; 

int fact(int n){
	if (n<=1) return 1;
	return  n*fact(n-1);
}

inline void solve()
{
	map <int,bool> m;
	int  n,ans1 =1,ans2=1; 
	cin >> n ; 
	for (int i=1;i<=n;i++){
		int  a; cin >> a ; 
		m[a]=true;
		int  c=0,k=1; 
		while (k<a) {
			if (m.count(k)==0) c++; 
			k++; 
		}
		for (int j=1;j<=c;j++) {
			ans1 += fact(n-i);
		}
	}
	m.clear();
	for (int i=1;i<=n;i++){
		int  a; cin >> a ; 
		m[a]=true;
		int  c=0,k=1; 
		while (k<a) {
			if (m.count(k)==0) c++; 
			k++; 
		}
		for (int j=1;j<=c;j++) {
			ans2 += fact(n-i);
		}
	}
	cout << abs(ans1-ans2) <<endl; 
}

signed main()
{
	int t=1; //cin>>t;
	while(t--) solve();
	return 0;
}

/*
3
3 2 1

*/


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

int main() {
    int N;
    cin >> N;
    vector<ll> vec(N);
    for(int i = 0; i < N; i++){
        cin >> vec.at(i);
    }
    int ans = 0;
    for(int i = 0; i < N-2; i++){
        for(int j = i+1; j < N-1; j++){
            for(int k = j+1; k < N; k++){
                if(abs(vec.at(j) - vec.at(k)) < vec.at(i) && vec.at(i) < vec.at(j) + vec.at(k) && vec.at(i) != vec.at(j) && vec.at(j) != vec.at(k) && vec.at(k) != vec.at(i)){
                ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define int long long

vector<int> ans;
signed main(){
	int n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);
	if(n < a+b-1 || n > a*b){
		printf("-1\n");
		return 0;
	}
	
	int x = n-a, cnt = n-a+1;
	for(int i = cnt;i <= n;i++)ans.push_back(i);
	for(int i = 0;i < b-1;i++){
		int d = x/(b-1);
		if(x%(b-1) > i)d++;
		cnt -= d;
		for(int j = cnt;j < cnt+d;j++)ans.push_back(j);
	}
	
	printf("%lld", ans[0]);
	for(int i = 1;i < ans.size();i++)printf(" %lld", ans[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 6000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define drep(i, n) for (int i = (int)(n); i >= 0; i--)

vi counting_sort(vi &a, int k) {
  vi b(a.size()), c(k + 1);

  for (auto i: a) c[i]++;
  for (int i = 1; i <= k; i++) c[i] += c[i - 1];
  
  for (int i = (int)a.size() - 1; i >= 0; i--) {
    b[c[a[i]] - 1] = a[i];
    c[a[i]]--;
  }

  return b;
}

int main() {
  int n, k = 0;
  cin >> n;

  vi a(n);
  rep(i, n) {
    scanf("%d", &a[i]);
    k = max(k, a[i]);
  }

  auto b = counting_sort(a, k);

  rep(i, n)
    printf(i != n - 1 ? "%d " : "%d\n", b[i]);
}



Measured memory_bytes: 18436
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int asc(const void* a, const void* b) {
	return *(int*)a - *(int*)b;
}

int main()
{	
	char s[10];
	cin >> s;
	sort(s, s + 4);
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>//
#include <vector>//
#include <map>
#include <cstdlib>
#include <numeric>
#include <algorithm>//ソート等に使用
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <thread>///////////////////
#include <queue>//幅優先等のキュー

#define rep(i,m,n) for(int i=(m);i<(n);i++)
#define rem(i,m,n) for(int i=(m);i>(n);--i)

#define MOD 1000000007
//#define MOD 998244353
#define MAX 

using namespace std;

using ll = long long int;
using ld = long double;
using std::swap;

vector<int> v;
vector<int> w;
vector<long long int> vll;
vector<long long int> wll;
//vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;
vector<vector<int>> ww;


int main() {
	v.resize(5);
	rep(i, 0, 5)cin >> v[i];
	rep(i, 0, 5) {
		if (v[i] == 0)cout << i+1 << '\n';
	}

	return 0;

}

Measured memory_bytes: 3572
#!/usr/bin/env python3
import sys
from networkx.utils import UnionFind
from operator import itemgetter
def input(): return sys.stdin.readline().rstrip()


def main():
    n = int(input())
    city = []
    for i in range(n):
        x, y = map(int, input().split())
        city.append((x, y, i))
    city.sort(key=itemgetter(0))
    kouho = []
    for i in range(n-1):
        kouho.append((city[i+1][0]-city[i][0], city[i][2], city[i+1][2]))
    city.sort(key=itemgetter(1))
    for i in range(n-1):
        kouho.append((city[i+1][1]-city[i][1], city[i][2], city[i+1][2]))
    kouho.sort(key=itemgetter(0))
    ans = 0
    num = n
    uf = UnionFind()
    for road in kouho:
        if uf[road[1]] != uf[road[2]]:
            uf.union(road[1],road[2])
            ans+=road[0]
            num-=1
            if num==1:
                print(ans)
                break


if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  int S = 0, M = 107;
  for (int i = 0; i < N; i++) {
    int X;
    cin >> X;
    S += X;
    if (X % 10 != 0) {
      M = min(M, X);
    }
  }
  if (S % 10 != 0) cout << S << endl;
  else {
    if (M > 100) cout << 0 << endl;
    else cout << S - M << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>
#include<bitset>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const double EPS = 0.000000000001;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;

ll kaizyo(ll n) {

	ll tmp = 1;
	for (int i = 1; i <= n; i++) {
		tmp *= i;
		tmp %= MOD;
	}
	return tmp;

}

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================


	int N, M;
	cin >> N >> M;

	if (N == M) {
		cout << (((kaizyo(N) * kaizyo(M)) % MOD) * 2) % MOD;
	}
	else if (abs(N - M) == 1) {
		cout << (kaizyo(N) * kaizyo(M)) % MOD;
	}
	else {
		cout << 0;
	}


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch TaxRate | diff TaxRate.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address TaxRate.cpp && ./a.out

/*
 
 12/1/2019
 
 4:02-
 
 */

int N;

void solve() {
  for(int x=0; x<=N; ++x) {
    if((LL)x*108/100==(LL)N) {
      cout<<x<<endl;
      return;
    }
  }
  cout<<":("<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

  int N, ans = 0;
  int A[100], B[100];

  cin >> N;

  for(int i = 0; i < N - 1; i++){
	A[i] = 1000000;
	cin >> B[i];
  }
  
  A[N-1] = 1000000;

  for(int i = 0; i < N -1; i++){
	if(A[i] > B[i]){
	  A[i] = B[i];
	}
	if(A[i+1] > B[i]){
	  A[i+1] = B[i];
	}
  }

  for(int i = 0; i < N; i++){
	ans += A[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "D:\C++\test_lib_projects\testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>

bool debug=true;
/*
   Write In New Computer
    By XiaoGeNintendo
	     gwq2017
	Type:
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int n,m;
int a[100005];
int main(int argc,char* argv[]){
	cin>>n>>m;

	if(n<=m){
		cout<<1<<endl;
		return 0;
	}
	
	cout<<(n-1+m-2)/(m-1);
	
	return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ld long double
#define mem(x,y) memset(x,y,sizeof x)

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

int pos[200009];
int ind[200009],inv[200009],g[200009];
int ans[200009];
set<int> s;
int par[200009],sz[200009];
int fin(int v) 
{
	if(par[v]==-1) return par[v]=v;
    if (v == par[v])    return v;
    return par[v] = fin(par[v]);
}
 
void uni(int a, int b) 
{
    a = fin(a);
    b = fin(b);
    if(a == b) return;
    if(sz[a] < sz[b]) swap(a, b);
    par[b] = a;
    sz[a] += sz[b];
    g[a]=min(g[a],g[b]);
}
void solve()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		cin>>a>>b;
		pos[a]=b;
		ind[a]=i;
		inv[b]=a;
		s.insert(b);
		par[i]=i;
		sz[i]=1;
		g[i]=b;
	}
	set<int> small;
	for(int i=1;i<=n;i++)
	{
		auto it = small.upper_bound(pos[i]);
		while(!small.empty() && it != small.begin())
		{
			it--;
			assert(pos[i]>*it);
			uni(ind[i],ind[inv[*it]]);
			small.erase(it);
			it = small.upper_bound(pos[i]);
		}
		small.insert(g[fin(ind[i])]);
	}
	for(int i=1;i<=n;i++) cout<<sz[fin(i)]<<'\n';
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


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

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

   


Measured memory_bytes: 1664
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

vector<pair<int, int>> primeFactorization(int n) {
    int k = n;
    vector<pair<int, int>> ret;
    for (int i = 2; i <= sqrt(n); i++) {
        int cnt = 0;
        while(k % i == 0) {
            k /= i; // 重複を許さないならここを while に
            cnt++;
        }
        if (cnt) ret.push_back({i, cnt});
    }
    if(k > 1) ret.push_back({k, 1});
    return ret;
}

const int MAX = 210000;

long long 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;
}

int main(){
    cin.tie(0);
    
    COMinit();
    int N, M;
    cin >> N >> M;
    Int ans = 1;
    auto factor = primeFactorization(M);
    for (int i = 0; i < factor.size(); i++){
        int cnt = factor[i].second;
        Int tmp = COM(N+cnt-1, cnt);
        tmp %= MOD;
        ans = (ans * tmp) % MOD;
    }
    cout << ans << endl;
} 


Measured memory_bytes: 5120
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

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

signed main() {
  int N;
  cin >> N;

  int M = 100000;
  int sum = 0;
  vector<int> cnt(M + 1);

  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
    sum += A[i];
    cnt[A[i]]++;
  }
  int Q;
  cin >> Q;
  rep(q, Q) {
    int B, C;
    cin >> B >> C;
    sum += (C - B) * cnt[B];
    cout << sum << endl;

    cnt[C] += cnt[B];
    cnt[B] = 0;
  }
}

Measured memory_bytes: 4808
n,m,x = map(int, input().split())

min_money = 999999999

l=[]
for i in range(n):
	a=list(map(int,input().split()))
	l.append(a)

for i in range(2**n):
	bag = []
	for j in range(n):
		if ((i >> j) & 1):
			bag.append(l[j])

	money = 0
	skill = [0] * m
	enough = [0] * m
	for sub in bag:
		money += sub[0]
		for k in range(1,m+1):
			skill[k-1] += sub[k]
			if skill[k-1] >= x:
				enough[k-1] = 1

	if 0 not in enough and min_money > money:
		min_money = money

if min_money != 999999999:
	print(min_money)
else:
	print(-1)

Measured memory_bytes: 9136
#include <stdio.h>
#include <math.h>
#include <cmath>
 
using namespace std;
 
int main(){
    int n;
    double x[100] = {0},y[100] = {0},p_1 = 0,p_2 = 0,p_3 = 0,p_infinity = -1;
    scanf("%d",&n);
    for(int i = 0; i < n; i++) scanf("%lf",&x[i]);
    for(int i = 0; i < n; i++) scanf("%lf",&y[i]);
 
    for(int i = 0; i < n; i++){
        p_1 += abs(x[i] - y[i]);
        p_2 += (x[i] - y[i])*(x[i] - y[i]);
        p_3 += abs((x[i] - y[i])*(x[i] - y[i])*(x[i] - y[i]));
        p_infinity = (p_infinity >= abs(x[i] - y[i]))? p_infinity:abs(x[i] - y[i]);
    }
    printf("%.6lf\n",p_1);
    printf("%.6lf\n",sqrt(p_2));
    printf("%.6f\n",cbrt(p_3));
    printf("%.6lf\n",p_infinity);
 
}


Measured memory_bytes: 2952
#include <iostream>
using namespace std;
int main() {
char s[3];
    for(int i = 0; i < 3; i++) {
        cin >> s[i];
    }

    if(s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 888
N, K = map(int, input().split())
cnts = [0 for _ in range(100001)]
for _ in range(N):
    a, b = map(int, input().split())
    cnts[a] += b
rui = 0
for i in range(100001):
    rui += cnts[i]
    if rui >= K:
        print(i)
        break

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

using namespace std;
// template for creating 2d vector
template<typename T>
vector<vector<T>> make_2d_vector(size_t rows, size_t cols, T init)
{ return vector< vector<T> >(rows, vector<T>(cols, init)); }



#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;

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

  int N;
  cin >> N;

  vector<int> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }


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

  vector<ll> sumA(N);
  sumA[0] = A[0];
  for(int i = 1; i < N; i++) {
    sumA[i] = sumA[i-1] + A[i];
  }

  reverse( sumA.begin(), sumA.end() );
  reverse( A.begin(), A.end() );


  vector<bool> dp(N);
  dp[0]  = true;
  for(int i = 1; i < N; i++) {
    if( 2 * sumA[i] >=  A[i-1] ) dp[i] = dp[i-1];
  }

  int res = 0;
  for(int i = 0; i < N; i++) {
    if(dp[i]) res++;
  }
  cout << res << "\n";

  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#define INT_MAX 100000000
using namespace std;
int index;
int mm[1000][1000];
int mine = INT_MAX;
 
void solve(int p[]){
  int n = index-1,j,q;
  for(int i=1;i<=n;i++)mm[i][i]=0;
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      j = i+l-1;
      mm[i][j] = INT_MAX;
      for(int k=i;k<=j-1;k++){
    q = mm[i][k] + mm[k+1][j] + p[i-1]*p[k]*p[j];
    if(q<mm[i][j]){
      mm[i][j] = q;
        
    }
 
      }
    }
  }
 
 
 
 
}
 
int main(){
  int p[1000],a,b;
  scanf("%d",&index);
  //for(int i=0;i<=index;i++)for(int j=0;j<=n;j++)mm[i][j] = INT_MAX;
  for(int i=0;i<index;i++){
    scanf("%d %d",&a,&b);
    p[i] = a;
    if(i == index-1)p[i+1] = b;
  }
 
  index = index+1;
  solve(p);
  
  printf("%d\n",mm[1][index-1]);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

struct WF{
  void solve(vector<vector<pair<int, ll> > >&G, vvl&v){
    int n = sz(G);
    v.resize(n);
    FOR(i, 0, n){
      v[i] = vl(n);
      fill(v[i].begin(), v[i].end(), linf);
    }
    FOR(i, 0, n){
      each(itr, G[i]){
        v[i][itr->fi] = itr->se;
      }
      v[i][i] = 0;
    }
    FOR(k, 0, n) FOR(i, 0, n) FOR(j, 0, n) mins(v[i][j], v[i][k] + v[k][j]);
  }
};

typedef pair<int, ll> T;
typedef vector<T> vt;
vector<vt> G;

int n, m, r;
vi rl;
vvl v;
ll DP[256][8];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> r;
  G.resize(n);
  FOR(i, 0, r){
    int _r;
    cin >> _r;
    _r--;
    rl.pb(_r);
  }
  FOR(i, 0, m){
    int a, b;
    ll c;
    cin >> a >> b >> c;
    a--; b--;
    G[a].pb(mp(b, c));
    G[b].pb(mp(a, c));
  }
  WF wf;
  wf.solve(G, v);
  FOR(i, 1, 1<<r){
    if(pcnt(i) == 1){
      FOR(j, 0, r){
        if(i&(1<<j)){
          DP[i][j] = 0;
        }else{
          DP[i][j] = linf;
        }
      }
    }else{
      FOR(j, 0, r){
        DP[i][j] = linf;
        if(i&(1<<j)){
          int l = i - (1<<j);
          FOR(k, 0, r) mins(DP[i][j], DP[l][k] + v[rl[j]][rl[k]]);
        }
      }
    }
  }
  ll ans = linf;
  FOR(i, 0, r) mins(ans, DP[(1<<r)-1][i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int exist_int(int N, vector<int> tmp)
{
	int i;
	int keta = log10(N);
	if (log10(N - 1) - (int)log10(N) != (double)0)
		keta++;
	for (i = 0; i < keta; i++)
	{
		int waru = 1;
		int j = 1;
		for (j = 1; j < keta - i; j++)
			waru *= 10;
		int iff = (N / waru) % 10;
		if (find(tmp.begin(), tmp.end(), iff) != tmp.end())
			return 1;
	}
	return -1;
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	//定義
	int i, K;
	int N;
	//入力
	cin >> N >> K;
	vector<int> d(K);
	vector<int> dd(10 - K);
	for (i = 0; i < K; i++)
		cin >> d[i];
	int c = 0;
	for (i = 0; i < 10; i++)
	{
		if (find(d.begin(), d.end(), i) == d.end())
		{
			dd[c] = i;
			c++;
		}
	}
	i = 0;
	int result;
	while (1)
	{
		if (exist_int(N + i, d) == -1)
		{
			result = N + i;
			break;
		}
		i++;
	}

	cout << result;
	return 0;
}

Measured memory_bytes: 4000
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  const items = input.map(v => v.split(" "))
  const num = items[0][0]

  const answer = Math.pow(num / 3, 3)

  console.log(answer)

  //文字列から10進数に変換するときはparseIntを使います
  // const a = parseInt(input[0], 10);
  //出力
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  cout << ((double)d / s <= t ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  char S[222]; cin >> S;
  
  int n = strlen(S);
  for(int i=n-2; i; i-=2) {
    if(strncmp(S, S+i/2, i/2)==0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())

c_b = 0
c_w = S.count('.')
sum = []

for i in S:
        if i == '.':
                c_w = c_w - 1
        sum.extend([c_b+c_w])
        if i == '#':
                c_b = c_b + 1

print(min(sum))


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int f(int n)
{
    return (n % 2 ? 3 * n + 1 : n / 2);
}

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

    int s;
    cin >> s;
    vector<int> a(10000000);
    a[1] = s;
    set<int> st;
    st.insert(s);
    for (int i = 2; i < 10000000; i++)
    {
        a[i] = f(a[i - 1]);
        if (st.find(a[i]) != st.end())
        {
            cout << i << endl;
            return 0;
        }
        st.insert(a[i]);
    }
}


Measured memory_bytes: 39296
import numpy as np
from numba import njit
@njit
def main():
  # Worst Case
  #n,k=100000,100
  #a=[p for p in range(100000)]
  
  kl=[p for p in range(1,k+1)]
  dp=[10**9]*(n)
  dp[0]=0
  for i in range(n):
    for j in kl:
      ij=i+j
      if ij < n:
        m=dp[i]+abs(a[i]-a[ij])
        if m < dp[ij]:
          dp[ij]=m
  return dp[n-1]

n,k=map(int,input().split())
a=np.array(list(map(int,input().split())))
print(main())



Measured memory_bytes: 143824
{-# LANGUAGE TupleSections #-}
import           Control.Arrow     (second)
import           Control.Exception (assert)
import           Data.Char         (isLower)
import           Data.Function     (on)
import qualified Data.Map          as Map (foldl', fromListWith,
                                           intersectionWith)

main :: IO ()
main = do
  n <- readLn :: IO Int
  assert (n >= 1 && n <= 18) $ do
    s <- getLine
    assert (all isLower s && length s == 2 * n) $ print $ f s

f :: String -> Int
f s = Map.foldl' (+) 0 $ (Map.intersectionWith (*) `on` toMap . partitions) front rear
  where
    toMap = Map.fromListWith (+) . map (,1)
    (front, rear) = twoFold s

partitions :: [a] -> [([a], [a])]
partitions []     = [([], [])]
partitions (x:xs) = partitions xs >>= \(ys, zs) -> [(x:ys, zs), (ys, x:zs)]

twoFold :: [a] -> ([a], [a])
twoFold xs = second reverse $ splitAt (length xs `div` 2) xs


Measured memory_bytes: 165116
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する

int main(){
    int n,x,a,b;
    string s;
    cin>>s;
    bool ans = true;
    n = s.length();
    if(n%2!=0){
        ans = false;
    }
    rep(i,n){
        if(i%2==0 && s[i]!='h'){
            ans = false;
        }
        if(i%2!=0 && s[i]!='i'){
            ans = false;
        }
    }
    YN(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 300005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N;
int p[MAXN],pos[MAXN];
int pre[MAXN],f[MAXN],ans[MAXN];
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) {
        read(p[i]);pos[p[i]] = i;
    }
    for(int i = N - 1 ; i >= 1 ; --i) {
        if(ans[i + 1] == 0) {
            if(pos[i] < pos[i + 1]) ans[i] = 0;
            else {ans[i] = 1;f[0] = i + 1;}
        }
        else {
            int t = ans[i + 1] - 1;
            int a[3] = {i,i + 1,f[t]};
            sort(a,a + 3,[](int c,int d){return pos[c] < pos[d];});
            while(a[0] != f[t]) {
                swap(a[2],a[0]);swap(a[1],a[2]);
            }
            if(a[1] == i) {
                ans[i] = ans[i + 1];
            }
            else {
                ans[i] = ans[i + 1] + 1;
                f[t + 1] =  i + 1;
            }
        }
    }
    out(ans[1]);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 4864
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define MOD  1000000007

int main(int argc, char const *argv[]) {
  int i, j, k;
  int N, x[100], y[100], h[100];
  cin >> N;
  for(i=0; i<N; i++) cin >> x[i] >> y[i] >> h[i];

  for(int Cx=0; Cx<=100; Cx++){
      for(int Cy=0; Cy<=100; Cy++){
            int H = -1; // -1:未確定
            int Hmax = 2e9; // h[i]=0である点から要求されるHの上限
            bool success = true;
            for(i=0; i<N; i++){
                int d = abs(Cx-x[i]) + abs(Cy-y[i]);
                if(h[i] > 0){
                    int H2 = h[i] + d;
                    if(H > 0 && H != H2){
                        success = false;
                        break;
                    }

                    else{
                        H = H2;
                    }
                }

                else{
                    Hmax = min(Hmax, d);
                }
            }

            if(success && H <= Hmax){
                cout << Cx << " " << Cy << " " << H << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include<iostream>

using ll = long long;
using namespace std;

ll func(ll b, ll n);

int main() {
	ll n, s;
	cin >> n >> s;
	for (ll i = 2;i <= sqrt(n);i++) {
		if (func(i, n) == s) {
			cout << i << endl;
			return 0;
		}
	}

	for (ll i = (ll)(sqrt(n));i >= 1;i--) {
		if ((i + n - s) >= 0) {
			if ((i + n - s) % i == 0) {
				ll b = (i + n - s) / i;
				if (b > 1) {
					if (n / b == i && func(b, n) == s) {
						cout << b << endl;
						return 0;
					}
				}	
			}
		}
	}
	if (n == s) {
		cout << n + (ll)1 << endl;
		return 0;
	}
	cout << -1 << endl;
}

ll func(ll b, ll n) {
	if (n < b)return n;
	else {
		ll add = n % b;
		return add + func(b, n / b);
	}
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}  

Measured memory_bytes: 256
N = int(raw_input())
G = {}
for i in range(N):
  G[i] = {}
for i in range(N-1):
  a, b, c = map(int, raw_input().split())
  G[a-1][b-1] = G[b-1][a-1] = c
Q, K = map(int, raw_input().split())
K -= 1

d = [0]*N
p = [K]
while len(p)>0:
  v = p.pop()
  for n in G[v].keys():
    if n!=K and d[n]==0:
      d[n] = d[v]+G[v][n]
      p.append(n)

for i in range(Q):
  x, y = map(int, raw_input().split())
  print d[x-1]+d[y-1]

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

int main(){
  int A,B;
  cin >> A >> B;
  if(A>12){
    cout << B << endl;
  }else if(A>5){
    cout << B/2 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

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

int main() {
 int N;
  cin >> N;
  vector<int> T(N+1);
  vector<int> X(N+1);
  vector<int> Y(N+1);
  T.at(0) = 0;
  X.at(0) = 0;
  Y.at(0) = 0;
  for(int i=1; i<=N; i++){
    cin >> T.at(i) >> X.at(i) >> Y.at(i);
  }
  bool can = true;
  for(int i=0; i<N; i++){
    if(T.at(i+1)-T.at(i) < abs(X.at(i+1)-X.at(i)) + abs(Y.at(i+1)-Y.at(i))){
      can = false;
      break;
    }
    if((T.at(i+1)-T.at(i)-X.at(i+1)-Y.at(i+1)+X.at(i)+Y.at(i)) % 2 == 1){
      can = false;
      break;
    }
  }
  if(can) cout << "Yes" << endl;
  else cout <<"No"<< endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
//i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 n;
    cin >> n;

    i64 cnt=0, cnt_max=0;

    for (i64 i=0; i<n; ++i) {
        i64 x, y;
        cin >> x >> y;
        if (x==y) ++cnt;
        else cnt=0;
        cnt_max = max(cnt_max, cnt);
    }

    cout << (cnt_max >= 3 ? "Yes":"No") << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.14159265358979323846
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

/*vector<int> parent, rak;

int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rank[a]+=rank[b];
    }
}*/

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;

//vector<vector<ll>>v;
//vector<ll>vis,d;

int main() {
    IOS;
    cin>>x>>y;
  	cout<<max(x+y,max(2*x-1,2*y-1));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

VI memo[26];

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t; cin >> s >> t;
    int slen = s.length();
    int tlen = t.length();
    REP(i,slen){
        memo[s[i]-'a'].eb(i);
    }
    REP(i,26){
        if(SZ(memo[i]) != 0){
            memo[i].eb(memo[i][0]+slen);
        }
    }

    int loop = 0;
    int now = -1;
    REP(i,tlen){
        int tmp = t[i]-'a';
        if(SZ(memo[tmp]) == 0){
            cout << -1 << endl;
            return 0;
        }

        int idx = *lower_bound(memo[tmp].begin(),memo[tmp].end(),now+1);
        if(idx >= slen){
            loop++;
            now = idx - slen;
        }else{
            now = idx;
        }
    }
    dump(loop)
    dump(now)
    LL ans;
    ans = loop * 1LL * slen + now;
    cout << ans+1 << endl;


}


Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    for (int i=1; i<=9; i++) {
        if (n <= 100*i+10*i+i) {
            cout << 100*i+10*i+i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int a[]={0,1,2,4,7,12,20,29,38,52,73};
int n,w[12][12],b[12];
main()
{
	cin>>n;
	w[1][2]=w[2][1]=1;
	for(int i=3,m=1;i<=n;i++)
	{
		for(int j=1;j<i;j++)w[i][j]=w[j][i]=(m+1)*a[j];
		for(int j=1;j<=i;j++)b[j]=j;
		do
		{
			int s=0;
			for(int j=1;j<i;j++)s+=w[b[j]][b[j+1]];
			m=max(m,s);
		}while(next_permutation(b+1,b+1+i));
	}
	for(int i=1;i<=n;i++,cout<<'\n')
		for(int j=1;j<=n;j++)cout<<w[i][j]<<' ';
}


Measured memory_bytes: 256