akhauriyash/Code-Regression huggingface dataset:
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  [a,b,c] <- readInts
  putStrLn $ if ((100*a+10*b+c) `mod` 4) == 0 then "YES" else "NO"

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 380
#include  <iostream>
#include  <vector>
#include  <algorithm>
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; }
#define rep(i, n) for(int i = 0; i < n; i++)

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

const int INF = 1 << 29;
const ll LINF = 1LL << 60;

int main()
{
	int n, w;
	cin >> n >> w;
	vector<int> W(n, 0), V(n, 0);
	rep(i, n)  cin >> W[i] >> V[i];

	int tsum = 0;
	rep(i, n)  tsum += V[i];
	vector<vector<ll>> dp(n + 1, vector<ll>(tsum + 1, LINF));  //初期化
	dp[0][0] = 0;  //初期条件
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= tsum; j++) {
			chmin(dp[i + 1][j], dp[i][j]);
			if (j >= V[i]) chmin(dp[i + 1][j], dp[i][j - V[i]] + W[i]);
		}
	}

	ll ans = 0;
	for (int i = tsum; i >= 0; i--) {
		if (dp[n][i] <= w) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	string s,sttd;cin>>s;sttd=s;reverse(s.begin(),s.end());
	for (int i=0;i<s.length();i++){
		if (s[i]=='b') s[i]='d';
		else if (s[i]=='d') s[i]='b';
		else if (s[i]=='p') s[i]='q';
		else if (s[i]=='q') s[i]='p';
	}
	if (sttd==s) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	N := nextInt64()
	A := nextInt64()
	B := nextInt64()

	fmt.Println((N/(A+B))*A + min(N%(A+B), A))
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}



void SOLVE(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;
    ll ans = 0;
    ll x = min(a, k);
    ans += x;
    k-=x;
    x = min(k, b);
    k-=x;
    x = min(c, k);
    k-=x;
    ans -= x;
    cout << ans << '\n';
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif
    ll TC;
    // cin >> TC;
    TC = 1;
    for(ll tc1=1; tc1<=TC; tc1++){
        SOLVE();
    }
    printclock;
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
#define rep(it,st,en) for(int it=(st);it<(int)(en);++it)
#define allof(c) (c).begin(), (c).end()
#define mt make_tuple
#define mp make_pair
#define pb push_back
#define X first
#define Y second
typedef long long int ll; 
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
const int INF=(int)1e9; 
const double EPS=(ld)1e-7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int> p(n);
    vector<int> ans(n,-1);
    vector<set<int> > forb(n);
    vector<int> deg(n,0);
    rep(i,0,n){
        cin>>p[i];
        --p[i];
        ++deg[p[i]];
    }
    queue<int> q;
    rep(i,0,n) if(deg[i] == 0) q.push(i);
    while(!q.empty()){
        int x = q.front();
        q.pop();
        int k = 0;
        for(int i:forb[x]){
            if(i != k) break;
            ++k;
        }
        ans[x] = k;
        forb[p[x]].insert(k);
        if(--deg[p[x]] == 0) q.push(p[x]);
    }
    int st = -1;
    rep(i,0,n) if(deg[i]) st = i;
    vector<int> ansCP = ans;
    vector<set<int> > forbCP = forb;
    vector<int> degCP = deg;

    // try small
    deg[st] = 0;
    q.push(st);
    while(!q.empty()){
        int x = q.front();
        q.pop();
        int k = 0;
        for(int i:forb[x]){
            if(i != k) break;
            ++k;
        }
        ans[x] = k;
        forb[p[x]].insert(k);
        if(--deg[p[x]] == 0) q.push(p[x]);
    }
    if(!forb[st].count(ans[st])){
        //cerr<<"1"<<endl;
        cout<<"POSSIBLE"<<endl;
        return 0;
    }
    
    int bad = ans[st];
    ans = ansCP;
    forb = forbCP;
    deg = degCP;


    // try large
    forb[st].insert(bad);
    deg[st] = 0;
    q.push(st);
    while(!q.empty()){
        int x = q.front();
        q.pop();
        int k = 0;
        for(int i:forb[x]){
            if(i != k) break;
            ++k;
        }
        ans[x] = k;
        forb[p[x]].insert(k);
        forbCP[p[x]].insert(k);
        if(--deg[p[x]] == 0) q.push(p[x]);
    }

    if(forbCP[st].count(bad)){
        //cerr<<"2"<<endl;
        cout<<"POSSIBLE"<<endl;
        return 0;
    }

    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


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

using namespace std;


template <class T>
std::istream& operator>>(std::istream& in, std::vector<T>& data) {
    for (auto& item : data) {
        in >> item;
    }
    return in;
}

template <class T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& data) {
    bool first = true;
    for (const auto& item : data) {
        if (!first) {
            out << " ";
        }
        out << item;
        first = false;
    }
    return out;
}


