akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int n, m; cin >> n >> m;
    if (n==m) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

bool used[1000010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s; cin >> s;
    int cnt = 1;
    while(true) {
        if (used[s]) {
            cout << cnt << endl;
            return 0;
        }
        used[s] = true;
        if (s % 2 == 0) s /= 2;
        else s = s * 3 + 1;
        cnt++;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Q = sc.nextInt();
		String S = sc.next();
		int[] ans = new int[N+1];
		for( int i=0; i<=N-2; i++ ){
			if( S.charAt(i)=='A' && S.charAt(i+1)=='C' ){
				ans[i+2] += ans[i+1]+1;
			}else{
				ans[i+2] += ans[i+1];              
            }              
		}              
		for( int i=0; i<Q; i++ ){
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println(ans[b] - ans[a]);          
		}
	}
}


Measured memory_bytes: 65672
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main(){
    int n,m;cin>>n>>m;
    vector<vector<int>> d(n);
    vector<int> list(n);
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        d[a].push_back(b);
        d[b].push_back(a);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(list[i]==1)continue;
        queue<int> q;
        q.push(i);
        list[i]=1;
        int sum=1;
        while(!q.empty()){
            int p=q.front();
            q.pop();
            for(auto np:d[p]){
                if(list[np]==1)continue;
                list[np]=1;
                q.push(np);
                sum+=1;
            }
        }
        ans=max(ans,sum);
    }
    cout <<ans;
}

Measured memory_bytes: 15576
N , M = [int(x) for x in input().split()]
height = [int(x) for x in input().split()]
good = [True] * N

for i in range(M):
    A, B = [int(x) for x in input().split()]
    if height[A-1] <= height[B-1]:
        good[A-1] = False
    if height[B-1] <= height[A-1]:
        good[B-1] = False
print(good.count(True))

Measured memory_bytes: 19980
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()


