akhauriyash/Code-Regression huggingface dataset:
/******************************\
*  Everyone has a different way of thinking, so God Created us
   Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Mo_Murad   *
\******************************/
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define SZ(c) int(c.size())
#define ff first
#define ss second
#define INF INT32_MAX
#define _INF INT32_MIN
#define PQ priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { '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' };
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL gcd(LL a,LL b) {
	LL c;
	while (a != 0) {
		c = a;
		a = b % a;
		b = c;
	}
	return b;
}
int LCM(int a, int b) {
	return (a*b) / gcd(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		printf("%d ", 2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			printf("%d ", i);
			n /= i;
		}
	}
	if (n > 2)printf("%d ", n);
}
bool is_square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
bool is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
void dijjkstra(int src, int n) {
	list<ipair>adj[1000005];
	vector<bool>visited(1000005, false);
	vector<int>dis(1000005, 1e9);
	PQ<ipair, vector<ipair>, greater<ipair>>pq;
	pq.push(MP(0, 1));
	dis[src] = 0;
	while (!pq.empty())
	{
		int u = pq.top().ss;
		visited[u] = true;
		pq.pop();
		list<ipair>::iterator i;
		for (i = adj[u].begin(); i != adj[u].end(); i++)
		{
			int v = i->ff;
			int we = i->ss;
			if (!visited[v] && dis[v] > dis[u] + we)
			{
				dis[v] = dis[u] + we;
				pq.push(MP(dis[v], v));
			}
		}
	}
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	int64_t  w, h, x, y;
	cin >> w >> h >> x >> y;
	bool ok = 0;
	double xx = w / 2.0;
	double yy = h / 2.0;
	double ar = (w*h) / 2.0;
	if (x==xx &&y==yy)
		cout <<ar <<" "<<1<< endl;
	else cout <<ar << " " << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;



int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M;
	while (N) {
		set<pair<int, pair<string, bool>>>s;
		for (int i = 0; i < N; i++) {
			string t;
			int a,b;
			cin >> t >> a >> b;
			s.insert({ b - a + 1,{t,true} });
			s.insert({ b,{t,false} });
		}
		vector<pair<int, pair<string, bool>>>v(s.begin(), s.end());
		v.push_back({ INT_MAX,{"olphe",true} });
		v.push_back({ INT_MAX,{ "olphe",true } });
		for (int i = 0; i < M; i++) {
			int a;
			cin >> a;
			for (int j = 0; j < v.size()/2; j++) {
				if (v[j*2].first > a) {
					cout << "Unknown\n";
					break;
				}
				if (v[j * 2].first <= a&&v[j * 2 + 1].first >= a) {
					cout << v[j * 2].second.first << " " << a - v[j * 2].first + 1 << endl;
					break;
				}
			}
		}
		cin >> N >> M;
	}
	return 0;
}

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

