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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;


template< class Abel > class BIT {
public:
  BIT(int _n) : N(_n) { init(); }

  void init() {
    // [1, N]の範囲なので、+1する必要がある
    bit.clear();
    bit.resize(N + 1, 0);
  }

  void add(int i, Abel x) {
    while (i <= N) {
      bit[i] += x;
      i += i & -i;
    }
  }

  Abel sum(int i) {
    Abel sm = 0;
    while (i > 0) {
      sm += bit[i];
      i -= i & -i;
    }
    return sm;
  }

  Abel getSum(int _x, int _y) {
    return sum(_y) - sum(_x - 1);
  }

private:
  int N;
  vector< Abel > bit;
};

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

  CIN(N, Q);
  BIT< ll > bit(N);

  REP(qi, Q) {
    LCIN(c, _x, _y);
    if (c == 0) {
      // add
      bit.add(_x, _y);
    } else {
      // getSum
      cout << bit.getSum(_x, _y) << endl; 
    }
  }

  return 0;
}



Measured memory_bytes: 3568
#include <stdio.h>
int main(void)
{
  int W,H,x,y,r;
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

  /*  
   * |           |
   * +-----------+
   */
  if(y-r>=0 && x-r>=0 && y+r<=H && x+r<=W){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "D:\C++\test_lib_projects\testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int n,k;
ll a[100005];

int main(int argc,char* argv[]){
	
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	
	int pos=upper_bound(a,a+n,0)-a;
	pos--;
	if(pos==-1){
		cout<<a[k-1];
		return 0;
	}
	if(pos==n-1){
	    cout<<-a[n-k]<<endl;
	    return 0;
	}
	
	//cout<<pos<<endl;
	
	ll ans=1e18;
	for(int i=1;i<=k;i++){
		int Lto=pos-i+1;
		int Rto=pos+k-i;
		if(Lto<0 || Rto>=n){
			continue;
		}
		
		ans=min(ans,-a[Lto]*2+a[Rto]);
		ans=min(ans,a[Rto]*2-a[Lto]);
	}
	
	cout<<ans;
	return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
    int A, B, C, D;

    scanf("%d%d%d%d", &A, &B, &C, &D);

    while(1){
        C -= B;
        if(C <= 0){
            printf("Yes\n");
            break;
        }
        A -= D;
        if(A <= 0){
            printf("No\n");
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1660
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int W = sc.nextInt();
    static int H = sc.nextInt();
    static int x = sc.nextInt();
    static int y = sc.nextInt();
    static int r = sc.nextInt();

    public static void main(String[] args) {
        if (W < x + r || H < y + r || x - r < 0 || y - r < 0)
            System.out.println("No");
        else
            System.out.println("Yes");
    }

}



Measured memory_bytes: 26408
awk -M '\
NR==1{N=$1}
NR>1{
    if(substr($1,1,1)=="M"){
        M[1]++
    }
    if(substr($1,1,1)=="A"){
        M[2]++
    }
    if(substr($1,1,1)=="R"){
        M[3]++
    }
    if(substr($1,1,1)=="C"){
        M[4]++
    }
    if(substr($1,1,1)=="H"){
        M[5]++
    }
}
END{
    for(i=1;i<=5;i++){
        for(j=i+1;j<=5;j++){
            for(k=j+1;k<=5;k++){
                ans+=M[i]*M[j]*M[k]
            }
        }
    }
    print ans
}'

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

int main() {
  int S,s1,s2,s3;
  cin >> S;
  s3 = S % 10;
  s2 = (S % 100 - s3) / 10;
  s1 = (S - S % 100) / 100;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <deque>
#include <map>
#include <string>
#include <iterator>
#include <algorithm>

int main() {
    std::string str;
    int n;
    std::cin >> str >> n;
    std::set<char> chs;
    std::map<char, std::deque<int>> pos;
    for (auto i = 0; i < str.size(); i++) {
        chs.insert(str[i]);
        pos[str[i]].push_back(i);
    }

    for (auto c : chs) {
        std::set<std::string> s;
        for (auto i : pos[c]) {
            for (auto j = 1; j <= std::min(5ul, str.size() - i); j++) {
                s.insert(str.substr(i, j));
            }
        }
        if (s.size() >= n) {
            auto it = s.begin();
            std::advance(it, n - 1);
            std::cout << *it << std::endl;
            return 0;
        }
        n -= s.size();
    }

    return 0;
}

Measured memory_bytes: 384
program main
  implicit none
  character(len=100000) S
  character(len=1),parameter ::alp(26) &
       = (/"a","b","c","d","e","f","g","h","i","j","k","l",&
       "m","n","o","p","q","r","s","t","u","v","w","x","y","z"/)
  integer :: nalp(26) 
  integer :: N
  integer :: i,j
  integer(8) :: out
  
  read(*,*) N
  read(*,*) S
  nalp(:) = 0
  do i = 1,N
     do j =1,26
        if ( alp(j) == S(i:i)) then
           nalp(j) = nalp(j) + 1
           exit
        end if
     end do
  end do
  out=1
  do j = 1,26
     out=out*int(nalp(j)+1,8)
     out=mod(out,(10**9+7))
  end do
  out=out-1
  write(*,'(i0)') mod( out, (10**9+7) )
  stop
end program main


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

typedef long long int ll;

int main () {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll mod = 1000000007;
    
    ll n;
    cin >> n;
    
    ll sum = 0;
    
    ll a[n];
    for (ll i=0 ; i<n ; i++) {
		cin >> a[i];
		sum += a[i];
	}
	
	sum -= a[0];
	
	ll ans = 0;
	
	for (ll i=0 ; i<n-1 ; i++) {
		ans = (ans%mod + (sum%mod * a[i]%mod)%mod)%mod;
		sum -= a[i+1];
	}
	
	cout << ans << "\n";
    
}


Measured memory_bytes: 5212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    ll n;
    cin>>n;
    map<P,ll> m;
    ll num=1;
    ll pre;

    VVI g(1010101);
    VVI gg(1010101);
    VI h(1010101,0);

    for(i=0;i<n;i++){
        for(j=0;j<n-1;j++){
            ll x;
            cin>>x;
            x--;
            ll y=i;
            if(x>y) swap(x,y);
            if(m[P(x,y)]==0){
                m[P(x,y)]=num;
                num++;
            }
            if(j!=0) {
                g[pre].pb(m[P(x,y)]);
                gg[m[P(x,y)]].pb(pre);
                h[m[P(x,y)]]++;
            }
            pre=m[P(x,y)];
        }
    }
    stack<ll> st;
    for(i=1;i<num;i++){
        if(h[i]==0)st.push(i);
    }

    VI ans;
  while(st.size()) {
    i = st.top(); st.pop();
    ans.push_back(i);
    for(auto &k: g[i]) {
      h[k]--;
      if(h[k] == 0) st.push(k);
    }
  }

  if(ans.size()<n*(n-1)/2){
      cout<<-1<<endl;
      return 0;
  }

    vector<ll> uu(1010101);
    for(i=0;i<ans.size();i++){
        uu[ans[i]]=i;
    }

  vector<ll> v(num,0);
  ll ma=0;
  for(i=0;i<ans.size();i++){
      ll zo=0;
      for(j=0;j<gg[ans[i]].size();j++){
          if(uu[ans[i]]<uu[gg[ans[i]][j]]){
              cout<<-1<<endl;
              return 0;
          }
          zo=max(zo,v[gg[ans[i]][j]]);
      }
      v[ans[i]]=zo+1;
      ma=max(ma,zo+1);
  }

  cout<<ma<<endl;
    
    return 0;   
}

Measured memory_bytes: 133868
S=input()
import collections
counter=collections.Counter(S)

# 後ろと前からxを無視して比較していく
# 同じ文字なら続行、indexで出逢えばOK

ans=0
indf=0
indl=len(S)-1
while indf<indl:
  if S[indf]==S[indl]:
    indf+=1
    indl-=1
    continue
  if S[indf]=="x":
    indf+=1
    ans+=1
  elif S[indl]=="x":
    indl-=1
    ans+=1
  else:
    print(-1)
    break
else:
  print(ans)

Measured memory_bytes: 3444
N,W = map(int, input().split())
INF = 10**10
dp = [[-INF] * (W+1) for i in range(2)]
dp[0][0] = 0
for i in range(N):
    dp[(i+1)%2][:] = dp[i%2][:]
    v,w = map(int, input().split())
    for j in range(W+1):
        if dp[i%2][j] == -INF:continue
        if j+w <= W:
            dp[(i+1)%2][j+w] = max(dp[i%2][j+w],dp[i%2][j]+v)
    # print(dp[i+1])
print(max(dp[N%2]))


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

bool check(int s, int e, int m){
	return (s <= m && m <= e);
}

int main() {
	
	ll N, M;
	
	while(cin >> N >> M, N, M){
		int r, q;
		set<int> person;
		cin >> r;
		vector<int> tmpt(r), n(r), m(r), tmps(r);
		
		
		rep(i, r){
			cin >> tmpt[i] >> n[i] >> m[i] >> tmps[i];
			person.insert(m[i]);
		}
		
		vector<vector<int>> t(person.size()), s(person.size());
		
		rep(i, r){
			int id = distance(person.begin(), person.find(m[i]));
			t[id].push_back(tmpt[i]);
			s[id].push_back(tmps[i]);
		}
		
		cin >> q;
		rep(i, q){
			int ts, te, tm;
			cin >> ts >> te >> tm;
			auto id = distance(person.begin(), person.find(tm));
			if(id >= person.size()){
				cout << 0 << endl;
				continue;
			}
			
			
			int cnt = 1, ans = 0;
			REP(j, 1, t[id].size()){
				//cout << cnt << endl;
				
				if(cnt >0){
					if((check(ts, te, t[id][j-1]) || check(ts, te, t[id][j]))) ans += (min(t[id][j], te) - max(t[id][j-1], ts));
					else if(t[id][j-1] <= ts && te <= t[id][j]) ans += (te - ts);
					else if(ts <= t[id][j-1] && t[id][j] <= te) ans += (t[id][j] - t[id][j-1]);
				}
				cnt += (2 * s[id][j] - 1);
			}
			cout << ans << endl;
		}
		
	}
	

	return 0;
}

Measured memory_bytes: 3032
#include <iostream>
#include <vector>

using namespace std;

void success () {
  cout << "Yes" << endl;
  exit(0);
}

void failure () {
  cout << "No" << endl;
  exit(0);
}

const int MAX_N = 1e5 + 5;

int root [MAX_N];

typedef long long ll;

ll sq (ll x) {
  return x * (x - 1) / 2;
}

int find (int u) {
  if (root[u] != u) {
    root[u] = find(root[u]);
  }
  return root[u];
}

void merge (int u, int v) {
  u = find(u);
  v = find(v);

  root[u] = v;
}

int main () {
  ios::sync_with_stdio(false);

  int n, q;
  ll m;
  cin >> n >> m >> q;

  for (int i = 0; i < n; i++) {
    root[i] = i;
  }

  vector<pair<int, int>> ones;
  for (int i = 0; i < q; i++) {
    int u, v, c;
    cin >> u >> v >> c;

    if (c == 0) {
      merge(u, v);
    } else {
      ones.push_back(make_pair(u, v));
    }
  }

  int compc = 0;
  for (int i = 0; i < n; i++) {
    if (root[i] == i) {
      compc++;
    }
  }

  if (compc <= 2) {
    if (m != n - 1 || !ones.empty()) {
      failure();
    } else {
      success();
    }
  }

  for (auto pr : ones) {
    int u = pr.first;
    int v = pr.second;

    if (find(u) == find(v)) {
      failure();
    }
  }

  if (m == n - 1 && !ones.empty()) {
    failure();
  }

  ll maxe = (n - compc) + sq(compc);
  if (m > maxe) {
    failure();
  }

  success();
}


Measured memory_bytes: 1784
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
using namespace std;

int main()
{
  int n;
  cin >> n;
  
  cpp_int sum = 0;
  
  for (int i=1; i<=n; ++i){
    for (int j=1; j<=n; ++j){
      int add = i*j;
      if (add > n) break;
      sum += add; 
    }
  }
 
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,mod=1e9+7;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,ans=0;cin>>n;
    for(ll i=0,cur=1;i<n;i++){
        ll x;cin>>x;
        if(cur==x)cur++;
        else ans+=(x-1)/cur;
        if(cur==1)cur++;
    }
    cout<<ans;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;



int main() {
    

    string s;
    cin >> s;
    ll x = 0;
    ll y = 0;
    int flag = 0; // R
    vector <ll> ans;
    for(ll i=0;i<s.length();i++){
        if(flag == 1 and s[i] == 'R'){
            vector <ll> v(x,0);
            if(x%2 == 1){
                if(y%2 == 1){
                    v[y-1] = (x+1)/2;
                    v[y] = x/2;
                }else{
                    v[y-1] = x/2;
                    v[y] = (x+1)/2;
                }
            }else{
                v[y-1] = v[y] = x/2;
            }
            ans.insert(ans.end(), v.begin(), v.end());
            x = 0;
            flag = 0;
        }
        if(flag == 0 and s[i] == 'L'){
            flag = 1;
            y = x;
        }
        x++;
    }
    vector <ll> v(x,0);
    if(x%2 == 1){
        if(y%2 == 1){
            v[y-1] = (x+1)/2;
            v[y] = x/2;
        }else{
            v[y-1] = x/2;
            v[y] = (x+1)/2;
        }
    }else{
        v[y-1] = v[y] = x/2;
    }
    ans.insert(ans.end(), v.begin(), v.end());

    for (ll i=0;i<ans.size();i++){
        cout << ans[i] << " ";
    }
    cout << endl;



}

Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
signed main() {
	int n, q;
	cin >> n >> q;
	vector<int>a;
	rep(i, n) a.push_back(read());
	sort(all(a));
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		cout << upper_bound(all(a), r) - lower_bound(all(a), l) << endl;
	}
}


Measured memory_bytes: 3992
import sys

def resolve():
    N, X = list(map(int, input().split(" ")))
    M = [int(input()) for i in range(N)]
    base = sum(M)
    m = min(M)
    cnt = N
    x = X - base
    while True:
        if x < m:
            break
        x -= m
        cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <set>
#include <queue>
#include <map>
using namespace std;
#define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef vector<vector<vector<ll>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
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;
}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// vector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
bool is_prime(int x){
    if(x<=1) return false;
    for(int i=2;i*i<=x;i++)
        if(x%i==0) return false;
    return true;
}
int main() {
    int x;
    cin >> x;
    int res = 0;
    rep(i,x,x+100000) if (is_prime(i)) cout << i << '\n',exit(0);

    return 0;
}


Measured memory_bytes: 3636
import math
x,k,d = (int(x) for x in input().split())
if x < 0:
    x *= -1

if x/d >= k:
    print(x-d*k)
else:
    if (k-math.ceil(x/d)) % 2 == 0:
        a = x - math.ceil(x/d)*d
        print(a * -1)
    else:
        a = x - math.ceil(x/d)*d
        print(a + d)

Measured memory_bytes: 9024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s1,s2;
    int c=0;
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++)
    {
        if(s1[i]==s2[i])
        {
            c++;
        }
    }
    cout<<c;
}


Measured memory_bytes: 256
# coding:utf-8

in1 = input().split()

in1 = [int(i) for i in in1]

if(in1[0]==1 and in1[1]==1):
    print("1")
elif(in1[0]==1 or in1[1]==1):
    print((in1[0]-2)*(in1[1]-2)*(-1))
else:
    print((in1[0]-2)*(in1[1]-2))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=0;i<101;i++){
    if(a*i%b==c){
      cout<<"YES";
      return 0;
    }
  }
  cout<<"NO";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<ctime>
