akhauriyash/Code-Regression huggingface dataset:
//shara's here
//SPEEEEEEEEEED IS KEEEEEEEEEEY
#include <bits/stdc++.h>
using namespace std;
//fold
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
//using ll = long long;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#define push_back pb
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
    speed;
    ll n,t;
    cin>>n>>t;
    vector< vector<ll> > v(n,vector<ll>(2));
	for(ll i=0;i<n;i++){
		for(ll j=0;j<2;j++){
			cin>>v[i][j];
			}
		}
	sort(v.begin(),v.end());
	bool ok=false;
	ll ans=0;
	for(ll i=0;i<n;i++){
		if(v[i][1]<=t){ok=true; ans=v[i][0]; break;}
		}
	if(ok){
		cout<<ans<<endl;
		}
	else cout<<"TLE"<<endl;











	


































return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int x,a,b;cin>>x>>a>>b;
  cout<<(x-a)-(x-a)/b*b<<endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li, li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li, li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b) {
	if (b)cout << "Yes";
	else cout << "No";
}
void yes(li b) {
	if (b)cout << "yes";
	else cout << "no";
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	cout.precision(16);

	li N,M;
	cin >>N>>M;
	Yes(N==M);
}

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

using namespace std;

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

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

    // Say we take two blocks
    // w1 s1 v1
    // w2 s2 v2
    //
    // what order do we stack them?
    // obviously we get v1 + v2 value regardless of order
    // have the same weight if we want to put more stuff below them
    // Only need to consider putting more blocks above
    // put 1 on top of 2 if s2 - w1 > s1 - w2
    // or equivalently 
    // 1 goes on top of 2 if s2 + w2 > s1 + w1
    // Sort by sum of s + w
    // then dp?
    // dp[i][j] = max value of first i blocks with weight <= j
    int n;
    cin >> n;
    using block = tuple<int, int, int, int>;
    vector<block> blocks;
    int max_w = 0;
    int max_s = 0;
    for (int i = 0; i < n; ++i) {
        int w, s, v;
        cin >> w >> s >> v;

        max_w = max(max_w, w);
        max_s = max(max_s, s);
        blocks.emplace_back(w + s, w, s, v);
    }
    sort(all(blocks));

    int cap = max_s + max_w;
    // now run the dp
    vector<vector<ll>> dp(n + 1, vector<ll>(cap + 1, 0LL));

    for (int i = 0; i < n; ++i) {
        int ws, w, s, v;
        tie(ws, w, s, v) = blocks[i];
        for (int j = 0; j <= cap; ++j) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i + 1][j - 1]);
            }

            if (j <= s and j + w <= cap) {
                dp[i + 1][j + w] = max(dp[i + 1][j + w], dp[i][j] + v);
            }
        }
    }

    cout << dp[n][cap] << '\n';

    return 0;
}


Measured memory_bytes: 160640
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int power(int K){
  if( K == 0){ return 1;}
  return 2 * power( K - 1);}
  

int main(){
  int A,B,C,K; cin >> A >> B >> C >> K;
  int x = max(max(A,B),C);
  
  cout << A + B + C + x * power( K ) - x << endl;
  
  return 0;}
  
  

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}


template<class T,class F>
struct SegmentTree{
	F f;
	T ti;
	vector<T>dat;
	int sz;
	SegmentTree(const F &f,const T &ti):f(f),ti(ti){}
	void build(const vector<T>&v){
		assert(v.size());
		sz=1;
		while(sz<v.size())sz<<=1;
		dat.resize(sz<<1,ti);
		for(int i=0;i<v.size();i++)dat[sz-1+i]=v[i];
		for(int i=sz-2;i>=0;i--)dat[i]=f(dat[i*2+1],dat[i*2+2]);
	}

	inline void update(int k,T x){
		k+=sz-1;
		dat[k]=x;
		while(k){
			k=(k-1)/2;
			dat[k]=f(dat[k*2+1],dat[k*2+2]);
		}
	}

	inline void add(int k,int x){
		k+=sz-1;
		dat[k]=f(dat[k],x);
		while(k){
			k=(k-1)/2;
			dat[k]=f(dat[k*2+1],dat[k*2+2]);
		}
	}

