akhauriyash/Code-Regression huggingface dataset:
//0:実行モード
//1:開発モード
//2:最終テストモード
const sys_debugMode : number = 0;

function chk(in_data1 : any, in_data2? : any) : void{
	if (sys_debugMode == 0 || sys_debugMode == 2){
		return;
	}
	else if (in_data2 === undefined){
		console.log(in_data1);
	}
	else{
		console.log(in_data1 + "[" + typeof(in_data2) + "] =", in_data2);
	}
}

function prt(in_data : any) : void{
	console.log(in_data);
}

class ParamManager {

	private a_s_inputLines : string[];
	private n_maxLine : number;
	private n_nowLineCnt : number;

	constructor(){
		this.a_s_inputLines = this.inputLines();
		this.n_maxLine = this.a_s_inputLines.length;
		this.descLines();
		this.n_nowLineCnt = 1;
	}
	inputLines(){
		const fs = require('fs');

		let text;
		if(sys_debugMode == 0){
			text = fs.readFileSync("/dev/stdin", 'utf8');
		}
		else{
			text = fs.readFileSync("input.txt", 'utf8');
		}

		const line:string[] = text.toString().replace(/\r/g, "").split('\n');

		return line;
	}
	descLines(){
		chk("ParamManager.a_s_inputLines", this.a_s_inputLines);
	}
	getNextLine(in_s_type?):any{
		if (this.n_nowLineCnt > this.n_maxLine){
			chk("ParamManager.getNextLine","No Next Line!");
			return;
		}
		const s_returnLine:string = this.a_s_inputLines[this.n_nowLineCnt - 1];

		this.n_nowLineCnt++;
		
		if (in_s_type == "n"){
			return parseInt(s_returnLine);
		}
		else if (in_s_type == "a"){
			return s_returnLine.split(" ");
		}
		else if (in_s_type == "an"){
			const a_s_temp = s_returnLine.split(" ");
			const a_n_temp = a_s_temp.map(function(str){return Number(str)});
			return a_n_temp;
		}
		else{
			return s_returnLine;
		}
	}
}
const paramManager = new ParamManager();
//==================================================
//A - Air Conditioner
//あなたは、室温が  30  度以上のとき、またそのときに限り、冷房の電源を入れます。
//今の室温は  X  度です。冷房の電源を入れますか？
//==================================================
class Param{
	situon:number = null;

	constructor(){
		chk("--------------------------------------------------");
		chk("パラメータ");
		//入力は以下の形式で標準入力から与えられる。
		//X
		//− 40 ≤ X ≤ 40
		//X  は整数である
		this.situon = paramManager.getNextLine("n");
		
		chk(this);
	}
}
const param = new Param();
//==================================================
class Manager{

	constructor(){
		this.main();
	}

	main():void{
		chk("--------------------------------------------------");
		chk("main");

		this.dataInput();


		this.resultOutput();
	}

	dataInput():void{
		chk("--------------------------------------------------");
		chk("dataInput");

	}

	resultOutput():void{
		chk("--------------------------------------------------");
		chk("resultOutput");
		//室温が  30  度以上のとき、またそのときに限り、冷房の電源を入れます。
		if(param.situon >= 30){
			//冷房の電源を入れるならば Yes
			prt("Yes");
		}
		else{
			//入れないならば No を出力せよ。
			prt("No");
		}
	}

}
const manager = new Manager();
//==================================================

Measured memory_bytes: 29664
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;

template<typename T, typename S>
istream& operator >> (istream& is, pair<T, S>& p) {
    is >> p.first >> p.second;
    return is;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& v) {
    for (auto& x : v) {
        is >> x;
    }
    return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& v) {
    for (auto& x : v) {
        os << x << " ";
    }
    os << "\n";
    return os;
}

int dfs(int v, const vector<vector<int>>& e) {
    vector<int> ds;
    for (int u : e[v]) {
        ds.push_back(dfs(u, e));
    }
    sort(ds.rbegin(), ds.rend());
    int max_d = 0;
    for (int i = 1; i <= ds.size(); ++i) {
        max_d = max(max_d, i + ds[i - 1]);
    }
    return max_d;
}

int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<vector<int>> e(n);
    for (int i = 1; i < n; ++i) {
        int x;
        cin >> x;
        --x;
        e[x].push_back(i);
    }
    cout << dfs(0, e);
}


