akhauriyash/Code-Regression huggingface dataset:
// Clockwork is still ticking.

#include <bits/stdc++.h>

using namespace std;

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

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

namespace fastIO
{
	const UI BUFFER_SIZE = (UI) 1 << 15;
	char buffer[BUFFER_SIZE], *cur, *ed;

	inline char getc() { return *(cur == ed ? ed = buffer + fread(buffer, 1, BUFFER_SIZE, stdin), cur = buffer : cur)++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

template<typename T> inline T sqr(const T &val) { return val * val; }
template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }

// END tpl.

const int MAXN = (int) 1e3, MAXM = (int) 2e5;

int n, m;

vector<int> adj[MAXN + 5];

struct edge
{
	int u, v;

	edge() { }
	edge(int _u, int _v): u(_u), v(_v) { }
};

edge E[MAXM + 5];

inline void input()
{
	n = read<int>(), m = read<int>();
	for(int i = 1; i <= m; ++i)
	{
		int u = read<int>(), v = read<int>();
		E[i] = edge(u, v);
		adj[u].push_back(v);
	}
}

int vis[MAXN + 5], cur = 0;

inline void dfs(int u, int *G)
{
	vis[u] = cur, G[u] = 1;
	for(auto v : adj[u]) if(vis[v] != cur) dfs(v, G);
}

inline void dfs_mark(int u, int val, int *T)
{
	vis[u] = cur, T[u] = val;
	for(auto v : adj[u]) if(vis[v] != cur) dfs_mark(v, val, T);
}

inline void solve()
{
	static int G[MAXN + 5][MAXN + 5];

	for(int i = 1; i <= n; ++i) ++cur, dfs(i, G[i]);

	static int mn[MAXN + 5][MAXN + 5], mx[MAXN + 5][MAXN + 5];

	for(int i = 1; i <= n; ++i) sort(ALL(adj[i]));
	for(int u = 1; u <= n; ++u)
	{
		vis[u] = ++cur;
		for(auto v : adj[u]) if(vis[v] != cur) dfs_mark(v, v, mn[u]);

		reverse(ALL(adj[u]));
		vis[u] = ++cur;
		for(auto v : adj[u]) if(vis[v] != cur) dfs_mark(v, v, mx[u]);
		reverse(ALL(adj[u]));
	}

	for(int i = 1; i <= m; ++i)
	{
		int u = E[i].u, v = E[i].v;
		puts(G[v][u] + (mn[u][v] < mx[u][v]) == 1 ? "diff" : "same");
	}
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 16128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e16;
void yes(bool c) { if (c)print("Yes"); else print("No"); };


int H[200020];
int N, M;
vector<int>G[200020];
void solve() {
	cin >> N >> M;
	REP(i, N)cin >> H[i];
	REP(i, M) {
		int u, v; cin >> u >> v;
		u--, v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	int ans = 0;
	REP(i, N) {
		bool ok = true;
		for (auto nxt : G[i]) {
			if (H[i] <= H[nxt])ok = false;
		}
		if (ok)ans++;
	}
	print(ans);
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 12592
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;
 
typedef ostringstream OSS;
typedef istringstream ISS;
 
typedef vector<int> VI;
typedef vector< VI > VVI;
 
typedef long long LL;
 
typedef pair<int, int> PII;
typedef vector<PII> VPII;
 
#define X first
#define Y second

vector<bool> Prime;
void initPrime(long num) {
	Prime = vector<bool>(num + 1, true);
	Prime[1] = Prime[0] = false;
	for (long i = 2; i * i <= num; i++) {
		if (Prime[i]) {
			for (long j = i + i; j <= num; j += i) {
				Prime[j] = false;
			}
		}
	}
}
 
int main(void) {
	initPrime(1000000);
	int N, X;
	while (cin >> N >> X, N) {
		VI ps(N);
		for (auto &p : ps) cin >> p;
		
		vector<bool> dp(X + 1);
		dp[0] = true;

		for (auto p : ps) {
			for (int i = 0; i <= X; i++) {
				if (!dp[i]) continue;

				int np = i + p;
				if (np <= X) {
					dp[np] = true;
				}
			}
		}

		int ans = 0;
		for (int i = 0; i <= X; i++) {
			if (dp[i] && Prime[i]) ans = i;
		}

		if (ans) cout << ans << endl;
		else cout << "NA" << endl;
	}

}

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

using namespace std;

int main(){
    int n,m,ans = 0;
    cin >> n >> m;

    vector<vector<int>>v(n,vector<int>(1,0));
    vector<int>check(n,0);

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

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

    for(int i = 0;i < n;i++){
        bool flag = true;
        if(check[i] == 0){
            ans++;
            continue;
        }
        for(int j = 1;j < v[i].size();j++){
            if(v[i][0] <= v[i][j])flag = false;
        }
        if(flag)ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9860
#include<iostream>
using namespace std;
#define INF 1000000007
struct edge{
  int from,to,cost;
};
edge es[2020];
int d[1010];
int V,E,r;
bool find_negative_loop(){
  for(int i=0;i<V;i++){
    d[i]=INF;
  }
  d[r]=0;
  for(int i=0;i<V;i++){
    for(int j=0;j<E;j++){
      edge e=es[j];
      if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        if(i==V-1) return true;
      }
    }
  }
  return false;
}
int main(){
  cin>>V>>E>>r;
  for(int i=0;i<E;i++){
    cin>>es[i].from>>es[i].to>>es[i].cost;
  }
  if(find_negative_loop()){
    cout<<"NEGATIVE CYCLE"<<endl;
    return 0;
  }
  for(int i=0;i<V;i++){
    if(d[i]==INF) cout<<"INF"<<endl;
    else cout<<d[i]<<endl;
  }
}


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

class A {
    final int val;
    int maxSum;

    A( int val ) {
	this.val = val;
    }

    public String toString() {
	return String.format( "(%d, %d)", val, maxSum );
    }
}

class Main {

    public static void main(String[] args) {

	final Scanner stdin = new Scanner(System.in);
	ArrayList<ArrayList<A>> list = new ArrayList<ArrayList<A>>();

	while ( stdin.hasNextLine() ) {
	    String[] input = stdin.nextLine().split( "," );
	    ArrayList<A> ar = new ArrayList<A>();
	    for ( final String in : input ) {
		ar.add( new A( Integer.parseInt( in ) ) );
	    }
	    list.add( ar );
	}
	list.get( 0 ).get( 0 ).maxSum = list.get( 0 ).get( 0 ).val;
	
	final int size = list.size() / 2;
	for ( int i = 0; i < size; i++ ) {
	    for ( int j = 0; j <= i; j++ ) {
		A cur = list.get( i ).get( j );
		A straight = list.get( i + 1 ).get( j );
		straight.maxSum = Math.max( straight.maxSum, cur.maxSum + straight.val );
		A next = list.get( i + 1 ).get( j + 1 );
		next.maxSum = Math.max( next.maxSum, cur.maxSum + next.val );
	    }
	}

	for ( int i = size + 1; i <= size * 2; i++ ) {
	    for ( int j = 0; j < 2 * size + 1 - i; j++ ) {
		A cur = list.get( i ).get( j );
		A straight = list.get( i - 1 ).get( j );
		A next = list.get( i - 1 ).get( j + 1 );
		cur.maxSum = Math.max( straight.maxSum, next.maxSum ) + cur.val;
	    }
	}
	System.out.println( list.get( size * 2 ).get( 0 ).maxSum );
    }
    
}

Measured memory_bytes: 21296
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int w,a,b;
    cin>>w>>a>>b;
    int x=min(a,b);
    int y=max(a,b);
    ((y-(x+w))>0)?cout<<(y-(x+w))<<endl:cout<<0<<endl;

}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int a,b,c,d,e,f;
int main()
{
	int i,j,k,l;
	int water=0,max,ans1=0,ans2=0;
	double bj=-1;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	for(i=0;a*100*i<=f;i++)
		for(j=0;b*100*j+a*100*i<=f;j++){
			water=b*100*j+a*100*i;
			max=0;
			for(k=0;k*c<=e*water/100&&k*c+water<=f;k++)
				for(l=0;l*d+k*c<=e*water/100&&k*c+l*d+water<=f;l++)
					if(max<l*d+k*c)
						max=l*d+k*c;
			if(bj<double(max*100.0)/(double)(max+water)){
				bj=double(max*100.0)/(double)(max+water);
				ans1=water+max;ans2=max;
			}
		}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;

	string S;
	cin >> S;

	if (S[K - 1] == 'A') {
		S[K - 1] = 'a';
	}
	else if (S[K - 1] == 'B') {
		S[K - 1] = 'b';
	}
	else if (S[K - 1] == 'C') {
		S[K - 1] = 'c';
	}
	else {
		S;
	}
		
	cout << S << endl;
}


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

using namespace std;

int main() {
  int h,w;
  char a[200][200];
  cin >> h >> w;  
  for(int i = 1; i < h+1; i++) {
    for(int j = 1; j < w+1; j++)
      cin >> a[i][j];
  }
  for(int i = 0; i < h+2; i++) {
    for(int j = 0; j < w+2; j++) {
      if(i == 0 || i == h+1)
        cout << "#";
      else {
        if(j == 0 || j == w+1)
          cout << "#";
        else cout << a[i][j];
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 3672
using System;
class Program
{
    private const int Price = 800;
    private const int CashBack = 200;
    private const int ServiceCount = 15;

    static void Main(string[] args)
    {
        int total = int.Parse(Console.ReadLine());
        int x = total * Price;
        int y = (total / ServiceCount) * CashBack;

        Console.WriteLine(x - y);
    }
}


Measured memory_bytes: 11092
#include <iostream>

using namespace std;

int n, res;
int a[300005];
int b[300005];
string str;

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

    if (str[0] == 'W')
    {
        a[0] = 1;
        b[0] = 0;
    }
    else
    {
        a[0] = 0;
        b[0] = 1;
    }
    for (int i = 1; i < n; ++i)
    {
        a[i] = a[i-1];
        b[i] = b[i-1];

        if (str[i] == 'W')
            a[i]++;
        else
            b[i]++;
    }

    res = n + 1;
    for (int i = 0; i < n; ++i)
    {
        int tmp1, tmp2;

        if (i == 0)
        {
            tmp1 = 0;
            tmp2 = b[n-1] - b[i];
        }
        else
        {
            tmp1 = a[i-1];
            tmp2 = b[n-1] - b[i];
        }

        if (tmp1 + tmp2 < res)
            res = tmp1 + tmp2;

    }

    cout << res << endl;

    return 0;
}

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

int main() {
	string o,e;
	cin >> o >> e;
	for(int i = 0;i < o.length();i++)
	{
		cout << o.at(i);
		if(e.size() > i )
		{
			cout << e.at(i);
		}
	}
    cout << endl;
	return 0;
}


Measured memory_bytes: 256
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int          long long int
#define     ld           long double
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     pii          pair<int,int>
#define     F            first
#define     S            second
#define     show(x)      for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     show2(x)     for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

const int inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int n,r;
    cin>>n>>r;

    if(n>=10)
        cout<<r;
    else
    {
        r+=100*(10-n);
        cout<<r;
    }
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




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

int memo[200000];

int main() {
  int64_t N;
  cin >> N;
  for(int64_t i = 0; i < N-1; i++) {
    int64_t x;
    cin >> x;
    memo[x]++;
  }
  for ( int64_t i = 1; i <=N; i++) {
    cout << memo[i] << endl;
  }
}


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

int main(){
 
    string S;
    int count=0;
 
    cin >> S;
    
    for(int i = 0;i<3;i++){
        
        for(int j=1;j<(4-i);j++){
            if(S[i]==S[i+j]){
                count++;
            }
            
        }
        
        
        
    }
    
    if(count==2)
        cout << "Yes";
    else
        cout << "No";
    
 
 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>

#define max 5

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int x, y, z, tmp;
    char s[max];
    
    scanf("%d %d %d", &x, &y, &z);
    
    tmp=x;
    x=y;
    y=tmp;
    tmp=x;
    x=z;
    z=tmp;
    
    printf("%d %d %d", x, y, z);
    
    
    return 0;
}




Measured memory_bytes: 128
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    S = input().strip()
    T = input().strip()
    if len(S) + 1 == len(T):
        if S == T[:-1]:
            print('Yes')
            exit()
    print('No')
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main() {
	int x,y;
    cin >> x >> y;
    int ans=0;
    switch (x)
    {
    case 1:
        ans+=300000;
        break;
    case 2:
        ans+=200000;
        break;
    case 3:
        ans+=100000;
        break;
    default:
        break;
    }
        switch (y)
    {
    case 1:
        ans+=300000;
        break;
    case 2:
        ans+=200000;
        break;
    case 3:
        ans+=100000;
        break;
    default:
        break;
    }
    if(x==1 && y ==1) ans+=400000;
    cout << ans <<endl;
    return 0;



}


Measured memory_bytes: 256
def way10(ball, box):
    """ball: False / box: False / constraints: None
    ans = P(ball, box)  Pは分割数 / 計算量 O(ball * box)
    """
    # P[i][j] := 整数iを順序を区別せずに「j以下の自然数」の和に分ける場合の数
    P = [[0] * (ball + 1) for _ in range(ball + 1)]
    for j in range(ball + 1):
        P[0][j] = 1
    for i in range(ball):
        for j in range(ball):
            if i - j >= 0:
                P[i + 1][j + 1] = (P[i + 1][j] + P[i - j][j + 1]) % MOD
            else:
                P[i + 1][j + 1] = P[i + 1][j]
    return P[ball][min(box, ball)]


n, k = map(int, input().split())
MOD = 10 ** 9 + 7

print(way10(n, k))


Measured memory_bytes: 29364
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

#[allow(dead_code)]
const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut tree = vec![vec![]; n];
    for _ in 1..n {
        let u = sc.cin::<usize>() - 1;
        let v = sc.cin::<usize>() - 1;
        let w: usize = sc.cin();
        tree[u].push((v, w));
        tree[v].push((u, w));
    }
    let mut memo = vec![None; n];
    let mut stack = vec![0];
    memo[0] = Some(0);
    while let Some(u) = stack.pop() {
        let c = memo[u].unwrap();
        for &(v, w) in tree[u].iter() {
            if memo[v] != None {
                continue;
            }
            if w % 2 == 0 {
                memo[v] = Some(c);
            } else {
                memo[v] = Some(1 - c);
            }
            stack.push(v);
        }
    }
    for i in 0..n {
        put!(memo[i].unwrap());
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 14716
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005

using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;


int main(){
   IOS
   ll a,b,c;
   cin >>a>>b>>c;
   if((a+b+c)>21)cout<<"bust";
   else cout << "win";
    return 0;
}


Measured memory_bytes: 256
if __name__ == "__main__":

    while True:
        s = raw_input().split()
        a = int(s[0])
        b = int(s[2])
        op = s[1];

        if op == "*":
            x = a * b
        elif op == "+":
            x = a + b
        elif op == "-":
            x = a - b
        elif op == "/":
            x = a / b
        elif op == "?":
            break;
        print x

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int v;
  int Even[100001]={};
  int Odd[100001]={};
  int i;
  int odd1,odd2,even1,even2;
  for(i=0;i<n/2;i++){
    cin >> v;
    Odd[v]++;
    cin >> v;
    Even[v]++;
  }
  odd1 = 0;
  odd2 = 0;
  even1 = 0;
  even2 = 0;
  for(i=1;i<=100000;i++){
    if(Odd[i]>=Odd[odd1]){
      odd2 = odd1;
      odd1 = i;
    }else if(Odd[i]>=Odd[odd2]){
      odd2 = i;
    }
    if(Even[i]>=Even[even1]){
      even2 = even1;
      even1 = i;
    }else if(Even[i]>=Even[even2]){
      even2 = i;
    }
  }
  int ans = 0;
  if(odd1 != even1){
    ans = n-Odd[odd1]-Even[even1];
  }else{
    if(Odd[odd1]-Odd[odd2]<=Even[even1]-Even[even2])ans = n-Odd[odd2]-Even[even1];
    else ans = n-Odd[odd1]-Even[even2];
  }
  cout << ans;

}


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

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}

	Scanner cin;

	const int MOD = 1000000007;
	const int INF = int.MaxValue - 10;
	const long INFL = long.MaxValue - 10;
	const double EPS = 1e-8;
	const double PI = 3.1415926536;
	int[,] dir8;
	int[,] dir4;



	void prog()
	{
		cin = new Scanner();
		dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		int K = cin.nextInt();
		long[] a = new long[N];
		long[] b = new long[N];
		for (int i = 0; i < N; i++)
		{
			if (i == 0)
			{
				a[0] = cin.nextInt();
				b[0] = Math.Max(0, a[0]);
			}
			else
			{
				int num = cin.nextInt();
				a[i] = a[i - 1] + num;
				b[i] = b[i - 1] + Math.Max(0, num);
			}
		}
		long ans = 0;
		for (int i = 0; i <= N-K; i++)
		{
			long ans1 = Math.Max(0, a[i + K - 1] - (i == 0 ? 0 : a[i - 1]));
			if (i != 0) ans1 += b[i - 1];
			ans1 += b[N - 1] - b[i + K - 1];
			ans = Math.Max(ans, ans1);
		}
		Console.WriteLine(ans);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 18392
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
H = list(map(int, input().split()))
G = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    G[A].append(B)
    G[B].append(A)
ans = 0
for v in range(N):
    if all(H[v] > H[u] for u in G[v]):
        ans += 1
print(ans)

Measured memory_bytes: 95076
while True:
	a, op, b = map(str, input().split())
	a, b = int(a), int(b)
	
	if op == "+":
		output = a + b
	elif op == "-":
		output = a - b
	elif op == "*":
		output = a * b
	elif op == "/":
		output = a // b
	elif op == "?":
		break
	print(output)

Measured memory_bytes: 7632
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
now = A[0]
ans = 0
s = 1
for i in range(1,N):
    if now == A[i]:
        s += 1
    else:
        if s % 2 == 0:
            pass
        else:
            ans += 1
        s = 1
    now = A[i]
if s % 2 == 1:
    ans += 1
print(ans)

Measured memory_bytes: 51544
<?php
$n = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));

if($n == 2){
    echo abs($a[0] - $a[1]);
}else{
    $s = array_sum($a);
    $ans = abs($a[0] * 2 - $s);
    $i = 0;
    $x = 0;
    while($i < $n - 1){
        $x += $a[$i];
        $s -= $a[$i];
        $ans = min($ans,abs($x - $s));
        ++$i;
    }
    echo $ans;
}
?>

Measured memory_bytes: 39668
a, b, c = map(int, input().split())
m = max([a, b, c])
print((m * 3 - (a + b + c)) // 2 if (a + b + c) % 2 == (m * 3) % 2 else ((m + 1) * 3 - (a + b + c)) // 2)

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

int main(){
  char str[4];
  cin >> str;
  bool a = 0, b = 0, c = 0;
  for(int i = 0; i < 3; i++){
    if(str[i] == 'a'){
      a = 1;
      break;
    }
  }
  for(int i = 0; i < 3; i++){
    if(str[i] == 'b'){
      b = 1;
      break;
    }
  }
  for(int i = 0; i < 3; i++){
    if(str[i] == 'c'){
      c = 1;
      break;
    }
  }
  if(a && b && c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int dp[1010][1010];int main(){string a,b;cin>>a>>b;for(int i=0;i<a.size()+1;i++)dp[i][0]=i;for(int i=0;i<b.size()+1;i++)dp[0][i]=i;	for(int i=1;i<=a.size();i++){for(int j=1;j<=b.size();j++){int q=1;if(a[i-1]==b[j-1])q = 0;dp[i][j]=min(min(dp[i-1][j-1]+q,dp[i][j-1]+1),dp[i-1][j]+1);}}cout<<dp[a.size()][b.size()]<<endl;return 0;}

Measured memory_bytes: 7100
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long n = in.nextLong();

            long max = n;
            for (long i = 2; i < Math.sqrt(n) + 1; i++) {
                if (n % i == 0)
                    max = n / i;
            }

            int ans = 0;
            while (max > 0) {
                ans++;
                max /= 10;
            }
            out.println(ans);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

    }
}



Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define ll int64_t
using namespace std;

bool compare_by_b(pair<string,int> a,pair<string,int> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

int main(){
    ll h,w;
    cin>>h>>w;
    string d[50];
    rep(i,h) cin>>d[i];
    
    const int dx[8] = {1,0,-1,0,1,-1,-1,1};
    const int dy[8] = {0,1,0,-1,1,1,-1,-1};
    
    rep(i,h){
        rep(j,w) {
            if(d[i][j]=='#'){
                cout<<"#";
                continue;
            }
            int num=0;
            rep(b,8){
                const int ni = i + dy[b];
                const int nj = j + dx[b];
                
                if(ni<0 || h<=ni) continue;
                if(nj<0 || w<=nj) continue;
                if(d[ni][nj]=='#') num++;
            }
            cout<<num;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

array = [math.ceil(n/a),
         math.ceil(n/b),
         math.ceil(n/c),
         math.ceil(n/d),
         math.ceil(n/e)]
ans = max(array)+4
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
const int MAX_V=100000;
#define int long long
struct edge{int to,cost;};
int V,E;
vector<edge> G[MAX_V];
int d[MAX_V];

signed main(){
  string s,t;
  cin >> s >> t;
  char b;
  LOOP(i,s.length()-1){
    FOR(j,i,s.length()){
      if(s[i]>s[j]){
        b=s[i];
        s[i]=s[j];
        s[j]=b;
      }
    }
  }
  LOOP(i,t.length()-1){
    FOR(j,i,t.length()){
      if(t[i]<t[j]){
        // cout << i<<"*"<<j << endl;
        b=t[i];
        t[i]=t[j];
        t[j]=b;
      }
    }
  }
  // cout << s << " " <<t << endl;
  int cnt=0;
  while(1){
    if(cnt==t.length()){
      cout << "No" << endl;
      return 0;
    }
    if(cnt==s.length()){
      cout << "Yes"<<endl;
      return 0;
    }
    if(s[cnt]<t[cnt]){
      cout << "Yes" << endl;
      return 0;
    }if(s[cnt]>t[cnt]){
      cout << "No" << endl;
      return 0;
    }
    cnt++;
  }
  cout << s <<endl<< t <<endl;
}


Measured memory_bytes: 2560
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int a[][52],int b[][52],int x,int y){
  if(a[x][y]==0||b[x][y]==1)
    return 0;
  else{
    b[x][y]=1;
    f(a,b,x-1,y-1);
    f(a,b,x,y-1);
    f(a,b,x+1,y-1);
    f(a,b,x-1,y);
    f(a,b,x+1,y);
    f(a,b,x-1,y+1);
    f(a,b,x,y+1);
    f(a,b,x+1,y+1);
    return 1;
  }
}
int main(){
  int i,j;
  int a[52][52],b[52][52],w,h;
  int ct;
  while(cin>>w>>h&&w+h){
    memset(a,0,sizeof(a));
    for(i=1;i<h+1;i++)
      for(j=1;j<w+1;j++)
	cin>>a[j][i];
    memset(b,0,sizeof(b));
    ct=0;
    for(i=1;i<h+1;i++)
      for(j=1;j<w+1;j++)
	ct+=f(a,b,j,i);
    cout<<ct<<endl;
  }
  return 0;
}

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

main :: IO ()
main = do
  [m, nmin, nmax] <- f
  unless (m == 0 && nmin == 0 && nmax == 0) $ do
    solve nmin nmax <$> replicateM m readLn >>= print
    main
  where
    f = map read <$> words <$> getLine

solve :: Int -> Int -> [Int] -> Int
solve nmin nmax ps = snd . maximum $ zip xs [nmin ..]
  where
    xs = take (nmax - nmin + 1) . drop (nmin - 1) $ zipWith (-) ps (tail ps)



Measured memory_bytes: 5524
import sys
input = sys.stdin.readline
mod = 10**9 + 7

h, w, k = [int(x) for x in input().split()]

dp = [[0]*w for _ in range(h + 1)]
dp[0][0] = 1

for i in range(h):
    for j in range(w):
        x = 0 # right
        y = 0 # left
        z = 0 # remain
        for l in range(2**(w - 1)):
            l = bin(l)[2:].zfill(w - 1)
            if "11" in l:
                continue
            if j - 1 >= 0 and l[j - 1] == "1":
                y += 1
            elif j + 1 < w and l[j] == "1":
                x += 1
            else:
                z += 1
        if j + 1 < w:
            dp[i + 1][j + 1] += x * dp[i][j]
            dp[i + 1][j + 1] %= mod
        if j - 1 >= 0:
            dp[i + 1][j - 1] += y * dp[i][j]
            dp[i + 1][j - 1] %= mod
        dp[i + 1][j] += z * dp[i][j]
        dp[i + 1][j] %= mod

print(dp[-1][k - 1])
            
            


Measured memory_bytes: 45916
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 1e5 + 20;
int x[maxn];
int main()
{
    int n , q;
    cin >> n >> q;
    for(int i = 0; i < q; i++)
    {
        int a , b;
        cin >> a >> b;
        x[a]++;
        x[b]++;
    }
    for(int i = 2; i <= n; i++)
        if(x[i] % 2)
        {
            cout << "NO";
            return 0;
        }
    cout << "YES";
}


Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	c := intScanner()
	k := intScanner()
	ts := intSliceScanner(n)
	sort.Sort(sort.Reverse(sort.IntSlice(ts)))
	ans := 0
	for len(ts) != 0 {
		x := ts[len(ts)-1]
		ts = ts[:len(ts)-1]
		for i := 0; i < c-1 && len(ts) != 0; i++ {
			y := ts[len(ts)-1]
			if x+k >= y {
				ts = ts[:len(ts)-1]
			} else {
				break
			}
		}
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2944
sixteen = {
  "A": 10,
  "B": 11,
  "C": 12,
  "D": 13,
  "E": 14,
  "F": 15,
  "G": 16
}

X, Y = input().split(" ")
x = sixteen[X]
y = sixteen[Y]
if x > y:
  print(">")
elif x < y:
  print("<")
else:
  print("=")

Measured memory_bytes: 3060
#coding:utf-8

n = int(input())
string = list(map(int,input().split()))

cnt = 0
Q = [string[0]]
for i in range(1,n):
    if Q[0] == string[i]:
        Q.append(string[i])
    else:
        cnt += len(Q) //2
        Q = [string[i]]

cnt += len(Q) // 2

print(cnt)


Measured memory_bytes: 3316
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	long long n;
	long long a;
	/* 各桁の数字 */
	int dig;

	/* 和 */
	long long sum = 0;
	cin >> n;
	a = n;

	/* 自然数の各桁の数字の和を計算 */
	while (n) {
		dig = n % 10;
		sum = sum + dig;
		n = n / 10;
	}

	if (a % sum == 0) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		cout << "No" << endl;
		return 0;
	}


}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <tuple>
using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

long long N, A[1 << 18], P;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i]; if (i == 1) P = A[1]; else P = gcd(P, A[i]);
	}
	cout << P << endl;
	return 0;
}

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

// clang-format off
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define endl '\n'
#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}; 
constexpr int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
    int N = input();
    vector< int > h(N);
    cin >> h;
    
    vector< int > dp(N, inf);
    dp[0] = 0;
    range(i, 1, N) {
        if (i - 2 >= 0) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    
    cout << dp.back() << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

	vector<int> accE(N + 1, 0);
	for (int i = 0; i < N; ++i) {
		accE[i + 1] = accE[i] + (S[i] == 'E');
	}

	int ans = N;
	for (int i = 0; i < N; ++i) {
		int nWtoE = i - accE[i];
		int nEtoW = accE[N] - accE[i + 1];
		ans = min(ans, nWtoE + nEtoW);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1796
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	scanf("%lld",&n);
	ll xs=2;
	ll ans=0;
	if(n%2==1)
	{
		printf("0");
		return 0;
	}
	while(1)
	{
		if(xs*5>n)
		break;
		
		xs*=5;
		ans+=n/xs;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> v(N, 0);
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[a]++; v[b]++;
    }
    for(int i=0; i<N; i++)
        if(v[i] % 2 == 1){
            cout << "NO" << endl;
            return 0;
        }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 640
/**********************************************
 *Author*        :XzzF
 *Created Time*  : 2018/7/7 14:48:18
 *Ended  Time*  : 2018/7/7 14:55:31
*********************************************/

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 200000;

int n;
LL a[MaxN + 5];

LL cal(LL x) {
	LL res = 0LL;
	for(int i = 1; i <= n; i++) 
		res += abs(a[i] - (x + i));
	return res;
}

void solve() {
	LL l = -inf, r = inf;
	while(l < r) {
		LL lmid = l + (r - l) / 3;
		LL rmid = r - (r - l) / 3;
		if(cal(lmid) < cal(rmid)) r = rmid - 1;
		else l = lmid + 1;
	}
	printf("%lld\n", cal(l));
}

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
		solve();
	}
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define INF 100000000
#define rep(i,a,b) for(int (i)=a;(i)<(int)(b);(i)++)
using ipair = pair<int,int>;

int main(){
    int K;
    string S;
    cin >> K >> S;
    if(S.size()<=K) cout << S << endl;
    else cout << S.substr(0,K) << "..."<< endl;
}

Measured memory_bytes: 3628
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int MAX = 200000;
const ll INF = 1e18;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,K; cin >> N >> K;
    vector<int> A(N);
    rep(i,N) {
        cin >> A[i];
        --A[i];
    }

    vector<vector<int>> G(MAX);
    rep(i,N) {
        G[A[i]].emplace_back(i);
        G[A[i]].emplace_back(i+N);
    }
    rep(i,MAX) sort(all(G[i]));
    vector<vector<int>> nex(61, vector<int>(N));
    vector<vector<ll>> dist(61, vector<ll>(N));
    rep(i,N) {
        dist[0][i] = *upper_bound(all(G[A[i]]),i)+1;
        nex[0][i] = dist[0][i]%N;
        dist[0][i] -= i;
    }
    rep(b,60) {
        rep(i,N) {
            dist[b+1][i] = min(INF,dist[b][i]+dist[b][nex[b][i]]);
            nex[b+1][i] = nex[b][nex[b][i]];
        }
    }

    K *= N;
    int cur = 0;
    for (int bit = 60; bit >= 0; --bit) {
        if (dist[bit][cur] <= K) {
            K -= dist[bit][cur];
            cur = nex[bit][cur];
        }
    }
    vector<int> ans;
    vector<bool> check(MAX);
    rep(i,K) {
        if (check[A[cur]]) {
            while (check[A[cur]]) {
                check[ans.back()] = 0;
                ans.pop_back();
            }
        } else {
            ans.emplace_back(A[cur]);
            check[A[cur]] = 1;
        }
        cur++;
        if (cur == N) cur = 0;
    }
    for (auto i : ans) cout << i+1 << " ";
    cout << ln;
}

Measured memory_bytes: 158292
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		long sum = 0;
		char[] c = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			c[i] = s.charAt(i);
		}

		for (int bit = 0; bit < (1 << s.length()-1); bit++) {
			StringBuilder t = new StringBuilder();
			for (int i = 0; i < s.length(); i++) {
				t.append(c[i]);
				if ((bit & (1 << i)) != 0) {
					sum += Long.parseLong(t.toString());
					t.setLength(0);
					continue;
				}
				if (i==s.length()-1) sum += Long.parseLong(t.toString());
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);


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

  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'L' && i != 0 && s[i-1] == 'L') {
      ans++;
    } else if (s[i] == 'R' && i != n-1 && s[i+1] == 'R') {
      ans++;
    }
  }

  ans = min(ans + k * 2, n-1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512