int main()
{
	string A, B;
	cin >> A >> B;

	string a = "";
	 rep(i, atoi(B.c_str()))
	{
		a += A;
	}

	string b = "";
	rep(i, atoi(A.c_str()))
	{
		b += B;
	}

	cout << min(a, b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
const int nn=1e5+5;
void solve() {
    int n;
    cin>>n;
    cout<<n+(n*n)+(n*n*n);
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //fillprime();
    //int t;cin>>t;while(t--)
        solve();
}

Measured memory_bytes: 3760
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a+b==c||a+c==b||b+c==a){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


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

int main() {

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

  int len = sizeof(A) / sizeof(int);
  sort(A, A+len);
  cout << A[N-1]-A[0] << endl;
  return 0;
}

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

li s;

bool read () {
	if (scanf("%lld", &s) != 1)
		return false;
	return true;
}

void solve() {
	li sq = sqrt(s);
	while (sq * sq < s) ++sq;
	printf("0 0 %lld %lld %lld %lld\n", sq, 1ll, sq * sq - s, sq);
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if(read()) {
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}

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

int main()
{
	string S;
	cin >> S;

	int N = S.size();
	int ans = 1000;
	for( int i = 0; i < N - 3 + 1; i++ ) {
		int X = 0;
		for( int j = 0; j < 3; j++ ) {
			X = X * 10 + S[i + j] - '0';
		}
		ans = min( ans, abs( X - 753 ) );
	}

	cout << ans << endl;
}


Measured memory_bytes: 3568
#include <atcoder/all>
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll digitcal(ll x){
  ll n=0;
  while(x>0){
    x/=10;
    n++;
  }
  return n;
}

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

int main() {
  int n,m;
  cin>>n>>m;
  dsu d(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    d.merge(a,b);
  }
  set<int> memo;
  for(int i=0;i<n;i++){
    memo.insert(d.leader(i));
  }
  cout<<(int)memo.size()-1<<endl;
  return 0;
}

Measured memory_bytes: 7536
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <utility>
#include <string>

using namespace std;

int main()
{
  uint64_t N; cin >> N;
  uint64_t M = (N - 1) * (1 + N - 1) / 2;
  cout << M;
}

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

int main(){
    long long n;
    cin >> n;
    long long sum = 0;
    for(int i=1; i<=n; i++){
        if(i%3!=0 && i%5!=0) sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define trace(x)     cerr<<#x<<":"<<x<<endl;
#define trace2(x,y) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<endl;
#define trace3(x,y,z) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<"|"<<#z<<":"<<z<<endl;
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

int main(){
	fast_io;
	int n;
	cin>>n;
	vector<vi > c(n,vi(3,0)), dp(n,vi(3,0));
	for(int i=0;i<n;i++){
		int a,b,cc;
		cin>>a>>b>>cc;
		c[i][0] = a;
		c[i][1] = b;
		c[i][2] = cc;
	}
	dp[0][0] = c[0][0];
	dp[0][1] = c[0][1];
	dp[0][2] = c[0][2];
	for(int i=1;i<n;i++){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + c[i][0];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + c[i][1];
		dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + c[i][2];
	}
	cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
using namespace std;
using v = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}

int main(int argc, char *argv[]){
    string w; cin >> w;
    rep(i, w.size()){
        int n = 0;
        v V;
        if(w[i] != '0'){
            rfor(j, i, w.size()){
                if(w[i] == w[j]){
                    V.push_back(j);
                    n++;
                }
            }
            if(n % 2 != 0){
                cout << "No" << endl;
                return 0;
            }
            rep(j, V.size()){
                w[V[j]] = '0';
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#
#https://www.youtube.com/watch?v=igfVeTsGeYw
#https://atcoder.jp/contests/abc121/tasks/abc121_d
#
import numpy as np
import sys

input = sys.stdin.readline

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

def calc(x):
    if (x+1)%4 == 0:
        return 0
    elif (x+1)%4 == 1:
        return x
    elif (x+1)%4 == 2:
        return (x-1)^x
    else:
        return (x-2)^(x-1)^x

if A!=0:A-=1

print(calc(A)^(calc(B)))



Measured memory_bytes: 13064
#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main()
{
	int n;
	int ma=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	}
	vector<string>ans;
	map<string,int>::iterator it;
	for(it=mp.begin();it!=mp.end();it++)
	{
		//cout<<it->second<<it->first<<endl;
		if(it->second>ma){
			ma=it->second;
			ans.clear();
			ans.push_back(it->first);
			continue;
		}
		if(it->second==ma){
			ans.push_back(it->first);
		}
	}
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 26868
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int k,n;
	cin>>k>>n;
	vector<int>v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	v.push_back(v[0]+k);
	int l=0;
	for(int i=0;i<n;i++){
		l=max(l,v[i+1]-v[i]);
	}
	int ans=k-l;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
char str[N];
int ans[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%s", str + 1);
	int n = strlen(str + 1);
	int cnt = 0;
	for (int i = 1; i <= n; i++)
	{
		if (str[i] == 'L')
		{
			if (cnt & 1) ans[i - cnt - 1]++;
			else ans[i - cnt]++;
			cnt++;
		}
		else cnt = 0;
	}
	cnt = 0;
	for (int i = n; i >= 1; i--)
	{
		if (str[i] == 'R')
		{
			if (cnt & 1) ans[i + cnt + 1]++;
			else ans[i + cnt]++;
			cnt++;
		}
		else cnt = 0;
	}
	for (int i = 1; i <= n; i++)
		printf("%d%c", ans[i], " \n"[i == n]);
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e5)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;

int main()
{
    ll N, D;
    cin >> N >> D;
    vector<vector<ll>> vec(N, vector<ll>(D, 0));
    rep(i, N) {
        rep(j, D) {
            cin >> vec[i][j];
        }
    }
    ll cnt = 0;
    rep(i, N) {
        for (ll j = i; j < N; j++) {
            if (i == j) continue;
            double d = 0.;
            rep(k, D) {
                d += pow(vec[i][k] - vec[j][k], 2);
            }
            if (floor(sqrt(d)) == sqrt(d)) cnt++;
        }
    }
    print(cnt);
    return 0;
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 2999;
long double dp[MAX_N+1][MAX_N]; // dp[i][j]: i+1回目までに表がj回出る確率
long double p[MAX_N+1];
int n;

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn1(i,n) cin >> p[i];

  dp[0][0] = 1.0;

  forn1(i,n) {
    dp[i][0] = (1.0-p[i]) * dp[i-1][0];
    forn1(j,n) {
      dp[i][j] = (1.0-p[i]) * dp[i-1][j] + p[i] * dp[i-1][j-1];
    }
  }

  printf("%.10Lf\n", accumulate(dp[n]+n/2+1,dp[n]+n+1,0.0L));

  return 0;
}


Measured memory_bytes: 140800
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>

using namespace std;

const int INF = 1 << 30;

template <class Type>
class Segtree {
public:
    explicit Segtree(int N) : length(1) {
        while (length < N) length *= 2;
        nodes.assign(length * 2, INF);
    }

    Type query(int ql, int qr, int nidx, int nl, int nr) {
        if (nr <= ql || qr <= nl) return INF;
        if (ql <= nl && nr <= qr) return nodes[nidx];
        Type lvalue = query(ql, qr, nidx * 2, nl, (nl + nr) / 2);
        Type rvalue = query(ql, qr, nidx * 2 + 1, (nl + nr) / 2, nr);
        return min(lvalue, rvalue);
    }

    // half-open interval [ql, qr)
    Type query(int ql, int qr) {
        return query(ql, qr, 1, 0, length);
    }

    void update(int idx, Type value) {
        int nidx = idx + length;
        nodes[nidx] = value;
        while (nidx > 0) {
            nidx /= 2;
            nodes[nidx] = min(nodes[nidx * 2], nodes[nidx * 2 + 1]);
        }
    }

    int length;
    vector<Type> nodes;
};

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

    vector<Segtree<int>> seg(2, Segtree<int>(N));
    // seg[i] = indexを2で割った余りがiであるものだけを集めたもの
    int p[N], rev[N];
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
        --p[i];
        seg[i % 2].update(i, p[i]);
        rev[p[i]] = i;
    }

    vector<int> ans;
    priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>> que;
    que.push(make_tuple(seg[0].query(0, N), 0, N));
    // (区間[l, r)で選べる最小値, l, r)

    while (!que.empty()) {
        int mi, l, r;
        tie(mi, l, r) = que.top();
        que.pop();
        ans.push_back(mi);
        int d1 = rev[mi];

        // もう一方はd1で切った後ろにおける同様の最小値
        mi = seg[(d1 + 1) % 2].query(d1 + 1, r);
        ans.push_back(mi);
        int d2 = rev[mi];

        // 分割後の半開区間
        pair<int, int> segs[3] = {{l, d1}, {d1 + 1, d2}, {d2 + 1, r}};

        for (int i = 0; i < 3; ++i) {
            tie(l, r) = segs[i];
            if (l < r) que.push(make_tuple(seg[l % 2].query(l, r), l, r));
        }
    }

    for (int a : ans) cout << a + 1 << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 9468
x = int(input())

if (x%7 ==1):
  print("fri")
elif (x%7 ==2):
  print("sat")
elif (x%7 ==3):
  print("sun")
elif (x%7 ==4):
  print("mon")
elif (x%7 ==5):
  print("tue")
elif (x%7 ==6):
  print("wed")
else:
  print("thu")



Measured memory_bytes: 5592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_154
{
    class D
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            int n = nk[0];
            int k = nk[1];
            double[] ps = ReadDoubles();
            double res = 0;
            double sum = 0;
            for(int i = 0; i < k; i++)
            {
                sum += (ps[i] + 1) / 2;
            }
            res = sum;
            for(int i = k; i < n; i++)
            {
                sum += (ps[i] + 1) / 2;
                sum -= (ps[i - k] + 1) / 2;
                res = Max(res, sum);
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 29532
h, w = map(int, input().split())
toggle = True
while h != 0:
    # print off the chess board
    for i in range(h):
        for j in range(w):
            char = "#" if (i+j) % 2 == 0 else "."
            print(char, end="")
        print()
    h, w = map(int, input().split())
    print()


Measured memory_bytes: 7000
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

int main() {
	lnt a,b,c,d;
	std::cin >> a >> b >> c >> d;
	print(std::max({a*c,b*d,a*d,b*c}));
}


Measured memory_bytes: 3648
N=int(input())
K=int(input())

sN=str(N)
keta=len(sN)

#dp[i][j][t]=Nと同じ桁数の整数で上からi桁目までで0でない数字がj個あるものの個数
dp=[[[0]*2 for __ in range(K+1)] for _ in range(keta+1)]
dp[0][0][1]=1

for i in range(1,keta+1):
    for j in range(K+1):
        if sN[i-1]=='0':
            dp[i][j][1] = dp[i-1][j][1]
        elif j>0:
            dp[i][j][1] = dp[i-1][j-1][1]
        dp[i][j][0] = dp[i-1][j][0]
        if sN[i-1]!='0':
            dp[i][j][0] += dp[i-1][j][1]
        if j>0:
            dp[i][j][0] += dp[i-1][j-1][1]*(max(0,int(sN[i-1])-1))
            dp[i][j][0] += dp[i-1][j-1][0]*9

print(dp[keta][K][0]+dp[keta][K][1])


Measured memory_bytes: 38480
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct edge{int from,to,cost;};
int n,m,r,a,b,c,d[1000];
vector<edge>v;
int main(void){
    cin>>n>>m>>r;
    for(int i=0;i<m;i++){
        cin>>a>>b>>c;
        v.push_back({a,b,c});
    }
    for(int i=0;i<n;i++)d[i]=1e9;
    d[r]=0;
    for(int i=0;i<n;i++){
        int ok=0;
        for(int j=0;j<m;j++){
            edge e=v[j];
            if(d[e.from]!=1e9&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                ok=1;
                if(i==n-1){
                    cout<<"NEGATIVE CYCLE"<<endl;
                    return 0;
                }
                
            }
        }
        if(!ok)break;
    }
    for(int i=0;i<n;i++){
        if(d[i]==1e9)cout<<"INF"<<endl;
        else cout<<d[i]<<endl;
    }
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (s == "abc") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


//---------------------------------------------------------------------------
const int MOD = bmd;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    ll w,s;
    cin>>s>>w;
    if(w>=s){
        cout<<"unsafe"<<"\n";
    }
    else cout<<"safe"<<"\n";

}

int main()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);//first give all input then gives output

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


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
	
#define roop(i, start, end) for(int i=start;i<end;i++)
	
using namespace std;
using ll = long long int;
using ull = unsigned long long;
	
float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

bool isPrime(int x) { // 素数判定
	if (x <= 1) return false;
	for (int i = 2; i*i <= x; i++) {
		if (x % i == 0) {
			return false;
		}
	}
	return true;
}

int main() {
	int n, k, r, s, p;
	cin >> n >> k;
	cin >> r >> s >> p;
	string t;
	cin >> t;
	int ans = 0;
	vector<bool> table(n);
	for (int i = 0; i < t.length(); i++) {
		if (i >= k) {
			if (t[i - k] == t[i]) {
				if (table[i - k] == true) continue;
			}
		}
		if (t[i] == 'r') {
			ans += p;
		} else if (t[i] == 'p') {
			ans += s;
		} else {
			ans += r;
		}
		table[i] = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
function main(input) {
  var input = input.trim().split("\n");
  var s = input[0];
  result = s.replace(/hi/g, "");
  if ( result.length == 0) {
    return "Yes";
  } else {
    return "No";
  }
}
console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

int main() {
	int n, m, l;
	cin >> n >> m >> l;
	vector<vector<int>> a(n, vector<int>(m));
	vector<vector<int>> b(m, vector<int>(l));
	vector<vector<int64_t>> c(n, vector<int64_t>(l));
	for(int i = 0 ; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> a.at(i).at(j);
		}
	}
		for(int i = 0 ; i < m; i++) {
		for(int j = 0; j < l; j++) {
			cin >> b.at(i).at(j);
		}
	}
	for(int i =0 ; i < n; i++) {
		for(int j = 0; j < l; j++) {
			c.at(i).at(j) = 0;
			for(int k = 0; k < m; k++) {
				c.at(i).at(j) += a.at(i).at(k) * b.at(k).at(j);
			}
			cout << c.at(i).at(j);
			if(j != l -1) cout << " ";
			else cout << endl;
		}
	}
}


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

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int A, B;
  cin >> A >> B;
  int a, b;
  bool flag1 = false;
  bool flag2 = false;
  rep(i, 10000) {
    if ((A == (int)floor((double)i*0.08)) && (B == (int)floor((double)i*0.1))) {
      a = i;
      flag1 = true;
      break;
    }
  }
  if (flag1 == false)
    cout << "-1" << endl;
  else
    cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define ENDL cout << endl
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1000000000;

int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    if (A >= K) {
        COUT(K);
    }
    if (A < K && K <= A + B) {
        COUT(A);
    }
    if (A + B < K) {
        COUT(A - (K - A - B));
    }
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll dp[101][100010];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<ll> sum(k, 0);
    dp[0][0] = 1;
    for (ll i = 0; i < n; i++)
    {
        for (ll sum = 0; sum <= k; sum++)
        {
            // for (ll j = 0; j <= a[i]; j++)
            // {
            //     if (sum + j <= k)
            //     {
            //         (dp[i + 1][sum + j] += dp[i][sum]) %= MOD;
            //     }
            // }
            (dp[i + 1][sum] += dp[i][sum]) %= MOD;
            (dp[i + 1][min(sum + a[i], k) + 1] += MOD - dp[i][sum]) %= MOD;
        }
        for (ll j = 1; j <= k + 1; j++)
        {
            (dp[i + 1][j] += dp[i + 1][j - 1]) %= MOD;
        }
    }
    cout << dp[n][k] << endl;
}

Measured memory_bytes: 79232
import sys, re
from collections import deque, defaultdict, Counter
from math import floor, ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
R, S, P = MAP()
T = input()

point = {"r": R, "s": S, "p": P}
win = {"r":"p", "s": "r", "p": "s"}

ideal = [win[x] for x in T]

ans = 0
for i in range(N):
  if i < K:
    ans += point[ideal[i]]
  elif ideal[i-K] == ideal[i]:  # i の手を変える
    ideal[i] = None
  else:
    ans += point[ideal[i]]

print(ans)


Measured memory_bytes: 6484
n = gets.to_i
dices = []
n.times do
  dices << gets.split.map(&:to_i)
end

answer = 'No'

dices.each_cons(3) do |pairs|
  if pairs.map { |pair| pair.uniq.size }.all?(1)
    answer = 'Yes'
    break
  end
end

puts answer


Measured memory_bytes: 14360
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int r = Integer.parseInt(str[1]);

		if (n >= 10) {
			System.out.println(r);
		} else {
			System.out.println(r + (100 * (10 - n)));
		}
	}
}

Measured memory_bytes: 32528
S=input()
N=len(S)+1
LEFT=[0]
RIGHT=[0]
left=0
right=0
for i in range(N-1):
  if S[i]==">":
    left=0
  else:
    left+=1
  LEFT+=[left]
for i in range(N-2,-1,-1):
  if S[i]=="<":
    right=0
  else:
    right+=1
  RIGHT+=[right]
ans=0  
for i in range(N):  
  ans+=max(LEFT[i],RIGHT[N-1-i])
print(ans)  

Measured memory_bytes: 27932
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dump(X) cout << #X << ' ' << X << endl
#define pe(X) cout << X << endl
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 N;
ll K;
int A[200100];
vector<int> vec[200100];
ll nxt[200100];
ll cost[200100];
int main(){
	cin >> N >> K;
	vector<int> zip;
	for(int i=0;i<N;i++){
		cin >> A[i];
		zip.pb(A[i]);
	}
	sort(all(zip));
	zip.erase(unique(all(zip)),zip.end());
	for(int i=0;i<N;i++){
		A[i] = lower_bound(all(zip),A[i])-zip.begin();
		vec[A[i]].pb(i);
		vec[A[i]].pb(i+N);
	}
	for(int i=0;i<zip.size();i++)sort(all(vec[i]));
	for(int i=0;i<N;i++){
		nxt[i] = (*upper_bound(all(vec[A[i]]),i))+1;
		cost[i] = nxt[i]-i;
		while(nxt[i]>=N)nxt[i]-=N;
	}
	/*for(int i=0;i<N;i++){
		cout << i << ' ' << nxt[i] << ' ' << cost[i] << endl; 
	}*/
	ll now = 0;
	ll sum = 0;
	do{
		sum += cost[now];
		now = nxt[now];
	}while(now!=0);
	//cout << now << ' ' << sum << endl;
	ll rem =  K*((ll)N)%((ll)sum);
	now = 0;
	while(rem>cost[now]){
		rem -= cost[now];
		now = nxt[now]; 
	}
	vector<int> ans;
	vector<int> cnt(zip.size(),0);
	for(int i=0;i<rem;i++){
		int idx = (now+i)%N;
		if(cnt[A[idx]]>0){
			while(cnt[A[idx]]>0){
				int k = ans.back();
				ans.pop_back();
				cnt[k]--;
			}
		}else{
			cnt[A[idx]]++;
			ans.pb(A[idx]);
		}
	}
	for(int i=0;i<ans.size();i++){
		cout << zip[ans[i]];
		if(i+1<ans.size())cout << ' ';
		else cout << endl;
	}
	return 0;
}

Measured memory_bytes: 18804
#include <bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
#define ll long long
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int k, n,m;
    while(cin>>n>>k>>m){
        (n+k+m)>=22?cout<<"bust"<<endl:cout<<"win"<<endl;
    }
    return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> nums;
    int now = 1, cnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] - '0' == now) {
            cnt++;
        } else {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    if (cnt != 0) nums.push_back(cnt);
    if (nums.size() % 2 == 0) nums.push_back(0);

    int res = 0;
    int ADD = 2 * K + 1;

    int left = 0, right = 0, sum = 0;
    for (int i = 0; i < nums.size(); i += 2) {
        int next_left = i;
        int next_right = min(i + ADD, (int)nums.size());

        while (next_left > left) {
            sum -= nums[left++];
        }
        while (next_right > right) {
            sum += nums[right++];
        }
        res = max(res, sum);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1020
#include <cstdio>

int main()
{

    int count[26];
    for (int i = 0; i < 26; i++)
    {
        count[i] = 0;
    }
    char s[1300];
    while (fgets(s, 1300, stdin) != NULL)
    {
        for (int i = 0; s[i] != '\0'; i++)
        {
            if (s[i] >= 'A' && s[i] <= 'Z') //sに文字列が入っているので
            {
                count[s[i] - 'A']++; //ここで数える
            }
            if (s[i] >= 'a' && s[i] <= 'z') //
            {
                count[s[i] - 'a']++;
            }
        }
    }
    for (int i = 0; i < 26; i++)
    {
        printf("%c : %d\n", 'a' + i, count[i]);
    }
    return 0;
}


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

string e[12];
int idx[5010];
bool dp[5010][1 << 12];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int n, m;
	while(cin >> n >> m, n){
		map<string, int> sm;
		for(int i = 0; i < n; i++){
			cin >> e[i];
			sm[e[i]]++;
		}
		string s;
		for(int i = 0; i < m; i++){
			string t;
			cin >> t;
			s += t;
		}
		int L = s.size();
		for(int i = 0; i < L; i++){
			idx[i] = 0;
		}
		for(int i = 0; i < n; i++){
			int len = e[i].length();
			for(int j = 0; j + len <= L; j++){
				if(e[i] == s.substr(j, len)) idx[j] |= 1 << i;
			}
		}

		memset(dp, 0, sizeof dp);
		for(int i = 0; i < L + 1; i++){
			dp[i][0] = 1;
		}
		for(int i = 0; i < L; i++){
			for(int j = 0; j < 1 << n; j++){
				if(dp[i][j] == 0) continue;
				for(int k = 0; k < n; k++){
					if(idx[i] >> k & 1){
						if(j >> k & 1) continue;
						int len = e[k].length();
						dp[i + len][j | (1 << k)] = true;
					}
				}
			}
		}

		ll ans = 0;
		for(int i = 0; i <= L; i++){
			ans += dp[i][(1 << n) - 1];
		}
		/*for(auto v : sm){
			if(v.second >= 2){
				for(int i = 2; i <= v.second; i++){
					ans /= i;
				}
			}
		}*/
		cout << ans << endl;
	}
}

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

typedef long long ll;

struct BIT{
    // 1-origin
    vector<int> v;
    int n;

    BIT(int _n):
        v(vector<int>(_n+1, 0)), n(_n) {}

    int sum(int i){
        int s = 0;
        while(i > 0){
            s += v[i];
            i -= lsb(i);
        }
        return s;
    }
    
    int sum(int l, int r){
        return sum(r) - sum(l-1);
    }

    void add(int i, int x){
        while(i <= n){
            v[i] += x;
            i += lsb(i);
        }
    }

    ll invNum(){
        ll ret = 0;
        for(int j = 0; j < n; j++){
            ret += j - sum(v[j]);
            add(v[j], 1);
        }
        return ret;
    }

private:
    // least significant bit
    int lsb(int i){
        return i & -i;
    }
};

typedef pair<int,int> pii;

int main(){
    int n, q;
    cin >> n >> q;
    int c[n];
    for(int i = 0; i < n; i++)  cin >> c[i], c[i]--;
    vector<pair<pii,int>> vp;
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        vp.push_back({{--r, --l}, i});
    }
    sort(vp.begin(), vp.end());
    vector<int> last(n, -1), ans(q);
    int qind = 0;
    BIT bit(n);
    for(int i = 0; i < n; i++){
        if(last[c[i]] != -1){
            bit.add(last[c[i]]+1, -1);
        }
        last[c[i]] = i;
        bit.add(last[c[i]]+1, 1);
        while(qind < q && vp[qind].first.first == i){
            ans[vp[qind].second] = bit.sum(i+1)-bit.sum(vp[qind].first.second);
            qind++;
        }
    }
    for(int i = 0; i < q; i++)  cout << ans[i] << endl;
    return 0;
}



Measured memory_bytes: 17368
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll x = max(a,b),y = min(a,b);
    if((x-y)%2==0){
        cout << (x-y)/2 << endl;
        return 0;
    }
    cout << min(n-x,y-1)+1+(x-y-1)/2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath> 
#include <tuple>
#include <bitset>
//pair sort firstに揃う

#define int long long
#define double long double
#define Rap(n,i) for(int (i)=0;(i)<(n);(i)++)
#define Pr(n) cout<<n<<endl;
#define PairV vector<pair<int , int> >
#define F first
#define S second
#define Vector1 vector<int>
#define VectorS vector<string>
#define vector2 vector<vector<int> >
#define index(v,x) find((v).begin(), (v).end(), (x))-(v).begin()
#define ctoi(c) (int)(c-'0')
#define incin(n) int (n); cin>>(n);
#define incin2(n,m) int (n),(m); cin >> (n)>>(m);
#define stcin(s) string (s); cin>>(s);
#define all(v) (v).begin() , (v).end()
namespace Mathf
{
    const int INF = 1000000000000;
    const double PI = 3.14159274;
    const double Rad2Deg = 57.29578;
    const double log2(double a,double b);
    const double log2(double a,double b){
        return log(b)/log(a);
    }
} // namespace Mathf

using namespace std;

int MD(pair<int,int> a,pair<int,int> b){//ManhattanDisRance
    return abs(a.first-b.first) + abs(a.second-b.second);
}
int MOD(int a,int b){
    return abs(a%b);
}
template <typename T1,typename T2> bool Comp (pair<T1,T2> a,pair<T1,T2> b){
    if(a.first!=b.first){
        return a.first<b.first;//first昇順
    }
    if(a.second!=b.second){
        return a.second > b.second;//second降順
    }else{
        return  true;
    }
}
signed  main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    incin(n);
    stcin(s);
    if(n%2==1){
        cout<<"No"<<endl;
    }else{
        if(equal(s.begin(),s.begin()+(n/2),s.begin()+(n/2),s.end())){
            Pr("Yes");
        }else{
            Pr("No");
        }
    }
    return 0;
}
 

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

int main()
{
	int m,d,o,t,count=0,temp;
	cin>>m>>d;
	/*if(d<=10){
		cout<<"0";
	}
	else*/
	for(int i=1;i<=m;i++){
		for(int j=11;j<=d;j++){
			temp=j;
			o=temp%10;
			temp=temp/10;
			t=temp;
			if(o>=2&&t>=2&&(o*t)==i)	{
				count++;
			}
		}
	}
	cout<<count<<" ";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST ll t;cin>>t;while(t--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));

bool prime[10000];
void era(){
    memset(prime,true,sizeof prime);
    for(ll p=2;p*p<=10000;p++){
        if(prime[p]){
            for(ll q=p*p;q<=10000;q+=p){
                prime[q]=false;
            }
        }
    }

    return;
}
ll fac[200001],finv[200001];
ll power(ll a,ll b){
    ll ans=1;
    while(b){
        if(b&1) ans=(ans*a)%MAX;
        b/=2;
        a=(a*a)%MAX;
    }
    return(ans%MAX);
}
ll inverse(ll a){
    return((power(a,MAX-2))%MAX);
}
ll ncr(ll n, ll r){
    ll p1=finv[n-r];
    ll p2=finv[r];

    return((((fac[n]*p1)%MAX)*p2)%MAX);


}
bool solve(ll n,ll arr[]){
    ll sum=0;
    for(ll i=0;i<n;i++){
        sum+=arr[i];
        if(sum<=0) return(false);
    }
    sum=0;
    for(ll i=n-1;i>=0;i--){
        sum+=arr[i];
        if(sum<=0) return(false);
    }
    return(true);
}
struct Node{
    ll l,r,w;
}arr[5001];
bool cmp(Node a,Node b){
    return(a.r<b.r);
}
int main(){
    IO
    ll W,H,N;
    cin>>W>>H>>N;
    ll max_y=H,min_y=0;
    ll max_x=W,min_x=0;
    while(N--){
        ll x,y,a;
        cin>>x>>y>>a;
        if(a==1){
            min_x=max(x,min_x);
        }
        else if(a==2){
            max_x=min(x,max_x);
        }
        else if(a==3){
            min_y=max(y,min_y);
        }
        else max_y=min(y,max_y);
    }
    cout<<(max((ll)0,max_x-min_x))*(max((ll)0,max_y-min_y));
    return(0);
}

Measured memory_bytes: 256