akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;
  V<ll> v(n);
  rep(i,0,n)cin>>v[i];
  ll ans=0;

  rep(i,0,n){
    if(v[i]%2 && i%2==0){
      ++ans;

    }
  }

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3608
N, M = map(int, input().split())
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

goukei = [[] for _ in range(8)]
sums = []
for i in range(1 << 3):
    ope = ['+', '+', '+']
    for j in range(3):
        if (i >> j) & 1:
            ope[j] = '-'
    for k in range(N):
        siki = '{}{}{}{}{}{}'.format(ope[0], x[k], ope[1], y[k], ope[2], z[k])
        goukei[i].append(eval(siki))
    goukei[i].sort()
    goukei[i].reverse()
    sums.append(sum(goukei[i][:M]))

print(max(sums))

Measured memory_bytes: 3528
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=1e6+5;
int n;
int a[MAXN],num[MAXN];
struct rec{
	int x,pos;
};
rec c1[MAXN],c2[MAXN];
bool comp(const rec &x,const rec &y){
	return x.x>y.x;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]); num[i]=a[i];
	}
	sort(num+1,num+1+n);
	int nn=unique(num+1,num+1+n)-num-1;
	for (int i=1;i<=n;++i) a[i]=lower_bound(num+1,num+1+nn,a[i])-num;
	for (int i=1;i<=n;++i){
		c1[i].pos=i; c2[i].pos=i;
	}
	for (int i=1;i<=n;++i)
		if (i%2==1) ++c1[a[i]].x; else ++c2[a[i]].x;
	
	sort(c1+1,c1+1+n,comp); sort(c2+1,c2+1+n,comp);
	if (c1[1].pos==c2[1].pos) printf("%d",min(n-c1[1].x-c2[2].x,n-c1[2].x-c2[1].x)); else printf("%d",n-c1[1].x-c2[1].x);
}

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

using namespace std;

const int MX = 200000;

int a[MX], n;

bool check(int k) {
	vector<pair<int, int>> last = {{1, a[0]}};
	int len = a[0];
	for (int i = 1; i < n; i++) {
		if (len < a[i]) {
			last.emplace_back(1, a[i] - len);
			len = a[i];
			
			continue;
		}
		
		while (len - last.back().second >= a[i]) {
			len -= last.back().second;
			last.pop_back();
		}
		
		last.back().second -= len - a[i];
		len = a[i];
		
		while (len > 0 && last.back().first == k) {
			len -= last.back().second;
			last.pop_back();
		}
		
		if (len == 0) return false;
		
		int c = last.back().first;
		last.back().second--;
		if (last.back().second == 0) last.pop_back();
		last.emplace_back(c + 1, 1);
		if (len != a[i]) {
			last.emplace_back(1, a[i] - len);
			len = a[i];
		}
	}
	
	return true;
}

int main() {
	ignore = scanf("%d", &n);
	for (int i = 0; i < n; i++) ignore = scanf("%d", a + i);

	int ans = 0;
	for (int p = (1 << 20); p > 0; p /= 2) {
		if (check(ans + p) == false) {
			ans += p;
		}
	}
	
	printf("%d\n", ans + 1);
	
	return 0;
}


Measured memory_bytes: 4692
#include<bits/stdc++.h>
using namespace std;
int n,res=0;
int wwq(int aa)
{
	int a=aa,ans=0;
	a*=10;
	a+=1;
	while(a)
	{
		a/=10;
		ans++;
	}
	if(ans%2) return false;
	else return true;
}
int main()
{
	cin>>n;
	for(int i=n;i>=1;i--)
		if(wwq(i)) res++;
	cout<<res;
	return 0;
}

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