#include<bitset>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

inline ll max(ll a,ll b) { return a>b?a:b; }
inline ll min(ll a,ll b) { return a<b?a:b; }
inline ll abs1(ll a) { return a>0?a:-a; }

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	ll a,b,c,d;
	while(cin>>a>>b>>c>>d)
		cout<<max(b*d,max(a*c,max(a*d,b*c)))<<endl;
	
	return 0;
}

Measured memory_bytes: 3584
S = list(input())
if S == S[::-1]:
    S1 = S[:(len(S)-1)//2]
    if S1 == S1[::-1]:
        S2 = S[(len(S)+3)-1//2:]
        if S2 == S2[::-1]:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 2940
//

fun main() {
    abc177c()
}

fun abc177c() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    var ans = 0L
    val base = 1_000_000_007L
    var p = a[0] % base
    for (i in 1 until n) {
        val t = (p * a[i]) % base
        ans = (ans + t) % base
        p = (p + a[i]) % base
    }
    println(ans)
}


Measured memory_bytes: 64852
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main()
{
	double fh, om;
	while (cin>>fh>>om) {
		if (fh < 35.5 && om < 71.0) {
			puts("AAA");
		}
		else if (fh < 37.5 && om < 77.0) {
			puts("AA");
		}
		else if (fh < 40.0 && om < 83.0) {
			puts("A");
		}
		else if (fh < 43.0 && om < 89.0) {
			puts("B");
		}
		else if (fh < 50.0 && om < 105.0) {
			puts("C");
		}
		else if (fh < 55.0 && om < 116.0) {
			puts("D");
		}
		else if (fh < 70.0 && om < 148.0) {
			puts("E");
		}
		else {
			puts("NA");
		}
	}
	return 0;
}

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

bool mycompare(const tuple<string, int, int> &s, tuple<string, int, int> &t) {
  if (get<0>(s) != get<0>(t)) return get<0>(s) < get<0>(t);
  if (get<1>(s) != get<1>(t)) return get<1>(s) > get<1>(t);
  return get<2>(s) < get<2>(t);
}
int main() {
  int n;
  cin >> n;
  vector<tuple<string, int, int>> s(n);
  for (int i = 0; i < n; i++) {
    string t;
    int p;
    cin >> t >> p;
    get<0>(s.at(i)) = t;
    get<1>(s.at(i)) = p;
    get<2>(s.at(i)) = i + 1;
  }
  sort(s.begin(), s.end(), mycompare);
  for (int i = 0; i < n; i++) {
    cout << get<2>(s.at(i)) << endl;
  }

  return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

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

const ll SIZE = 1e5+10;

ll n,k;
ll p[1011];

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; i++){
      cin >> p[i];
  }

  sort(p,p+n);
  ll ans = 0;
  for(int i = 0; i < k; i++)    ans += p[i];

  cout << ans << endl;
  
}

