akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N, M;
int cnt[(int)1e5 + 10];

int main(void) {
    scanf("%d%d", &N, &M);
    REP(i, M) {
        int a, b;
        scanf("%d%d", &a, &b);
        cnt[a - 1]++;
        cnt[b - 1]++;
    }
    REP(i, N) if (cnt[i] % 2) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}


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

int main() {
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  if(x - r >= 0 && y + r <= h && x + r <= w && y - r >= 0){
    std::cout << "Yes\n" ;
  }
  else{
    std::cout << "No\n" ;
  }
}


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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    int x; cin >> x;
    v<ll> memo;
    ll num = 0;
    while(pow(num, 5) < LINF) {
        memo.push_back(pow(num, 5));
        num++;
    }

    int i = 0;
    while(1) {
        if (i >= memo.size()) return 1;
       for (int j = 0; j <= i; ++j) {
//           cout << i << ' ' << j << endl;
//           cout << memo[i] << ' ' << memo[j] << endl;
           if (memo[i] - memo[j] == x) {
               cout << i << ' ' << j;
               return 0;
           }
           if (memo[i] + memo[j] == x) {
               cout << i << ' ' << -j;
               return 0;
           }
       }
       i++;
    }

    return 0;
}


Measured memory_bytes: 4276
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int,int> ii;
int n;
vector<int> al[100005];
vector<ii> edges;
int c[100005];
int depth[100005];
void dfs(int i,int p){
    int col=1;
    for (auto it:al[i]){
        if (it==p) continue;
        if (c[i]==col) col++;
        c[it]=col++;
        depth[it]=depth[i]+1;
        dfs(it,i);
    }
}
int main(){
    scanf("%d",&n);
    int a,b;
    for (int x=1;x<n;x++){
        scanf("%d%d",&a,&b);
        al[a].push_back(b);
        al[b].push_back(a);
        edges.push_back(ii(a,b));
    }
    
    c[1]=0;
    dfs(1,0);
    
    int m=0;
    for (int x=2;x<=n;x++) m=max(m,c[x]);
    printf("%d\n",m);
    for (int x=0;x<n-1;x++){
        if (depth[edges[x].first]>depth[edges[x].second]){
            printf("%d\n",c[edges[x].first]);
        }
        else{
            printf("%d\n",c[edges[x].second]);
        }
    }
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#else
#define db(...) true
#endif
template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c; return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

const int MX = 1000000;
int k, x;

int main() {
	#ifdef LOCAL
	auto stTime = clock();
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	si ans;
	cin >> k >> x;
	for (int i = 1; i <= k; ++i) {
		int L = max(x - (i - 1), -MX);
		int R = min(x + k - i, MX);
		for (int j = L; j <= R; ++j) {
			ans.insert(j);
		}
	}

	for (auto& lilAns : ans) {
		cout << lilAns << ' ';
	}ndl;

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms\n";
	#endif
    return 0;
}


Measured memory_bytes: 256
# -*-coding:utf-8-*-

def get_input():
    
    while True:
        try:
            yield "".join(input())
        except EOFError:
            break
                     
if __name__=="__main__":
    array = list(get_input())
    for i in range(len(array)):
        
        temp = array[i].split()
        
        a = int(temp[0])
        b = int(temp[1])
                        
        ans = a + b
        
        print(len(str(ans)))

Measured memory_bytes: 7624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 100000000
#define MAX_E 100000
#define MAX_V 10000
struct edge{int u,v,cost;};
edge es[MAX_E];
int V,E;
int par[MAX_V];
int rank[MAX_V];
void init_union(){
  for(int i=0;i<V;i++){
    par[i]=i;
    rank[i]=0;
  }
}
int find(int x){
  if(par[x]==x)return x;
  else {
    return par[x]=find(par[x]);
  }
}
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return ;

  if(rank[x] < rank[y]) par[x]=y;
  else {
    par[y]=x;
    if(rank[x]==rank[y])x++;
  }
}
bool same(int x,int y){
  return find(x)==find(y);
}
bool comp(const edge& e1, const edge& e2){
  return e1.cost < e2.cost;
}