namespace GuessTheNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputValue = Console.ReadLine().Split(' ');
            

            int contests = Convert.ToInt32(inputValue[0]);
            int displayRating = Convert.ToInt32(inputValue[1]);

            int innerRating = 0;
            if (contests < 10)
            {
                var temp = 100 * (10 - contests);
                innerRating = displayRating + temp;
            }
            else
            {
                innerRating = displayRating; 
            }

            Console.WriteLine(innerRating);
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
	if(a+b+c+d==7) cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";
	else if(a-b+c+d==7) cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";
	else if(a+b-c+d==7) cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";
	else if(a+b+c-d==7) cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";
	else if(a-b-c+d==7) cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";
	else if(a+b-c-d==7) cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";
	else if(a-b+c-d==7) cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";
	else if(a-b-c-d==7) cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";
	
			
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	double r,g;
	cin>>r>>g;
	cout<<2*g-r<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    ll a,b,k; cin>>a>>b>>k;
    ll x = a-k;
    ll y = b+x;
    if (y<0) y=0;
    else if (y>b) y=b;
    cout << max(x,0ll) << ' ' << y << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int h,w,n,a[10005]={};
  cin >> h >> w >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  int c[100][100]={},k=1;
  for(int i=0; i<h; i++) {
    if(i%2==0) {
      for(int j=0; j<w; j++) {
        c[i][j]=k;
        a[k-1]--;
        if(a[k-1]==0) {
          k++;
        }
      }
    }
    else {
      for(int j=w-1; j>=0; j--) {
        c[i][j]=k;
        a[k-1]--;
        if(a[k-1]==0) {
          k++;
        }
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w-1; j++) {
      cout << c[i][j] << " ";
    }
    cout << c[i][w-1] << endl;
  }
}

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

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

  int p[n];

  rep(i,n) cin >> p[i];

  sort(p,p+n);
int sum =0;
  for(int i=0;i<k;i++){
   sum += p[i];
  }

  cout << sum << endl;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

k = int(input())
ans = []
def dfs(string):
  if int(string) > 3234566667: return
  ans.append(int(string))
  botom = string[-1]
  intbotom = int(botom)
  if 0 <= intbotom -1 :
    dfs(string + str(intbotom-1))
  dfs(string+botom)
  if intbotom + 1 <= 9:
    dfs(string + str(intbotom+1))
for i in range(1,10):
  dfs(str(i))
ans .sort()

print(ans[k-1])

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