Measured memory_bytes: 3600
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.LinkedList;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a[]=new int[N];
        for(int i=0;i<N;i++){
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[N-1]-a[0]);
    }
}

Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int x=cin.nextInt();
			int h=cin.nextInt();
			if(x+h==0){
				break;
			}
			double hen = Math.sqrt(Math.pow((double)x*Math.sqrt(2)/2.0, 2) + Math.pow(h, 2));
			double a =  Math.sqrt(Math.pow(hen, 2) - Math.pow((double)x/2.0, 2));
			double tri = (double)x*a/2.0;
			System.out.printf("%.6f\n", tri*4+x*x);
		}
	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,s,ans;

void func(int x,int y,int z){
	if(!x&&!y){
		ans++;
		return;
	}
	if(!x||y<0||z==10) return;
	for(int i=z;i<10;i++) func(x-1,y-i,i+1);
}

int main(){
	while(1){
		cin>>n>>s;
		if(!n&&!s) break;
		ans=0;
		func(n,s,0);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

using namespace std;

int n, k;
vector<int> v[2222];

int c;
void haku(int s, int e, int u) {
    if (u > k/2) return;
    c++;
    for (int i = 0; i < v[s].size(); i++) {
        if (v[s][i] == e) continue;
        haku(v[s][i], s, u+1);
    }
}

int main() {
    cin >> n >> k;
    for (int i = 1; i <= n-1; i++) {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int u = n;
    if (k%2 == 0) {
        for (int i = 1; i <= n; i++) {
            c = 0;
            haku(i,0,0);
            u = min(u,n-c);
        }
    } else {
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < v[i].size(); j++) {
                int a = i;
                int b = v[i][j];
                c = 0;
                haku(a,b,0);
                haku(b,a,0);
                u = min(u,n-c);
            }
        }
    }
    cout << u << "\n";
}

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

const int MAX_N = 2e5 + 10;
int n, m;
int Arr[MAX_N];

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> m;
	if (n == 2 && m == 2) {
		cout << "Yes\n 1 2 3";
		return 0;
	}
	
	n = 2 * n - 1;
	if (m == 1 || m == n) {
		cout << "No\n";
		return 0;
	}
	
	cout << "Yes\n";
	if (m + 1 != n) {
		Arr[n / 2] = m;
		Arr[n / 2 - 1] = m + 2;
		Arr[n / 2 + 1] = m - 1;
		Arr[n / 2 + 2] = m + 1;
		int ind = 1;
		while (m - 1 <= ind && ind <= m + 2)
			ind++;
			
		for (int i = 0; i < n; i++)
			if (i < n / 2 - 1 || n / 2 + 2 < i) {
				Arr[i] = ind;
				ind++;
				
				
				while (m - 1 <= ind && ind <= m + 2)
					ind++;
			}
	}
	else {
		Arr[n / 2] = m;
		Arr[n / 2 - 1] = m - 2;
		Arr[n / 2 + 1] = m + 1;
		Arr[n / 2 + 2] = m - 1;
		int ind = 1;
		while (m - 2 <= ind && ind <= m + 1)
			ind++;
			
		for (int i = 0; i < n; i++)
			if (i < n / 2 - 1 || n / 2 + 2 < i) {
				Arr[i] = ind;
				ind++;
				
				
				while (m - 2 <= ind && ind <= m + 1)
					ind++;
			}
	}
	
	
	for (int i = 0; i < n; i++)
		cout << Arr[i] << " ";
		
}