int main() {
#ifdef LOCAL
    freopen("atcoder/input.txt", "r", stdin);
#endif

    string s;
    int n, k;

    cin >> n >> k >> s;
    --k;


    s[k] = s[k] + ('a' - 'A');

    cout << s << "\n";




    return 0;
}











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

using namespace std;

int dx['Z'], dy['Z'];

int main()
{
    dx['E'] = 1;
    dx['W'] = -1;
    dy['N'] = 1;
    dy['S'] = -1;

    int n;
    while(cin>>n, n)
    {
        bool f[21][21];
        fill(f[0], f[21], false);
        for(int i=0; i<n; i++)
        {
            int x, y;
            cin >> x >> y;
            f[y][x] = true;
        }
        int m;
        cin >> m;
        int ct = 0;
        int px, py;
        px = py = 10;
        for(int i=0; i<m; i++)
        {
            string dir;
            int dst;
            cin >> dir >> dst;
            char c = dir[0];
            for(int j=0; j<dst; j++)
            {
                px += dx[c];
                py += dy[c];
                if(f[py][px])
                {
                    ct++;
                    f[py][px] = false;
                }
            }
        }
        cout << (ct==n ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 3100
import re

S = input()

x = S[0]
y = S[-1]

cnt = {}
cnt['B'] = len(re.findall('B+', S))
cnt['W'] = len(re.findall('W+', S))

if x == y:
  print(2 * (cnt[y]-1))
  
else:
  print(min(2 * cnt[x] -1, 2 * cnt[y] -1))

Measured memory_bytes: 4212
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        long[] inpt = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

        int count = (int)inpt[0];
        long addTime = inpt[1];

        inpt = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

        long ans = 0;

        long tmpTime = addTime;

        for (int i = 1; i < count; i++)
        {
            if (inpt[i] - inpt[i-1] < tmpTime)
            {
                ans += (inpt[i] - inpt[i-1]);
                tmpTime = addTime;
            }
            else
            {
                ans += tmpTime;
                tmpTime = addTime;
            }
        }
        ans += tmpTime;
        Console.WriteLine(ans);

        
    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



9 10
0 3 5 7 100 110 200 300 311


";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

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

using namespace std;
using i64 = std::int_fast64_t;
using u64 = std::uint_fast64_t;

const i64 INF = static_cast<i64>(1) << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<i64> S(A + 2), T(B + 2);
  for (int i = 0; i < A; i++) {
    cin >> S[i + 1];
  }
  for (int i = 0; i < B; i++) {
    cin >> T[i + 1];
  }
  S[0] = -INF, T[0] = -INF;
  S[A + 1] = INF, T[B + 1] = INF;
  for (int i = 0; i < Q; i++) {
    i64 x;
    cin >> x;
    int s = lower_bound(S.begin(), S.end(), x) - S.begin();
    int t = lower_bound(T.begin(), T.end(), x) - T.begin();
    i64 res = INF;
    for (int i = -1; i < 1; i++) {
      for (int j = -1; j < 1; j++) {
        i64 a = S[s + i], b = T[t + j];
        i64 c = abs(a - x) + abs(a - b), d = abs(b - x) + abs(a - b);
        res = min({res, c, d});
      }
    }
    cout << res << '\n';
  }
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> d(3);
  cin >> d[0] >> d[1] >> d[2];
  sort(d.begin(),d.end());
  if((d[2]-d[1])%2==0&&(d[2]-d[0])%2==0){
    cout << (d[2]*2-d[1]-d[0])/2 << endl;
  }
  if((d[2]-d[1])%2!=(d[2]-d[0])%2){
    cout << (d[2]*2-d[1]-d[0]+1)/2+1 << endl;
  }
  if((d[2]-d[1])%2==1&&(d[2]-d[0])%2==1){
    cout << (d[2]*2-d[1]-d[0]-2)/2+1 << endl;
  }
}

Measured memory_bytes: 256
import           Data.List


main :: IO ()
main = do
    [n ,k] <- getInts
    as <- sortBy (\a b -> compare (length b)  $ length a)
          . group . sort <$> getInts
    print $ n - solve k as

getInts :: IO [Int]
getInts = map read . words <$> getLine

solve k = sum . map length . take k


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

#define ff first
#define ss second
#define mp make_pair

using namespace std;

typedef long long ll;

// uniform_int_distribution<int>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int v[50];

int main() {
	int n,m;

	scanf("%d", &n);

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

	for(int i = 0; i < n; i++) {
		scanf("%d", &m);
		if(v[i] > m) ans += v[i] - m;
	}

	printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  int n;
  while( cin >> n ) {
    int id = n % 39;
    id = ( id == 0 ? 39 : id );
    cout << "3C" << ( id < 10 ? "0" : "" ) << id  << endl;
  }
  return EXIT_SUCCESS;
}

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

using namespace std;

class UnionFind {
    
private:
    vector<int> parent;
    int num;

public:
    UnionFind(int n)
    {
        parent.resize(n);
        for (int i = 0; i < n; i++) parent[i] = i;
        num = n;
    }

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

    void unite(const int v, const int w)
    {
        int rv = root(v);
        int rw = root(w);
        if (rv != rw) {
            parent[rw] = rv;
            num--;
        }
    }

    bool isSame(const int v, const int w)
    {
        return root(v) == root(w);
    }

    int getNum() { return num; }

};



int main()
{
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);

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

    cout << uf.getNum() << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
//#include <numeric>
//#include <vector>
//#include<math.h>
//#include <algorithm>
//#include <functional>
//#include <numeric>
//#include<cmath>
//#include <stdio.h> 
//#include <cstdint>
//#include <string>
//#include <cstdlib>
//#define pi 3.14159265359
using namespace std;

int main() {

	int n;
	string str;
	cin >> n;
	cin >> str;

	char* cstr = new char[str.size() + 1];
	std::char_traits<char>::copy(cstr, str.c_str(), str.size() + 1);

	if (n % 2 != 0) {
		cout << "No";
	}

	else {
		int a = 0;
		for (int i = 0; i < n / 2; i++) {
			//cout << i;
			if (cstr[i] != cstr[n / 2 + i]) {
				cout << "No";
				//cout << i;
				a = 1;
				break;
			}
		}
		if (a == 0) {
			cout << "Yes";
		}
	}

	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	long long int N,A,B,sum=0;
	cin>>N>>A>>B;
	sum=A;
	if(N%(A+B)==0){cout<<N/(A+B)*A;return 0;}
	sum=N/(A+B)*A;
	N%=(A+B);
	if(N>=A)sum+=A;
	else sum+=N;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint l(n);
    rep(i, n) cin >> l[i];
    sort(all(l));

    int ans = 0;
    rep(i, n-2) {
        srep(j, n-1, i+1) {
            int stick = lower_bound(all(l), l[i]+l[j]) - l.begin();
            stick -= (j+1);
            ans += stick;
        }
    }

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

Measured memory_bytes: 256
K, A, B = map(int, input().split())

if B - A < 2:
    print(K + 1)
else:
    t = K - (A - 1)
    if t == 0:
        print(K + 1)
    else:
        print(t // 2 * (B - A) + A + t % 2)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
char s[2000];
int main(){
	int n;
	scanf("%s",s);
	n = strlen(s);
	if(s[n-1] == 's'){
		s[n] = 'e';
		s[n+1]='s';
		s[n+2]=0;
	}
	else{
		s[n]='s';
		s[n+1]=0;
	}
	printf("%s\n",s );
	return 0;
}

Measured memory_bytes: 3760
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        long a = in.nl(), b = in.nl(), x = in.nl();
        if(a==0){
            out.println(b/x+1);
        }else{
            out.println(b/x-(a-1)/x);
        }
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

int main() 
{
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    int ans=0;
    while(x!=0 && y!=0)
    {
        int d = min(x,y);
        while(d--)
        {
            ans+=min(a+b,2*c);
            x--; y--;
        }
        while (x!=0)
        {
            ans+=min(a,2*c);
            x--;
        }
        while (y!=0)
        {
            ans+=min(b,2*c);
            y--;
        }
        // cout << "a" << endl;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
#n,m=map(int,input().split())
#t=int(input())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

mn=pl[0]
mnl=[]
for i in range(n):
    mn=min(mn,pl[i])
    mnl.append(mn)
res=0
for i in range(n):
    if pl[i]<=mnl[i]: res+=1
print(res)


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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define LL           long long
#define cnd tree[idx]
#define lnd (idx<<1)
#define rnd ((idx<<1)+1)
#define MAX 200005
#define Val first
#define lazy second
#define F first
#define S second

typedef pair<LL,LL> pii;

const LL INF = (LL)100000000000000000;
pii tree[4*MAX];

void update_node(int idx, int b, int e,LL v)
{
    cnd.Val += v;
    cnd.lazy += v;
}

void lazy_update(int idx, int b, int e)
{
    int m = (b+e)>>1;

    update_node(lnd, b, m, cnd.lazy);
    update_node(rnd, m + 1, e, cnd.lazy);

    cnd.lazy = 0;
}


void update(int idx, int b, int e, int st, int en,LL &v,int type)
{
    if(st > e || en < b ) return;
    if(st <= b && en >= e && !type)
    {
        update_node(idx, b, e, v);
        return;
    }
    if(st <= b && en >= e)
    {
        v = min(v, tree[idx].Val);
        return;
    }

    lazy_update(idx, b, e);

    int m = (b+e)>>1;

    update(lnd, b, m, st, en, v, type);
    update(rnd, m + 1, e, st, en, v, type);

    cnd.Val = min(tree[lnd].Val, tree[rnd].Val);
}

LL dp[MAX], prin, lolo;
vector<pii> mat[MAX];

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

    int n, m, l, r, c;
    lolo = INF;

    cin >> n >> m;
    FOR(i,0,m-1)
    {
        cin >> l >> r >> c; prin += c;
        mat[r].push_back( {l, c} );
    }

    int base = n;

    FOR(i,1,n + 1)
    {
        dp[i] = INF;
        update(1, 0, base, 0, i - 1, dp[i], 1);

        for(auto x : mat[i])
             update(1, 0, base, 0, x.F - 1, x.S, 0);

        update(1, 0, base, i, i, dp[i], 0);
    }

    cout << prin - dp[n + 1] << endl;

    return 0;
}


Measured memory_bytes: 22912
#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;

#include <functional>
#include <climits>

//SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},INT_MAX);
template< typename T>
class SegmentTree{
public:

  using F = function<T(T,T)>;

  int n;
  vector<T> tree;
  const F operation;
  const T def;

  SegmentTree(int size,F _operation,T _def):operation(_operation),def(_def){
    n=1;
    while(n<size) n*=2;
    tree.resize(2*n-1,def);
  }

  void initialize(vector<T> v){
    int vSize=v.size();
    n=1;
    while(n<vSize) n*=2;
    tree.resize(2*n-1,def);

    for(int i=0;i<vSize;i++) tree[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--) tree[i]=operation(tree[2*i+1],tree[2*i+2]);
  }

  void update(int index,T value){
    index+=n-1;

    tree[index]=value;
    while(index>0){
      index=(index-1)/2;
      tree[index]=operation(tree[2*index+1],tree[2*index+2]);
    }
  }

  T query(int a,int b,int k=0,int l=0,int r=-1){//[a,b),getMin(a,b,0,0,-1)
    if(r<0) r=n;

    if(r<=a||b<=l) return def;
    else if(a<=l&&r<=b) return tree[k];
    else{
      T lval=query(a,b,2*k+1,l,(l+r)/2);
      T rval=query(a,b,2*k+2,(l+r)/2,r);
      return operation(lval,rval);
    }
  }

  int find(int x,int k=0,int l=0,int r=-1){// a[0]+...+a[i]>=x (i:minimal)
    if(r<0) r=n;
    if(r-l==1) return k-(n-1);
    if(tree[2*k+1]>=x) return find(x,2*k+1,l,(l+r)/2);
    else return find(x-tree[2*k+1],2*k+2,(l+r)/2,r);
  }
};


int main(){
  int N;
  ll K;
  cin>>N>>K;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  rep(i,N) A[i]-=K;

  map<ll,int> mp;
  int cnt=0;
  vector<ll> sum(N+1,0);
  rep(i,N) sum[i+1]=sum[i]+A[i];

  vector<ll> v;
  for(int i=0;i<=N;i++){
    v.push_back(sum[i]);
    v.push_back(-sum[i]);
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());

  for(int i=0;i<v.size();i++){
    if(mp.count(v[i])) continue;
    mp[v[i]]=cnt++;
  }

  SegmentTree<int> seg(cnt+1,[](int a,int b){return a+b;},0);
  seg.update(mp[0],1);
  ll ans=0;
  for(int i=1;i<=N;i++){
    int q=seg.query(0,mp[sum[i]]+1);
    ans+=q;
    int val=seg.query(mp[sum[i]],mp[sum[i]]+1);
    seg.update(mp[sum[i]],val+1);
  }

  cout<<ans<<endl;



  return 0;
}



Measured memory_bytes: 20456
#include<bits/stdc++.h>
#define ford(i,a,b) for(int i=(a);i>=b;i--)
#define rep1(i,a,b) for(int i=(a);(i)<=(b);(i)++)
#define rep(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
#define N 200005
#define pql priority_queue<ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define rev(a,n) reverse(a,a+n)
using namespace std;
int h,w,k,sum;
char s[9][9];
int main() {
	cin>>h>>w>>k;
	rep(i,0,h) rep(j,0,w) cin>>s[i][j];
	rep(i,0,1<<h) rep(j,0,1<<w){
		int cnt=0;
		rep(a,0,h) rep(b,0,w){
			if(i>>a&1)continue;
			if(j>>b&1)continue;
			if(s[a][b]=='#') cnt++;
		}
		if(cnt==k)sum++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3544
from itertools import combinations
n=int(input())
num=[0 for _ in range(5)]
sum=0
for i in range(n):
    s=input()
    if s[0]=="M":
        num[0]+=1
    elif s[0]=="A":
        num[1]+=1
    elif s[0]=="R":
        num[2]+=1
    elif s[0]=="C":
        num[3]+=1
    elif s[0]=="H":
        num[4]+=1
num=[i for i in num if i>=1]
if len(num)<=2:
    print(sum)
else:
    c=list(combinations(num,3))
    for i in range(len(c)):
        sum+=c[i][0]*c[i][1]*c[i][2]
    print(sum)

Measured memory_bytes: 3064
N = int(input())
row1str = input().split()
row2str = input().split()
row1, row2 = [], []
for (s, t) in zip(row1str, row2str):
    row1.append(int(s))
    row2.append(int(t))

candidates = []
candidate = 0
for j in range(N):
    for k in range(N):
        if j>=k:
            candidate += row1[k]
        if j<=k:
            candidate += row2[k]
    candidates.append(candidate)
    candidate = 0
    
print(max(candidates))

Measured memory_bytes: 3064
#include  <iostream>

using namespace std;
typedef long long ll;

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = 0;
	ans += n / (a + b) * a;
	if (n % (a + b) < a)  ans += n % (a + b);
	else  ans += a;

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a;
  vector<int> b;
  for(int i=0; i<M; ++i){
    int A,B;
    cin>>A>>B;
    a.push_back(A);
    b.push_back(B);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  sort(b.begin(),b.end());
  
  int x=b[0]-a[0]+1;
  if(x>0) cout<<x<<endl;
  else cout<<0<<endl;
}

Measured memory_bytes: 1276
#include <cstdio>

using namespace std;

const int MOD = 998244353;

int dp[3001];
int dp2[3001];

int main()
{
  int n, s;
  
  scanf("%d %d", &n, &s);
  
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    for (int j = s; j >= 0; j--) {
      dp2[j] = (dp[j] + (j >= a ? dp[j - a] : 0)) % MOD;
    }
    for (int j = 0; j <= s; j++) {
      dp[j] = (dp[j] + dp2[j]) % MOD;
    }
  }
  
  printf("%d\n", dp[s]);
}


Measured memory_bytes: 1748
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string S;
  cin >> S;
  
  vector<int> RL;
  int init = 0;
  while (true) {
    auto pos = S.find("RL", init);
    if (pos == std::string::npos) break;
    RL.pb((int) pos);
    init = (int) pos + 1;
  }
  
  int N = S.length();
  vector<int> ans(N, 0);
  REP(i, N) {
    decltype(RL)::iterator itr;
    if (S[i] == 'R') itr = lower_bound(ALL(RL), i);
    else itr = --upper_bound(ALL(RL), i);
    int d = abs(*itr - i);
    if (d % 2 == 0) ++ans[*itr];
    else ++ans[*itr + 1];
  }

  for (auto e: ans) cout << e << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1864
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <sstream>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define rrep(i, a) RREP(i, a, 0)
#define RREP(i, a, b) for(int i = a; i >= b; --i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)
#define rrepll(i, a) RREPLL(i, a, 0)
#define RREPLL(i, a, b) for(ll i = a; i >= b; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<int, P> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+18 + 10;

const int maxN = 200001;

//1:indexed
class Bit{
public:
	int n;
	int dat[maxN + 1];

	void init(int x){
		n = x;
	}

	int sum(int k){
		int ret = 0;
		while (k > 0){
			ret += dat[k];
			k -= k & -k;
		}
		return ret;
	}

	void add(int k, int x){
		while (k <= n){
			dat[k] += x;
			k += k & -k;
		}
	}
};

int n;
int a[maxN];
ll ans = 0;
Bit b;

std::map<int, int> map;

int main(){
	std::cin >> n;
	b.init(n);
	rep(i, n)scanf("%d", &a[i]), map[a[i]] = 0;
	
	int order = 1;
	std::map<int, int>::iterator it = map.begin();
	while (it != map.end()){
		it->second = order;
		++order;
		++it;
	}

	rep(i, n)a[i] = map[a[i]];

	rep(i, n)ans += (i - b.sum(a[i])), b.add(a[i], 1);
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 12176
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException 
    {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        
        int maxCount = 0;
        int highest = 0;
        for (int i = 1; i <= n; i++)
        {
            int copy = i;
            int count = 0;
            while (copy % 2 == 0)
            {
                count++;
                copy /= 2;
            }
            if (count >= maxCount)
            {
                maxCount = count;
                highest = i;
            }
        }
        System.out.println(highest);
    } 
}

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

// 2
// 1 2 3 4 5 6
//
// 156 = 12
// 234 = 9
// ---
// 8
//
// 135 = 9
// 246 = 12
// ---
// 7
int main() {
  int N;
  cin >> N;

  vector<ll> a(N * 3);
  for (int i = 0; i < (N * 3); i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());

  ll ans = 0;
  for (int i = 0; i < (N * 2); i++) {
    if (i % 2 != 0) {
      ans += a.at(i);
    }
  }

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


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

using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    bool check = true;
    for (ll i = n - 2; i >= 0; i--) {
        ll d = a[i+1] - a[i];
        check &=
            i + 1 >= a[i+1] &&
            i >= a[i] &&
            d <= 1LL;
        if (!check) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    ll ans = 0;
    for (ll i = 1; i < n; i++) {
        if (a[i-1] >= a[i]) {
            ans += a[i-1];
        }
    }
    ans += a[n-1];
    if (n == 1 && a[0] > 0) {
        ans = -1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <vector>
#include <fstream>

using namespace std;

#define ll long long int

#define rep(i, start, end) for (int i = (int)(start); i < (int)(end); i++)
#define charToInt(c) c - 'a'




int main(int argc, const char *argv[])
{
    const long MOD = 1000000000 + 7;
    //デバッグ用コード
    //std::ifstream in("/Users/tolemy/Downloads/D (1)/in/in07.txt");
    //std::cin.rdbuf(in.rdbuf());

    int n = 0;
    cin >> n;

    //charを扱うのは面倒なので、
    //A→0
    //G→1
    //C→2
    //T→3
    //とする。

    //条件を満たさない文字列
    //1.「AGC」を含む
    //2.隣あう2文字を反転させて、「AGC」を作ることができる。
    //以上の条件を満たす文字は
    //AGC
    //ACG
    //GAC
    //A?GC
    //AG?C
    //の5つ
    //3文字から順番に調べて、条件を満たすものをカウントし続ける。

    //動的計画法に使う配列は
    //dp[考えている文字列の長さ][最後から3文字目][最後から1文字目][最後から1文字目]
    //とする（最後の3文字 + 新しく付け加える1文字がわかれば問題を解ける）。
    //int dp[101][4][4][4];
    
    int ****dp = new int***[101];
    rep(i, 0, n+1)
    {
        dp[i] = new int **[4];
        rep(a, 0, 4)
        {
            dp[i][a] = new int *[4];
            rep(b, 0, 4)
            {
                dp[i][a][b] = new int [4]();
            }
        }
    }
    
    
    //初期化
    //1文字の場合は長さ1
    dp[0][3][3][3] = 1;

    rep(i, 0, n)
    {
        rep(a, 0, 4)
        {
            rep(b, 0, 4)
            {
                rep(c, 0, 4)
                {
                    if(dp[i][a][b][c] == 0) continue;

                    rep(x, 0, 4)
                    {

                        //AGC
                        if(b == 0 && c == 1 &&  x == 2) continue;
                        //ACG
                        if(b == 0 && c == 2 && x == 1) continue;
                        //GAC
                        if(b == 1 && c == 0 && x == 2) continue;
                        //A?GC
                        if(a == 0 && c == 1 && x == 2) continue;
                        //AG?C
                        if(a == 0 && b == 1 && x == 2) continue;

                        dp[i + 1][b][c][x] += dp[i][a][b][c];
                        dp[i + 1][b][c][x] %= MOD;
                    }
                }
            }
        }
    }

    long count = 0;
    rep(a, 0, 4)
    {
        rep(b, 0, 4)
        {
            rep(c, 0, 4)
            {
                count += dp[n][a][b][c];
                count %= MOD;
            }
        }
    }

    cout << count << endl;

    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
  int N;
  cin >> N;

  int a = 1;
  while(a<=N){
    a*=2;
  }
  cout << a/2 << endl;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if (a + b == 15)
        cout << "+" << endl;
    else if (a * b == 15)
        cout << "*" << endl;
    else
        cout << "x" << endl;




    return 0;
}


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

int main(){
  int n;
  string s;
  cin>>n>>s;
  int a=0;
  for(int i=1;i<n;i++){
    int t=1;
    for(int j=0;i+j<n;j++){
      if(s[j]==s[j+i])a=max(a,min(i,t++));
      else t=1;
    }
  }
  cout<<a;
}


Measured memory_bytes: 3640
n, m = map(int, input().split())
AB = []
for i in range(n):
  abi = list(map(int, input().split()))
  AB.append(abi)
ABs = sorted(AB)
t = 0
ans = 0
for j in range(n):
  if m-t >= ABs[j][1]:
    t += ABs[j][1]
    ans += ABs[j][0]*ABs[j][1]
  else:
    ans += ABs[j][0]*(m-t)
    t += m-t
  if t == m:
    break
print(ans)


Measured memory_bytes: 28656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
 
	return 0;
}

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

Measured memory_bytes: 580
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int T;scanf("%d",&T);
	while(T--){
		int a,b;scanf("%d%d",&a,&b);
		int ret=127*(a-1);
		if(a%2==0)ret+=127-b;
		else ret+=b;
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
  int n;
  cin >> n;
  vector<ll> a(n + 1, 0);
  rep (i, n) cin >> a[i + 1];

  a.pb(0);

  ll sum = 0;
  rep (i, n + 1) sum += abs(a[i] - a[i + 1]);

  rrep (i, n) {
    cout << (sum - abs(a[i] - a[i - 1]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])) << endl;
  }

  return 0;
}

Measured memory_bytes: 2032
//http://tsutaj.hatenablog.com/entry/2017/03/29/204841
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#ifdef _MSC_VER
#  define __builtin_popcount __builtin_popcountll
#  define __builtin_popcountll __popcnt
#endif
#define int long long
using namespace std;
using ll = long long;
using ld = long double;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
inline void my_io() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout << fixed << setprecision(10);
}
class segment_tree {
private :
    int n;
    vector<int>node;
    const int INF = numeric_limits<signed>::max();
public:
    segment_tree(vector<int>v) {
        //元の配列vをセグメント木で表現する
        // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
        // セグメント木全体で必要なノード数は 2n-1 個である
        int sz = v.size();//要素数
        n = 1;
        while (n < sz) {
            n *= 2;
        }
        node.resize(2 * n - 1, INF);
        //最下段に値を入れた後に、下の段から順番に値を入れる
        for (int i = 0; i < sz; i++) {
            node[i + n - 1] = v[i];
        }
        //値を入れるには、自分の子の二値を入れればいい
        for (int i = n - 2; i >= 0; i--) {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(int x, int val) {//x番目の要素をvalに更新する
        //最下段のノードにアクセスする
        x += (n - 1);
        //最下段のノードを更新したら、あとは親にのぼって更新していく
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = min(node[2 * x + 1], node[2 * x + 2]);
        }
    }
    /*
    「区間 [a,b) にある要素の最小値を答える」ことを考えます。
     説明のため、クエリで与えられた区間 (実際に計算したい区間) を「要求区間」、
     各ノードがカバーしている区間を「対象区間」と定義します (造語)。
     これを扱うには、以下の 3 つの情報が必要になります。
 
    要求区間はどのような区間か？
    いま自分がいるノードは何番目か？
    自分がいるノードはどのような区間か？ (対象区間はどのようになっているか？)
     
    要求区間と対象区間の関係によって場合分けをします。
    */
    // 要求区間 [a, b) 中の要素の最小値を答える
    // k := 自分がいるノードのインデックス
    // 対象区間は [l, r) にあたる
    int getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
        //最初に呼び出された時の対象区間は[0,n)
        if (r < 0) {
            r = n;
        }
        // 要求区間と対象区間が交わらない -> 適当に返す
        if (r <= a || b <= l) { 
            return INF; 
        }
        // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う
        if (a <= l && r <= b) return node[k];
        // 要求区間が対象区間の一部を被覆 -> 子について探索を行う
        // 左側の子を vl ・ 右側の子を vr としている
        // 新しい対象区間は、現在の対象区間を半分に割ったもの
        int vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
 
 
    }
};
signed main() {
    my_io();
    int n, q;
    cin >> n >> q;
    segment_tree segtree(vector<int>(n,numeric_limits<signed>::max()));
    for (int i = 0; i < q; i++) {
        int com;
        cin >> com;
        if (com == 0) {
            int x, val;
            cin >> x >> val;
            segtree.update(x, val);
        }
        else if (com == 1) {
            int a, b;
            cin >> a >> b;
            cout << segtree.getmin(a, b+1) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5744
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N,Q=map(int,input().split())
a=tuple(map(int1,input().split()))
lr=[() for i in range(Q)]
for i in range(Q):
    l,r=map(int1,input().split())
    lr[i]=(l,r,i)
lr.sort(key=lambda t: t[1],reverse=1)
class BIT:
    def __init__(self,n):
        self.num=n
        self.dat=[0]*(self.num+1)
        self.depth=n.bit_length()
    
    def add(self,i,x):
        i+=1
        while i<=self.num:
            self.dat[i]+=x
            i+=i&-i
    
    def sum(self,i):
        i+=1
        s=0
        while i>0:
            s+=self.dat[i]
            i-=i&-i
        return s
    
    def lower_bound(self,x):
        sum_=0
        pos=0
        for i in range(self.depth,-1,-1):
            k=pos+(1<<i)
            if k<=self.num and sum_+self.dat[k]<x:
                sum_+=self.dat[k]
                pos+=1<<i
        return pos, sum_

b=BIT(N)
lastap=[-1]*N
ans=[-1]*Q
l,r,j=lr.pop()
for i,x in enumerate(a):
    if lastap[x]!=-1:
        b.add(lastap[x],-1)
    b.add(i,1)
    lastap[x]=i
    while r==i:
        ans[j]=b.sum(r)-b.sum(l-1)
        if lr:
            l,r,j=lr.pop()
        else:
            l,r,j=-1,-1,-1
print(*ans,sep='\n')


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

int main(){

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

 cout<<n*(n-1)/2+m*(m-1)/2<<endl;


return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int n;
	scanf("%d",&n);
	if(n>=65 && n<=90)	printf("1\n");
	else if(n>=97 && n<=122)	printf("2\n");
	else printf("0\n");
	return 0;
}


Measured memory_bytes: 2692
//...Bismillahir Rahmanir Rahim...
// Code by    Asad Bin Saber

#include <bits/stdc++.h>

using namespace std;

// typedefs...
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;

// constants...
const double PI = acos(-1);
const int MOD = 1e9+7; // 998244353;
const int MXS = 2e5+5;
const int MXI = 1e9+5;
const ll MXL = 1e15+5;
const int INF = 1e9+5;

// defines...
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

// chess moves...
// int dx[] = {+0, +0, -1, +1}; ///Up-down, Left-Right
// int dy[] = {+1, -1, +0, +0};
// int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
// int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1};
// int dx[] = {-2, -2, -1, -1,  1,  1,  2,  2}; ///Knight's Move
// int dy[] = {-1,  1, -2,  2, -2,  2, -1,  1};

// structs...
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

// functions...
ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll lcm(ll a, ll b)
{
    return (a/gcd(a, b)*b);
}
ll comb(ll a, ll b)
{
    ll x = max(a-b, b), ans=1;

    for(ll K=a, L=1; K>=x+1; K--, L++){
        ans *= K;
        ans /= L;
    }

    return ans;
}


void task()
{
	// Code here...
	
	int n, m;
	
	cin >> n >> m;
	
	if(n==m) cout << "Yes\n";
	else cout << "No\n";
}

 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	
	task();

    return 0;
}



Measured memory_bytes: 3624
N = int(input())
S = input()
count = 0
n = int(N / 2)
if N % 2 == 1:
    print("No")
else:
    for i in range(n):
        if S[i] == S[i+n]:
            count += 1
        else:
            count += 0
    if count == n:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 2940
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, h, w, res; cin >> n >> m;
    if(n == 1) h = 1;
    else h = n - 2;
    if(m == 1) w = 1;
    else w = m -2;
    res = h * w;
    cout << res;
    cout << endl;
    return 0;
}


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

int main() {
    cin >> a >> b;
    if (a > 0) {
        cout << "Positive" << endl;
        return 0;
    }
    if (1LL*a*b <= 0) {
        cout << "Zero" << endl;
        return 0;
    }
    int d = b - a + 1;
    if (d & 1) cout << "Negative" << endl;
    else cout << "Positive" << endl;
}


Measured memory_bytes: 256