int kruskal(){
  int ans=0;
  sort(es,es+E,comp);
  init_union();

  for(int i=0;i<E;i++){
    edge e=es[i];
    if(!same(e.u,e.v)){
      unite(e.u,e.v);
      ans+=e.cost;
    }
  }
  return ans;
}
int main(){
  cin >> V >> E;
  for(int i=0;i<E;i++){
    int s,t,w;
    edge e;
    cin >> s >> t >> w;
    e.u=s; e.v=t; e.cost=w;
    es[i]=e;
  }
 
  cout << kruskal() << endl ;
  return 0;
}

Measured memory_bytes: 4356
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
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;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int unsigned long long
//----------------------------------------------------
int n, x;
int a[100];
//レベルiバーガーの肉
int b[100];
//レベルiバーガーのサイズ
signed main() {
	cin >> n >> x;
	a[0] = 1; b[0] = 1;
	for (int i = 1; i <= n; i++) {
		a[i] = a[i - 1] * 2 + 1;
		b[i] = b[i - 1] * 2 + 3;
	}
	int ans = 0;
	for (int i = n; i >= 0 && x > 0; i--) {
		if (x == b[i]) {
			ans += a[i];
			break;
		}
		if (x > b[i - 1] + 1) {
			ans++;
			x -= b[i - 1] + 2;
			ans += a[i - 1];
		}
		else {
			x--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let t = read_vec::<i32>();
    let a = t[0];
    let b = t[1];
    let mut ans = 0;
    let mut now = 1;
    while now < b {
        now += a - 1;
        ans += 1;
    }
    println!("{}", ans);
}

Measured memory_bytes: 2112
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    int A[n][m],B[m][l];
    long long int C[n][l];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            C[i][j] = 0;
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%d",&A[i][j]);
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            scanf("%d",&B[i][j]);
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int k = 0; k < l; k++){
            for(int j = 0; j < m; j++){
                C[i][k] += A[i][j]*B[j][k];
            }
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l-1; j++){
            printf("%lld ",C[i][j]);
        }
        printf("%lld\n",C[i][l-1]);
    }
}


Measured memory_bytes: 2872
#include <bits/stdc++.h>
using namespace std;
long long R[10000005]={0};
void init(){
  long long l=0;
  long long r=0;
  int now=0;
  for(int i=1;i<=9;i++){

    now++;
    R[i]=i;
  //  cout<<R[i]<<endl;
  }
  l=r+1;
  r+=now;
now=0;
  for(int j=1;j<=9;j++){

  for(int i=l;i<=r;i++){
    if(R[i]%10==0){
      now++;
      R[r+now]=R[i]*10;
      now++;
        R[r+now]=R[i]*10+1;
    }
    else if(R[i]%10==9){
        now++;
        R[r+now]=R[i]*10+8;
        now++;
          R[r+now]=R[i]*10+9;
      }
      else{
        //cout<<R[i+now]<<endl;
        now++;
        R[r+now]=R[i]*10+R[i]%10-1;
        now++;
        R[r+now]=R[i]*10+R[i]%10;
        now++;
        R[r+now]=R[i]*10+R[i]%10+1;
      }
  }

  l=r+1;
  r+=now;
  now=0;
}
}
int main(){

    int k;
    cin>>k;
init();
  cout<<R[k]<<endl;

}


/*long long n,k;
cin>>n>>k;
long long p=0;
if(n>=k)p=n%k;
else p=n;
cout<<min(p,k-p)<<endl;
*/


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if(a <= 0 and b >= 0) cout << "Zero";
    else if(a > 0 or ((b - a) & 1)) cout << "Positive";
    else cout << "Negative";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

bool used[200020];
vector<int> v[200020];
ll ans;
int cnt;
int c[200020];
int val[200020];

void dfs(int from,int now){
  used[now]=true;
  val[now]=c[cnt];
  cnt++;
  rep(i,v[now].size()){
    if(!used[v[now][i]]){
      dfs(now,v[now][i]);
    }
  }
}

int main(){
  int n;
  cin >> n;
  pint p[n];
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--,b--;
    p[i]={a,b};
    v[a].push_back(b);
    v[b].push_back(a);
  }
  rep(i,n)cin >> c[i];
  sort(c,c+n,greater<int>());
  dfs(-1,0);
  rep(i,n-1){
    ans+=min(val[p[i].first],val[p[i].second]);
  }
  cout << ans << endl;
  rep(i,n)cout << val[i] << ' ';
  cout << endl;
return 0;}

Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;
typedef pair<ll, ll> pint;