Measured memory_bytes: 2304
import sys, random
mod = 1000000007
def get_array(): return list(map(int, sys.stdin.readline().split()))
def get_ints(): return map(int, sys.stdin.readline().split())
def input(): return sys.stdin.readline()
def print_array(a): print(" ".join(map(str, a)))
def main():
        w = ['Sunny', 'Cloudy', 'Rainy']
        s = input().strip()
        print(w[(w.index(s) + 1) % 3])
if __name__ == "__main__":
        main()

Measured memory_bytes: 5480
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int N,M;
int main() {
  cin >> N >> M;
  vi F(M);
  rep(i,N) {
    int K; cin >> K;
    rep(j,K) {
      int f; cin >> f;
      f--;
      F[f]++;
    }
  }
  int ans =0;
  rep(i,M){
    if (F[i] == N) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] values = new int[N+2];

        values[0] = 0;
        values[N+1] = 0;
        for (int i = 0; i < N; i++) {
            values[i + 1] = sc.nextInt();
        }

        int sum = 0;
        for (int i = 0; i < N+1; i++) {
            int diff = Math.abs(values[i] - values[i+1]);
            sum += diff;
        }

        int[] diffs = new int[N+1];
        for (int i = 1; i < N+1; i++) {
            int minus = Math.abs(values[i - 1] - values[i]) + Math.abs(values[i + 1] - values[i]);
            int plus = Math.abs(values[i - 1] - values[i + 1]);
            diffs[i - 1] = (-1 * minus) + plus;
        }
        for (int i = 0; i < N; i++) {
            System.out.println(sum + diffs[i]);
        }
    }
}

