akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		final int n = Integer.parseInt(sc.next());
		final int m = Integer.parseInt(sc.next());
		if((n*m)%2 != 0){
			out.print("Yes");
		}else {
			out.print("No");
		}
		out.flush();
	}
}


Measured memory_bytes: 22740
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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 main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll A,B; cin>>A>>B;
  ll ans=0;
  ll T=1;
  rep(i,48){
    T*=2;
    ll B_flag=(B+1)/T*T/2+((B+1)%T>T/2?(B+1)%T-T/2:0);
    ll A_flag;
    if(A==0) A_flag=0;
    else A_flag=A/T*T/2+(A%T>T/2?A%T-T/2:0);
    //cout<<(B_flag-A_flag)%2<<endl;
    if((B_flag-A_flag)%2==1) ans^=(1LL<<i);
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

  int n;
  cin >> n;

  int rsl = 0;

  if(n / 9 >= 1) rsl += 9;
  else {
      rsl += n;
      cout << rsl << endl;
      return 0;
  }

  if(n / 999 >= 1) rsl += 999 - 100 + 1;
  else {
      rsl += max(0, n - 100 + 1);
      cout << rsl << endl;
      return 0;
  }

  if(n / 99999 >= 1) rsl += 99999 - 10000 + 1;
  else {
      rsl += max(0, n - 10000 + 1);
      cout << rsl << endl;
      return 0;
  }

  cout << rsl << endl;

}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
#include <stdlib.h>

using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define m_t make_tuple
#define rep(i,n)  for(int i=0; i<(int) (n); i++)


const double pai = 3.1415926535897;
const int mod = 1000000007;
const int INF = 1000000021;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];


int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}
//x未満の要素数を返す二分探索関数
int b_s(vector<int>& vec, int xx) {
	return lower_bound(all(vec), xx) - vec.begin();
}
template<typename T>
void vecout(vector<T>& vec) { for (T t : vec) cout << t << " "; cout << endl; }
template<typename TT>
void vecin(vector<TT>& vec) {
	for (int i = 0; i < vec.size(); i++) {
		cin >> vec[i];
	}
}


// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
//n個を1個以上のx組のグループに分ける重複組み合わせはcom(n-1,x-1)
//グループが0個でもいいときはnにxを足す
// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	if (xx <= 1) {
		return 0;
	}
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int t = 0;
	string s;
	cin >> s;
	for (int tmp = 0; tmp < (1 << (s.size() - 1)); tmp++) {
		bitset<10>s2(tmp);
		int n = 0;
		rep(i, s.size()) {
			n *= 10;
			n += s[i] - '0';
			if (s2[i] == 1) {
				t += n;
				n = 0;
			}
		}
		t += n;
	}
	cout << t << endl;
}


Measured memory_bytes: 3584
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <set>
#include <cmath>
#include <algorithm>
#include <locale>

#define int long long
#define pb(n) push_back(n)
#define For(n,i) for(int (i)=0;(i)<(n);(i)++)
//#define ForJ(n) for(int j=0;j<n;j++)
//#define ForK(n) for(int k=0;k<n;k++)
#define Pr(n) cout<<n<<endl;
#define INS(v,n) for(int i=0;i<n;i++){cin >>v.at(i);}//vector 代入
#define ELM 100001 //問題によっては1000000001に変更
using namespace std;

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



Measured memory_bytes: 256
// ABC 156-D
// 2020.2.23 bal4u

#include <stdio.h>

typedef long long ll;

#define M 1000000007

int pow_mod(int b, int p)
{
   int r = 1;
   while (p) {
      if (p & 1) r = (ll)r * b % M;
      b = (ll)b * b % M;
	  p >>= 1;
   }
   return r;
}

#define MOD 1000000007
#define MAX 200005
int fact[MAX] = {1,1};
int inv[MAX] = {1,1};
int invfact[MAX] = {1,1};

int comb(int n, int k) {
	int ans = invfact[k];
	while (k--) ans = (ll)ans * (n-k) % M;
	return ans;
}
int main()
{
	int i, n, a, b;
	ll ans;

	scanf("%d%d%d", &n, &a, &b);
	for (i = 2; i <= b; i++) {
		fact[i] = (ll)fact[i-1]*i % M;
		inv[i] = -(M/i)*(ll)inv[M%i] % M;
		invfact[i] = (ll)invfact[i-1]*inv[i] % M;
	}
	ans = pow_mod(2, n) - 1;
	ans -= comb(n, a);
	ans -= comb(n, b);
	ans %= M;
	if (ans < 0) ans += M;
	printf("%d\n", (int)ans); 
	return 0;
}


