akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int n;
char s[maxn], t[maxn];
int f[maxn];
void getf()
{
	for(int i = 2; i <= n; ++i)
	{
		int j = f[i - 1];
		while(j && t[j + 1] != t[i]) j = f[j];
		if(t[j + 1] == t[i]) ++j;
		f[i] = j;
	}
} 
int match()
{
	int j = 0;
	for(int i = 1; i <= n; ++i)
	{
		while(j && t[j + 1] != s[i]) j = f[j];
		if(t[j + 1] == s[i]) ++j;
	}
	return j;
}
int main()
{
	scanf("%d%s%s", &n, s + 1, t + 1);
	getf();
	int ret = match();
	printf("%d\n", 2 * n - ret);
	return 0;
}

Measured memory_bytes: 3704
package main

import (
    "fmt"
)

const MOD = 1000000007

func comb(x, y int64) int64 {
    var ret, i int64
    ret = 1
    for i = y - 1; i >= 0; i-- {
        ret = ret * (x - i) % MOD
    }
    ret = ret * inverse(fact(y)) % MOD
    return ret
}

func fact(y int64) int64  {
    var ret, i int64
    ret = 1
    for i = 1;i <= y; i++ {
        ret = ret * i % MOD
    }
    return ret
}

func pow(x, y int64) int64 {
    if y == 0 {
        return 1
    }
    if y % 2 == 0 {
        return pow(x * x % MOD, y / 2)
    } else {
        return x * pow(x, y - 1) % MOD
    }
}

func inverse(f int64) int64 {
    return pow(f, MOD - 2)
}



func main() {
    var n, m int64
    var ans, i, cnt int64
    fmt.Scan(&n)
    fmt.Scan(&m)
    ans = 1
    for i = 2; i < 1000000; i++ {
        if m < i {
            break
        }
        cnt = 0
        for m % i == 0 {
            cnt++
            m /= i
        }
        ans = ans * comb(n + cnt - 1, cnt) % MOD
    }
    if m != 1 {
        ans = ans * comb(n, 1) % MOD
    }
    fmt.Println(ans)
}

Measured memory_bytes: 512
n = gets.to_i
dp = Array.new(n+1){[]}
dp[0] = [0,0,0]
n.times do |i|
  h = gets.split.map(&:to_i)
  dp[i+1][0] = [dp[i][1], dp[i][2]].max + h[0]
  dp[i+1][1] = [dp[i][0], dp[i][2]].max + h[1]
  dp[i+1][2] = [dp[i][0], dp[i][1]].max + h[2]
end
p dp[n].max


Measured memory_bytes: 9468
import java.util.Scanner;