int main () {
  int N;
  int fx = 0; // 各桁の数字を足したものを格納する変数
  cin >> N;
  
  for (int a = N; a > 0; a /= 10) {
    fx += a % 10; 
    // a(1回目はNと同値)を１０で割ったあまり(=１桁目)をfxに格納
    // 繰り返しのあとaを１０で割った商を新たなaとする(Nが１２３４の場合、新たなaは１２３)
    // 2回目も同様にaを１０で割ったあまりを処理をすることでNの２桁目を抽出、格納ができる
    // 以下同様
  }
  
  if (N % fx == 0) {
    cout << "Yes" << endl; // Nをfx(各桁の和)で割ったあまりが0ならハーシャッド数
  }
  
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}
const int M = 2e5 + 5;
int par[M], siz[M];
int find(int x){
    if(x == par[x])    return x;
    else return par[x] = find(par[x]);
}
void make(int x){
    par[x] = x;
    siz[x] = 1;
}
void unio(int x, int y){
    int a = find(x);
    int b = find(y);
    if(a != b){
        if(siz[a] < siz[b])
            swap(a, b);
        par[b] = a;
        siz[a] += siz[b];
    }
}
void solve()
{
    for(int i = 0; i < M; i++)
        make(i);
    int n, m;
    cin >> n >> m;
    while(m--){
        int x, y;
        cin >> x >> y;
        unio(x, y);
    }
    int maxi = 0;
    for(int i = 1; i <= n; i++)
        maxi = max(maxi, siz[i]);
    cout << maxi << "\n";
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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

int main() {
	int A, B;
	while (cin >> A >> B, A) {
		int C = B - A;
		int x = C / 1000;
		C %= 1000;
		int y = C / 500;
		C %= 500;
		int z = C / 100;
		cout << z << " " << y << " " << x << endl;
	}
}


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

int main(){
    double x1=0.0, y1=0.0, x2=0.0, y2=0.0;
    double ans=0.0;
    double X,Y;
    
    scanf("%lf %lf %lf %lf",&x1, &y1, &x2, &y2);  

    X = x1-x2;
    if(X<0) X*=-1.0;
    Y = y1-y2;
    if(Y<0) Y*=-1.0;
    
    ans = sqrt(X*X + Y*Y);
    printf("%f\n",ans);
//    printf("%f %f %f % \n",X*X, Y*Y, X);
    
return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using ll = long long;
const int INF_INT = 100000000;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second


int main()
{
    int a,b;
    std::cin >> a >> b;
    std::cout << (a - 1) * (b - 1) << std::endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String line = reader.readLine();
		String newline = line.replace("apple", "aaaaa")
				.replace("peach", "apple").replace("aaaaa", "peach");
		System.out.println(newline);

	}
}

Measured memory_bytes: 16900
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int MAXN = 2e3+5,mod = 998244353;
int n,k,C[MAXN<<1][MAXN<<1],bit[MAXN<<1];
it add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
it mul(int x,int y){return 1ll*x*y%mod;}
il inc(int &x,int y){x=add(x,y);}
il Init(){
	C[0][0]=1,bit[0]=1;
	for(ri i=1;i<=4000;++i){
		C[i][0]=1;
		for(ri j=1;j<=i;++j) C[i][j]=add(C[i-1][j],C[i-1][j-1]);
		bit[i]=mul(bit[i-1],2);
	}
}
it Solve(int x,int y,int z){
	int res=0;
	for(ri i=0;i<=z&&i<=x;++i)
		if(y+i-1>=0) inc(res,mul(mul(C[x][i],C[y+z-1][i+y-1]),bit[i]));
	return res;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(k),read(n),Init();
	for(ri i=2;i<=2*k;++i){
		int cnt=0;
		for(ri j=1;j<=k;++j) cnt+=(i-j>=1&&i-j<=k);
		if(i&1) print(Solve(cnt>>1,k-cnt,n)),puts("");
		else print(add(Solve(cnt>>1,k-cnt,n-1),Solve(cnt>>1,k-cnt,n))),puts("");
	}
	return 0;
}

Measured memory_bytes: 61440
import sys

sys.setrecursionlimit(100000)

def fact(i):
    if i == 0:
        return 1
    return i * fact(i - 1)

def main():
    while True:
        n = int(input())
        if n == 0:
            break

        n = str(fact(n))
        cnt = 0
        while True:
            if n[len(n) - cnt - 1] == '0':
                cnt += 1
            else:
                break

        print(cnt)

if __name__ == '__main__':
    main()

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

int main() {
    int bomb;
    string S;
    cin >> S;
    
    bomb=0;
    for(int i=0; i <S.size()-1; i++){ 

        if(S.at(i) == S.at(i+1)){
            cout << "Bad" << endl;
            bomb=1;
            break;
        }

        }

    if(bomb!=1){
        cout << "Good" << endl;
    }

}


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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1e9 + 7, NX = 1e5 + 5;
int N, K, a[NX];

int mul(int aa, int b) {
    return 1ll * aa * b % MOD;
}

int sub(int aa, int b) {
    aa -= b;
    while(aa < 0) aa += MOD;
    return aa%MOD;
}

int pow(int aa, int b) {
    if(b == 0)
        return 1;
    int p = pow(aa, b/2);
    if(b&1)
        return mul(mul(p, p), aa);
    else
        return mul(p, p);
}

int add(int aa, int b) {
    return (aa%MOD + b%MOD)%MOD;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> N >> K;
    int res = 0;
    REPD(i, K+1, 1) {
        int sm = 0;
        for(int j=2*i; j<=K; j+=i) {
            sm = add(sm, a[j]);
        }
        a[i] = sub(pow(K/i, N), sm);
        res = add(res, mul(i, a[i]));
    }
    cout << res << "\n";    
    return 0;
}


Measured memory_bytes: 4008
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int k, a, b;
	cin >> k >> a >> b;
	bool ok = false;
	for (int i = a; i <= b; i++) {
		if (i % k == 0)ok = true;
	}
	if (ok)puts("OK");
	else puts("NG");*/


	/*ll x;
	cin >> x;
	ll a = 100;
	ll ans = 0;
	while (a < x) {
		ans++;
		a *= 1.01;
	}
	cout << ans;*/


	/*int n, m, q;
	cin >> n >> m >> q;*/


	ll a, b, n;
	cin >> a >> b >> n;
	ll x = min(n, b - 1);
	ll ans = floor(a * x / b);
	cout << ans;

	return 0;
}

