akhauriyash/Code-Regression huggingface dataset:
/*{{{*/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll a,b,x;
  cin >> a >> b >> x;
  ll ans = b/x - a/x;
  if(a%x==0) ans++;
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 256
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())
  g[a-1].append(b-1)
  g[b-1].append(a-1)

cnt = n
for i in range(n):
  for j in g[i]:
    if h[i] <= h[j]:
      cnt -= 1
      break
print(cnt)

Measured memory_bytes: 29316
import java.io.*
import java.util.*

val pw = PrintWriter(System.out)
fun solve(N: Int, M: Int, X: Int, Y: Int, x: IntArray, y: IntArray){
    for (z in X+1..Y){
        if (z>x.max()!! && z<= y.min()!!){
            println("No War")
            return
        }
    }
    println("War")
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val M = sc.next().toInt()
    val X = sc.next().toInt()
    val Y = sc.next().toInt()
    val x = IntArray(N)
    for (i in 0 until N) {
        x[i] = sc.next().toInt()
    }
    val y = IntArray(M)
    for (i in 0 until M) {
        y[i] = sc.next().toInt()
    }
    solve(N, M, X, Y, x, y)
}



Measured memory_bytes: 34216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  ll N,C,K; cin>>N>>C>>K;
  ll ts[N]; CINA(ts,N);
  sort(ts,ts+N);
  ll r = 0;
  ll p = 0;
  ll t_f = -1;
  REP(i,N){
    ll t = ts[i];
    if(t_f==-1){
      ++p; t_f = t;
    }
    else if(t<=t_f+K){
      ++p;
    }else{
      ++r; p=1; t_f = t; continue;
    }
    if(p==C){ ++r; p=0; t_f = -1;}
  }
  if(t_f>0){ ++r;}
  cout << r <<"\n";
}

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

template <typename T>
class node {
public:
	node<T> *l, *r;
	T val;
	node() {}
	node(T val_, node<T>* l_ = nullptr, node<T>* r_ = nullptr) : l(l_), r(r_), val(val_) {}
	void init(T val_, node<T>* l_ = nullptr, node<T>* r_ = nullptr) {
		val = val_;
		l = l_;
		r = r_;
	}
};

template <typename T>
class DynamicSegmentTree {
	using func_t = function<T(T, T)>;
	const ll n;
	const T id;
	func_t merge;
	node<T> *root;
	vector<node<T>> pool;
	int it;
	ll size(ll n) {
		ll res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	node<T> *new_node() {
		pool[it].init(id);
		return &pool[it++];
	}
	T sub(ll l, ll r, node<T>* n, ll lb, ll ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) return n->val;
		return merge(n->l != nullptr ? sub(l, r, n->l, lb, (lb + ub) / 2) : id, n->r != nullptr ? sub(l, r, n->r, (lb + ub) / 2, ub) : id);
	}
	void suc(ll v, node<T>* n, ll lb, ll ub, T val) {
		if (ub - lb <= 1) {
			n->val = val;
			return;
		}
		ll c = (lb + ub) / 2;
		if (v < c) {
			if (n->l == nullptr) n->l = new_node();
			suc(v, n->l, lb, c, val);
		}
		else {
			if (n->r == nullptr) n->r = new_node();
			suc(v, n->r, c, ub, val);
		}
		n->val = merge(n->l != nullptr ? n->l->val : id, n->r != nullptr ? n->r->val : id);
	}
public:
	DynamicSegmentTree(ll n_, int max_, T id_, func_t merge_) :
		n(size(n_)), id(id_), merge(merge_), pool(max_)
	{
		it = 0;
		root = new_node();
	}
	void Update(ll p, T val) {
		suc(p, root, 0, n, val);
	}
	T Find(ll l, ll r) {
		return sub(l, r + 1, root, 0, n);
	}
};

int main()
{
	cin.sync_with_stdio(false);
	int n, q, com, x, y;
	cin >> n >> q;
	DynamicSegmentTree<int> dst(10000000000000000ll, 10000000, 0x7fffffff, [](int l, int r) { return min(l, r); });
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			printf("%d\n", dst.Find(x, y));
		}
		else {
			dst.Update(x, y);
		}
	}
	return 0;
}

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