Measured memory_bytes: 19368
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
	string s,t,u;
	int a,b;
	cin>>s>>t>>a>>b>>u;
	if(u==s)
	{
		cout<<a-1<<" "<<b<<endl;
	}
	else
	{
		cout<<a<<" "<<b-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
int h;
int ans;
struct point
{
	int a,b;
}p[100010];
bool cmp(point p1,point p2)
{
	return p1.b>p2.b;
}
int main()
{
	scanf("%d%d",&n,&h);
	int maxx=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&p[i].a,&p[i].b);
		maxx=max(p[i].a,maxx);
	}
	sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(p[i].b<maxx)
		{
			break;
		}
		h-=p[i].b;
		ans++;
		if(h<=0)
		{
			ans=i;
			break;
		}
	}
	if(h>0)
	{
		if(h%maxx==0)
		ans+=h/maxx;
		else
		{
			ans+=h/maxx;
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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


struct Node {
    int key;
    Node *parent,*left,*right;
    };

Node *root,*NIL;

void insert(int key) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = key;
    z->right = NIL;
    z->left = NIL;

    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        }else {
            x = x->right;
        }
    }

    z->parent = y;
    if(y == NIL) {
        root = z;
    }else {
        if(z->key < y->key) {
            y->left = z;
        }else {
            y->right = z;
        }
    }
}