/**
 * https://abc055.contest.atcoder.jp/tasks/abc055_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();
		
		int ans = N*800-(N/15)*200;
		System.out.println(ans);

	}

}


Measured memory_bytes: 24020
I=lambda:map(int,input().split());F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=[(f,F),(f,-F)];H=[(F,f),(-F,f)]
for i in r(n):a,b,c=I();R+=[((a,b),c)];Y+=[c];X+=[a,b]
for i in r(m):a,b,c=I();H+=[(a,(b,c))];X+=[a];Y+=[b,c]
s=dict(enumerate(sorted(set(X))));K=len(s);t=dict(enumerate(sorted(set(Y))));L=len(t);h=dict(zip(s.values(),s.keys()));w=dict(zip(t.values(),t.keys()));V=[[0]*-~K for i in r(L+1)];U=[i[:]for i in V];v=[i[:]for i in V]
for(a,b),c in R:U[w[c]][h[a]]+=1;U[w[c]][h[b]]+=-1
for i in r(L+1):
 for j in r(K):U[i][j+1]+=U[i][j]
for d,(e,f)in H:V[w[e]][h[d]]+=1;V[w[f]][h[d]]+=-1
for j in r(K+1):
 for i in r(L):V[i+1][j]+=V[i][j]
q=[(h[0],w[0])];v[w[0]][h[0]]=1;a=0
while q:
 x,y=q.pop();a+=(s[x]-s[x+1])*(t[y]-t[y+1])
 for e,f in[(-1,0),(1,0),(0,1),(0,-1)]:
  c=x+e;d=y+f
  if(K>c>=0<=d<L)*v[d][c]==0:
   if U[(f>0)+y][x]|e==0 or V[y][(e>0)+x]|f==0:q+=[(c,d)];v[d][c]=1
if a>F:a='INF'
print(a)

Measured memory_bytes: 551476
cat, unknown, guess = map(int, input().split())
if guess > cat:
    if cat + unknown < guess:
        print('NO')
    else:
        print('YES')
else:
    if guess + unknown > cat + unknown:
        print('NO')
    else:
        if cat > guess:
            print('NO')
        else:
            print('YES')

Measured memory_bytes: 3060
#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<P,int> 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};

typedef complex<double> C;
typedef pair<C,C> pp;
typedef vector<C> VP;
#define eq(a,b) (fabs(a-b)<eps)
#define veq(a,b) (eq(a.real(),b.real())&&eq(a.imag(),b.imag()))
const C O{0,0};

void In(C& p){
	double x,y;
	cin>>x>>y;
	p=C(x,y);
}

void Out(C p){
	cout<<p.real()<<' '<<p.imag()<<endl;
}

double Dot(C p,C q){
	return p.real()*q.real()+p.imag()*q.imag();
}

double Det(C p,C q){
	return p.real()*q.imag()-q.real()*p.imag();
}

C Normal(C p){
	return C(p.imag(),-p.real());
}

bool Comp(C p,C q){
	if(eq(p.real(),q.real())) return p.imag()<q.imag();
	return p.real()<q.real();
}

int Clock(C a,C b,C c){
	double t=Det(b-a,c-a);
	if(t>eps) return 1;
	if(t<-eps) return -1;
	if(Dot(b-a,c-a)<-eps) return 2;
	if(Dot(a-b,c-b)<-eps) return -2;
	return 0;
}

bool is_Orthgonal(C a,C b,C c,C d){
	return eq(Dot(a-b,c-d),0);
}

bool is_Parallel(C a,C b,C c,C d){
	return eq(Det(a-b,c-d),0);
}

bool is_Cross(C a,C b,C c,C d){
	if(is_Parallel(a,b,c,d)){
		if(Clock(a,b,c)==0||Clock(a,b,d)==0) return 1;
		return 0;
	}
	C A=b-a,B=d-c;
	return 1;
}

int n;

int main(){
	C p,q;
	In(p);In(q);
	cin>>n;
	for(int i=0;i<n;i++){
		C a;
		In(a);
		int t=Clock(p,q,a);
		if(t==1) cout<<"COUNTER_CLOCKWISE"<<endl;
		if(t==-1) cout<<"CLOCKWISE"<<endl;
		if(t==2) cout<<"ONLINE_BACK"<<endl;
		if(t==-2) cout<<"ONLINE_FRONT"<<endl;
		if(t==0) cout<<"ON_SEGMENT"<<endl;
	}
}


Measured memory_bytes: 3228
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 998244353
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n2 = [1 for _ in range(3010)]
for i in range(1, 3010):
    n2[i] = n2[i - 1] * 2 % mod

n, s = MAP()
a = LIST()
dp = [[0 for _ in range(s + 1)] for _ in range(n)]
if s >= a[0]:
    dp[0][a[0]] = 1
#print(a[0], dp[0])
for i in range(1, n):
    for j in range(1, min(s + 1, a[i])):
        dp[i][j] = dp[i - 1][j] * 2
        dp[i][j] %= mod
    if a[i] <= s:
        dp[i][a[i]] = dp[i - 1][a[i]] * 2 + n2[i]
        dp[i][a[i]] %= mod
    for j in range(a[i] + 1, s + 1):
        dp[i][j] = dp[i - 1][j] * 2
        if dp[i - 1][j - a[i]]:
            dp[i][j] += dp[i - 1][j - a[i]]# * 2 + dp[i - 1][j - a[i]]
        dp[i][j] %= mod
    #print(a[i], dp[i])
print(dp[n - 1][s])

Measured memory_bytes: 149200
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int n,M[N][N];
int color[N],d[N],f[N],tt;
 
void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0) continue;
    if(color[v]==WHITE) dfs_visit(v);
  }
  color[u]=BLACK;
  f[u]=++tt;
}
 
void dfs()
{
  int u;
  for(u=0;u<n;u++) color[u]=WHITE;
  tt=0;
 
  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}
 
int main()
{
  int u,v,k,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  dfs();
 
  return 0;
}

Measured memory_bytes: 636
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

constexpr int MAX_N = 100000;

int N, M;
int p[MAX_N];
int ans;

int par[MAX_N];
int rank[MAX_N];

std::vector<int> vss[MAX_N];

int find( int x )
{ return par[x]==x ? x : par[x]=find(par[x]); }

void unite( int x, int y )
{
  x = find(x);
  y = find(y);

  if( x == y )
    return;

  if( rank[x] < rank[y] )
    par[x] = y;
  else
  {
    par[y] = x;

    if( rank[x] == rank[y] )
      ++rank[x];
  }

  return;
}

bool same( int x, int y )
{
  return find(x) == find(y);
}

int main()
{
  scanf( "%d%d", &N, &M );
  rep( i, N )
    scanf( "%d", p+i ), --p[i], ans += p[i]==i;

  rep( i, N )
    par[i] = i, rank[i] = 0;

  rep( i, M )
  {
    int x, y;
    scanf( "%d%d", &x, &y );
    --x; --y;

    unite( x, y );
  }

  rep( i, N )
  {
    find( i );

    vss[par[i]].push_back( i );
  }

  rep( i, N )
  {
    std::set<int> S;

    rep( j, vss[i].size() )
      S.insert( p[vss[i][j]] );

    rep( j, vss[i].size() ) if( vss[i][j] != p[vss[i][j]])
      ans += S.count( vss[i][j] );
  }

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

  return 0;
}

Measured memory_bytes: 8824
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N,M;
    cin >> N >> M;
    int X[M];
    for(int i=0;i<M;i++){
        cin >> X[i];
    }
    int distance[M];
    distance[M-1] = 0;
    sort(X,X+M);
    for(int i=0;i+1<M;i++){
        distance[i] = X[i+1] - X[i];
    }
    int ans = 0;
    sort(distance,distance+M,greater<>());
    for(int i=N-1;i<M;i++){
        ans += distance[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3888
/**
 * 
 * ......................我佛慈悲......................
 *                       _oo0oo_
 *                      o8888888o
 *                      88" . "88
 *                      (| -_- |)
 *                      0\  =  /0
 *                    ___/`---'\___
 *                  .' \\|     |// '.
 *                 / \\|||  :  |||// \
 *                / _||||| -卍-|||||- \
 *               |   | \\\  -  /// |   |
 *               | \_|  ''\---/''  |_/ |
 *               \  .-\__  '-'  ___/-. /
 *             ___'. .'  /--.--\  `. .'___
 *          ."" '<  `.___\_<|>_/___.' >' "".
 *         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 *         \  \ `_.   \_ __\ /__ _/   .-` /  /
 *     =====`-.____`.___ \_____/___.-`___.-'=====
 *                       `=---='
 *                       
 *..................佛祖开光 ,永无BUG...................
 * 
 */