Measured memory_bytes: 63768
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <math.h> 

using namespace std;



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

	long long n, i, j, k, ans, x, ct, nn, s, m;
	cin >> n;
	nn = 1 << n;
	
	vector<vector<long long>> plist(n + 1);		// by pop count
	vector<vector<int>> vlist(nn);
	ct = 0;
	plist[0].push_back(0);
	vlist[0].push_back(0);
	for (i = 0; i < n; i++) {
		x = 1 << i;
		for (j = n - 1; j >= 0; j--) {
			for (auto p : plist[j]) {
				plist[j + 1].push_back(p | x);
				for (auto pp : vlist[p]) {
					vlist[p | x].push_back(pp);
					vlist[p | x].push_back(pp | x);
					ct += 2;
				}
			}
		}
	}
	
	vector<vector<long long>> a(n, vector<long long>(n));
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) cin >> a[i][j];
	}

	vector<long long> dp(nn, -(1LL << 60));
	dp[0] = 0;
	for (i = 1; i <= n; i++) {
		for (auto p : plist[i]) {
			vector<int> id;
			for (j = 0; j < n; j++) {
				if ((1 << j) & p) id.push_back(j);
			}

			// value of no division
			s = 0;
			for (auto p1 : id) {
				for (auto p2 : id) s += a[p1][p2];
			}
			s /= 2;
			dp[p] = s;

			// divide and conquer
			for (auto pp : vlist[p]) {
				dp[p] = max(dp[p], dp[pp] + dp[p ^ pp]);
			}
		}
	}

	ans = dp[nn - 1];
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 174076
def main():
    m, k = map(int, input().split())

    max_a = pow(2, m)

    if k >= max_a:
        print(-1)
        exit()

    if m == 1:
        if k == 0:
            print('0 0 1 1')
        else:
            print(-1)
        exit()

    l = [0] * (2 * max_a)
    l[0] = k
    l[max_a] = k
    for i in range(k):
        l[i + 1] = i
        l[-i - 1] = i
    for i in range(k + 1, max_a):
        l[i] = i
        l[-i] = i
    print(' '.join(map(str, l)))