Measured memory_bytes: 3568
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

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 long long LL;
typedef unsigned long long ULL;

const int INTINF = 1e9;
const LL LLINF = 1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve()
{
    double H; cin >> H;
    LL num = (LL)log2(H);
    LL ans = 1;
    REP1(i, num)
    {
        ans += (1ll << i);
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define P pair<ll,ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod=1000000007;
constexpr ll INF=(1ll<<60);
constexpr double pi=3.14159265358979323846;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<typename T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}


int main(){
    ll n;cin>>n;
    bool ans=false;
    rep(i,100){
        rep(j,100){
            if(n==4*i+7*j){
                ans=true;
                break;
            }
        }
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	char[] s = sc.next().toCharArray();
      	int ans = 0;
      	int cnt = 0;
      
		for (int i = 0; i < n; i++) {
        	if (s[i] == 'D') {
              cnt--;
            } else {
              cnt++;
            }
          
          if (cnt > ans) ans = cnt;
            
        }
      
      System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define vect(x) vector<x>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;



ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }

ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return ((__int128)a*b + p)%p;}

ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}




void solve()
{
    
    ll r,c;
    cin >> r >> c;
    vector<string> v(r);
    forr(i,r) cin >> v[i];
    
    ll dp[r+2][c+2];
    memset(dp,0,sizeof(dp));

    for(ll i=1;i<=c;i++)
    {
        if(v[0][i-1]=='#') break;
        dp[1][i]=1;
    }
    for(ll i=1;i<=r;i++)
    {
        if(v[i-1][0]=='#') break;
        dp[i][1]=1;
    }
    for(ll i=2;i<=r;i++)
    {
        for(ll j=2;j<=c;j++)
        {
            if(v[i-1][j-1]!='#')
            {
                dp[i][j] = add(dp[i][j] , dp[i-1][j]);
                dp[i][j] = add(dp[i][j] , dp[i][j-1]);
            }
        }
    }
    cout << dp[r][c];
    
}