#include<iostream>
#include<cstdio>
using namespace std;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int n;
long long t1,t2;
long long a[11000],b[11000];
long long lz;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)
		a[i]=read(),t1+=a[i];
	for(int j=1;j<=n;j++)
		b[j]=read(),t2+=b[j];
	if(t1>t2) {
		cout<<"No"<<'\n';
		return 0;
	}
	long long s=t2-t1;
	for(int i=1;i<=n;i++)
		if(b[i]>a[i])
			lz+=(b[i]+1-a[i])/2;
	if(lz>s) {
		cout<<"No"<<'\n';
		return 0;
	}
	else {
		cout<<"Yes"<<'\n';
		return 0;
	}
}

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

constexpr int N = 1e5, P = 1000000007;

int a[N + 1];

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n;
    std::cin >> n;
    for (int i = 0; i < n; ++i)
        std::cin >> a[i];
    std::sort(a, a + n, std::greater<>());
    
    int x = 0;
    while (x < n && x + 1 < a[x + 1])
        ++x;
    int ans = 0;
    if ((a[x] - x) % 2 == 0)
        ans = 1;
    int y = x;
    while (x < a[y + 1])
        ++y;
    if ((y - x) % 2 == 1)
        ans = 1;
    
    if (ans == 1) {
        std::cout << "First\n";
    } else {
        std::cout << "Second\n";
    }
    return 0;
}

Measured memory_bytes: 4040
use proconio::input;

fn main() {
    input! {
        r#as: [u128],
    }

    let ans = r#as.into_iter().fold(Some(1), |prod, a| match (prod, a) {
        (_, 0) => Some(0),
        (Some(prod), a) if prod * a <= 10u128.pow(18) => Some(prod * a),
        _ => None,
    });

    if let Some(ans) = ans {
        println!("{}", ans);
    } else {
        println!("-1");
    }
}


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

int n;
string a, b;

int dfs(string a, int i, int cnt){
    if(i >= n) return cnt;
    if(a[i] == b[i]){
        return dfs(a,i + 1, cnt);
    }

    int ret = 1e8;
    int dif = (b[i] - a[i] + 10) % 10;
    for(int j = i; j < n; j++){
        a[j] = '0' + (a[j] + dif - '0') % 10;
        ret = min(ret, dfs(a,i + 1, cnt + 1));
    }
    return ret;
}

int main(){
    while(cin >> n,n){
        map<string,int> m;
        cin >> a >> b;

        queue<pair<int,string>> q;
        q.push(make_pair(0,a));
        cout << dfs(a,0,0) << endl;
    }
}

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

using namespace std;

int main()
{   int count=0,i;
    string s1,s2;
    cin>>s1;
    cin>>s2;
   for(i=0;i<s1.length();i++)
     {if(s1[i]!=s2[i])
       {count++;
       }
     }
     cout<<count;
    return 0;
}

Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl
 
#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()
 
#define pb push_back
#define ff first
#define ss second
#define hell 1000000007
 
#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009
 
ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll k,x;cin>>k>>x;
	if((k*500)>=x)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