int main()
{
  string s,t;
  cin >> s >> t;

  int c = 0;
  for(int i=0; i<s.length(); ++i){
    if (s[i] != t[i]) ++c;
  }
  cout << c << endl;
  
  return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    int sum = ceil((double)(n-1)/(k-1));
    cout << sum << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main()
{
	//freopen("in.txt","r",stdin);
	scanf("%d %d",&n,&m);
	if(n&1){
		for(int i=1,j=n;i<=m;++i,--j) printf("%d %d\n",i,j);
	}
	else{
		for(int i=1,j=n;i<=m;++i,--j){
			printf("%d %d\n",i,j);
			if(i==n>>2) --j;
		}
	}
}

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

public class Main {
  public static void main( String[] args ) {
	  int a,b,x,y,z;
//InputStreamReader isr = new Scanner(System.in);
      Scanner scan = new Scanner(System.in);
/*	  BufferedReader br = new BufferedReader(scan);
try{
	String buf = br.readLine();
	a = Integer.parseInt(buf);
//	System.out.print("b = ");
	buf = br.readLine();
	b = Integer.parseInt(buf);
}catch(Exception e){
    a = 0;
	b = 0;
}
*/
   a = scan.nextInt();
   b = scan.nextInt();
   x = a + b;
   y = a - b;
   z = a * b;
   
int values[] = {x, y, z};
int max      = values[0];
for (int index = 1; index < values.length; index ++) {
	 max = Math.max(max, values[index]);
     }
	  System.out.println ( max );
  }
}


Measured memory_bytes: 22996
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;

int main(){
	int a,b;
	cin >> a >> b;
	if(a > b) swap(a, b);
	for(int i=0; i<b; i++){
		cout << a;
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n;
  scanf("%lld", &n);
  ll dp[n - 1][21], num[n];
  for(i = 0; i < n; ++i) scanf("%lld", &num[i]);
  for(i = 0; i < n - 1; ++i) for(j = 0; j < 21; ++j) dp[i][j] = 0;
  dp[0][num[0]] = 1;
  for(i = 1; i < n - 1; ++i) {
    for(j = 0; j < 21; ++j) {
      if(j + num[i] <= 20) dp[i][j + num[i]] += dp[i - 1][j];
      if(j - num[i] >= 0) dp[i][j - num[i]] += dp[i - 1][j];
    }
  }
  /*for(i = 0; i < n - 1; ++i) {
    for(j = 0; j < 21; ++j) printf("%lld ", dp[i][j]);
    printf("\n");
  }*/
  printf("%lld\n", dp[n - 2][num[n - 1]]);
  return 0;
}


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

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i <= n-1; i++){
		cin >> a[i];
	}
	
	for (int i = 0; i <= n-1; i++){
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		for (int k = 0; k <= n-1; k++){
			cout << a[k];
			if (k < n-1){
				cout << " ";
			}else{
				cout << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int n, a[N];

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	int tmp = 1, r = tmp;
	while (tmp < n && a[tmp + 1] >= tmp + 1)
		++tmp;
	while (a[r + 1] >= tmp) ++r;
	int ans = ((a[tmp] - tmp) & 1) || ((r - tmp) & 1);
	puts(ans ? "First" : "Second");
	return 0;
}


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

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int n = in.nextInt();
        String s = in.nextToken();
        char[] t = s.toCharArray();
        int p = 0;
        for (int i = 0; i < n; i++) {
            if(t[i] == '(') {
                p++;
            } else {
                p--;
            }
            if(p < 0) {
                p++;
                s = "(" + s;
            }
        }
        for (int i = 0; i < p; i++) {
            s += ")";
        }
        System.out.println(s);
    }

}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


Measured memory_bytes: 21460
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);


struct node{
    int index,life,cost;
    node(int index,int life,int cost):index(index),life(life),cost(cost){}
    bool operator<(const node& other)const{
        return cost>other.cost;
    }
};
const int MAX=INT_MAX/10;
const int NONE=-1;