int main()
{
    
    
    fastio
    
    ll tc=1;
   // read(tc);
    while(tc--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;

using namespace std;
struct A
{
    int l;
    int r;
    int q;
};
struct B
{
    int a;
    int b;
    int num;
};
B bb[300005];
A aa[300005];
int a[100005], b[100005];
int f[100005];
int finds(int x)
{
    return f[x] == x?x:f[x] = finds(f[x]);
}
int cmp1(B a, B b)
{
    return a.a < b.a;
}
int cmp2(B a, B b)
{
    return a.b < b.b;
}
int cmp3(A a, A b)
{
    return a.q < b.q;
}
int main()
{
    int n;
    scanf("%d", &n);
    FOR(i,1,n)
    {
        scanf("%d%d", &bb[i].a, &bb[i].b);
        bb[i].num = i;
    }
    int ji = 0;
    sort(bb+1, bb+1+n, cmp1);
    for(int i = 1; i < n; i++)
    {
        aa[ji].l = bb[i].num;
        aa[ji].r = bb[i+1].num;
        aa[ji++].q = min(abs(bb[i].a-bb[i+1].a), abs(bb[i].b-bb[i+1].b));
    }
    sort(bb+1, bb+1+n, cmp2);
    for(int i = 1; i < n; i++)
    {
        aa[ji].l = bb[i].num;
        aa[ji].r = bb[i+1].num;
        aa[ji++].q = min(abs(bb[i].a-bb[i+1].a), abs(bb[i].b-bb[i+1].b));
    }
    sort(aa, aa+ji, cmp3);
    FOR(i,1,n)
    f[i] = i;
    int ans = 0;
    for(int i = 0; i < ji; i++)
    {
        int x = finds(aa[i].l);
        int y = finds(aa[i].r);
        if(x != y)
        {
            f[x] = y;
            ans += aa[i].q;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 5632
N = int(input())
A = list(map(int, input().split()))

A.sort()

ans = 1
for i in range(N - 1):
    if A[i] * 2 >= A[i + 1]:
        ans += 1
    else:
        ans = 1
    A[i + 1] += A[i]

print (ans)


Measured memory_bytes: 14276
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]

ab = sorted(ab)

money = 0
for i in ab:
    money += i[0]*min(m,i[1])
    m -= min(m,i[1])
    
    if m<=0:
        break

print(money)

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

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

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

signed main() {
		vector<int> a;
		for(int i=0;i<3;i++){
				int tmp;
				cin >> tmp;
				a.push_back(tmp);
		}
		sort(a.begin(),a.end());
		cout << a[2] * 10 + a[0] + a[1] << endl;
}


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

using namespace std;
vector<int>f1(100001);
vector<int>f2(100001);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        int d;
        cin>>d;
        if(i%2==0)
            f1[d]++;
        else
            f2[d]++;
    }
    vector<int>::iterator  max1=max_element(f1.begin(),f1.end());
    vector<int>::iterator  max2=max_element(f2.begin(),f2.end());
   // cout<<*max1<<' '<<*max2<<endl;
    if((max1-f1.begin())==(max2-f2.begin()) )
    {
        if(*max1!=n/2 && *max2!=n/2)
        {
            if(*max1>*max2)
            {
                *max2=-1;
                max2=max_element(f2.begin(),f2.end());
            }
            else if(*max1==*max2)
            {
                *max1*=-1;
                *max2*=-1;
               vector<int>::iterator smax1=max_element(f1.begin(),f1.end());
               vector<int>::iterator smax2=max_element(f2.begin(),f2.end());
                if(*smax1>=*smax2)
                {
                    *max1=*smax1;
                    *max2*=-1;
                }
                else
                {
                    *max2=*smax2;
                    *max1*=-1;
                }
            }
            else
            {
                *max1=-1;
                max1=max_element(f1.begin(),f1.end());
            }

        }
        else
        {
            if(*max1==n/2 && *max2==n/2)
            {
                *max2=-1;
                max2=max_element(f2.begin(),f2.end());
            }
            else if(*max1==n/2)
            {
                *max2=-1;
                max2=max_element(f2.begin(),f2.end());
            }
            else
            {
                *max1=-1;
                max1=max_element(f1.begin(),f1.end());
            }
        }
    }
    cout<<(n/2-*max1)+(n/2-*max2)<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>

using namespace std;
int main(){
	string str1, str2; cin >> str1 >> str2;
	bool success = false;
	for (int i = 0; i < str1.size(); ++i){
		int j = 0;
		for (; j < str2.size(); ++j){
			int len = str1.size();
			if (i+j<len && str2[j] != str1[i+j]) break;
			else if (i + j >= len && str2[j] != str1[i + j - len]) break;
		}
		if (j == str2.size()) {
			success = true; break;
		}
	}
	if (success) cout << "Yes\n";
	else cout << "No\n";
}

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

using namespace std;

int x[222];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 2 * n; ++i)
        cin >> x[i];
    sort(x + 1, x + 2 * n + 1);
    int tot = 0;
    for (int i = 1; i <= 2 * n; i += 2)
        tot += x[i];
    cout << tot;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ( ( a + b ) == ( c + d ) ) {
    cout << "Balanced" << endl;
  } else if ( ( a + b ) > ( c + d ) ) {
    cout << "Left" << endl;
  } else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,x,min;
    cin >> n >> x;
    int m[n];
    rep(i, n){
        cin >> m[i];
        x -= m[i];
    }
    min = m[0];
    rep(i, n){
        if (m[i] < min) {
            min = m[i];
        }
    }
    cout << n + x / min << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 0;
		while(true) {
			if((n = sc.nextInt()) == 0) {
				break;
			}
			int ascore = 0, bscore = 0;
			for(int i = 0; i < n; i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				if(a > b) ascore += a + b;
				else if(a < b) bscore += a + b;
				else {
					ascore += a;
					bscore += b;
				}
			}
			System.out.printf("%d %d\n", ascore, bscore);
		}
	}
}