k, n = map(int, input().split())
a_list = list(map(int, input().split()))
a_list.sort()

a_list = a_list + list(map(lambda x: x + k, a_list))

mi_len = k
for i in range(len(a_list)-(n-1)):
    mov_len = a_list[i+(n-1)] - a_list[i]
    if mi_len > mov_len:
        mi_len = mov_len

print(mi_len)

Measured memory_bytes: 26436
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  
  A,B,M=map(int,pin().split())
  a=list(map(int,pin().split()))
  b=list(map(int,pin().split()))
  
  ans=min(a)+min(b)
  
  for _ in [0]*M:
    x,y,c=map(int,pin().split())
    t=a[x-1]+b[y-1]-c 
    if t<ans:
      ans=t 
  print(ans)
  return 

main()

Measured memory_bytes: 25156
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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



    ll ans = 0;
    int count = 0;

    ll mi = 99999999999;
    rep(i,n){
        ll x;
        cin >> x;
        if(x<0){
            count++;
        }
        ans += abs(x);
        if(abs(x)<mi){
            mi = abs(x);
        }
    }
    //cout << count;
    if(count%2==1){
        ans -= mi*2;
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M = 998244353;
const ll inf = 1e18+5;
const ll INF=INT_MAX;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}
ll arr[500000],st[500000];
void buildtree(int si,int ss,int se){
	if(ss==se){
		st[si]=arr[ss];
		return;
	}
	int mid=ss+(se-ss)/2;
	buildtree(2*si,ss,mid);
	buildtree(2*si+1,mid+1,se);
	st[si]=min(st[2*si],st[2*si+1]);
}
int query(int si,int ss,int se,int qs,int qe){
	if(qs>se || qe<ss) //completely outside
		return INF;
	if(ss>=qs && se<=qe)
		return st[si];
	int mid=ss+(se-ss)/2;
	int l=query(2*si,ss,mid,qs,qe);
	int r=query(2*si+1,mid+1,se,qs,qe);
	return min(l,r);
}
void update(int si,int ss,int se,int qi){
	if(ss==se){
		st[si]=arr[ss];
		return;
	}
	int mid=ss+(se-ss)/2;
	if(qi<=mid) update(2*si,ss,mid,qi);
	else update(2*si+1,mid+1,se,qi);
	st[si]=min(st[2*si],st[2*si+1]);
}
void solve(){
	ll n;
	cin>>n;
	ll a[n],count=0;
	for(ll i=0;i<n;i++) cin>>a[i];
	for(ll i=0;i<n;i+=2) if(a[i]%2==1) count++;
	cout<<count<<"\n";
 }
int main(){
	fast();
	solve();
	return 0;
}


Measured memory_bytes: 3600
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	int N, M;
	std::cin >> N >> M;
	constexpr std::array<int, 10> must = { 0,2,5,5,4,5,6,3,7,6 };
	std::map<int, int> map;
	for (auto i : boost::irange(0, M))
	{
		int v;
		std::cin >> v;
		auto c = must[v];
		map[c] = std::max(map[c], v);
	}
	std::map<int, int> rmap;
	for (auto p : map)
	{
		rmap[p.second] = p.first;
	}
	std::vector<int> dp(N + 1, std::numeric_limits<int>::min());
	dp[0] = 0;
	for (auto i : boost::irange(0, N))
	{
		for (auto p : map)
		{
			if (i + p.first <= N)
			{
				dp[i + p.first] = std::max(dp[i + p.first], dp[i] + 1);
			}
		}
	}
	for (int n = N; n != 0;)
	{
		for (auto p : rmap | adaptor::reversed)
		{
			if (p.second <= n && dp[n] - 1 == dp[n - p.second])
			{
				std::cout << p.first;
				n -= p.second;
				break;
			}
		}
	}
	std::cout << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
// g++ -std=c++11 -O2 -Wall *.cpp -o *
#define eps 1e-9
#define MAX 1000001
#define MOD 1000000007
#define PI 3.14159265358979323846
#define Fi first
#define Se second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(), a.end()
#define Rep(i, a, b) for (int i = a; i < b; ++i)
typedef long long ll;
typedef pair<int, int> pr_int;


