akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll m,n;cin>>m>>n;
    const ll mod=1e9+7;
    cout<<modpow(m,n,mod)<<endl;
    return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int x = sc.nextInt();
      sum += 2 * Math.min(Math.abs(x), Math.abs(x - k));
    }

    System.out.println(sum);

  }
}

Measured memory_bytes: 35820
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {
  public static void main(String[] args) {
    int i, j;
    Scanner sc = new Scanner(System.in); 
    int n = Integer.parseInt(sc.next());;
    int r[] = new int[n];
    for (i=0; i<n; i++)
      r[i] = Integer.parseInt(sc.next());;

    //res???max-min???????????????(???????????????mini?????´??°??§???????????¨???????????????)
    int res = r[1] - r[0];
    int mini = r[0];
    for (j=1; j<n; j++) {
      if (res < r[j] - mini) res = r[j] - mini;
      if (r[j] < mini) mini = r[j];
    }

    System.out.println(res);
  }
}

/*
  //O(n^2):TLE
  int res = r[1] - r[0];
  for (i=0; i<n-1; i++)
  for (j=i+1; j<n; j++)
    res = (res < r[j] - r[i]) ? r[j] - r[i] : res; 
  printf("%d\n", res);
*/
   
/*
  //WA(mini???????¨??????´??°?????????maxj-mini????????????????????¨?????????)
  int maxj = r[1];
  int mini = r[0];
  for (j=1; j<n; j++) {
    if (maxj-mini < r[j]-mini) {
    maxj = r[j];
    if (j < n-1 && r[j] < mini) mini = r[j];
    }
  //    if (j < n-1 && r[j] < mini) mini = r[j];
  }
  printf("%d\n", maxj-mini);
*/

Measured memory_bytes: 72376
#include <iostream>
#include <cstring>
#include <algorithm>
#include <unordered_map>

using namespace std;

#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    unordered_map<int,int> h;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int temp;
        cin>>temp;
        h[temp]++;
    }
    int count=0;
    for(auto t:h)
    {
        if(t.first<=t.second)
            count+=t.second-t.first;
        else
            count+=t.second;
    }
    cout<<count;
    cout<<endl;
    return 0;
}


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

int main() {
    int s;
    cin>>s;
    vector<int> vi(1000010,0);
    vi[s]=1;
    for (size_t i = 0; i < 1000011; i++)
    {
        if(s%2==0){s/=2;}
        else {s=s*3+1;}
        if(vi[s]==1){
            cout << i+2<<endl;
            return 0;
        }
        else {
            vi[s]=1;
        }
//        cerr<<s<<endl;
        /* code */
    }
    
    return 0;
}

Measured memory_bytes: 4096
//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#define SZ(x) ((int)(x).size())
#define all(x)  x.begin(),x.end()
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define tt int t;cin >> t;while(t--)
#define int3(x,y,z) int x,y,z;cin >> x >> y >> z;
#define int2(x,y) int x,y;cin >> x >>y;
#define int1(x) int x;cin>>x;
#define vi vector<int>
#define vii vector<vector<int>>
typedef long long ll;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//bool cmp(pair<string,int>p1,pair<string,int>p2) {
//    return p1.ss > p2.ss;
//}
//if (s1.find(s2) != std::string::npos) {
//   std::cout << "found!" << '\n';
//}


using namespace std;