ll mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}

int main(){
    ll N, K;
    cin >> N >> K;
    combination comb(100000);
    mint ans = 0;
    mint tmp1 = 0;
    mint tmp2 = 0;
    rep(i, K) {
        tmp1 += N - i;
        tmp2 += i;
    }
    REP(i, K, N+2){
        ans += tmp1 - tmp2 + 1;
        tmp1 += N - i;
        tmp2 += i;

    }
    cout << ans.x << endl;


}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> v(H,vector<char>(W));
  for (int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      cin >> v.at(i).at(j);
    }
  }
  for (int i=0;i<H;i++){
    for (int k=0;k<2;k++){
      for (int j=0;j<W;j++){
        cout << v.at(i).at(j);
        if (j==W-1){
          cout << endl;
        }
      }
    }
  }
}

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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

# define int long long

int n;
int a[N];
int ans;

signed main()
{
    read(n);
    Rep(i,1,n)read(a[i]);
    ans=1000;
    Rep(i,2,n)
        if(a[i-1]<a[i])ans+=(a[i]-a[i-1])*(ans/a[i-1]);
    printf("%lld\n",ans);
    return 0;
}   

Measured memory_bytes: 3760
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	string S, T;
	cin >> S >> T;
	int sl = S.length(), tl = T.length();

	bool match;
	for (int i = sl - tl; i >= 0; i--) {
		match = true;
		REP(j, tl) {
			if (S[i + j] == T[j] || S[i + j] == '?') {

			}
			else {
				match = false;
				break;
			}
		}
		if (match) {
			REP(j, tl) {
				S[i + j] = T[j];
			}
			break;
		}
	}

	if (match) {
		REP(i, sl) {
			if (S[i] == '?') {
				S[i] = 'a';
			}
		}
		cout << S << endl;
	}
	else {
		cout << "UNRESTORABLE" << endl;
	}

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned uint;
typedef pair<uint, uint> pairUInt;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

const int MAXN=1e5;