int main()
{
	//freopen("input.txt", "r", stdin);
    int h, a;
    cin >> h >> a;
    if (h % a)
		cout << h / a + 1;
	else
		cout << h / a;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

ll dp[100001];
vector<int> adj[100001];
ll fun(int cur){
    if(dp[cur]!=-1) return dp[cur];
    dp[cur]=0;
    for(int i=0;i<adj[cur].size();i++){
        dp[cur]=max(dp[cur],1+fun(adj[cur][i]));
    }
    return dp[cur];
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll i,j,n,m;    cin>>n>>m;
	for(i=1;i<=n;i++){
	    dp[i]=-1;
	}
	for(i=0;i<m;i++){
	    int u,v;    cin>>u>>v;
	    adj[u].pb(v);
	}
	ll ans=0;
	for(i=1;i<=n;i++){
	    ans=max(ans, fun(i));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8576
from collections import defaultdict

X, N = map(int, input().split())
P = list(map(int, input().split()))

exist_P = defaultdict(int)

for p in P:
    exist_P[p] = 1

diff = X + 1
ans = -1
for i in range(0, 102):
    if exist_P[i] == 0:
        if abs(X - i) < diff:
            ans = i
            diff = abs(X - i)
print(ans)

Measured memory_bytes: 9468
#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define all(V) (V).begin(), (V).end() 
using namespace std;
typedef long long ll;
const int MM = 1e5;
vector<pair<int,int>> g[MM];
int v[MM];
typedef long long int lli;
lli D[102020], N, M;
void addedge(int from, int to, int wt) { //0 based , directed x to y
    g[from].push_back({to, wt});
    // cout << from << ' ' << to << ' ' << wt << endl;
}
void dijkstra(int x) {
    for(int i = 0; i < MM; i++) {
        D[i] = 1e18;
    }
    D[x] = 0;
    priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;
    q.push({0,x});
    
    while(!q.empty()) {
        pair<int,int> p = q.top();
        q.pop();
        int u = p.second, dist = p.first;
        if(dist > D[u]) {
            continue;
        }
    
        for(pair<int,int> pr : g[u]) {
            int v = pr.first;
            lli next_dist = dist + pr.second;
            if(next_dist < D[v]) {
                D[v] = next_dist;
                q.push({next_dist,v});
            }
        }
    }
}
string s[200];
int main() {fio;
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			if(j < m - 1)
				addedge(i * m + j, i * m + (j + 1), s[i][j] != s[i][j + 1]);
			if(i < n - 1)
				addedge(i * m + j, (i + 1) * m + j, s[i][j] != s[i + 1][j]);
		}
	}
	addedge(10200, 0, s[0][0] != '.');
	addedge(n * m - 1, 10201, s[n - 1][m - 1] != '.');
	dijkstra(10200);
	cout << D[10201] / 2;

    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int n;
    cin >> n;
    vector<int> a(n+2, 0), cost(n+1, 0);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        cost[i-1] = abs(a[i] - a[i-1]);
    }
    cost[n] = abs(a[n+1] - a[n]);

    int sum = accumulate(cost.begin(), cost.end(), 0);

    int ans;
    for (int i = 1; i <= n; i++) {
        ans = sum - cost[i-1] - cost[i];
        ans += abs(a[i+1] - a[i-1]);
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

typedef double D;

ll calc(ll a) {
    return max(1LL, a*(a+1LL)/2LL);
}

int main(){
    int n;
    cin >> n;
    multiset<ll> st;
    rep(i, n) {
        ll tmp;
        cin >> tmp;
        st.insert(tmp);
    }
    vector<D> A(n), B(n), C(n);
    vl x(n), y(n);
    auto st2 = st;
    int i = 0;
    for(auto& s : st2) {
        auto it = st.lower_bound(s);
        x[i] = *it;
        st.erase(it);
        auto it2 = st.lower_bound(s/2);
        if(it2 == st.begin()) {
            if(*it2 > s) {
                x[i] = *it2;
                y[i] = s; 
            }
            else {
                y[i] = *it2;
            }
        }
        else if(it2 == st.end()) {
            --it2;
            y[i] = *it2;
        }
        else {
            auto it3 = it2;
            --it3;
            ll dif2 = abs(s/2. - *it2);
            ll dif3 = abs(s/2. - *it3);
            if(dif2 < dif3) {
                y[i] = *it2;
            }
            else {
                y[i] = *it3;
            }
        }
        st.insert(s);

        ll a = x[i], b = y[i], c = x[i] - y[i];
        A[i] = log(calc(a));
        B[i] = log(calc(b));
        C[i] = log(calc(c));
        ++i;
    }
    vi idx(n);
    rep(i, n) idx[i] = i;
    sort(all(idx), [&](int i, int j) {return A[i]+B[j]+C[j] < A[j] + B[i] + C[i];});
    cout << x[idx[0]] << " " << y[idx[0]] << endl;
    return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define ll long long int
#define N 100000
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
#define square(x) x*x
using namespace std;
/**
        * @author :: Sawlani
        *
        */
int main()
{
    ll k,n;
    cin >>  k >>  n;

    ll a[n+1];

    f(i,1,n)  cin >> a[i];


    ll ans=LONG_MAX;

    ll pre[n+1]={0};
    ll fro=(k-a[n])+a[1];
    pre[1]=0;
    f(i,2,n){

       pre[i]=pre[i-1]+a[i]-a[i-1];    
   
    }
     ans=min({ans,pre[n],fro+pre[n]});   
    f(i,2,n)
    {
        ll a=(pre[n]-pre[i])+pre[i-1]+fro;
        ll b;
        if(i==n)
        b=pre[n];
        else
         b=pre[i]+fro+pre[n]-pre[i+1];

        // cout << i << " " << b << endl; 
           ans=min({ans,a,b});
    }

    cout << ans;
}

Measured memory_bytes: 3968
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    int a, b;
    while(cin>>a>>b) {
        P(a-b);
    }
    return 0;
}

Measured memory_bytes: 3096
#include "bits/stdc++.h"
using namespace std;
char field[50][51];

void dfs(int x, int y, int H, int W){
	char cnt[2];
	cnt[0] = '0';

	for(int dx = -1;dx <= 1;dx++){
		for(int dy = -1;dy <=1;dy++){
			int nx = x + dx, ny = y + dy;
			if(0<=nx && nx<H && 0<=ny && ny<W && field[nx][ny] == '#') cnt[0]++;
		}
	}
	field[x][y] = cnt[0];

	return ;
}
int main(){
	int H,W;
	cin>>H>>W;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>field[i][j];
		}
	}

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(field[i][j] == '.'){
				dfs(i, j, H, W);
			}
		}
	}

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout<< field[i][j] ;
		}
		cout<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long n,t,l,cnt1,cnt2,x[100005],a[100005],b[100005],q[100005],p,g,f,s[100005],w[100005],ans[100005];

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n >> l >> t;
    for(int i=1;i<=n;i++){
        cin >> x[i] >> w[i];
        if(w[i]==1) a[i]++;
        else b[i]++;
        a[i]+=a[i-1];
        b[i]+=b[i-1];
        s[i]=i;
    }
    for(int i=1;i<=n;i++){
        if(w[i]==1) s[i]+=(2*t/l)*b[n];
        else s[i]-=(2*t/l)*a[n];
    }
    p=(2*t)%l;
    for(int i=1;i<=n;i++){
        if(w[i]==1){
            g=x[i]+p; f=0;
            if(g>=l){
                f=b[n]-b[i-1]+b[(int)(upper_bound(x+1,x+n+1,g-l)-x)-1];
            }
            else{
                f=b[(int)(upper_bound(x+1,x+n+1,g)-x)-1]-b[i-1];
            }
            s[i]+=f;
            s[i]%=n;
            if(s[i]<=0) s[i]+=n;
        }
        else{
            g=x[i]-p; f=0;
            if(g<0){
                f=a[i]+a[n]-a[(int)(lower_bound(x+1,x+n+1,g+l)-x)-1];
            }
            else{
                f=a[i]-a[(int)(lower_bound(x+1,x+n+1,g)-x)-1];
            }
            s[i]-=f;
            s[i]%=n;
            if(s[i]<=0) s[i]+=n;
        }
    }
    for(int i=1;i<=n;i++){
        if(w[i]==1){
            ans[s[i]]=x[i]+t;
            ans[s[i]]%=l;
            if(ans[s[i]]<0) ans[s[i]]+=l;
        }
        else{
            ans[s[i]]=x[i]-t;
            ans[s[i]]%=l;
            if(ans[s[i]]<0) ans[s[i]]+=l;
        }
    }
    for(int i=1;i<=n;i++) cout << ans[i] << '\n';
}


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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    while (cin >> s, s != "#") {
        vector<string> m(1, "");
        each(c, s) {
            if (isdigit(c)) {
                rep(i, '0', c) m.back() += ".";
            }
            else if (c == 'b') {
                m.back() += "b";
            }
            else {
                m.pb("");
            }
        }
        ll x1, y1, x2, y2; cin >> y1 >> x1 >> y2 >> x2; --y1, --x1, --y2, --x2;
        m[y2][x2] = 'b';
        m[y1][x1] = '.';
        string ans = "";
        rep(y, m.size()) {
            if (y) ans += "/";
            ll cnt = 0;
            each(c, m[y]) {
                if (c == 'b') {
                    if (cnt > 0) ans += char('0'+cnt);
                    cnt = 0;
                    ans += "b";
                }
                else {
                    ++cnt;
                }
            }
            if (cnt > 0) ans += char('0'+cnt);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <iterator>
#include <algorithm>
using namespace std;


int main() {
	int N;

	cin >> N;

	vector<int> P(N), tmpP(N);

	for(int i=0; i<N; i++) {
		cin >> P.at(i);
	}

	bool isEnable = false;

	for(int i=0; i<N-1; i++){
		for(int j=i;j<N; j++) {
			tmpP = P;
			// exchange
			int tmp = tmpP.at(j);
			tmpP.at(j) = tmpP.at(i);
			tmpP.at(i) = tmp;
			// cout << "exchange: " << tmpP.at(i) << " " << tmpP.at(j) << endl;

			bool loopEnable = true;
			for(int z=0; z<N-1; z++) {
				if(tmpP.at(z) + 1 != tmpP.at(z+1)) {
					loopEnable = false;
					break;
				}
			}
			if(loopEnable) {
				isEnable = true;
				break;
			}

		}

		if(isEnable) break;
	}

	if (isEnable) cout << "YES";
	else  cout << "NO";

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
	int A, B, X;
	cin >> A >> B >> X;
	if (A <= X && X - A <= B)cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;

int n, m, p;
vector<int>d;
int res = INF;

int main() {
	cin >> n >> m >> p;
	for (int i = 0; i < m; i++) {
		int num;
		cin >> num;
		num -= p;
		if (num < 0) num += n;
		d.pb(num);
	}
	VSORT(d);
	res = min(res, n - d[0]);
	res = min(res, d[m - 1]);
	for (int i = 0; i < m - 1; i++) {
		int sum = 0;
		sum += d[i];
		sum += d[i] + (n - d[i + 1]);
		res = min(res, sum);
	}
	for (int i = m - 1; i > 1; i--) {
		int sum = 0;
		sum += (n - d[i]) * 2;
		sum += d[i - 1];
		res = min(res, sum);
	}
	out(res*100);
	return 0;
}


Measured memory_bytes: 3288
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.numeric;
import std.stdio;
import std.string;

void main()
{
    string n = readln().chomp;
    int[] a = readln().chomp.split(" ").to!(int[]);
    int count = 0;
    int max = 100;
    for (int i = 1; i < a.length; ++i)
    {
        if (a[i - 1] == a[i])
        {
            ++count;
            a[i] = max++;
        }
    }
    writeln(count);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int c[100005]={0};
int main(){
	int a,b,i,j,k=100000,p=0,n,ans=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a>>b;
		if(a<k) k=a;
		if(b>p) p=b;
		for(j=a;j<=b;j++) c[j]++;
	} 
	for(i=k;i<=p;i++){
		if(c[i]==1) ans++;
	}
	cout<<ans<<endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i=0; i<n; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  cout << d.at(n/2)-d.at(n/2-1) <<endl;
  
}


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

#define int long long

signed main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); ++i) if(i%2==0) cout << s[i];
    cout << endl;
    return 0;
}



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

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

    double ansnodo = 0.0;
    int answater = 0;
    int anssugar = 0;
    for (int i = 0; 100 * a * i <= f; ++i) {
        for (int j = 0; 100 * a * i + 100 * b * j <= f; ++j) {
            int water = 100 * a * i + 100 * b * j;
            for (int k = 0; water + c * k <= f; ++k) {
                for (int l = 0; water + c * k + d * l <= f; ++l) {
                    int sugar = c * k + d * l;
                    if (sugar <= e * water / 100) {
                        if (water + sugar == 0) continue;
                        double nodo = 100.0 * sugar / (water + sugar);
                        if (nodo >= ansnodo) {
                            ansnodo = nodo;
                            answater = water;
                            anssugar = sugar;
                        }
                    }
                }
            }
        }
    }

    cout << answater + anssugar << " " << anssugar << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a,b;
    char c;
    scanf("%d %c %d",&a,&c,&b);
    while(c != '?'){
        switch(c){
            case '+':
                printf("%d\n",a+b);
                break;
            case '-':
                printf("%d\n",a-b);
                break;
            case '*':
                printf("%d\n",a*b);
                break;
            case '/':
                printf("%d\n",a/b);
                break;
        }
         scanf("%d %c %d",&a,&c,&b);
    }
    return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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