int main(){
    int n,m,l,k,a,h;
    while(scanf("%d %d %d %d %d %d",&n,&m,&l,&k,&a,&h),n){
        vvi dist(n,vi(n,NONE));
		vi reito(n);
		REP(i,l){
			int r;
			scanf("%d",&r);
			reito[r]=1;
		}
		REP(i,n){
			dist[i][i]=0;
		}
        REP(i,k){
            int src,dst,d;
			scanf("%d %d %d",&src,&dst,&d);
            dist[src][dst]=d;
            dist[dst][src]=d;
        }
        
        priority_queue<node> q;
        q.push(node(a,m,0));
        vvi cost(n,vi(m+1,MAX));
        cost[a][m]=0;
        while(!q.empty()){
            node cnode=q.top();q.pop();
            if(cost[cnode.index][cnode.life]<cnode.cost){
                continue;
            }
			REP(charge,(reito[cnode.index]?m-cnode.life+1:1)){
				FOR(i,(!charge?0:cnode.index),(!charge?n:cnode.index+1)){
					if((charge>0&&cnode.index==i)||(charge==0&&i!=cnode.index&&dist[cnode.index][i]!=NONE)){
						int newlife=cnode.life+charge-dist[cnode.index][i];
						if(newlife>=0){
							int newcost=cnode.cost+dist[cnode.index][i]+charge;
							if(cost[i][newlife]>newcost){
								cost[i][newlife]=newcost;
								q.push(node(i,newlife,newcost));
							}
						}
					}
				}
            }
        }
		int ans=MAX;
		FOR(i,0,m+1){
			ans=min(ans,cost[h][i]);
		}
		if(ans==MAX){
			printf("Help!\n");
		}else{
			printf("%d\n",ans);
		}
    }
}

Measured memory_bytes: 1364
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

double distance(const pair<int,int>& A, const pair<int,int>& B){
    auto x = static_cast<double>(A.first-B.first);
    auto y = static_cast<double>(A.second-B.second);
    return sqrt(x*x + y*y);
}

int main()
{
    int N, x, y;
    cin >> N;
    vector< pair<int,int> > townvec;
    vector< int > idxs;
    int idx = 0;
    while(cin>>x>>y){
        townvec.push_back( make_pair(x, y) );
        idxs.push_back(idx);
        ++idx;
    }
    
    double sum = 0;
    int cnt = 0;
    
    do{
        ++cnt;
        for( int ii = 0; ii < N-1; ++ii ){
            x = idxs[ii];
            y = idxs[ii+1];
            auto dist = distance(townvec[x], townvec[y]);
            sum += dist;
        }
    } while( next_permutation( idxs.begin(), idxs.end() ) );
    
    cout << setprecision(30) << sum/cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,h,w;
	cin>>n>>h>>w;
	cout<<(n-h+1)*(n-w+1); 
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, A, B = map(int, input().split())

num = N // (A + B)
blue = num * A
blue += min(A, N - (A + B) * num)
print(blue)



Measured memory_bytes: 6992
p = input()
q = input()

s = list(p)
t = list(q)

s.sort()
t.sort()
answer = True

for i in range(len(s)):
    front = s[i]
    rear = t.pop()
    f = ord(front)
    r = ord(rear)
    if t == []:
        answer = False
        break
    if f == r:
        continue
    elif f < r:
        answer = True
        break
    else:
        answer = False
        break

if answer:
    print('Yes')
else:
    print('No')


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;

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

	int n, s;
	cin >> n;
	s = n*(n+1)/2;
	cout << s;
	
	return 0;
}


