akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

int T;

const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int a[N];
int n, k;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> n >> k)
    {
        for (int i = 1; i <= n; ++i)
        {
            scanf("%d", &a[i]);
        }
        sort(a + 1, a + 1 + n);

        LL ans = 1;
        int sn = 1;

        if (n == k)
        {
            for (int i = 1; i <= n; ++i)
            {
                if (a[i] < 0) sn *= -1, a[i] = -a[i];
                ans = (ans * a[i]) % mod;
            }
            if (sn == -1) ans = mod - ans;
            cout << ans << endl;
            continue;
        }

        int l = 1, r = n;
        if (k % 2)  //奇数情况
        {
            ans = a[r--], k--;
            if (ans < 0) sn = -1;  //唯一的全负状况 取最小
        }

        while (k)  //转化为偶数状态处理
        {
            LL ll = 1ll * a[l] * a[l + 1], rr = 1ll * a[r] * a[r - 1];
            if (ll * sn > rr * sn)
            {
                ans = ll % mod * ans % mod;
                l += 2;
            }  //左右两边哪个绝对值大就选哪个 全负数状态相反
            else
            {
                ans = rr % mod * ans % mod;
                r -= 2;
            }
            k -= 2;
        }
        if (ans < 0) ans = mod + ans;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4532
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const N = lines[0]-0;
    console.log(N>=30?"Yes":"No")
});


Measured memory_bytes: 30128
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.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; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        ll mx = -inf;
        ll ans = -inf;
        rep(i, 1, N+1) {
                ll cnt = 0;
                ll tmp = i;
                while (tmp % 2 == 0) {
                        tmp /= 2;
                        ++cnt;
                }
                if (cnt > mx) {
                        mx = cnt;
                        ans = i;
                }
        }
        cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mk make_pair
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;

ll qpow(ll a, ll b, ll p){//a的b次方求余p 
     ll ret = 1;
     while(b){
         if(b & 1) ret = (ret * a) % p;
         a = (a * a) % p;
         b >>= 1;
     }
     return ret;
 }


int main()
{
   IOS;
   int n;
   cin >> n;
   if(n == 1)
   {
       cout << 0;
       return 0;
   }
   else if(n == 2)
   {
       cout << 2;
       return 0;
   }
   else
   {
       cout << ((qpow(10,n,mod)%mod-2*qpow(9,n,mod)%mod+qpow(8,n,mod)%mod)+mod)%mod <<endl;
   }
   
}


Measured memory_bytes: 3572
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) rep2(i,0,n)

using namespace std;


main(){
    string s;
    cin>>s;
    int a,b,c;
    a=0;
    b=0;
    c=0;
    rep(i,3){
        if('a'==s[i]) a=1;
        else if('b'==s[i]) b=1;
        else if('c'==s[i]) c=1;
    }
    if(a*b*c) cout<<"Yes";
    else cout<<"No";


    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    K = int(readline())

    queue = deque(range(1, 10))
    for _ in range(K):
        n = queue.popleft()

        tail = n % 10
        n10 = n * 10
        if tail == 0:
            queue.append(n10 + tail)
            queue.append(n10 + tail + 1)
        elif tail == 9:
            queue.append(n10 + tail - 1)
            queue.append(n10 + tail)
        else:
            queue.append(n10 + tail - 1)
            queue.append(n10 + tail)
            queue.append(n10 + tail + 1)

    print(n)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74804
h, w = map(int, input().split())
field = [list(input()) for i in range(h)]

for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            count = 0
            for s in range(max(0,i-1), min(h,i+2)):
                for t in range(max(0,j-1), min(w,j+2)):
                    if field[s][t]=='#':
                        count += 1
            field[i][j] = count
        print(field[i][j], end='')
    print()


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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 998244353
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n,sum=0,high=0;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		high=max(high,arr[i]);
		sum+=arr[i];
	}
	cout<<sum-high/2<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


struct SuffixArray {
  vector< int > SA;
  const string s;