Measured memory_bytes: 2560
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var a, b, c float64
	fmt.Scan(&a, &b, &c)
	s := []float64{a, b, c}
	sort.Float64s(s)
	fmt.Println(math.Abs(s[0]-s[1]) + math.Abs(s[1]-s[2]))
}


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

int n,num,a[100010];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>num;
        a[num]=i;
    }
    for(int i=1;i<=n;++i){
        if(i!=n)
            cout<<a[i]<<" ";
        else
            cout<<a[i]<<"\n";
    }
    return 0;
}

Measured memory_bytes: 1280
using System;

class ITP1_8_B{
    static void Main(string[] args){
        while(true){
            int a = 0;
            string str = Console.ReadLine().Trim();
            char[] ch = str.ToCharArray();
            if(ch[0] == 48) break;
            foreach(char s in str){
                a += (int)s -48;
            }
            Console.WriteLine(a);
        }
    }
}


Measured memory_bytes: 15888
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main(){
    int N;
    cin >> N;
    long long a[N];
    map<long long,long long> bucket,used;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        bucket[a[i]]++;
    }
    long long ans = 0;
    for(int i =0; i < N; i++){
        if(used[a[i]]) continue;
        if(a[i] <= bucket[a[i]]){
            ans += bucket[a[i]] - a[i];
        }
        else ans += bucket[a[i]];
        used[a[i]] = 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 13056
n, m, xc, yc = [int(_) for _ in input().split(' ')]
x = [int(_) for _ in input().split(' ')]
y = [int(_) for _ in input().split(' ')]
x.append(xc)
y.append(yc)

if xc >= yc or max(x) >= min(y):
    print('War')
else:
    print('No War')


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

int main() {
    // input
    int n; cin >> n;
    vector<ll> a(n);
    REP (i, n) cin >> a[i];
    vector<ll> b(n);
    REP (i, n) cin >> b[i];

    // solve
    ll cnt = 0;
    REP (i, n) {
        if (a[i] > b[i]) {
            ll k = a[i] - b[i];
            b[i] += k;
            cnt += k;
        }
    }
    REP (i, n) {
        if (a[i] < b[i]) {
            ll k = (b[i] - a[i]) / 2;
            a[i] += 2 * k;
            cnt -= k;
            if (a[i] < b[i]) {
                a[i] += 2;
                b[i] += 1;
            }
        }
    }
    bool answer = (cnt <= 0);

    // output
    cout << (answer ? "Yes" : "No") << endl;
    return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<long long> a(n);
    long long ans = 0;
    map<long long, long long> M;
    for(int i = 0;i < n;i++){
        cin>>a[i];
        ans += a[i];
        M[a[i]]++;
    }

    int q;
    cin>>q;
    long long x,y;
    while(q--){
        cin>>x>>y;
        ans += M[x]*y - M[x]*x;
        M[y] += M[x];
        M[x] = 0;

        cout<<ans<<endl;
    }
}

Measured memory_bytes: 10120
#include <iostream>

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

using namespace std;

typedef string::const_iterator Cursol;

int P, Q, R;
int op1[3] = {2, 1, 0};
int op2[3][3] = {{0, 0, 0}, {0, 1, 1}, {0, 1, 2}};
int op3[3][3] = {{0, 1, 2}, {1, 1, 2}, {2, 2, 2}};

int expr(Cursol &c) {
	int res = 0;
	if(*c == 'P') {
		res = P;
	} else if(*c == 'Q') {
		res = Q;
	} else if(*c == 'R') {
		res = R;
	} else if(isdigit(*c)) {
		res = *c - '0';
	} else if(*c == '-') {
		return op1[expr(++c)];
	} else if(*c == '(') {
		res = expr(++c);
		if(*c == '*') {
			res = op2[res][expr(++c)];
		} else if(*c == '+') {
			res = op3[res][expr(++c)];
		}
	}
	c++;
	return res;
}

int main() {
	string s;
	Cursol c;
	while(cin >> s) {
		if(s == ".") break;
		int ans = 0;
		for(P = 0; P < 3; P++) {
			for(Q = 0; Q < 3; Q++) {
				for(R = 0; R < 3; R++) {
					c = s.begin();
					if(expr(c) == 2) ans++;
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

// 最大公約数
ll gcd(ll m, ll n) {
  if (n==0) return abs(m);
  else return gcd(n, m%n);
}

// 最小公倍数
ll lcm(ll m, ll n) {
  return abs(m)/gcd(m, n)*abs(n);
}

int main() {
  ll N, M;
  string S, T;
  cin >> N >> M >> S >> T;
  ll L = lcm(N, M);
  bool can = true;
  for (ll k=0; k<gcd(N, M); k++) {
    can = true;
    ll a = k*(N/gcd(N, M)), b = k*(M/gcd(N, M));
    if (S[a]!=T[b]) {
      can = false;
      break;
    }
  }
  if (can) cout << L << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define br cout << endl ;
#define all(x) (x).begin() ,(x).end()
#define rall(x) (x).rbegin() ,(x).rend()
#define pb push_back
const int MOD = 1000* 1000 * 1000 + 7;
const int MAXN = 1000*1000 + 10 ; 
using namespace std;

int main() {
	int t = 1 ;
	// cin >> t ;
	while(t--){
	int  x ,  y , z ;
	cin >> x >> y >> z ;
	cout << z <<" "<< x<<" "<< y ;
	

	}

	


return 0 ; 
}		



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int t = 0;
    for (int i = 0; i < k; i++) {
        t += a[i];
    }
    cout << t << endl;
}


Measured memory_bytes: 3600
/*
* @Author: 王文宇
* @Date:   2018-03-11 20:02:07
* @Last Modified by:   王文宇
* @Last Modified time: 2018-03-11 20:07:06
*/
#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=a;i<=b;i++)
int a[100007];
bool check(int x)   
{  
  if (x < 0) return false;  
  int div = 1;  
  while (x / div >= 10) {  
    div *= 10;  
  }  
  while (x != 0) {  
    int l = x / div;    
    int r = x % 10;  
    if (l != r) return false;  
    x = (x % div) / 10;  
    div /= 100;  
  }  
  return true;  
}  
int n,m;
int main(int argc, char const *argv[])
{
	cin>>n>>m;
	int ans = 0;
	_for(i,n,m)if(check(i))ans++;
	cout<<ans<<endl;
	return 0;
}

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

// long long 用の pow (MAX ll 9,223,372,036,854,775,807 -> 19桁)
ll myLongLongPow(ll base, ll times) {
    ll acc = 1;
    rep(i, times) acc *= base;
    return acc;
}

// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i, N) cin >> S.at(i);

    vector<int> C(4, 0);

    rep(i, N) {
        if ("AC" == S.at(i)) {
            C.at(0)++;
        } else if ("WA" == S.at(i)) {
            C.at(1)++;
        } else if ("TLE" == S.at(i)) {
            C.at(2)++;
        } else if ("RE" == S.at(i)) {
            C.at(3)++;
        }
    }

    cout << "AC"
         << " x " << C.at(0) << endl;
    cout << "WA"
         << " x " << C.at(1) << endl;
    cout << "TLE"
         << " x " << C.at(2) << endl;
    cout << "RE"
         << " x " << C.at(3) << endl;

    return 0;
}


Measured memory_bytes: 6420
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

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

int main() {
    int N; cin >> N;
    int d[N]; REP(0, i, N) cin >> d[i];

    sort(d, d + N);

    // cout << d[N / 2 - 1] << endl;
    // cout << d[N / 2] << endl;

    cout << d[N / 2] - d[N / 2 - 1] << endl;
    return 0;
}


Measured memory_bytes: 640
from math import floor, ceil


def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    average = sum(a) / n
    answer = [0, 0]
    for i in range(n):
        answer[0] += (a[i] - floor(average)) ** 2
        answer[1] += (a[i] - ceil(average)) ** 2
    print(min(answer))


if __name__ == '__main__':
    main()



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

int main() {
	int n, k;char d[10];
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> d[i];
	}
	string s;
	bool flag = false;
	while (1) {
		s = to_string(n);
		for (int i = 0; i < s.length(); i++) {
			for (int j = 0; j < k; j++) {
				if (s[i] == d[j]) {
					flag = true;
					break;
				}
			}
			if (flag == true) {
				break;
			}
		}
		if (flag == false) {
			cout << n << endl;
			return 0;
		}
		flag = false;
		n++;
	}
}

Measured memory_bytes: 256
def bellman_ford(n, graph, start=0, last=n-1)
  r = [-1.0/0] * n
  r[start] = 0

  g = lambda{|t, &block|
    t.times{|i|
      graph.each{|from, to, cost|
        if r[from] != -1.0/0 && r[to] < r[from] + cost
          r[to] = r[from] + cost
          block.(to) if block
        end
      }
    }
  }
  g.(n-1)
  neg = [false] * n
  g.(n){|to| neg[to] = true}

  [r[last], neg[last]]
end

N, M = gets.split.take(2).map(&:to_i)
Graph = M.times.map{
  a,b,c= gets.split.take(3).map(&:to_i)
  # from, to, score(cost)
  [a-1, b-1, c]
}

score, closep = bellman_ford(N, Graph, 0, N-1)
puts closep ? :inf : score


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

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	std::vector<std::pair<int, int>> wars(M);
	for (auto& e: wars)
	{
		scanf("%d%d", &e.second, &e.first);
		e.first--;
		e.second--;
	}
	wars.push_back({1 << 30, 0});
	std::sort(wars.begin(), wars.end());
	int num{}, undone{}, last{};
	for (int i{1}; i < N; i++)
	{
		if (wars[undone].first != i) continue;
		while (wars[undone].first == i) undone++;
		if (last <= wars[undone - 1].second)
		{
			num++;
			last = i;
		}
	}
	if (undone != M) num++;
	printf("%d\n", num);

	return 0;
}

Measured memory_bytes: 1792
N = int(input())
field = [input() for _ in range(N)]

from collections import deque
# 木構造を作る
G = [[] for i in range(N)]
for i in range(N):
    for j in range(N):
        if field[i][j] == "1":
            if j not in G[i]:
                G[i].append(j)
            if i not in G[j]:
                G[j].append(i)

ans = 0
# 木をBFSをする
for i in range(N):
    category = [-1] * N
    category[i] = 0
    q = deque([i])
    while len(q) > 0:
        a = q.popleft()
        Vs = G[a]
        c = category[a]
        # print(c)
        for u in Vs: # 頂点以外の要素がグラフにあるときはここ
            if category[u] == -1:
                q.append(u)
                category[u] = c+1
            elif category[u] == c:
                print(-1)
                exit()
    ans = max(ans, len(set(category)))
print(ans)


Measured memory_bytes: 42680
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll n,m,at = 1;
  cin >> n;
  while( n >= at)
  {
    at = at*2;
  }
  at = at/2;
  cout << 2*at-1;
  return 0;
}


Measured memory_bytes: 256
s = gets.chomp.split('').map(&:to_i)
k = gets.chomp.to_i
Inf = 10**19
ss = s.map { |e| [e, e == 1 ? 1 : Inf] }
sum = 0
ss.each do |d|
  sum += d.last
  if sum >= k
    puts d.first
    exit 0
  end
end


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		double a = scn.nextDouble();
		double b = scn.nextDouble();
		double e = scn.nextDouble();
		double C = Math.sin(Math.toRadians(e));
		double S = a * b * C / 2;
		double d = (a * a) + (b * b) - (2 * a * b * Math.cos(Math.toRadians(e)));
		double L = a + b + Math.sqrt(d);
		double h = b * C;
		System.out.println(S + " " + L + " " + h);
	}
}


