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

int64_t N, K, A[200000], F[200000];

bool check(int64_t X){
    int64_t need = 0;
    for(int i=0; i<N; i++){
        int64_t ok = X/F[i];
        if(ok < A[i]) need += A[i] - ok;
    }
    return (need <= K);
}

int main(){
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) cin >> F[i];
    sort(A, A+N);
    sort(F, F+N, greater<>());
    int64_t ok = 1e13, ng = -1;
    while(ok-ng>1){
        int64_t mid = (ok+ng)/2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 3328
# 3つリストを作って、各頭文字をくっつけた略語をアッパー

s1, s2, s3 = map(list, input().split())
# print(s1)
# print(s2)
# print(s3)

abbreviation = s1[0] + s2[0] + s3[0]
# print(abbreviation)

print(abbreviation.upper())


Measured memory_bytes: 9052
/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define int ll
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int n,m,k;
const int N=1000010,Mod=1e9+7;
int fac[N],fai[N],inv[N];
void init(){
	fac[0]=fai[0]=inv[0]=inv[1]=1;
	for(int i=1;i<=1000000;i++)fac[i]=1ll*fac[i-1]*i%Mod;
	for(int i=2;i<=1000000;i++)inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
	for(int i=1;i<=1000000;i++)fai[i]=1ll*fai[i-1]*inv[i]%Mod;
}
int C(int n,int m){
	if(n<m || n<0 || m<0)return 0;
	return 1ll*fac[n]*fai[m]%Mod*fai[n-m]%Mod;
}
int qpow(int a,int b){
	int ret=1;
	while(b){
		if(b&1)ret=1ll*ret*a%Mod;
		b>>=1;a=1ll*a*a%Mod;
	}
	return ret;
}
signed main(){
	n=gi();m=gi();k=gi();
	init();
	int ans=qpow(3,m+k),sum=1;
	for(int u=1;u<=m+k;u++){
		sum=(2ll*sum%Mod-(u>k?C(u-1,k):0)+Mod-(u>m?C(u-1,u-m-1):0)+Mod)%Mod;
		ans=(ans+1ll*C(n+u-1,n-1)*qpow(3,m+k-u)%Mod*sum%Mod)%Mod;
	}
	printf("%lld\n",(ans+Mod)%Mod);
	return 0;
}


Measured memory_bytes: 23680
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int x, a, b;
	cin >> x >> a >> b;
	cout << (b <= a ? "delicious" : b - a <= x ? "safe" : "dangerous") << endl;
	return 0;
}


Measured memory_bytes: 256
import math
import sys
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
##### naive method for testing prime or not#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)
#####function that return all the letters#####
def alphbates():
    return "abcdefghijklmnopqrstuvwxyz"
#####binary search#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1
#####taking an array/list as input#####
def inp():
    ls=list(map(int,input().split()))
    return ls
#####taking multiple inputs#####
def mult_inp():
    return map(int,input().split())
#####Main function starts from here#####
x,k,d=mult_inp()
if x==k==d:
    if x%2==0:
        print(x)
    else:
        print(0)
elif x==0:
    if d%2==0:
        print(0)
    else:
        print(k)
