akhauriyash/Code-Regression huggingface dataset:
// you should probably see at the bottom ..
#include<bits/stdc++.h>

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define rrange(v) v.rbegin(), v.rend()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	string s, t;
	cin >> s >> t;
	int n = s.length(), m = t.length();
	int ans = inf;
	for (int i = 0; i + m <= n; i++) {
		int cur = 0;
		for (int j = 0; j < m; j++) {
			if (s[i + j] != t[j])
				cur++;
		}
		ans = min(cur, ans);
	}

	cout << ans << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

/*
 * COME ON DUDE .... DONT GET UP UNTIL U GET THE SOLUTION
 * GIVING UP NOT GONNA HELP .. JUST GET YOUR ASS TO WORK ALREADY ..
 * AND FOR FUCKING SAKE ... DONT PANIC !!
*/


Measured memory_bytes: 3684
#include <bits/stdc++.h>                                                                               
using namespace std;
#define FOR(v1, v2) for (v1 = 0; v1 < v2; ++v1)
#define FORE(v1, v2) for (v1 = 0; v1 <= v2; ++v1)
#define FORO(v1, v2) for (v1 = 1; v1 < v2; ++v1)
#define FOROE(v1, v2) for (v1 = 1; v1 <= v2; ++v1)
using P = pair<int, int>;


P conv(int x) {
  int e = x % 10; 
  int s;
  while(x > 0) {
    s = x;
    x /= 10; 
  }
  return P(s, e); 
}

int main () {
  int n;
  cin >> n;
  int i;
  map<P, int> freq;
  FOROE(i, n) {
  // convert i to (s, e)
    ++freq[conv(i)];
  }
  int ans = 0;
  FOROE(i, n) {
    auto p = conv(i);
    ans += freq[P(p.second, p.first)];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <deque>
#define ll long long

using namespace std;



int main() {
	char s[100];
	deque<int> d;
	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			int pre = d.back();
			d.pop_back();
			int post = d.back();
			d.pop_back();
			d.push_back(pre + post);
		}
		else if (s[0] == '-') {
			int pre = d.back();
			d.pop_back();
			int post = d.back();
			d.pop_back();
			d.push_back(post - pre);
		}
		else if (s[0] == '*') {
			int pre = d.back();
			d.pop_back();
			int post = d.back();
			d.pop_back();
			d.push_back(pre * post);
		}
		else d.push_back(atoi(s));
	}
	cout << d.back() << endl;



	return 0;

}