int main() {
	int X;
	cin >> X;

	if (X < 600) {
		cout << 8 << endl; return 0;
	}

	if (X < 800) {
		cout << 7 << endl; return 0;
	}

	if (X < 1000) {
		cout << 6 << endl; return 0;
	}

	if (X <1200) {
		cout << 5 << endl; return 0;
	}

	if (X < 1400) {
		cout << 4 << endl; return 0;
	}

	if (X < 1600) {
		cout << 3 << endl; return 0;
	}

	if (X < 1800) {
		cout << 2 << endl; return 0;
	}

	cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 3160
Imports System
Module Module1

    Sub Main()
        Dim str = Console.ReadLine().Replace(vbNewLine, "")
        Dim sep = "BDEFHIJKLMNOPQRSUVWXYZ".ToCharArray()
        Dim separate = str.Split(sep, 10, StringSplitOptions.RemoveEmptyEntries)
        Dim len As Integer = 0
        For Each item As String In separate
            If len < item.Length Then len = item.Length
        Next
        Console.WriteLine(len)
        Return
    End Sub

End Module

Measured memory_bytes: 13780
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
//#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m,t;
	cin>>n>>m>>t;
	vi in(t+1);
	rep(i,n){
		int a;cin>>a;
		in[max(0,a-m)]++;
		in[min(t,a+m)]--;
	}
	rep(i,t-1)in[i+1]+=in[i];
//	rep(i,t)cout<<" "<<in[i];cout<<endl;
	int co=0;
	rep(i,t)if(in[i]==0)co++;
	cout<<co<<endl;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<63;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    ll N; cin >> N;
    vector<pair<ll,ll>> p(N); REP(i,N) cin >> p[i].second >> p[i].first;
    SORT(p);

    ll cur = 0;
    REP(i,N){
        if(cur + p[i].second <= p[i].first) cur += p[i].second;
        else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll x;
  cin >> x;
  ll ans = x/11;
  if(x%11==0){
    cout << ans*2;
  }else if(x%11<=6){
    cout << ans*2+1;
  }else{
    cout << ans * 2 + 2;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define pii pair<int, int>
#define plli pair <lli, lli>
#define F(i,n) for(lli (i)=0;(i)<(n);(i)++)
#define FR(i,n) for(lli (i)=(n)-1;(i)>=0;(i)--)
#define FSG(i,a,b) for(lli (i)=(a);(i)<(b);(i)++)
#define FSGR(i,a,b) for(lli (i)=(b)-1;(i)>=(a);(i)--)
#define VAL(n) cout << n << endl;
#define VALD(n) cout << #n << ": " << n << endl;

int main(){
  int N, D;
  cin >> N >> D;
  int x[N][D];
  F(i, N){
    F(j, D){
      cin >> x[i][j];
    }
  }
  int cnt = 0;
  F(i, N-1){
    FSG(j, i+1, N){
      double dist = 0.0;
      F(k, D){
        dist+=(x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
      }
      dist = sqrt(dist);
      if(ceil(dist) == floor(dist)){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, x, ans;
string s;

int main() {
	cin >> n >> s;
	rep(i,n) {
		if (s[i]=='I') x++;
		else x--;
		chmax(ans, x);
	}
	cout << ans << ln;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)

bool func(ll tmp, vector<ll>a, ll k, ll n) {
	ll log=0;
	rep(i, n) {
		log += (a[i]-1) / tmp;
		if (log >k) {
			return false;
		}
	}
	return true;

}


//小文字=大文字+32
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	ll wa = 0;
	ll ac = pow(10,9);
	ll tmp;
	rep(i, n) {
		cin >> a[i];
	}
	while (wa!= ac-1) {
		tmp = (ac + wa)/2;
		if (func(tmp,a,k,n)) {
			ac = tmp;

		}
		else {
			wa = tmp;
		}
	}
	cout << ac;

}
	



Measured memory_bytes: 6408
package main

import "fmt"

var mod int = 1000000007
var a []int
var memo [100001]int
var cnt int

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	
	a = make([]int, N+1)
	var bef int = -1;
	
	for i := 0; i < M; i++ {
		var t int
		fmt.Scan(&t)
		if t == bef + 1{
			fmt.Println(0); return;
		}
		a[t] = 1
		bef = t
	}
	
	memo[0] = 1; 
	fmt.Println(dfs(N))
}
func dfs(n int) int {
	if n < 0 || a[n] == 1 { 
		return 0
	}
	if memo[n] != 0 {
		return memo[n]
	}

	//cnt++;
	//fmt.Println(cnt,n)
	memo[n] = (dfs(n-1) + dfs(n-2)) % mod
	return memo[n]
}


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

int main(){
  int r,g,b,n;
  cin >> r >> g >> b >>n;
  int ans = 0;

  for (int i = 0; i*r <=n; i++)
  {
    for (int j = 0; i*r + j*g <=n; j++)
    {
        if((n-i*r-j*g)%b == 0) ans++;
    }
  }

  cout << ans << endl;
  
}

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

int main() {
	int q; cin >> q; int temp_1, temp_2, temp_3; deque<int> dq;
	for (int i = 0; i < q; i++) {
		cin >> temp_1;
		switch (temp_1) {
		case 0:
			cin >> temp_2 >> temp_3;
			if (temp_2 == 0) dq.push_front(temp_3);
			if (temp_2 == 1) dq.push_back(temp_3);
			break;
		case 1:
			cin >> temp_2; cout << dq[temp_2] << endl; break;
		case 2:
			cin >> temp_2; 
			if (temp_2 == 0) dq.pop_front();
			if (temp_2 == 1) dq.pop_back();
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 4548
/// 1:28 AM 29/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> v(4);
    for (ll i = 0; i < n; i++) {
        ll x;
        cin >> x;
        v[x]++;
    }
    vector<vector<vector<ld> > > dp(n + 1,
                                    vector<vector<ld> >(n + 1,
                                                        vector<ld>(n + 1, 0.0)));
    for (ll k = 0; k <= n; k++) {
        for (ll j = 0; j <= (n); j++) {
            for (ll i = 0; i <= (n); i++) {
                ld ans = 0.0;
                ld c = i + j + k;
                if (i == 0 && j == 0 && k == 0) {
                    continue;
                }
                if ((i + j + k) > n) {
                    continue;
                }
                ld one = i;
                ld two = j;
                ld three = k;
                ld p1 = (one / c);
                ld p2 = (two / c);
                ld p3 = (three / c);
                ld moves = (1.0 * n) / c;
                if (i > 0) {
                    ans += p1 * (moves + dp[i - 1][j][k]);
                }
                if (j > 0) {
                    ans += p2 * (moves + dp[i + 1][j - 1][k]);
                }
                if (k > 0) {
                    ans += p3 * (moves + dp[i][j + 1][k - 1]);
                }
                dp[i][j][k] = ans;
            }
        }
    }
    cout << fixed << setprecision(10) << dp[v[1]][v[2]][v[3]];
    return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        String s = in.ns();
        out.println(s.substring(0, 3));
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 32784
n = int(input())

a = list(map(int, input().split()))

c = 0
k = 1
while True:
	for i in range(n):
		if a[i]%2 != 0:
			k = 0
			break
		else:
			a[i] = a[i]/2
	if k == 1:
		c += 1
	else:
		break

print(c)


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

int main() {
    int n;
    cin >> n;
    int64_t ans = 0;
    for(int i = 1; i <= n; i++){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<int> a(n);
    ll sum=0;
    ll cnt=0;
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
        sum +=a[i];
        if(i%2==0 && sum<=0) {
            cnt+=(1-sum);
            sum=1;
        }
        else if(i%2==1 && sum>=0) {
            cnt+=(sum+1);
            sum=-1;
        }
    }
    ll ans=cnt;

    sum=0;
    cnt=0;
    for(i=0; i<n; i++) {
        sum +=a[i];
        if(i%2==1 && sum<=0) {
            cnt+=(1-sum);
            sum=1;
        }
        else if(i%2==0 && sum>=0) {
            cnt+=(sum+1);
            sum=-1;
        }
    }
    ans = MIN(ans, cnt);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

int main(){

  double r;
  
  scanf("%lf",&r);
    printf("%lf %lf\n",M_PI*r*r,2*r*M_PI);
  //  printf("%lf %lf\n",3.1415926535*r*r,2*r*3.1415926535);
  return 0;
}

Measured memory_bytes: 648
//This program is written by Brian Peng.
#pragma GCC optimize("Ofast","inline","no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define Rd(a) (a=read())
#define Gc(a) (a=getchar())
#define Pc(a) putchar(a)
int read(){
	int x;char c(getchar());bool k;
	while(!isdigit(c)&&c^'-')if(Gc(c)==EOF)exit(0);
	if(c^'-')k=1,x=c&15;else k=x=0;
	while(isdigit(Gc(c)))x=(x<<1)+(x<<3)+(c&15);
	return k?x:-x;
}
void wr(int a){
	if(a<0)Pc('-'),a=-a;
	if(a<=9)Pc(a|'0');
	else wr(a/10),Pc((a%10)|'0');
}
signed const INF(0x3f3f3f3f),NINF(0xc3c3c3c3);
long long const LINF(0x3f3f3f3f3f3f3f3fLL),LNINF(0xc3c3c3c3c3c3c3c3LL);
#define Ps Pc(' ')
#define Pe Pc('\n')
#define Frn0(i,a,b) for(int i(a);i<(b);++i)
#define Frn1(i,a,b) for(int i(a);i<=(b);++i)
#define Frn_(i,a,b) for(int i(a);i>=(b);--i)
#define Mst(a,b) memset(a,b,sizeof(a))
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
int a,b,c; 
signed main(){
	Rd(a),Rd(b),Rd(c),wr(max(c-(a-b),0));
	exit(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

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

    char s[10000000]; long long sum=0;
    cin>>s;
    long long len=strlen(s);
    for(int i=0;i<len;i++)
    {
        long long x = s[i]-48;
        sum=sum+x;
    }
    if(sum%9==0)cout<<"Yes\n";
    else cout<<"No\n";


}


Measured memory_bytes: 3824
// C.cpp
#include <bits/stdc++.h>

using namespace std;

int n;
char buffer[1010][1010];

const char m3[3][4] =
    {"aa.",
     "..a",
     "..a"};

const char m4[4][5] =
    {"aabc",
     "ddbc",
     "bcaa",
     "bcdd"};

const char m5[5][6] =
    {"aabba",
     "bcc.a",
     "b..cb",
     "a..cb",
     "abbaa"};

const char m6[6][7] =
    {"aabc..",
     "ddbc..",
     "..aabc",
     "..ddbc",
     "bc..aa",
     "bc..dd"};

const char m7[7][8] =
    {"aabbcc.",
     "dd.dd.a",
     "..d..da",
     "..d..db",
     "dd.dd.b",
     "..d..dc",
     "..d..dc"};

void writeBuffer(int id, int x, int y)
{
    for (int i = 0; i < id; i++)
    {
        const char *str;
        switch (id)
        {
        case 3:
            str = m3[i];
            break;
        case 4:
            str = m4[i];
            break;
        case 5:
            str = m5[i];
            break;
        case 6:
            str = m6[i];
            break;
        case 7:
            str = m7[i];
            break;
        }
        for (int j = 0; str[j]; j++)
            buffer[x + i][y + j] = str[j];
    }
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            buffer[i][j] = '.';
    if (n <= 2)
        puts("-1"), exit(0);
    if (n <= 7)
        writeBuffer(n, 0, 0);
    else
    {
        int base = 0;
        writeBuffer(n % 4 + 4, base, base), base += n % 4 + 4;
        while (base < n)
            writeBuffer(4, base, base), base += 4;
    }
    for (int i = 0; i < n; i++)
        printf("%s\n", buffer[i]);
    return 0;
}

Measured memory_bytes: 4704
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int64_t T[2];
int64_t A[2];
int64_t B[2];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> T[0] >> T[1];
	in >> A[0] >> A[1]; A[0] *= T[0]; A[1] *= T[1];
	in >> B[0] >> B[1]; B[0] *= T[0]; B[1] *= T[1];

	if ((A[0] > B[0]) == (A[1] > B[1])) {
		out << 0 << endl;
		return 0;
	}
	if (A[0] > B[0]) {
		std::swap(A[0], B[0]);
		std::swap(A[1], B[1]);
	}
	if (A[0] + A[1] == B[0] + B[1]) {
		out << "infinity" << endl;
		return 0;
	}
	if (A[0] + A[1] < B[0] + B[1]) {
		out << 0 << endl;
		return 0;
	}

	auto diff = (A[0] + A[1]) - (B[0] + B[1]);
	auto res = ((B[0] - A[0]) / diff) * 2;
	if ((B[0] - A[0]) % diff) {
		res += 1;
	}
	out << res << endl;

	return 0;
}
#endif


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<random>
#include<stdio.h>
using namespace std;

typedef long long ll;

int main(){
 int N;
 cin>>N;
 vector<string> S(N);
 for (int i=0;i<N;i++){
     cin>>S[i];
 }
 int ans=0;
 for (int i=0;i<N;i++){
     int A=i;
     int B=0;
     int flag=0;
     for (int j=0;j<N;j++){
         for (int k=0;k<N;k++){
             if (S[(j+A)%N][(k+B)%N]!=S[(k+A)%N][(j+B)%N]){
                 flag=1;
             }
         }
     }
     if (flag==0){
         ans+=N;
     }
 }
 cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<int, int> P;


//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

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

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}


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

int main() {
ll m,n;
cin>>n>>m;

ll a[n+1];
double sum=0.0;
for(int i=1;i<=n;i++){
	cin>>a[i];
	sum+=(double)(a[i]+0.0);
}

ll cnt=0;
double k=1.0/(4.0*(double)(m+0.0))*sum;
for(int i=1;i<=n;i++){
if(a[i]>=k){cnt++;}
}

if(cnt>=m){cout<<"Yes"<<endl;}
else{cout<<"No"<<endl;}
return 0;




}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define v(x) vector<int> x;
#define all(x) x.begin(),x.end()
#define s(x,n) memset(x,n,sizeof(x));
#define pb(x) push_back(x)
ll gcd(ll m,ll n)
{
    if(n==0)
        return m;
    else
        return gcd(n,m%n);
}
using namespace std;
int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)/gcd(a,b)<<"\n";
}

Measured memory_bytes: 3556
# -*- coding: utf-8 -*-
import math

def main():
    N, M = map(int,input().split())
    A = list(map(int,input().split()))
    B = [[] for _ in range(40)]

    Bmax = 1
    for Ai in A:
        Bi = int(math.log2(Ai)) + 1
        B[Bi].append(Ai)
        Bmax = max(Bmax, Bi)

    while M >= 0 and Bmax > 0:
        B[Bmax].sort(key=lambda x:-x)
        count = len(B[Bmax])
        Bcur = min(M, count)
        for i in range(Bcur):
            B[Bmax][i] = B[Bmax][i] // 2 
            
        Bmax -= 1
        B[Bmax].extend(B[Bmax+1])
        B[Bmax+1] = []
        M -= count

    Total = 0
    for Bi in B:
        for Ai in Bi:
            Total += Ai

    print(Total)




if __name__ == "__main__":
    main()


Measured memory_bytes: 15028
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <string.h>
#define   FOR(i,n) for(int i=0;i<n;i++)

using namespace std;
int int_sort(const void*a,const void *b) {
    return *(  int *) b - *(int *) a;
    //qsort(b, a, sizeof(long long int), int_sort);
}

template<typename T>
istream& operator >>(istream& is, vector<T>& vec){
    for(T& x: vec) is >>x;
    return is;
}
int main() {
	int N,M,k,cnt=0;
	cin >> N >> M;
	int tmp;
	vector<int> flag(10000);
	FOR(i,N){
		cin>>k;
		FOR(m,k){
			cin>>tmp;
			flag[tmp-1]++;
		}
	}
	FOR(i,M){
		if(flag[i]==N)
			cnt++;
	}
	cout<<cnt;
	return 0;

}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

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

Measured memory_bytes: 3624
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>
using namespace std;
#define ran 111111
int N;
char s[ran];
int todo[ran];
typedef priority_queue<int,vector<int>,greater<int> > ves;
ves *q[ran];
ves Q[ran];

int val[ran * 4];
void build(int i,int s,int e){
	if(s==e){
		val[i] = todo[s];
		return;
	}
	int m = (s+e)/2;
	build(i*2,s,m);
	build(i*2+1,m+1,e);
}
void pus(int i){
	int&tmp = val[i];
	val[i*2] = (val[i*2] + tmp)%26;
	val[i*2+1] = (val[i*2+1] + tmp)%26;
	tmp = 0;
}
void inc(int i,int s,int e,int l,int r,int x){
	if(s == l && e == r){
		val[i] = (val[i] + x)%26;
		return;
	}
	pus(i);
	int m=(s+e)/2;
	if(r <= m)inc(i*2,s,m,l,r,x);else
		if(l>m)inc(i*2+1,m+1,e,l,r,x);else{
			inc(i*2,s,m,l,m,x);
			inc(i*2+1,m+1,e,m+1,r,x);
		}
}
int query(int i,int s,int e,int x){
	if(s == e)return val[i];
	pus(i);
	int m=(s+e)/2;
	if(x<=m)return query(i*2,s,m,x);
	return query(i*2+1,m+1,e,x);
}

void merge(ves*big,ves*small){
	while(!small->empty()){
		int x = small->top();
		small->pop();
		big->push(x);
	}
}

int main(){
	scanf("%s",s+1);
	int n = strlen(s+1), m;
	N = n/2;
	for(int i=1, j=n; i<=N; i++,j--){
		todo[i] = (s[j] - s[i] + 26)%26;
		q[i] = &Q[i];
	}
	build(1,1,N);
	for(scanf("%d",&m); m--;){
		int st, en;
		scanf("%d%d",&st,&en);
		if(en > N){
			if(st > N){
				st = n+1 - st;
				en = n+1 - en;
				swap(st, en);
			}else{
				en = n+1 - en;
				if(st > en)swap(st, en);
				--en;
			}
		}
		if(en > N)--en;
		if(st > en)continue;
		q[st]->push(en);
	}
	for(int i=1; i<=N; i++){
		int xx = query(1,1,N,i);
		if(q[i]->empty()){
			if(xx != 0){
				puts("NO");
				return 0;
			}
			continue;
		}
		int tt = q[i]->top();
		inc(1,1,N,i,tt,26-xx);
		while(!q[i]->empty() && q[i]->top() == tt)
			q[i]->pop();
		if(tt + 1 > N)continue;
		if(q[i]->size() > q[tt+1]->size()){
			merge(q[i], q[tt+1]);
			q[tt+1] = q[i];
		}else{
			merge(q[tt+1],q[i]);
		}
	}
	puts("YES");
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

struct MinimumBoundingBox {
    const double INF = numeric_limits<double>::max();
    const double NINF = numeric_limits<double>::lowest();

    int n;
    vector<double> x, y, dx, dy;

    MinimumBoundingBox(int _n) : n(_n), x(n), y(n), dx(n), dy(n) {}

    void input() {
        char d;
        for (int i = 0; i < n; ++i) {
            cin >> x[i] >> y[i] >> d;
            if (d == 'R') dx[i] = 1;
            else if (d == 'L') dx[i] = -1;
            else if (d == 'U') dy[i] = 1;
            else if (d == 'D') dy[i] = -1;
        }
    }

    ld solve() {
        double min_v = f(0), lb = 0, ub = 1e9;
        for (int i = 0; i < 200; ++i) {
            const double t1 = (2.0 * lb + ub) / 3.0;
            const double t2 = (lb + 2.0 * ub) / 3.0;

            min_v = min(min_v, f(t1));
            min_v = min(min_v, f(t2));

            if (f(t1) > f(t2)) lb = t1;
            else ub = t2;
        }
        return min_v;
    }

    double f(const double t) {
        pair<double, double> seg_x(INF, NINF), seg_y(INF, NINF);
        for (int i = 0; i < n; ++i) {
            double vx = x[i] + t * dx[i], vy = y[i] + t * dy[i];

            seg_x.first = min(seg_x.first, vx);
            seg_x.second = max(seg_x.second, vx);
            seg_y.first = min(seg_y.first, vy);
            seg_y.second = max(seg_y.second, vy);
        }
        return (seg_x.second - seg_x.first) * (seg_y.second - seg_y.first);
    }
};

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

    int n;
    cin >> n;

    MinimumBoundingBox mbb(n);
    mbb.input();
    cout << mbb.solve() << endl;

    return 0;
}


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

int main() {
  int n,d;
  cin >> n >> d;
  int w = 2*d + 1;
  int ans = (n+w-1)/w;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}
bool isPrime(long long n)
{
 
    if (n <= 1)
        return false;
 
 
    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;
 
    return true;
}

int main() 
{   ios;
    int t=1;
    //cin>>t;
    //cin.ignore(numeric_limits<streamsize>::max(),'\n');
    while(t--)
    {ll pos,sum=0,ans=0,x,y,z,k,h,c,n,t,m,i,j,flag=0,count=0,moves=0;
     cin>>n;
     ll A[n];
     for(i=0;i<n;i++)
     cin>>A[i];
     ll ht=0;
     for(i=1;i<n;i++)
     {
         if(A[i]>=A[i-1])
         continue;
         else if(A[i]<A[i-1])
         {ht+=A[i-1]-A[i];
          A[i]=A[i-1];
         }
     }
     cout<<ht<<endl;
     
    }
	return 0;
}


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

using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const int MAX_N = 2e6 + 1;

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    char s1 = toupper(s[0]);
    if(s[0] == s1)cout << "A" << endl;
    else cout <<  "a" << endl;
}

Measured memory_bytes: 3604
//MADE BY Y_is_sunshine;
//#include <bits/stdc++.h>
//#include <memory.h>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define INF 0x3f3f3f3f
#define MAXN 100005

typedef long long ll;

const ll mod = 1e9 + 7;
const double PI = acos(-1);

using namespace std;

int N, M, K;

int vis[20][20];

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

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

	//cout << (1 << 16) << '\n';

	cin >> N;
	for(int i = 1; i <= N; i++){
		int q;
		cin >> q;
		while(q--){
			int a, b;
			cin >> a >> b;
			if(b)
				vis[i][a] = b;
			else
				vis[i][a] = -1;
		}
	}
	
	int ans = 0;
	
	int t = (1 << N);
	
	for(int i = 1; i < t; i++){
		bool ok = true;
		for(int j = 1; j <= N; j++){
			if(ok){
				if((1 << (j - 1)) & i){
					for(int k = 1; k <= N; k++){
						if(vis[j][k] == 1){
							if(!((1 << (k - 1)) & i)){
								ok =false;
								break;
							}
						}
						else if(vis[j][k] == -1){
							if((1 << (k - 1)) & i){
								ok = false;
								break;
							}
						}
					}
				}
			}
		}
		if(ok){
			int t = i;
			int res = 0;
			while(t){
				if(t & 1)
					res++;
				t >>= 1;
			}
			ans = max(ans, res);
		}
	}
	
	cout << ans << '\n';
	








	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int n, a, ans;

int dp[20*1000+7][42]; //(koszt1, kosztA) = max produkcja przy 0 ciastkach

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n >> a;

	ans = n;

	for(int i = sqrt(n)-5; i <= sqrt(n)+5; ++i)
	{
		if(i>1)
			ans = min(ans, i+a+(n+i-1)/i);
	}

	for(int i = pow(n, 1.0/3)-5; i <= pow(n, 1.0/3)+5; ++i)
	{
		for(int j = pow(n, 1.0/3)-5; j <= pow(n, 1.0/3)+5; ++j)
		{
			if(i>1 && j>1)
			{
				int x = j*i;
				ans = min(ans, i+a+j+a+(n+x-1)/x);
			}
		}	
	}

	int s = 3*pow(n, 1.0/4)+3;

	dp[0][0] = 1;

	for(int k1 = 0; k1 <= s; ++k1)
	{
		for(int k2 = 0; k2 <= 40; ++k2)
		{
			if(!dp[k1][k2])
				continue;

			ans = min(ans, k1+a*k2+(n+dp[k1][k2]-1)/dp[k1][k2]);

			for(int ile = 2; k1+ile <= s && ile*dp[k1][k2] <= n; ++ile)
			{
				dp[k1+ile][k2+1] = max(dp[k1+ile][k2+1], ile*dp[k1][k2]);
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int x,y;
    bool operator<(const node&o)const
    {
        return y>o.y;
    }
}a[100005];
int n,k,cot=0;
bool vis[100005];

stack<int>s;
int main()
{
    long long ans=0,res=0,type=0;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++)
    {
        if(cot<k)
        {
            if(!vis[a[i].x])
            {
                vis[a[i].x]=true;
                type++;
            }
            else s.push(a[i].y);
            res+=a[i].y;
            cot++;
            ans=max(ans,res+type*type);
        }
        else
        {
            if(s.empty())break;
            if(vis[a[i].x]) continue;
            vis[a[i].x]=true;
            type++;
            res+=a[i].y;
            res-=s.top();s.pop();
            ans=max(ans,res+type*type);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1280
from collections import deque
import bisect

INF = float("inf")

N,M = map(int,input().split())

xtic = {0,-INF,INF}
ytic = {0,-INF,INF}

hor = []
for _ in range(N):
  a,b,c = map(int,input().split())
  hor.append((c,a,b))
  xtic.add(a)
  xtic.add(b)
  ytic.add(c)
  
ver = []
for _ in range(M):
  d,e,f = map(int,input().split())
  ver.append((d,e,f))
  xtic.add(d)
  ytic.add(e)
  ytic.add(f)

xtic = list(xtic)
ytic = list(ytic)
xtic.sort()
ytic.sort()
xdic = {xtic[i]:i+1 for i in range(len(xtic))}
ydic = {ytic[i]:i+1 for i in range(len(ytic))}

gyaku_xdic = {xdic[k]:k for k in xdic}
gyaku_ydic = {ydic[k]:k for k in ydic}

hor.sort()
ver.sort()

hor_dic = {}
ver_dic = {}

now = None
for c,a,b in hor:
  c,a,b = ydic[c],xdic[a],xdic[b]
  if c != now:
    hor_dic[c] = (1<<b) - (1<<a)
  else:
    hor_dic[c] |= (1<<b) - (1<<a)
  now = c

now = None
for d,e,f in ver:
  d,e,f = xdic[d],ydic[e],ydic[f]
  if d != now:
    ver_dic[d] = (1<<f) - (1<<e)
  else:
    ver_dic[d] |= (1<<f) - (1<<e)
  now = d

def is_connected(x,y,dx,dy):
  if dx == 0:
    if dy > 0:
      if (hor_wall[y+1]>>x)&1:
        return False
      return True
    else:
      if (hor_wall[y]>>x)&1:
        return False
      return True
  else:
    if dx > 0:
      if (ver_wall[x+1]>>y)&1:
        return False
      return True
    else:
      if (ver_wall[x]>>y)&1:
        return False
      return True
      
def calc_area(x,y):
  X = gyaku_xdic[x+1] - gyaku_xdic[x]
  Y = gyaku_ydic[y+1] - gyaku_ydic[y]
  return X*Y

offset = [(1,0),(0,1),(-1,0),(0,-1)]
x0 = bisect.bisect(xtic,0)
y0 = bisect.bisect(ytic,0)
W,H = len(xtic)+1 ,len(ytic)+1

hor_wall = [0 for i in range(H)]
ver_wall = [0 for i in range(W)]

for k in hor_dic:
  hor_wall[k] = hor_dic[k]
for k in ver_dic:
  ver_wall[k] = ver_dic[k]

d = [[0 for i in range(W)] for j in range(H)]
d[y0][x0] = 1
q = deque([(x0,y0)])

area = 0

while q:
  x,y = q.pop()
  area += calc_area(x,y)
  for dx,dy in offset:
    nx,ny = x+dx,y+dy
    if 0<=nx<W and 0<=ny<H:
      if is_connected(x,y,dx,dy):
        if nx == 0 or ny == 0 or nx == W-1 or ny == H-1:
          print("INF")
          exit()
        if d[ny][nx] == 0:
          d[ny][nx] = 1
          q.append((nx,ny))

print(area)

Measured memory_bytes: 260972