int main(int argc, char *argv[])
{
    int N, M, a, b;
    unordered_map<int,int> hist;

    cin >> N >> M;

    FOR(i,M) {
        cin >> a >> b;
        hist[a] = hist[a] + 1;
        hist[b] = hist[b] + 1;
    }

    for (auto p : hist) {
        if (p.second % 2 == 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    
    return 0;
}


Measured memory_bytes: 3876
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair<int, pair<int, int> >
#define pf push_front

const int maxn = 2000* 100 + 5;
int a[maxn];

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


Measured memory_bytes: 1792
N=int(input())

c=[]
s=[]
f=[]

for i in range(N-1):
    ci,si,fi=map(int, input().split())
    c.append(ci)
    s.append(si)
    f.append(fi)

for i in range(N):
    t=0
    for j in range(i, N-1):
        if t<s[j]:
            t=s[j]
        if t%f[j]==0:
            t+=c[j]
        else:
            t=t+f[j]-t%f[j]
            t+=c[j]
    print(t)

Measured memory_bytes: 3064
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {
	lld ans = 0ll;
	lld n, a, b; cin >> n >> a >> b;
	for4(i, 1ll, n + 1, 1ll) {
		lld num = i;
		lld sumOfDigits = 0ll;
		while (num) {
			sumOfDigits += num % 10;
			num /= 10;
		}

		if (a <= sumOfDigits  and sumOfDigits <= b) {
			ans += i;
		}
	}

	cout << ans;

	cout << "\n";

	return;
}


signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  AtCoder Practice

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
vector<vector<int>> G;
vector<int> vis, v;
bool dfs(int i, int r) {
    vis[i] = 1;
    v.push_back(i);
    for (auto &e : G[i]) {
        if (e == r) {
            return true;
        }
        if (vis[e]) {
            continue;
        }
        if (dfs(e, r)) {
            return true;
        }
    }
    v.pop_back();
    return false;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vis.resize(n);
    G.resize(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].push_back(b);
    }
    for (int j = 0; j < n; j++) {
        fill(all(vis), 0);
        if (dfs(j, j)) {
            vector<vector<int>> nG(v.size()), rG(v.size());
            map<int, int> mp;
            for (int i = 0; i < v.size(); i++) {
                mp[v[i]] = i;
            }
            for (int i = 0; i < v.size(); i++) {
                for (auto &e : G[v[i]]) {
                    if (mp.count(e)) {
                        nG[i].push_back(mp[e]);
                        rG[mp[e]].push_back(i);
                    }
                }
            }
            int st = 0, gl = v.size(), to = -1;
            gl--;
            vector<int> ok(v.size(), 1);
            for (int i = 0; i < v.size(); i++) {
                if (i >= gl) {
                    break;
                }
                if (to > i) {
                    ok[i] = 0;
                    continue;
                } else if (to == i) {
                    to = -1;
                }
                for (auto &e : rG[i]) {
                    if (e > i && e <= gl && ok[e]) {
                        st = i;
                        chmin(gl, e);
                    }
                }
                for (auto &e : nG[i]) {
                    if (e > i && e <= gl && ok[e]) {
                        chmax(to, e);
                    }
                }
            }
            vector<int> vv;
            for (int i = st; i <= gl; i++) {
                if (ok[i]) {
                    vv.push_back(v[i]);
                }
            }
            cout << vv.size() << endl;
            for (int i = 0; i < vv.size(); i++) {
                cout << vv[i] + 1 << endl;
            }
            return 0;
        }
    }
    cout << -1 << endl;
}

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

#define MAX_N 100000

// int N = 2;
// vector<int> a = {1, 5};
// vector<int> b = {2, 4};
// vector<int> c = {3, 6};

int N;
vector<long long> a, b, c;

int main() {
    // input
    cin >> N;
    for (int i = 0; i < N; i++) {
        long long tmpa;
        cin >> tmpa; a.push_back(tmpa);
        // cout << tmpa;
    }
    for (int i = 0; i < N; i++) {
        long long tmpb;
        cin >> tmpb; b.push_back(tmpb);
    }
    for (int i = 0; i < N; i++) {
        long long tmpc;
        cin >> tmpc; c.push_back(tmpc);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

// cout << upper_bound(c.begin(), c.end(), 6) - lower_bound(c.begin(), c.end(), 3);
// return 0;
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        long long target_b = b[i];
        long long a_size = upper_bound(a.begin(), a.end(), target_b - 1LL) - lower_bound(a.begin(), a.end(), a[0]);
        long long  c_size = upper_bound(c.begin(), c.end(), c[N-1]) - lower_bound(c.begin(), c.end(), target_b + 1LL);

        // printf("%d %d\n", a_size, c_size);
        if (a_size >= 1 && c_size >= 1) {
            ans += (a_size * c_size);
        }
        // auto begin_b = lower_bound(b.begin(), b.end(), target_a);
        // cout << target_a << endl;;
        // for (auto j = begin_b; j != b.end(); j++) {
        //     cout << *j << endl;
        //     int size = upper_bound(c.begin(), c.end(), *j) - lower_bound(c.begin(), c.end(), *j);
        //     cout << size << endl;
        //     ans += size;
        // }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define f first
#define s second 
using namespace std;
const LL MOD = (LL) 998244353;
const int MAXN = 3005;

int n, tgt, a[MAXN];
LL dp[MAXN][MAXN], sum[MAXN];

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

	cin >> n >> tgt;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		for (int j = a[i]; j <= tgt; j++) {
			dp[i][j] = sum[j - a[i]];
		}
		dp[i][a[i]] = (dp[i][a[i]] + i) % MOD;
		for (int j = a[i]; j <= tgt; j++) {
			sum[j] = (sum[j] + dp[i][j]) % MOD;
		}
	}
	
	LL ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = (ans + dp[i][tgt] * (n - i + 1)) % MOD;
	}
	
	cout << ans << '\n';

	return 0;
}

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

vector<int> seen;

void dfs(int x, const vector<vector<int>> &g, vector<int> &c){
  seen[x] = 1;
  for(auto i : g[x]){
    if(seen[i]) continue;
    c[i] += c[x];
    dfs(i,g,c);
  }
}

int main(){
  int n,q;
  cin>>n>>q;
  vector<vector<int>> g(n);
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> counter(n);
  rep(i,q){
    int p,x;
    cin>>p>>x;
    p--;
    counter[p] += x;
  }
  
  seen.resize(n);
  dfs(0,g,counter);
  
  rep(i,n) cout << counter[i] << endl;
}

Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;
    rep1(i,10){
        rep1(j,10){
            if(i*j == n){Yes}
        }
    }
    No
    return 0;

}