void bfs(int sn,vector<vi>adj,int n, int *level) {
    queue<int>q;
    q.push(sn);
    level[sn] = 0;
    bool vis[n+1];
    memset(vis,false,sizeof(vis));
    vis[sn] = true;
    while(!q.empty()) {
        int p = q.front();
        q.pop();
        for (int t = 0; t < adj[p].size(); ++t) {
            if(!vis[adj[p][t]]) {
                level[adj[p][t]] = level[p]+1;
                q.push(adj[p][t]);
                vis[adj[p][t]] = true;
            }

        }
    }

}
int main() {
    fio
    int3(n,x,y)
    vector<vi>adj(n+1);

    for (int i = 1; i < n; ++i) {
        adj[i].push_back(i+1);
        adj[i+1].push_back(i);
    }
    adj[x].pb(y);
    adj[y].pb(x);
    map<int,int> levels;
    int level[n+1];
    memset(level,0,sizeof(level));
    for (int j = 1; j < n; ++j) {
        bfs(j, adj, n, level);
        for (int i = j; i <= n; ++i) {
            levels[level[i]]++;
        }
        memset(level,0,sizeof(level));

    }
    for (int l = 1; l <= n-1; ++l) {

        cout << levels[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 640
N, M = map(int, input().strip().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().strip().split())

shop_list = [[0 for i in range(2)] for j in range(N)]
for i in range(N):
    shop_list[i][0] = A[i]
    shop_list[i][1] = B[i]

shop_list.sort()

count = 0
money = 0
for i in range(N):
    if count + shop_list[i][1] < M:
        money += shop_list[i][0] * shop_list[i][1]
        count += shop_list[i][1]
    else:
        for j in range(shop_list[i][1]):
            if count == M:
                break
            money += shop_list[i][0]
            count += 1

print(money)

Measured memory_bytes: 23212
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	int M = 1000000007;

	int N = 'z' - 'a' + 1;
	long[] a = new long[N];

	string s = ReadLine();
	for (int i = 0; i < n; i++)
	{
	    char c = s[i];
	    a[c - 'a']++;
	}

	long x = 1;
	for (int i = 0; i < N; i++)
	{
	    if (a[i] > 0)
		x = x * (a[i] + 1) % M;
	}

	x = (x + M - 1) % M;
	WriteLine(x);
    }
}


Measured memory_bytes: 11232
function Main(input){
  A = input.trim();
  ans = '';
  switch(A){
    case 'A' : ans = 'T';break;
    case 'T' : ans = 'A';break;
    case 'G' : ans = 'C';break;
    case 'C' : ans = 'G';break;
    default : break;
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf-8"));


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

int main(){
    constexpr long MOD = 1000000007;
    long N;
    cin >> N;
    long dp{N};
    vector<long> sum(N + 3, (N - 1) * N % MOD);
    sum[0] = 0;
    for(long i = 3; i != N + 3; ++i)sum[i] = (sum[i - 1] - 1 + ((dp += sum[i - 3]) %= MOD)) % MOD;
    cout << dp << endl;
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;
  cin >> n;
  int ans = 0;
  for(int i=1;i<=n;i+=2){
    int c = 0;
    for(int j=1;j<=i;j++){
      if(i%j==0) c++;
    }
    if(c==8)ans++;
  }
  cout << ans fin;

  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(long i=0;i<n;i++)
using namespace std;
 
int main() {
  long n,k,sum=0;
  cin>>n>>k;
  vector<long> h(n);
  rep(i,n){
    cin>>h[i];
    
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  if(k<n){
    for(long i=k;i<n;i++){
    sum+=h[i];
    }
  cout<<sum<<endl;
  }
  else{
    cout<<0<<endl;
  }
}


Measured memory_bytes: 1792
#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>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    x -= z;
    cout << x/(y+z) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

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

  int sum[2] = {0, 0};
  int t = 0;
  for (int i = 0; i < n; i++) {
    sum[t] += A[i];
    t = (t + 1) % 2;
  }
  cout << sum[0] - sum[1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
map<string,int>m;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int x;
    cin>>x;
    string s;

    for (int i=0;i<x;i++)
    {
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    ll ans=0,n;
    for (auto j=m.begin();j!=m.end();j++){
        n=j->second;
        ans+=(n*(n+1)/2-n);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <cmath>
#include <vector>
#include <utility>

using namespace std;

int main(){
    while(true){
        int x,y,s;
        cin >> x >> y >> s;
        if(x==0)break;
        x+=100;
        y+=100;
        int maxc=0;
        for(int i=1;i<s;i++){
            int c1=i*100/x;
            for(int j=1;j<s;j++){
               int c2=j*100/x;
               if(c1*x/100+c2*x/100==s){
                   if(maxc<c1*y/100+c2*y/100){
                       maxc=c1*y/100+c2*y/100;
                   }
               }
           }
       }
       cout << maxc << endl;
                
            
    }
    return 0;
}

Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define pii pair<ll, ll>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i, a, b) for (ll i = a; i <= (ll)b; ++i)
#define per(i, a, b) for (ll i = a; i >= (ll)b; --i)
#define ll long long
#define lowbit(x) ((x) & (-x))
#define debug(...) fprintf(stderr, __VA_ARGS__)
inline int __gcd(int a,int b) {return b>0 ? __gcd(b,a%b):a;}

const int mod=1e9+7;
const int maxn=1e5+5;

vector<ll>ans;
void dfs(int u,int len,ll num,int step)
{
    if(step==len){
        ans.pb(num);
        //cout<<num<<endl;
        return ;
    }
    //cout<<num<<endl;
    if(u<9) dfs(u+1,len,num*10+(u+1),step+1);
    if(u>0) dfs(u-1,len,num*10+(u-1),step+1);
    dfs(u,len,num*10+u,step+1);
}
void solve()
{
   int n; cin>>n;

   rep(i,1,10){
       rep(j,1,9) dfs(j,i,j,1);
   }
   //ans.pb(0);
   sort(ans.begin(),ans.end());
   cout<<ans[n-1]<<"\n";
}
int main()
{
    #ifndef local
    IOS
    #endif
    cout<<fixed<<setprecision(10);
    int t=1; 
    //cin>>t; 
    while(t--) {
        solve();
    }
}




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

int main()
{
    string last;
    cin >> last;
    if (last == "ABC")
    {
        puts("ARC");
    }
    else
    {
        puts("ABC");
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
  ll K,A,B,C,G;cin>>A>>B>>C;
  G=max(A,max(B,C));
  K=3*G-A-B-C;
  if(K%2!=0){
    K+=3;
  }
  cout << K/2 << endl;
}

Measured memory_bytes: 256
use std::io;
use std::io::BufRead;

const MOD: u64 = 1_000_000_007;


fn main() {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    
    let (n,m) = {
        let mut s = String::new();
        stdin.read_line(&mut s).unwrap();
        let mut s = s.trim().split_whitespace();
        (
            s.next().unwrap().parse::<usize>().unwrap(),
            s.next().unwrap().parse::<usize>().unwrap(),
        )
    };
    if m == 0 { println!("{}", fibonacci(n).last().unwrap()%MOD); return; }

    let a: Vec<usize> = {
        let mut a = Vec::new();
        for _ in 0..m {
            let mut s = String::new();
            stdin.read_line(&mut s).unwrap();
            a.push(
                s.trim().parse::<usize>().unwrap()
            );
        }
        a
    };


    let mut lag: Vec<usize> = vec![ a[0]-1 ];
    
    for i in 0..m-1 {
        let l = a[i+1] - a[i];
        if l == 1 { println!("0"); return; }
        lag.push( l-2 );
    }
    lag.push( n-a[m-1]-1 );

    let phi: Vec<u64> = fibonacci( *lag.iter().max().unwrap() );

    let mut prod: u64 = 1;
    for (i,l) in lag.iter().enumerate() {
        // prod *= phi[*l];
        
        // if i%8 == 0 {
        //     prod = prod % MOD;
        // }
        prod = prod * phi[*l] % MOD;
    }

    println!("{}", prod%MOD );
}



fn fibonacci( n: usize ) -> Vec<u64> {
    let mut phi: Vec<u64> = vec![ 1, 1 ];

    for i in 2..n+1 {
        let sum = phi[i-2] + phi[i-1];

        if sum >= MOD {
            phi.push( sum-MOD )
        } else {
            phi.push(sum);
        }
    }
    phi
}


Measured memory_bytes: 4352
from bisect import bisect_left
N = int(input())
X = list(map(int,input().split()))
Y = X.copy()
Y.sort()
for i in range(N):
    k = bisect_left(Y,X[i])
    if k < N//2:
        print(Y[N//2])
    else:
        print(Y[N//2-1])

Measured memory_bytes: 25228
///**Bismillahir Rahmanir Rahim.**

#include <bits/stdc++.h>
#define clr(a, v)             memset(a, v, sizeof a)
#define all(v)                v.begin(), v.end()
#define ast(v)                sort(v.begin(),v.end())
#define dst(v)                sort(v.begin(),v.end(), greater <int> ())
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ass(tmp, v)           tmp.assign(v.begin(), v.end())
#define rep(i, l, r)          for (int i = l; i < r; i++)
#define rep2(i, l, r)         for (int i = l-1; i >= r; i--)
#define sf(n)                 scanf("%d", &n)
#define sff(n, m)             scanf("%d %d",&n,&m)
#define sfl(n)                scanf("%lld", &n)
#define sfu(n)                scanf("%llu", &n)
#define sffl(n, m)            scanf("%lld %lld",&n,&m)
#define sfff(n, m, o)         scanf("%d %d %d",&n,&m, &o)
#define pf(n)                 printf("%d", n)
#define sp                    printf(" ")
#define nl                    printf("\n")
#define prln(n)               printf("%d\n", n)
#define pfl(n)                printf("%lld", n)
#define pfu(n)                printf("%llu", n)
#define pb                    push_back
#define pii                   pair<int,int>
#define mp                    make_pair
#define S                     second
#define F                     first
#define PI                    3.1415926

struct greaters
{
    bool operator()(const long& a, const long& b) const
    {
        return a > b;
    }
};

//-----------------------------------***********************----------------------------------------------//


typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
const int N = 200050;
const int mod = 1e9+7;


int main()
{
    //freopen("test.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fast;
    int tcase = 1, cas = 0;
    while(tcase--)
    {
		int n;
      string s;
      cin >> n >> s;
      if(n < 3200) cout << "red" << '\n';
       else cout << s << '\n';

        ///printf("%d : %lld\n", ++cas, ans);
    }
    return 0;

}

//-----------------------------------***********************----------------------------------------------//


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(998244353)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e18
#define EPS 1e-9
#define int long long
#define MAX 100009
int fun(int arr[], int n){
	/*if(n == 1) return 0LL;
	if(n == 2) return abs(arr[n]-arr[n-1]);
    return min(abs(arr[n]-arr[n-1]) + fun(arr, n-1), abs(arr[n]-arr[n-2]) + fun(arr, n-2));*/
	int dp[n+1];
	dp[1] = 0LL; dp[2] = abs(arr[2]-arr[1]);
	for(int i = 3; i <= n; i++){
		dp[i] = min(abs(arr[i]-arr[i-1]) + dp[i-1], abs(arr[i]-arr[i-2]) + dp[i-2]);
	}
	return dp[n];
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
	int T=1;
	//cin >> T;
	FOR1(i, T)
	{
		//cout << "Case #" << i << ": \n";
		int n; cin >> n;
        int a[n+1];
        FOR1(i, n) cin >> a[i];
        cout << fun(a, n);
		cout<<'\n';
	}
	return 0;
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; i++)
#define repn(i, st, ed) for(ll i=st; i<=ed; i++)
#define repb(i, ed, st) for(ll i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
vector<int> g[N];
int n, k;
ll dfs(int curr, int par)
{
	int i = 2;
	ll a = 1;
	for(int x: g[curr])
	{
		if(x != par)
		{
			a = (a * dfs(x, curr)) % M;
			a = (a * (k - i)) % M;
			i++;
		}
	}
	return a;
}

int main()
{
	
	cin>>n>>k;
	bool flag = true;
	rep(i, 1 ,n)
	{
		int u, v;
		cin>>u>>v;
		g[u].pb(v);
		g[v].pb(u);
		if(g[u].size() >= k) flag = false;
		if(g[v].size() >= k) flag = false;
	}
	if(flag == false)
	{
		cout<<0<<endl;
		return 0;
	}
	ll ans = k;
	int i = 1;
	for(int x: g[1])
	{
		ll c = dfs(x, 1);
		c = (c * (k - i)) % M;
		ans = (ans * c) % M;
		i++;
	}
	cout<<ans<<endl;
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll L, R;
    cin >> L >> R;

    ll m = INT_MAX;
    for(ll i = L ; i < R && i < (L+2019); i++ ){
        for( ll j = i+1; j <= R && j < ((i+1)+2019); j++ ){
            m = min(m, ((i*j)%2019));
        }
    }

    cout << m << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<pair<pair<string, int>, int>> v(n);
    rep(i, n)
    {
        cin >> v[i].first.first >> v[i].first.second;
        v[i].first.second *= -1;
        v[i].second = i + 1;
    }
    sort(all(v));
    rep(i, n) cout << v[i].second << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int d = scanner.nextInt(), t = scanner.nextInt(), s = scanner.nextInt();
			System.out.println((d <= t * s) ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 35644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    ll ans = (n + (a - 1)) / a;
    ans = max(ans + 1, (n + (b - 1)) / b + 1);
    ans = max(ans + 1, (n + (c - 1)) / c + 2);
    ans = max(ans + 1, (n + (d - 1)) / d + 3);
    ans = max(ans + 1, (n + (e - 1)) / e + 4);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eb emplace_back
#define pb pop_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define sz(x) (int)x.size()
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define itn int
#define vpii vector<pii>
#define pdd pair<double,double>
#define vll vector<ll>

typedef long long ll;

using namespace std;

bool is_prime(ll x) {
	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a, b;
	cin >> a >> b;
	vector <ll> d;
	for (ll i = 1; i * i <= a; i++) {
		if (a % i == 0) {
			if (b % i == 0) {
				d.eb(i);
			}
			ll x = a / i;
			if (b % x == 0) {
				d.eb(x);
			}
		}
	}
	sort(all(d));
	d.resize(unique(all(d)) - d.begin());
	int ans = 0;
	for (auto x : d) {
		if (is_prime(x)) {
			ans++;
		}
	}
	cout << ans;
	return 0;
}


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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	int n;
	int a[200000] = {};
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int k;
		cin >> k;
		a[k]++;
		a[k + 1]++;
		a[k + 2]++;
	}
	int m = 0;
	for (int i = 0; i < 200000; ++i) {
		m = max(a[i], m);
	}
	cout << m << endl;
}


Measured memory_bytes: 1024
#line 1 "test/algebra/mint_pow.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B"

#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint mod = 1000000007;

#line 1 "test/algebra/../../library/algebra/mint.cpp"
struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }
#line 9 "test/algebra/mint_pow.test.cpp"

int main() {
    lint m, n;
    cin >> m >> n;
    cout << mint(m).pow(n) << "\n";
    return 0;
}



Measured memory_bytes: 3100
a = gets.split.map{|s|s.to_i}.sort

t1 = t2 = 0

3.times do |i|
  t1 += (a[i-1]- a[i]).abs if i != 0
  t2 += (a[-i] - a[-(i+1)]).abs if i != 0
end

puts [t1, t2].min

Measured memory_bytes: 3836
def main():
    n = int(input())
    ls = [int(x) for x in input().split()]
    if n==1:
        print(1)
    else:
        right,left = 0,1
        cnt = 0
        flg = 0
        while 1:
            now = ls[left]
            nex = ls[right]   
            if now<nex:
                if flg ==-1:
                    cnt +=1
                    flg = 0
                else:
                    flg = 1
                left +=1
                right +=1
            elif nex==now:
                left +=1
                right +=1         

            else:
                if flg ==1:
                    cnt += 1
                    flg = 0
                else:
                    flg = -1
                left +=1
                right +=1

            if right==n-1:
                cnt +=1
                break
        print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
bool vis[N];
int main(){
	int k,x=0;scanf("%d",&k);
	for(int i=1;;i++){
		x=(x*10+7)%k;
		if(vis[x])break;
		if(!x)return printf("%d\n",i),0;
		vis[x]=1;
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 4692
package main

import (
	"fmt"
)

func main() {
	var n, t, tt, x, tx, y, ty int
	res := true
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&tt, &tx, &ty)
		for tt != t {
			if x < tx {
				x++
			} else if x > tx {
				x--
			} else if y < ty {
				y++
			} else {
				y--
			}
			t++
		}
		if !(tx == x && ty == y) {
			res = false
		}
	}

	if res {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 5504
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long
#define MAX 10001

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

int main(void){
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    if(n==1){
        printf("0\n");
        return 0;
    }
    qsort(a,n,sizeof(int),cmpfunc);
    printf("%d\n",a[n-1]-a[0]);
    return 0;
}


Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

h,w,k=mii()

arr=[list(ss()) for _ in range(h)]
mat1=[[0]*w for _ in range(h)]
height=[]
cnt1=0
chk1=True
tmp1=1
for i in range(h):
    if "#" in arr[i]:
        if chk1!=True:
            height.append(tmp1)
            tmp1=1
            cnt1+=1
        
        for j in range(w):
            mat1[i][j]=cnt1
        chk1=False
        
    else:
        for j in range(w):
            mat1[i][j]=cnt1
        tmp1+=1
height.append(tmp1)
#print(height)

ans=[[0]*w for _ in range(h)]

start=0
tmp=1
chk=False
for i in height:
    for j in range(w):
        if "#" in [arr[p][j] for p in range(start,start+i)]:
            if chk!=False:
                tmp+=1
            for k in range(start,start+i):
                ans[k][j]=tmp
            chk=True
        else:
            for k in range(start,start+i):
                ans[k][j]=tmp
    tmp+=1
    start+=i
    chk=False
    
for j in range(h):
    print(*ans[j])               




        

Measured memory_bytes: 11028
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	var stack []string
	for sc.Scan() {
		i := sc.Text()
		if i == "+" || i == "-" || i == "*" {
			a, _ := strconv.Atoi(stack[len(stack)-2])
			b, _ := strconv.Atoi(stack[len(stack)-1])
			if len(stack) > 2 {
				stack = stack[:len(stack)-2]
			} else {
				stack = []string{}
			}
			if i == "+" {
				stack = append(stack, strconv.Itoa(a+b))
			} else if i == "-" {
				stack = append(stack, strconv.Itoa(a-b))
			} else if i == "*" {
				stack = append(stack, strconv.Itoa(a*b))
			}
		} else {
			stack = append(stack, i)
		}
	}
	fmt.Println(stack[0])
}



Measured memory_bytes: 1124
#include <iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
   int n,a,b;
   scanf("%d%d%d",&n,&a,&b);
   if(n==1)
   {
       if(a==b)
        printf("1\n");
       else
       {
           printf("0\n");
       }
   }
   else
   {
       if(a>b)
        printf("0\n");
       else
        printf("%lld\n",(long long)(n-2)*(b-a)+1);
   }

    return 0;
}


Measured memory_bytes: 256
(* O(n) *)
let kMax = 100000 + 10
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ns = Array.make (kMax + 1) 0
let f a =
  for i = 0 to 2 do ns.(a + i) <- ns.(a + i) + 1 done
let _ =
  Array.iter f a_s;
  Array.fold_left max 0 ns |> Printf.printf "%d\n"

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

using namespace std;

#define ll long long
#define pb push_back
#define all(s) s.begin(), s.end()

const int inf = (int)1e6 + 7;

ll n, a, ans;

bool check (int x, int k) {
    ll u = 1;
    for (int i = 0; i <= k; i++) {
        u *= x;
        if (u >= n) return true;
    }
    return false;
}

main() {
    scanf ("%lld %lld", &n, &a);
    ans = n;
    for (int i = 1; i <= 40; i++) {
        int l = 1, r = inf;
        ll x = i * a;
        while (r - l > 1) {
            int mid = (l + r) >> 1;
            if (check(mid, i)) {
                r = mid;
            } else {
                l = mid;
            }
        }
        ll u = 1;
        for (int j = 0; j <= i; j++) u *= l;
        x += (i + 1) * l;
        for (int j = 0; j <= i; j++) {
            u /= l;
            u *= r;
            x++;
            if (u >= n) break;
        }
        ans = min(ans, x);
    }
    cout << ans;
}


Measured memory_bytes: 256
#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(){
  string S;
  cin >> S;
  
  rep(i,S.size()){
    S.at(i) = 'x';
  }
  
  cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	long long x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	long long n = x / d, r = x % d;
	if (n > k) cout << (x - k * d);
	else if ((k - n) % 2) cout << abs(d - r);
	else cout << r;
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans = 0;
  for (int i = 1; i + 1 < n; i++) {
    ans += (arr[i] > arr[i - 1]) ^ (arr[i] > arr[i + 1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=LLONG_MAX,mod=1000000007,BS,k;

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n;cin>>n;ll arr[n],ans=0;
        for(ll i=0;i<n;i++)cin>>arr[i];
        for(ll i=0;i<n;i++){
            for(ll j=i+1;j<n;j++){
                for(ll k=j+1;k<n;k++){
                    if(arr[i]==arr[j]||arr[i]==arr[k]||arr[j]==arr[k])continue;
                    if(max(arr[i],max(arr[j],arr[k]))<min(arr[i],min(arr[j],arr[k]))+arr[i]+arr[j]+arr[k]-min(arr[i],min(arr[j],arr[k]))-max(arr[i],max(arr[j],arr[k])))
                    ans++;
                }
            }
        }
        cout<<ans;

}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
long long t[600001];
int h[200001];
long long query(int index,int lb,int rb,int lq,int rq)
{
	if(rb==lb||lq==lb&&rq==rb)
		return t[index];
	int mid=(lb+rb)/2;
	if(rq<=mid)
		return query(index*2,lb,mid,lq,rq);
	else if(lq>mid)
		return query(index*2+1,mid+1,rb,lq,rq);
	else
		return max(query(index*2,lb,mid,lq,mid),query(index*2+1,mid+1,rb,mid+1,rq));
}
void update(int index,int lb,int rb,int leaf_id,long long value)
{
	if(lb==rb&&lb==leaf_id)
	{
		t[index]=value;
		return;
	}
	int mid=(lb+rb)/2;
	if(leaf_id>mid)
	{
		t[index]=max(t[index],value);
		update(index*2+1,mid+1,rb,leaf_id,value);
	}
	else
	{
		t[index]=max(t[index],value);
		update(index*2,lb,mid,leaf_id,value);
	}
}
int main()
{
	int i,n,a;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&h[i]);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		update(1,1,n,h[i],query(1,1,n,1,h[i]-1)+a);
		//query(1,1,n,1,h[i]-1);
	}
	printf("%lld",t[1]);
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) (find(all(v),x)!=v.end())
#define incls(s,c) (s.find(c)!=string::npos)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(all(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
inline ll lin() { ll x; scanf("%lld",&x); return x;}
inline char chin() { char x; scanf("%c",&x); return x;}
inline string stin() { string x; cin >> x; return x;}
inline double din() { double x; scanf("%lf",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  int ans = 0;
  rep(i,1000) {
    int c[3] = {i/100, i/10%10, i%10};
    int f = 0;
    rep(j,n) {
      if (s[j] == '0'+c[f]) f++;
      if (f == 3) break;
    }
    if (f == 3) ans++;
  }

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    int a[n+1],b[n+1];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        b[a[i]-1]=i+1;
    }
    for(i=0;i<n;i++)
    {
        printf("%d ",b[i]);
    }
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long int ll;
using namespace std;
int main ()
{
  ll n, sum=0;
  cin >> n;
  for(int i=0; i <= n; i++){
    if(i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3640
#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;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().strip().split()))

v = sorted(v, reverse=True)

while len(v) > 1:
    a = v.pop(-1)
    b = v.pop(-1)
    c = (a + b) / 2
    v.append(c)
    v = sorted(v, reverse=True)

last = v[0]
print(last)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
        int i, j;
        int m, n, target[100], name, point[100], miss;

        scanf("%d%d", &n, &m);
        for(i=0;i<m;i++){
                scanf("%d", &target[i]);
                target[i]--;
        }
        for(i=0;i<n;i++)point[i]=0;

        for(i=0;i<m;i++){
                miss = 0;
                for(j=0;j<n;j++){
                        scanf("%d", &name);name--;
                        if(name == target[i]) point[j]++;
                        else miss++;
                }
                point[target[i]] += miss;
        }
        
        for(i=0;i<n;i++)printf("%d\n", point[i]);
        return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

signed main() {
  int N;
  string s;
  cin >> N >> s;
  
  map<char, int> m;
  REP(i, N) m[s[i]]++;

  int ans = 1;
  for(auto p : m) ans = (ans*(p.second+1))%MOD;

  cout << ans-1 << endl;

  return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int n;
  S(n);
  int ans = 0, cnt = 0;
  rep(i,1,n+1) {
    int x;
    S(x);
    if(x == i) {
      cnt++;
    } else {
      if(cnt) {
        cnt = 0;
        ans++;
      }
    }
    if(cnt == 2) {
      cnt = 0;
      ans++;
    }
  }
  if(cnt) ans++;
  P(ans);
  return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (b==1){
    cout << 0 << endl;
    return 0;
  }
  int sockets = a;
  int count = 1;
  while (sockets < b) {
    count++;
    sockets += a - 1;
  }
  cout << count << endl;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String h = "2019/04/30";
        if (s.compareTo(h) == 1) {
            System.out.println("TBD");
        } else {
            System.out.println("Heisei");
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

int main() {
    ll n;
    cin >> n ;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<ll> sim(n);
    sim[0] = 0;
    for(int i = 1; i < n; i++){
        sim[i] = 2*a[i-1] - sim[i-1];
    }
    sim[0] = a[n-1] - (sim[0]+sim[n-1])/2;
    for(int i = 1; i < n; i++){
        sim[i] = 2*a[i-1] - sim[i-1];
    }
    for(int i = 0; i < n; i++){
        cout << sim[i] << " ";
    }
    cout << endl;
    return 0;

}


Measured memory_bytes: 2944
from time import time
start = time()
from random import randrange

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

for i in range(n):
    if A[i] != B[i]:
        continue
    while time() - start < 1.9:
        j = randrange(n)
        if A[i] != B[j] and A[j] != B[i]:
            B[i], B[j] = B[j], B[i]
            break
    else:
        print("No")
        exit(0)

print("Yes")
print(*B)

Measured memory_bytes: 124372
import java.util.Scanner;

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

	int d = scan.nextInt();

	switch(d){
	case 22:
	    System.out.println("Christmas Eve Eve Eve");
	    break;
	case 23:
	    System.out.println("Christmas Eve Eve");
	    break;
	case 24:
	    System.out.println("Christmas Eve");
	    break;
	default:
	    System.out.println("Christmas");
	    break;
	}
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) cin >> a.at(i);
    auto mx = max_element(a.begin(), a.end()), mn = min_element(a.begin(), a.end());
    if (*mx <= 0) {
        cout << n - 1 << '\n';
        for (int i = n; i > 1; --i) cout << i << ' ' << i - 1 << '\n';
    } else if (*mn >= 0) {
        cout << n - 1 << '\n';
        for (int i = 1; i < n; ++i) cout << i << ' ' << i + 1 << '\n';
    } else {
        int cnt = 0;
        ostringstream s;
        if (*mx >= -*mn) {
            for (int i = 1; i <= n; ++i) if (a.at(i) < 0) {
                ++cnt;
                s << mx - a.begin() << ' ' << i << '\n';
            }
            cout << cnt + n - 1 << '\n' << s.str();
            for (int i = 1; i < n; ++i) cout << i << ' ' << i + 1 << '\n';
        } else {
            for (int i = 1; i <= n; ++i) if (a.at(i) > 0) {
                ++cnt;
                s << mn - a.begin() << ' ' << i << '\n';
            }
            cout << cnt + n - 1 << '\n' << s.str();
            for (int i = n; i > 1; --i) cout << i << ' ' << i - 1 << '\n';
        }
    }
    return 0;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c, d;

  cin >> a >> b >> c >> d;
  
  int x = c - a;
  int y = d - b;

  cout << c - y << ' ' << d + x << ' ' << a - y << ' ' << b + x << endl;
  return 0;
}


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

using namespace std;

int main(void){
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    int sum = 0;
    for(int i=0;i<k;i++){
        sum += l[n-i-1];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256