const string YES = "Yes";
const string NO = "No";

void func(long long N, long long K, std::vector<long long> A){

    REP(i,K,N){
        if(A[i]>A[i-(K)]){
            cout<<YES<<endl;
        }
        else{
            cout<<NO<<endl;
        }
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, K, std::move(A));
    return 0;
}


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

int main(){
    int x; cin >> x;
    if(x == 3 || x == 5 || x == 7){
        put("YES");
    }else{
        put("NO");
    }
}

Measured memory_bytes: 256
from collections import Counter

N, M = map(int, input().split())


def factorize(n):
    if n == 1:
        return [1]

    i, factors = 2, []
    while i * i <= n:
        while n % i == 0:
            n //= i
            factors.append(i)
        i += 1
    if n > 1:
        factors.append(n)
    return factors


c = Counter(factorize(M))
a = [1]
for k, v in c.items():
    tmp = []
    for x in a:
        for i in range(v + 1):
            tmp.append(x * (k**i))
    a = list(set(a) | set(tmp))

ans = 0
for x in a:
    y = M // x
    if N <= y:
        ans = max(ans, x)
print(ans)


Measured memory_bytes: 3444
import sys
R = lambda:map(int,raw_input().split())
d = {}
while 1:
    try:
        s,p = raw_input().split()
        p = int(p)
        if not d.has_key(s):
            d[s] = set()
        d[s].add(p)
            
    except EOFError:
        break