  SuffixArray(const string &str) : s(str) {
    SA.resize(s.size());
    iota(begin(SA), end(SA), 0);
    sort(begin(SA), end(SA), [&](int a, int b) {
      return s[a] == s[b] ? a > b : s[a] < s[b];
    });
    vector< int > classes(s.size()), c(s.begin(), s.end()), cnt(s.size());
    for(int len = 1; len < s.size(); len <<= 1) {
      for(int i = 0; i < s.size(); i++) {
        if(i > 0 && c[SA[i - 1]] == c[SA[i]] && SA[i - 1] + len < s.size() && c[SA[i - 1] + len / 2] == c[SA[i] + len / 2]) {
          classes[SA[i]] = classes[SA[i - 1]];
        } else {
          classes[SA[i]] = i;
        }
      }
      iota(begin(cnt), end(cnt), 0);
      copy(begin(SA), end(SA), begin(c));
      for(int i = 0; i < s.size(); i++) {
        int s1 = c[i] - len;
        if(s1 >= 0) SA[cnt[classes[s1]]++] = s1;
      }
      classes.swap(c);
    }
  }

  int operator[](int k) const {
    return SA[k];
  }

  size_t size() const {
    return s.size();
  }

  bool lt_substr(const string &t, int si = 0, int ti = 0) {
    int sn = (int) s.size(), tn = (int) t.size();
    while(si < sn && ti < tn) {
      if(s[si] < t[ti]) return true;
      if(s[si] > t[ti]) return false;
      ++si, ++ti;
    }
    return si >= sn && ti < tn;
  }

  int lower_bound(const string &t) {
    int low = -1, high = (int) SA.size();
    while(high - low > 1) {
      int mid = (low + high) / 2;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    return high;
  }

  pair< int, int > lower_upper_bound(string &t) {
    int idx = lower_bound(t);
    int low = idx - 1, high = (int) SA.size();
    t.back()++;
    while(high - low > 1) {
      int mid = (low + high) / 2;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    t.back()--;
    return {idx, high};
  }

  void output() {
    for(int i = 0; i < size(); i++) {
      cout << i << ": " << s.substr(SA[i]) << endl;
    }
  }
};

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  string s;
  cin>>s;
  int q;
  cin>>q;
  SuffixArray sa(s);
  while(q--){
    string t;
    cin>>t;
    P range = sa.lower_upper_bound(t);
    cout<<(range.F!=range.S)<<endl;
  }


}


Measured memory_bytes: 35308
#include<stdio.h>

int main()
{
  int P,Q,R,min,i;
  for(i=0;i<100;i++)
  {
    if(scanf("%d %d %d",&P,&Q,&R)!=3)break;
    min = P+Q;
    if(P+R<min)min=P+R;
    if(Q+R<min)min=Q+R;
    printf("%d\n",min);
  }
  return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
ball=[False]*n
for i in range(n-1,-1,-1):
    cnt=0
    for j in range(i,n,i+1):
        if ball[j]:
            cnt+=1
    if cnt%2!=a[i]:
        ball[i]=True
ans=[i+1 for i in range(n) if ball[i]]
print(len(ans))
print(*ans)

Measured memory_bytes: 14132
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"
#ifdef DEBUG
#define dump(v) cerr << "["#v << ":" << (v) << "]" << endl;
#else
#define dump(v)
#endif
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
const ll MOD = (1e9+7);
const ll INF = (1e9+123456789);
const ll INFL = (INF*INF);
inline ll addm(ll a, ll b, ll m = MOD) {return ((a+b)%m);}
inline ll subm(ll a, ll b, ll m = MOD) {return (((a-b)%m+m)%m);}
inline ll mulm(ll a, ll b, ll m = MOD) {return ((a*b)%m);}
ll powm(ll a, ll b, ll m = MOD) {ll ret=(!b)?1:powm(a, b/2, m);return (!b)?1:mulm(mulm(ret,ret,m),b%2?a:1,m);}
ll inv(ll x, ll m = MOD) {return powm(x,m-2,m);}

const int N = 500500;
const int S = 2100100;
vi v[S];
ll sum[N], zero[N];
void solve()
{
    int n; cin >> n;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        sum[i] = sum[i-1] ^ x;
        zero[i] = zero[i-1];
        if (sum[i] == 0) zero[i]++;
    }
    /* for (int i = 1; i <= n; i++) */
    /*     cout << sum[i] << " "; */
    /* cout << endl; */
    for (int i = 1; i <= n; i++)
        v[sum[i]].push_back(i);
    ll ans = (zero[n] && sum[n] == 0) ? powm(2, zero[n]-1) : 0;
    for (int s = 1; s < S; s++) {
        if (sz(v[s]) == 0) continue;
        ll s0 = 0, s1 = 0;
        int l = 0;
        for (int i: v[s]) {
            ll z = zero[i]-zero[l];
            if (z > 0) {
                s0 += s1 * z;
                l = i;
            }
            s1 += s0 + 1;
            s0 %= MOD;
            s1 %= MOD;
            /* cout << i << "(" << s0 << "," << s1 << ") "; */
        }
        /* cout << endl; */
        if (sum[n] == 0 || s == sum[n]) {
            ans += (sum[n] == 0) ? (s1) : (s0 + 1);
            ans %= MOD;
        }
    }
    cout << ans << endl;
}

int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 66932
N = int(input())
nums = list(map(int,input().split()))
sort_nums = sorted(nums)
for i in nums:
    n = N // 2
    if sort_nums[n-1] == sort_nums[n]:
        print(sort_nums[n-1])
    else:
        if i > sort_nums[n-1]:
            print(sort_nums[n-1])
        else:
            print(sort_nums[n])

Measured memory_bytes: 25476
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
//#define vi vector<int>
#define vb vector<bool>
#define pii pair<int, int>
#define mii map<int, int>
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define inf (long long)1e18
#define F first
#define S second
#define SZ(x) ((int)(x).size())
//#define rep(i, n) for (int i = 0; i < n; i++)
//#define repd(i,n) for(int i=n-1;i>=0;i--)
//#define rep1(i,n) for(int i=1;i<=n;i++)
const int N = 1e9 + 7;

int pow(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = ((res) * (x));
        res %= N;
        y = y >> 1;
        x = ((x) * (x));
    }
    return res;
}
ll powm(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll mxn(ll a, ll b)
{
    if (a > b)
        return a;
    else
    {
        return b;
    }
}
long long minl(long long a, long long b)
{
    if (a < b)
        return a;
    else
    {
        return b;
    }
}

void solve()
{
    int n;
    cin >> n;
    int x, y, cnt = 0;
    while (n--)
    {

        cin >> x >> y;
        if (x == y)
        {
            cnt++;
        }
        else
        {
            if (cnt >= 3)
            {
                cout << "Yes";
                return;
            }
            cnt = 0;
        }
    }
    if (cnt >= 3)
    {
        cout << "Yes";
    }
    else
        cout << "No";
}

int32_t main()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    // cin >> t;
    // while (t--)
    // {
    solve();
    // }
}