Measured memory_bytes: 3248
#include<iostream>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #include<string>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    using namespace std;
    #define INF 10000000;
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define rrep(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
    #define vec(n) vector<int>(n)
    #define vvec(m,n) vector<vector<int>> vec(m,vector(n))

  
  
    int main(){
      int a,b,c;
      cin >> a >> b >> c;

      int s = a+b+c;
      int max1 = max({a,b,c});
      if(s%2 != max1%2)max1++;

      int res = (3*max1-s)/2;

      cout << res <<endl;
      }
    


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int A, B, C; cin >> A >> B >> C;
	if (A*B*C == 5 * 5 * 7)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

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

const int INTINF = 1e9;
const LL LLINF = 1e18;
#define TENS(n) int(1e##n + n)

// デックに残る要素が [i,j) だったときのX-Y
LL dp[3001][3001];
LL a[3001];
bool flag[3001][3001];

LL dfs(int turn, int i, int j)
{
    if (flag[i][j] or i == j)
        return dp[i][j];
    flag[i][j] = true;

    LL l = dfs(turn + 1, i + 1, j);
    LL r = dfs(turn + 1, i, j - 1);

    if (turn % 2 == 0)
    {
        l += a[i];
        r += a[j - 1];
        return dp[i][j] = max(l, r);
    }
    else
    {
        l -= a[i];
        r -= a[j - 1];
        return dp[i][j] = min(l, r);
    }
}

void solve()
{
    int N;
    cin >> N;
    REP0(i, N)
    {
        cin >> a[i];
    }

    cout << dfs(0, 0, N) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

Measured memory_bytes: 78592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
const int maxn = 1000005;
const int maxm = maxn*2;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
ll qpow(ll a,ll b,ll p){
    ll ret = 1; if(p==1) return 0; if(b==0) return 1;
    while(b){if(b&1) ret = (ret*a) % p; a = (a*a) % p;b>>=1;}
    return ret;
}
char s[5005];
int n;
ll dp[5005][5005];
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n>>(s+1);
    dp[0][0] = 1;
    for(int i = 0;i<=n;i++) {
        for(int j = 0;j<=i;j++){
            dp[i+1][j+1] = (dp[i+1][j+1] + 2*dp[i][j]%mod) % mod;
            dp[i+1][max(j-1,0)] = (dp[i+1][max(j-1,0)] + dp[i][j]) % mod;
        }
    }
    cout<<dp[n][strlen(s+1)]*qpow(qpow(2,strlen(s+1),mod),mod-2,mod)%mod;
}


Measured memory_bytes: 194176
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int H, W; cin >> H >> W;
    vector<string> A(H);
    REP(i, H) cin >> A[i];

    vec s(H, -1), e(H, -1);
    REP(i, H){
        REP(j, W){
            if(A[i][j] == '#'){
                s[i] = j;
                break;
            }
        }
        if(s[i] == -1){
            cout << "Impossible";
            return 0;
        }
        FOR(j, s[i], W){
            if(A[i][j] == '.'){
                e[i] = j - 1;
                break;
            }
        }
        if(e[i] == -1) e[i] = W - 1;
        FOR(j, e[i] + 2, W){
            if(A[i][j] == '#'){
                cout << "Impossible";
                return 0;
            }
        }
        //cout << s[i] << "," << e[i] << endl;
    }
    bool f = true;
    REP(i, H - 1) if(e[i] != s[i + 1]) f = false;
    if(f) cout << "Possible";
    else cout << "Impossible";
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 764
import math
n, m = map(int, input().split())
mod = 10**9+7

fact_n = math.factorial(n)
fact_m = math.factorial(m)

if n == m:
    print((fact_n*fact_m*2)%mod)
elif abs(n - m) == 1:
    print(fact_n*fact_m%mod)
else:
    print(0)


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

int main() {
#ifndef ONLINE_JUDGE
  freopen("c.in", "r", stdin);
  freopen("c.out", "w", stdout);
#endif
  int N, ans = 0;
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    ans += N / i;
    if (N % i == 0) --ans;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
use input::Input;

fn main() {
    let mut input = Input::default();

    let n = input.parse();
    let a = (0..n).map(|_| input.parse::<u32>()).collect::<Vec<_>>();

    let mut cnt = 0;
    for (i, x) in a.iter().enumerate() {
        if i % 2 == 0 && x % 2 != 0 {
            cnt += 1;
        }
    }

    println!("{}", cnt);
}

#[allow(dead_code)]
pub mod input {
    #[derive(Default)]
    pub struct Input(Vec<String>);

    impl Input {
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok().expect("read error");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            let x = if let Some(x) = self.0.pop() {
                x
            } else {
                let s = self.read_line();
                self.0 = s.split_whitespace().map(String::from).rev().collect();
                self.0.pop().expect("reached EOF")
            };
            x.parse().ok().expect("parse error")
        }
    }
}


Measured memory_bytes: 2116
mod = 10**9+7
import sys
import math
from collections import Counter, defaultdict, deque
import copy

# from itertools import product, permutations, combinations, combinations_with_replacement
# from itertools import accumulate
# from operator import itemgetter
# from bisect import bisect_bound_list,bisect
# from heapq import heappop,heappush
# from math import ceil,floor
# from copy import deepcopy
# from heapq import heappop,heappush,heapify
# import heapq


# def combinations(n, r):
# 	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# def gcd(a, b):
# 	if b == 0:
# 		return a
# 	else:
# 		return gcd(b, a%b)
 
# def lcm(a, b):
# 	return a // gcd(a, b) * b

# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))

# import numpy as np
# R, C = MI()
# S = np.array([LI() for _ in range(R)])
# ans = 0
# for i in range(2**R):
#     r = np.array([[i >> r & 1 for r in range(R)]])
#     X = np.sum(S.T ^ r, axis=1)
#     ans = max(ans, np.sum(np.maximum(X, R-X)))
# print(ans)


N,x = MI()
A = LI()
cnt = 0
for i in range(len(A)):
    if i > 0:
        if A[i-1] + A[i] > x:
            cnt += A[i-1] + A[i] - x
            A[i] = A[i] - (A[i-1] + A[i] - x)
    else:
        if A[i] > x:
            cnt += A[i] - x
            A[i] = x
print(cnt)














Measured memory_bytes: 60636
n = input()
n = int(n)
a_list = [0 for i in range(n)]
line = input()
b_list = line.split(" ")
b_list = [int(b) for b in b_list]

for i in range(n-1):
    if i == 0:
        a_list[i] = b_list[i]
        a_list[i+1] = b_list[i]
    else:
        if a_list[i] > b_list[i]:
            a_list[i] = b_list[i]
        a_list[i+1] = b_list[i]
print(sum(a_list))



Measured memory_bytes: 3064
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};
use std::{cmp, fmt};

