akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using plpii = std::pair<long long, std::pair<int, int>>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;

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

	int k;
	string s;
	cin >> k >> s;
	if (s.length() <= k) {
		cout << s << "\n";
	}
	else {
		cout << s.substr(0, k) << "..." << "\n";
	}

	return 0;
}



Measured memory_bytes: 3656
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<usize>();
    let S = read_String_Vec();
    let mut array = vec![0; N+1];

    for n in 0..N {
        array[n+1] = {
            if S[n] == 'I' {
                array[n] + 1
            } else {
                array[n] - 1
            }
        };
    }
    array.sort();
    println!("{}", array[N]);


}


Measured memory_bytes: 4352
# import bisect
# from collections import Counter, defaultdict, deque, namedtuple
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    q = int(input())
    prime = [False] * 100001
    count = [0] * 100001
    prime[2] = True

    for i in range(3, 100001, 2):
        for j in range(3, int(i**0.5)+1, 2):
            if i % j == 0:
                break
        else:
            prime[i] = True

    for i in range(3, 100001):
        count[i] = count[i-1]
        if i % 2 == 1 and prime[i] and prime[(i+1)//2]:
            count[i] += 1

    for i in range(q):
        l, r = list(map(int,ipti().split()))
        print(count[r]-count[l-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 54592
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int A,B;

int main(){
	cin>>A>>B;
	int t=B-A;
	for(int i=1;i<=t;i++) B-=i;
	cout<<-B<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
typedef long long ll;

using namespace std;

int N, M;
int pnum[100000] = {};
int pcount = 0;
ll ans;
static int mod = 1000000007;

ll mul2(ll a, ll b) {
    return ((a % mod) * (b % mod)) % mod;
}

ll modinv(ll a) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

ll div2(ll a, ll b) {
    return mul2(a, modinv(b));
}

ll nCr(ll n, ll r) {
    if (r * 2 > n) r = n - r;
    ll ans = 1;
    for (int i = 1; i <= r; ++i) {
        ans = mul2(ans, (n - i + 1));
        ans = div2(ans, i);
    }
    return ans;
}

int main() {
    cin >> N >> M;
    int temp = M;
    for (int i = 2; i <= sqrt(temp); i++) {
        while (temp % i == 0) {
            pnum[i]++;
            pcount++;
            temp /= i;
        }
    }
    if(temp != 1) pnum[1]++;
    ans = 1;
    for (int i = 1; i <= sqrt(M); i++) {
        //if(pnum[i] != 0)cout << "prime num:" << i << " count:" << pnum[i] << " nCr:" << nCr(pnum[i] + N - 1, pnum[i]) << endl;
        ans = mul2(ans, nCr(pnum[i] + N - 1, pnum[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,A,B = map(int,input().split())
goukei = 0

for i in range(N+1):
    c = 0
    t = i
    while t > 0:
        c += t % 10
        t //= 10
    if c >= A and c <=B:
        goukei += i
print(goukei)

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

using namespace std;

int main(){
    int x,y,a;

    cin >> x >> y;
    a = 4 * x - y;

    if(a % 2 == 0 && 0 <= a/2 && a/2 <= x) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;
void bin(unsigned n) 
{ 
    unsigned i; 
    for (i = 1 << 10; i > 0; i =    i / 2) 
        (n & i)? printf("1"): printf("0"); 

    printf("\n");
} 

int main(){
    int cases;cin>>cases;
    int min = 1e9;
    int out = 0;
    fore(c,0,cases){
        int val;cin>>val;
        if(val<min){
            out++;
            min = val;
        }
    }
    cout<<out;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int h, w, d; cin >> h >> w >> d;
    map<int, pair<int, int>> m;
    rep(i, h) rep(j, w) {
        int a; cin >> a;
        m[a] = {i, j};
    }
    int q; cin >> q;
    vector<pair<int, int>> query(q);
    rep(i,q) {
        int l, r;
        cin >> l >> r;
        query[i] = {l, r};
    }
    vector<int> acc(100001, 0);
    for (int s = h * w; s >= h * w - d + 1; --s) {
        for (int i = s - d; i >= 0; i -= d) {
            auto yx = m[i];
            auto nyx = m[i + d];
            int cost = abs(nyx.first - yx.first) + abs(nyx.second - yx.second);
            acc[i] = acc[i + d] + cost;
        }
    }
    for (auto lr : query) {
        int l = lr.first;
        int r = lr.second;
        cout << acc[l] - acc[r] << endl;
    }
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,m,ans=0;
  cin >> n >> m;
  vector<long> a(n);
  vector<long> v(n);
  vector<vector<long>> b(m+1,vector<long>(2));
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=0;i<m;i++) cin >> b[i][1] >> b[i][0];
  b[m]={0,10000000};
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  long aa=0;
  long j=0;
  for(long i=0;i<n;i++) {
    if(i==aa) {
      aa+=b[j][1];
      j++;
    }
    ans+=max(a[i],b[j-1][0]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 7296
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n;
    cin >> n;
    cout << n*32 << endl;
}



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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-8
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9+7;
const double pi = acos(-1);

int n,i,j,k,t;
int cnt[200002];

int main(){
	memset(cnt, 0, sizeof cnt);
	scanf("%d %d", &n, &k);
	for(i=1;i<=n;++i){
		cnt[i%k]++;
	}
	ull ans = cnt[0];
	ans += 1LL*cnt[0]*(cnt[0]-1)*(cnt[0]-2);
	ans += 3LL*cnt[0]*(cnt[0]-1);
	if(k%2==0){
		ans += cnt[k/2];
		ans += 1LL*cnt[k/2]*(cnt[k/2]-1)*(cnt[k/2]-2);
		ans += 3LL*cnt[k/2]*(cnt[k/2]-1);
	}
	printf("%llu\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 50//00
#define MIN -100001
#define _MAX 100
#define g 9.8
#define d 4.9
int main(void)
{
	int a[4], b[4], hit = 0, blow = 0;
	while (scanf_s("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF) {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (b[i] == a[j]) {
					if (i == j) ++hit;
					else ++blow;
				}
			}
		}
		printf("%d %d\n", hit, blow);
		hit = blow = 0;
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 2147483647
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;
template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int N;
	cin>>N;
	vector<int> A(N+1);
	vector<int> B(N+1);
	vector<int> C(N+1);
	FDS(i,N){
		cin>>A[i];
	}
	A[N]=2147483647;
	FDS(i,N){
		cin>>B[i];
	}	
	B[N]=2147483647;
	FDS(i,N){
		cin>>C[i];
	}	
	C[N]=2147483647;
	VSORT(A);
	VSORT(B);
	VSORT(C);
	
	vector<long long int> S(N+1);
	vector<long long int> T(N+1);
	int j=0;
	FDS(i,N){
		while(B[i]>A[j]){
			S[i]++;
			if(j<N){
			    j++;
			}
		}
		S[i+1]=S[i];
	}
	j=N-1;
	for(int i=N-1;i>=0;i--){
		while(B[i]<C[j]){
			T[i]++;
			if(j>=0){
				j--;
			}
		}
		if(i>0){
			T[i-1]=T[i];
		}
	}
	ll ans=0;
	FDS(i,N){
	    ans+=S[i]*T[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3072
#include<stdio.h>
#include<string.h>
char ch[101];
int flag1=1;
int flag2=1;
int i;
int main(void)
{
 scanf("%s",ch);
  for(i = 1;i<=strlen(ch);i++)
{
       if(i % 2 == 0 )
         {
             if(ch[i-1] =='L' || ch[i-1] == 'U' || ch[i-1] == 'D')       
                 {
                      continue;
                  }
else{
          flag1=0;break;
}
          }
else
{
           if(ch[i-1] =='R' || ch[i-1] == 'U' || ch[i-1] == 'D')
                {
                   continue;
               }else{
flag2=0;break;
}
}
}
if(flag1&&flag2) printf("Yes");
else printf("No");
 return 0;
}

Measured memory_bytes: 128
import heapq

x, y, z, k = map(int, raw_input().split())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())

def diff(l):
    m = max(l)
    return sorted(m - v for v in l)[1:]

s = sum(map(max, [a, b, c]))
sa, sb, sc = map(diff, [a, b, c])
da, db, dc = [0], [0], [0]
q = [0]
while k > 0:
    while True:
        if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):
            for v in [sa[0] + bb + cc for bb in db for cc in dc]:
                heapq.heappush(q, v)
            da.append(sa[0])
            sa = sa[1:]
        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):
            for v in [sb[0] + aa + cc for aa in da for cc in dc]:
                heapq.heappush(q, v)
            db.append(sb[0])
            sb = sb[1:]
        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):
            for v in [sc[0] + aa + bb for aa in da for bb in db]:
                heapq.heappush(q, v)
            dc.append(sc[0])
            sc = sc[1:]
        else:
            break
    v = heapq.heappop(q)
    print s - v
    k -= 1


Measured memory_bytes: 4096
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a, e, k;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> a;
    for (int i = 1; i < 5; i++) cin >> e;
    cin >> k;
    if (e  - a > k) {
        cout << ":(\n";
    }
    else {
        cout << "Yay!\n";
    }
    //system("pause");
    return 0;
}

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

int main() {
    int N, P;
    cin >> N >> P;
    string S;
    cin >> S;
    long long cnt = 0;

    if  (10%P == 0) {
        for (int i=0;i<N; i++) {
            if((S[i]-'0')%P == 0) cnt += i+1;
        }
        cout << cnt << endl;
        return 0;
    }

    int order = 1;
    vector <int> R(N+1);
    int r=0;
    vector <int> v_cnt(P,0);
    v_cnt[0] = 1;
    for (int i=N-1;i>=0;i--){
        r = ((S[i]-'0') * order + r)%P;
        cnt += v_cnt[r];
        v_cnt[r] ++;
        order = (10*order)%P;
    }
    
    cout << cnt << endl;
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    REP(i, M) {
        cin >> a[i];
    }
    vector<LL> dp(N + 1, 0);
    dp[0] = 1;
    int l = 0;
    FOR(i, 1, N + 1) {
        if(l < M && a[l] == i) {
            l++;
        }else{
            if(0 <= i - 1) {
                dp[i] = dp[i - 1];
            }
            if(0 <= i - 2) {
                dp[i] += dp[i - 2];
                dp[i] = dp[i]%mod;
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1408
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [0]*n

for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        l[b - 1] = -1
    elif h[a - 1] < h[b - 1]:
        l[a - 1] = -1
    else:
        l[a - 1] = -1
        l[b - 1] = -1

ans = l.count(0)
print(ans)

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

int N;
int A[11111];

bool prime[11111];
signed main(){
	cin>>N;
	rep(i,N+1)cin>>A[N-i];


	int X=abs(A[N]);

	set<int>s;
	auto f=[&](int p){
		for(int i=0;i<=N;i++)if(A[i]%p)return false;
		return true;
	};

	for(int i=2;i*i<=X;i++){
		if(X%i)continue;
		if(f(i))s.insert(i);
		while(X%i==0)X/=i;
	}
	if(X!=1&&f(X))s.insert(X);

	fill_n(prime,11111,1);
	prime[0]=prime[1]=0;


	auto g=[&](int p){
		for(int i=0;i<p-1&&i<=N;i++){
			int sum=0;
			for(int j=i;j<=N;j+=p-1)sum+=A[j];
			if(sum%p)return false;
		}
		return true;
	};


	for(int i=2;i<11111;i++){
		if(!prime[i])continue;
		if(s.find(i)==s.end()&&g(i)&&A[0]%i==0)s.insert(i);
		for(int j=i+i;j<11111;j+=i)prime[j]=0;
	}
	
	for(auto x:s)cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
using namespace std;
#define N 200012
int n,m;
int main(){
	scanf("%d",&n);if(!(n&(n-1))){printf("No");return 0;}int i;
	printf("Yes\n");
	printf("%d %d\n",1,2);
	printf("%d %d\n",2,3);
	printf("%d %d\n",3,n+1);
	printf("%d %d\n",n+1,n+2);
	printf("%d %d\n",n+2,n+3);
	for(i=4;i<=n-1;i+=2)
	{
		printf("%d %d\n",i,2);
		printf("%d %d\n",3,i+1);
		printf("%d %d\n",i+1,n+i);
		printf("%d %d\n",i,n+i+1);
	}
	if(!(n&1))
	{
		for(m=n;m&(m-1);m&=(m-1));
		printf("%d %d\n",n,m);m=(n-m)^2;if(m)printf("%d %d\n",n+n,m);else printf("%d %d\n",n+n,2);
	}return 0;
}

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

int main() {
  
  int a, b, c, d; cin >> a >> b >> c >> d;
  
  if( abs(a-c)<=d ){ cout << "Yes" << endl; }
  else if( abs(a-b)<=d && abs(b-c)<=d ){ cout << "Yes" << endl; }
  else{ cout << "No" << endl; }
  

}

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

int n;

int main(){

    cin>>n;

    int ans = 1;
    int max = 0;

    for (int i = 1; i <= n; i++)
    {
        int j = i;
        int cnt = 0;
        while(true){
            if(j%2 == 1) break;
            j /= 2;
            cnt++;
            if(cnt>max){
                ans = i;
                max = cnt;
            }

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


Measured memory_bytes: 256
// cand <genesis?>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const ll base = 7;
const ll N = 5e5 + 9;
const ll inf = 1000100009;
typedef pair<ll,ll> LL;

ll a,b,c,k;
ll ans;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("test.INP", "r", stdin);
    cin>>a>>b>>c>>k;
    ans += min(a,k); k -= min(a,k); k -= min(b,k);
    ans -= k;
    cout<<ans;
}


Measured memory_bytes: 3616
#include<stdio.h>

int main() {
  int W, H, N, w1, w2, h1, h2;
  scanf("%d %d %d", &W, &H, &N);
  w1 = 0;
  w2 = W;
  h1 = 0;
  h2 = H;
  int xarray[100];
  int yarray[100];
  int aarray[100];
  for(int i=0; i<N; i++){
    scanf("%d %d %d", &xarray[i], &yarray[i], &aarray[i]);
  }

  for(int i=0; i<N; i++){
    switch (aarray[i]) {
      case 1:
        if(w1 < xarray[i]){
          w1 = xarray[i];
        }
        break;
      case 2:
        if(xarray[i] < w2){
          w2 = xarray[i];
        }
        break;
      case 3:
        if(h1 < yarray[i]){
          h1 = yarray[i];
        }
        break;
      case 4:
        if(yarray[i] < h2){
          h2 = yarray[i];
        }
        break;
    }
  }

  if(w2<=w1 || h2<=h1){
    printf("%d\n", 0);
  }else{
    printf("%d\n", (w2-w1)*(h2-h1));
  }

  return 0;
}


Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
string s;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	if(s=="Sunny")
		cout<<"Cloudy"<<endl;
	if(s=="Cloudy")
		cout<<"Rainy"<<endl;
	if(s=="Rainy")
		cout<<"Sunny"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

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

    --N;

    string s;

    while (N >= 26)
    {
        s += ('a' + (N % 26));

        N /= 26;
        --N;
    }

    s += ('a' + (N % 26));

    reverse(s.begin(), s.end());

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()

#define int long long
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;


int a,b,c;
int k;
signed main(){
  cin>>a>>b>>c;
  cin>>k;
  int ma=max(a,max(b,c));


  cout<<pow(2,k)*ma+b+c+a - ma<<endl;


}


Measured memory_bytes: 256
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <bits/stdc++.h>

using namespace std;

bool is_palindrome(const string& s) {
	int n = s.size();
	for (int i = 0; i < n; i++) {
		if (s[i] != s[n - 1 - i]) {
			return false;
		}
	}
	return true;
}

long long ret;

map<pair<string, string>, long long> cache;
priority_queue<pair<long long, pair<string, string>>> heap;

void add_to_heap(const string& s1, const string& s2, long long cost) {
	auto s = make_pair(s1, s2);
	auto it = cache.find(s);
	if (it != cache.end() && cost >= it->second) {
		return;
	}
	cache[s] = cost;
	heap.push(make_pair(-cost, s));
}

void add(const string& s1, const string& s2, long long cost) {
	if (cost >= ret) {
		return;
	}
	int l1 = s1.length();
	int l2 = s2.length();
	int l = min(l1, l2);
	for (int i = 0; i < l; ++i) {
		if (s1[i] != s2[l2 - 1 - i]) {
			return;
		}
	}
	if (l1 == l2) {
		ret = min(ret, cost);
		return;
	}
	if (l1 > l2) {
		string s = s1.substr(l2);
		if (is_palindrome(s)) {
			ret = min(ret, cost);
			return;
		}
		add_to_heap(s, "", cost);
	}
	else {
		string s = s2.substr(0, l2 - l1);
		if (is_palindrome(s)) {
			ret = min(ret, cost);
			return;
		}
		add_to_heap("", s, cost);
	}
}

int main()
{
#ifdef _MSC_VER
	freopen("f.in", "r", stdin);
#endif
	std::ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> s(n);
	vector<long long> c(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i] >> c[i];
	}
	ret = (1LL << 62);
	for (int i = 0; i < n; ++i) {
		add(s[i], "", c[i]);
	}
	while (!heap.empty()) {
		auto w = heap.top().second;
		long long cost = -heap.top().first;
		heap.pop();
		if (cost != cache[w]) {
			continue;
		}
		for (int i = 0; i < n; i++) {
			if (w.first == "") {
				add(w.first + s[i], w.second, cost + c[i]);
			} else {
				add(w.first, s[i] + w.second, cost + c[i]);
			}
		}
	}
	if (ret >= (1LL << 62)) {
		ret = -1;
	}
	cout << ret << endl;
	return 0;
}


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

int main(){
  long long int n;
  cin>>n;
  vector<long long int> a(n);
  long long int p=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[i]-=(i+1);
  }
  long long int ans=1e18;

  long long int l=-1e9;
  long long int r=1e9;
  while(abs(r-l)>2){
    long long int mid=(l*2+r)/3;
    long long int mid2=(l+r*2)/3;
    long long int tmp=0;
    for(int i=0;i<n;i++)tmp+=abs(a[i]+mid);
    long long int tmp2=0;
    for(int i=0;i<n;i++)tmp2+=abs(a[i]+mid2);
    //cout<<l<<" "<<r<<endl;
    if(tmp<tmp2){
      r=mid2;
    }else{
      l=mid;
    }
    ans=min(ans,min(tmp,tmp2));
  }

  for(int i=l-100;i<r+100;i++){
    long long int tmp=0;
    for(int j=0;j<n;j++)tmp+=abs(a[j]+i);
    ans=min(ans,tmp);
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    int n, h;
    cin >> n >> h;
    vector<int> a(n), b(n);
    vector<pair<int, int>> c(2 * n);

    rep(i, n)
    {
        cin >> a[i] >> b[i];
        c[2 * i] = {a[i], 0};
        c[2 * i + 1] = {b[i], 1};
    }
    sort(ALL(c), greater<pair<int, int>>());
    int ans = 0;
    rep(i, 2 * n)
    {
        if (c[i].second == 0)
        {
            ans += (h + c[i].first - 1) / c[i].first;
            break;
        }
        else
        {
            ans += 1;
            h -= c[i].first;
        }
        if (h <= 0)
        {
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include<vector>
#include<cstring>
#include<set>
#include <cstdio>
#include<queue>
#include<map>
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define endl '\n'
#define forup(i,a,n) for( int i =a; i < n; i++)
#define llforup(i,a,n) for( ll i =a; i < n; i++)
#define fordown(i,a,n) for( int i =a; i >= n; i--)
#define fornot(i,a,n) for( int i=a;!n;i++)
#define mod  (ll)(1e9+7)
#define ifempty(a)  if(!a)
using namespace std;
typedef long long ll;
inline int readnum() 
{
 int p, data = 0;char ch = 0;
 while ((ch != ' - ') && ch<'0' || ch>'9') ch = getchar();//相当于正则表达式的搜索，跳过不需要的字符
 if (ch == '- ')p = -1, ch = getchar();
 else p = 1;
 while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();//搜索需要的字符
 return data * p;
}
//E-mail 374656045@qq.com
int w[1001];
int v[1001];
int ans[10001];
class solve {
private:int N, W;
public:
	solve()
	{
		cin >> N >> W;
		forup(i, 1, N + 1)
			cin >> v[i] >> w[i];//尝试用滚动数组处理01背包问题
		forup(i, 1, N + 1)
			for (int j = W - w[i]; j >= 0; j--)
				if (ans[j + w[i]] < ans[j] + v[i])//注意更新的方向决定了是完全背包还是01背包,更新的方向会决定是层间转移还是同层转移
					ans[j + w[i]] = ans[j] + v[i];//选第i种或者不选第i种
					cout << ans[W] << endl;
	}
};
int main(void)
{
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	
	solve solution;
#ifdef DEBUG
	fclose(stdin);//关闭文件 
	fclose(stdout);//关闭文件 
#endif
	return 0;
	
}



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

using namespace std;
long long MOD=1000000007;
long long MOD2=998244353;

int main(){
  int N; cin>>N;
  string S,T; cin>>S>>T;
  for(int i=0;i<N;i++) cout<<S[i]<<T[i];
  cout<<endl;
  return 0;
}


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

int A, B, C;

int main() {
    cin >> A >> B >> C;
    map<int, int> mp;
    mp[A]++;
    mp[B]++;
    mp[C]++;

    if (mp[5] == 2 && mp[7] == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
N = int(input()) 
t = [input() for i in range(N)] 

def is_unique(seq):
    return len(seq) == len(set(seq))
flag = 'B'
if is_unique(t) == False:
  flag = 'A'

count = 0       
while count < N-1:
  if t[count][-1] != t[count+1][0]:
      flag = 'A'
      count += 1
  else:
    count += 1

if flag =='A':
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3064
MOD = 10**9+7
# dp[i][j] := Sの後ろからi桁を13で割った余りがjとなるようなものの個数
S = input()
l = len(S)
dp = [[0]*13 for _ in range(l+1)]
dp[0][0] = 1
mul = 1

for i in range(l):
    x = S[-(i+1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= MOD
    else:
        k = int(x) # これしか選ぶ余地なし
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[len(S)][5]%MOD)


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

#define LL long long

LL f(LL n) { //全ての桁の数の和
    LL res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

double g(LL n) {
    return (double)n/f(n);
}

int main(){
    vector<LL> res;
    LL base = 1;

    //　まずは候補を(1~150)99999 的な奴を全列挙
    for(int i = 0; i < 15; ++i) {
        for(int j = 1; j < 150; ++j) {
            res.push_back(base * (j+1) - 1);
        }
        base *= 10;
    }
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());

    // ダメな奴を除く:
    for(LL i = 0; i < res.size(); ++i) {
        for(LL j = i+1; j < res.size(); ++j) {
            if(g(res[i]) > g(res[j])) {
                res.erase(res.begin() + i--);
                break;
            }
        }
    }

    LL k;
    cin >> k;
    for(LL i = 0; i < k; ++i) {
        cout << res[i] << endl;
    }
}

Measured memory_bytes: 256
n = int(input())
A = [int(input()) for i in range(n)]
ma1 = max(A)
ma2 = 0
c = 0
for a in A:
    if a == ma1:
        c+=1
    else:
        ma2=max(ma2,a)
for a in A:
    if a!=ma1:
        print(ma1)
    else:
        if c>1:
            print(ma1)
        else:
            print(ma2)


Measured memory_bytes: 12532
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K; cin >> N >> K;
	VI A(N);
	REP(i, N) {
		cin >> A[i];
		A[i]--;
	}
	vector<VI> ne(65, VI(N));

	REP(i, N) {
		ne[0][i] = A[i];
	}
	
	FOR(i, 1, 65) {
		REP(j, N) {
			ne[i][j] = ne[i - 1][ne[i - 1][j]];
		}
	}
	int now = 0;
	//cout << "K" << endl;
	int k = 0;
	while (K) {
		if (K % 2) {
			now = ne[k][now];
		}
		k++;
		K /= 2;
	}
	
	cout << now + 1 << endl;

	return 0;
}



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

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

    int pow2 = 1, d;
    for(int i=1; i<=9; i++){// 500 < 2^9
        pow2 *= 2;
        if(n <= pow2){ d = i; break; }
    }

    vector<vector<int>> ans(n, vector<int>(n));
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            //cout << i << " " << j << endl;
            for(int k=0; k<d; k++){
                if(((i >> k) & 1) == ((j >> k) & 1)) continue;

                ans[i][j] = k+1;
                break;
            }
        }
    }

    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            cout << ans[i][j];
            if(j == n-1) break;
            cout << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 4464
n=int(input())
s=input()
l=[0 for i in range(26)]
for c in s:
    l[ord(c)-ord('a')]+=1
r=[0 for i in range(26)]
ans=0

for c in s:
    l[ord(c)-ord('a')]-=1
    r[ord(c)-ord('a')]+=1
    tmp=0
    for i in range(26):
        if l[i] and r[i]:
            tmp+=1
    if ans<tmp:
        ans=tmp
print(ans)


Measured memory_bytes: 3064
//@source: 
//@create: 19:51:16 Sunday 09/08/2020
//@author: nghethuat102
#include <bits/stdc++.h>
using namespace std;

#define len(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define discrete(x) sort(all(x)), x.erase(unique(all(x)), x.end())

const long long base = 1e9;

void solve() {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    map<pair<int, int>, int> cnt;
    for (int i = 0; i < n; ++i) {
        long double x;
        cin >> x;
        x *= base;
      //  cout << fixed << setprecision(0) << x << " ";
        long long y = round(x);
     //   cout << y << "\n";
        a[i].first = 0;
        a[i].second = 0;
        while (y % 2 == 0) {
            ++a[i].first, y /= 2;
        }
        while (y % 5 == 0) {
            ++a[i].second, y /= 5;
        }
        cnt[a[i]]++;
    }
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        cnt[a[i]]--;
        for (auto j: cnt) {
            if (a[i].first + j.first.first >= 18 && a[i].second + j.first.second >= 18) {
                ans += j.second;
            }
        }
        cnt[a[i]]++;
    }
    ans /= 2;
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    for (int it = 1; it <= t; ++it) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4716
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	A := make([]int, N)
	B := make([]int, N)
	var sumA, sumB int
	for i := range A {
		A[i] = nextInt(sc)
		sumA += A[i]
	}
	for i := range B {
		B[i] = nextInt(sc)
		sumB += B[i]
	}
	var cnt int
	if sumA >= sumB {
		d := make([]int, N)
		var sumS int
		for i := 0; i < N; i++ {
			d[i] = A[i] - B[i]
			if d[i] < 0 {
				sumS += d[i]
				cnt++
			}
		}
		sort.Sort(sort.Reverse(sort.IntSlice(d)))
		for i := 0; i < N; i++ {
			if sumS >= 0 {
				break
			}
			sumS += d[i]
			cnt++
		}
	} else {
		cnt = -1
	}
	fmt.Println(cnt)
}


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

int main(){
    int n ,count = 0;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    for(int i=1; i < n-1; i++){
        if(a[i-1] < a[i] && a[i] < a[i+1])count++;
        else if(a[i-1] > a[i] && a[i] > a[i+1])count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;
using ll = long long int;

int main()
{
  int n, k;
  cin >> n >> k;
  vector<ll> v(n);
  for(int i = 0; i < n; i++)
  {
    cin >> v[i];
  }
  vector<ll> memo(k + 1, 0);
  for(int i = 1; i <= k; i++)
  {
    ll imax = 0;
    for(int j = 0; j <= i; j++)
    {
      //cout << i << " " << j << endl;
      int l = i - j;
      int r = j;
      if(i >= n){
        l = n;
        r = 0;
      }
      vector<ll> temp;
      ll temp_sum = 0;
      for(int index = 0; index < l; index++)
      {
        temp.push_back(v[index]);
        temp_sum += v[index];
      }
      for(int index = 0; index < r; index++)
      {
        temp.push_back(v[n - 1 - index]);
        temp_sum += v[n - 1 - index];
      }
      /*for(auto e : temp){
        cout << e << " ";
      }
      cout << endl;*/
      sort(temp.begin(), temp.end());
      for(int index = 0; index < k - i; index++)
      {
        if(temp.size() <= index) break;
        if(temp[index] < 0){
          temp_sum -= temp[index];
        }
      }
      imax = max(imax, temp_sum);
    }
    memo[i] = imax;
  }
  ll result = 0;
  for(auto e : memo){
    result = max(e, result);
  }
  cout << result << endl;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
square = [input() for i in range(H)]

ans = 'Yes'
for i in range(1, H-1):
    for j in range(1, W-1):
        if square[i][j] == '#':
            if square[i-1][j] == square[i+1][j] == square[i][j-1] == square[i][j+1] == '.':
                ans = 'No'
                break

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(ll i = 0; i < (ll)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
//const ll MOD = 998244353ll;
const dou pi=3.141592653589793*2;

int main(){
    ll n;
    std::cin >> n;
    VEC(ll,a,n*3);
    sort(all(a),gre(ll));
    ll ans=0;
    rep(i,2*n){
        if(i%2==1)ans+=a[i];
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 2560
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.array;

  int n, m; rd(n, m);
  auto g=new int[][](n, n);
  foreach(_; 0..m){
    int a, b; rd(a, b);
    g[a-1][b-1]=g[b-1][a-1]=1;
  }
  
  auto v=new int[](0); v~=0;
  auto usd=new bool[](n); usd[0]=true;

  int f(int k){
    if(k==n){
      bool ok=true;
      foreach(i; 1..n){
        ok&=g[v[i-1]][v[i]]==1;
      }
      return ok ? 1 : 0;
    }else{
      int ret=0;
      foreach(j; 1..n)if(!usd[j]){
        v~=j; usd[j]=true;
        ret+=f(k+1);
        v.popBack; usd[j]=false;
      }
      return ret;
    }
  }

  writeln(f(1));

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}

Measured memory_bytes: 764
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int ans = 0;
		if(x<a) {
			ans = 0;
		}else {
			ans = 10;
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 35404
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	cout << a - b + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      int n,k,q;
      cin>>n>>k>>q;
      int a[n+1];
      memset(a,0,sizeof(a));
      int x=q;
      while(x--)
      {
          int i;
          cin>>i;
          a[i]+=1;
      }
      FOR(i,1,n)
      {
          a[i]+=k-q;
          if(a[i]>0)cout<<"Yes\n";
          else cout<<"No\n";
      }
  }
  return 0;
}

Measured memory_bytes: 1024
N = int(input())
d = {}
for i in range(1,N+1):
    d[i] = 0
A = list(map(int,input().split()))
for i in range(N):
    a = A[i]
    d[a] += 1
s = 0
for i in range(1,N+1):
    x = d[i]
    s += (x*(x-1))//2
for i in range(N):
    y = A[i]
    z = s - d[y] + 1
    print(z)

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

#define ll long long
int main() {
  
  int N;
  cin >> N;
  
  int X[N];
  
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  
  int all = 0;
  for (int i = 0; i < N; i++) {
    all = all ^ X[i];
  }
  
  for (int i = 0; i < N; i++) {
    cout << (all ^ X[i]) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 4316
n = int(input())
i = 1

while i <= n:
	
	x = i
	
	if x % 3 == 0:
		print(" ", end ="")
		print(i, end ="")
	else:
		while x != 0:
			if x % 10 == 3:
				print(" ", end ="")
				print(i, end ="")
				break
			else:
				x = int(x / 10)
			
	i += 1
print()

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int ans[100010];

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

	string S;
	cin >> S;

	int tp = 0;
	rep(i, 1, SZ(S))
	{
		if (S[i] == 'R')
		{
			tp = i;
		}
		else
		{
			int d = i - tp;
			if (d % 2 == 1)
			{
				ans[i - d + 1]++;
			}
			else
			{
				ans[i - d]++;
			}			
		}
	}
	tp = SZ(S) - 1;
	rrep(i, 0, SZ(S) - 1)
	{
		if (S[i] == 'L')
		{
			tp = i;
		}
		else
		{
			int d = tp - i;
			if (d % 2 == 1)
			{
				ans[i + d - 1]++;
			}
			else
			{
				ans[i + d]++;
			}
		}
	}

	rep(i, 0, SZ(S))
	{
		cout << ans[i] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1488