Measured memory_bytes: 51528
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

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

    ll n;
    cin >> n;

    vector<ll> v{1};
    ll sum = 1;
    while(sum <= n) {
        v.push_back(v.back() * 26);
        sum += v.back();
    }
    n -= sum - v.back();
    v.pop_back();

    string s;
    while(!v.empty()) {
        s.push_back('a' + n / v.back());
        n %= v.back();
        v.pop_back();
    }

    cout << s << endl;

    return 0;
}

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

namespace TheSecondHeat
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            int N = int.Parse(Console.ReadLine());
            // スペース区切りの整数の入力
            //string[] input = Console.ReadLine().Split(' ');
            //int b = int.Parse(input[0]);
            //int c = int.Parse(input[1]);
            // 文字列の入力
            string A = Console.ReadLine();
            string B = Console.ReadLine();
            string C = Console.ReadLine();

            int ans = 0;
            for(var i = 0; i < N; i++)
            {
                if(A.Substring(i,1) != B.Substring(i, 1))
                {
                    ans++;
                }
                if (A.Substring(i, 1) != C.Substring(i, 1))
                {
                    ans++;
                }
                if ((B.Substring(i, 1) == C.Substring(i, 1))&&(A.Substring(i, 1) != B.Substring(i, 1)))
                {
                    ans--;
                }
            }
            if (ans < 0)
            {
                ans = 0;
            }
            //出力
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L