	inline T query(int a,int b){
		return query(a,b,0,0,sz);
	}
	T query(int a,int b,int k,int l,int r){
		if(r<=a||b<=l)return ti;
		if(a<=l&&r<=b)return dat[k];
		return f(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
	}
};

signed main(){
	auto f=[](int a,int b){return min(a,b);};
	const int ti=(1ll<<31)-1;
	SegmentTree<int,decltype(f)>seg(f,ti);

	int N,Q;
	scanf("%lld%lld",&N,&Q);
	seg.build(vint(N,ti));
	while(Q--){
		int t,x,y;
		scanf("%lld%lld%lld",&t,&x,&y);
		if(t==0){
			seg.update(x,y);
		}
		else{
			y++;
			printf("%lld\n",seg.query(x,y));
		}
	}
	return 0;
}


Measured memory_bytes: 5748
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    cout << (!(s[0] == s[1] && s[1] == s[2]) ? "Yes" : "No") << endl;

    return 0;
}

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


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

  return gcd(b % a, a);
}

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


int main() {
  long long N, M; cin >> N >> M;
  vector<long long> A;
  rep(i, N) {
    long long a;
    cin >> a;
    A.push_back(a / 2);
  }
  long long scm = 1;
  for (long long a: A) {
    scm = lcm(a, scm);
  }
  for (long long a: A) {
    if ((scm / a) % 2 == 0) {
      scm = 0;
      break;
    }
  }
  if (scm == 0) {
    cout << scm << endl;
  } else {
    long long scm_num = M / scm;
    long long ans = scm_num / 2;
    if (scm_num % 2 == 1) {
      ans ++;
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
ll mod = 1000003;
ll INF = 1000000099;

long long modpow(long long a, long long n, long long mod) {//a^n(mod)を求める
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;//次の準備
        n >>= 1;
    }
    return res;
}

const ll MAX = 1000003;//設定して

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}


signed main(){
    ll q;
    cin>>q;
    COMinit();

    while(q--){
        ll x,d,n;
        cin>>x>>d>>n;
        if(d==0){
            cout << modpow(x,n,mod) << endl;
            continue;
        }
        
        if(n>=mod || (x*inv[d] -1)%mod > (x*inv[d]+n-1)%mod){
            cout << 0 << endl;
        }else{
            cout << (modpow(d,n,mod)*fac[(x*inv[d]+n-1)%mod]*finv[(x*inv[d] -1)%mod] )%mod << endl;
        }
    }   
}

Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  VV<> s(m, V<>(n));
  for (int i = 0; i < m; ++i) {
    int k; cin >> k;
    while (k--) {
      int x; cin >> x, --x;
      s[i][x] = 1;
    }
  }
  V<> p(m); for (auto&& e : p) cin >> e;
  int res = 0;
  for (int bit = 0; bit < 1 << n; ++bit) {
    bool ok = true;
    for (int i = 0; i < m; ++i) {
      int c = 0;
      for (int j = 0; j < n; ++j) if (bit >> j & 1) {
        c += s[i][j];
      }
      if ((c & 1) != (p[i] & 1)){
        ok = false;
        break;
      }
    }
    res += ok;
  }
  cout << res << '\n';
}

Measured memory_bytes: 3668
from collections import deque
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for i in range(1, min(n, k+1)):
    vv = deque(v)
    q = deque(v[:i])
    for _ in range(i+1):
        tmp = list(q)
        tmp.sort()
        rem = k-i
        s = sum(tmp)
        for j in tmp:
            if rem==0 or j>=0:
                break
            s -= j
            rem -= 1
        ans = max(ans, s)
        q.pop()
        q.appendleft(vv.pop())
if k>=n:
    v.sort()
    rem = k-n
    s = sum(v)
    for j in v:
        if rem==0 or j>=0:
            break
        s -= j
        rem -= 1
    ans = max(ans, s)
print(ans)

Measured memory_bytes: 73704
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String n = in.nextLine();
        for(int i = 1; i < n.length(); i++) {
            if(n.charAt(i) != '0') {
                int sum = 0;
                for(int j = 0; j < n.length(); j++) {
                    sum += n.charAt(j) - '0';
                }
                System.out.println(sum);
                return;
            }
        }
        if(n.charAt(0) == '1') {
            System.out.println(10);
            return;
        }
        System.out.println(n.charAt(0));
    }
}


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