Measured memory_bytes: 3644
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int N;
	int D[100000];
	int R=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>D[i];
	}

	int a1=1,a2=1,a3=1;
	for(int i=1;i<N;i++){
		if(D[i]!=D[i-1]){
			a1+=1;
			a2+=1;
			a3+=1;
		}
		if(D[i]==D[i-1]){
			R=max(R,a3);
			a3=a2+1;
			a2=a1+1;
			a1=1;
		}

	}

	R=max(R,a1);
	R=max(R,a2);
	R=max(R,a3);


	cout<<R<<endl;
	return 0;
}

Measured memory_bytes: 3480
import math
N = int(input())

keta = int(math.log10(N)+1)
count = 0
for i in range(1,keta+1):
    if i % 2 == 1:
        if i == 1:
            if keta == 1:
                count += N
            else:
                count += 9
        elif i != keta:
            count += int('8'+'9'*(i-1)) + 1
        else:
            count += N - 10 ** (keta-1) + 1
print(count)

Measured memory_bytes: 3188
import bisect
N = int(input())
S = list(map(int, list(input())))
index = [[] for _ in range(10)]
for i in range(N):
    index[S[i]].append(i)
ans = 0
for i in range(10):
    ii = 0
    if ii>=len(index[i]):
        continue
    ii = index[i][ii]
    for j in range(10):
        jj = bisect.bisect_right(index[j], ii)
        if jj>=len(index[j]):
            continue
        jj = index[j][jj]
        for k in range(10):
            kk = bisect.bisect_right(index[k], jj)
            if kk>= len(index[k]):
                continue
            ans+=1
            
print(ans)
            

Measured memory_bytes: 41712
#include"bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())

int main() {
	int r;
	cin >> r;
	cout << r * r << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a), N / 2);
	}
	else{
		return MOD(a * power(a, N - 1));
	}
}

int inverse(int a){
	return power(a, p - 2);
}

int fact(int N){
	if(N == 0){
		return 1;
	}
	else{
		return MOD(N * fact(N - 1));
	}
}