Measured memory_bytes: 28124
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

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

func main() {
	n := nextLine()
	ss := strings.Split(n, "")
	cache := ss[0]

	for index := 1; index < 4; index++ {
		if cache == ss[index] {
			fmt.Println("Bad")
			return
		}
		cache = ss[index]
	}
	fmt.Println("Good")
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
  val n = readLine()?.toInt()?:0
  val one = n % 10
  if ((one == 2) || (one == 4) || (one == 5) || (one == 7) || (one == 9)) {
    println("hon")
  } else if ((one ==0) || (one == 1) || (one == 6) || (one == 8)) {
    println("pon")
  } else {
    println("bon")
  }
}

Measured memory_bytes: 34376
n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

mod = 10**9+7
dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * (2*10**5+10)

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]
        dp[i] %= mod

print(dp[-1])


Measured memory_bytes: 92752
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
	vector <string> v;
	stringstream ss(s); string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
	cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
	err(++it, args...);
}

int ini() {int x; scanf("%d", &x); return x;}
long long inl() { long long x; scanf("%lld", &x); return x;}
double ind() {double x; scanf("%lf", &x); return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

int a[N];
std::vector<int> adj[N];

queue<int>q;
int vis[N], dis[N], ans[N];
void bfs(int s, int v) {
	for (int i = 0; i <= v; i++)vis[i] = 0, dis[i] = 0;
	q.push(s);
	vis[s] = 1;
	dis[s] = 0;

	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (int i = 0; i < adj[u].size(); i++) {
			if (!vis[adj[u][i]]) {
				int v = adj[u][i];
				vis[v] = 1;
				dis[v] = dis[u] + 1;
				ans[dis[v]]++;
				q.push(v);
			}
		}

	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1, te = 0;
	//  cin>>t;
	while (t--) {
		int n, x, y;

		cin >> n >> x >> y;

		for (int i = 1; i < n; ++i) {
			adj[i].push_back(i + 1);
			adj[i+1].push_back(i);
		}

		adj[x].push_back(y);
		adj[y].push_back(x);

		for (int i = 1; i <= n; ++i) {
			bfs(i, n);
			
			
		}

		for (int j = 1; j < n; ++j) {
				printf("%d\n", ans[j]/2);
		}
	

	



		//printf("Case %d: ",++te);
	}
	return 0;
}




Measured memory_bytes: 31104
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
int main() {
  int D,N;
  cin >> D >> N;
  int k = 1;
  for (int i=1; i<=D; i++) {
    k *= 100;
  }
  int ans = N*k;
  if (N == 100) {
    ans = ans + k;
  }
  cout << ans << endl;
}

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

int n,a[100009];
int gcd(int x,int y){ return y?gcd(y,x%y):x; }
bool solve(){
	if (n==1) return a[1]!=1;
	int i,x;
	if (n&1){
		for (i=1,x=0; i<=n; i++) x^=a[i];
		if (!(x&1)) return 1;
		for (i=1,x=0; i<=n; i++)if (a[i]&1) x++;
		if (x>1) return 0;
		for (i=1,x=0; i<=n; i++){
			if (a[i]&1)	a[i]--;
			if (!a[i]) return 0; x=gcd(x,a[i]);
		}
		for (i=1; i<=n; i++) a[i]/=x;
		return !solve();
		
	} else{
		for (i=1,x=0; i<=n; i++) x^=a[i];
		return x&1;
	}
}
int main(){
	scanf("%d",&n);
	int i;
	for (i=1; i<=n; i++) scanf("%d",&a[i]);
	puts(solve()?"First":"Second");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

constexpr unsigned int D = 365;
constexpr unsigned int type = 26;
constexpr int INF = (1 << 30);
constexpr int X = 500;

using Data = pair<int, pair<array<int, type>, vector<int>>>;

array<int, type> c;
array<array<int, type>, D> s;

void input () {
	int buff;
	cin >> buff;
	for (int &i : c) cin >> i;
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < type; j++) {
			cin >> s[i][j];
		}
	}
}