main()

Measured memory_bytes: 99976
#include<stdio.h>
#include<stdlib.h>

int main(void){
    int N,A,B,C,D;
    scanf("%d",&N);
    A = N / 1000;
    B = N % 1000 / 100;
    C = N % 1000 % 100 / 10;
    D = N % 1000 % 100 % 10 /1; 

    // printf("%d+%d+%d-%d=%d",A,B,C,D,A+B+C-D);
    if(A+B+C+D == 7){
        printf("%d+%d+%d+%d=7",A,B,C,D); 
        return 0;
    }

    if(A+B+C-D == 7){
        printf("%d+%d+%d-%d=7",A,B,C,D); 
        return 0;
    }

    if(A+B-C+D == 7){
        printf("%d+%d-%d+%d=7",A,B,C,D); 
        return 0;
    }

    if(A+B-C-D == 7){
        printf("%d+%d-%d-%d=7",A,B,C,D); 
        return 0;
    }

    if(A-B+C+D == 7){
        printf("%d-%d+%d+%d=7",A,B,C,D); 
        return 0;
    }

    if(A-B+C-D == 7){
        printf("%d-%d+%d-%d=7",A,B,C,D); 
        return 0;
    }

    if(A-B-C+D == 7){
        printf("%d-%d-%d+%d=7",A,B,C,D); 
        return 0;
    }

    if(A-B-C-D == 7){
        printf("%d-%d-%d-%d=7",A,B,C,D); 
        return 0;
    }


}

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