int main(void) {
  int N, x;
  int a[110];
  
  cin >> N >> x;
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a, a+N);
  int num = 0;
  bool hasZero = false;
  for (int i = 0; i < N; ++i) {
    if (x >= a[i]) {
      ++num;
      x -= a[i];
    } else {
      hasZero = true;
    }
  }
  
  if (!hasZero && x > 0 && num > 0) --num;
  cout << num << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <istream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
//#include <unordered_map>
#include <cstring>
#include <string.h>
#include <iomanip>
#include <queue>
#include <stack>
#include <list>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

#define fopen freopen("substrcmp.in", "r", stdin); freopen("substrcmp.out","w", stdout)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define IOSFAST ios::sync_with_stdio(false); cin.tie(0)

const ll MOD = 1000LL * 1000 * 1000 + 7;
const int INF = 1e9;
const ll base = 1e18;
const int MAX = 1000;
const double EPS = 1e-9;
const double PI = acos(-1.);

int n,m;
char a[102][102];
map<char,int> cnt;
int main()
{
	cin >> n >> m;
	FOR(i,0,n)
	{
		FOR(j,0,m)
		{
			cin >> a[i][j];
			cnt[a[i][j]]++;
		}
	}
	int cnt1 = ((n%2)&&(m&2));
	int cnt2 = 0;
	if (n%2)
	{
		cnt2+=m/2;
	}
	if (m%2)
	{
		cnt2+=n/2;
	}
	int cnt4 = n*m-cnt1-2*cnt2;
	cnt4/=4;
	while (cnt4>0)
	{
		bool flag = true;
		for (map<char, int>::iterator iter = cnt.begin(); iter!= cnt.end(); iter++)
		{
			if (iter->s >= 4)
			{
				iter->s-=4;
				cnt4--;
				flag = false;
				break;
			}
		}
		if (flag)
			break;
	}
	while (cnt2>0)
	{
		bool flag = true;
		for (map<char, int>::iterator iter = cnt.begin(); iter!= cnt.end(); iter++)
		{
			if (iter->s >= 2)
			{
				iter->s-=2;
				cnt2--;
				flag = false;
				break;
			}
		}
		if (flag)
			break;
	}
	while (cnt1>0)
	{
		bool flag = true;
		for (map<char, int>::iterator iter = cnt.begin(); iter!= cnt.end(); iter++)
		{
			if (iter->s >= 1)
			{
				iter->s-=1;
				cnt1--;
				flag = false;
				break;
			}
		}
		if (flag)
			break;
	}
	if (cnt1+cnt2+cnt4 == 0)
	{
		cout << "Yes";
	} else
	{
		cout << "No";
	}
	return 0;
}



Measured memory_bytes: 256
// Problem : A - Circle Pond
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

// sprawdz MODULO!
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int r;
	cin >> r;
	cout << fixed << setprecision(20) << r * M_PI * 2 << endl;
	return 0;
}
 


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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 505;
int h, w, cnt;
int a[N][N];
vector<int> res[N * N];

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < h; ++i) {
        if (i & 1) {
            for (int j = w - 1; j >= 0; --j) {
                if (a[i][j] & 1) {
                    if (j == 0) {
                        if (i < h - 1) {
                            res[cnt++] = {i, j, i + 1, j};
                            ++a[i + 1][j];
                        }
                    } else {
                        res[cnt++] = {i, j, i, j - 1};
                        ++a[i][j - 1];
                    }
                }
            }
        } else {
            for (int j = 0; j < w; ++j) {
                if (a[i][j] & 1) {
                    if (j < w - 1) {
                        res[cnt++] = {i, j, i, j + 1};
                        ++a[i][j + 1];
                    } else {
                        if (i < h - 1) {
                            res[cnt++] = {i, j, i + 1, j};
                            ++a[i + 1][j];
                        }
                    }
                }
            }
        }
    }
    cout << cnt << endl;
    for (int i = 0; i < cnt; ++i) {
        cout << res[i][0] + 1 << ' ' << res[i][1] + 1 << ' ' <<
             res[i][2] + 1 << ' ' << res[i][3] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 14456
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
#define Pll pair<ll,ll>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	char c;
	int N;
	map<char,int> mp;
	cin>>N;

	REP(i,N){
		cin>>c;
		mp[c]++;
	}
	
	if(mp.size()==3) print("Three");
	else print("Four");
	return 0;
}




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