vector<pair<int, int>> calc (int day, const array<int, type> &last) {
	array<int, type + 1> l, r; l[0] = r[type] = 0;
	vector<pair<int, int>> score;
	for (int i = 0; i < type; i++) l[i + 1] = l[i] + c[i] * (day - last[i]);
	for (int i = type; i > 0; i--) r[i - 1] = r[i] + c[i - 1] * (day - last[i - 1]);
	for (int i = 0; i < type; i++) {
		int val = s[day - 1][i] - (l[i] + r[i + 1]);
		score.emplace_back(val, i);
	}
	auto comp = [&](const pair<int, int> &r, const pair<int, int> &l) {
		if (r.first == l.first) {
			if (day == D) return r.second < l.second;
			return (s[day][r.second] > s[day][l.second]);
		}
		return (r.first > l.first);
	};
	sort(score.begin(), score.end(), comp);
	return score;
}


int main() {
	input();
	vector<Data> dat;
	{
		array<int, type> a;
		vector<int> b(0);
		fill(a.begin(), a.end(), 0);
		dat.emplace_back(0, pair(a, b));
	}
	
	auto comp = [](const Data &lhs, const Data &rhs) {
		return (lhs.first > rhs.first);
	};

	for (int day = 0; day < D; day++) {
		vector<Data> buff;
		for (size_t i = 0; i < dat.size(); i++) {
			vector<pair<int, int>> cd = calc(day + 1, dat[i].second.first);
			for (auto [v, id] : cd) {
				int val = dat[i].first + v;
				array<int, type> nxt;
				vector<int> con;
				tie(nxt, con) = dat[i].second;
				nxt[id] = day + 1;
				con.push_back(id);
				buff.emplace_back(val, pair(nxt, con));
			}
		}
		sort(buff.begin(), buff.end(), comp);
		buff.resize(X);
		dat.swap(buff);
	}

	for (int a : dat[0].second.second) cout << a+1 << '\n';
	
	return 0;
}