int main() {
    const int MAX_N = 1e+5;
    int N;
    cin >> N;

    int k = 2, l;
    bool is_found = false;
    while (true) {
        l = (k - 1) * k;
        if (l > 2 * N) {
            break;
        } else if (l == 2 * N) {
            is_found = true;
            break;
        }
        k++;
    }

    if (is_found) {
        vector<vector<int>> S(k);
        int v = 1;
        for (int i = 0; i < k - 1; i++) {
            for (int j = i + 1; j < k; j++) {
                S[i].push_back(v);
                S[j].push_back(v);
                v++;
            }
        }

        cout << "Yes" << endl;
        cout << k << endl;
        rep(i, k) {
            cout << (k - 1);
            rep(j, k - 1) cout << " " << S[i][j];
            cout << endl;
        }
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 4492
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long A, B, X;
  cin >> A >> B >> X;
  if (A <= X and X <= A+B) cout << "YES" << endl;
  else cout << "NO" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    public class Prog
    {
        const int MOD = 1000000007;
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Prog().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var b = cin.ReadInt;

            var ans = -1;

            if (a <= 9 && b <= 9)
            {
                ans = a * b;
            }

            Console.WriteLine(ans);
        }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; } }
    }
}


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

  int main() {

    int N;
    cin >> N;
    unsigned long long int S = 1;
    unsigned long long int M = pow(10, 18);
    int zero = 0;
    int yaba = 0;

    vector<unsigned long long int> A(N);
    for (int i; i < N; i++)
    {
      cin >> A.at(i);
      if (A.at(i) == 0)
      {
        zero = 1;
        break;
      }   
      if (S > M / A.at(i))
       {
         yaba = 1;
       }
      S *= A.at(i);
    }


    if (zero == 1)
    {
      cout << "0" << endl;
    }
    else if (yaba == 0)
    {
      cout << S << endl;
    }
    else
    {
      cout << "-1" << endl;
    }
    


  }


Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
int n,m,x,y;
int main(){
    cin>>n>>m;
    vector<int>a(n,1),b(n,0);
    b[0]=1;
    while(m--){
        cin>>x>>y; x--; y--;
        a[x]--;
        a[y]++;
        if(b[x])b[y]=1;
        if(!a[x])b[x]=0;
    }
    int sum=0;
    for(int i=0;i<n;i++) sum+=b[i];
    cout<<sum<<endl;
}

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

#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'

int main()
{
 fastIO();
	string s;
	cin >> s;
	for(int i=0; i<s.size(); i++)
	{
		if(s[i] == '1')
		{
			s[i]='9';
		}
		else if(s[i] == '9')
		{
			s[i] = '1';
		}
	}
	cout << s << endl;
return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main() {
  int yyyy, mm, dd;
  char S[10];
  scanf("%d/%d/%d", &yyyy, &mm, &dd);
  if (yyyy < 2019) {
    printf("Heisei\n");
    return 0;
  }
  if (yyyy > 2019) {
    printf("TBD\n");
    return 0;
  }
  if (mm < 5) {
    printf("Heisei\n");
    return 0;
  }
  printf("TBD\n");
  return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve(){
	string s, t;
	cin >> s >> t;
	int ctn = 0;
	for(auto i = 0; i < s.size(); ++i) {
		if(s[i] != t[i]) ++ctn;
	}
	cout << ctn << "\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
	solve();
    
    return 0;
}


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

int main(){
  
  int a,b;
  char op;
  
  while (1){
    cin >> a >> op >> b;
    if (op == '?') break;
    switch (op){
  case '+':
    cout << a+b <<endl;
    break;
  case '-':
    cout << a-b << endl;
    break;
    case '*':
      cout << a*b << endl;
      break;
  case '/':
    cout << a/b << endl;
    break;
    }
  }
}


Measured memory_bytes: 3076
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int bm = 100002;
int BIT[bm];
void addp(int A) {
	while (A <= bm) {
		BIT[A]++;
		A += A & -A;
	}
}
void addn(int A) {
	while (A <= bm) {
		BIT[A]--;
		A += A & -A;
	}
}
int query(int A) {
	int ret = 0;
	while (A > 0) {
		ret += BIT[A];
		A -= A & -A;
	}
	return ret;
}


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


	int N, M;
	cin >> N >> M;
	int L[300001], ne[300001], he[100001] = {};
	rep1(i, N) {
		int lr;
		cin >> L[i] >> lr;
		lr -= L[i] - 1;
		ne[i] = he[lr];
		he[lr] = i;
	}

	int k = N;
	co(N);
	for (int j = he[1]; j; j = ne[j]) {
		addp(L[j]);
		addn(L[j] + 1);
		k--;
	}
	for (int i = 2; i <= M; i++) {
		int ans = k;
		for (int j = i; j <= M; j += i) {
			ans += query(j);
		}
		co(ans);
		for (int j = he[i]; j; j = ne[j]) {
			addp(L[j]);
			addn(L[j] + i);
			k--;
		}
	}

	Would you please return 0;
}

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

using namespace std;

long long cnt;
long long n, a, b;
long long x[100005];

int main()
{
    scanf("%lld%lld%lld", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &x[i]);
    }
    for(int i = 1; i < n; i++)
    {
        if((x[i]-x[i-1]) * a < b)
        {
            cnt += (x[i]-x[i-1]) * a;
        }
        else
        {
            cnt += b;
        }
    }
    printf("%lld", cnt);
    return 0;
}


