akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Event
{
	int t, s, d;
	Event( int t, int s, int d ) : t( t ), s( s ), d( d )
	{
		return;
	}

	bool operator < ( const Event &a ) const
	{
		return t < a.t;
	}
};

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

	for ( int n, m; cin >> n >> m, n | m; )
	{
		vector<Event> events;

		REP( i, 0, m )
		{
			int t, s, d;
			cin >> t >> s >> d;
			events.PB( Event( t, s - 1, d - 1 ) );
		}
		sort( ALL( events ) );

		VI infected( n );
		infected[0] = 1;
		FOR( e, events )
		{
			infected[ e.d ] |= infected[ e.s ];
		}

		cout << count( ALL( infected ), 1 ) << endl;
	}

	return 0;
}

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

int main(){
  int n, k, s;
  cin >> n >> k >> s;
  if(s < INF) {
    rep(i,k) cout << s << " ";
    for(int i = k; i < n; i++) cout << INF << " ";
    cout << endl;
  } else {
    rep(i,k) cout << INF << " ";
    for(int i = k; i < n; i++) cout << 1 << " ";
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
def comb(x,y):
  s = 1
  for i in range(y):
    s = s*(x-i)//(i+1)
  return s

n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse = 1)

m = v[a-1]
l = -1
while v[l+1] > m:
  l += 1
r = a-1
while r+1 <= n-1 and v[r+1] == m:
  r += 1
#print(l,r)
print(sum(v[:a])/a)
ans = 0
if l == -1:
  for k in range(a,b+1):
    ans += comb(r-l,(k-1-l))
else:
  ans += comb(r-l,(a-1-l))
print(ans)
#print(comb(1,1))

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int t;
    cin >> t;

    while (t--) {
        int n; cin >> n;
        vector<ll> a(n); REP(i, n) cin >> a[i];
        string s; cin >> s;

        int ans = 0;
        vector<ll> dp;
        // 最終的な結果から逆算して行って，
        // 現在の要素が最終的な結果を0にすることが可能な要素かどうかを確認していく
        for (int i = n; i--;) {
            // 後ろから見て行った要素が
            // 最終的な結果を0にできる要素群に含まれるかを確認する．
            // 排他的論理和が0なら含まれているし，
            // 0以外なら含まれていないことになる．
            for (ll j : dp) a[i] = min(a[i], a[i]^j);
            if (a[i]) {
                // 排他的論理和は同じものを掛けると消せるので
                // 最終的には0の状態にしたいので，
                // s[i]が0の時の要素が，最終的な結果を0の状態にできる要素になる．
                if (s[i] == '0') dp.push_back(a[i]);
                else ans = 1;
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define show(x) cout << #x << " = " << x << endl;
vector<int>g[100005];
int cnt = 0;
bool used[100005];
void dfs(int s){
    rep(i,g[s].size()){
        int k = g[s][i];
        if(used[k] == false){
            used[k] = true;
            cnt++;
            dfs(k);
        }
    }
}
int main(){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    cnt = 1;
    used[0] = used[1] = true;
    dfs(0);
    int v1 = cnt;
    cnt = 1;
    dfs(1);
    int v2 = cnt;
    int nokori = n-v1-v2;
    ll ans = 0;
    rep(i,nokori+1){
        ll k = v1 + i;
        ll kk = n-k;
        ans = max(ans,k*(k-1)/2 + kk*(kk-1)/2);
    }
    cout <<(ll)( ans - m) << endl;
}

Measured memory_bytes: 10496
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
using namespace std;

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin,(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

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


int main(){
  int H,W,h,w;
  cin >> H >> W >> h >> w;
  cout << (H-h) * (W-w) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb          push_back
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,i,j,k,l,sum=0,flag=0,t,dp[200005],ans=0,a[200005];
void solve(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    dp[1]=0;
    for(int i=2;i<=n;i++){
    	dp[i] = hell;
    	for(int j=1;j<=k;j++){
    		if(i-j==0)
    			break;
    		dp[i] = min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
    	}
    }
    cout<<dp[n]<<endl;
}
signed main()
{
    ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>

int main()
{
	char w[11];
	scanf("%s",w);
	int n;
	scanf("%d",&n);
	int all = 0;
	int l = strlen(w);
	for(int i = 0; i < n; i++)
	{
		char s[20];
		scanf("%s",s);
		for(int i = 0; i < 10; i++)
		{
			s[i + 10] = s[i];
		}
		for(int ii = 0; ii < 10; ii++)
		{
			bool t = true;
			for(int j = 0; j < l; j++)
			{
				if(s[ii + j] != w[j])
				{
					t = false;
					break;
				}
			}
			if(t)
			{
				all++;
				break;
			}
		}
	}
	printf("%d\n",all);
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main() {
    int n;
    cin>>n;
    vector<ll> v(n);
    ll s=0;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        s+=v[i];
        s = s%mod;
    }
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        s = (s%mod - v[i] + mod)%mod;
        ans = (ans+((s%mod)*v[i])%mod)%mod;
    }
    cout<<ans;
}


Measured memory_bytes: 4760
import java.util.Scanner;

class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		while(sc.hasNext()){

			int a = sc.nextInt();
			int b = sc.nextInt();
			int sum = a+b;

			if(sum<10){
				System.out.println("1");
			}

			if(sum < 100 && sum > 9){
				System.out.println("2");
			}

			if(sum < 1000 && sum > 99){
				System.out.println("3");
			}

			if(sum < 10000 && sum > 999){
				System.out.println("4");
			}

			if(sum < 100000 && sum > 9999){
				System.out.println("5");
			}

			if(sum < 1000000 && sum > 99999){
				System.out.println("6");
			}
			if(sum < 10000000 && sum > 999999){
				System.out.println("7");

			}
		}
	}
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

bool dp[10100];
void func(long long N, std::vector<long long> s){
    dp[0]=true;

    REP(i,0,N){
        for(lli j=10099;j>=0;j--){
            if(!dp[j])continue;
            dp[j+s[i]]=true;
        }
    }

    lli ans = 0;
    REP(i,0,10100){
        if(i%10==0)continue;
        if(dp[i])ans = max(ans,(lli)i);
    }
    cout<<ans<<endl;
}

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

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


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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector <int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  arr[0]--;
  for (int i = 1; i < n; i++) {
    if (arr[i] == arr[i - 1]) continue;
    arr[i]--;
  }
  for (int i = 0; i + 1 < n; i++) {
    if (arr[i] > arr[i + 1]) {
      cout << "No\n";
      return (0);
    }
  }
  cout << "Yes\n";
  return (0);
}


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

typedef long long int ll;
ll n, k, s;

int main() {
    cin >> n >> k >> s;
    for(ll i = 0; i < k; ++i) cout << s << ' ';
    if(s == 1000000000) s = 0;
    for(ll i = k; i < n; ++i) cout << s + 1 << ' ';

    return 0; 
}


Measured memory_bytes: 3592
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	string s1,s2,s3;
    cin>>s1>>s2;
    if(s1.size()>s2.size()) cout<<"GREATER"<<endl;
    else if(s1.size()<s2.size()) cout<<"LESS"<<endl;
    else if(s1>s2) cout<<"GREATER"<<endl;
    else if(s1<s2) cout<<"LESS"<<endl;
    else cout<<"EQUAL"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#include <numeric>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};

int N;
int A, B;

vector<int> graph[101010];
int X[101010];
int low[101010], hi[101010];
int dep[101010];

void dfs(int p, int rt, int d) {
  dep[p] = d;
  for (int q : graph[p]) if (q != rt) {
    dfs(q, p, d + 1);
    low[p] = max(low[p], low[q] - 1);
    hi[p] = min(hi[p], hi[q] + 1);
  }
}

void dfs2(int p, int rt) {
  for (int q : graph[p]) if (q != rt) {
    low[q] = max(low[q], low[p] - 1);
    hi[q] = min(hi[q], hi[p] + 1);
    dfs2(q, p);
  }
}

signed main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> N;
  REP(i,N-1) {
    cin >> A >> B;
    A--; B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  REP(i,N) {
    X[i] = -INF;
    low[i] = -INF;
    hi[i] = INF;
  }
  int K;
  cin >> K;
  while (K--) {
    int v, p;
    cin >> v >> p;
    v--;
    X[v] = low[v] = hi[v] = p;
  }

  dfs(0, -1, 0);
  dfs2(0, -1);

  int par = -1;
  REP(i,N) {
    if (X[i] != -INF) {
      int myp = (X[i] ^ dep[i]) & 1;
      if (par == -1) par = myp;
      if (par != myp) {
        puts("No");
        return 0;
      }
    }
    if (low[i] > hi[i]) {
      puts("No");
      return 0;
    }
  }

  puts("Yes");
  // REP(i,N) cout << low[i] << endl;
  REP(i,N) printf("%lld\n", low[i]);
}

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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair<int, int> pii;

#define F(i, l, r) for(int i = (l); i < (r); i++)
#define E(i, l, r) for(int i = (l); i <= (r); i++)
#define DF(i, l, r) for(int i = (l); i >= (r); i--)
#define I(x, a) for(auto x : (a))
#define mp make_pair
#define X first
#define Y second
#define clean(x) memset((x), 0, sizeof(x))
#define ret return
#define cont continue
#define brk break
#define ins insert
#define all(x) (x).begin(),(x).end()
#define sync ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define y1 fjfg

const int maxn = 1e6 + 6;
const int mod = 1000000007;

int n;
ll le[maxn];
ll fac[maxn];

ll inv(ll a){
	ll res = 1;
	ll pw = mod - 2;
	while(pw){
		if(pw&1)res = res * a % mod;
		a = a * a % mod;
		pw >>= 1;
	}
	ret res;
}

ll C(ll A, ll B){
	if(B > A)return 0;
	ll q = fac[B] * fac[A - B] % mod;
	return fac[A] * inv(q) % mod;
}

ll f(int len, int ones){
	if(len < ones)return 0;
	if(len == 0)return 1;
	if(ones == 0)return 1;
	if(len == 1)return 1;
	//ret (f(len - 2, ones - 1) + f(len - 1, ones))%mod;
	ret C(len - (ones - 1), ones);
}

int main(){
	sync;
	fac[0] = 1;
	F(i, 1, maxn)fac[i] = fac[i - 1] * i % mod;
	cin >> n;
	if(n == 2){cout << 1; return 0;}
	le[0] = 0;
	//ll ans = fac[n - 1] * 1ll * (n) % mod;
	ll ans = 0;
	F(i, 1, n){
		le[i] = fac[n - 1 - i] * fac[i] % mod;
		le[i] *= f(n - 3, n - 1 - i);
		le[i] %= mod;
		ans += i * 1ll * (le[i] - le[i - 1]) % mod;
	}
	//F(i, 1, n){
//		ans -= le[i];
//		ans %= mod;
//	}
/*	F(ones, 0, 20){
		F(len, 0, 20)
			cout << f(len, ones) << ' ';
		cout << endl;
	}
*/
	ans = (ans%mod + mod)%mod;
	cout << ans;
}


Measured memory_bytes: 15872
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#define ll long long

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> V(N,0),C(N,0);
    for(int i=0;i<N;i++){
        cin >> V[i];
    }
    for(int i=0;i<N;i++){
        cin >> C[i];
    }
    vector<int> sa(N,0);
    for(int i=0;i<N;i++){
        sa[i]=V[i]-C[i];
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(sa[i]>0){
            ans+=sa[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():
    N, X = map(int, input().split())
    a = [0]*N
    p = [0]*N
    a[0] = 1
    p[0] = 1
    for i in range(1, N):
        a[i] = a[i-1]*2+3
        p[i] = p[i-1]*2+1

    def rec(N, X):
        if X == 1 and N == 0:
            return 1
        elif X == 1 and N != 0:
            return 0
        elif 2 <= X <= 1+a[N-1]:
            return rec(N-1, X-1)
        elif X == 2+a[N-1]:
            return p[N-1]+1
        elif 3+a[N-1] <= X <= 2+a[N-1]*2:
            return p[N-1]+rec(N-1, X-a[N-1]-2)+1
        else:
            return p[N-1]*2+1
    print(rec(N, X))


resolve()

Measured memory_bytes: 38256
#include<stdio.h>
#include<bits/locale_facets.h>
#include<algorithm>
using namespace std;
int a[100001];
long long input();
int main()
{
	int n=input(),total=0;
	for(int i=1;i<=n;i++)a[i]=input();
	sort(a+1,a+n+1);
	if(a[n]-a[1]>1||a[n]>=n)printf("No");
	else if(a[n]==a[1])
	{
		if(a[n]*2>n&&a[n]<n-1)printf("No");
		else printf("Yes");
	}
	else
	{
		for(int i=1;i<=n&&a[i]<a[n];i++)total++;
		if(0<a[n]-total&&2*a[n]<=n+total)printf("Yes");
		else printf("No");
	}
	return 0;
}
long long input()
{
	long long value=0,positive=1;
	char digit=getchar();
	for(;!isdigit(digit);digit=getchar())
	if(digit=='-')positive=-positive;
	for(;isdigit(digit);digit=getchar())value=(value<<3)+(value<<1)+digit-'0';
	return positive*value;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
string s,t ;
int main(){
  cin >> s >> t;
  cout << t+s << endl; 
}


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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

int n, q;
string s;
vector<pair<char,char>> v;

bool okl(int k) {
  if (k == 0) return 1;
  k--;

  REP(i,q) {
    if (s[k] == v[i].fi) {
      if (v[i].se == 'L') {
        k--;
        if (k < 0) return 1;
      } else {
        k++;
        if (k >= n) return 0;
      }
    }
  }

  return 0;
}

bool okr(int k) {
  if (k == 0) return 1;
  k = n - k;

  REP(i,q) {
    if (s[k] == v[i].fi) {
      if (v[i].se == 'L') {
        k--;
        if (k < 0) return 0;
      } else {
        k++;
        if (k >= n) return 1;
      }
    }
  }

  return 0;
}


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

  cin >> n >> q >> s;
  REP(i,q) {
    char c,d;
    cin >> c >> d;
    v.pb({c,d});
  }

  int l1 = 0, r1 = n;
  while (l1 < r1) {
    int mid = (l1+r1+1)/2;
    if (okl(mid)) {
      l1 = mid;
    } else {
      r1 = mid - 1;
    }
  }
  int l2 = 0, r2 = n;
  while (l2 < r2) {
    int mid = (l2+r2+1)/2;
    if (okr(mid)) {
      l2 = mid;
    } else {
      r2 = mid - 1;
    }
  }

  cout << min(n, n - l1 - l2) << endl;
  return 0;
}


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

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long H = input[0];
		long W = input[1];
		long ans = H * W;
		if ((H * W) % 3 == 0) { ans = 0; }
        else
		{
            for(var i = 1; i < H; i++)
			{
				long s1 = i * W;
				long s2 = Math.Min((H - i) * ((W + 1) / 2), W * (H - i + 1) / 2);
				long s3 = H * W - s1 - s2;
				long dif = Math.Max(s1, Math.Max(s2, s3)) - Math.Min(s1, Math.Min(s2, s3));
				if (dif < ans) { ans = dif; }
			}
			for (var i = 1; i < W; i++)
			{
				long s1 = i * H;
				long s2 = Math.Min((W - i) * ((H + 1) / 2), H * (W - i + 1) / 2);
				long s3 = H * W - s1 - s2;
				long dif = Math.Max(s1, Math.Max(s2, s3)) - Math.Min(s1, Math.Min(s2, s3));
				if (dif < ans) { ans = dif; }
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13396
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    

    N,M = LMIIS()
    A = LMIIS()
    if N - sum(A) < 0:
        print(-1)
    else:
        print(N-sum(A))
if __name__ == '__main__':
    main()

Measured memory_bytes: 68264
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int k,i;
    char s[105];
    scanf("%d",&k);
    scanf("%s",s);
    if(k<strlen(s)){
        for(i=0;i<k;i++){
            printf("%c",s[i]);
        }
        printf("...\n");
    }
    else printf("%s\n",s);
    return 0;
}


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

typedef long long int ll;
using namespace std;
int main(){
	int W,H,x,y,chec=0;
	cin >>W>>H>>x>>y;
	
	if(W==2*x&&H==2*y){
		chec=1;
	}
	printf("%.9lf", (double)W*H/2);
	cout<<" "<<chec<<endl;
	return 0;
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;


int main(){
int N;
cin >> N ;
vector<int> d(N);
for(int i = 0; i < N; i++){
    cin >> d[i];
}
set<int> s(d.begin(), d.end());
cout << s.size() << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c, d; cin >> a >> b >> c >> d;
	if (a != c)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
import  java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int k = cin.nextInt();
        int n = cin.nextInt();
        int[] a = new int[n+1];
        int[] d = new int[n+1];
        a[1] = cin.nextInt();
        for(int i = 2; i <= n; i++){
        	a[i] = cin.nextInt();
        	d[i-1] = a[i]-a[i-1];
        }
        d[n] = k-a[n]+a[1];
        int ans = 0, maxn = 0;
        for(int i = 1; i <= n; i++){
        	if(maxn < d[i]) maxn = d[i];
        	ans += d[i];
        }
        ans = ans - maxn;
        System.out.println(ans);
    }
}

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

int primes[1000];
int primescnt;

int isprime(int n){
  int flg=0;
  if (sqrt(n)>=primes[primescnt-1]){
    for (int i=primes[primescnt-1];i<=sqrt(n);i++){
      flg=0;
      for (int j=0;j<primescnt;j++){
	if (i%primes[j]==0){flg=1;break;}
      }
      if (!flg) {
	primes[primescnt]=i;
	primescnt++;
      }
    }
  }
  flg=0;
  for (int j=0;j<primescnt;j++){
    if (primes[j]>sqrt(n))break;
    if (n%primes[j]==0){flg=1;break;}
  }
  return !flg;
}

int main(){
  int n,pcnt;
  primes[0]=2;
  primes[1]=3;
  primes[2]=5;
  primes[3]=7;
  primes[4]=11;
  primescnt=5;

  while (1){
    cin >> n;
    if (n==0) break;
    pcnt=0;
    for (int i=n+1;i<=n*2;i++){
      pcnt+=isprime(i);
    }
    cout << pcnt << endl;
  }
  return 0;
}

Measured memory_bytes: 3080
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A=sc.nextInt(), B=sc.nextInt(), X=sc.nextInt();
    if(A>X) {
      System.out.println("NO");
    } else if(X-A>B) {
      System.out.println("NO");
    } else {
      System.out.println("YES");
    }
  }    
}

Measured memory_bytes: 35392
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

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

    int a, b;

    cin >> a >> b;

    if (a <= 8 && b <= 8) {
        cout << "Yay!";
    } else {
        cout << ":(";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
m = 55555
prime = [True for i in range(m+1)]
prime[0] = prime[1] = False
for i in range(2, m+1):
    if prime[i] == True:
        for j in range(2, m+2):
            if i*j >= m+1:break;
            prime[i*j] = False
cnt = 0
ans = []
for i in range(2, m+1):
    if prime[i] == True and i%5 == 1:
        cnt += 1
        ans.append(i)
    if cnt == n:break
for i in range(n):
    print(ans[i], end = '')
    if i == n-1:print()
    else:print(" ", end = '')

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

int main(){
    int n;
    std::cin >> n;
    std::vector<int> x(n + 1);
    std::cin >> x[0];
    for(int i = 0; i < n; i++){
        std::cin >> x[i + 1];
    }
    
    std::sort(x.begin(), x.end());
    std::vector<int> diff;
    for(int i = 1; i < x.size(); i++){
        diff.push_back(x[i] - x[i - 1]);
    }
    
    auto gcd = [](int a, int b){
        int tmp;
        while(a%b != 0){
            tmp = b;
            b = a%b;
            a = tmp;
        }
        return b;
    };
    
    int ans = diff[0];
    for(int i = 1; i < diff.size(); i++){
        ans = gcd(diff[i], ans);
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}


Measured memory_bytes: 1276
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
class stack{
    int top,S[100];
    public:
    void initialize(){
        top = 0;
        
    }
    bool isEmpty(){
        return top == 0;
    }
    bool isFull(){
        return top >=  99;
    }
    void push(int x){
        top++;
        S[top] = x;
        
    }
    int pop(){
        top--;
        return S[top+1];
        
    }
    void print(){
        cout << S[top] << endl;
    }
    
};
int main(){
    char ch[100];
    int a,b;
    stack s;
    s.initialize();
    while(scanf("%s", ch) != EOF){
        if(ch[0] == '+'){
            a = s.pop();
            b = s.pop();
            s.push(a+b);
        }
        else if(ch[0] == '-'){
            a = s.pop();
            b = s.pop();
            s.push(b-a);
        }
        else if(ch[0] == '*'){
            a = s.pop();
            b = s.pop();
            s.push(a*b);
        }
        else{
            a  = atoi(ch);
            s.push(a);
        }
    }
    s.print();
    return 0;
    
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);  



int main(){
  string s; cin >> s;
  vector<bool> a(26, false);
  for(int i=0; i<s.size();i++)  a[s[i]-'a'] = true;
  
  if(s.size()==26){
    string t=s;
    if(next_permutation(s.begin(), s.end())==0){
      cout << -1 << endl;
    }else{
      for(int i=0; i<26; i++){
        cout << s[i];
        if(s[i]!=t[i]){
          cout << endl; return 0;
        }
      }
    }
    
  }else{
    for(int i=0; i<26; i++){
      if(!a[i]){
        s += ('a'+i);
        cout << s << endl;
        break;
      }
    }
  }

  
    
}

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

from collections import Counter 

N = int(input())
AN = [int(input()) for i in range(N)]

# 各数値ごとに数を集計
AN_dict = Counter(AN)

cnt = 0
for key, value in AN_dict.items():
    if value % 2 != 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 16640
// Last Change: 04/13/2019 21:05:04.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

int main() {
  int N, maxHight;
  cin >> N;
  maxHight = 0;

  int ipt, ans = 0;
  for (int i = 0; i < N; ++i) {
    cin >> ipt;
    if (ipt >= maxHight) {
      ++ans;
    }
    maxHight = max(maxHight, ipt);
  }

  cout << ans << endl;

  //NS::LoopUntilZeroInpput();
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

struct dice{
	int q1,q2,q3,q4,q5,q6;
};

void mN(dice &d){
	int tmp=d.q1;
	d.q1=d.q2;
	d.q2=d.q6;
	d.q6=d.q5;
	d.q5=tmp;
}

void mE(dice &d){
	int tmp=d.q1;
	d.q1=d.q4;
	d.q4=d.q6;
	d.q6=d.q3;
	d.q3=tmp;
}
void mW(dice &d){
	int tmp=d.q1;
	d.q1=d.q3;
	d.q3=d.q6;
	d.q6=d.q4;
	d.q4=tmp;
}
void mS(dice &d){
	int tmp=d.q1;
	d.q1=d.q5;
	d.q5=d.q6;
	d.q6=d.q2;
	d.q2=tmp;
}

void spin(dice &d){
	int tmp=d.q2;
	d.q2=d.q3;
	d.q3=d.q5;
	d.q5=d.q4;
	d.q4=tmp;
}

int main(){
	dice y, z;
	bool flag = false;
	
	scanf(" %d %d %d %d %d %d", &y.q1, &y.q2, &y.q3, &y.q4, &y.q5, &y.q6);
	scanf(" %d %d %d %d %d %d", &z.q1, &z.q2, &z.q3, &z.q4, &z.q5, &z.q6);
	
	for(int i=0; i<4; ++i){
		for(int j=0; j<4; ++j){
			//printf("now: %d %d %d %d %d %d\n", y.q1, y.q2, y.q3, y.q4, y.q5, y.q6);
		
			if(y.q1==z.q1 && y.q2==z.q2 && y.q3==z.q3 && y.q4==z.q4 && y.q5==z.q5 && y.q6==z.q6) {
				flag = true;
				break;
			}
			spin(y);	
		}
		if(flag) break;
		mN(y);
	}
	
	mE(y);
	
	//printf("now: %d %d %d %d %d %d\n", y.q1, y.q2, y.q3, y.q4, y.q5, y.q6);
	
	for(int i=0; i<4; ++i){
		for(int j=0; j<4; ++j){
			//printf("now: %d %d %d %d %d %d\n", y.q1, y.q2, y.q3, y.q4, y.q5, y.q6);
		
			if(y.q1==z.q1 && y.q2==z.q2 && y.q3==z.q3 && y.q4==z.q4 && y.q5==z.q5 && y.q6==z.q6) {
				flag = true;
				break;
			}
			spin(y);	
		}
		if(flag) break;
		mN(y);
	}	
			
	if(flag)printf("Yes\n");
	else printf("No\n");
		
	return 0;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int gcd(int a, int b, int c){
  int ans = __gcd(a,__gcd(b,c));
  return ans;
}

int main()
{
  int K;
  cin >> K;
  ll ans = 0;
  for(int i=1; i<=K; i++){
    for(int j=1; j<=K; j++){
      for(int k=1; k<=K; k++){
        ans += gcd(i,j,k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
# 解説放送を見た
# https://youtu.be/9MphwmIsO7Q?t=5738

def main():
    mod = 10 ** 9 + 7

    n = int(input())
    *c, = map(int, input().split())

    c.sort()

    pw = [1]
    t = 1
    for _ in range(n):
        t = t * 2 % mod
        pw.append(t)

    ret = 0
    for l, x in enumerate(c):
        r = n - 1 - l  # lxr
        ret = (ret + x * pw[l] * (pw[r] + pw[r - 1] * r)) % mod

    ret = ret * pw[n] % mod

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26172
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int N,T,L,B;
bool Lose[102];
bool Back[102];

int next_pos(int pos,int n) {
    int cnt=0;
    int a=1;
    while(cnt < n) {
        if(pos == N) a=-1;
        if(pos == 0) a=1;
        pos+=a;
        cnt++;
    }

    return pos;
}
double dp[102][102];

// ターン数,場所
double dfs(int a,int b) {
    if(b == N) return 1;
    if(a >= T) return 0;
    if(dp[a][b]!=-1) return dp[a][b];

    double res=0.0;
    rep(i,6) {
        int next = next_pos(b,i+1);
        if(Lose[next]) res += dfs(a+2,next) / 6.0;
        else if(Back[next]) res += dfs(a+1,0)/6.0;
        else res += dfs(a+1,next)/6.0;
    }

    return dp[a][b] = res;
}

void solve() {
    rep(i,102) Lose[i]=Back[i]=false;
    rep(i,102) rep(j,102) dp[i][j]=-1;
    rep(i,L) {
        int a;
        cin>>a;
        Lose[a]=true;
    }
    rep(i,B) {
        int a;
        cin>>a;
        Back[a]=true;
    }

    printf("%.6f\n", dfs(0,0));
}

int main() {
    while(cin>>N>>T>>L>>B) {
        if(N+T+L+B==0) break;
        solve();
    }
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>p(n), q(n);
	for (auto&& x : p)cin >> x;
	for (auto&& x : q)cin >> x;

	vector<int>g; for (int i = 0; i < n; i++)g.push_back(i + 1);
	vector<vector<int>>np;
	do {
		np.push_back(g);
	} while (next_permutation(g.begin(), g.end()));

	int a, b;
	for (int i = 0; i < np.size(); i++) {
		bool af = true, bf = true;
		for (int j = 0; j < n; j++) {
			if (af)if (np[i][j] != p[j])af = false;
			if (bf)if (np[i][j] != q[j])bf = false;
		}
		if (af)a = i; if (bf)b = i;
	}
	cout << abs(a - b) << endl;

	return 0;
}

Measured memory_bytes: 6384
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<long long, long long>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

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

struct UnionFind {
	vector<int>uf;
	
	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i-1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

void dfs(int from) {
	int c = 1;
	for (auto t : tree[from]) {
		c = c != color[from] ? c : c + 1;
		color[t] = c;
		colorMap[make_pair(from, t)] = c;
		m = max(c, m);
		dfs(t);
		c++;
	}
}

int main() {
	ll N;
	cin >> N;
	vector<ll>bit(60);
	for (int i = 0; i < N; ++i) {
		ll a;
		cin >> a;
		int cnt = 59;
		while (0 < a) {
			ll b = pow(2,cnt);
			if (b <= a) {
				a -= b;
				bit[cnt]++;
			}
			cnt--;
		}
	}

	ll ans = 0;
	for (ll i = 0; i < 60; ++i) {
		ans = (ans + (((1LL << i) % MOD)*((bit[i] * (N - bit[i]) % MOD)))) % MOD;
	}
	cout << ans << endl;
}

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

int main() {
  int N, cnt;
  cin >> N;
  cnt = 0;
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    if(((i+1)%2)==1 && a%2==1) cnt++;
  }
  cout << cnt;
}

Measured memory_bytes: 3648
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        //string input= Console.ReadLine();
        int input =int.Parse(Console.ReadLine());
        if (input==1)
        {
            Console.WriteLine("Hello World");
        }
        else
        {
            Console.WriteLine(int.Parse(Console.ReadLine())+ int.Parse(Console.ReadLine()));
        }
        


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

Measured memory_bytes: 11092
import java.util.Scanner

object Main extends App {
  val scanner = new Scanner(System.in)
  val n = scanner.nextInt()
  val t = scanner.nextFloat()
  val a = scanner.nextFloat()
  val h = Array.fill(n)(scanner.nextFloat())
  val result = h.map(hn=>{
    val diff = a-(t-hn*0.006)
    if (diff>0){
      diff
    } else {
      -diff
    }
  }).zipWithIndex.minBy(_._1)._2
  println(result+1)
}

Measured memory_bytes: 31804
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(){
  string s;
  int a[27]={};
  std::cin >> s;
  rep(i,4)a[s[i]-'A']++;
  rep(i,27){
    if(a[i]==0 || a[i]==2);
    else {
      std::cout << "No" << '\n';
      return 0;
    }
  }
  std::cout << "Yes" << '\n';


  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()

#define MOD 1000000007
int N;
string S;
LL c[26] = {};

int main(){
	cin >> N >> S;
	for(int i=0; i<N; i++){
		c[S[i]-'a']++;
	}

	LL ans = 1;
	for(int i=0; i<26; i++){
		ans *= c[i]+1;
		ans %= MOD;
	}
	cout << ans-1 << endl;

	return 0;
}

Measured memory_bytes: 512
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

int costs[505][505];
int eempty[505][505];
void solve() {
	int n;
	cin>>n;
	fr(i,1,n)
		fr(j,1,n) {
			costs[i][j]=min({i-1,j-1,n-i,n-j});
			eempty[i][j]=1;
		}
	int ans=0;
	int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
	fr(i,1,n*n) {
		int who;
		cin>>who;
		int ro=(who-1)/n+1,co=(who-1)%n+1;
		queue<pii> upd;
		upd.push({ro,co});
		ans+=costs[ro][co];
		eempty[ro][co]=0;
		pii at=upd.front();
		rep(j,0,4)
			if(costs[at.fi+dx[j]][at.se+dy[j]]+eempty[at.fi+dx[j]][at.se+dy[j]]<costs[at.fi][at.se])
				costs[at.fi][at.se]=costs[at.fi+dx[j]][at.se+dy[j]]+eempty[at.fi+dx[j]][at.se+dy[j]];
		while(sz(upd)) {
			pii at=upd.front();
			upd.pop();
			rep(j,0,4)
				if(costs[at.fi+dx[j]][at.se+dy[j]]>eempty[at.fi][at.se]+costs[at.fi][at.se]) {
					costs[at.fi+dx[j]][at.se+dy[j]]=eempty[at.fi][at.se]+costs[at.fi][at.se];
					upd.push({at.fi+dx[j],at.se+dy[j]});
				}
		}
	}
	cout<<ans<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(8);
	int t=1;
//	cin>>t;
	fr(i,1,t) {
		solve();
	}
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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

int main()
{
  int input;
  int i,j;
  scanf("%d",&input);
  
  if(input<10){
    printf("Yes\n");
  }
  else if(input>81){
    printf("No\n");
  }
  else if(1){
    j = 0;
    for(i=2;i<=9;i++){
      if( (input%i)==0 && (input/i)<10 ){
        j = 1;
        break;
      }
      else{
        j = 2;
      }
    } 
  }
  
  if(j==1){
    printf("Yes\n");
  }
  if(j==2){
    printf("No\n");
  }
             
  
  return 0; 
}

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

using namespace std;

typedef long long ll;

int f(int x){
	if (x % 2){
		return 3 * x + 1;
	}
	return x / 2;
}

int main(){
	int s, ans = 0;
	cin >> s;
	while(true){
		if (s == 4 || s == 2 || s == 1){
			cout << ans + 4;
			break;
		}
		s = f(s);
		ans ++;
	}	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint a(n+2);
    a[0] = 0;
    a[n+1] = 0;
    rep(i, n) cin >> a[i+1];

    ll dist = 0;
    rep(i, n+1) {
        dist += abs(a[i+1]-a[i]);        
    }

    rep(i, n) {
        int id = i+1;
        ll ans = dist;
        ans += abs(a[id+1]-a[id-1]);
        ans -= abs(a[id+1]-a[id]);
        ans -= abs(a[id]-a[id-1]);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1664