Measured memory_bytes: 31008
# 次のダメパターンがあればImpossibleそれ以外はPossible
#  .#    ##
#  ## or #.

h, w = map(int, input().split())

table = []
for _ in range(h):
    a = input()
    temp = []
    for c in a:
        temp.append(c == '#')
    table.append(temp)

def check():
    for s in table:
        if True in s:
            return False
    return True
    
def solve(y, x):
    if table[y][x] == False:
        return False
    table[y][x] = False
    ret = False
    if y == h - 1 and x == w - 1:
        ret = check()
    else:
        if y < h - 1:
            ret = ret or solve(y + 1, x)
        if x < w - 1:
            ret = ret or solve(y, x + 1)
    table[y][x] = True
    return ret

ans = 'Possible' if solve(0, 0) else 'Impossible'

print(ans)

Measured memory_bytes: 3064
N = int(input())
arr = [[0, 0, 0]] * N

for i in range(N):
    arr[i] = input().split()
    arr[i][1] = int(arr[i][1])
    arr[i].append(i + 1)

ans = sorted(arr, key = lambda a: (a[0], -1 * a[1]))

for i in range(N):
    print(ans[i][2])

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v;
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 24484
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      k: usize,
   }

   let mut ans = 1;
   let mut x = 7 % k;
   for _ in 0..k + 1 {
      if x == 0 {
         println!("{}", ans);
         return;
      }
      x *= 10;
      x += 7;
      x %= k;
      ans += 1;
   }
   println!("-1");
}


Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a));

    combination c(n+5);

    mint ans = 0;
    rep(ri,2) {
        rep(i,n) {
            mint now = c(i,k-1);
            if (ri == 1) now = -now;
            ans += now*a[i];
        }
        reverse(ALL(a));
    }
    cout << ans.x << endl;
    
    return 0;
}