elif x>0:
    if x//d>k:
        print(x-k*d)
    else:
        k-=x//d
        if k%2==0:
            print(x-(x//d)*d)
        else:
            print(abs(x-(x//d)*d-d))
else:
    x=x*-1
    if x//d>k:
        print(x-k*d)
    else:
        k-=x//d
        if k%2==0:
            print(x-(x//d)*d)
        else:
            print(abs(x-(x//d)*d-d))

Measured memory_bytes: 9256
n, x = (int(i) for i in input().split())
list_l = [int(j) for j in input().split()]
tmp = 0
count = 0
for i in range(0, n + 1):
    if i == 0:
        pass
    else:
        tmp += list_l[i - 1]
        if tmp > x:
            break
    count += 1
print(count)

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

int main() {
	int N;
	cin >> N;
	if ( N < 10 ){
      if ( N == 3) {
        cout << "bon" << endl;
      }
      else if ( N == 0 || N == 1 || N == 6 || N == 8 ) {
        cout << "pon" << endl;
      }
      else {
        cout << "hon" << endl;
      }
    }
  else if ( N > 9 && N < 100 ) {
    N = N%10;

     if ( N == 3) {
        cout << "bon" << endl;
      }
      else if ( N == 0 || N == 1 || N == 6 || N == 8 ) {
        cout << "pon" << endl;
      }
      else {
        cout << "hon" << endl;
      }
  }
  else if ( N > 99 && N < 1000 ) {
    N = N%100;
    N = N%10;
     if ( N == 3) {
        cout << "bon" << endl;
      }
      else if ( N == 0 || N == 1 || N == 6 || N == 8 ) {
        cout << "pon" << endl;
      }
      else {
        cout << "hon" << endl;
      }
  }
}


Measured memory_bytes: 3564
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);



int main(){
	FAST_IO
  string s; cin >> s;
  int bitC = 0;
  
  for(char c : s) bitC += (c == '1');

  cout << bitC << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int N,L,c,r,ra,D[100];
queue<int>q[2][105],w;
int main()
{
	for(;scanf("%d%d\n",&N,&L),N;)
	{
		r=-1;
		c=N;
		for(int i=0;i<N;i++)
		{
			int t;
			char d;
			scanf("%c%d\n",&d,&t);
			q[0][t].push(i);
			D[i]=d=='R'?1:-1;
		}
		for(int time=0;c>0;time++)
		{
			int f=time%2,nf=f^1;
			for(int i=0;i<=L;i++)
			{
				while(!q[f][i].empty())
				{
					int p=q[f][i].front();q[f][i].pop();
					if(i+D[p]<0||i+D[p]>L)
					{
						c--;
						if(r<time)
						{
							r=time;
							ra=p+1;
						}
					}
					else
						q[nf][i+D[p]].push(p);
				}
			}
			for(int i=0;i<=L;i++)
			{
				if(q[nf][i].size()>1)
				{
					while(!q[nf][i].empty())
					{
						int p=q[nf][i].front();q[nf][i].pop();
						D[p]*=-1;
						w.push(p);
					}
					while(!w.empty())
					{
						q[nf][i].push(w.front());
						w.pop();
					}
				}
			}
		}
		printf("%d %d\n",r,ra);
	}
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

string A;

const int maxn = 100;
int freq[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> A;
    int n = A.length();
    for(int i = 0;i < n;i++){
        freq[A[i] - 'a']++;
    } 
    ll ans = 1;
    for(int i = 0;i < 26;i++){
        for(int j = i + 1;j < 26;j++){
            ans += 1LL * freq[i] * freq[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    int n;
    cin >> n;
    vector<double> v(n);
    FOR(i, 0, n)cin >> v[i];

    SORT(v);
    FOR(i, 1, n)v[i] = (v[i] + v[i - 1]) / 2;
    cout << v[n - 1] << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

char a[15][15];

int main() {
	int H, W;
	cin >> H >> W;
	for(int i=1;i<=H;i++)
		scanf("%s", a[i]+1);
	bool yes=1;
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++) {
			if(i==1 && j==1) {
				if( (a[i+1][j]=='#') + (a[i][j+1]=='#') != 1) yes=0;
				continue;
			}
			if(i==H && j==W) {
				if( (a[i-1][j]=='#') + (a[i][j-1]=='#') != 1) yes=0;
				continue;
			}
			if(a[i][j]!='#') continue;
			if( (a[i-1][j]=='#') + (a[i][j-1]=='#') != 1) yes=0;
			if( (a[i+1][j]=='#') + (a[i][j+1]=='#') != 1) yes=0;
			debug("yes %d\n", yes);
		}
	puts(yes?"Possible":"Impossible");
	return 0;
}


Measured memory_bytes: 256
s = input()
t = input()

ans = 1001001
for i in range(len(s)-len(t)+1):
    tmp_string = s[i:i+len(t)]
    if i == len(s) - len(t) - 1:
        tmp_string = s[i:]
    cnt = 0
    for j in range(len(t)):
        if t[j] != tmp_string[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)


Measured memory_bytes: 9060
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(ll i=(x);i<(y);i++)
#define disp(a) cout << a << endl;
typedef long long ll;
using namespace std;

double kitaichi(double A) {
	double B=0;
	fore(i, 1, A + 1) {
		B = B + i / A;
	}
	return B;
}

int main()
{
	ll A, B, K;
	vector<ll>ANS;
	cin >> A >> B >> K;
	for (ll i = 0; i < K;i++) {
		if (A + i <= B)ANS.push_back(A + i);
	}
	for (ll i = 0; i < K; i++) {
		if (B - K + i + 1 >= A)ANS.push_back(B - K + i +1);
	}
	sort(ANS.begin(), ANS.end());
	ANS.erase(unique(ANS.begin(), ANS.end()), ANS.end());
	for (ll i = 0; i < ANS.size(); i++) {
		cout << ANS[i] << endl;
	}
}

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

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

    for(int i = 0; i < N;i++){
        int x;
        cin >> x;
        if(x < K - x){
            distance += x;
        }
        else{
            distance += K - x;
        }
    }
    cout << 2 * distance  << endl;
}

Measured memory_bytes: 256
K, A, B = map(int,input().split())

if B - A <= 2 or K < A + 1:
  print(K+1)
else:
  cnt = A - 1
  bisket = 1 + cnt + (B - A) * ((K - cnt)//2)
  bisket += (K - cnt) % 2
  print(bisket)

Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;

map<int, int> prime_factor(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inverse(ll x) {
    return mod_pow(x, mod-2);
}

const int max_n = 200100;
ll fact[max_n];
ll fact_inv[max_n];
void calc_fact() {
    fact[0] = 1;
    for (ll i = 1; i < max_n; i++)
        fact[i] = (fact[i-1] * i) % mod;
    fact_inv[max_n-1] = mod_inverse(fact[max_n-1]);
    for (ll i = max_n-2; i >= 0; i--)
        fact_inv[i] = (fact_inv[i+1] * (i+1)) % mod;
}
ll mod_comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return (fact[n] * fact_inv[k] % mod) * fact_inv[n-k] % mod;
}
ll mod_perm(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return fact[n] * fact_inv[n-k] % mod;
}
ll mod_hom(ll n, ll k) {
    if (n == 0 && k == 0) return 1;
    return mod_comb(n+k-1, k);
}

ll solve() {
    calc_fact();
    map<int, int> pf = prime_factor(m);
    ll res = 1;
    for (const auto& a : pf) {
        res *= mod_hom(n, a.second);
        res %= mod;
    }
    return res;
}

void input() {
    cin >> n >> m;
}

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

    input();
    cout << solve() << endl;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

long long comb(long long n, long long r) {
    static vector<vector<ll>> memo(51, vector<ll>(51, -1));
    long long r_new = (r <= n/2) ? r : n-r;
    if (r_new < 0) return 0;
    if (r_new == 0) return 1;
    if (memo.at(n).at(r) != -1) return memo.at(n).at(r);
    else return memo.at(n).at(r) = (n-r_new+1) * comb(n, r_new-1) / r_new;
}

void solve() {
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    vector<int> a(n);
    for (int i=0; i<n; ++i) cin >> a.at(i);

    vector<int> free;
    for (int i=0; i<18; ++i) {
        int ss = s & (1<<i), tt = t & (1<<i);
        if (ss && !tt) {
            cout << 0 << '\n';
            return;
        }
        if (!ss && tt) {
            free.push_back(i);
            continue;
        }
        for (int j=0; j<n; ++j) {
            if ((a.at(j) & (1<<i)) != ss) {
                a.erase(a.begin()+j);
                --j;
                --n;
            }
        }
    }

    int d = (int)free.size();
    for (int i=0; i<n; ++i) {
        int tmp = 0;
        for (int j=0; j<d; ++j) if (a.at(i) & (1<<free.at(j))) tmp += (1<<j);
        a.at(i) = tmp;
    }

    ll res = 0;
    for (int bits=0; bits<(1<<d); ++bits) {
        int cnt = 0;
        for (int i=0; i<d; ++i) if (bits & (1<<i)) ++cnt;
        map<int, int> mp;
        for (int i=0; i<n; ++i) ++mp[bits & a.at(i)];
        ll sum = 0;
        for (auto p : mp) for (int i=1; i<=min(k, p.second); ++i) sum += comb(p.second, i);
        if (cnt%2 == 0) res += sum;
        else res -= sum;
    }
    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        if(a > b){
            System.out.println("a > b");
        }else if(a < b){
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
    }
}



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

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int cnt=1;
			while(in.hasNextInt()){
				int n = in.nextInt();
				if(n==0) break;
				int xs[] = new int[n], ys[] = new int[n];
				for(int i=0; i<n; i++){
					xs[i] = in.nextInt();
					ys[i] = in.nextInt();
				}
				int ans = 0;
				for(int i=0; i<n; i++){
					ans += get2Area(xs[i], ys[i], xs[(i+1)%n], ys[(i+1)%n]);
				}
				System.out.printf("%d %.1f\n", cnt, Math.abs(ans/2.0));
				cnt++;
			}
	}
	
	private static int get2Area(int x1, int y1, int x2, int y2){
		return x2*y1 - x1*y2;
	}
}

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

int main(){
    int n;
    cin>>n;
    
    vector<int> a(n);
    
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    
    
    long long sum = 0;
    

    for(int i=0;i<n;i++){
        sum = sum + a[i];
    }
    
    cout<<a[0]<<" "<<a[n-1]<<" "<<sum<<endl;
}


Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
ll n;
ll t[108], v[108], s[108], p[40008];

int main() {
	cin >> n;
	s[0] = 0;
	for(ll i = 1; i <= n; i++){cin >> t[i]; t[i] *= 2; s[i] = s[i-1]+t[i];}
	v[0] = 0; v[n+1] = 0;
	for(ll i = 1; i <= n; i++){cin >> v[i]; v[i] *= 2;}
	for(ll i = 0; i <= s[n]; i++){
		for(ll j = 1; j <= n; j++){if(s[j] >= i){p[i] = v[j]; break;}}
		for(ll j = 0; j <= n; j++){
			ll dist = abs(s[j]-i);
			p[i] = min(p[i], dist+min(v[j], v[j+1]));
		}
	}
	ll sum = 0;
	for(ll i = 0; i <= s[n]; i++){sum += p[i];}
	cout << fixed << setprecision(15) << (double)sum/4;
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

    	Scanner scanner=new Scanner(System.in);

    	int n =scanner.nextInt();

    	int pow=1;


    	while(true) {

    		if(n>=pow*2) {
    			pow*=2;
    		}else {
    			break;
    		}

    	}


    	System.out.println(pow);

    	scanner.close();


    }

}

Measured memory_bytes: 21844
n = int(input())
scope = []
for _ in range(n):
    x, l = map(int, input().split())
    scope.append([x+l, x-l])
    
scope.sort()
ans = 1
border = scope[0][0]
for i, r in enumerate(scope[1:]):
    if border <= r[1]:
        ans += 1
        border = r[0]
print(ans)


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

using ll = long long;
using pii = pair<ll, ll>;

ll H, W, N;
ll A[111111], B[111111];
set<pii> coord, S; // 入力座標, 入力座標の周辺座標
ll ans[100];

// 黒マス周辺の9座標をsetに格納する
void make(ll y, ll x) {
   for (ll i = -2; i <= 0; i++) {
      for (ll j = -2; j <= 0; j++) {
         ll ny = y + i, nx = x + j;
         if (ny >= 1 && ny <= H-2 && nx >= 1 && nx <= W-2) {
            S.insert({ny, nx});
         }
      }
   }
}

int main() {
   cin >> H >> W >> N;
   for (int i = 0; i < N; i++) {
      cin >> A[i] >> B[i];
      coord.insert({A[i], B[i]});
      make(A[i], B[i]);
   }

   ll white = (H-2) * (W-2);
   for (pii p : S) {
      ll y = p.first, x = p.second;
      int cnt = 0;
      for (ll i = y; i < y+3; i++) {
         for (ll j = x; j < x+3; j++) {
            if (coord.find({i, j}) != coord.end()) {
               cnt++;
            }
         }
      }
      if (cnt) white--;
      ans[cnt]++;
   }

   ans[0] = white;
   for (int i = 0; i <= 9; i++) {
      cout << ans[i] << endl;
   }


   return 0;
}

Measured memory_bytes: 64256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define vii vector<int>
#define vll vector<long long>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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 dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    vii a(n+2);
    int sum = 0;
    a[0] = a[n+1] = 0;
    erep(i, 1, n) cin >> a[i];
    sum = abs(a[1]) + abs(a[n]);
    erep(i, 1, n-1) sum += abs(a[i+1] - a[i]);
    erep(i, 1, n) {
        // cout << sum << endl;
        cout << sum - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1]) << endl;
    }
    return 0;
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;



int main()
{
    int n;
    cin >> n;
    vector<vector<pair<int, int> > > node(n);
    vector<int> ans(n,-1);
    for(int i = 0; i < n-1; i++){
        int u,v,w;
        cin >> u >> v >> w;
        u--; v--;
        node[u].push_back(make_pair(v,w));
        node[v].push_back(make_pair(u,w));
    }
    ans[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int top = q.front();
        q.pop();
        for(auto p : node[top]){
            if(ans[p.first] != -1) continue;
            if(p.second % 2 == 0){
                ans[p.first] = ans[top];
                q.push(p.first);
            }else{
                ans[p.first] = ans[top] + 1;
                q.push(p.first);
            }
        }
    }
    for(int i : ans){
        cout << i % 2 << endl;
    }
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集 

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

    int N; cin >> N;
    vector<ll> a(N);

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

    ll ans = 0;

    ll now = 1000;
    ll kabu = 0;
    int idx = 0;
    while(1){
        for(int j=idx+1; j<N; j++){
            if(a[idx] < a[j]){
                kabu += now/a[idx];
                now -= kabu * a[idx];
                now += kabu * a[j];
                kabu = 0;
                idx++;
                break;
            }else{
                idx++;
                break;
            }
        }
        if(idx >= a.size()-1) break;
    }
    cout << now << endl;


    return 0;
}


Measured memory_bytes: 3652
N, M = map(int, input().split())
X = [N] * M
for i in range(N):
  tmp = list(map(int, input().split()))
  for j in range(tmp[0]):
    X[tmp[j+1]-1] -= 1

cnt = 0
for x in X:
  if x == 0:
    cnt += 1

print(cnt)


Measured memory_bytes: 3060
#include <math.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
int main(){
	int n,m,k[11],s[11][11]={0},p[11],ans=0,all[11];
	scanf("%d%d",&n,&m);
	rep(i,m){
		scanf("%d",&k[i]);
		rep(j,k[i])scanf("%d",&s[i][j]);
	}
	rep(i,m)scanf("%d",&p[i]);
	rep(i,pow(2,n)){	//2進数全探索
		Rep(j,1,n+1)all[j]=(i%(int)pow(2,j))/pow(2,j-1);
		int flag=0;
		rep(j,m){
			int P=0;
			rep(l,k[j])if(all[s[j][l]])P++;
			if(P%2==p[j])flag++;
		}
		if(flag==m)ans++;
	}
	printf("%d",ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return x * m % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    // const int N = 52;
    int n; cin >> n;
    vector<string> s;
    REP(i,2) {
        string x;
        cin >> x;
        s.push_back(x);
    }

    int ans = 1;
    int x = 0;
    while(x < s[0].size()) {
        int mul = 0;
        if (x == 0) {
            if (s[0][0] == s[1][0]) {
                mul = 3;
                x += 1;
            }
            else {
                mul = 6;
                x += 2;
            }
        } else {
            if (s[0][x] == s[1][x]) {
                // tate
                if (s[0][x-1] == s[1][x-1]) mul = 2;
                else mul = 1;
                x += 1;
            } else {
                // yoko
                if (s[0][x-1] == s[1][x-1]) mul = 2;
                else mul = 3;
                x += 2;
            }
        }

        //cerr << s[y][x] << " " << mul << endl;
        ans = modm(ans,mul);
        //cerr << ans << endl;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}


int main()
{
	ios_init();
	int m, n;
	while(cin >> n >> m) {
		if(m >= (1<<n)) {
			cout << -1 << endl;
		} else {
			if(n == 1) {
				if(m == 0) {
					cout << "0 0 1 1" << endl;
				} else {
					cout << -1 << endl;
				}
			} else {
				cout << m << ' ';
				REP(i, 1<<n) {
					if(m != i) {
						cout << i << ' ';
					}
				}
				cout << m << ' ';
				RREP(i, 1<<n) {
					if(m != i) {
						cout << i << ' ';
					}
				}
				cout << endl;

			}
		}	
	}

	return 0;
}


Measured memory_bytes: 1792
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    int K;
    cin >> s;
    cin >> K;

    int n = s.length();

    vector<string> S;
    for (int l = 1; l <= K; ++l) {
        for (int i = 0; i + l <= n; ++i) {
            string ss = s.substr(i, l);
            S.push_back(ss);
        }
    }
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());

    cout << S[K - 1] << '\n';

    return 0;
}

Measured memory_bytes: 1660
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let iter = buf.split_whitespace();
    let mut v: Vec<T> = Vec::new();
    for i in iter {
        v.push(i.parse().ok().unwrap());
    }
    v
}

fn main() {
    let mut cnt = 0_u64;
    let v:Vec<i64> = procon_read();
    let n = v[0];
    let d = v[1]*v[1];
    for i in 0..n {
        let v:Vec<i64> = procon_read();
        if v[0]*v[0] <= d - v[1]*v[1]  {
            cnt+=1;
        }
    }
    println!("{}", cnt);
}

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

int main(){
  int D, G, min;
  cin >> D >> G;
  min = D * 100;
  
  vector<int> p(10,0),c(10,0);
  for(int i=0;i<D;i++){
    cin >> p.at(i) >> c.at(i);
  }
  
  for(int tmp=0;tmp < (1 << 10);tmp++){
    bitset<10> x(tmp);
    int q=0, score=0;
    
    for(int i=0;i<D;i++){
      if(x.test(i)){
        score += (i+1) * 100 * p.at(i) + c.at(i);
        q += p.at(i);
      }
    }
    
    for(int i=0;i<D;i++){
      if(!(x.test(D-1-i))){
        int count=0;
        while((score < G) && (count < (p.at(D-1-i)))){
          score += 100 * (D-i);
          q++;
          count++;
        }
      }
    }
    
    if(q < min)
      min = q;
  }
  
  cout << min << endl;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main(){
char s[1000];
while(cin.getline(s,1000)){
for(int i=0;s[i]!='\0';i++){
if(((s[i]-s[i+1]+26)%26=='t'-'h')&&(((s[i+1]-s[i+2]+26)%26==('h'-'e'+26)%26)||(((s[i+1]-s[i+2]+26)%26==('h'-'i'+26)%26)&&((s[i+2]-s[i+3]+26)%26==('i'-'s'+26)%26))||(((s[i+1]-s[i+2]+26)%26==('h'-'a'+26)%26)&&((s[i+2]-s[i+3]+26)%26==('a'-'t'+26)%26)))){
for(int j=0;s[j]!='\0';j++){
if((s[j]!=' ')&&(s[j]!='.')&&(s[j]!='\n')){
putchar((s[j]+'t'-s[i]-'a'+26)%26+'a');
}else{
putchar(s[j]);
}
}cout<<endl;
break;
}
}
}
return 0;
}

Measured memory_bytes: 1112
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
i = int(arr_data[0][1])

print(n-i+1)


Measured memory_bytes: 2940
import sys
n = int(input())
A = [int(i) for i in input().split()]
mx = 10**18
if 0 in A:
    print(0)
    sys.exit(0)
p = 1
for a in A:
    if p * a <= mx:
        p *= a
    else:
        print(-1)
        sys.exit(0)
print(p)

Measured memory_bytes: 21432
#include <cstdio>
typedef long long lint;
const int N=15;
const int mod=1e9+7;
int n,m,nxt[N],dp[1<<N],cbit[1<<N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

template <class T> inline int fpow(int x,T t){
	int ans=1;
	for(; t; x=(lint)x*x%mod,t>>=1){
		if(t&1) ans=(lint)ans*x%mod;
	}
	return ans;
}

int main(){
	n=nxi(),m=nxi();
	for(int i=1; i<=m; ++i){
		const int a=nxi()-1,b=nxi()-1;
		nxt[a]|=1<<b;
	}
	for(int i=1; i<1<<n; ++i){
		cbit[i]=cbit[i>>1]+(i&1);
	}
	dp[3]=1;
	for(int i=4; i<1<<n; ++i){
		if((i&1)!=(i>>1&1)) continue;
		dp[i]=1;
		for(int j=(i-1)&i; j; j=(j-1)&i){
			if((j&1)!=(j>>1&1)) continue;
			const int p=i^j;
			int ws=dp[j],wt=1;
			for(int k=0; k<n&&ws; ++k){
				if(j>>k&1){
					ws=ws*((1ll<<cbit[nxt[k]&p])-1)%mod;
				}
				if(p>>k&1){
					wt=wt*(1ll<<cbit[nxt[k]&j])%mod;
				}
			}
			dp[i]=(dp[i]+(lint)ws*wt)%mod;
		}
	}
	printf("%d\n",(fpow(2,m)-dp[(1<<n)-1]+mod)%mod);
	return 0;
}


Measured memory_bytes: 384
# 23:05-
n, h = gets.to_s.split.map{|t|t.to_i}

a_max = 0
b = []
n.times do |i|
  a, t = gets.to_s.split
  a = a.to_i
  a_max = a if a_max < a
  b << t.to_i
end

b.sort!
b.reverse!

idx = b.bsearch_index{ |t| t <= a_max } || n

b[0, idx].each_with_index do |t, i|
  
  h -= t
  
  if h <= 0
    puts i + 1
    exit
  end
end

puts idx + ( h + a_max - 1 ) / a_max

Measured memory_bytes: 3704
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define deb1(x) cout<<#x<<" :: "<<x<<"\n";
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
ll mod=1000000007;

int main(){
     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<n;i++){
		ll a=n/i;
		if(n%i==0)
			a--;
		ans+=a;
		}
	cout<<ans<<endl;
	
	 }
	 			
	 
	
	 			


			
		
			
			
	
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			
	
			
	
	

	
				
	











Measured memory_bytes: 3688
S = input()
MOD = 10**9 + 7

A = 0
AB = 0
ABC = 0
prd = 1

for s in S:
    if s == 'A':
        A += prd
    elif s == 'B':
        AB += A
    elif s == 'C':
        ABC += AB
    else:
        a = A * 3 + prd
        ab = AB * 3 + A
        abc = ABC * 3 + AB
        A, AB, ABC = a, ab, abc
        prd *= 3
    A %= MOD
    AB %= MOD
    ABC %= MOD
    prd %= MOD

print(ABC)


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

string s, t;

int main(){
	cin >> s >> t;
	if (s.size() < t.size()) {
		return 0;
	}
	for (int i = 0; i < s.size() - t.size() + 1; i++) {
		for (int j = 0; j < t.size(); j++) {
			if (s[i + j] != t[j]) {
				break;
			}
			if (j == t.size() - 1 && s[i + j] == t[j]) {
				cout << i << endl;
			}
		}
}
	return 0;
}

Measured memory_bytes: 3172
if __name__ == '__main__':
    str_buttons = input().split()
    buttons = [int(str_buttons[0]), int(str_buttons[1])]

    answer = 0
    for i in range(2):
        answer += max(buttons)
        bi = buttons.index(max(buttons))
        buttons[bi] -= 1

    print(answer)

Measured memory_bytes: 3060
N, L = map(int, input().split())

# 1/2 * N * (L + L+N-1)
value = L*N + N *(N-1)//2

if L <= 0 <= L+N-1:
    None
elif L > 0:
    value -= L
elif L+N-1 < 0:
    value -= L+N-1

print(value)


Measured memory_bytes: 3064
#define mod 1000000007
char buf[30];sz;
char out[10];osz=10;
int N,K;
long F[2<<17],I[2<<17];
long p(long a,long b){
	long ret=1;
	while(b)
	{
		if(b&1)ret=ret*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return ret;
}
main()
{
	read(0,buf,30);
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		N=N*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		K=K*10+c-'0';
	}
	F[0]=1;
	for(int i=1;i<=N;i++)F[i]=F[i-1]*i%mod;
	I[N]=p(F[N],mod-2);
	for(int i=N;i--;)I[i]=I[i+1]*(i+1)%mod;
	long ans=0;
	for(long i=0;i<N&&i<=K;i++)
	{
		ans+=F[N]*F[N-1]%mod*I[N-i]%mod*I[i]%mod*I[N-1-i]%mod*I[i]%mod;
	}
	ans%=mod;
	do{
		out[--osz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+osz,10-osz);
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main()
{   
    int a,b,c,d,e,f;
    cin>>a>>b>>c;
    d=a+b;
    e=a+c;
    f=b+c;
    cout<<min(d,min(e,f));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

int main(){
	int n,m;
	cin>>n;
	vi c(n);
	rep(i,n) cin>>c[i];
	int sum=accumulate(all(c),0);
	cin>>m;
	rep(i,m){
	    int p,x;
	    cin>>p>>x;
	    cout<<sum+x-c[p-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
V = list(map(int, input().split()))

s = 0
for i in range(min(K, N)+1):
    res = K - i
    for j in range(i+1):
        k = i - j

        Q = sorted(V[:j] + V[N-k:])
        minus = sum([q < 0 for q in Q])
        score = sum(Q[min(minus, res):])
        s = max(s, score)

print(s)


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

int main() {
	int N, d[110];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	set<int> values;
	for (int i = 0; i < N; i++) {
		values.insert(d[i]);
	}
	cout << values.size() << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+1;
int main()
{
	int flag=0;
	int sum1=0;
	int n,m;
	int i,arr[200005];
	int brr[200005];
	memset(brr,0,sizeof(brr));
	int  sum=0;
	scanf("%d",&n);
	for(i=0;i<n-1;i++)
	{
		scanf("%d",&arr[i]);
		if(arr[i]==1)
		sum++;
		else
		brr[arr[i]]++;
	}
	printf("%d\n",sum);
	for(int j=2;j<=n;j++)
	{
		printf("%d\n",brr[j]);
	}
}  


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

int main(void){

    unsigned long long x,y;
    cin >> x >> y;
    unsigned long long temp = x;
    int cnt = 0;
    while (temp <= y)
    {
        temp *= 2;
        cnt++;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...)                                                             \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        int n, m;
        cin >> n >> m;
        int ans = 0;
        if (n >= 2)
            ans += n * (n - 1) / 2;
        if (m >= 2)
            ans += m * (m - 1) / 2;
        cout << ans << '\n';
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256
import datetime

def checkDay(m, d):
    takahashis = [
        datetime.datetime(2018,1,1,0,0),
        datetime.datetime(2018,2,2,0,0),
        datetime.datetime(2018,3,3,0,0),
        datetime.datetime(2018,4,4,0,0),
        datetime.datetime(2018,5,5,0,0),
        datetime.datetime(2018,6,6,0,0),
        datetime.datetime(2018,7,7,0,0),
        datetime.datetime(2018,8,8,0,0),
        datetime.datetime(2018,9,9,0,0),
        datetime.datetime(2018,10,10,0,0),
        datetime.datetime(2018,11,11,0,0),
        datetime.datetime(2018,12,12,0,0)
    ]

    tgt = datetime.datetime(2018,m,d,0,0)
    res = 0
    for dt in takahashis:
        if dt <= tgt:
            res += 1
    return res

m, d = map(int, input().split())
res = checkDay(m, d)
print (res)

Measured memory_bytes: 3404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

map<ll, int> prime_factor(ll n){
	map<ll, int> res;
	for(ll i = 2; i*i<=n; i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1) res[n]++;
	return res;
}


int main(){
    ll n;
    cin >> n;
    auto mp = prime_factor(n);
    int ans = 0;
    for(auto p : mp) {
        int cnt = 0;
        int now = p.second;
        while(now - (cnt+1) >= 0) {
            now -= cnt+1;
            cnt++;
        }
        ans += cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
n = int(input())
arr = []
for i in range(n):
    a = list(map(ord,list(input())))
    arr.append(a)


ans = 0

for i in range(n):
    ok = True
    for j in range(n):
        for k in range(n):
            if j == k:
                continue
            l = j + i
            if l > n-1:
                l = l-n

            m = k + i
            if m > n-1:
                m = m-n
            # print(l,k,i)
            # print(arr[l][k],arr[k][l])
            if arr[l][k] != arr[m][j]:
                ok = False
                break

    # print("####")
    if ok:
        ans += n



print(ans)

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
  	for(int i=1;i<=b;++i){
    	if(i*a%b==c){cout<<"YES"<<endl;return 0;}
    }
  	cout<<"NO"<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  int n,m,x; cin>>n>>m>>x;
  int cost[n]; int a[n][m];
  rep(i,n){
    cin>>cost[i];
    rep(j,m){
      cin>>a[i][j];
    }
  }
  int powerof2[n];
  powerof2[0]=1;
  rep1(i,n){
    powerof2[i]=2*powerof2[i-1];
  }
  int ans=INF;
  for(int y=0;y<2*powerof2[n-1];y++){
    int rikai[m]={}; int money=0;
    rep(i,n){
      if((y&powerof2[i])!=0){
        money+=cost[i];
        rep(j,m){
          rikai[j]+=a[i][j];
        }
      }
    }
    int f=1;
    rep(i,m){
      if(rikai[i]<x){
        f=0;
      }
    }
    if(f==1){
      ans=min(ans,money);
    }
  }
  if(ans==INF){
    cout<<-1;
  }else{
    cout<<ans;
  }
}


Measured memory_bytes: 3628
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  int X[N];
  for(int i=0;i<N;++i) cin>>X[i];
  int point;
  int ans = inf;
  int tmpans;
  for(int i=0;i<=100;++i) {
    point = i;
    tmpans = 0;
    for(int j=0;j<N;++j) {
      tmpans += pow((X[j]-point), 2);
    }
    ans = min(ans, tmpans);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3636
#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, lint b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
#line 2 "main.cpp"
int n;
std::string c;
int main(){
	std::cin>>n>>c;
	int rcount=0;
	rep(i,n){
		if(c[i]=='R')rcount++;
	}
	int ans=0;
	rep(i,rcount){
		if(c[i]=='W')ans++;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 3760