akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;

int main() {
    long N, K;
    cin>>N>>K;
    vector<long> A, F;
    long tmp;
    for(int i=0;i<N;++i){
        cin>>tmp;
        A.push_back(tmp);
    }
    for(int i=0;i<N;++i){
        cin>>tmp;
        F.push_back(tmp);
    }
    sort(A.begin(), A.end());
    sort(F.begin(), F.end());
    vector<long> time;
    for(int i=0;i<N;++i){
        time.push_back(A[i]*F[N-1-i]);
    }
    long r = 0;
    for(int i=0;i<N;++i){
        if(time[i]>r) r=time[i];
    }
    long l = 0;
    long middle;
    long trainnum;
    while(l<r){
        middle = (l+r)/2;
        trainnum = 0;
        for(int i=0;i<N;++i){
            if(time[i]>middle){
                if((time[i]-middle)%F[N-1-i]==0){
                    trainnum += (time[i]-middle)/F[N-1-i];
                }
                else trainnum += (time[i]-middle)/F[N-1-i] + 1;
            }
        }
        if(trainnum > K) l = middle+1;
        else r = middle;
    }
    cout<<l<<endl;
}


Measured memory_bytes: 6384
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	n%=10;
	char*s;
	switch(n){
		case 3:
			s="bon";
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			s="pon";
			break;
		default:
			s="hon";
	}
	puts(s);
}

Measured memory_bytes: 1660
#! /usr/bin/env python
# coding: utf-8

import numpy as np
import math

def slove(a, b):
    return math.ceil((a + b)/2)

if __name__ == "__main__":
    ab = input().split()
    a = int(ab[0])
    b = int(ab[1])
    print(slove(a, b))


Measured memory_bytes: 21984
inp=input()
arr1=inp.split(" ")
arr2=list(map(int,input().strip().split()))[:2]
inp1=input()
if(inp1==arr1[0]):
    arr2[0]-=1
elif(inp1==arr1[1]):
    arr2[1]-=1