Measured memory_bytes: 256
while True:
    a, op, b = input().split()
    a, b = int(a), int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    else:
        break




Measured memory_bytes: 5600
#include<bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define MST(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VI vector<int>
#define VL vector<long long>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}

const LL N=1003;
struct NODE{
	db o,r,d;
};
LL t,n,m,ans;
LL MOD=1e9+7,inf=0x1f1f1f1f;
db eps=1e-5;
LL a[5];

int main()
{
//	FOUT;//FIN;
	ios_base::sync_with_stdio(false);cin.tie(0);
	LL i,j,k,l,ca=0,u,v,d;
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]%2==0||a[1]%2==0||a[2]%2==0)cout<<"0"<<endl;
	else cout<<a[0]*a[1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
#define N 200000 
int dp[N];
int func(int arr[],int i,int n,int k)
{
	if(i>=n-1) return dp[i]=0;
	if(dp[i]>=0) return dp[i];
	int t=1;
	int min=INT_MAX;
	while(t<=k )
	{
		int x=abs(arr[i+t]-arr[i])+func(arr,i+t,n,k);
		if(x<min)min=x;
		t++;
	}
	return dp[i]=min;
}
int main()
{
	int n,k;
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	int arr[n+k];
	forl(i,0,n) cin>>arr[i];
	forl(i,n,n+k) arr[i]=INT_MAX;
	cout<<func(arr,0,n,k)<<endl;
	
	
}

Measured memory_bytes: 10752
package main

import (
	"fmt"
	"math"
	"strconv"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)

	strList := scanStrings(n)

	results := make(map[string]int)
	for _, str := range strList {
		result := ""
		for c := 'a'; c <= 'z'; c++ {
			result += strconv.Itoa(strings.Count(str, string(c)))
		}
		results[result] += 1
	}

	resultCnt := 0
	for _, v := range results {
		if v != 1 {
			// vC2
			resultCnt += (v * (v-1)) / 2
		}
	}
	fmt.Println(resultCnt)
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}


Measured memory_bytes: 20224
#ABC060D
N, W = map(int,input().split())
WV = [list(map(int,input().split())) for _ in range(N)]
A = WV[0][0]
B = A + 1
C = A + 2
D = A + 3

AA = []
BB = []
CC = []
DD = []

for wv in WV:
  if wv[0] == A:
    AA.append(wv[1])
  elif wv[0] == B:
    BB.append(wv[1])
  elif wv[0] == C:
    CC.append(wv[1])
  else:
    DD.append(wv[1])

AA = sorted(AA)[::-1]
BB = sorted(BB)[::-1]
CC = sorted(CC)[::-1]
DD = sorted(DD)[::-1]

ans = 0
for a in range(N+1):
  for b in range(N+1-a):
    for c in range(N+1-a-b):
      for d in range(N+1-a-b-c):
        if a > len(AA) or b > len(BB) or c > len(CC) or d > len(DD):
          continue
        if A * a + B * b + C * c + D * d > W:
          continue
        tmp = sum(AA[:a])+sum(BB[:b])+sum(CC[:c])+sum(DD[:d])
        ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt() - 1;
    int b = sc.nextInt() - 1;
    int c = sc.nextInt() - 1;
    int d = sc.nextInt() - 1;
    int[] mas = new int[n];
    String s = sc.next();
    for(int i = 0; i < n; i++) {
      if(s.charAt(i) == '#') mas[i] = 1;
    }
    String ans = "Yes";
    int p = 0;
    for(int i = a + 1; i <= c; i++) {
      if((mas[i - 1] == 1) && (mas[i] == 1)) p++;
    }
    for(int i = b + 1; i <= d; i++) {
      if((mas[i - 1] == 1) && (mas[i] == 1)) p++;
    }
    if(c > d) {
      if(p == 0) {
        int q = 0;
        for(int i = b; i <= d; i++) {
          if((mas[i - 1] == 0) && (mas[i] == 0) && (mas[i + 1] == 0)) q++;
        }
        if(q == 0) ans = "No";
      } else {
        ans = "No";
      }
    } else {
      if(p > 0) ans = "No";
    }
    System.out.println(ans);
  }
}

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

using namespace std;