Measured memory_bytes: 2176
# -*- coding: utf-8 -*-

# 入力
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

cnt = 0
for i in range(0, H):
    for j in range(0, W):
        if i == 0 and j == 0 or i == 0 and j == W-1 or \
            i == H-1 and j == 0 or i == H-1 and j == W-1:
            continue
        if S[i][j] == "#":
            if i == 0:
                if S[i][j+1] != "#" and S[i][j-1] != "#" and S[i+1][j] != "#":
                    cnt += 1
            elif i == H-1:
                if S[i][j+1] != "#" and S[i][j-1] != "#" and S[i-1][j] != "#":
                    cnt += 1
            elif j == 0:
                if S[i][j+1] != "#" and S[i+1][j] != "#" and S[i-1][j] != "#":
                    cnt += 1
            elif j == W-1:
                if S[i][j-1] != "#" and S[i+1][j] != "#" and S[i-1][j] != "#":
                    cnt += 1
            else:
                if S[i][j+1] != "#" and S[i][j-1] != "#" \
                    and S[i+1][j] != "#" and S[i-1][j] != "#":
                    cnt += 1
if cnt == 0:
    print("Yes")
else:
    print("No")

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

const int NUM = 100;

int main(){
    int W[NUM],H[NUM],n=0;
    for(int i=0;i<NUM;++i){
        cin >> H[i] >> W[i];
        
        if(H[i] == 0 && W[i] == 0){
            n=i;
            break;
        }
    }
    
    for(int l=0;l<n;++l){
        for(int h=0;h<H[l];++h){
            for(int w=0;w<W[l];++w){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3116
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
signed main(){
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    int buf=a[0];
    rep1(i,n-1){
        buf=gcd(buf,a[i]);
    }
    cout<<buf<<endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1e18 + 10;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int w, a, b; cin >> w >> a >> b;
    if(a>b)swap(a,b);
    cout << max(0, b-(a+w)) << ln;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  
  ll n,t; cin>>n>>t;
  ll l=0,r=0;
  for(i=0;i<n;i++){
    cin>>buf;
    if(buf>=r){
      l=buf;
      r=buf+t;
      res+=t;
    }
    else{
      res+=t-(r-buf);
      l=buf;
      r=buf+t;
    }

  }
  cout<<res<<endl;


  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 1e5 + 5;
int n;
lli ans = 0;

struct data
{
    int a, b;
} dish[maxn];

void ReadInput()
{
    cin >> n;
    for(int i = 1; i <= n; ++i)
    {
        cin >> dish[i].a >> dish[i].b;
        ans += -1LL * dish[i].b;
    }
}

bool cmp(const data&p, const data&q)
{
    return p.a + p.b > q.a + q.b;
}

void Solve()
{
    sort(dish + 1, dish + n + 1, cmp);
    for(int i = 1; i <= n; i += 2)
        ans += (lli)dish[i].a + dish[i].b;
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int cnt_rect, cnt_rhom;
	
	cnt_rect = 0;
	cnt_rhom = 0;
	
	while (scanf("%d,%d,%d", &a, &b, &c) != EOF){
		if (a * a + b * b == c * c){
			cnt_rect++;
		}
		
		if (a == b){
			cnt_rhom++;
		}
	}
	
	printf("%d\n", cnt_rect);
	printf("%d\n", cnt_rhom);
	
	return (0);
}

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

int main()
{
	int n;
	string p, q;
	cin >> n;
	for (int i = 0; i < n; i++) {
		char p_in;
		cin >> p_in;
		p += p_in;
	}
	for (int i = 0; i < n; i++) {
		char q_in;
		cin >> q_in;
		q += q_in;
	}

	int cnt = 0;
	int p_cnt = 0;
	int q_cnt = 0;
	vector<int> v(n);
	iota(v.begin(), v.end(), 1);
	do {
		string str = "";
		for (int v_ele : v) {
			str += to_string(v_ele);
		}
		cnt++;
		if (str == p) {
			p_cnt = cnt;
		}
		if (str == q) {
			q_cnt = cnt;
		}
	}while (next_permutation(v.begin(), v.end()));

	int ans = abs(p_cnt - q_cnt);

	cout << ans << endl;
}


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

int main(){
  int N;
  
  cin >> N;
  
  if(N == 1) cout << "Hello World" << endl;
  if(N == 2){
    int A, B;
    cin >> A >> B;
    cout << A + B << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
int main() {
 //fastio
ll n,d;
cin>>n;
int arr[n];
ll sum=0;
for(int i=0;i<n;i++)
    {cin>>arr[i];
    if(i%2==0)
    arr[i]=2*arr[i];
    else arr[i]=-1*2*arr[i];
    sum+=arr[i];}

    sum=sum/2;
    ll b=sum;
    cout<<sum<<" ";
    for(int i=0;i<n-1;i++)
    {
        sum=abs(arr[i])-sum;
        cout<<sum<<" ";
    }




}



Measured memory_bytes: 1664
n = int(input())
a = list(map(int, input().split()))

def test(total, res):
    for i in a[1:]:
        hugou = total > 0
        total += i
        if hugou:
            if total>=0:
                res += abs(total)+1
                total = -1
        else:
            if total<=0:
                res += abs(total)+1
                total = 1
    return res

    
res = 0
total = a[0]
if a[0]<=0:
    total = 1
    res += abs(a[0])+1
res1 = test(total, res)

res = 0
total = a[0]
if a[0]>=0:
    total = -1
    res += abs(a[0])+1
res2 = test(total, res)

print(min(res1, res2))

Measured memory_bytes: 14648
#include <iostream>
using namespace std;
double maxvolume(double s)
{
    double length = s / 3;

    s -= length;
    double breadth = s / 2;
   	double height = s - breadth;

    return length * breadth * height;
}
int main()
{
  double l;
  cin>>l;
  double v = maxvolume(l);
  cout<<fixed<<v<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void p(int x)
{
    int i,j;
    for(i=2;i<=1000000;i++)
    {
        if(x==1){printf("\n"); return;}
        while(x%i==0)
        {
            printf(" %d",i);
            x=x/i;
        }
    }
    printf(" %d\n",x);
}
int main()
{
    int x;
    scanf("%d",&x);
    printf("%d:",x);
    p(x);
    return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
typedef long long lint;
using namespace std;
const int N=1e5+5;
int n,q,val[N];

namespace utils{
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	n=nxi(),q=nxi();
	for(int i=1; i<=n; ++i) val[i]=nxi();
	int ans=1e9;
	for(int i=1; i<=n-q+1; ++i){
		int l=val[i],r=val[i+q-1];
		if((l>0)!=(r>0)){
			apn(ans,r-l*2);
			apn(ans,r*2-l);
		}else{
			apn(ans,r<0?-l:r);
		}
	}
	printf("%d\n",ans);
	return 0;
}


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

struct Node{
  int num;

  vector<int> edge_to;
  vector<int> edge_cost;
  vector<int> edge_time;

  bool done;
  int cost;
  int time;
};

int main(){
  for(;;){
    int n,m,a,b,c,t,p,q,r;
    cin>>n>>m;
    if(n==0&&m==0)break;
    vector<Node> node;

    Node no;

    for(int i=1;i<=m;i++){
      no.num=i;
      no.done=false;
      no.cost=-1;
      no.time=-1;
      node.push_back(no);
    }


    while(n--){
      cin>>a>>b>>c>>t;
      node[a-1].edge_to.push_back(b);
      node[b-1].edge_to.push_back(a);
      node[a-1].edge_cost.push_back(c);
      node[b-1].edge_cost.push_back(c);
      node[a-1].edge_time.push_back(t);
      node[b-1].edge_time.push_back(t);
    }

    cin>>n;
    while(n--){
      cin>>p>>q>>r;

      vector<Node> n(node.size());
      copy(node.begin(),node.end(),n.begin());
      p--;
      q--;

      if(r){

	n[p].time = 0;
	while(1){

	  int d=-1;

	  for(int i=0;i<n.size();++i){
	    if( n[i].done || n[i].time < 0) {
	      continue;
	    } else if(d == -1 || n[i].time < n[d].time) {
	      d=i;
	    }
	  }

	  if ( d == -1 )
	    break;

	  n[d].done = true;

	  for(int i=0;i<n[d].edge_to.size();++i) {
	    int ttime = n[d].time + n[d].edge_time[i];
	    if(n[n[d].edge_to[i]-1].time < 0 || ttime < n[n[d].edge_to[i]-1].time){
	      n[n[d].edge_to[i]-1].time = ttime;
	    }
	  }

	}
	cout<<n[q].time<<endl;

      }else{

	n[p].cost = 0;
	while(1){

	  int d=-1;

	  for(int i=0;i<n.size();++i){
	    if( n[i].done || n[i].cost < 0) {
	      continue;
	    } else if(d == -1 || n[i].cost < n[d].cost ) {
	      d=i;
	    }
	  }

	  if ( d == -1 )
	    break;

	  n[d].done = true;

	  for(int i=0;i<n[d].edge_to.size();++i) {
	    int tcost= n[d].cost + n[d].edge_cost[i];
	    if(n[n[d].edge_to[i]-1].cost < 0 || tcost < n[n[d].edge_to[i]-1].cost){
	      n[n[d].edge_to[i]-1].cost = tcost;
	    }
	  }

	}
	cout<<n[q].cost<<endl;

      }

    }
  }
}

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

using namespace std;
int main()
{
	int n,l;
	
	cin >> n >>l;
	vector<string> a(n);

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

	sort(a.begin(), a.end());

	string length;

	for (int i = 0; i < n; ++i) {
		length += a.at(i);
	}

	cout << length << endl;
	return 0;
}

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(){
  string S;
  cin >> S;
  
  int flag = 0;
  rep(i, S.size()-1){
    if(S.at(i) != S.at(i+1)){
      flag = 1;
    }
  }
  
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int main(){
    int ans=0;
    string S;

    cin>>S;
    for(int i=0;i<4;i++){
        if( S[i] == '+'){
            ans++;
        }else{
            ans--;
        }

    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
char* F(char *b,int n,FILE *f){char *r=fgets(b,n,f);if(!r)return NULL;b[strlen(b)-1]=0;return r;}
char Q[29999],*q[9],L[29999];
n,old_indent=-1,depth=0;
main(){F(Q,sizeof(Q),stdin);q[0]=strtok(Q+1,".");for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;for(;;){
	int indent=0;
	if(!F(L,sizeof(L),stdin))puts("no such property"),exit(0);
	for(;L[indent]==' ';indent++);
	if(old_indent>=indent)puts("no such property"),exit(0);
	char *name=strtok(L+indent,":"),*value=name+strlen(name)+1;
	if(!strcmp(name,q[depth])){
		if(old_indent=indent,depth++,depth==n)
			if(*value)printf("string \"%s\"\n",value+1),exit(0);
			else puts("object"),exit(0);
	}
}}

Measured memory_bytes: 588
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int n = s.length();
    int[] leastnums = new int[n + 1];
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) == '<') {
        leastnums[i + 1] = leastnums[i] + 1;
      }
    }
    for (int j = 0; j < n; j++) {
      if (s.charAt(n - 1 - j) == '>' && leastnums[n - 1 - j] <= leastnums[n - j]) {
        leastnums[n - 1 - j] = leastnums[n - j] + 1;
      }
    }
    long count = 0;
    for (int i : leastnums) {
      count += i;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 44332
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define plll pair<pll,ll>
#define ppll pair<pll, pll>
#define pii pair<int, int> 
#define piii pair<pii, int>
#define ppii pair<pii,pii>
#define pb push_back
const ll llinf = 2e18 + 7;
const int inf = 2e9 + 7;
const ll mod = 1e9 + 7;
const ll N = 1e6 + 7;
const ld pi = 3.14159265358979;
void solve() {
    int n;
    cin>>n;
    vector<ll> arr(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr.begin(),arr.end());
    ll sum = arr.back();
    for(int i=n-2,j=n-2;i>0;i-=2,j--) {
        sum+=arr[j];
        if(i>1) {
            sum += arr[j];
        }
    }
    cout<<sum;
} 
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    t = 1;
    // seive();
    // cin>>t;
    while(t--) {
        solve();
        cout<<"\n";
    }
    return 0; 

}


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

int main(){
  int a=0;
  string s,t,u;
  cin >> s >> t;
  for(int i=0;i<200;i++){
   for(int j=0;j<s.size()-1;j++){
      u += s.at(j+1);
   }
      u += s.at(0);
    if(u==t){
      a = 1;
   }
    s = u;
    u.clear();
  }
  if(a == 1){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256