Measured memory_bytes: 3640
/**
*   @Author : MeGaCrazy
*   @InitTime : Sun Dec 30 14:56:45 2018
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+7;
long long a[N];
int main(){
#ifndef ONLINE_JUDGE
 //  freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif
    long long n,m;
    scanf("%lld %lld",&n,&m);

    for(int i=0;i<n;i++){
    	scanf("%lld",&a[i]);
    }
    long long ans=0;
    for(int i=0;i+1<n;i++){
    	long long cur=a[i]+a[i+1];
    	if(cur>m){
    	     long long dif=cur-m;
    	     a[i+1]=max(0ll,a[i+1]-dif);
    	     ans+=dif;	
    	}
    }
    printf("%lld",ans);



}

Measured memory_bytes: 1024
/*

*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
//typedef pair <long long, long long> pll;
//typedef pair <int, long long> pil;
//typedef pair <int, string> pis;
//typedef pair <int, char> pic;
//typedef pair <long long, int> pli;
//typedef pair <long long, string> pls;
//typedef pair <long long, char> plc;
//typedef pair <string, int> psi;
//typedef pair <string, long long> psl;
//typedef pair <string, char> psc;
//typedef pair <char, int> pci;
//typedef pair <char, long long> pcl;
//typedef pair <char, string> pcs;

ll a, b;

int main () {
	cin >> a >> b;
	for (ll i = max(a, b);; i += max(a, b)) {
		if (i % a == 0 && i % b == 0) {
			cout << i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
string s,p,t;
//map<string,int>mp;
//vector<int>v;

int main()
{
    ft
    int i,j,n,m,l,r,f=0;
    cin>>s;
    n=s.size();
    p=s;
    reverse(p.begin(),p.end());
    if(s==p)
    {
        f++;
    }
    m=n/2;
    for(i=0;i<m;i++)
    {
        t+=s[i];
    }
    p=t;
    reverse(p.begin(),p.end());
    if(p==t)
    {
        f++;
    }
    t.clear();
    for(i=m+1;i<n;i++)
    {
        t+=s[i];
    }
    p=t;
    reverse(p.begin(),p.end());
    if(p==t)
    {
        f++;
    }
    if(f==3)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int N, W, s[200009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> W;
	int ret = 0;
	for (int i = W / 2 + 1; i < W; i++) {
		for (int j = 2 * i - W + 1, k = 1; j <= N - W + 1 || k == 1; j += i, k++) {
			int l = j, r = j + W - i;
			if (j == 2 * i - W + 1) l = 1;
			s[l]++, s[r]--;
		}
	}
	for (int i = 1; i <= N - W + 1; i++) {
		if (i >= 2) cout << ' ';
		s[i] += s[i - 1];
		cout << s[i] + W / 2 + min(i, W);
	}
	cout << "\n";
	return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 1000100
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
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); }



void solve(void)
{
  string str;cin>>str;
  if(str == "RRR")
  {
    cout<<3<<endl;
  }
  else if(str == "SSS")
  {
    cout<<0<<endl;
  }
  else if((str == "RRS")||(str == "SRR"))
  {
    cout<<2<<endl;
  }
  else
  {
    cout<<1<<endl;
  }
  

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;
typedef vector<int> vec;

const int N = 200;

int n;

int ask(vec a) {
	static char buf[10];
	printf("?");
	for (auto x : a)
		printf(" %d", x);
	putchar('\n');
	fflush(stdout);
	scanf("%s", buf);
	return buf[0] == 'B' ? 0 : 1;
}

vec operator + (vec a, vec b) {
	for (auto x : b)
		a.push_back(x);
	return a;
}
vec V(int l, int r) {
	vec rt;
	for (int i = l; i <= r; i++)
		rt.push_back(i);
	return rt;
}

char ans[N];
char mp[5] = "BR";
int main() {
	scanf("%d", &n);
	int c1 = ask(V(1, n));
	int l = 1, r = n + 1, mid;
	while (l <= r) {
		mid = (l + r) >> 1;
		int cm = ask(V(mid, mid + n - 1));
		if (cm ^ c1) {
			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	r = l + n - 2;
	vec base = V(l, r);
	for (int i = 1; i <= 2 * n; i++) {
		if (i < l || i > r) {
			ans[i] = mp[ask(base + (vec) {i})];
		}
	}
	base = V(1, l - 2) + V(r + 2, 2 * n);
	for (int i = l; i <= r; i++) {
		ans[i] = mp[ask(base + (vec) {i})];
	}
	printf("! %s\n", ans + 1);
	fflush(stdout);
	return 0;
}


Measured memory_bytes: 724
#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> a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
        if (a[i] % 2 == 1) ans++; 
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream> 
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath> 
#include<algorithm>
#define ll long long 
using namespace std;
const int maxn=500010, inf=1e9;
int n;
int a[maxn], mx[maxn], mx2[maxn], pos1[maxn], pos2[maxn];

template<typename T>
inline void read(T &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;
}

inline void update(int x, int delta, int pos)
{
	if(mx[x]<=delta && pos!=pos1[x])
	{
		mx2[x]=mx[x];
		pos2[x]=pos1[x];
		mx[x]=delta;
		pos1[x]=pos;
	}
	else if(mx2[x]<delta && pos!=pos1[x]) mx2[x]=delta, pos2[x]=pos; 
}

int main()
{
	read(n); int N=1<<n;
	for(int i=0;i<N;i++) read(mx[i]), mx2[i]=-inf, pos1[i]=i;
	int ans=-inf;
	for(int i=1;i<N;i++)
	{
		for(int j=0;j<18;j++) 
		if(i & (1<<j)) 
		update(i, mx[i^(1<<j)], pos1[i^(1<<j)]), update(i, mx2[i^(1<<j)], pos2[i^(1<<j)]);
		ans=max(ans, mx[i]+mx2[i]);
//		printf("%d %d %d %d\n", mx[i], pos1[i], mx2[i], pos2[i]);
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;

  if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
} 

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1.0/LINF;

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

class BBiteEating {
public:
    int N, L;

    void solve(std::istream& in, std::ostream& out) {
        in >> N >> L;
        int mini = INF;
        int eaten = -100;
        REP(i, N) {
            if (mini > abs(L + i)) {
                mini = abs(L + i);
                eaten = i;
            }
        }
        int sum = 0;
        REP(i, N) {
            if (i != eaten) sum += L + i;
        }
        OUT(sum);
    }
};


int main() {
    BBiteEating solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
str_len = list(map(int, input().split()))

#print(str_len)

num5 = str_len.count(5)
num7 = str_len.count(7)

#print(num5)
#print(num7)

if num5 == 2 and num7 == 1:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

using Real = double;
using Point = complex<Real>;
const Real Pi = acos(-1), EPS = 1e-9;
inline bool eq(Real a, Real b) { return fabs(a - b) < EPS; }

//scalar
Point operator*(const Point &p, const Real &c)
{
    return Point(c * real(p), c * imag(p));
}

//add
Point operator+(const Point &p, const Point &q)
{
    return Point(real(p) + real(q), imag(p) + imag(q));
}

//equal
bool operator==(const Point &p, const Point &q)
{
    return (real(p) == real(q)) && (imag(p) == imag(q));
}

Real radian_to_degree(Real r)
{
    return (r * 180.0 / Pi);
}

Real degree_to_radian(Real d)
{
    return (d * Pi / 180.0);
}

//rotate
Point rot(Real theta, const Point &p)
{
    return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

//norm
Real norm(Point const &p)
{
    return (real(p) * real(p) + imag(p) * imag(p));
}

//argumant [0, 2 * Pi)
Real arg(Point const &p)
{
    Real a = atan2(imag(p), real(p));
    if (a < 0)
        a = fabs(a) + Pi;
    return a;
}

//input
istream &operator>>(istream &is, Point &p)
{
    Real a, b;
    is >> a >> b;
    p = Point(a, b);
    return is;
}

//output
ostream &operator<<(ostream &os, Point &p)
{
    os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

// a line given two points
struct Line
{
    Point a, b;
    Line() = default;

    Line(Point a, Point b) : a(a), b(b) {}

    // Ax + By = C
    Line(Real A, Real B, Real C)
    {
        if (eq(A, 0))
            a = Point(0, C / B), b = Point(1, C / B);
        else if (eq(B, 0))
            b = Point(C / A, 0), b = Point(C / A, 1);
        else
            a = Point(0, C / B), b = Point(C / A, 0);
    }

    friend istream &operator>>(istream &is, Line &a)
    {
        return is >> a.a >> a.b;
    }

    friend ostream &operator<<(ostream &os, Line &p)
    {
        return os << p.a << " to " << p.b;
    }
};

using Points = vector<Point>;
using Polygon = vector<Point>;
using Lines = vector<Line>;

Real dot(const Point &p, const Point &q)
{
    return (real(p) * real(q) + imag(p) * imag(q));
}

Point projection(const Line &l, const Point &p)
{
    double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}

int main()
{
    Line l;
    cin >> l;
    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        Point X;
        cin >> X;
        Point A = projection(l, X);
        cout << A << endl;
    }
}


Measured memory_bytes: 3296
#include<iostream>
#include<string.h>
#include<queue>
#include<map>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=10000000000000LL;
typedef long long ll;
typedef pair<ll,ll> P;
ll N,M,K=0;
ll T;
ll A,B,C;
ll D[1005];
string str;
map<string,int> m;

int main(){
	cin>>A;
	cout<<48-A<<endl;
	return 0;
}


Measured memory_bytes: 256
def selection(A,N):
    global cnt
    for i in range(0,N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    return A

n = int(input())
a = [int(s) for s in input().split()]
cnt = 0
print(" ".join(map(str,selection(a,n))))
print(cnt)


Measured memory_bytes: 5608
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main{
	Scanner s=new Scanner(System.in);

	void solve(){
		int[]a= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		System.out.println(a[gInt()-1]);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	int gInt(){
		return Integer.parseInt(s.next());
	}
	long gLong(){
		return Long.parseLong(s.next());
	}
	double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,this::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,this::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,this::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(this::gInt).limit(n);
	}
	LongStream LONGS(int n){
		return LongStream.generate(this::gLong).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}

class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return (cur+d==to)||(d<0^cur+d<to);
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}


Measured memory_bytes: 23380
import itertools
n, m, x = list(map(int,input().split()))
c = []
for i in range(n):
    c.append(list(map(int,input().split())))
mn = -1
for bn in itertools.product([0,1], repeat=n):
    money = 0
    skills = [0]*m
    for j in range(n):
        if bn[j] == 1:
            money += c[j][0]
            for k in range(m):
                skills[k] += c[j][k+1]
    if all([y >= x for y in skills]):
        if mn == -1:
            mn = money
        elif money < mn:
            mn = money
print(mn)

Measured memory_bytes: 9100
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, X, Y = MI()
    d = defaultdict(int)

    for i in range(1, N+1):
        for j in range(i+1, N+1):
            a = abs(j - i)
            b = abs(X - i) + 1 + abs(Y - j)
            c = abs(Y - i) + 1 + abs(X - j)
            # print(i, j)
            # print(a, b, c)
            # print()
            d[min(a, b, c)] += 1

    for i in range(1, N):
        if i in d:
            print(d[i])
        else:
            print(0)


if __name__ == '__main__':
    main()


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

using namespace std;



int m;
bool cmpm(int ar1[], int ar2[]){
    for(int i = 0; i < m; i++){
        if(ar1[i] != ar2[i]) return false;
    }
    return true;
}


int main(){
    cin >> m;
    int a, b;
    int ar1[m], ar2[m], ar3[m];
    for(int i = 0; i < m; i++){
        ar1[i] = (i+1);
        cin >> ar2[i];
    }
    int res1 = -1,res2 = -1, temp = 0;
    for(int i = 0; i < m; i++){
        cin >> ar3[i];
    }
    do{
        temp++;
        if(cmpm(ar1, ar2)) res1 = temp;
        if(cmpm(ar1, ar3)) res2 = temp;
    }while(next_permutation(ar1, ar1+m) && (res1 == -1 || res2 == -1));
    cout << abs(res1-res2) << endl;
    return 0;
}

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

int main() {
  int N;
  vector<int> a(9);
  rep(i,9) cin >> a[i];
  cin >> N;
  vector<int> b(N);
    rep(i,N) cin >> b[i];
  rep(in,N){
    rep(i,9){
      if(b[in]==a[i]) a[i] = 101;
    }
  }
    if(a[1]==a[4]&& a[4]==a[7]){
      cout << "Yes";
      return 0;
    }
  if(a[2]==a[5]&& a[5]==a[8]){
      cout << "Yes";
      return 0;
    }
  if(a[0]==a[3]&& a[3]==a[6]){
      cout << "Yes";
      return 0;
    }
  if(a[0]==a[1]&& a[1]==a[2]){
      cout << "Yes";
      return 0;
    }
  if(a[3]==a[4]&& a[4]==a[5]){
      cout << "Yes";
      return 0;
    }
  if(a[6]==a[7]&& a[7]==a[8]){
      cout << "Yes";
      return 0;
    }
  if(a[0]==a[4]&& a[4]==a[8]){
      cout << "Yes";
      return 0;
    }
  if(a[2]==a[4]&& a[4]==a[6]){
      cout << "Yes";
      return 0;
    }
 
  cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n, a;
    cin >> n >> a;

    cout << n * n - a << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


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

int main() {
    int x, a;
    cin >> x >> a;
    if (x >= a) cout << 10;
    else cout << 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python2.7

root_s = raw_input()

'''
for length n, there are n-1 places to put the plus sign
'''

total = 0

n = len(root_s)
for mask in xrange(2**(n-1)):
    new_s = ''
    for i, c in enumerate(root_s):
        new_s += c
        if mask & (1 << i):
            new_s += '+'
    #print new_s
    total += eval(new_s)

print total

Measured memory_bytes: 2568
// Problem : D - Lunlun Number
// Contest : AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

priority_queue<ll,vector<ll>,greater<ll> >q;

int main()
{
	int n;cin>>n;
	rep(i,1,9) q.push(i);
	rep(i,1,n)
	{
		ll t=q.top();
		q.pop();
		if(i==n){
			cout<<t<<endl;
			return 0;
		}
		int k=t%10;
		if(k>0){
			q.push(t*10+k-1);
		}
		q.push(t*10+k);
		if(k<9){
			q.push(t*10+k+1);
		}
	}
	return 0;
}


Measured memory_bytes: 3444
N = int(input())

t_prev, x_prev, y_prev = 0, 0, 0
for _ in range(N):
    t, x, y = [int(x) for x in input().split()]
    l = (t - t_prev) - ((x - x_prev) + (y - y_prev))
    if not (l >= 0 and l % 2 == 0):
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
    int n;
    scanf("%d", &n);
    int prev_a;
    int trend = 0;
    int count = 1;

    scanf("%d", &prev_a);
    for (int i = 1; i < n; i++) {
        int a;
        scanf("%d", &a);
        if (a < prev_a) {
            if (trend == 1) {
                count++;
                trend = 0;
            } else if (trend == 0) {
                trend = -1;
            }
        } else if (a > prev_a) {
            if (trend == -1) {
                count++;
                trend = 0;
            } else if (trend == 0) {
                trend = 1;
            }
        }
        prev_a = a;
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let k: i64 = read();
    let x: i64 = read();
    let mut mini: i64 = x-k+1;
    let mut maxi: i64 = x+k-1;
    if mini < -1000000 {
	mini = -1000000;
    }
    if maxi > 1000000 {
	maxi = 100000;
    }
    for i in mini..maxi{
	print!("{} ",i);
    }
    println!("{}",maxi);
}


Measured memory_bytes: 4352
#include<stdio.h>

int main()
{
	int a, b, c, d, s1, s2;
	
	scanf("%d %d %d %d", &a, &b, &c, &d);

	s1 = a * b;
	s2 = c * d;

	if (s1 < s2) {
		printf("%d\n", s2);
	}
	else {
		printf("%d\n", s1);
	}

	
	
	return 0;

}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int k;
    cin >> k;
    string s;
    cin >> s;

    if(s.size() <= k) cout << s << endl;
    else{
        cout << s.substr(0 ,k) << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}


struct UnionFind{
  Int n;
  vector<Int> r,p;
  UnionFind(){}
  UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);}
  Int find(Int x){
    return (x==p[x]?x:p[x]=find(p[x]));
  }
  bool same(Int x,Int y){
    return find(x)==find(y);
  }
  void unite(Int x,Int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};

//INSERT ABOVE HERE
signed main(){
  Int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(Int i=0;i<h;i++) cin>>s[i];

  UnionFind uf(h*w);
  auto idx=[&](Int i,Int j){return i*w+j;};
  for(Int i=0;i<h;i++){
    for(Int j=0;j<w;j++){
      if(i+1<h){
        if(s[i][j]!=s[i+1][j]) uf.unite(idx(i,j),idx(i+1,j));
      }
      if(j+1<w){
        if(s[i][j]!=s[i][j+1]) uf.unite(idx(i,j),idx(i,j+1));
      }
    }
  }

  vector<Int> cnt(h*w,0);
  for(Int i=0;i<h;i++)
    for(Int j=0;j<w;j++)
      if(s[i][j]=='#') cnt[uf.find(idx(i,j))]++;
  
  Int ans=0;
  for(Int i=0;i<h*w;i++){
    if(uf.find(i)!=i) continue;
    Int x=cnt[i],y=uf.r[i]-x;
    //cout<<x<<" "<<y<<endl;
    ans+=x*y;
  }
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4224
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    h, n = map(int, input().split())
    A = list(map(int, input().split()))

    print("Yes" if h <= sum(A) else "No")


if __name__ == '__main__':
    resolve()


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

int main() {
  int N,i,on,kai;
  cin>>N;
  vector<int> a(N);
  for(i=0;i<N;i++){
    cin>>a.at(i);
  }
  on=0;
  kai=0;
  for(;;){
    on=a.at(on)-1;
    kai++;
    if(on==1){
      break;
    }
    if(kai>=N){
      kai=-1;
      break;
    }
    
  }
  cout<<kai<<endl;
  
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

long i;

bool searchs(long r1[], long t, int min, int max) {
	long mid = (min + max) / 2;

	if (r1[mid] == t) {
		return true;
	}
	else if (max == min) {
		return false;
	}
	else if (r1[mid] < t) {
		return searchs(r1, t, mid + 1, max);
	}
	else
		return searchs(r1, t, min, mid);
}

int main() {
	long q, n;
	cin >> n;
	long r1[100000];
	long t;
	long counts = 0;
	for (i = 0; i < n; ++i) {
		cin >> r1[i];
	}
	
	cin >> q;
	for (int j = 0; j < q; ++j) {
		cin >> t;
		if (searchs(r1, t, 0, i)) {
			counts++;
		}
	}
	cout << counts << endl;
	return 0;
}


Measured memory_bytes: 3868
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d; cin >> a >> b >> c >> d;
    if (a + b > c + d)      cout << "Left" << endl;
    else if (a + b < c + d) cout << "Right" << endl;
    else                    cout << "Balanced" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(N: Int, M: Int, A: IntArray, B: IntArray){
    val jobs = Array(100007){ ArrayDeque<Int>() }
    for (i in 0 until N){ jobs[A[i]].addLast(B[i]) }
    val queue = PriorityQueue<Int>()
    var ans = 0
    for (day in M-1 downTo 0){
        jobs[M - day].forEach{ queue.offer(-it) }
        ans -= queue.poll()?: 0
    }
    println(ans)
    return
}

fun <T : Comparable<T>> List<T?>.upperBound(
        element: T,
        fromIndex: Int = 0,
        toIndex: Int = size
): Int {
    var low = fromIndex
    var high = toIndex
    while (low < high) {
        val mid = (low + high) / 2
        if (element >= this.get(mid)!!) {
            low = mid + 1
        } else {
            high = mid
        }
    }
    return low
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val M = sc.next().toInt()
    val A = IntArray(N)
    val B = IntArray(N)
    for (i in 0 until N) {
        A[i] = sc.next().toInt()
        B[i] = sc.next().toInt()
    }
    solve(N, M, A, B)
}


Measured memory_bytes: 65308
A, B, C, D, E, F = map(int, input().split())

water = set()
sugar = set()

for i in range(0, F+1, 100*A):
    for j in range(0, F+1-A, 100*B):
        water.add(i+j)

for i in range(0, F+1, C):
    for j in range(0, F+1-C, D):
        sugar.add(i+j)

per = -1
for w in water:
    for s in sugar:
        ws = w+s
        # 砂糖水の質量合計はFg以下 and 砂糖が溶け残らない
        if 0 < ws <= F and s <= w*E // 100:
            if s/(ws) > per:
                per = s/(ws)
                ans = ws, s

print(ans[0], ans[1])

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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;

using StrView = string_view;

auto solve(i64 const K, i64 const A, i64 const B) -> void {
  for (i64 i = A; i <= B; ++i) {
    if (i % K == 0) {
      puts("OK");
      return;
    }
  }
  puts("NG");
}

auto main() -> int {
  i64 K;
  scanf("%" SCNd64, &K);
  i64 A;
  scanf("%" SCNd64, &A);
  i64 B;
  scanf("%" SCNd64, &B);
  solve(K, A, B);
  return 0;
}


Measured memory_bytes: 3692