Measured memory_bytes: 1024
s = input()
key = "keyence"
ans = "NO"
for i in range(len(key)+1):
    if s.startswith(key[:(len(key))-i]):
        if s.endswith(key[-i:]):
            ans = "YES"
if s.startswith("keyence") or s.endswith("keyence"):
    ans = "YES"
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
    using namespace std;
    using namespace __gnu_pbds;
    typedef long long ll; 
    #define int long long
    typedef unsigned long long lu;
    typedef vector<ll> v;
    typedef vector<vector<ll> > vv;
    typedef vector<string>  vs;
    typedef vector<pair<ll,ll>> vpr;
    typedef long double ld;
    #define f(i,n) for(ll i = 0; i < n; i++)
    #define ff(i,n) for(ll i=1;i<=n;i++)
    #define pb push_back
    #define mp make_pair
    #define endl "\n"
    #define fi first
    #define se second
    #define all(x) x.begin(),x.end()
    #define rall(x) x.rbegin(),x.rend()
    #define amax(x,y) if(y>x) x=y;
    #define amin(x,y) if(y<x)x=y;
    #define bg(x) x.begin()
    #define sz(x) (ll)x.size()
    #define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
    #define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
    #define mxt(a) *(max_element(a.begin(),a.end()))
    #define mnt(a) *(min_element(a.begin(),a.end())
    #define tc ll t;cin>>t;while(t--)
    typedef pair<ll,ll> pi;
    #define yes cout<<"YES\n";
    #define no cout<<"NO\n";
    #define yesno(f) if(f) yes else no
    const v dx = {1, -1, 0, 0};
    const v dy = {0, 0, 1, -1};
    const ld PI = 2 * acos(0.0);
    ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
    ll power(ll a,ll b,ll m)
    {
        if(b==0)
            return 1;
        ll d=power(a,b/2,m);
        d=(d*d)%m;
        if(b&1)
            d=(d*a)%m;
        return d;
    }
    const ll mod=1e9+7;
    int MOD(int a)
    {
        if(a<0)
            a+=mod;
        if(a>=mod)
            a%=mod;
        return a;
    }
    // set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
    // set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
    /*string operations :
    str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
    str.substr (x) : returns a substring str[x],... end of string
    str.find(qtr) : returns the first occurenece of qtr in str */
    int32_t main()
    {
        ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
        int n,m;cin>>n>>m;
        vv gr(n);
        for(int i=0;i<m;i++)
        {
            int a,b;cin>>a>>b;
            a--;
            b--;
            gr[a].pb(b);
            gr[b].pb(a);
        }
        queue<int>que;
        que.push(0);
        vector<bool>vst(n,false);
        vst[0]=true;
        v parent(n,0);
        while(!que.empty())
        {
            int u=que.front();
            que.pop();
            for(auto it:gr[u])
            {
                if(!vst[it])
                {
                    vst[it]=true;
                    parent[it]=u;
                    que.push(it);
                }
            }
        }
        cout<<"Yes\n";
        for(int i=1;i<n;i++)
            cout<<parent[i]+1<<"\n"     ;
        return 0;
    }

Measured memory_bytes: 13048
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

int main(){    
  long long count=1,sum=1;
  long long H;
  cin >> H;

  while(H!=1){
    H = ceil(H/2);
    count *= 2;
    sum+=count;
  }
  
  cout << sum << endl;
  
}


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

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

int main() {
    FAST;

    string s;
    cin >> s;

    s.insert(4, " ");
    println(s);
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    sort(all(a), greater<ll>());
    ll last = 1;
    ll cnt = 0;
    ans = a[0];
    rep(i,2,n){
        ans += a[last];
        cnt++;
        if(cnt == 2){
            last++;
            cnt = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4784