akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int M = 1000000007;
#define pb push_back
#define fs first
#define sc second
#define forn(i,k,n) for(int i = k; i < n; ++i)
#define nfor(i,n,k) for(int i = n; i >= k; --i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vvpii vector<vector<pait<int,int>>>
#define all(arr) arr.begin(), arr.end()
#define endl '\n'
#define dbgarr(V,n) forn(i,0,n) cout << V[i] << " "; cout << endl;
#define dbgarrrev(V,n) nfor(i,n,0) cout << V[i] << " "; cout << endl;
#define dbgmaze(V) for(auto x: V) {for(auto y : x) cout << y <<  " ";cout << endl;}
#define dbg2d(V,n,m) forn(i,0,n) {forn(j,0,m) cout << V[i][j] <<  " ";cout << endl;}
#define N 100005
#define inf 1000000000
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n; cin >> n;
	int A[n][3] ;
	forn(i,0,n) cin >> A[i][0] >> A[i][1] >> A[i][2];
	int dp[n + 1][3] = {};
	dp[0][0] = A[0][0]; dp[0][1] = A[0][1]; dp[0][2] = A[0][2];
	forn(i,1,n){
		forn(j,0,3){
			dp[i][j] = -inf;
			forn(k,0,3){
				if(j != k){
					dp[i][j] = max(dp[i][j],dp[i - 1][k] + A[i][j]);
				}
			}
		}
	}
	cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
    return 0;
}


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

using namespace std;

using LL = long long;
using PII = pair<int, int>;
using ll = long long;
using DBL = double;
using VI = vector<int>;
using VD = vector<DBL>;
using VVI = vector<VI>;
using VVD = vector<VD>;
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define REP(i,n) FOR(i,0,n)
#define SZ(a) ((int)((a).size()))
#define ALL(x) (x).begin(), (x).end()
#define SET(a,v) memset((a), (v), sizeof(a))
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define ST first
#define ND second

#define trace(...) {__f(#__VA_ARGS__, __VA_ARGS__);}
template<typename Arg> void __f(const char* name, Arg&& arg) {
  cerr << name << " = " << arg << std::endl;
} template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1<<" | ";__f(comma+1, args...); }
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds; // OST: find_by_order, order_of_key
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// #pragma GCC optimize("Ofast")
// optimize("unroll-loops")
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// /*** RNGS ***/
// SEED=chrono::steady_clock::now().time_since_epoch().count();
// // or high_resolution_clock
// mt19937 rng(SEED); /*or*/ random_device rd; mt19937 rng(rd());
// uniform_int_distribution<> dis(MIN, MAX);// usage: dis(rng)
// struct chash {int operator()(int x) const {return x^SEED;}};
// gp_hash_table<int,int,chash>m;//use cc if very less updates
// /*** FAST IO ***/
// inline int scan(){ bool y=0; int x=0; char c=getchar_unlocked();
// while(c<'0'||c>'9'){ if(c=='-')y=1; c=getchar_unlocked();}
// while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar_unlocked();}
// return y?-x:x; }

const int N = 100010;
int idx = 1;
map<char, int> m[N];

void insert_string(const string &s) {
	int node = 0;
	for(auto&z: s) {
		if(m[node].count(z) == 0) m[node][z] = idx++;
		node = m[node][z];
	}
}

long long calc(int node, long long h) {
	if(SZ(m[node]) == 0) return 0;
	if(SZ(m[node]) == 1) {
		assert(h != 0);
		long long temp = 1;
		while(true) {
			if(temp * 2 <= h and h % (temp * 2) == 0) temp *= 2;
			else break;
		}
		// trace(temp, node, h);
		return (temp ^ (calc(m[node].begin()->second, h-1)));
	}
	if(SZ(m[node]) == 2) return ( (calc(m[node]['0'], h-1)) ^ (calc(m[node]['1'], h-1)) );
	assert(SZ(m[node]) <= 2);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	long long l;
	cin >> n >> l;
	for(int i=1; i<=n; ++i) {
		string s;
		cin >> s;
		insert_string(s);
	}
	if(calc(0, l)) cout << "Alice\n";
	else cout << "Bob\n";
	return 0;
}

Measured memory_bytes: 15852
#include <stdio.h>

int main(void){
    int i=1;
    int temp;
    
    scanf("%d\n", &temp);
    
    while(temp !=0){
        printf("Case %d: %d\n", i, temp);
        scanf("%d\n", &temp);
        i++;
    }

    return 0;
}



Measured memory_bytes: 2032
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


/////////////////////////////////////////////////////////////////