signed main(){
	int N, X, i, j, count;
	scanf("%lld%lld", &N, &X);
	int *S = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld", &S[i]);
	}
	int *dp = (int *)malloc(sizeof(int) * (X + 1));
	for(i = 0; i <= X; i++){
		for(j = 0, count = 0, dp[i] = 0; j < N; j++){
			if(S[j] <= i){
				dp[i] = MOD(dp[i] + dp[i % S[j]]);
				count++;
			}
		}
		if(count > 0){
			dp[i] = MOD(dp[i] * inverse(count));
		}
		else{
			dp[i] = i;
		}
	}
	printf("%lld\n", MOD(fact(N) * dp[X]));
	return 0;
}

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

int main(){
  int N, T;
  cin >> N >> T;
  
  int cost = 2147483647;
  bool ret = false;
  for(int i = 0 ; i < N ; i++){
    int c, t;
    cin >> c >> t;
    if(t <= T && cost > c){
      cost = c;
      ret = true;
    }
   
  }
  
  if(ret) cout << cost << endl;
  else cout << "TLE" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    vector<int> Nums;
    
    int now = 1;  //今見ている数
    int cnt = 0;  //nowがいくつ並んでいるか
    rep(i, n) {
        if(s[i] == (char)('0' + now)) {
            cnt++;
        }
        else {
            Nums.push_back(cnt);
            now = 1 - now;  //0と1を切り替える計算
            cnt = 1;  //新しいのをカウントし始める
        }
    }
    if(cnt != 0) {
        Nums.push_back(cnt);
    }

    //1-0-1-0-1-0-1ってかんじの配列が欲しい
    //1-0-1-0みたいに0で終わってたら適当に1つ足す
    if(Nums.size()%2 == 0) {
        Nums.push_back(0);
    }

    //累積和を作る
    vector<int> rui(Nums.size()+1);
    rep(i, Nums.size()) {
        rui[i+1] = rui[i] + Nums[i];
    }

    int add = 2*k+1;
    int ans = 0;
    //1-0-1…の1から始めるので、偶数番目だけ見る
    for(int i = 0; i < Nums.size(); i += 2) {

        //次のleft, rightを計算する
        int left = i;
        int right = min((int)Nums.size(), i+add);
        int tmp = rui[right] - rui[left];

        ans = max(ans, tmp);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1272
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
a = max(A)
B.sort(reverse=True)

s = (H + a - 1)
ans = s // a
for i in range(N):
    s -= B[i]
    s = max(0, s)
    ans = min(ans, s // a + i + 1)

print(ans)

Measured memory_bytes: 11948
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
#define All(v) (v).begin(),(v).end()
#define Rep(i,n) for(int i = 0; i < (int)n; i++)
#define Reps(i,n) for(int i = 1; i <= (int)n; i++)
#define For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define inf 2e9
#define f first
#define s second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

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

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

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


int main (){
    int n;
    cin >> n;
    vector<int> a(n);
    int mi_cnt = 0;
    int mi = inf;
    ll ans = 0;
    Rep(i,n){
        cin >> a[i];
        if(a[i] < 0) mi_cnt++;
        mi = min(mi,abs(a[i]));
        ans += abs(a[i]);
    }
    if(mi_cnt%2 == 0) cout << ans << endl;
    else cout << ans-mi*2 << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<utility>
#include<vector>
#include<functional>
#include<stack>
#include<queue>
#include<math.h>
#include<deque>
#define rep(i,rept)	for(ll i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;

//Product and GCD
//2 2 2 3 3 3

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

	ll n = 0,p_copy = 0,p = 0,ans = 1;
	map<ll, ll> prime;
	
	cin >> n >> p;

	if (n == 1) {
		cout << p << endl; 
		return 0;
	}

	if (n == p) {
		cout << 1 << endl;
		return 0;
	}

	p_copy = p;
	for (ll i = 2; i <= sqrt(p_copy); i++) {
		while (p%i == 0) {
			prime[i]++;
			p /= i;
		}
	}

	for (ll i = 2; i <= sqrt(p_copy); i++) {
	
		if (prime[i] >= n) {
			ans *= pow(i,prime[i] / n);
		}

	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 61952
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
#define sp cout<<"---------------------------------------------------"<<endl;
#define foreach(i,dat) for(__typeof(dat.begin()) i = dat.begin();i!=dat.end();++i)
const int inf=1e9+7;
struct node {
      int p,b,c;
};
inline bool operator < (node x,node y){return x.c>y.c;}
map<int,vector<int> >e[100100];
vector<int>v[100100];
map<int,int>d[100100];
priority_queue<node>q;
int main(){
      int n,m,i,x,y,z;
      scanf("%d%d",&n,&m);
      for(i=1;i<=m;i++){
          scanf("%d%d%d",&x,&y,&z);
          x--,y--;
          e[x][z].push_back(y);
          e[y][z].push_back(x);
          v[x].push_back(z);
          v[y].push_back(z);
      }
      q.push({0,0,0});;
      d[0][0]=0;
      while(!q.empty()){
          node p=q.top();
          q.pop();
          if(d[p.p][p.b]!=p.c)continue;
          if(d[p.p].find(0)==d[p.p].end()||d[p.p][0]>p.c){
            d[p.p][0]=p.c;
            q.push({p.p,0,p.c});
        }
        if(!p.b){
          for(i=0;i<(int)v[p.p].size();i++)
            if(d[p.p].find(v[p.p][i])==d[p.p].end()||d[p.p][v[p.p][i]]>p.c+1){
              d[p.p][v[p.p][i]]=p.c+1;
              q.push({p.p,v[p.p][i],p.c+1});
            }
          continue;
        }
        for(i=0;i<(int)e[p.p][p.b].size();i++)
          if(d[e[p.p][p.b][i]].find(p.b)==d[e[p.p][p.b][i]].end()
             ||d[e[p.p][p.b][i]][p.b]>p.c){
              d[e[p.p][p.b][i]][p.b]=p.c;
              q.push({e[p.p][p.b][i],p.b,p.c});
          }
      }
      int ans=inf;
      for(map<int,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++)
        ans=min(ans,it->second);
      if(ans==inf)puts("-1");
        else printf("%d\n",ans);
      return 0;
}

Measured memory_bytes: 85808
H, W = STDIN.gets.split.map(&:to_i)

G = []

H.times do
  a = Array.new(W)
  line = STDIN.gets.chomp.bytes.push 35
  i, j = 0, 0
  while i <= W
    if line[i] == 35
      if j < i
        c = i - j
        k = j
        while k < i
          a[k] = c
          k += 1
        end
      end 
      i += 1
      j = i
    else
      i += 1
    end
  end
  G << a
end 
G << Array.new(W)

ans = 0
G.transpose.each do |ar|
  i, j = 0, 0
  local_max = 0
  while i <= H
    v = ar[i]
    if v.nil?
      if j < i
        local_max += (i - j)
        ans = local_max if ans < local_max
        local_max = 0
      end 
      i += 1
      j = i
    else
      local_max = v if local_max < v  
      i += 1
    end 
  end 
end
puts ans - 1


Measured memory_bytes: 76412
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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



 
 
int main(){
    int N, id(0); std::cin >> N;
    std::vector<int> A(N);
    for(int i(0); i < N; ++i) std::cin >> A[i];
    std::sort(A.begin(), A.end());
    long long sum(0);
    for(int i(0), i_len(N-1); i < i_len; ++i){
        sum += A[i];
        if(2*sum < A[i+1]) id = i + 1;
    }
    std::cout << N - id << std::endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
  	int n;
  	string a,b;
  	
  	while(cin>>n){
      
      string str="";
      cin>>a>>b;
    	for(int i=0;i<n;i++){
        	str += a[i];
          str += b[i];
      }
      cout<<str<<endl;
    }
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 1; i < n; i++) cin >> a[i];
  vector<int> ans(n);
  for (int i = 1; i < n; i++) ans[a[i] - 1]++;
  rep(i, n) { cout << ans[i] << endl; }
  return 0;
}

Measured memory_bytes: 4852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main
{
  static int a;
  static int b;
  static int c;

  static int n;
  static int l[];

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    PrintWriter out = new PrintWriter(System.out);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    n = Integer.parseInt(sl[0]);

    s = r.readLine();
    sl = s.split(" ");
    int v = 0;
    for(int i = 0; i < n; i++)
    {
      v += Integer.parseInt(sl[i]) - 1;
    }
    out.println(v);
    out.flush();
  }

}

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

using namespace std;

const string t="keyence";  

int main(){
   
  string s;
  cin >>s;
  
  if(s.substr(0,7)==t||s.substr(s.length()-7,7)==t){ cout << "YES" << endl;
   return 0;
  } 
  
  bool res=false;

  for(int i=1;i<=7;i++){
   if(s.substr(0,i)+s.substr(s.length()-(7-i),(7-i))==t) res=true;
  }     
     
  if(res) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

const int limit = 200010;
int n,a[limit];

int cmax[limit];

int main(void){
	cin >> n;
	rep(i,n) cin >> a[i];

	bool ok = true;
	if(a[0] != 0) ok = false;
	
	int start = 0;
	rep(i,1,n){
		if(a[i] == 0){
			start = i;
			continue;
		}

		if(a[i-1] < a[i] - 1 or a[i] > i - start){
			ok = false;
		}
	}

	if(ok == false){
		cout << -1 << endl;
		return 0;
	}

	rep(i,n){
		const int tar = i - a[i];
		chmax(cmax[tar],a[i]);
	}

	ll ans = 0LL;
	rep(i,n) ans += cmax[i];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
N=int(input())
a=[int(i) for i in input().split()]
X=0
Y=0
min=10**11
for i in range(N):
  X=X+a[i]

for j in range(N-1):
  Y=Y+a[j]
  if abs(X-2*Y) <= min:
   min=abs(X-2*Y)
print(min)


Measured memory_bytes: 24832
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	string a;
	ll b;
	cin>>a>>b;
	for(int i=0;i<a.size();i++){
		if(a[i]!='1'){
			cout<<a[i];
			return 0;
		}
		if(i==b-1){
			cout<<1;
			return 0;
		}
	}
}

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

int main() {
  int X,Y;
  cin >> X >> Y;
  int m=0;
  if(X==1&&Y==1)
    m +=400000;
  if(X==1)
    m +=300000;
  if(X==2)
    m +=200000;
  if(X==3)
    m +=100000;
  if(Y==1)
    m +=300000;
  if(Y==2)
    m +=200000;
  if(Y==3)
    m +=100000;
  cout << m << endl;
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i).sort

cnt = Hash.new(0)

A.each do |a|
  cnt[a-1] += 1
  cnt[a] += 1
  cnt[a+1] += 1
end

p cnt.max{ |x, y| x[1] <=> y[1] }[1]


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

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int n;
  cin >> n;
  int ans = 1;
  int prev, curr;
  cin >> curr;
  if (n == 1) {
    cout << "1\n";
    return 0;
  }

  int status = 0;
  for (int i = 1; i < n; ++i) {
    prev = curr;
    cin >> curr;
    if (prev != curr) {
      if (0 < prev - curr) {
        if (status == 1) {
          ++ans;
          status = 0;
        } else {
          status = -1;
        }
      } else {
        if (status == -1) {
          ++ans;
          status = 0;
        } else {
          status = 1;
        }
      }
    }
  }
  cout << ans << "\n";
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n,k;cin>>n>>k;
  vector<int >a(n);
  rep(i, n)cin>>a[i];

  ll sum=0;
  rep(i, n)sum += a[i];

  set<ll>c;
  for(ll i=1; i*i<=sum; i++){
    if(sum%i)continue;
    c.insert(i);
    c.insert(sum/i);
  }

  ll ans = 0;
  for(ll cc: c){
    vector<ll>ca(n);
    rep(i, n)ca[i] = a[i]%cc;
    sort(ca.begin(), ca.end());

    ll psum = 0, msum=0;
    rep(i, n)psum += ca[i];
    if(psum <= k)ans = max<ll>(ans, cc);
    rrep(i, n){
      psum-=ca[i];
      msum += cc-ca[i];
      ll cans = max<ll>(psum, msum);
      if(cans<=k)ans = max<ll>(ans, cc);
//cout<<cc<<' '<<ans<<' '<<cans<<endl;
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3688
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int INF = INT_MAX / 2;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<vector<bool> > schedule(n, vector<bool>(31, false));
        for(int i=0; i<n; ++i){
            int f;
            cin >> f;
            for(int j=0; j<f; ++j){
                int a;
                cin >> a;
                schedule[i][a] = true;
            }
        }

        vector<vector<int> > hand(n, vector<int>(n, INF));
        for(int i=0; i<n; ++i){
            hand[i][i] = 0;
            multimap<int, int> mm;
            mm.insert(make_pair(0, i));
            while(!mm.empty()){
                int day = mm.begin()->first;
                int curr = mm.begin()->second;
                mm.erase(mm.begin());
                if(day > hand[i][curr])
                    continue;

                for(int j=0; j<n; ++j){
                    for(int k=day; k<=min(30, hand[i][j]-1); ++k){
                        if(schedule[curr][k] && schedule[j][k]){
                            hand[i][j] = k;
                            mm.insert(make_pair(k, j));
                        }
                    }
                }
            }
        }

        int ret = INF;
        for(int i=0; i<n; ++i){
            int tmp = 0;
            for(int j=0; j<n; ++j)
                tmp = max(tmp, hand[j][i]);
            ret = min(ret, tmp);
        }
        if(ret == INF)
            cout << -1 << endl;
        else
            cout << ret << endl;
    }
}

Measured memory_bytes: 1236
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		
		Scanner sca = new Scanner(System.in);
		while(true)
		{
			int n = sca.nextInt();
			if(n == 0) break;
			
			int[] start = new int[n];
			int[] end = new int[n];
			int[] used = new int[n];
			int i, j, k;
			
			for(i = 0;i < n;i++)
			{
				String text;
				int h, m, s;
				
				text = sca.next();
				h = (text.charAt(0) - '0') * 10 + (text.charAt(1) - '0');
				m = (text.charAt(3) - '0') * 10 + (text.charAt(4) - '0');
				s = (text.charAt(6) - '0') * 10 + (text.charAt(7) - '0');
				start[i] = h * 60 * 60 + m * 60 + s;
				
				text = sca.next();
				h = (text.charAt(0) - '0') * 10 + (text.charAt(1) - '0');
				m = (text.charAt(3) - '0') * 10 + (text.charAt(4) - '0');
				s = (text.charAt(6) - '0') * 10 + (text.charAt(7) - '0');
				end[i] = h * 60 * 60 + m * 60 + s;
				
				used[i] = 0;
			}
			
			for(i = n;i > 0;i--)
			{
				for(j = 0;j < (i - 1);j++)
				{
					if(start[j] > start[j + 1])
					{
						int tmp;
						tmp = start[j];   start[j] = start[j + 1];   start[j + 1] = tmp;
						tmp = end[j];   end[j] = end[j + 1];   end[j + 1] = tmp;
					}
				}
			}
			
			int train = 0;
			while(true)
			{
				int t = 0;
				for(i = 0;i < n;i++)
				{
					if(used[i] == 1) continue;
					if(t <= start[i])
					{
						used[i] = 1;
						t = end[i];
					}
				}
				train++;
				
				for(i = 0;i < n;i++)
					if(used[i] == 0) break;
				if(i == n) break;
			}
			
			System.out.println(train);
		}
	}
}

Measured memory_bytes: 68436
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int n=s.length();
    vector <int> count;
    count.resize(26,0);
    for(int i=0;i<n;i++)
        count[s[i]-97]++;
    for(int i=0;i<26;i++)
        if(count[i]%2)
        {
            cout<<"No\n";
            return 0;
        }
    cout<<"Yes\n";

    
    return 0;   
}


 
 


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[][] SCA = new char[N][10];
        long cnt = 0;
        Map<String, Long> sMap = new HashMap<>();

        for (int i = 0; i < N; i++) {
            SCA[i] = sc.next().toCharArray();
            Arrays.sort(SCA[i]);
            String si = new String(SCA[i]);
            sMap.put(si, sMap.getOrDefault(si, 0L) + 1);
        }

        for (long n : sMap.values())
            cnt += n * (n - 1) / 2;

        System.out.println(cnt);


    }
}