Node *find(Node *u,int key) {
    while(u != NIL && key != u->key) {
        if(key < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}

void preorder(Node *u) {
    if(u == NIL) return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}




int main() {

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

    for(int i = 0;i < N; i++) {
        cin >> s;
        if(s == "find") {
            cin >> k;
            Node *t = find(root,k);
            if(t != NIL) cout << "yes" << endl;
            else cout << "no" << endl;
        }else if(s == "insert") {
            cin >> k;
            insert(k);
        }else {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }

}



Measured memory_bytes: 21948
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Pair[] pair = new Pair[n];
		for (int i = 0; i < n; i++) {
			pair[i] = new Pair(sc.nextInt(), sc.nextInt());
		}
		int time = Integer.MAX_VALUE;
		String s = "Yes";
		Arrays.sort(pair, (x, y) -> y.b - x.b);
		for (int i = 0; i < n; i++) {
			if (time >= pair[i].b) {
				time = pair[i].b - pair[i].a;
			} else {
				time = time - pair[i].a;
			}
			if (time < 0) {
				s = "No";
				break;
			}
		}
		System.out.println(s);
	}
}

class Pair {
	int a, b;

	Pair(int a, int b) {
		this.a = a;
		this.b = b;
	}

}

Measured memory_bytes: 108452
#include <iostream>

using namespace std;

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

using Int=long long;

const int inf = 1e9;

int N;
int h[100010];
int dp[100010];

int abs(int a)
{
	return a > 0 ? a : -a;
}

int main()
{
	cin >> N;
	rep(i, N) cin >> h[i];
	h[N] = h[N+1] = inf;

	rep(i, N) dp[i] = inf;

	dp[0] = 0;
	for (int i = 0; i < N; ++i) {
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
	}

	cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"iomanip"
using namespace std;
typedef long long ll;
ll r[int(1e5+5)];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;cin>>n>>m;
    while(m--)
    {
        int a,b;cin>>a>>b;
        if(a>b)swap(a,b);
        r[a]++;r[b]--;
    }
    for(int i=1;i<=n-1;++i)
    {
        r[i]+=r[i-1];
    }
    for(int i=1;i<n;++i)
    {
        if(r[i]%2!=0)
        {
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
}




Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int N = keyboard.nextInt();
		int K = keyboard.nextInt();
		String S = keyboard.next();
		
		String[] T = S.split("");
		
		if (T[K-1].equals("A")) {
			T[K-1] = "a";
		}
		if (T[K-1].equals("B")) {
			T[K-1] = "b";
		}
		if (T[K-1].equals("C")) {
			T[K-1] = "c";
		}

		for(int j = 0; j < N; j++) {		
			System.out.print(T[j]);
		}
			
		keyboard.close();	
	}
}

Measured memory_bytes: 23892
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


int d, N, M;
int main() {
	while (cin >> d, d)
	{
		cin >> N >> M;
		vector<int> shop(2 * N);
		shop[0] = 0;
		for (int i = 1; i < N; i++) {
			cin >> shop[i];
		}
		for (int i = 0; i < N; i++) {
			shop[N + i] = shop[i] + d;
		}

		sort(shop.begin(), shop.end());
		int ans = 0;
		for (int i = 0; i < M; i++) {
			int k;
			cin >> k;
			auto it1 = lower_bound(shop.begin(), shop.end(), k);
			auto it2 = it1;
			if(it1 != shop.begin()) it2 = it1 - 1;
			ans += min(*it1 - k, k - *it2);
		}

		cout << ans << endl;
	}

	return 0;
}



Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
int n,ans,q;string s;
int main()
{
  cin>>n>>s;
  for(int i=0;i<n;i++)
  {
    if(s[i]=='I')q++,ans=max(ans,q);
    if(s[i]=='D')q--;
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int A, B;
  cin >> A >> B;
  for (int i = 1; i <= 1000; i++) {
    if (int((double)i * 0.08) == A && int((double)i * 0.1) == B) {
      cout << i << endl;
      return;
    }
  }
  cout << -1 << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int X[110];

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i) cin >> X[i];
	int ans=1e9;
	for(int p=1; p<=100; ++p){
		int now=0;
		for(int j=0; j<N; ++j){
			now += (X[j]-p)*(X[j]-p);
		}
		ans=min(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    string s, t; 
    cin >> s >> t;
    int ss = s.size();
    int ts = t.size();
    
    string s1 = s.substr(0, ss);
    string s2 = t.substr(0, ss); 
    //cout << s1 << " " << s2 << "\n";
    
    if (s1 == s2)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    
}

Measured memory_bytes: 3572
#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 num;
  vector<int> rs,ps;
  UnionFind(){}
  UnionFind(int n):num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);}
  int find(int x){
    return (x==ps[x]?x:ps[x]=find(ps[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(rs[x]<rs[y]) swap(x,y);
    rs[x]+=rs[y];
    ps[y]=x;
    num--;
  }
  int size(int x){
    return rs[find(x)];
  }
  int count() const{
    return num;
  }
};


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  vector<int> as(n),bs(n);
  for(int i=0;i<n;i++) cin>>as[i]>>bs[i];
  vector<int> ls(m),rs(m);
  for(int i=0;i<m;i++) cin>>ls[i]>>rs[i];

  vector<int> cs(as);
  sort(cs.begin(),cs.end());
  auto idx=[&](int v){return lower_bound(cs.begin(),cs.end(),v)-cs.begin();};

  vector<int> vs(n+1,0);
  for(int i=0;i<n;i++)
    vs[idx(as[i])]=bs[i];

  vector<int> ss(n+1,vs[0]);
  for(int i=0;i<n;i++) ss[i+1]=vs[i]^vs[i+1];

  UnionFind uf(n+1);
  using P = pair<int, int>;
  vector< vector<P> > G(n+1);
  for(int i=0;i<m;i++){
    int l=idx(ls[i]),r=idx(rs[i]+1);
    if(uf.same(l,r)) continue;
    uf.unite(l,r);
    G[l].emplace_back(r,i);
    G[r].emplace_back(l,i);
  }

  vector<int> cnt(n+1,0);
  for(int i=0;i<=n;i++)
    cnt[uf.find(i)]+=ss[i];

  for(int i=0;i<=n;i++)
    if(cnt[i]&1) drop(-1);

  vector<int> ans;
  for(int r=0;r<=n;r++){
    if(uf.find(r)!=r) continue;
    MFP([&](auto dfs,int v,int p)->int{
          for(auto e:G[v]){
            if(e.first==p) continue;
            if(dfs(e.first,v)){
              ans.emplace_back(e.second);
              ss[v]^=1;
            }
          }
          return ss[v];
        })(r,-1);
    assert(!ss[r]);
  }

  cout<<ans.size()<<endl;
  sort(ans.begin(),ans.end());
  for(int i=0;i<(int)ans.size();i++){
    if(i) cout<<" ";
    cout<<ans[i]+1;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 11644
N = int(input())
B = input().split()

total = 0
for i in range(1, N + 1):
    if i == 1:
        total += int(B[i - 1])
    elif i == N:
        total += int(B[i - 2])
    else:
        total += min(int(B[i - 2]), int(B[i - 1]))
print(total)

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

using namespace std;
int main()
{
    int a,c;
    string b;
    cin>>a;
    cin>>b;
    c = b.size();
    if(c > a){
        b.resize(a);
        cout<<b<<"..."<<endl;
    }
    else{
        cout<<b;
    }

    return 0;
}


Measured memory_bytes: 3620
MOD = 10 ** 9 + 7
n, m = gets.to_s.split.map { |v| v.to_i }
pit = Array.new(n + 1, false)
m.times do
  pit[gets.to_s.to_i] = true
end
dp = Array.new(n + 1, 0)
dp[0] = 1

n.times do |i|
  [1, 2].each do |j|
    next if n < i + j
    next if pit[i + j]
    dp[i + j] += dp[i]
    dp[i + j] %= MOD
  end
end

pp dp[-1]

Measured memory_bytes: 15888
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll m; cin >> m;
    vector <ll> as;
    REP(i, n){
        ll a; cin >> a;
        as.push_back(a);
    }
    sort(as.begin(), as.end());
    ll sum = 0;
    REP(i, n){
        sum+=as[i];
    }
    ll cnt = 0;
    REP(i, n){

        dump(as[i])
        dump(sum/(4*m))
        dump(as[i] >= (sum+4*m-1)/(4*m))
        if (as[i] >= (sum+4*m-1)/(4*m)){
            cnt++;
        }
    }
    if (m <= cnt){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s = input()
abcd = []
op = []
for i in range(2**3):
  tmp = ['-'] * 3
  for j in range(3):
    if i >> j & 1:
      tmp[j] = "+"
  op.append(tmp)
#print(op)
s_ = []
for i in range(4):
  if(i == 3):
    s_.append(s[i])
    break
  s_.append(s[i])
  s_.append(" ")

for i in range(len(op)):
  tmp = s_
  tmp[1::2] = op[i]
  temp = ''.join(tmp)
  ans = eval(temp)
  #print(ans)
  if(ans == 7):
    ss = temp + "=7"
    print(ss)
    break


     

Measured memory_bytes: 38256
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        // Your code here!
        int N = int.Parse(Console.ReadLine());
        int[] num = new int[110];
        int sum = 0;
        for(int i = 0; i < N; i++)
        {
            int x = int.Parse(Console.ReadLine());
            num[x]++;
        }
        
        for(int i = 0; i < num.Length; i++)
        {
            if(num[i] > 0)
            {
                sum++;
            }
        }
        
        Console.WriteLine(sum);
        
    }
}

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

typedef long long ll;

#define rep(x,n) for (int i = x; i < (n); ++i)
#define Fast_IO ios::sync_with_stdio(false) ,cin.tie(0) ,cout.tie(0)

int binarySearch (long long a[], int beg, int end, int item)
{
    int mid;
    if(end >= beg)
    {
        mid = (beg + end)/2;

        if(a[mid] == item)
            return mid+1;
        else if(a[mid] < item)
        {
            if (a[mid+1] == item)
                return mid+2;
            else if (a[mid+1] > item)
                return mid+1;
            return (binarySearch(a,mid+1,end,item));
        }
        else
        {
            if (a[mid-1] <= item)
                return mid;
            return binarySearch(a,beg,mid-1,item);
        }
    }
    return beg;
}

int main()
{
    Fast_IO;
    int n ,m ,k;
    cin >> n >> m >> k;

    int arr1[n] ,arr2[m];
    rep(0 ,n) cin >> arr1[i];
    rep(0 ,m) cin >> arr2[i];

    ll pfx2[m+1]={0};
    pfx2[0] = arr2[0];
    rep(1 ,m) pfx2[i] = pfx2[i-1]+arr2[i];
    pfx2[m] = LONG_LONG_MAX;

    int i=0 ,res=((k < pfx2[0]) ? 0 :binarySearch(pfx2 ,0 ,m ,k));
    while(i<n && k-arr1[i] >= 0)
    {
        int temp = i+1;
        k -= arr1[i++];
        temp += binarySearch(pfx2 ,0 ,m ,k);
        res = max (res , temp);
    }
    cout << res;
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int K;
    cin >> K;

    int N = (int)s.size();
    vector<string> res;
    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= N - i && j <= K; j++) {
            res.push_back(s.substr(i, j));
        }
    }

    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());
    cout << res[K - 1] << endl;
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	long long a, b, x, ans = 0;
	cin >> a >> b >> x;
	long long m = a / x, n = b / x;
	ans = n - m;
	if (a%x == 0) 
		++ans;
	cout << ans << endl;
endapp:
	//system("pause > nul");
	return 0;
}

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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    for (int i = 0; i < n - k; i++) {
        if (a.at(i) < a.at(i + k)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3948
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef pair<int,int> pii;

set<pii> bus_time;

int main(){
  int n,m;
  cin >> n;
  for (int i = 0; i < n; i++){
    int h,m;
    cin >> h >> m;
    bus_time.insert(pii(h,m));
  }
  cin >> m;
  for (int i = 0; i < m; i++){
    int h,m;
    cin >> h >> m;
    bus_time.insert(pii(h,m));
  }
  int count = 0;
  for(pii point:bus_time){
    count++;
    printf("%d:%02d", point.first, point.second);
    if(count != bus_time.size())
      printf(" ");
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 1228
package MyApp;
use utf8;
use 5.016;

print func(map { chomp; $_ } <>);

sub func {
    my @result;
    my ($n1, $n2, $n3) = split / /, shift;
    my $last = $n3;
    for my $i (1 .. 10) {
        $last = $n1 * $last - $n2;
        push @result, $last;
    }

    return join("\n", @result, '');
}

sub func2 {
    my ($n1, $n2) = @_;
    return $n2 if $n1 >= 13;
    return $n2 / 2 if $n1 >= 6;
    return 0;
}

1;
__END__


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main 
{


	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //cities
		int m = sc.nextInt(); //trains
		int q = sc.nextInt(); //queries
		
		int[] ramp = new int[n];
		
		int[][] tr = new int[n][n];
		
		for(int i = 0; i < m; i++)
		{
			int l = sc.nextInt()-1;
			int r = sc.nextInt()-1;
			tr[l][r]++;
			ramp[l]++;
			ramp[r]--;
		}
		
		int[][] dp = new int[n][n];
		int[][] sdp = new int[n][n]; //strict dp: strictly starts at l, ends up to r
		
		for(int l = 0; l < n; l++)
		{
			for(int r = l; r<n;r++)
			{
				if(r>0)sdp[l][r] = sdp[l][r-1];
				sdp[l][r]+=tr[l][r];
//				System.out.println("Adding tr " + l + " " + r + ": " + tr[l][r]);
			}
		}
		for(int r = n-1; r >= 0; r--)
		{
			for(int l = r; l >= 0; l--)
			{
				int cur = 0;
				if(l<n-1) cur+= dp[l+1][r];
				cur+=sdp[l][r];			
				dp[l][r] = cur;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < q; i++)
		{
			int l = sc.nextInt()-1;
			int r = sc.nextInt()-1;
			sb.append(dp[l][r] + "\n");
		}
		System.out.print(sb);
	}

}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int MAX = 50000;
            int sqrtMAX = (int)Math.Sqrt(MAX);

            bool[] isPrime = Enumerable.Repeat(true, MAX + 1).ToArray();
            isPrime[0] = isPrime[1] = false;

            for (int i = 2; i <= sqrtMAX; i++)
            {
                if (!isPrime[i]) continue;

                for (int j = i * i; j <= MAX; j += i)
                {
                    isPrime[j] = false;
                }
            }

            List<int> primes = new List<int>();

            for (int i = 0; i <= MAX; i++)
            {
                if (isPrime[i]) primes.Add(i);
            }

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int len = n / 2, count = 0;

                for (int i = 0; primes[i] <= len; i++)
                {
                    int checknum = n - primes[i];

                    if (isPrime[checknum]) count++;
                }
                sb.AppendLine(count.ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9856
N = int(input())
G = [dict() for i in range(N)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    G[a-1][b-1] = c
    G[b-1][a-1] = c

Q,K = map(int,input().split())

inf = 10**20
import heapq 
# 条件:グラフに負辺がないこと(もちろん負の閉路はない)
# V=ノード数,E=エッジ数とすると、計算量はO((V+E)logV)
# ついでに指定した始点-終点間の最短経路を求められる
def Dijkstra(ad_dict,start): # startから各頂点への最短距離を求める
    distance = [inf for _ in range(N)] # startからの距離
    previous = [inf for _ in range(N)] # previous[i]:頂点iに至る直前に居た頂点の番号．これを持っておけば，goalからstartまで戻れる
    distance[start] = 0
    hq = []
    heapq.heappush(hq, (0, start)) # (startからvへの暫定距離,v)を追加
    while hq:
        temp_dist, prev = heapq.heappop(hq)
        if distance[prev] < temp_dist:
            # startからprevまでの距離がtemp_distより小さいなら，既により最適な経路があるから，この経路は不採用
            continue
        for now, cost in ad_dict[prev].items():
            if (distance[prev] + cost) < distance[now]: # より最適なら更新
                distance[now] = distance[prev] + cost # 最短距離更新
                heapq.heappush(hq, (distance[now], now))
                previous[now] = prev
    return distance, previous # distance:list([int,int,...]), previous:list([int,int,...])

def reconstruct_path(distance, previous, goal): # 最短経路復元
    now = goal
    path = [goal]
    while previous[now] != inf: # now == startのときに停止
        path.append(previous[now])
        now = previous[now]
    return list(path[::-1]) # start -> goalの最短経路

D,_ = Dijkstra(G,K-1)
for i in range(Q):
    x,y = map(int,input().split())
    print(D[x-1]+D[y-1])

Measured memory_bytes: 110752
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N, K;
  cin >> N >> K;
  vector<int> H(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
  }

  vector<ll> dp(N, 1000000000);
  dp[0] = 0;
  for (int i = 1; i < N; ++i) {
    int k = max(0, i - K);
    for (int j = k; j < i; ++j) {
      dp[i] = min(dp[i], abs(H[i] - H[j]) + dp[j]);
    }
  }
  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;
import java.util.Arrays;

public class Main 
{
    
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.nextLine();
        String str = sc.nextLine();
        String Arr[] = str.split(" ");
        long Arr2[] = new long[a];
        long sum = 0;
        
        for(int i = 0; i < a; i++)
        {
            Arr2[i] = Integer.parseInt(Arr[i]);
            sum = sum + Arr2[i];
        }
        
        Arrays.sort(Arr2);
        
        System.out.println(Arr2[0] + " " + Arr2[a-1] + " " + sum);
        
    }
                
}


Measured memory_bytes: 32744
#include <stdio.h>
int A[100000];
int main(void){
    // Your code here!
    int N, K;
    scanf("%d %d",&N,&K);
    
    int pos_one;
    for(int i = 0; i < N ; i++){
        scanf("%d", A+i);
        if(A[i] == 1) pos_one = i;
    }
    
    if (K == N){
        puts("1");
        return 0;
    }
    int count = 0;
    while(K*count-(count-1) < N){
        count++;
    }
    printf("%d\n",count);
    
}


Measured memory_bytes: 512
N = int(input())
ps = list(map(int, input().split()))
diffs = []
for i, p in enumerate(ps):
    index = i + 1
    if index != p:
        diffs.append((index, p))

diffs_size = len(diffs)
if diffs_size == 0:
    print("YES")
elif diffs_size == 2:
    a, b = diffs[0], diffs[1]
    if a[0] == b[1] and a[1] == b[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")


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

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

  if (a + b + c >= 22)
  {
    cout << "bust" << endl;
  }
  else
  {
    cout << "win" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B, C, X, Y, ans=0; cin >> A >> B >> C >> X >> Y;
if(A+B<=2*C){ ans=A*X+B*Y; }
else{
  int m=min(X, Y); ans+=2*m*C; X-=m; Y-=m;
  if(X){ if(A<=2*C){ ans+=A*X; }else{ ans+=2*C*X; } }
  if(Y){ if(B<=2*C){ ans+=B*Y; }else{ ans+=2*C*Y; } }
}
cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
	//??\???
	int N[31] = { 0 };
	int i, j;
	for (i = 1; i < 29; i++) {
		scanf("%d", &j);
		N[j] = 1;
	}
	for (i = 1; i < 31; i++) {
		if (N[i] == 0)
			printf("%d\n", i);
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int n;
double v[101], res;
int main () {
  if (fopen ("test.inp", "r")) {
    freopen ("test.inp", "r", stdin);
  }
  ios_base :: sync_with_stdio (0);
  cin.tie (nullptr);
  cout.tie (nullptr);
  cin >> n;
  for (int i = 1; i <= n; ++ i) {
    cin >> v[i];
  }
  sort (v + 1, v + n + 1);
  res = v[1];
  for (int i = 2; i <= n; ++ i) {
    res += v[i];
    res /= double (2.0);
  }
  cout << setprecision (5) << fixed << res;
}


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

int main(){
	while(1){
		string ss1[200],ss2[200];
		string tt1[200],tt2[200]; 
		s1="";
		s2="";
		cin>>s1;
		if(s1[0]=='.') break;
		cin>>s2;
		int pc1=0,kc1=0,cnt=0;
		for(int i=0;i<s1.size();i++){
			if(s1[i]=='"'){
				cnt++;
				if(cnt==2){
					pc1++; 
					kc1++;
					cnt=0;
				}
				continue;
			}
			if(cnt==1){
				tt1[kc1]+=s1[i];
				continue;
			}
			if(s1[i]==';'){
				pc1++;
				continue; 
			}
			ss1[pc1]+=s1[i];
		}
		int pc2=0,kc2=0;
		for(int i=0;i<s2.size();i++){
			if(s2[i]=='"'){
				cnt++;
				if(cnt==2){
					pc2++; 
					kc2++;
					cnt=0;
				}
				continue;
			}
			if(cnt==1){
				tt2[kc2]+=s2[i];
				continue;
			}
			if(s2[i]==';'){
				pc2++;
				continue; 
			}
			ss2[pc2]+=s2[i];
		}
	//	for(int i=0;i<kc1;i++){
	//		cout<<i<<tt1[i]<<" "<<tt2[i]<<endl;
	//	}
		if(pc1!=pc2||kc1!=kc2){
			cout<<"DIFFERENT"<<endl;
			continue;
		}
		int flg=0;
		for(int i=0;i<=pc1;i++){
			if(ss1[i]!=ss2[i]){
				flg=2; 
			}
		}
		for(int i=0;i<kc1;i++){
			if(tt1[i]!=tt2[i]) flg++;
			if(flg>=2) break;
		} 
		if(flg==0) cout<<"IDENTICAL"<<endl;
		if(flg>=2) cout<<"DIFFERENT"<<endl;
		if(flg==1) cout<<"CLOSE"<<endl;
	}
} 

/*
print"hello";print123
print"hello";print123
read"B1input";solve;output;
read"B2";solve;output;
read"C1";solve;output"C1ans";
read"C2";solve;output"C2ans";
""""""""
"""42"""""
slow"program"
fast"code"
"super"fast"program"
"super"faster"program"
X""
X
I"S""CREAM"
I"CE""CREAM"
11"22"11
1"33"111
.
*/


Measured memory_bytes: 3184
#! /usr/local/bin/python3
# coding: utf-8

from collections import deque

def main():
    n, q = [int(x) for x in input().split()]

    proc = deque()

    for i in range(n):
        name, ptime = input().split()
        proc.appendleft((name, int(ptime)))

    time = 0
    while proc:
        name, ptime = proc.pop()
        time += min(q, ptime)
        ptime -= min(q, ptime)
        if ptime <= 0:
            print(name, time)
        else:
            proc.appendleft((name, ptime))

main()


Measured memory_bytes: 12548
// std input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),*  )) => {
        ( $(read_value!($iter, $t)),*  )
    };
    ($iter:expr, [ $t:tt ; $len:expr  ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main()
{
    input!{
        n: usize,
        ds: [u64; n],
    }
    let mut sum:u64 = 0;
    for i in 0..n {
        for j in i..n {
            if i == j {
                continue;
            }
            sum += ds[i] * ds[j];
        }
    }
    println!("{}", sum);
}

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

ll max(ll a , ll b)
{
  return (a > b) ? a: b;
}
ll min(ll a , ll b)
{
  return (a < b) ? a : b;
}
void memset(int *arr , int n , int value)
{
    for(int i= 0; i<n ; i++)
    {
        arr[i] = value;
    }
}

ll path(string matrix[] , int h , int w , ll **dp)
{
    for(int i= 0; i < w ; i++)
    {
        if(matrix[0][i] != '#')
        {
            dp[0][i] = 1;
        }
        else
        {
            break ;
        }
    }
    for(int i = 0 ; i<h ; i++)
    {
        if(matrix[i][0] != '#')
        {
            dp[i][0] = 1;
        }
        else
        {
            break;
        }
    }
    for(int i= 1 ; i<h ; i++)
    {
        for(int j = 1 ; j<w ; j++)
        {
            if(matrix[i][j] == '#')
            {
                dp[i][j] = 0;
            }
            else
            {
               dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod)%mod ;
            }
        }
    }
    return (dp[h-1][w-1]%mod) ;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll h , w;
    cin>>h>>w;
    string matrix [h] ;
    for(int i= 0 ; i< h ; i++)
    {
        cin>>matrix[i];
    }
    ll **dp = new ll*[h] ;
    for(int i= 0; i<h ; i++)
    {
        dp[i] = new ll[w] ;
        for(int j= 0; j<w ; j++)
        {
            dp[i][j] = 0 ;
        }
    }
    cout<<path(matrix , h , w , dp)<<endl;
    return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
    long long  n,k;
    long long min_num=1000000;
    cin >> n >> k;
    n = n%k;
    min_num = n;
    
    cout << min(abs(n-k),min_num) <<endl;
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n;
	cin>>n;

	vector<lli> a(n);
	REP(i,0,n)cin>>a[i];

	lli now = 0;
	for(lli i=0;i<n;i++){
		if(i%2) now -= a[i]*2;
		else now += a[i]*2;
	}
	vector<lli> ans(n);
	ans[0] = now/2;
	for(lli i=1;i<n;i++){
		ans[i] = 2*a[i-1] - ans[i-1];
	}
	REP(i,0,n){
		cout<<ans[i]<<" ";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define EPSILON numeric_limits<double>::epsilon()
int main(){
   double x,y,x1,y1;
   cin >> x >> y >> x1 >> y1;
   double xa = x,ya=y;
   x = x/2.0;
   y = y/2.0;
   if(abs(x1-x) < EPSILON && abs(y1-y) < EPSILON)
        cout<<fixed<<setprecision(9)<< xa*ya/2.0 << " "<<1 ;
   else
   {
          cout <<fixed<<setprecision(9)<<xa*ya/2.0 << " " <<0;
   }

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            var count = 0;
            var maxCnt = 0;

            for (int i = 0; i < N; i++)
            {
                var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

                if(line[0] == line[1])
                {
                    count++;
                    maxCnt = Math.Max(count, maxCnt);
                }
                else
                {
                    count = 0;
                }
            }

            if (maxCnt >= 3)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 28260
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Text.Printf
import Data.Ord

main :: IO ()
main = readLine >>= main'
    where
        main' [n, m] = replicateM m readLine >>= printRes . solve 
        printRes = mapM_ (\[x, y] -> printf "%06d%06d\n" x y)

solve :: [[Int]] -> [[Int]]
solve = map snd . sortBy (comparing fst) . makeIDs 1 . sortBy cmpf . zip [0..]
    where
        cmpf lhs rhs = comparing (head . snd) lhs rhs  `mappend` comparing (last . snd) lhs rhs

        makeIDs np xxs@(_ : _) = innerMIDs 1 xxs
            where
                innerMIDs m (x@(n, [p, _]) : xs)
                    | np == p = (n, [p, m]) : innerMIDs (m + 1) xs
                    | otherwise = makeIDs (np + 1) $ x : xs
                innerMIDs _ _ = []
        makeIDs _ _ = []


readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 73212
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<int,pair<int,int>>;
#define MAX 200003
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int n,q;
  cin>>n>>q;
  int k=sqrt(n);
  int s=(n+k-1)/k;
  vector<int> a(n,(1ll<<31)-1);
  vector<int> b(s,(1ll<<31)-1);

  vector<int> ans;
  for(int i=0;i<q;i++){
    int c;
    cin>>c;
    if(c==0){
      int x,y;
      cin>>x>>y;
      a.at(x)=y;
      int m=(1ll<<31)-1;
      for(int j=(x/k)*k;j<min((x/k+1)*k,n);j++){
        m=min(m,a.at(j));
      }
      b.at(x/k)=m;
    }else{
      int x,y;
      cin>>x>>y;
      y++;
      int m=(1ll<<31)-1;
      while(x<y&&x%k>0){
        m=min(m,a.at(x));
        x++;
      }
      while(x<y&&y%k>0){
        y--;
        m=min(m,a.at(y));
      }
      while(x<y){
        m=min(m,b.at(x/k));
        x+=k;
      }
      ans.push_back(m);
    }
  }

  for(int i=0;i<ans.size();i++){
    cout<<ans.at(i)<<endl;
  }
}



Measured memory_bytes: 3604
#include <stdio.h>


int main()
{

int a, b, x, xtoa,xtob;

scanf("%d %d %d",&x, &a, &b);


		xtoa=x-a;
		if(xtoa<0){
			xtoa=xtoa*-1;
		}
		xtob=x-b;
		if(xtob<0){
			xtob=xtob*-1;
		}

	if(xtoa>xtob)
	{
		printf("B");
	}
	else if(xtoa<xtob) {
	
		printf("A");
	}

return 0;
}



Measured memory_bytes: 1640
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n,da[202][3];
std::cin>>n;
rep(i,n)rep(j,3)std::cin>>da[i][j];
rep(i,n){
int ans=0;
rep(j,3){
int t=0;
rep(k,n)if(da[i][j]==da[k][j])t++;
if(t==1)ans+=da[i][j];}
std::cout<<ans<<std::endl;}}


Measured memory_bytes: 1160
"use strict";

function main(arg) {
    const S = arg.split("\n")[0].split("/");
    let answer;
    
    if(parseInt(S[0]) < 2019) {
        answer = "TBD";
    } else if (parseInt(S[0]) == 2019 && parseInt(S[1]) > 4) {
        answer = "TBD";
    } else {
        answer = "Heisei";
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
	int n; cin >> n; 
	string s; cin >> s;
	int r = 0, b = 0;
	for( int i = 0; i < n; ++i ){
		if( s[i] == 'R' ){
			++r;
		} else {
			++b;
		}
	}
	if( r > b ){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

namespace Atc_0035
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            int N = int.Parse(s.Split(' ')[0]);

            var Ps = Console.ReadLine().Split(' ').Select(int.Parse).ToList<int>();

            int v = Ps.Sum();

            if (N < v)
            {
                Console.WriteLine("-1");
            }
            else
            {
                Console.WriteLine(N - v);
            }
        }
    }
}


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

int main(){
    int A,B;
    cin >> A >> B;
    A = (A + 11) % 13;
    B = (B + 11) % 13;
    if(A > B) cout << "Alice" << endl;
    else if(A == B) cout << "Draw" << endl;
    else cout << "Bob" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto e : s) os << e; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += b % mod) %= mod; if (a < 0) a += mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int cnt = 0;
  rep(i, n) {
    if (i % 2 == 0 && a[i] % 2) cnt++;
  }
  cout << cnt << endl;
}


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

int main(){
    int a;
    cin >> a;
    int b = 100;
    for (int i=0;i<a;i++){
        b = (int)ceil(b*1.05);
    }
    cout << b*1000 << endl;
//    cout << int(1.999) << int(2.000) << endl;
    return 0;
}



Measured memory_bytes: 2996
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include<iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	string str;
	cin >> str;
	ll a=0,b=0,ans=0;
	
	REP(i,str.size())
	{
		if(str[i] == 'p')
		{
			if(b > a)
			{
				a++;
			}
			else
			{
				b++;ans--;
			}
		}
		else
		{
			if(b > a)
			{
				a++;
				ans++;
			}
			else
			{
				b++;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> t(n + 1), x(n + 1), y(n + 1);
  int i;
  int buf1, buf2;
  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  for(i = 1; i <= n; i++){
    cin >> t.at(i);
    cin >> x.at(i);
    cin >> y.at(i);
  }
  bool judge = true;
  for(i = 0; i < n && judge; i++){
    buf1 = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    buf2 = t[i + 1] - t[i];
    if(buf1 > buf2 || (buf2 - buf1) % 2 == 1)
      judge = false;
  }
    
  if(judge) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if((a[0]==a[1] && a[0]!=a[2] )|| (a[1]==a[2] && a[0]!=a[1])){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
//	cout<<a[0]<<a[1]<<a[2];
	return 0;}

Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
import sys

for i in range(N):
  if a[i]==0:
    print (0)
    sys.exit()
    
p=1
for i in range(N):
  p=p*a[i]
  if p>10**18:
    print (-1)
    sys.exit()

if p>10**18:
  print (-1)
else:
  print(p)

Measured memory_bytes: 21716
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>
#include<map>
#include<vector>
using namespace std;

typedef long long ll;
typedef long double ld;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)

#define get_arsize(a) (sizeof(a)/sizeof(a[0]))
const ll mod = 1000000007;
const double eps = 1e-10;
const int MAX = 200000;

int main() {
	int r,g,b;
	cin >> r >> g >> b;
  string a="YES";
  if ((r*100+g*10+b)%4) a = "NO";
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 32524