int main() {
	int N;cin>>N;
	vector<int>H(N);
	for(int i=0;i<N;i++)cin>>H[i];
	int ans = 0;
	int cnt = 0;
	int pre = -1;
	for (int i = 0; i < N; i++)
	{
		if (pre < H[i])
		{
			ans = max(ans, cnt);
			cnt = 0;
		}
		else cnt++;

		pre = H[i];
	}
	ans = max(ans, cnt);

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>

#ifdef GONGKUNPENG
#include <cassert>
#define _GG 1
#else
#define _GG 0
#endif

#define uint unsigned
#define ll long long
#define ull unsigned long long
#define vector std::vector
#define ms(a, v) memset(a, v, sizeof(a))
#define ufor(i, n) for (int i = 1; i < n; ++i)
#define sfor(i, n) for (int i = 1; i <= n; ++i)
#define tfor(i, n) for (int i = 0; i < n; ++i)
using std::max;
using std::min;
using std::sort;
using std::swap;

#define _GIO 1

#if _GIO
struct _gio {
#define BFSZ 1 << 18
#define blank(x) (x == ' ' || x == '\t' || x == '\n' || x == '\r')

  char rcha;
  bool rneg;
#if _GG
#else
  char ruf[BFSZ], wuf[BFSZ], *r1, *r2, *w1;
#endif

  _gio() {
    rcha = ' ';
#if _GG
#else
    r1 = r2 = ruf, w1 = wuf;
#endif
  }

  ~_gio() {
#if _GG
#else
    fwrite(wuf, 1, w1 - wuf, stdout);
#endif
  }

  inline void flush() {
#ifdef _GG
#else
    fwrite(wuf, 1, w1 - wuf, stdout), w1 = wuf;
#endif
  }

  inline int readc() {
#if _GG
    return getchar();
#else
    return (r1 == r2 && (r2 = (r1 = ruf) + fread(ruf, 1, BFSZ, stdin), r1 == r2)
                ? -1
                : *r1++);
#endif
  }

  template <typename T, typename... Args>
  void read(T &x, Args &... args) {
    read(x), read(args...);
  }

  inline void read() {}

  inline void read(char *s) {
    while (blank(rcha)) rcha = readc();
    while (!blank(rcha) && rcha > 0) *s++ = rcha, rcha = readc();
    *s = '\0';
  }

  inline void readl(char *s) {
    while (blank(rcha)) rcha = readc();
    while (rcha != '\n' && rcha > 0) *s++ = rcha, rcha = readc();
    *s = '\0';
  }

  template <typename T>
  inline void read(T &x) {
    x = rcha = rneg = 0;
    while (!isdigit(rcha) && rcha != '-') rcha = readc();
    rcha == '-' && (rneg = true, rcha = readc());
    while (isdigit(rcha)) x = (x << 3) + (x << 1) - 48 + rcha, rcha = readc();
    rneg && (x = -x);
  }

  inline void writec(char c) {
#if _GG
    putchar(c);
#else
    (w1 - wuf == BFSZ) && (fwrite(wuf, 1, BFSZ, stdout), w1 = wuf);
    *w1++ = c;
#endif
  }

  template <typename T, typename... Args>
  void write(const T &x, const Args &... args) {
    write(x), write(args...);
  }

  template <typename T, typename... Args>
  void writel(const T &x, const Args &... args) {
    write(x), write(args...);
    writec('\n');
  }

  inline void write() {}

  inline void write(const char &c) { writec(c); }

  template <typename T>
  void write(T x) {
    if (x < 0) {
      writec('-');
      write(-(long long)(x));
      return;
    }
    if (x > 9) write(x / 10);
    writec(x % 10 ^ 48);
  }

  inline void write(const char *s) {
    while (*s) writec(*s++);
  }
#undef BFSZ
} io;
#endif

const int INF = 0x3f3f3f3f;
const int MAXN =
#ifdef GONGKUNPENG
    15
#else
    1000005
#endif
    ;

int main() {
  int a, b;
  io.read(a, b);
  io.write(a <= b ? "unsafe\n" : "safe\n");
  return 0;
}

Measured memory_bytes: 3060
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod=1000000007;
typedef pair<int,int>pii;
int main()
{
	int num;
	scanf("%d",&num);
	vector<pii>v;
	for(int i=0;i<num;i++)
	{
		int z;
		scanf("%d",&z);
		v.push_back(make_pair(z,-1));
	}
	for(int i=0;i<num;i++)
	{
		int z;
		scanf("%d",&z);
		v.push_back(make_pair(z,1));
	}
	sort(v.begin(),v.end());
	vector<int>now;
	ll ans=1;
	int cnt=0;
	for(int i=0;i<num*2;i++)
	{
		cnt+=v[i].second;
		now.push_back(v[i].second);
		if(cnt==0)
		{
			int p=now[0];
			ll c=0;
			for(int j=0;j<now.size();j++)
			{
				if(p==now[j])c++;
				else
				{
					ans*=c;
					ans%=mod;
					c--;
				}
			}
			now.clear();
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int[] array = new int[3];
		int box = 0;
		for(int i = 0;i < 3;i++)
		{
			array[i] = scan.nextInt();
		}
		
		for(int i = 0;i < 2;i++)
		{
			for(int j = i + 1;j < 3;j++)
			{
				if(array[i] > array[j])
				{
					box = array[i];
					array[i] = array[j];
					array[j] = box;
				}
			}
		}
		System.out.println(array[0] + " " + array[1] + " " + array[2]);
	}
}

Measured memory_bytes: 17360
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, n;
    cin >> x >> n;
    set<int> st;
    rep(i,n){
        int p;
        cin >> p;
        st.insert(p);
    }
    for(int i = 0; i <= 300; ++i){
        if(st.find(x - i) == st.end()){
            cout << x - i << endl;
            return 0;
        }
        if(st.find(x + i) == st.end()){
            cout << x + i << endl;
            return 0;
        }
    }
	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

const ll mod = 1e9 + 7;
const ll N = 1e6 + 6;
const ll maxN = 1e6 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

int dx[4] = { -1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// up, right, down, left

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

ll n;
ll a[maxN];
int hash1[maxN];
int h1[maxN];

vt<int> spf(maxN);
void spfsieve() {
	for (int i = 2; i < maxN; i += 2)
		spf[i] = 2;
	for (int i = 3; i < maxN; i += 2) {
		if (spf[i] == 0) {
			spf[i] = i;
			for (int j = 2 * i; j < maxN; j += i) {
				if (spf[j] == 0)
					spf[j] = i;
			}
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in6.txt", "r", stdin);
	freopen("out2.txt", "w", stdout);
#endif
	FIO
	spfsieve();
	cin >> n;
	ll g = 0;
	set<int> s[n];
	FOR(i, n) {
		cin >> a[i];
		g = __gcd(g, a[i]);
		ll t = a[i];
		while (t != 1) {
			s[i].insert(spf[t]);
			t = t / spf[t];
		}
	}
	ll f1 = 0;
	for (int i = 0; i < n; ++i) {
		for (auto& it : s[i]) {
			if (h1[it] == 1) {
				f1 = 1; break;
			}
			h1[it] = 1;
		}
	}
	if (f1 == 0)
		cout << "pairwise coprime";
	else if (g == 1)
		cout << "setwise coprime";
	else
		cout << "not coprime";
	return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {

		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str;
        while((str=br.readLine())!=null){
        String[] sp = str.split(" ");

        int a = Integer.parseInt(sp[0]);
        int b = Integer.parseInt(sp[1]);

        System.out.println(a * b);

        }
	}

}

Measured memory_bytes: 24396
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

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

int main(){
    vector<double> n(1);
    int tmp=0;
    double s;
    while (scanf("%lf",&s)!=EOF){
        n.push_back(s);
        tmp++;
    }
    sort(n.begin(),n.end());
    printf("%lf\n",n[tmp]-n[1]);
    return 0;
}

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


int n,s;

long long int dp[10][1010];

int main(void){
	dp[0][0]=1LL;
	rep(i,101){
		for(int j=8;j>=0;j--)rep(k,1010){
			if(k+i<=1010)
				dp[j+1][k+i]+=dp[j][k];
		}
	}
	while(cin >> n >> s,n){
		cout << dp[n][s] << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // malloc(), free()
#include <string.h>         // memset()

#define MAX_N 2000000
#define MAX_V 10000


int
main(int argc, char** argv)
{
	unsigned short *a, *b;
	int c[MAX_V + 1];
	int n;
	int i;

	scanf("%d", &n);
	a = malloc(sizeof(short) * n + 1);
	b = malloc(sizeof(short) * n + 1);
	memset(c, 0, sizeof(int) * MAX_V + 1);

	for (i = 0; i < n; ++i)
	{
		scanf("%hu", &a[i + 1]);
		c[a[i + 1]]++;
	}

	for (i = 1; i <= MAX_V; ++i)
		c[i] = c[i] + c[i - 1];

	for (i = n; i >= 1; --i)
	{
		b[c[a[i]]] = a[i];
		c[a[i]]--;
	}

	for (i = 1; i <= n; ++i)
		printf("%d%c", b[i], (i != n) ? ' ' : '\n');

	free(a);
	free(b);
	return 0;
}

Measured memory_bytes: 8408
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/
int md;

void dfs(int cur, vector<vector<int>> &g, map<pair<int, int>, int> &color, vector<int> &used, int c) {
  used[cur] = 1;
  for(int i = 0; i < g[cur].size(); i++) {
    int nxt = g[cur][i];
    if(used[nxt] == 1) continue;
    color[{cur, nxt}] = c;
    color[{nxt, cur}] = c;
    c = c + 1;
    c %= md;
    dfs(nxt, g, color, used, c);
  }
}

int main(){
  
  int n; cin >> n;
  vector<vector<int>> g(n);
  vector<int> d(n, 0);
  map<pair<int, int>, int> id;
  for(int i = 0; i < n - 1; i++) {
    int a, b; cin >> a >> b;
    a--;
    b--;
    d[a]++;
    d[b]++;
    g[a].push_back(b);
    g[b].push_back(a);
    id[{a, b}] = i;
    id[{b, a}] = i;
  }

  for(int i = 0; i < n; i++) md = max(md, d[i]);

  map<pair<int, int>, int> color;
  vector<int> used(n, 0);
  dfs(0, g, color, used, 0);
  vector<int> ans(n - 1);
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < g[i].size(); j++) {
      int idd = id[{i, g[i][j]}];
      ans[idd] = color[{i, g[i][j]}];
    }
  }
  
  cout << md << endl;
  for(auto hoge : ans) cout << hoge + 1 << endl;

  return 0;
}


Measured memory_bytes: 32256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>

using namespace std;

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

    string a;

    // 引数の受け取り
    cin >> a ;
    // 回答用
    string ans = "";

    // コード
    for (int i=0;i<a.size();i++){
        for (int j=i+1;j<=a.size();j++){
            if(a[i]==a[j]) {
                a.erase(j, 1);
                break;
            } else if(j==a.size()){
                cout << "No" << endl;
                return 0;
            }
        } 
    }
    cout << "Yes" << endl;

    // 出力
    return 0;
}



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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*
--------------------------------------------

	Optimizer

--------------------------------------------
*/
//#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*
--------------------------------------------
 
	Utility Algorithm

-------------------------------------------- 
*/

template <typename T>
void swapAlgorithm(T& a, T& b) {
    T tmp = a;
    a = b;
    b = tmp;
}
 
template <typename T1>
T1 euclideanAlgorithm(T1 a, T1 b) {
    T1 a_tmp = a;
    T1 b_tmp = b;
 
    if (a_tmp > b_tmp) {
        swapAlgorithm<T1>(a_tmp, b_tmp);
    }
 
    T1 r = a_tmp % b_tmp;
    while (r != 0) {
        a_tmp = b_tmp;
        b_tmp = r;
        r = a_tmp % b_tmp;
    }
    return b_tmp;    
}

template <typename T2>
T2 getLCM(T2 a, T2 b) {
    return (a * b)/(euclideanAlgorithm(a, b));
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        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);
    }
};

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    sort(ALL(s));
    sort(ALL(t), std::greater<char>());

    REP(s.size()) {
        if(s[i] > t[i]) {
            cout << "No" << endl;
            return 0;
        }

        if(s[i] < t[i]) {
            cout << "Yes" << endl;
            return 0;
        };

        if(s[i] == t[i] && i == (s.size() - 1) && s.size() >= t.size()) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (A, B) = listOfInt()
    println(if (A in 1..9 && B in 1..9) A * B else -1)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { it.toInt() + delta }


Measured memory_bytes: 37816
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory.h>
#include<map>
#include<set>
#include<queue>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
map<int,int>M;
int N,n;
const int mod=1e9+7;
int a[2000005],f[200005],last[200005];
int main()
{
	cin>>n;
	rep(i,1,n)
	{
		scanf("%d",a+i);
		if(M.count(a[i]))a[i]=M[a[i]];else a[i]=M[a[i]]=++N;
	}
	rep(i,1,N)last[i]=2000001;
	f[0]=1;
	n=unique(a+1,a+1+n)-a-1;
	rep(i,1,n)f[i]=(f[i-1]+f[last[a[i]]])%mod,last[a[i]]=i;
	cout<<f[n];
}


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

int n, m, k;
string s[10];

int main(){
	cin >> n >> m >> k;
	rep(i, n) cin >> s[i];
	int ans = 0;
	rep(mask_r, 1 << n){
		rep(mask_c, 1 << m){
			int cnt = 0;
			rep(i, n){
				rep(j, m){
					if(s[i][j] == '#' && (mask_r & (1 << i)) && (mask_c & (1 << j))){
						cnt++;
					}
				}
			}
			if(cnt == k) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next(), b = sc.next();
		int diff = a.length() - b.length();
		if(diff == 0) diff = a.compareTo(b);
		if(diff > 0) System.out.println("GREATER");
		else if(diff < 0) System.out.println("LESS");
		else System.out.println("EQUAL");
	}
}

Measured memory_bytes: 21844
//abc147D
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define deb 62
int main(void) {
  int i, j;
  long long n, mod=1000000007, sum=0,bin=1, x[deb];
  scanf("%lld", &n);
  long long a[n];

  for(i=0; i < n; i++)
    scanf("%lld", &a[i]);
  for(i=0; i < deb; i++)
    x[i]=0;

  for(i=0; i < n; i++){
    for(j=0; j < deb; j++){
      if(a[i] & 2 != 0) x[j]++;
      a[i]/=2;
      if(a[i]==0)break;
    }
  }

  for(i=0; i < deb; i++){
    sum=(sum+x[i]*(n-x[i])%mod*bin)%mod;
    bin=bin*2%mod;
    //printf("%d ", x[i]);
  }
  printf("%lld", sum);
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
int x;

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

	cin >> x;
	cout << (x^1) << endl;
 
	cout.flush();
	return 0;
}

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

#define lli long long int
#define FOR(i,n) for(i = 0; i < n; i++)
#define ALL(arr) arr.begin(),arr.end()
#define PI acos(-1)

using namespace std;

void solve()
{
    lli n,i,a,b,c,x,y,k;
    cin >> n >> k;
    vector<lli> arr(k),dis(k);
    cin >> arr[0];

    for(i = 1; i < k; i++) {
        cin >> arr[i];
        dis[i-1] = arr[i] - arr[i-1];
    }
    dis[k-1] = arr[0] + n - arr[k-1] ;

    sort(ALL(dis));
    cout << n - dis[k-1] << endl;

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

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#define N 10000

using namespace std;

int main(){

  int n,q,time,cnt_time=0;
  string name;
  queue<pair<string,int> > que;
  cin >> n >> q;

  for(int i=0;i<n;i++){
    cin >> name >> time;
    que.push(make_pair(name,time));
  }

  while(!que.empty()){
    pair<string,int> top = que.front();
    que.pop();
    if(top.second <= q){
      cnt_time += top.second;
      cout << top.first << " " << cnt_time << endl;
    }
    else{
      cnt_time += q;
      que.push(make_pair(top.first,top.second-q));
    }
  }
}





Measured memory_bytes: 6224
import copy

def sol(animals):
  for i, rep in enumerate(reps[:N-2]):
    if i == 0: continue
    if animals[i] == 1:animals[i+1] = rep*animals[i-1]
    else:animals[i+1] = -rep*animals[i-1]

  if animals[-2] == 1 and animals[-1] != reps[-2]*animals[-3]: return False
  elif  animals[-2] == -1 and animals[-1] != -reps[-2]*animals[-3]: return False
      
  if animals[-1] == 1 and animals[0] != reps[-1]*animals[-2]:return False
  elif animals[-1] == -1 and animals[0] != -reps[-1]*animals[-2]: return False

  return animals

N = int(input())
reps = [1 if s=='o' else -1 for s in input()]
animals = [0 for _ in range(N)]

if reps[0] == 1:
  cases = [[1,1,1], [-1,1,-1],[1,-1,-1],[-1,-1,1]]
else:
  cases = [[-1,1,1],[1,1,-1],[1,-1,1],[-1,-1,-1]]
  
for case in cases:
  animals1 = copy.deepcopy(animals)
  animals1[-1],animals1[0],animals1[1] = case #1,1,1
  res = sol(animals1)
  if res is not False:
    print(''.join(['S' if s==1 else 'W' for s in res]))
    exit()
print(-1)


Measured memory_bytes: 56608
#include<stdio.h>
int main()
{
  int A, B, c=0;
  scanf("%d%d",&A,&B);
  if(A>=13)
  {
    printf("%d\n",B);
  }
  else if(A>=6 && A<=12)
  {
    printf("%d\n",B/2);
  }
  else
  {
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int w,h,n; cin>>w>>h>>n;
  int a=0;
  int b=w;
  int c=0;
  int d=h;
  rep(i,n){
    int x,y,A; cin>>x>>y>>A;
    if(A==1)
    a=max(a,x);
    else if(A==2)
    b=min(x,b);
    else if(A==3)
    c=max(c,y);
    else
    d=min(y,d);
  }
  // cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
  int ans=(b-a)*(d-c);
  if(b-a<=0||d-c<=0)
  ans=0;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[1000000];
map<ll,ll> num;
ll add[1000000];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,k;
    cin>>n>>k;
    num[0]=1;
    ll ret=0;
    for (int i=1;i<=n;i++) {
        if (i>=k)num[add[i-k]]--;
        cin>>a[i];
        a[i]+=a[i-1];
        ll have = ((a[i]-i)%k+k)%k;
        add[i] = have;
        ret+=num[have];
        num[((a[i]-i)%k+k)%k]++;
    }
    cout<<ret<<endl;
}


Measured memory_bytes: 18432
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)

int main(void) {
    string N;
    cin >> N;
    int L = N.size();
    vector<vector<int>> dp(L + 1, vector<int>(2, 0));
    dp[0][1] = 1;
    // dp[i][0] = 上から i 桁についてぴったり払うときの最小枚数
    // dp[i][1] = 上から i 桁について 1 多く払うときの最小枚数
    repr(i, 1, L + 1) {
        int d = N[i - 1] - '0';
        dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + 10 - d);
        dp[i][1] = min(dp[i - 1][0] + d + 1, dp[i - 1][1] + 9 - d);
    }
    cout << dp[L][0] << endl;

    return 0;
}

Measured memory_bytes: 55940
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int x,y,s,i,j,m;
    while(1){
        x=in();
        y=in();
        s=in();
        if(!x)break;
        m=0;
        for(i=1;i<s;i++){
            for(j=1;j<s;j++){
                if(i*(100+x)/100+j*(100+x)/100==s)
                    m=max(m,i*(100+y)/100+j*(100+y)/100);
            }
        }
        print(m);
    }
    return 0;
}


Measured memory_bytes: 2128
n,k=map(int,input().split())
p=list(map(int,input().split()))
dp=[0]*(n-k+1)
dp[0]=sum(p[:k])
for i in range(n-k):
    dp[i+1]=dp[i]+p[k+i]-p[i]
print((max(dp)+k)/2)

Measured memory_bytes: 32004
/**
 *      ABC 100 A
 *      author  : kyomukyomupurin
 *      created : 2018/08/
**/

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

int main(){
    int A, B;
    cin >> A >> B;
    if (A <= 8 && B <= 8){
        cout << "Yay!";
    }
    else {
        cout << ":(";
    }

    return 0;
    
}

Measured memory_bytes: 256