int main()
{
int a,b,c,x,y;
int xn = 0;
int yn = 0;
int cena = 0;

    cin>>a>>b>>c>>x>>y;






    if((2*c) < (a + b))
    {

        while(xn < x && yn < y)
    {

        xn++;
        yn++;
        cena += (2*c);
    }

    }

    int naj = 0;
    int najm = 0;
    int g = 0;

    if(x > y)
    {

        naj = x;
        najm = y;
        g = a;
    }

    else
    {

        naj = y;
        najm = x;
        g = b;
    }


    if((2*c)*(naj - najm) < (naj-najm)*g )
    {

        cena += (2*c*(naj-najm));

    }
    else
    {

        while(xn < x || yn < y)
        {
            if(xn < x)
            {

                xn++;
                cena += a;

            }

            if(yn < y)
            {

                yn++;
                cena += b;

            }

        }
    }
    cout<<cena;






    return 0;
}


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

typedef long long int ll;

int main(){
	int n, m; cin>>n>>m;
	string s; cin>>s;
	
	vector<int> sauts;
	int pos = n;
	bool loose = false;
	while(pos>0){
		int place = max(0,pos-m);
		int zeropos = pos;
		for(int i=place; i<pos;i++){
			if(s[i]=='0'){
				zeropos = i;
				break;
			}
		}
		if(zeropos==pos){
			loose = true;
			break;
		}
		else{
			sauts.push_back(pos-zeropos);
			pos = zeropos;
		}
	}
	
	if(loose){
		printf("-1\n");
	}
	else{
		//~ sauts.reverse();
		for(int i=(int)sauts.size()-1;i>=0;i--){
			printf("%d ",sauts[i]);
		}
	}
}	



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

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

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a;
  cin >> a;
  cout << 3*a*a << endl;
}