fn main() {
    let (a, b): (u32, u32) = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        (sc.next(), sc.next())
    };
    if a + b == 15 {
        println!("+");
    } else if a * b == 15 {
        println!("*");
    } else {
        println!("x");
    }
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
    int a, b;
    cin >> a >> b;
    int ans = a*b;
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

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

	string result = "AC";
	auto count = 0;
	for (auto i = 0; i < S.length(); ++i)
	{
		if (i == 0)
		{
			if (S[i] != 'A')
			{
				result = "WA";
				break;
			}
		}
		else if (i >= 2 && i <= S.length() - 2)
		{
			if (S[i] == 'C')
			{
				++count;
			}
			else if (S[i] < 'a' || S[i] > 'z')
			{
				result = "WA";
				break;
			}
		}
		else if (S[i] < 'a' || S[i] > 'z')
		{
			result = "WA";
			break;
		}
	}

	if (count != 1)
	{
		result = "WA";
	}

	cout << result << endl;

	return 0;
}


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

int main() {
    string c="";
    cin >> c;
    if(c=="a" || c=="i" || c=="u" || c=="e" || c=="o"){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative

combinations :: Int -> [a] -> [[a]]
combinations 0 _ = [[]]
combinations _ [] = []
combinations n (x:xs) = (map (x:) (combinations (n-1) xs)) ++ (combinations n xs)

solve :: [Int] -> String
solve [n, x] =
   show $ length [nc3 | nc3<-combinations 3 [1..n], sum nc3==x]

main =
    mapM_ putStrLn =<< map solve . takeInputs . lines <$> getContents
    where
    takeInputs :: [String] -> [[Int]]
    takeInputs = takeWhile (not . all (== 0)) . map (map read . words)

Measured memory_bytes: 5468
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a;
    cin>>n;
    bool flag = 1;
    for (int i = 1;i<=n;i++)
    {
        cin>>a;
        if (a % 2 == 0)
        {
            if (a % 3 == 0 || a % 5 == 0) continue;
            flag = 0;
        }
    }
    if (flag) cout<<"APPROVED";
    else cout<<"DENIED";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<random>
#include<numeric>
#include<string>
#include<stack>
#include<cstring>
typedef long long ll;
typedef long double ld;
using namespace std;
ll dx[] = { 0,0,1,-1 };
ll dy[] = { 1,-1,0,0 };

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b)*b;
}
int main() {
	ll N;
	cin >> N;
	ll a[N];
	ll ans = 1;
	for (ll i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			ans *= 2;
		}
	}
	ll sum = 1;
	for (ll i = 0; i < N; i++) {
		sum *= 3;
	}
	cout << sum - ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int sumall(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  if (n % sumall(n) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
} 


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

using namespace std;

int main(){
        string str[110];
        int H, W;
        cin>>H>>W;
        for(int i=1;i<=H;i++){
                cin>>str[i];
                str[i].insert(str[i].begin(), '#');
                str[i]+='#';
        }
        for(int i=0;i<=W+1;i++){
                str[0]+='#';
                str[H+1]+='#';
        }
        for(int i=0;i<=H+1;i++){
                cout<<str[i]<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
import itertools
N = int(input())
S = input()

ans = set()
for x in range(10):
    if str(x) in S:
        idx = S.index(str(x))
        for y in range(10):
            if str(y) in S[idx+1:]:
                idx2 = S[idx+1:].index(str(y)) + idx + 1
                for z in range(10):
                    if str(z) in S[idx2+1:]:
                        idx3 = S[idx2 + 1:].index(str(z)) + idx2 + 1
                        ans.add((x,y,z))
print(len(ans))

Measured memory_bytes: 3192
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto as = readln.chomp.split.to!(int[]);
  auto res = int.max;
  
  foreach (a; as) {
    int cnt;
    while (!(a & 1)) {
      a >>= 1;
      cnt++;
    }
    res = min(res, cnt);
  }
  res.writeln;
}


Measured memory_bytes: 256
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(n: usize, a: [i64; n]);

    let mut seg = vec![];
    let mut next_pop = 0;
    let mut sum = 0;
    let mut xor = 0;

    for next_push in 0..n {
        sum += a[next_push];
        xor ^= a[next_push];
        while next_pop < next_push && sum != xor {
            sum -= a[next_pop];
            xor ^= a[next_pop];
            next_pop += 1;
        }
        assert_eq!(sum, xor);
        seg.push((next_pop, next_push));
    }

    let mut ans = 0;
    for &(next_pop, next_push) in seg.iter() {
        let len = next_push - next_pop + 1;
        ans += len;
    }
    println!("{}", ans);
}


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

int main(void)
{
    long long D;
    cin >> D;
    vector<long long> c(26);
    vector<long long> used(26);
    for (long long i = 0; i < 26; i++)
    {
        cin >> c[i];
        used[i] = -1;
    }
    vector<vector<long long>> s(D,vector<long long>(26));
    for (long long i = 0; i < D; i++)
    {
        for (long long j = 0; j < 26; j++)
        {
            cin >> s.at(i).at(j);
        }
    }

    for (long long i = 0; i < D; i++)
    {
        long long pena = 0;
        for (long long j = 0; j < 26; j++)
        {
            pena += c[j] * (i - used[j]);
        }
        long long ans = -1;
        long long cnt = -100000000;
        for (long long j = 0; j < 26; j++)
        {
            pena -= c[j] * (i - used[j]);
            if (s.at(i).at(j) - pena > cnt)
            {
                ans = j;
                cnt = s.at(i).at(j) - pena;
            }
            pena += c[j] * (i - used[j]);
        }
        used[ans] = i;
        cout << ans+1 << endl;
    }
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ii pair<int,int>
#define iii pair <int,ii>
#define iil pair<ll,ll>
#define iiil pair<ll,iil>
#define max3(a,b,c) max(a, max(b,c))
#define min3(a,b,c) min(a, min(b,c))
#define s(v) sort(v.begin(),v.end())
#define pf printf
#define sf scanf
#define MIN INT_MIN
#define MAX INT_MAX
#define accepted 0
#define GCD(x,y)  __gcd(x, y)
using namespace std;

int main(){
    int n;
        cin>>n;
    if(n%2)cout<< (n/2) + 1 <<endl;
    else cout<< n/2 <<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using pint=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define el '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define ceil_div(a,b) ((a+(b-1))/b)
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
#define $in(v,n) ;rep(II,0,n)cin>>v[II]
inline void IN(void){return;}
template<typename F,typename... R>inline void IN(F& f, R&... r){cin>>f;IN(r...);}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}


int main(){
	int n; string s;
	IN(n,s);
	if(n%2==1){
		puts("No");
	}else{
		n /= 2;
		rep(i,0,n){
			if(s[i]!=s[i+n]){
				puts("No");
				return 0;
			}
		}
		puts("Yes");
	}
	return 0;
}


Measured memory_bytes: 3100
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  int q = in();
  while (q--) {
    int t, b, e;
    cin >> t >> b >> e;
    if (t == 0) cout << *min_element(a.begin() + b, a.begin() + e) << endl;
    if (t == 1) cout << *max_element(a.begin() + b, a.begin() + e) << endl;
  }
}



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

int main(){
	string s;
	cin >> s;
	for( int i = 0 ; i < s.length() ; i++ )
		if( s[i] == '9' ){
			cout << "Yes" << endl;
			return 0;
		}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

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

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

/*
Log order calcuration of power
*/
ll bi_pow(ll x, ll n){
  ll res = 1;
  while (n>0){
    if (n%2==1) {res = res * x % MOD;}
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

/*
Inverse element of MOD = 1e9+7
*/
ll inv_MOD(ll x){
  return bi_pow(x, MOD-2);
}

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

  ll X, Y;
  cin >> X >> Y;
  
  ll a = 0;
  ll b = 0;
  while(X>=0){
    if (X*2==Y){
      b = X;
      break;
    }
    X -= 2; Y -= 1; a++;
  }
  if (X<0) {
    cout << 0 << "\n";
    return 0;
  }
  
  // calc a+1Hb
  ll numer = 1;
  REP(i,a+b){ numer = numer * (i+1) % MOD; }
  ll dl = 1;
  REP(i,a){ dl = dl * (i+1) % MOD; }
  ll dr = 1;
  REP(i,b){ dr = dr * (i+1) % MOD; }
  ll denom = dl * dr % MOD;
  ll ans = numer * inv_MOD(denom) % MOD;
  
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;


void dfs(int v, int p, vector< vector<int> >& tree, vector<int>& ans){
	for (int u : tree[v]) {
		if (u == p) continue; // 親の頂点を飛ばす．
		ans[u] += ans[v];
		dfs(u, v, tree, ans);
	}
}

int main() {
	int n,q;
	cin >> n >> q;

	vector< vector<int> > tree(n+1);
	vector<int> ans(n,0);

	for(int i=0; i<n-1; i++){
		int a,b;
		cin >> a >> b;
		--a,--b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	for (int i = 0; i < q; i++){
		int p,x;
		cin >> p >> x;
		--p;
		ans[p] += x;
	}

	dfs(0, -1, tree, ans);

	for (int i : ans) cout << i << endl;

	return 0;
}


Measured memory_bytes: 26624
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

string S;

signed main(){
    cin >> S;
    if(S.front() == S.back()){
        if(S.size()%2) cout << "Second" << endl;
        else cout << "First" << endl;
    }
    else{
        if(S.size()%2) cout << "First" << endl;
        else cout << "Second" << endl;
    }
}

Measured memory_bytes: 3760
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};

int T;
int number[9];
char color[9];

void solve() {
	int cr[10], cg[10], cb[10];
	minit(cr, 0); minit(cg, 0); minit(cb, 0);
	int cntr = 0, cntg = 0, cntb = 0;
	
	for_(i,0,9) {
		switch (color[i]) {
		case 'R':
			++cntr;
			++cr[number[i]];
			break;
		case 'G':
			++cntg;
			++cg[number[i]];
		case 'B':
			++cntb;
			++cb[number[i]];
			break;
		}
	}
	
	if (cntr % 3 == 0 && cntg % 3 == 0 && cntb % 3 == 0) {
		for_(i,1,10) {
			while (cr[i] >= 3) cr[i] -= 3;
			while (cg[i] >= 3) cg[i] -= 3;
			while (cb[i] >= 3) cb[i] -= 3;
		}
		
		for_(i,1,8) {
			while (cr[i] >= 1 && cr[i + 1] >= 1 && cr[i + 2] >= 1) {
				--cr[i]; --cr[i + 1]; --cr[i + 2];
			}
			while (cg[i] >= 1 && cg[i + 1] >= 1 && cg[i + 2] >= 1) {
				--cg[i]; --cg[i + 1]; --cg[i + 2];
			}
			while (cb[i] >= 1 && cb[i + 1] >= 1 && cb[i + 2] >= 1) {
				--cb[i]; --cb[i + 1]; --cb[i + 2];
			}			
		}
		
		bool flag = true;
		for_(i,1,10) {
			if (cr[i] > 0 || cg[i] > 0 || cb[i] > 0) flag = false;
		}
		
		if (flag) cout << 1 << endl;
		else cout << 0 << endl;
	} else {
		cout << 0 << endl;
	}
}

int main() {
	cin >> T;
	for_(i,0,T) {
		for_(j,0,9) cin >> number[j];
		for_(j,0,9) cin >> color[j];
		solve();
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////

int main() {
	int N; cin >> N;
	ll ans = 0;
	vector<int>a(N), b(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i < 30; ++i) {
		vector<int>a_(N), b_(N);
		int c = (int)1 << i, d = (int)1 << (i + 1);
		for (int j = 0; j < N; ++j) {
			a_[j] = a[j] % d;
			b_[j] = b[j] % d;
		}
		sort(a_.begin(), a_.end());
		sort(b_.begin(), b_.end());
		ll cnt = 0;
		//a[j]を固定する
		for (int j = 0; j < N; ++j) {
			cnt += lower_bound(b_.begin(), b_.end(), d - a_[j]) - lower_bound(b_.begin(), b_.end(), c - a_[j]);
			cnt += lower_bound(b_.begin(), b_.end(), 2 * d - a_[j]) - lower_bound(b_.begin(), b_.end(), d + c - a_[j]);
		}
		if (cnt % 2 == 1) {
			ans += c;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3432
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func intMax(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

func main() {
	sc.Split(bufio.ScanWords)
	MOD := int(math.Pow10(9) + 7)

	N, M := scanInt(), scanInt()
	A := make([]int, N+1)
	A[0], A[1] = 1, 1
	for i := 0; i < M; i++ {
		m := scanInt()
		A[m] = -1
	}

	for i := 2; i <= N; i++ {
		if A[i] != -1 {
			A[i] = intMax(A[i-2], 0) + intMax(A[i-1], 0)
			A[i] %= MOD
		}
	}
	fmt.Println(A[N])
}


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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

int main(){
    int N;
    cin >> N;
    vector<int>A(N);
    REP(i, N) cin >> A.at(i);

    ll X = 0;
    REP(i, N){
        if(i % 2 != 0) X -= A.at(i);
        if(i % 2 == 0) X += A.at(i);
    }
    REP(i, N){
        cout << X << ' ';
        X = A.at(i) * 2 - X;
    }
}



Measured memory_bytes: 1664
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  set_bool_name("POSSIBLE", "IMPOSSIBLE");
  int n, m;
  cin >> n >> m;
  set<int> x;
  vector<int> y;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    if (a == 1) x.emplace(b);
    if (b == n) y.emplace_back(a);
  }
  for (int i : y) {
    if (x.count(i)) {
      cout << true << endl;
      return 0;
    }
  }
  cout << false << endl;
}



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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
    int n;
    vector<string> s(2);
    cin>>n;
    rep(i,2)cin>>s[i];
    string ans;
    rep(i,n){
        rep(j,2){
            ans += s[j][i];
        }
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var s = ReadLine();
            if (s.Length == 2)
            {
                WriteLine(s);
            }
            else if (s.Length == 3)
            {
                WriteLine(new string(s.Reverse().ToArray()));
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 18456
from sys import stdin
input = lambda: stdin.readline().rstrip("\r\n")
from collections import defaultdict as vector
from collections import deque as que
inin = lambda: int(input())
inar = lambda: list(map(int,input().split()))
from heapq import heappush as hpush,heappop as hpop

s=input()
t=input()
ans=0
for i in range(len(s)):
	if s[i]!=t[i]:
		ans+=1
print(ans)

Measured memory_bytes: 74132
from collections import Counter

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

li = []
for i in P:
  if i <= A:
    li.append(1)
  elif A < i <= B:
    li.append(2)
  else:
    li.append(3)
    
cli = Counter(li)

if len(cli.keys()) != 3:
  print(0)
else:
  print(min(cli.values()))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll L[87];
  L[0] = 2;
  L[1] = 1;
  FOR(i,2,87){
      L[i] = L[i-1]+L[i-2];
  }
  int n;
  cin >> n;
  cout << L[n] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int min_comp(int min, int a)
{

}
int max_comp(int max, int a)
{
  if(max>a)    return max;
  else    return a;
}


int main()
{
  int K;
  int A,B,C;
  int A2,B2,C2;
  int max_flag;
  int min,max;
  int number;
  int debug_cnt;
//  long long N[101]={};
  int i;
  int cont;
//    int k=0;
  scanf("%d %d %d", &A, &B, &C);
  if((A<=C)&&(C<=A+B))
    printf("YES\n");
  else
    printf("NO\n");

  //  else printf("No\n"); 
return 0;
}


Measured memory_bytes: 128
# AOJ 0504: Card Game II
# Python3 2018.7.1 bal4u

from decimal import *

while True:
	n, k, m, r = map(int, input().split())
	if n == 0: break
	
	setcontext(Context(prec=r, rounding=ROUND_HALF_UP))
	one = Decimal(1)
	
	ans = one/Decimal(n)
	if m == 1:
		s = 0
		for i in range(1, n): s += one/Decimal(i)
		ans *= 1+s
	ans = str(ans)[:r+2]
	if len(ans) < r+2: ans += '0'*(r+2-len(ans))
	print(ans)


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

using namespace std;

//ifstream cin("/home/mihai/Documents/c++/A/A.in");
//ofstream cout("/home/mihai/Documents/c++/A/A.out");


int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	if(a + b == 15)
		return cout << '+', 0;
	if(a * b == 15)
		return cout << '*', 0;
	cout << 'x';
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  if(b-a+1>=2*k) {REP(i,k) {
    cout << a+i << endl;
  }
  REP(i,k) {
    cout << b-(k-i)+1 << endl;
  }} else {
    REP(i,b-a+1) {
      cout << a+i << endl;
    }
  }
  return 0;
}


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

const int INF = ~(1 << 31);

class Edge{
public:
	int source, dist, cost;
	Edge() : source(-1), dist(-1), cost(INF) {}
};

int main(){
	int v, e, r, s, t, d;
	vector< vector< int > > min_cost;
	vector< Edge > edge;
	bool negative = false;
	
	cin >> v >> e;
	edge.resize(e);
	min_cost.resize(v);
	
	for(int i = 0; i < v; ++i){
		min_cost[i].resize(v);
		for(int j = 0; j < v; ++j) min_cost[i][j] = INF;
	}
	
	for(int i = 0; i < e; ++i){
		cin >> s >> t >> d;
		edge[i].source = s;
		edge[i].dist = t;
		edge[i].cost = d;
	}
	
	
	
	for(int r = 0; r < v; ++r){
		min_cost[r][r] = 0;
		for(int i = 0; i < v; ++i){
			for(int k = 0; k < e; ++k){
				int source = edge[k].source;
				int dist = edge[k].dist;
				int cost = min_cost[source][r] + edge[k].cost;
				if(min_cost[source][r] != INF && min_cost[dist][r] > cost){
					min_cost[dist][r] = cost;
				}
			}
		}
	}
	
	for(int r = 0; r < v; ++r){
		for(int k = 0; k < e; ++k){
			if(min_cost[edge[k].source][r] != INF && min_cost[edge[k].source][r] + edge[k].cost < min_cost[edge[k].dist][r]){
				negative = true;
				break;
			}
		}
		if(negative) break;
	}
	
	if(negative){
		cout << "NEGATIVE CYCLE" << endl;
	}else{
		for(int r = 0; r < v; ++r){
			for(int i = 0; i < v; ++i){
				if(i != 0) cout << " ";
				if(min_cost[i][r] == INF) cout << "INF";
				else cout << min_cost[i][r];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1332
import sys
input = sys.stdin.readline
N, Q = map(int,input().split())
S = list(input())[:-1]
list_Sum = [0]*(N+1)
for i in range(1, N):
    list_Sum[i+1] = list_Sum[i]
    if S[i-1] == "A" and S[i] == "C":
        list_Sum[i+1] += 1
for i in range(Q):
    l, r = map(int,input().split())
    print(list_Sum[r]-list_Sum[l])

Measured memory_bytes: 56424