Measured memory_bytes: 62312
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {

  int H,N;
  cin >> H >> N;

  
  long long sum = 0;
  for(int i = 0;i < N;i++) {
    long long a;
    cin >> a;
    sum += a;
  }

  if(sum >= H) cout << "Yes" << endl;
  else cout << "No" << endl;



  
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
    if i != minj:
        t = a[minj]
        a[minj] = a[i]
        a[i] = t
        c += 1

print(*a)
print(c)

Measured memory_bytes: 5604
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    n = int(input())
    dd = list(map(int, input().split()))
    dd.sort()
    k = n//2
    print(dd[k]-dd[k-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 16448
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll inf = 1e18;

int main(void) {
    ll x;
    cin >> x;
    cout << 1-x << endl;
}



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

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

  int n, c;
  cin >> n >> c;
  int sum = 0;
  for(int i = 0; i < c; ++i) {
    int p;
    cin >> p;
    sum += p;
  }

  cout << sum / (n + 1) + !!(sum % (n + 1)) << endl;
}


Measured memory_bytes: 3212
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define N_MAX 200002

using namespace std;
typedef long long ll;
const ll MOD = 924844033;

vector<vector<ll>> dp[2002];
vector<vector<ll>> dp1[2002];

ll dpall[2002][2002];
int sz[2000];

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];

void init(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        fac[i]=fac[i-1]*(ll) i%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, K;
    cin >> N >> K;
    init();
    for(int i = 0; i < min(2*K, N); i++){
        int s = (N-i-1)/(2*K)+1;
        dp[i] = vector<vector<ll>>(s+1, vector<ll>(s+1, 0));
        dp1[i] = vector<vector<ll>>(s+1, vector<ll>(s+1, 0));
        sz[i] = s;
        for(int j = 0; j < s; j++){
            int k = i+j*2*K;
            int m = k-K;
            int M = k+K;
            if(j == 0){
                dp[i][0][0] = 1;
                if(M < N) dp1[i][0][1] = 1;
                if(m >= 0) dp[i][0][1] = 1;
            }else{
                // cout << "j=" << j << endl;
                for(int k = 0; k <= s; k++){
                    dp[i][j][k] = dp[i][j-1][k]+dp1[i][j-1][k];
                    if(k > 0 && m >= 0) dp[i][j][k] += dp[i][j-1][k-1];
                    dp[i][j][k] %= MOD;
                    if(k > 0 && M < N) dp1[i][j][k] = dp[i][j-1][k-1]+dp1[i][j-1][k-1];
                    dp1[i][j][k] %= MOD;
                    // cout << "k:"<< k << ' ' << dp[i][j][k] << ' ' << dp1[i][j][k] << ' ' << M << ' ';
                }
            }
            // cout << endl;
        }
        // cout << endl;
        // cout << i << ' ' << s << endl;
        // for(int j = 0; j <= s; j++) cout << dp[i][s-1][j]+dp1[i][s-1][j] << ' ';
        // cout << endl;
    }
    ll all = fac[N];
    // cout << all << endl;
    dpall[0][0] = 1;
    int sum = 0;
    for(int i = 0; i < min(2*K, N); i++){
        // cout << i << ' ' << sum << ' ' << sz[i] << endl;
        for(int j = 0; j <= sz[i]; j++){
            for(int k = 0; k <= sum; k++){
                dpall[i+1][j+k] += dpall[i][k]*(dp[i][sz[i]-1][j]+dp1[i][sz[i]-1][j]);
                dpall[i+1][j+k] %= MOD;
                // cout << j+k << ' ' << dpall[i][k] << ' ' << dp[i][sz[i]-1][j] << endl;;
            }
        }
        sum += sz[i];
    }
    int M = min(2*K, N);
    for(int i = 1; i <= N; i++){
        // cout << dpall[M][i] << ' ';
        int rem = N-i;
        if(i%2 == 1) all -= dpall[M][i]*fac[rem];
        if(i%2 == 0) all += dpall[M][i]*fac[rem];
        all %= MOD;
        all += MOD;
        all %= MOD;
    }
    // cout << endl;
    cout << all << endl;
}

Measured memory_bytes: 37888
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
#define For(i,a,b)  for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define bpc __builtin_popcount
#define MOD (ll)(1e9+7)
#define INF (2e9)
#define EPS (1e-6)
#define NATHANLEE_IS_EVIL_AND_ELECTRIC true
#define int ll
#ifdef LOCAL_TEST
#define debug(...) do{\
	cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
	" : ("#__VA_ARGS__<<") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<"\n";}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif
void INIT(){
#ifdef LOCAL_TEST
	freopen("D:\\input.in","r",stdin);
	freopen("D:\\output.out","w",stdout);
	freopen("D:\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(!NATHANLEE_IS_EVIL_AND_ELECTRIC);
	cin.tie(0);
}

ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll fpow(ll b,ll p){
	b%=MOD;
	ll ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int dp[100010];

int32_t main() {
	INIT();
	//code...
	int n,lim; cin>>n>>lim;
	dp[0]=0;
	For(i,1,100000) dp[i]=INF;
	while(n--){
		int w,v; cin>>w>>v;
		Forr(i,100000,v) dp[i]=min(dp[i],dp[i-v]+w);
	}
	Forr(i,100000,0) if(dp[i]<=lim){
		cout<<i<<"\n";
		return 0;
	}
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N, K; cin >> N >> K;
  vector<int> x(N);
  rep(i, N) cin >> x[i];
  int ans = inf;
  rep(i, N - K + 1) {
    minimize(ans, min(abs(x[i]), abs(x[i + K - 1])) + abs(x[i] - x[i + K - 1]));
  }
  cout << ans << "\n";
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    for(int i=0;i<n-1;i++) cin >> b[i];
    a[0] = b[0];
    ll ans = 0;
    ans = b[0];
    for(int i=1;i<n-1;i++){
        a[i] = min(b[i],b[i-1]);
        ans += a[i];
    }
    ans += b[n-2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256