print(arr2[0],arr2[1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int lint;
 
int main(){
    lint n, x;
    cin >> n >> x;
    lint arr[n];
    for(int i=0; i<n; i++){
        cin >> arr[i];
    }
    lint cntr = 0;
    lint sonuc = 0;
    for(int i=0; i<n; i++){
        
        cntr+=arr[i];
        if(cntr <= x)
            sonuc++;
        
    }
    cout << sonuc+1;
    return 0;
}

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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005

void add_slef(int &a, int b, int mod = 0) {
    a += b;
    if(mod > 0 && a >= mod) a -= mod;
}

void sub_slef(int &a, int b, int mod = 0) {
    a -= b;
    if(mod > 0 && a < 0) a += mod;
}

/*vector<string> split(string s, string del) {
        vector<string> ans;
        if(s.size() == 0) {
            return ans;
        }
        size_t pos = 0;
        while(pos = (s.find(del) != string::npos)) {
            string str = s.substr(0, pos);
            ans.push_back(str);
            s.erase(0, pos + del.size());
        }
        return ans;
}*/


/* So problem is to combine two adjuscent value into one 


so it is binary tree to combine and get the result at the root node. but we can create multiple binary tree and which 
would give us min value that is our answer
so at rang l to r we need to fine a k where l, k and k+1,r is min value than l, r
dp[l][r] -> min value of range in bianry tree
 */

const int nax = 405;
const int64 inf = 1e18+5;

int64 dp[nax][nax];
int main(int argc, char const *argv[])
{
    /* code */
    int n;
    cin >> n;
    vector<int> a(n+1);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<int64> ps(n, 0);
    ps[0] = a[0];
    for(int i = 1; i < n; i++) ps[i] += ps[i-1] + a[i];
    auto sum = [&](int L, int R) {
        int64 ans = 0;
        for(int i = L; i <= R; i++) ans += a[i];
        return ans;
    };

    for(int L = n-1; L >= 0; L--) {
        for(int R = L; R < n; R++) {
            if(L == R) {
                dp[L][R] = 0;
            } else {
                dp[L][R] = inf;
                int64 s = sum(L, R);
                for(int i = L; i < R; i++) {
                    dp[L][R] = min(dp[L][R], dp[L][i] + dp[i+1][R] + s);
                }
            }
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        if((n*a)<= b){
            System.out.println(n*a);
        }
        else{
            System.out.println(b);
        }
    }
    
}

Measured memory_bytes: 24020
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);

void solve() {
    int a,b;cin>>a>>b;
    int ans=a/b;
    if(a%b!=0)ans++;
    cout<<ans<<endl;
}
int32_t main() {
    IOS;
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 256
s = input()
t = input()
x = len(s)
y = len(t)
dp = [[0 for _ in range(y+1)] for _ in range(x+1)]

for i in range(x):
	for j in range(y):
		if s[i]==t[j]:
			dp[i+1][j+1] = 1+dp[i][j]
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])
i = x
j = y
ans = ''
while i*j!=0:
	if (dp[i][j] == 1 + dp[i-1][j-1]) and (s[i-1]==t[j-1]):
		ans = s[i-1] + ans
		i-=1
		j-=1
			
	else:	
		if dp[i][j] == dp[i-1][j]:
			i-=1
		elif dp[i][j] == dp[i][j-1]:
			j-=1

print(ans)

Measured memory_bytes: 152964
s = input()

ans = 'Second'
idx = 1
while(True):
    if s[idx-1] == s[idx+1] or idx == 0:
        idx += 1
    else:
        s = s[:idx]+s[idx+1:]
        idx -= 1
        if ans == 'First': ans = 'Second'
        else: ans = 'First'
        # print(s, idx)
    if idx == len(s)-1:
        break

print(ans)
    



Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
int main()
{
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    bool reversed = false;
    string top = "";
    string bot = "";
    REP(i, Q) {
        int T;
        cin >> T;
        if(T == 1) {
            reversed = !reversed;
        } else {
            int F;
            cin >> F;
            string C;
            cin >> C;
            if(F == 1) {
                if(!reversed) {
                    top += C;
                } else {
                    bot += C;
                }
            } else {
                if(!reversed) {
                    bot += C;
                } else {
                    top += C;
                }
            }
        }
    }
    string ans = "";
    IREP(i, top.size()) ans += top[i];
    ans += S;
    REP(i, bot.size()) ans += bot[i];
    if(reversed) {
        string tmp = ans;
        ans = "";
        IREP(i, tmp.size()) ans += tmp[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1664
fn main(){
  let av: Vec<i64> = read_vec();
  let a = av[0];
  let v = av[1];
  let bw: Vec<i64> = read_vec();
  let b = bw[0];
  let w = bw[1];
  let t: i64 = read();
  println!("{}", if v > w && (a - b).abs() <= (v - w) * t {"YES"} else {"NO"});
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}


Measured memory_bytes: 2104
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
string s;
int i;
int func(int a){
	vector<int>in;
	for(i=a;i<1e10;i++){
		if(s[i]==']')break;
		if(s[i]=='['){
			int q=i+1;
			in.pb(func(q));
		}
		if(isdigit(s[i])){
			int out=0;//s[i]-'0';
			while(isdigit(s[i])){
				out*=10;
				out+=s[i]-'0';
				i++;
			}
			return out/2+1;
		}
	}
	//rep(j,in.size())cout<<" "<<in[j];
	//cout<<endl;

	sort(all(in));
	int sum=0;
	rep(j,in.size()/2+1)sum+=in[j];
	return sum;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		i=0;
		cin>>s;
		int q=1;
		cout<<func(q)<<endl;
	}
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
 
using namespace std;
 
bool check(string& s)
{
    while (s != "ABC") {
        int N = s.size(), p = 0;
        string ns;
        for (int i = 0; i < N; i++) {
            if (i < N - 2 && s.substr(i, 3) == "ABC") {
                i += 2;
                ns += "#";
                p++;
            } else {
                ns += s[i];
            }
        }
 
        if (p == 0) return 0;
        vector<bool> exist(3);
        for (int i = 0; i < (int)ns.size(); i++) {
            if (ns[i] == '#') continue;
            exist[ns[i] - 'A'] = 1;                
        }
 
        if (exist[0] + exist[1] + exist[2] != 2) return 0;
        char c = (exist[0] == 0 ? 'A' : exist[1] == 0 ? 'B' : 'C');
        for (int i = 0; i < (int)ns.size(); i++) {
            if (ns[i] == '#') {
                ns[i] = c;
            }
        }
        s = ns;
    }
    return 1;
}
 
int main()
{
    string s;
    cin >> s;
    cout << (check(s) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3240
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k,n;
	cin>>k>>n;
	vector<int> a;
	a.resize(n);
	int i;
	for(i=0;i<n;i++)
		cin>>a[i];
	int mxval = a[1] - a[0];
	for(i=2;i<n;i++)
		mxval = max(mxval,a[i]-a[i-1]);
	mxval = max(mxval,k+a[0]-a[n-1]);
	int ans = k-mxval;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int c;
	vector<int> v;

	while (cin >> c) {
		if (c == 0) {
			break;
		}
		v.push_back(c);
	}

	for (int i = 0; i < v.size(); i++) {
		cout << "Case " << i + 1 << ": " << v[i] << endl;
	}

	cin >> c;
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int n;
   string s;
   cin >> s;
   if (s == "ABC") cout << "ARC" << endl;
   else cout << "ABC" << endl;
   
   return 0;

}


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

int NOD[10000000+1] = {};

int main()
{
    int N;
    long long ans = 0;
    cin >> N;

    for(int i = 1; i <= N; i++)
    {
        for(int j = i; j <= N; j += i)
        {
            NOD[j] += 1;
        }
    }

    for(int i=1; i<=N; i++)
    {
        ans = ans + (long long int)i*NOD[i];
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 42684
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, sum = 0;
    cin >> N;
    for (int i = 0; i < N; i++){
        int l, r;
        cin >> l >> r;
        sum += r -l + 1;
    }

    cout << sum << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<(x)<<endl;
#define mod 1000000007
#define pb push_back
#define endl '\n'




int main()
{
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(0);
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++) cin>>a[i];

	int b[n+1];
	b[0] = INT_MAX;
	for(int i=1;i<=n;i++)
	{
		b[i] = min(b[i-1],a[i]);
	}

	int ans = 0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]<=b[i]) ans++;
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dp = new int[(int) Math.pow(2, 15)];
		for (int i = 0; i * i < dp.length; i++)
			for (int j = i; i * i + j * j < dp.length; j++)
				for (int k = j; i * i + j * j + k * k < dp.length; k++)
					for (int l = k; i * i + j * j + k * k + l * l < dp.length; l++)
						dp[i * i + j * j + k * k + l * l]++;
		int n = sc.nextInt();
		while (n != 0) {
			System.out.println(dp[n]);
			n = sc.nextInt();
		}
		sc.close();
	}
}

Measured memory_bytes: 20580
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
//#include <ostream>


using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;


int main(){
  ll X,Y,A,B,C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> p(A);
  vector<ll> q(B);
  vector<ll> r(C);
  rep(i,A)cin >> p[i];
  rep(i,B)cin >> q[i];
  rep(i,C)cin >> r[i];
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  sort(q.begin(),q.end());
  reverse(q.begin(),q.end());
  sort(r.begin(),r.end());
  reverse(r.begin(),r.end());
  queue<ll> rr,pq;

  vector<ll> futatu(200010,0);
  rep(i,X)futatu[i] = p[i];
  rep(i,Y)futatu[i+X] = q[i];
  sort(futatu.begin(),futatu.end());
  reverse(futatu.begin(),futatu.end());
  rep(i,X+Y){
    pq.push(futatu[i]);
  }
  rep(i,C){
    rr.push(r[i]);
  }

  ll ans = 0;
  int i = 0;
  while(i < X+Y){
    if(pq.front() >= rr.front()){
      ans += pq.front();
      pq.pop();
    }else{
      ans += rr.front();
      rr.pop();
    }
    i++;
  }

  cout << ans << endl;

/*


  int i = 1;
  while(pp.size()==0 && qq.size()==0 && rr.size()==0){
    if(pp.size()>0 && qq.size()>0 && rr.size()>0){
      if(pp.front() >= qq.front() && pp.front() >= rr.front()){
        all[i] = pp.front();
        shu[i] = 1;
        pp.pop();
      }else if(qq.front() >= pp.front() && qq.front() >= rr.front()){
        all[i] = qq.front();
        qq.pop();
        shu[i] = 2;
      }else{
        all[i] = rr.front();
        rr.pop();
        shu[i] = 3;
      }
      continue;
    }
    if(pp.size()=0 && qq.size()>0 && rr.size()>0){
      if(qq.size()>= rr.size()){
        all[i] = qq.front();
        qq.pop();
        shu[i] = 2;
      }else{
        all[i] = rr.front();
        rr.pop();
        shu[i] = 3;
      }
    }
    if(pp.size()>0 && qq.size()=0 && rr.size()>0){
      if(pp.size()>= rr.size()){
        all[i] = pp.front();
        pp.pop();
        shu[i] = 1;
      }else{
        all[i] = rr.front();
        rr.pop();
        shu[i] = 3;
      }
    }
    if(pp.size()>0 && qq.size()>0 && rr.size()=0){
      if(pp.size()>= qq.size()){
        all[i] = pp.front();
        pp.pop();
        shu[i] = 1;
      }else{
        all[i] = qq.front();
        qq.pop();
        shu[i] = 2;
      }
    }
    if(pp.size()=0 && qq.size()=0 && rr.size()>0){
      all[i] = rr.front();
      rr.pop();
      shu[i] = 3;
    }
    if(pp.size()=0 && qq.size()>0 && rr.size()=0){
      all[i] = qq.front();
      qq.pop();
      shu[i] = 2;
    }
    if(pp.size()>0 && qq.size()=0 && rr.size()=0){
      all[i] = pp.front();
      pp.pop();
      shu[i] = 1;
    }
    i++;
  }



*/





}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int N;
  cin >> N;
  ll T[100010],A[100010];
  rep(i,N)cin >> T[i];
  rep(i,N)cin >> A[i];
  bool Tkak[100010],Akak[100010];
  Tkak[0]=1;
  Akak[N-1]=1;

  reps(i,1,N){
    if(T[i]!=T[i-1])Tkak[i]=1;
  }
  for(int i=N-2; i>=0; i--){
    if(A[i]!=A[i+1])Akak[i]=1;
  }

  rep(i,N){
    if(Tkak[i] && T[i]>A[i]){
      cout << 0 << endl;
      return 0;
    }
    if(Akak[i] && A[i]>T[i]){
      cout << 0 << endl;
      return 0;
    }
  }

  ll ans = 1;
  rep(i,N){
    if(!Tkak[i] && !Akak[i]){
      ans *= min(T[i],A[i]);
      ans %= MOD;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1920
from typing import List, Tuple


if __name__ == "__main__":
    n = int(input())
    coordinates: List[Tuple[int, int]] = []
    for _ in range(n):
        x, y = map(lambda x: int(x), input().split())
        coordinates.append((x, y))

    ans = 0.0
    for i in range(n):
        x1, y1 = coordinates[i][0], coordinates[i][1]
        x2, y2 = coordinates[(i + 1) % n][0], coordinates[(i + 1) % n][1]
        ans += (x1 * y2 - x2 * y1)

    print(f"{ans / 2.0:.1f}")



Measured memory_bytes: 7192
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const long long M = 1000000007;

void solve(long long N, long long A, long long B, std::vector<long long> S){
	if(B<A){
		swap(A,B);
	}
	vector<LL> dp0(N),dp1(N);
	dp0[0]=1;
	dp1[0]=1;
	int sa=0;
	int sb=-1;
	for(int i=1;i<N;i++){
		while(S[sb+1]+B<=S[i]){
			sb++;
		}
		if(sa<=sb+1){
			if (sb>=0){
				dp1[i]+=dp1[sb];
				if(sa<sb+1){
					dp1[i]+=dp0[sb];
				}
			}
			else{
				dp1[i]++;
			}
		}
		if(S[i]-S[i-1]>=A){
			dp0[i]+=dp0[i-1]+dp1[i-1];
		}
		else{
			sa=i;
			if(i==1||S[i]-S[i-2]>=A){
				dp0[i]+=dp1[i-1];
			}
		}
		dp0[i]%=M;
		dp1[i]%=M;
		//cerr << i << ": " << dp0[i] << ", " << dp1[i] << endl;
	}
	cout << (dp0[N-1]+dp1[N-1])%M << endl;


}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::vector<long long> S(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&S[i]);
    }
    solve(N, A, B, std::move(S));
    return 0;
}


Measured memory_bytes: 2688
k, n = map(int,input().split())

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

l = [k+a[0]-a[n-1]]
for i in range(1,n):
    l.append(a[i]-a[i-1])



l_max = max(l)

ans = sum(l)-l_max

print(ans)


Measured memory_bytes: 26420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
 
int main()
{
  string s;
  cin >> s;
  if(s[0] == 'a' || s[0] == 'i' || s[0] == 'u' || s[0] == 'e' || s[0] == 'o')
    cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}


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

int main() {
	
	int n;
	int a[200000];
	int ans[200000];

	cin >> n;
	for (int i = 1; i <= n; i++) {

		cin >> a[i];

	}

	if (n % 2 == 0) {

		for (int i = 1; i <= n; i += 2) {

			cout << a[n + 1 - i] << " ";

		}
		for (int i = 1; i <= n; i += 2) {

			cout << a[i] << " ";

		}

	}
	else {

		for (int i = 1; i <= n; i += 2) {

			cout << a[n + 1 - i] << " ";

		}
		for (int i = 2; i <= n; i += 2) {

			cout << a[i] << " ";

		}

	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#define X 600
using namespace std;

int main(){
	int i, d, x,  s;
	while(cin >> d){
		x = s = 0;
		while(x < X){
			s += (x*x) * d;
			x += d;
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int x=a+b-n;
    if(x<0) x=0;
    cout<<min(a,b)<<" "<<x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int a,b,t=0,res=0; cin>>a>>b;
 
 if(b<a) res=a-1;
 else res=a;
 cout<<res<<endl;
}

Measured memory_bytes: 256
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn main() {
  from_line!(M: u32);
  println!("{}", 48 - M);  
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void) {
	int a = 0;
	int b = 0;
	int c = 0;

	scanf("%d %d %d", &a, &b, &c);
	if (a <= b) {
		if (b <= c) { printf("%d %d %d\n", a, b, c); }
	else if(a <= c) { printf("%d %d %d\n",a ,c ,b); }
	else if (a >= c){ printf("%d %d %d\n", c, a, b); }
	}
	if (a >= b) { if (a <= c) { printf("%d %d %d\n", b, a, c); }
	else if(c <= b){ printf("%d %d %d\n", c, b, a); }
	else if (c >= b) { printf("%d %d %d\n", b, c, a); }
	}

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int X,Y,Z;
  cin>>X>>Y>>Z;
  int N=X+Y+Z;
  vector<ll> A(N),B(N),C(N);
  rep(i,N) cin>>A[i]>>B[i]>>C[i];

  vector<int> ord(N,0);
  rep(i,N) ord[i]=i;
  sort(ord.begin(),ord.end(),[&](int a,int b){
      return A[a]-B[a]>A[b]-B[b];
  });

  vector<ll> left(N,0);
  ll sum=0;
  priority_queue<ll> PQ;
  rep(i,X){
      int now=ord[i];
      sum+=A[now];
      PQ.push(C[now]-A[now]);
  }
  left[X-1]=sum;
  for(int i=X;i<X+Z;i++){
      int now=ord[i];
      sum+=A[now];
      PQ.push(C[now]-A[now]);
      auto f=PQ.top();
      PQ.pop();
      sum+=f;
      left[i]=sum;
  }

  vector<ll> right(N,0);
  sum=0;
  while(!PQ.empty()) PQ.pop();
  for(int i=1;i<=Y;i++){
      int now=ord[N-i];
      sum+=B[now];
      PQ.push(C[now]-B[now]);
  }
  right[N-Y]=sum;
  for(int i=N-Y-1;i>=X;i--){
      int now=ord[i];
      sum+=B[now];
      PQ.push(C[now]-B[now]);
      auto f=PQ.top();
      PQ.pop();
      sum+=f;
      right[i]=sum;
  }

  ll ans=0;
  for(int i=X;i<=N-Y;i++) chmax(ans,left[i-1]+right[i]);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 5752
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    double a,b;
    cin>>a>>b;
    double s1=(a/2);
    double s2=(b/2);
    double sum=(s1+s2);
    ll s=ceil(sum);
    ll aa=(ll)a;
    ll bb=(ll)b;
    if(fabs(aa-s) ==fabs(bb-s))
         pf("%lld",s);
    else
       pf("IMPOSSIBLE\n");

}


Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int N,A,B;


signed main(){
    scanf("%lld %lld %lld",&N,&A,&B);
    int ans=0;
    ans=A*(int)(N/(A+B))+min(A,(int)(N%(A+B)));
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
N, M = map(int, input().split())
S = []
for _ in range(M):
    tmp = list(map(int, input().split()))
    k = tmp[0]
    s = tmp[1:]
    S.append(s)

P = list(map(int, input().split()))
ans = 0

for i in range(2 ** N):
    on = []
    for j in range(N):
        if i >> j & 1 == 1:
            on.append(N - j)
    for i in range(M):
        if len(set(on) & set(S[i])) % 2 != P[i]:
            break
    else:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
	string s;

	cin >> s;

	for (int i = 0; i < s.size(); i++)
	{
		if (i % 2 == 0)
			cout << s[i];
	}

	return 0;
}

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

int N;
vector<bitset<32> > a;

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int a_in;
        cin >> a_in;
        bitset<32> bt(a_in);
        a.push_back(bt);
    }

    bool f = true;
    for (int i = 0; i < 32; i++) {
        int cnt = 0;
        for (int j = 0; j < N; j++) {
            bitset<32> bt = a[j];
            if (bt[i] == 1) {
                cnt++;
            }
        }
        if (cnt % 2 == 1) {
            f = false;
            break;
        }
    }

    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

ll gcd(ll a, ll b) {
    while (b) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return a;
}

ll po(ll a, ll b) {
    ll c = 1;
    while (b) {
        if (b % 2) c = c * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return c;
}

ll f[2000006], g[2000006];

void comb() {
    f[0] = 1;
    for (int i = 1; i <= 2000000; i++) f[i] = f[i - 1] * i % mod;
    g[2000000] = 407182070;
    for (int i = 1999999; i >= 0; i--) g[i] = g[i + 1] * (i + 1) % mod;
}

int p[200005];

int root(int x) {return p[x] < 0 ? x : p[x] = root(p[x]);}

void mer(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
}

int main() {
    ios::sync_with_stdio(false);
    int n, a[28] = {}, b[28] = {}, c[28] = {}, z = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i], z += b[i];
    for (int i = 1; i < n; i++) cin >> c[i];
    for (int i = 1; i < n; i++) if (a[i] + 1 == a[i + 1]) z += c[a[i]];
    cout << z;
}


Measured memory_bytes: 3664
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define IREP(i, v) for(auto i = (v).begin(); i != (v).end(); ++i)
#define IRREP(i, v) for(auto i = (v).rbegin(); i != (v).rend(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(RALL(v))
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const ll LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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


int gcd(int a, int b){
    if(!b) return a;
    if(a % b) return gcd(b, a % b);
    return b;
}


int main(){
    ll S; cin >> S;
    ll x((INF - S%INF) % INF);
    ll y((S+x)/INF);
    cout << "0 0 " << INF << " 1 " << x << " " << y << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<climits>

using namespace std;

int main()
{
  int N,k;
  cin>>N>>k;

  int dp[N+1] = {0};

  int arr[N+1];

  for(int i = 1 ; i<=N ; i++)
  {
    cin>>arr[i];
  }

  dp[0] = 0;
  dp[1]  = 0;
  /*dp[2] = abs(arr[2] - arr[1]);

  for(int i = 3 ; i<=N ; i++)
  {
    int op1 = dp[i-2] + abs(arr[i] - arr[i-2]);
    int op2 = dp[i-1] + abs(arr[i] - arr[i-1]);
    dp[i] = min(op1,op2);
  */

  for(int i = 2 ; i<=N ; i++)
  {
    dp[i] =INT_MAX;
    for(int j = 1 ; j<=k ; j++)
    {
      if(i-j >= 1)
        dp[i] = min(dp[i],dp[i-j] + abs(arr[i] - arr[i-j]));
      else
        break;
    }
  }

  cout<<dp[N];

  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (1<<30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout<<#x<<": "<<x<<endl
#define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x,y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
    if ( !v.empty() ) {
        out << '[';
        copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

// ref: https://qiita.com/ofutonfuton/items/c17dfd33fc542c222396
struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

/* template end */


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

    int n, m;
    cin >> n >> m;

    UnionFind tree(n);
    for(int i = 0; i < m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        tree.unite(x - 1, y - 1);
    }  

    set<int> s;
    for(int i = 0; i < n; i++) {
        s.insert(tree.root(i));
    }
#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 5376
n = gets.to_i

b_ary = gets.split(' ').map(&:to_i)

result = 0

b_ary.length.times do |i|
  b_i = b_ary[i]
  b_i_i = b_ary[i + 1]

  if b_i_i == nil
    a = b_i
  else
    a = b_i < b_i_i ? b_i : b_i_i
  end

  if i == 0
    if b_i_i == nil || b_i < b_i_i
      result += a * 2
    else
      result += b_i + b_i_i
    end
  else
    result += a
  end
end

puts result


Measured memory_bytes: 1788
def run(a, b):
    return a - b + 1


def read_line():
    a, b = input().split()
    a = int(a)
    b = int(b)
    return (a, b)


def main():
    a, b = read_line()
    print(run(a, b))


if __name__ == '__main__':
    main()


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

int64_t Q=998244353;
int n,q;
  
int MAX_N=131072*2;
int64_t Null=0;//初期値
vector<int64_t> seg(MAX_N*2-1,1);
vector<int64_t> lazy(MAX_N*2-1,Null);
vector<int64_t> j(MAX_N,1);
vector<int64_t> ichi(MAX_N,0);
vector<int64_t> p(MAX_N*2-1,MAX_N);
int64_t L,R,D;
void eval(int k){
  if(lazy[k]==Null){
    return;
  }
  if(k<MAX_N-1){//子への伝播
    lazy[k*2+1]=lazy[k];//change
    lazy[k*2+2]=lazy[k];//change
  }
  seg[k]=(lazy[k]*ichi[p[k]])%Q;//change
  lazy[k]=Null;
}

int64_t qu_s(int a,int b,int k,int l, int r){
  eval(k);
  if(r<=a||b<=l){
    return 0;//change
  }
  else if(a<=l&&r<=b){
    return (seg[k]*j[n-r])%Q;
  }
  else{
    int64_t X=qu_s(a,b,k*2+1,l,(l+r)/2);
    int64_t Y=qu_s(a,b,k*2+2,(l+r)/2,r);
    return (X+Y)%Q;//change
  }
}
int64_t qu(int a,int b){
  return qu_s(a,b,0,0,MAX_N);
}

void chran_s(int c,int a,int b,int k,int l, int r){
  eval(k);
  if(r<=a||b<=l){
    return;
  }
  else if(a<=l&&r<=b){
    lazy[k]=c;
    eval(k);
    while(k>0){//親への伝播
      k--;
      k/=2;
      eval(k);
      eval(2*k+1);
      eval(2*k+2);
      seg[k]=(seg[2*k+1]*j[p[2*k+1]]+seg[2*k+2])%Q;//change
    }
  }
  else{
    chran_s(c,a,b,k*2+1,l,(l+r)/2);
    chran_s(c,a,b,k*2+2,(l+r)/2,r);
  }
}
void chran(int c,int a,int b){
  chran_s(c,a,b,0,0,MAX_N);
}



int main() {
  cin>>n>>q;
  p[1]=p[0]/2;
  p[2]=p[0]/2;
  for(int i=1;i<MAX_N;i++){
    j[i]=(j[i-1]*10)%Q;
    ichi[i]=(ichi[i-1]+j[i-1])%Q;
    p[i*2+1]=p[i]/2;
    p[i*2+2]=p[i]/2;
  }
  for(int i=0;i<MAX_N;i++){
    seg[i]=ichi[p[i]];
  }
  for(int i=0;i<q;i++){
    cin>>L>>R>>D;
    L--;
    chran(D,L,R);
    cout<<qu(0,n)<<endl;
  }
}

Measured memory_bytes: 19520
h,w = gets.split.map(&:to_i)
s = [" " * w]
h.times {s << " " + gets.chomp! + " "}
s << " " * w

1.upto(h) do |i|
    1.upto(w) do |j|
        next if s[i][j] == '#'
        s[i][j] = (s[i-1][j-1,3] + s[i][j-1,3] + s[i+1][j-1,3]).count('#').to_s
    end
end

puts s[1..h].map(&:strip)

Measured memory_bytes: 1788
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
# from pprint import pprint


s1 = sys.stdin.readline().rstrip()
s2 = sys.stdin.readline().rstrip()

s1x = ''.join(sorted(list(s1)))
s2x = ''.join(sorted(list(s2), reverse=True))

if s1x < s2x:
  print('Yes')
else:
  print('No')





Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}

int main() {
    int N;

    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    rep(i, 0, N) { cin >> P[i]; }
    rep(i, 0, N) { cin >> Q[i]; }
    int kai[9];
    kai[0] = 1;
    rep(i, 1, 9) { kai[i] = kai[i - 1] * i; }

    vector<int> pshiyou(9);
    int pJun = 1;
    rep(i, 0, N) {
        int tmpjun = P[i];
        rep(j, 1, P[i]) {
            if(pshiyou[j] == 1)
                tmpjun--;
        }
        pJun += (tmpjun - 1) * kai[N - i - 1];
        pshiyou[P[i]] = 1;
    }
    vector<int> qshiyou(9);
    int qJun = 1;
    rep(i, 0, N) {
        int tmpjun = Q[i];
        rep(j, 1, Q[i]) {
            if(qshiyou[j] == 1)
                tmpjun--;
        }
        qJun += (tmpjun - 1) * kai[N - i - 1];
        qshiyou[Q[i]] = 1;
    }

    // cout << pJun << endl;
    // cout << qJun << endl;
    int res = pJun - qJun;
    if(res < 0) {
        res *= -1;
    }
    cout << res << endl;
}


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

using namespace std;
using ll = long long;


int main()
{
    int n;
    cin >> n;
    deque<int> que;
    set<int> st;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        if(a < 0) {
            if(!que.size() || que.back() != -a) {
                cout << i + 1 << endl;
                return 0;
            } else {
                st.erase(que.back());
                que.pop_back();
            }
        } else {
            if(st.count(a)) {
                cout << i + 1 << endl;
                return 0;
            }
            que.push_back(a);
            st.insert(a);
        }
    }
    cout << "OK" << endl;
}



Measured memory_bytes: 3136
n, q = map(int, input().split())
S = input()
piyo = False
work = [0]*n
i = 0
hoge = 0
for s in S:
    if s == "A":
        piyo = True
    elif s == "C" and piyo:
        hoge += 1
        piyo = False
    else:
        piyo = False
    work[i] = hoge
    i += 1
lr = [list(map(int, input().split())) for _ in range(q)]
for l, r in lr:
    result = work[r-1] - work[l-2] if l > 1 else work[r-1]
    if l>1 and S[l-2:l] == "AC":
        result -= 1
    print(result)

Measured memory_bytes: 30700
def calc(n, x):
    up = 1
    bottom = 1
    for i in range(x):
        up *= (n - i)
        up = up % mod
        bottom *= (i + 1)
        bottom = bottom % mod
    return (up * pow(bottom, mod - 2, mod)) % mod

mod = (10 ** 9) + 7

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

ans = pow(2, n, mod) - 1
for i in [a, b]:
    ans -= calc(n, i)
print(ans % mod)

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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    string ans = "No";

    if (a == b && b != c) ans = "Yes";
    if (a == c && b != c) ans = "Yes";
    if (a != b && b == c) ans = "Yes";
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 2 == 0 || b % 2 == 0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  int n,l; scanf("%d %d", &n, &l);
  vector<string> str(n);

  rep(i,n) cin >> str[i];

  sorti(str);

  for (auto itr : str) {
    cout << itr;
  }
  END;
}


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

int main(){
    long long n, k, cnt[100002]{}, ans = 0, sum = 0;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        long long a, b;
        cin >> a >> b;
        cnt[a] += b;
    }
    while(k > sum){
        ans++;
        sum += cnt[ans];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1152
i=61,f[],c,m,s;main(y){for(;s?++f[y*12+*f+"=>?2J13IK<@V&"[--s]]:~scanf("%d,%d,%d",f,&y,&s)?s=s*4+1:++i<180?i%12>1?(y=f[i])?y>m?m=y:1:++c:1:!printf("%d\n%d\n",c,m););if(m>12)return 1;if(m>11)puts("");return 0;}

Measured memory_bytes: 0
/* Ahmed Maher ( Acro_14 ) */
#include <bits/stdc++.h>
typedef long long ll;
const ll oo = 0x3f3f3f3f;
int const N = 1e5+5;
using namespace std;
//string alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//string BN(ll x){bool f=0;string Bn;int i=62;while(i--){if ((ll)x & (1LL << i)){Bn+='1';f=1;}else{if(f)Bn+='0';}}return Bn;}//Decimal to Binary converter
int main()
{
    int n;
    ll ans=0;
    cin>>n;
    int a[N]={0},b[N]={0};
    for(int i=0;i<=n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++){
        ll dec = min (b[i],a[i]);
        ans +=dec;
        b[i]-=dec;
        dec = min (b[i],a[i+1]);
        a[i+1]-=dec;
        ans+=dec;
    }
    cout<<ans;
}

//       int anss[t+1];
//            anss[j]=ans;
//     for(int j=1;j<=t;j++) printf("Case %d: %d\n",j,anss[j]);


Measured memory_bytes: 4344
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	long long int N;
	cin >> N;
	cout <<  N*(N-1)/2;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const long long int k=1e9;
using namespace std;
void dp(int n,double p[]){
	double ph[n][n+1];
	ph[0][0]=1-p[0];ph[0][1]=p[0];
	for(int i=2;i<n+1;i++)
	ph[0][i]=0;
	for(int i=1;i<n;i++){
		for(int j=0;j<n+1;j++){
			if(j)
			ph[i][j]=ph[i-1][j]*(1-p[i])+ph[i-1][j-1]*p[i];
			else
			ph[i][j]=(1-p[i])*ph[i-1][j];
		}
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<n+1;j++)
		cout<<ph[i][j]<<" ";
		cout<<endl;
	}*/
	double pmax=0;
	for(int i=n/2+1;i<n+1;i++)
	pmax+=ph[n-1][i];
	cout<<fixed<<setprecision(10)<<pmax<<endl;
}
int main(){
	int n;cin>>n;
	double p[n];
	for(int i=0;i<n;i++)
	cin>>p[i];
	dp(n,p);
}

Measured memory_bytes: 70528
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);
function main(){
  var h = o.a();
  var n = o.a();
  var a = o.l();
  return h<=a.reduce((a,b)=>a+b)?"Yes":"No";
}

Measured memory_bytes: 21956
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int[] a = new int[n];
        int ans = x;
        for(int i=0; i<n; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += 1 + (d-1) / a[i];
        }
        System.out.println(ans);
        
    }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
	int n,temp,sum=0;
	cin>>n;
	int ar[n+5]={0},s[n+5],ns[n+5],st[n+5];
	for(int i=1;i<=n;i++)
	{
		cin>>temp;
		st[i]=temp;
		ar[temp]++;
	}
		for(int i=1;i<=n;i++)
	{
		ns[i]=ar[i]*(ar[i]-1)/2;
		sum+=ns[i];
		s[i]=(ar[i]-2)*(ar[i]-1)/2;
	}
		for(int i=1;i<=n;i++)
		{
			cout<<sum-ns[st[i]]+s[st[i]]<<"\n";
		}

}

Measured memory_bytes: 9472
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 5e2+5;
int n, m, w, h, f, ans[N][N];
int main()
{
    n = read(), m = read(), w = read(), h = read();
    if(n%w == 0&&m%h == 0) return puts("No"), 0;
    else if(n%w == 0) swap(n, m), swap(w, h), f = 1;
    for(int i = 1; i <= n; i += w) ans[i][(m/h)*h] = (n/w)*(m/h)+1;
    for(int i = w; i <= n; i += w) ans[i][(m/h)*h] = -(n/w)*(m/h)-2;
    for(int i = w; i <= n; i += w)
        for(int j = h; j+h <= m; j += h)
            ans[i][j] = -1;
    puts("Yes");
    if(!f)
        for(int i = 1; i <= n; ++i, puts(""))
            for(int j = 1; j <= m; ++j)
                printf("%d ", ans[i][j]);
    else 
        for(int i = 1; i <= m; ++i, puts(""))
            for(int j = 1; j <= n; ++j)
                printf("%d ", ans[j][i]);
    return 0;
}

Measured memory_bytes: 1792