Measured memory_bytes: 256
/*https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for (int i = 0; i <= n; i++)
	{
		if (int(i * 1.08) == n)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}

Measured memory_bytes: 3576
import bisect

N, K = map(int, input().split())
A = []; B = [0]

for i in range(N):
    a, b = map(int, input().split())
    A.append([a, b])
A.sort()
for i in range(N):
    B.append(A[i][1] + B[i])

ans = bisect.bisect_left(B, K) - 1
print(A[ans][0])

Measured memory_bytes: 29816
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define inf 1000000000
#define mod 1000000007
using namespace std;
template <class T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <class T> void chmin(T &x,T y){x=x<y?x:y;return;}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;

ll h,w;

int main()
{
	cin>>h>>w;
	if(h==1||w==1) cout<<1<<endl;
	else if(w%2==0||h%2==0) cout<<h*w/2<<endl;
	else cout<<h*w/2+1<<endl;
	return 0;
}

Measured memory_bytes: 3572
import java.util.Scanner;
public class Main {
	void range(){
		int a,b,c;
		Scanner s = new Scanner(System.in);
		a = s.nextInt();
		b = s.nextInt();
		c = s.nextInt();
		if(a < b && b < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

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

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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;

    vector<int> d(n);
    REP(i,n)
        cin >> d[i];
    
    sort(ALL(d));

    int mid = n/2;
    int ans = d.at(mid) - d.at(mid-1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){

	int i;
	int N;
	scanf("%d", &N);
	int num[N], sum=0, ave;
	int ans1=0, ans2=0;

	for(i=0; i<N; i++){
		scanf("%d", &num[i]);
	}

	for(i=0; i<N; i++){
		sum += num[i];
	}

	ave = sum / N;
	
	for(i=0; i<N; i++){
		ans1 += (num[i] - ave) * (num[i] - ave);
		ans2 += (num[i] - ave -1) * (num[i] - ave -1); 
	}

	if(ans1>ans2){
		printf("%d\n", ans2);
	}else{
		printf("%d\n", ans1);
	}



	return 0;
}

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

int main(){
  int a=0, b=0, c=0, d=0;
  int n;
  cin >> n;
  rep(i, n){
    string tmp;
    cin >> tmp;
    if(tmp=="AC")a++;
    if(tmp=="WA")b++;
    if(tmp=="TLE")c++;
    if(tmp=="RE")d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int a[1111],b[1111],c[1111],d[1111],p[1111],i,j,x,y,z;
main(){
  for(;scanf("%d%d%d",a,b,c)&&(*a+=*b+*c);){
    for(i=0,scanf("%d",p);i++<*p;scanf("%d%d%d%d",a+i,b+i,c+i,d+i),p[i]=2);
    for(i=0;i++<1111;)
      for(j=0;j++<*p;d[j]?p[a[j]]=p[b[j]]=p[c[j]]=1:(x=p[a[j]]&1)&(y=p[b[j]]&1)?p[c[j]]=0:x&(z=p[c[j]])?p[b[j]]=0:y&z?p[a[j]]=0:0);
    for(i=0;i<*a;printf("%d\n",p[++i]));
  }return 0;
}

Measured memory_bytes: 616
#include <iostream>

using namespace std;

int main() {
  long long n;
  cin >> n;
  long long ans = (n * (n + 1)) / 2;
  for (int i = 2; i <= n; ++i) {
    if (i % 3 == 0 || i % 5 == 0) ans -= i;
  }
  cout << ans << endl;
  return 0;
}


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

#define MAX_N 100000

int main(){
	int N, M;
	int x, y;
	bool flag[MAX_N];
	int cnt[MAX_N];
	cin >> N >> M;
	flag[0] = true;
	for(int i=1; i<N; i++) flag[i] = false;
	for(int i=0; i<N; i++) cnt[i] = 1;
	
	for(int i=0; i<M; i++){
		cin >> x >> y;
		x--; y--;
		if(flag[x]) flag[y] = true;
		cnt[x]--; cnt[y]++;
		if(cnt[x]==0) flag[x] = false;
	}

	int res = 0;
	for(int i=0; i<N; i++){
		if(cnt[i]!=0 && flag[i]) res++;
	}

	cout << res << endl;
}
		







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

int main() {
    string S;
    cin >> S;

    int res = 0;
    for (int i = 0; i < 3; i++) {
        if (S.at(i) == 'o') {
            res++;
        }
    }

    cout << 700 + res * 100 << endl;
}

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

int main()
{
    long k,n,mx=0;
    cin>>k>>n;
    long a[n];
    for(int i=0;i<n;++i)
    cin>>a[i];
    for(int i=1;i<n;++i)
    {
        mx = max(mx, a[i]-a[i-1]);
    }
    mx = max(mx, a[0]+(k-a[n-1]));
    cout<<k-mx<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}


int main() {
  int N ; cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  sort(a.begin(),a.end());
  
  vector<ll>l;
  rep(i,N){
    int cnt = 1;
    while(a[i] == a[i+1] && i+1<=N-1){
      cnt++;
      i++;
    }
    if(cnt >= 4){
      l.push_back(a[i]);
      l.push_back(a[i]);
    }
    else if(2 <= cnt){
      l.push_back(a[i]);
    }      
  }
  sort(l.begin(),l.end());
  
  ll ans;
  if(l.size() < 2) ans = 0;
  else ans = l[l.size()-1]*l[l.size()-2];
  
  cout << ans << endl;
  
}

  



Measured memory_bytes: 1660
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
using namespace std;

int main(){

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

	int n,m,x,minCost=INT_MAX;
	cin>>n>>m>>x;
	vector<vector<int>> a(n,vector<int>(m)), dp(1<<n,vector<int>(m+1,0));
	vector<int> c(n);
	for(int i=0;i<n;i++)
	{
		cin>>c[i];
		for(int j=0;j<m;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=1;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				dp[i]=dp[i&(~(1<<j))];
				for(int k=0;k<m;k++)
				{
					dp[i][k]+=a[j][k];
				}
				dp[i][m]+=c[j];
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		bool greater=true;
		for(int j=0;j<m;j++)
		{
			if(dp[i][j]<x)
			{
				greater=false;
			}
		}
		if(greater) minCost=min(minCost,dp[i][m]);
	}
	if(minCost==INT_MAX)
		cout<<-1<<endl;
	else
		cout<<minCost<<endl;
	return 0;
}


Measured memory_bytes: 3884
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  for(int i = 1;;i++) {
    if(i*i > N) {
      cout << (i-1)*(i-1) << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
 
int main(){
    int n,m;
    int num;
    int ans=0;
    cin>>n>>m;
    int like[m]={};
    int a;
    for(int i=0;i<n;i++){
        cin>>num;
        for(int j=0;j<num;j++){
            cin>>a;
            like[a-1]++;
        }
    }
    for(int i=0;i<m;i++){
        if(like[i]==n) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256