#print d
for k in sorted(d.iterkeys()):
    print k
    print " ".join(str(s) for s in sorted(d[k]))

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

using namespace std;

using u128 = __uint128_t;

#define int long long
#define mod 1000000007

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    int *a= new int[n];
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    int count = 1;
    set<int> x;
    x.insert(a[0]);
    for(int i = 1; i< n; i++){
        auto it = x.begin();
        if(*it > a[i]) count++;
        x.insert(a[i]);
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 11264
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*

 */

char s[12];
char t[12];

int main(){
  cin >> s;
  int l = strlen(s);

  int j = 0;
  REP(i,l){
    if(s[i]!='B'){
      t[j] = s[i];
      j++;      
    } else {
      if(j>0)
        j--;
    }
  }
  t[j] = '\0';
  cout << t << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner in = new Scanner(System.in);
       int a = in.nextInt();
       int b = in.nextInt();
       
       int s = a*b;
       if (s % 2 == 0){
           System.out.println("Even");
       }else{
           System.out.println("Odd");
       }
     }
}


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

int main (){
    long long N = 0;
    cin >> N;
    vector<long long> A(N,0);
    for(long long i = 0; i < N; i++) {
    cin >> A.at(i);
    }
    long long h, l;
    vector<long long> m(N,0);
    vector<long long> s(N,0);
    m.at(0) = 1000;
    long long mt;

    if (A.at(0) <= A.at(1))
    {
        mt = m.at(0);
        m.at(0) -= (m.at(0)/A.at(0))*A.at(0);
        s.at(0) = mt/A.at(0);
        //cout << m.at(0) << "#" << s.at(0) << endl;
    }

    for (size_t i = 1; i < N-1; i++)
    {
        if (A.at(i-1) <= A.at(i) && A.at(i) >= A.at(i+1))
        {
            m.at(i) = m.at(i-1) + s.at(i-1)*A.at(i);
            s.at(i) = 0;
            //cout << A.at(i-1) << endl;
            //cout << m.at(i) << "#" << s.at(i) << endl;
        }else if (A.at(i-1) >= A.at(i) && A.at(i) <= A.at(i+1))
        {
            mt = m.at(i-1);
            m.at(i) = m.at(i-1) - (m.at(i-1)/A.at(i))*A.at(i);
            s.at(i) = mt/A.at(i)+s.at(i-1);
            //cout << m.at(i) << "#" << s.at(i) << endl;
        }else
        {
            m.at(i) = m.at(i-1);
            s.at(i) = s.at(i-1);
            //m.at(i+1) = m.at(i);
            //s.at(i+1) = s.at(i);

            //cout << m.at(i) << "#" << s.at(i) << endl;
        }
        
        
    }

    if (A.at(N-2) <= A.at(N-1))
    {
        //cout << "###" << endl;
        cout << m.at(N-2) + s.at(N-2)*A.at(N-1) << endl;
    }else
    {
        cout << m.at(N-2) << endl;
    }
    

    
    

    
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);  
    string S,T,ans = "No";
    cin >> S >> T;
    vector<int> s(26,0),t(26,0);
    for(int i = 'a';i < 'a'+27;i ++){
        for(int j = 0;j < S.size();j ++){
            if(int(S[j]) == i) s[i-'a'] ++;
        }
        for(int j = 0;j < T.size();j ++){
            if(int(T[j]) == i) t[i-'a'] ++;
        }
    }
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    if(s == t) ans = "Yes";

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 916
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double n,m;
  double cnt;
  double time;
  double ans=0,cp=0;
  double div_m=1,div_c;
  
  cin >> n >> m;
  
  for(int i=1;i<=m;i++){
    div_m*=2;
  }
  
  div_c=div_m;
  time=(m*1900)+(n-m)*100;

  if(m==0)
    ans=n*100;
  
  else{
    ans=time*div_m;
  }
  
  printf("%.0lf\n",ans);
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)


int main(){
    int n,k;
    cin>>n>>k;
    
    int ans = INF;
    for(int i=0;i<=n;i++){
        ans = min(ans,(1<<i)+k*(n-i));
    }
    cout<<ans<<endl;
}


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

int main(){
	int n;
	cin >>n;
	vector<int> v(n),c(n);
	rep(i,n)
		cin >> v[i];
	rep(i,n)
		cin >> c[i];
	int ans=0;
	rep(i,n){
		if (c[i] < v[i])
			ans += v[i]-c[i];
	}
	cout <<ans<<endl;

}

Measured memory_bytes: 256
n, m, x = map(int, input().split())
a = [int(i) for i in input().split()]
b = 0
c = 0
for i in range(m):
    if a[i] < x:
        b += 1
    elif a[i] > x:
        c = m - b
        break
print(min(b, c))

Measured memory_bytes: 3060