bool check(ll a,ll b){
    while(a>0&&b>0){
        if(a%2==1&&b%2==1){
            return false;
        }
        a/=2;
        b/=2;
    }
    return true;
}


int main(){
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=0,s=0,t=1;
    ll sum=0;
    while(s<=n-1){
        while(t<=n&&check(sum,a[t-1])){
            ans+=(t-s);
            sum+=a[t-1];
            t++;
        }
        sum-=a[s];
        s++;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1920
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

uint64_t gcd(uint64_t a, uint64_t b) {
    uint64_t ret = b;
    if (a < b) {
        ret = a;
        a = b;
        b = ret;
    }
    while (true) {
        if (a % b == 0) return ret;
        else {
            ret = a % b;
            a = b;
            b = ret;
        }
    }
}

uint64_t lcm(uint64_t a, uint64_t b) {
    uint64_t ret = (a / gcd(a, b)) * b;
    return ret;
}

int main() {
    uint64_t n, buf;
    cin >> n;
    vector<uint64_t> t(n);
    for (int i = 0;i < n;i++) cin >> t.at(i);
    if (n == 1) {
        cout << t.at(0) << endl;
        return 0;
    }
    for (int i = 0;i < (n - 1);i++) {
        buf = lcm(t.at(i), t.at(i + 1));
        t.at(i + 1) = buf;
    }
    cout << buf << endl;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
s=[input() for _ in range(h)]
d=[[0,1],[1,0],[-1,0],[0,-1]]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            continue
        ok=False
        for dx,dy in d:
            nx,ny=i+dx,j+dy
            if 0<=nx<h and 0<=ny<w:
                if s[nx][ny]=="#":
                    ok=True
        if not ok:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 9220
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;
typedef pair<ll, pair<ll, ll > > iip;
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;
//差を考える
int main() {

    //fstream in("input.txt");
    //cin.rdbuf(in.rdbuf());

    ll N; cin >> N;
    vector<iip> A;

    for(ll i = 0; i < N; i++){
        ll a; cin >> a;
        A.push_back(make_pair(0, make_pair(a, 0)));
    }

    for(ll i = 0; i < N; i++){
        ll b; cin >> b;
        A[i].first = b - A[i].second.first;
        A[i].second.second = b;
    }

    sort(A.rbegin(), A.rend());

    ll stock = 0;

    for(ll i = 0; i < N; i++){
        //cout << i << " " << stock << " " << A[i].first << endl;
        if(A[i].first >= 0){
            stock += A[i].first / 2;
            /*
            if(A[i].first % 2 == 1){
                stock--;
            }
            */
        }else{
            stock -= abs(A[i].first);
        }
    }

    if(stock < 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
 
}

Measured memory_bytes: 704
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 500005
 
#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define F first
#define S second
 
#define fixx(n) fixed << setprecision(n)
 
#define ll 	  long long 
 
#define mod  1000000007


 
int main()
{
	FAST;
	int n;
	cin >> n;
	ll ans = 0;
	int a[n+6];
	for(int i = 0 ;i < n; i++){
		cin >> a[i];
	}
	for(int i = 1; i < n; i++){
		if(a[i] < a[i-1]){
			ans += a[i-1]- a[i];
			a[i] = a[i-1];
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4380
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    ll n;
    cin>>n;
    ll a[200010]={},b[200010]={};
    vll v;
    ll sum=0;
    ll t=0;
    ll m=LLINF;
    rep(i,n){
        cin>>a[i]>>b[i];
        sum+=a[i];
        if(a[i]>b[i]){
            v.pb(b[i]);
            if(m>b[i]){
                t=i;
                m=b[i];
            }
        }
    }
    if(v.size()>0) sum-=b[t];
    else sum=0;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << "  " << y << endl
#define dbg3(x, y, z) cout << x << "  " << y << "  " << z << endl;
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    int arr[n];
    f(i, 0, n){
        cin >> arr[i];
    }
    int min = INT_MAX;
    int pts = 0;
    f(p, 1, 100){
        pts = 0;
        f(i, 0, n){
            pts += (arr[i] - p) * (arr[i] - p);
        }
        if(pts < min){
            min = pts;
        }
    }
    cout << min << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 1000005
#define ll long long
#define debug(a) cout<<#a<<": ";for(auto i:a)cout<<i<<" ";cout<<endl;
#define trace(a) cout<<#a<<": "<<a<< endl;

int p[N];
set<int> pos,val;
bool vis[N];
vector<int> adj[N];
void dfs(int node) {
	val.insert(p[node]);
	pos.insert(node);
	vis[node] = true;
	for(int it : adj[node]) {
		if(!vis[it]) {
			dfs(it);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
	int i,j,k,l,m,n,t;
	cin >> n >> m;
	for(int i = 1;i <= n;i++) {
		cin >> p[i];
	}
	for(i = 0;i < m;i++) {
		int u,v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int cnt = 0;
	for(i = 1;i <= n;i++) {
		if(!vis[i]) {
			dfs(i);
			
			for(int it : val) {
				if(pos.find(it) != pos.end()) {
					pos.erase(it);
					cnt++;
				}
			}
			val.clear();
			pos.clear();
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 42368
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

const int mod = 1e9+7;
int main() {
  string s; cin >> s;
  int n = s.length();
  vvi dp(n+1, vi(13, 0));
  dp[0][0] = 1;
  rep(i, n) {
    rep(j, 13) {
      if (s[i]== '?') {
        rep(k,10) {
          dp[i+1][(j*10 + k) % 13] += dp[i][j];
          dp[i+1][(j*10 + k) % 13] %= mod;
        } 
      } else {
        int d = s[i] - '0';
        dp[i+1][(j*10 +d ) % 13] += dp[i][j];
        dp[i+1][(j*10 + d) % 13] %= mod;
      }
    }
  }
  cout << dp[n][5] << endl;
  return 0;
}

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

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

    int x = min(A, B)+1;
    while(K > 0){
        --x;
        if(A%x == 0 && B%x == 0) --K;
    }

    cout << x << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String... nui) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
		
		System.out.println(a + b + c - Math.max(a, Math.max(b, c)));
		
	}

}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc078/tasks/abc078_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    A, B = [int(x, base=16) for x in input().split()]
    ans = '='
    if A < B:
        ans = '<'
    elif A > B:
        ans = '>'
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
    


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define x fir
#define y sec

pii p[64];

int main()
{
    canhazfast();

    int n, ans = 0;
    map<pii, int> mp;

    cin >> n;
    for (int i = 0; i < n; ++i) cin >> p[i].x >> p[i].y;
    sort(p, p+n);
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            int dx = p[i].x-p[j].x, dy = p[i].y-p[j].y;
            ++mp[{dx, dy}];
        }
    }
    for (const auto &e : mp) ans = max(ans, e.sec);
    ans = n-ans;
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, a[50], b[50], c[50];
int ans;

signed main() {
	cin >> 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 < n - 1; i++)cin >> c[i];
	for (int i = 0; i < n; i++) {
		ans += b[i];
		if (i > 0 && a[i - 1] + 1 == a[i])ans += c[a[i - 1] - 1];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
void read(int&a) {
	a = 0; char k = getchar(); int f = 1;
	for(;!isdigit(k); k = getchar()) if (k == '-') f = -1;
	for(; isdigit(k); k = getchar()) a = a * 10 + k - '0';
	a *= f;
}
const int N = 1e6 + 5;
int n, a[N], b[N], flag = true;
char s[N];
queue<int> Q;
int main()
{
	scanf("%d", &n);
	scanf("%s", s); for(int i = 0; i < n; ++i) a[i] = s[i] - 'a' + 1;
	scanf("%s", s); for(int i = 0; i < n; ++i) b[i] = s[i] - 'a' + 1, flag &= b[i] == a[i];
	int s = n - 1, t = n - 1;
	if(flag) {
		printf("0\n");
		return 0;
	}
	int ans = 1;
	while(t >= 0) {
		while(t > 0 && b[t] == b[t - 1]) t -= 1;
		while(s >= 0 && (s > t || a[s] != b[t])) s -= 1;
		if(s < 0) {
			printf("-1\n");
			return 0;
		}
		while(Q.size() && Q.front() - Q.size() >= t) Q.pop();
		if(s != t) Q.push(s);
		ans = max(ans, (signed)Q.size() + 1);
		--t;
	}
	printf("%d\n", ans);
	return 0;
}








































Measured memory_bytes: 13184
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,x=0;
    cin>>a>>b>>c;
    x=a*100+b*10+c;
    if(x%4==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}


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

const int MOD = 10007;

int dp[1024][8];

int joi(char c)
{
	if (c == 'J') return 4;
	else if (c == 'O') return 2;
	return 1;
}

int main()
{
	int n;
	char key[1024] = {0};
	
	scanf("%d", &n);
	scanf("%s", key);
	
	int first = joi(*key);
	for (int i = 1; i < 8; i++){
		if ((i | first | 4) != i) continue;
		dp[1][i] = 1;
	}
	int last = 4;
	for (int i = 2; key[i - 1] != 0; i++){
		int today = joi(key[i - 1]);
		
		for (int j = 0; j < 8; j++){
			if ((j | today) != j) continue;
			for (int k = 0; k < 8; k++){
				if ((j & k) == 0) continue;
				dp[i][j] = (dp[i][j] + dp[i - 1][k]) % MOD;
			}
		}
		last = today;
	}
	int sum = 0;
	for (int i = 0; i < 8; i++){
		sum = (sum + dp[n][i]) % MOD;
	}
	printf("%d\n", sum);
	
	return 0;
}

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

public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;

  private static PrintWriter _err = new PrintWriter(System.err);

  private int N;
  private long[] T;
  private int M;
  private int[] P;
  private long[] X;

  private void solve(Scanner sc, PrintWriter out) {
    N = sc.nextInt();
    T = new long[N];
    Map<Integer, Long> map = new HashMap<>();
    long total = 0;
    for (int i = 0; i < N; ++i) {
      T[i] = sc.nextLong();
      total += T[i];
      map.put(i + 1, T[i]);
    }
    M = sc.nextInt();
    P = new int[M];
    X = new long[M];
    for (int i = 0; i < M; ++i) {
      P[i] = sc.nextInt();
      X[i] = sc.nextLong();

      long newTotal = total - map.get(P[i]) + X[i];
      out.println(newTotal);
    }
  }
  private long C(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    for (long i = r; i > 1; --i) {
      res /= i;
    }
    return res;
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  private long ceil2pow(long n) {
    if (n == 0) {
      return 1;
    }
    n--;
    n |= (n >>> 1);
    n |= (n >>> 2);
    n |= (n >>> 4);
    n |= (n >>> 8);
    n |= (n >>> 16);
    n++;
    return n;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();

    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();

    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

Measured memory_bytes: 10320
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
class UnionFind():

    def __init__(self, n):
        self.n = n
        self.node = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def same(self, x, y):
        return bool(self.root(x) == self.root(y))

    def root(self, x):
        if self.node[x] == x:
            return x
        else:
            self.node[x] = self.root(self.node[x])  # 経路圧縮
            return self.node[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y:
            return  # 結合不要
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.node[y] = x
        self.size[x] += self.size[y]

    def return_size(self, x):
        return self.size[self.root(x)]


n = II()
s = IS()
cnt = 0
ans = s
for c in s:
    if c == '(':
        cnt += 1
    else:
        if cnt > 0:
            cnt -= 1
        else:
            ans = '(' + ans
cnt = 0
for c in s[::-1]:
    if c == ')':
        cnt += 1
    else:
        if cnt > 0:
            cnt -= 1
        else:
            ans = ans + ')'
print(ans)





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

int main(){
  ll N,count=0;
  cin>>N;
  vector<ll> A(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i);
  }
  for(int i=0; i<N-1; i++){
    if(A.at(i+1)<A.at(i)){
      count+=A.at(i)-A.at(i+1);
      A.at(i+1)=A.at(i);
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 4756
#include "bits/stdc++.h"
using namespace std;
const int maxn = 26;
const int sz = 200100;
int ls[1<<maxn], dp[sz];
int M(){
    string s;
    if(!(cin >> s)) return 0;
    for(int e = 0; e < 1<<maxn; e++) ls[e] = sz;
    int my = 0;
    dp[0] = 0;
    ls[0] = 0;
    for(int e = 0; e < s.size(); e++){
        my ^= 1<<(s[e] - 'a');
        dp[e+1] = 1 + dp[e];
        for(int f = 0; f < 26; f++){
            int mask = 1<<f;
            mask ^= my;
            dp[e+1] = min(dp[e+1], ls[mask] + 1);
        }
        dp[e+1] = min(dp[e+1], ls[my] + 1);
        ls[my] = min(ls[my], dp[e+1]);
    }
    cout << dp[s.size()] << endl;
    return 1;
}
int main(){
    while(M());
    return 0;
}


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

int bubbleSort(int A[], int N){
  int sw = 0;
  bool flag = 1;

  for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N - 1; j >= i + 1; j--){
      if(A[j] < A[j - 1]){
	swap(A[j], A[j - 1]);
	flag = 1;
	sw++;
      }
    }
  }
  return sw;
}

int main(){
  int A[100], N, sw;

  cin >> N;

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

  sw = bubbleSort(A, N);

  for(int i = 0; i < N; i++){
    if(i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll ans, n, a[222222], b[222222];
ll c[222222], d[222222];

bool isok(int x)
{
	ll i, cut=(1LL<<(x+1)), cnt=0, lef, rig;
	for(i=1 ; i<=n ; i++) c[i]=a[i]%cut;
	for(i=1 ; i<=n ; i++) d[i]=b[i]%cut;
	d[0]=-1e18; sort(d+1,d+n+1); d[n+1]=1e18;
	for(i=1 ; i<=n ; i++)
	{
		lef=(1LL<<x)-c[i];
		rig=2LL*(1LL<<x)-c[i]-1;
		cnt+=upper_bound(d,d+n+2,rig)-lower_bound(d,d+n+2,lef);
		lef=3LL*(1LL<<x)-c[i];
		rig=4LL*(1LL<<x)-c[i]-1;
		cnt+=upper_bound(d,d+n+2,rig)-lower_bound(d,d+n+2,lef);
	}
	if(cnt%2==1) return true;
	return false;
}

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n; int i, j;
	for(i=1 ; i<=n ; i++) cin>>a[i];
	for(i=1 ; i<=n ; i++) cin>>b[i];
	for(i=0 ; i<=28 ; i++) if(isok(i)) ans+=(1LL<<i);
	cout<<ans; return 0;
}

// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int a,b,c,d,e,f,g,h;

int main(){
	cin>>a>>b>>c>>d>>e>>f>>g>>h;
	if(a+b+c+d>e+f+g+h)cout<<a+b+c+d<<endl;
	else cout<<e+f+g+h<<endl;
}

Measured memory_bytes: 0
// 二分探索, BIT
package main

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

// BIT stands for binary indexed tree.
type BIT []int

func newBIT(n int) BIT {
	return make([]int, n)
}

func (bit BIT) add(i, v int) {
	for i++; i <= len(bit); i += i & -i {
		bit[i-1] += v
	}
}

func (bit BIT) sum(i int) int {
	result := 0
	for i++; i > 0; i -= i & -i {
		result += bit[i-1]
	}
	return result
}

type t struct {
	X int
	H int
}
type byX []t

func (a byX) Len() int           { return len(a) }
func (a byX) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a byX) Less(i, j int) bool { return a[i].X < a[j].X }

func main() {
	N := readInt()
	D := readInt()
	A := readInt()
	XH := make([]t, N)
	for i := 0; i < N; i++ {
		XH[i].X = readInt()
		XH[i].H = (readInt() + A - 1) / A
	}

	sort.Sort(byX(XH))
	result := 0
	bit := newBIT(N + 1)
	for i := 0; i < N; i++ {
		x, h := XH[i].X, XH[i].H
		h -= bit.sum(i)
		if h <= 0 {
			continue
		}
		result += h
		bit.add(i, h)

		ok := i
		ng := N
		for ng-ok != 1 {
			m := ok + (ng-ok)/2
			if XH[m].X <= x+2*D {
				ok = m
			} else {
				ng = m
			}
		}
		bit.add(ng, -h)
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 11008
N,K=map(int,input().split())
List = list(map(int, input().split()))
 
def imosu(x,k):
  data = [0]*k
  for i in range(k):
    first = i-x[i]
    last = i+x[i]
    if first < 0:
      first = 0
    data[first] += 1
    if last+1 < k:
      data[last+1] +=-1
  ruiseki = [0]*k
  ruiseki[0] = data[0]
  for i in range(k-1):
    ruiseki[i+1] = ruiseki[i] + data[i+1]
  return ruiseki
 
for i in range(K):
  List = imosu(List,N)
  if List.count(N) == N:
    break
print(*List)

Measured memory_bytes: 142004
#include <iostream>

using namespace std;

int main(){
  int data[5], k, i, j, flag=0;
  for(i=0; i<5; i++) cin >> data[i];
  cin >> k;
  for(i=0; i<5; i++){
    for(j=i+1; j<5; j++){
      if(abs(data[i]-data[j]) > k){
        flag=1;
        break;
      }
    }
  }
  if(flag == 0) cout << "Yay!"  << endl;
  else cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	map<int, int> mp;
	FOR(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	int ret = 0;
	for (auto itr = mp.begin(); itr != mp.end(); itr++) {
		if (itr->second & 1) ret++;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=1e5;
const long inf=1e18;
int main(){
	long A; string B; cin>>A>>B;
    long C = 100 * (B[0] - '0') + 10 * (B[2] - '0') + (B[3] - '0');
    cout<<A * C / 100<<endl;
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9

const int MOD = 1e9+7;

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

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
const int MAXN = 1e5+5;
int x[MAXN];
int ending[MAXN];
int answer[MAXN];
int bsa[MAXN];
int l;
int bs(int lo, int hi, int cur) {
	int ret=-1;
	while(lo<=hi) {
		int mid=lo+(hi-lo+1)/2;
		if(x[mid]-x[cur]<=l) ret=mid,lo=mid+1;
		else hi=mid-1;
	}
	return ret;
}
int main() {
//	freopen("TASK.in","r",stdin);freopen("TASK.out","w",stdout);
//	precompute();
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) scanf("%d",&x[i]);
	int BLOCK = sqrt(n);
	cin>>l;
	for(int i=1;i<=n;i++) bsa[i]=bs(i+1,n,i);
	for(int i=1;i<=n;i++) {
		int st=i,en=i+BLOCK;
		if(i+BLOCK>n) break;
		int ans=0;
		while(st<en) {
			int idx = bsa[st];
			ans++;
			if(idx>=en) st=en,ending[i]=idx;
			else st=idx;
		}
		answer[i]=ans;
	}
	int q;
	cin>>q;
	while(q--) {
		int a,b;
		scanf("%d%d",&a,&b);
		if(a>b) swap(a,b);
		if(a+BLOCK==b) {
			printf("%d\n",answer[a]);
			continue;
		}
		else if(a+BLOCK>b) {
			int st=a,en=b;
			int ans=0;
			while(st<en) {
				int idx = bsa[st];
				ans++;
				if(idx>=en) st=en;
				else st=idx;
			}
			printf("%d\n",ans);
			continue;
		}
		else {
			int ans=0;
			while(a+BLOCK<b) {
				ans+=answer[a];
				a=ending[a];
			}
			while(a<b) {
				int idx=bsa[a];
				ans++;
				if(idx>=b) a=b;
				else a=idx;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}


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

int main()
{
	int n;
	cin >> n;
	int a=100000;
	int b=0;
	for (int i=0;i<n;i++){
		b = a*1.05;
		if(b/1000.0-b/1000){
			a = (b/1000+1)*1000;}
		else 
			a = a*1.05;
	}
	cout << a << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
using lint = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int prev = -1;
    lint answer = 1;
    string s, t;
    vector<set<int> > alphabetPos(26);
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        s[i] -= 'a';
        alphabetPos[s[i]].insert(i);
    }
    for (char& c : t) {
        c -= 'a';
        if (!alphabetPos[c].size()) {
            answer = -1;
            break;
        }
        set<int>::iterator iter = alphabetPos[c].upper_bound(prev);
        if (iter == alphabetPos[c].end()) {
            answer += s.size();
            iter = alphabetPos[c].begin();
        }
        prev = *iter;
    }
    if (answer > 0) answer += prev;
    cout << answer;
    return 0;
}

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

int main(void){
  int n500, n100, n50;
  int total;
  int ans = 0;
  cin >> n500 >> n100 >> n50 >> total;
  for(int i = 0; i <= n500; ++i){
    for(int j = 0; j <= n100; ++j){
      for(int k = 0; k <= n50; ++k){
	if(500*i + 100*j + 50*k == total){
	  ++ans;
	}
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
using namespace std;

#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, ", ")
#define dbgln(x) DBG_PRINT(#x, x, endl)
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")
#define idbgln(x, i) DBG_PRINT(#x "[" << i << "]", x[i], endl)

typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

bool ask_blue(vector<bool>& q) {

	const int n = q.size();
	int s = 0;

	printf("?");
	for(int i = 0; i < n; i++) {
		if(q[i]) {
			printf(" %d", i + 1);
			s += 1;
		}
	}
	printf("\n");
	fflush(stdout);

	assert(s == (n >> 1));

	char buf[102];
	scanf("%s", buf);

	if(buf[0] == 'B') {
		return true;
	} else if(buf[0] == 'R') {
		return false;
	} else {
		assert(false);
	}
	return false;
}

int main() {

	int n;

	scanf("%d", &n);

	vector<bool> q(n * 2);
	for(int i = 0; i < n; i++) {
		q[i] = true;
		q[i + n] = false;
	}

	bool initial = ask_blue(q);
	int lo = 0, hi = n;

	while(hi - lo > 1) {
		int mid = (lo + hi) / 2;
		for(int i = 0; i < 2 * n; i++) {
			q[i] = false;
		}
		for(int i = 0; i < n - mid; i++) {
			q[i] = true;
		}
		for(int i = 0; i < mid; i++) {
			q[n + i] = true;
		}
		bool ans = ask_blue(q);
		if(initial != ans) {
			hi = mid;
		} else {
			lo = mid;
		}
	}

	vector<bool> main_color(2 * n, false);
	int x = n - hi;
	int y = lo;

	main_color[x] = true;
	main_color[n + y] = false;

	for(int i = 0; i < 2 * n; i++) {
		q[i] = false;
	}
	for(int i = 0; i < x; i++) {
		q[i] = true;
	}
	for(int i = 0; i < y; i++) {
		q[n + i] = true;
	}

	for(int i = x + 1; i < n; i++) {
		q[i] = true;
		bool ans = ask_blue(q);
		main_color[i] = (initial == ans);
		q[i] = false;
	}

	for(int i = y + 1; i < n; i++) {
		q[n + i] = true;
		bool ans = ask_blue(q);
		main_color[n + i] = (initial == ans);
		q[n + i] = false;
	}

	q[x] = q[n + y] = true;

	for(int i = 0; i < x; i++) {
		q[i] = false;
		bool ans = ask_blue(q);
		main_color[i] = (initial != ans);
		q[i] = true;
	}

	for(int i = 0; i < y; i++) {
		q[n + i] = false;
		bool ans = ask_blue(q);
		main_color[n + i] = (initial != ans);
		q[n + i] = true;
	}

	char blue = 'B', red = 'R';
	char mc = (initial) ? blue : red;
	char sc = (initial) ? red : blue;

	printf("! ");
	for(int i = 0; i < 2 * n; i++) {
		char c = (main_color[i]) ? mc : sc;
		printf("%c", c);
	}
	printf("\n");

	return 0;
}


// wafdayo~~~


Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
char a[1001];
int ans;
int main()
{
	gets(a);
	int k=strlen(a);
	for(int i=0;i<k;i++)
	{
		if(a[i]=='C')
		{
			for(int j=i;j<k;j++)
			{
				if(a[j]=='F')
				{
					cout<<"Yes"<<endl;return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fu(a,b) for(int i=a;i<b;i++)
#define fv(a,b) for(int j=a;j<b;j++)
using namespace std;

int mini(int x, int y)
{
	return x>y?y:x;
}

int main()
{
	int dp[100001];
	fu(0,100001)
	dp[i]=INT_MAX;
	dp[0]=dp[1]=0;
	int n,k;
	cin>>n>>k;
	int a[n+1];
	fu(1,n+1)
	{
		cin>>a[i];
	}
	dp[2]=abs(a[1]-a[2]);
	fu(1,n+1)
	{
		fv(i+1,i+k+1)
		{
			if(j<n+1)
			dp[j]=mini(dp[j],dp[i]+abs(a[i]-a[j]));
		}
	}
	
	cout<<dp[n];
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //int ycnt = 0;
            int ans = 0;
            int j = 0;

            while (ans==0)
            {
                for(int i = 2; i <= n+j; i++)
                {
                    if ((n + j) % i == 0)
                    {
                        if (i != n+j)
                        {
                            break;
                        }
                        else
                        {
                            ans = n + j;
                            //Console.WriteLine(ans);
                            break;
                        }
                    }
                }
                j++;
            }

            /*while(ycnt!=2)
            {
                ycnt = 0;
                if ((n + i) % 2 == 1)
                {
                    if ((n + i) % 3 == 1)
                    {
                        if ((n + i) % 5 == 1)
                        {
                            if ((n + i )% 7 == 1)
                            {
                                if ((n + i) % 11 == 1)
                                {
                                    for (int j = 1; j < n + i; j += 2)
                                    {
                                        if ((n + i) / j == 0) ycnt++;
                                        Console.WriteLine(j);

                                    }

                                }
                            }
                        }
                    }
                }
                i++;
            }*/
            //ans = n + i;



            Console.WriteLine(ans);


        }
    }
}


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

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

    int n;
    cin >> n;
    vector<long long> a;
    for (int i = 0; i < n; i++) {
        long long b;
        cin >> b;
        if (b == 0) {
            cout << 0 << "\n";
            return 0;
        }
        a.push_back(b);
    }

    long long r = 1;
    for (auto x : a) {
        long long tmp = r;
        if (x <= 1000000000000000000/r) {
            r *= x;
        }
        else {
            cout << -1 << "\n";
            return 0;
        }
    }
    cout << r << "\n";
}

Measured memory_bytes: 4256
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

int main()
{
	int64_t n, m, counter = 0;
	cin >> n >> m;
	auto h = vector<vector<int64_t>>(n);
	auto a = vector<int64_t>(m, 0);
	auto b = vector<int64_t>(m, 0);

	for (int64_t i = 0; i < n; i++)
	{
		int64_t temp;
		cin >> temp;
		h[i].push_back(temp);
	}

	for (int64_t i = 0; i < m; i++)
	{
		int64_t temp1, temp2;
		cin >> temp1 >> temp2;
		a.push_back(temp1);
		b.push_back(temp2);
		h[temp1 - 1].push_back(h[temp2 - 1][0]);
		h[temp2 - 1].push_back(h[temp1 - 1][0]);
	}

	for (int64_t i = 0; i < n; i++)
	{
		int64_t temp = h[i][0];
		if (h[i].size() == 1)
		{
			counter++;
		}
		else
		{
			h[i][0] = -1;
			sort(h[i].rbegin(), h[i].rend());
			if (h[i][0] < temp)
			{
				counter++;
			}
		}
	}

	cout << counter << endl;
	return 0;
}

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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> p;
  load(p, n);

  int x = 0, y = 0, z = 0;
  for (auto &item : p) {
    if (item <= a) {
      x++;
    } else if (a + 1 <= item && item <= b) {
      y++;
    } else if (b + 1 <= item) {
      z++;
    }
  }
  p(min({x, y, z}));
}

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

using namespace std;
vector<vector<long long>> AdjList;
vector<long long> color;
long long part=0;

//we will check if the graph is bipartie
//if bipartie we can connect all the vertex in part1 to all the vertex in part 2
//=> answer is vertex in part1 * part 2
//else
//answer is all the edge between all the vertex
//=> n*(n-3)/2 + n = n*(n-1)/2;

bool check(long long start)
{
    color[start]= 1;
    queue<long long> s;
    s.push(start);

    while(!s.empty())
    {
        long long u = s.front();
        if(color[u]==1)
            part++;
        s.pop();
        for(long long v:AdjList[u])
        {
            if(color[v]==-1)
            {
                color[v] = 1 - color[u];
                s.push(v);
            }
            else if(color[v]==color[u])
                return false;
        }
    }

    return true;
}

signed main()
{
    long long n,m;
    cin>>n>>m;
    AdjList.resize(n+1);
    color.assign(n+1,-1);

    long long start;
    for(long long i=0;i<m;i++)
    {
        long long u,v;
        cin>>u>>v;
        AdjList[u].push_back(v);
        AdjList[v].push_back(u);
        start = u;
    }



    if(check(start))
    {
        cout<<((part*(n-part))-m);
    }
    else
    {
        cout<<(((n*(n-1))/2)-m);
    }

}


Measured memory_bytes: 7168
n = int(input())
d = [tuple(map(int, input().split())) for i in range(n)]

for i in range(n - 2):
  if d[i][0] == d[i][1]:
    if d[i + 1][0] == d[i + 1][1] and d[i + 2][0] == d[i + 2][1]:
      print('Yes')
      break
else:
  print('No')

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

int main()
{
    int n;
    ll ans = 0;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep2(i, 1, n) {
        if (a[i] < a[i-1]) {
            ans += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout << ans << endl;
    return 0;
}

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

namespace ConsoleApp3
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] ab = Console.ReadLine().Split(' ').ToArray();
			int n = int.Parse(ab[0] + ab[1]);

			string ans = isSq(n) ? "Yes" : "No";

			Console.WriteLine(ans);
		}

		static bool isSq(int n)
		{
			double val = Math.Sqrt(n);
			if (Math.Ceiling(val) == Math.Floor(val))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <string.h>

int main(){
    int i,len1,len2,count=0;
    char a[5], b[5];
    
    scanf("%s",a);
    scanf("%s",b);
    
    len1=strlen(a);
    len2=strlen(b);
    
    for(i=0;i<len1;i++){
        if(a[i]==b[i]){
            count++;
        }
    }
    
    printf("%d\n",count);
     
    
    return 0;
}

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

typedef long long ll;
const ll MOD = 1000000007;

int main() {
    ll N;
    ll S = 0;
    cin >> N;
    vector<ll>A(N);
    vector<ll>X(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        S += A[i];
    }
    X[0] = S;
    for (int i = 1; i < N-1; i += 2) {
        X[0] -= 2*A[i]; 
    }
    cout << X[0] << endl;
    for (int i = 1; i < N; i++) {
        X[i] = 2*A[i-1] - X[i-1];
        cout << X[i] << endl;
    }
}


Measured memory_bytes: 2944
n = 4
a = [1, 2, 3, 4]

n = int(input())
a = input().split()


if n % 2 == 0:
    y = [a[j] for j in range(1, n, 2)][::-1]
    z = [a[j] for j in range(0, n, 2)]

else:
    y = [a[j] for j in range(0, n, 2)][::-1]
    z = [a[j] for j in range(1, n, 2)]

print(" ".join(map(str, y + z)))


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


int main(){

    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,s.size()) {
        int x = s[i] - 'A';
        x = (x + n) % 26;
        s[i] = x + 'A';
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256