int main() {
    int a, b;
    cin >> a >> b;
    int ans = a - b * 2;
    if (ans < 0) {
        cout << 0;
    }
    else {
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3600
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 1024;

int n;
string name[MAX];
int dur[MAX];

int main(void) {
	// in = fopen("A.in", "rt");
	
	fscanf(in, "%d", &n);
	for (int i = 0; i < n; i++) {
	    char tmp[128];
	    int d;
	    fscanf(in, "%s %d", &tmp, &d);
	    name[i] = tmp;
	    dur[i] = d;
    }
    char tmp[128];
    fscanf(in, "%s", tmp);
    string srch = tmp;
    
    int idx = 0;
    while (name[idx] != srch)
        idx++;
    idx++;
    int ans = 0;
    while (idx < n)
        ans += dur[idx++];
    fprintf(out, "%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
s = input()
repeat_num = int(input())

count = 1
count_list = []
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1
    else:
        count_list.append(count)
        count = 1

count_list.append(count)

if len(count_list) == 1:
    print((len(s) * repeat_num ) // 2)
else:
    if s[0] != s[-1]:
        single = sum(list(map(lambda x: x//2, count_list)))
        print(single * repeat_num)
    else:
        # s[0] == s[-1] 繰り返しによってつながる
        single = sum(list(map(lambda x: x//2, count_list[1:-1])))
        print(single * repeat_num
            + (count_list[0]) // 2
            + (count_list[-1]) // 2
            + (count_list[0] + count_list[-1]) // 2 * (repeat_num - 1))





Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a[10];
	for(int i=0;i<10;i++)
	{
		cin>>a[i];
	}
	sort(a,a+10);
	cout<<a[9]<<endl<<a[8]<<endl<<a[7]<<endl;
	return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
 
        int ans = 0;
 
        for(int i = a; i <= b; i++){
            if(c%i == 0)ans++;
        }
 
        System.out.printf("%d\n",ans);
    }
}


Measured memory_bytes: 26472
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>
#include <queue>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
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 (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;

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

    vector<ll> bits(41, 0);
    REP (j, 41) {
        ll digit = 1ll << j;
        int m = 0;
        REP (i, n) if (a[i] & digit) bits[j]++;
    }

    ll maxk = 0;
    REP(j, 41) {
        // cerr << (bits[j] < (n + 1) / 2);
        if (bits[j] < (n + 1) / 2) {
            maxk |= 1ll << j;
            if (maxk >= k) {
                for (int p = j; p >= 0; p--) {
                    ll digit = 1ll << p;
                    if (!(maxk & digit) && (k & digit)) {
                        break;
                    } else if ((maxk & digit) && !(k & digit)) {
                        maxk &= ~digit;
                    }
                }
                break;
            }
        }
    }
    // cerr << endl;

    ll ans = 0;
    REP(i, n) ans += a[i] ^ maxk;

    cout << ans << endl;
    
}

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

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

struct node {
  ll v, d;
  node(ll _a, ll _b):v(_a),d(_b){}
  bool operator<(const node &n) const { return d > n.d; }
};
struct edge {
  ll to, d;
  edge(ll _to, ll _d):to(_to),d(_d){}
};
class dijkstra{
public:
  vector<vector<edge>> G;
  vector<ll> dist;
  vector<ll> prev;

  dijkstra(ll s,ll t,const vector<vector<edge>> &_G):G(_G){ // sからtへの最短経路
    dist.resize(G.size(),1ll << 59);
    //prev.resize(G.size(),-1);
  
    priority_queue<node> que;
    que.push(node(s, 0));
    dist[s] = 0;
    
    while(!que.empty()){
      ll v = que.top().v, d = que.top().d;
      que.pop();
      if(v == t) break;
      rep(i, G[v].size()){
	ll tmp = d + G[v][i].d;
	if(dist[G[v][i].to] > tmp){
	  dist[G[v][i].to] = tmp;
	  //prev[G[v][i].to] = v;
	  que.push(node(G[v][i].to, tmp));
	}
      }
    }
  }

  vector<ll> getpath(ll t){ // tへの最短経路を返す
    vector<ll> path;
    while(t != -1){
      path.push_back(t);
      t = prev[t];
    }
    reverse(path.begin(), path.end());
    return path;
  }
};

int main(){
#define int ll
  int k; cin >> k;
  vector<vector<edge>> g(k);
  rep(i,k){
    g[i].pb(edge((i+1)%k,1));
    g[i].pb(edge((i*10)%k,0));
  }
  dijkstra d(1,0,g);
  cout << d.dist[0]+1 << endl;
}

Measured memory_bytes: 16252
#include <iostream>
using namespace std;
int getpostion(int a[],int p,int r)
{
    return r;
}
int partition(int a[],int p,int r)
{
    int c,x,i,j,t;
    c = getpostion(a,p,r);
    x = a[c];
    i = p-1;

    t = a[r];
    a[r] = a[c];
    a[c] = t;

    for(j=p;j<r;j++)
    {
        if(a[j]<=x)
        {
            i++;
            t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }

    t = a[i+1];
    a[i+1] = a[r];
    a[r] = t;

    return i+1;
}
int main()
{
    int n,x,i;
    int a[100000];
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    x = partition(a,0,n-1);
    for(i=0;i<x;i++)
        cout<<a[i]<<' ';
    cout<<'['<<a[x]<<']';
    for(i=x+1;i<n;i++)
        cout<<' '<<a[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;

ll C[2005][2005];
ll dp[100005][13];

int main(){
    int a,N,ans=0;
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++){
        if(i%2 == 0){
            if(S[i] == 'R' || S[i] == 'U' || S[i] == 'D')continue;
            else ans = -1;
        }else{
            if(S[i] == 'L' || S[i] == 'U' || S[i] == 'D')continue;
            else ans = -1;
        }
    }
    if(ans == -1){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

int partition(int*, int);

int main() {
  int i, n, key;
  int *a;
  
  scanf("%d",&n);
  a = (int*)malloc(sizeof(int) * n);
  for(i = 0;i < n;i++) 
    scanf("%d",&a[i]);
  key = partition(a, n);
  for(i = 0;i < n;i++) {
    if(i == key) printf("[%d]",a[i]);
    else printf("%d",a[i]);
    if(i != n-1) printf(" ");
  }
  printf("\n");
  free(a);
  return 0;
}

int partition(int* a, int r) {
  int j, change;
  int x = a[r-1];
  int i = -1;
  int k;
  for(j = 0;j < r-1;j++) {
    if(a[j] <= x) {
      i++;
      change = a[i];
      a[i] = a[j];
      a[j] = change;
    }
  }
  change = a[i+1];
  a[i+1] = a[r-1];
  a[r-1] = change;
  return i+1;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ull unsigned long long
#define lowbit(x) ((x)&(-x))
#define dis(p,q) sqrt((p.x-q.x)*(p.x-q.x)+(p.y-q.y)*(p.y-q.y))

#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
typedef long long ll;
typedef double db;
using namespace std;

namespace _{
    bool rEOF = 1;//为0表示文件结尾
    inline char nc(){
        static char buf[100000], *p1 = buf, *p2 = buf;
        return p1 == p2&&rEOF && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? (rEOF = 0, EOF) : *p1++;
    }
    template<class _T>
    inline bool read(_T &num){
        char c = nc(), f = 1; num = 0;
        while (c<'0' || c>'9')c == '-' && (f = -1), c = nc();
        while (c >= '0'&&c <= '9')num = num * 10 + c - '0', c = nc();
        return (bool)(num *= f);
    }
    inline bool need(char &c){ return c >= 'a'&&c <= 'z' || c >= 'A'&&c <= 'Z'; }//读入的字符范围
    inline bool read_str(char *a){
        while ((*a = nc()) && need(*a) && rEOF)++a;
        *a = '\0'; return rEOF;
    }
}using namespace _;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a<=5)printf("0\n");
    else
    if(a<=12&&a>=6)printf("%d\n",b/2);
    else printf("%d\n",b);
    return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())

A = []
B = []
for i in range(w+2):
    B.append(".")
A.append(B)
for i in range(h):
    s = "." + input() + "."
    A.append(list(s))
A.append(B)


for i in range(1, h+1):
    for j in range(1, w+1):
        # print(A[i][j], end="")
        C = []
        if A[i][j] == "#":
            print("#", end="")
        else:
            for k in range(-1, 2):
                for l in range(-1, 2):
                    C.append(A[i+k][j+l])
            print(C.count("#"), end = "")
    print()

Measured memory_bytes: 45020
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;


const int MAX = 1000000;
long long 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;
    }
}

// 二項係数
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    COMinit();
    int n;
    ll m;
    cin >> n >> m;
    vector<int> cnt;
    for(int i=2;i*i<=m;i++){
        if(m%i==0){
            cnt.push_back(0);
            while(m%i==0){
                cnt.back() ++;
                m /= i;
            }
        }
    }
    if(m > 1){
        cnt.push_back(1);
    }
    ll ans = 1;
    for(int c:cnt){
        ans = (ans * COM(n+c-1,c))%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
//#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;
#define pi 3.141592653589

signed main() {
    quickie 
    int n, k ;
    cin >> n >> k ;
    set<int> s ;
    rep(i, 0, k) {
        int d ;
        cin >> d ;
        rep(i, 0, d) {
            int a ;
            cin >> a ;
            s.insert(a) ;
        }
    }
    cout << n-s.size() << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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

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

int main() {
  int N,a;
  cin>>N;
  int d_1,d_2;
  a=0;
  vector<vector<int>> vec(N,vector<int>(2));
  for(int i=0; i<N; i++){
    int d_1,d_2;
    cin>>d_1>>d_2;
    vec.at(i).at(0)=d_1;
    vec.at(i).at(1)=d_2;
  }
  for(int i=0; i<N-2; i++){
    if(vec.at(i).at(0)==vec.at(i).at(1)&&vec.at(i+1).at(0)==vec.at(i+1).at(1)&&vec.at(i+2).at(0)==vec.at(i+2).at(1))
      a=1;
  }
  if(a==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}



Measured memory_bytes: 3632
#include <stdio.h>
int main()
{
   int n,m,b[1000],a[1000];
   int sum[1000]={0};
   scanf("%d %d",&n,&m);
   for(int i=0;i<=n-1;i++){
     scanf("%d",&a[i]);
   }
   for(int j=0;j<=m-1;j++){
     scanf("%d",&b[j]);
   }
   for(int j=0;j<=m-1;j++){
     for(int i=0;i<=n-1;i++){
        if(b[j]>=a[i]) {sum[i]=sum[i]+1;break;}
     }
   }
   int max=-1;
   for(int k=0;k<=n-1;k++){
      if(sum[k]>=max) max=sum[k];
   }
   for(int i=0;i<=n-1;i++){
     if(sum[i]==max) printf("%d\n",i+1);
   }
   return 0;
}


Measured memory_bytes: 2732
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;


int main(){

int n;
cin >> n;

string s,t;
cin >> s >> t;

rep(i,n){
    cout << s.at(i) << t.at(i);
}

cout << endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n, k;
vi l, r;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  r.pb(0);
  FOR(i, 0, n){
    int a;
    cin >> a;
    if(a >= 0){
      r.pb(a);
    }else{
      l.pb(-a);
    }
  }
  l.pb(0);
  reverse(rng(l));
  int ans = iinf, sl = sz(l), sr = sz(r);
  FOR(i, 0, k+1){
    if(i >= sl || k-i >= sr) continue;
    mins(ans, 2 * l[i] + r[k-i]);
    mins(ans, l[i] + 2 * r[k-i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1020
# -*- coding: utf-8 -*-
"""
Created on Thu Oct  3 07:43:37 2019

@author: avina
"""

import heapq

class Maxheap():
    
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)
    
    def push(self, value):
        heapq.heappush(self.heap, -value)
    
    def pop(self):
        return -heapq.heappop(self.heap)

n,t = map(int, input().split())

l = list(map(int, input().split()))
a = Maxheap(l)
for i in range(t):
    b = a.pop()//2
    a.push(b)
    
sums = 0
for i in range(n):
    sums += a.pop()
print(sums)

Measured memory_bytes: 14224
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
ll k;
cin>>k;

ll n=50,a[55];
rep(i,0,49)a[i]=n-1-i;

rep(i,0,n-1)
{
	a[i]+=k/n;
	if(i<k%n)a[i]++;
}

ol(n);on;
rep(i,0,n-1)
{
	ol(a[i]);os;
}

return 0;
}



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

signed main() {
	int n;
	cin>>n;
	std::vector<int> v(n),a(n+1);
	a[0]=0;
	for(int i=0;i<n;i++){
		cin>>v[i];
		a[i+1]=a[i]+v[i];
	}
	int ans=0;
	int j=1;
	sort(a.begin(),a.end());
	for(int i=0;i<n;i++){
		if(a[i]==a[i+1])j++;
		else{
			ans+=j*(j-1)/2;
			j=1;
		}
	}
	ans+=j*(j-1)/2;
	cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

int A[100001];
ll dif[100001];


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

	ll N; cin >> N;
	ll tot = 0LL;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		tot += A[i];
	}
	for (int i = 1; i < N; i++) dif[i] = A[i] - A[i - 1];
	dif[0] = A[0] - A[N - 1];

	if (tot % ((N*(N + 1))/ 2) != 0) cout << "NO" << endl;
	else {
		ll k = tot / (N*(N + 1) / 2);
		bool flag = true;
		for (int i = 0; i < N; i++) {
			dif[i] -= k;
			if (dif[i] > 0) flag = false;
			else {
				if (-dif[i] % N != 0) flag = false;
			}
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
 
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define FOR(i,n) for(int i = 0;i<n;i++)
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=998244353,INF=1ll<<60;
 
int N;
struct UF{
    vector<int>par,sz;
    void init(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};
 
signed main() {
    IOS();
    cin>>N;
    
    UF uf;
    uf.init(N);
    rep(i,0,N-(N%2)){
        uf.unite(i,N-i-(N%2)-1);
    }
    
    vpint ans;
    rep(i,0,N){
        rep(j,i+1,N){
            if(!uf.same(i,j)){
                ans.pb({i,j});
            }
        }
    }
    
    cout<<(int)ans.size()<<endl;
    rep(i,0,(int)ans.size()){
        cout<<ans[i].fi+1<<" "<<ans[i].se+1<<endl;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 512