akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

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

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  std::priority_queue<ll> que;

  std::sort(all(a),std::greater<ll>());

  ll ans=0;
  que.emplace(a[0]);

  rep(i,1,n){
    ans+=que.top();que.pop();
    que.emplace(a[i]);
    que.emplace(a[i]);
  }

  std::cout<<ans<<"\n";

  return 0;
}

Measured memory_bytes: 6892
import sys
S =input()
Q=int(input())
orders=[]
for line in sys.stdin.readlines():
    orders.append(line.rstrip().split(" "))
dire=1
right=""
left=""
center=""
for order in orders:
    if order[0]=="1":
        dire=dire*(-1)
        center=right
        right=left
        left=center
    elif order[0]=="2" and order[1]=="1":
        if dire==1:
            left=order[2]+left
        if dire==-1:
            left=left+order[2]
    elif order[0]=="2" and order[1]=="2":
        if dire==1:
            right=right+order[2]
        if dire==-1:
            right=order[2]+right
if dire==1:
    S=S
    right=right
    left=left
elif dire==-1:
    S=S[::-1]
    right=right[::-1]
    left=left[::-1]
print(left+S+right)

Measured memory_bytes: 51840
s=[int(i) for i in list(input())]
s1=int(''.join(map(str,[s[0],s[1]])))
s2=int(''.join(map(str,[s[2],s[3]])))

if 1<=s1<=12 and 1<=s2<=12:
    print('AMBIGUOUS')
elif 1<=s1<=12:
    print('MMYY')
elif 1<=s2<=12:
    print('YYMM')
else:
    print('NA')

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

int main()
{
	long long n, k, sum=0, br=0;
	cin >> n >> k;
	long long a[n+1];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}

	sort(a, a+n, greater<int>());

	for(int i=0; i<n; i++){
		sum += a[i];
		if(sum < k) br++;
		else sum -= a[i], br=0;
	}

	cout << br;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

int main(){
    fastcin();

    LL x;
    cin >> x;
    LL ans = (x/500)*1000;
    x %= 500;
    ans += (x/5)*5;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    string s;
    ll k;
    cin>>s>>k;
    ll n=s.length();
    ll ans=0;
    if(n<k){
        cout << 0<<endl;
        return 0;
    }
    while(k&&n){
        if(s[0]!='0'){
            ans+=com(n-1,k)*pow(9LL,k);
            ll num=(s[0]-'0');
            for(int i=1;i<num;i++){
                ans+=com(n-1,k-1)*pow(9LL,k-1);
            }
            if(n==k&&n==1)ans++;
            k--;
        }
        n--;
        s=s.substr(1,n);
    }
    if(n>k)ans++;
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)    _for (__VA_ARGS__)
#define rep(i,n)    FOR(i, size_t{}, n)
#define ALL(x)      begin (x), end (x)
#define repr(i,n) for (auto i = (n); i -- > 0;)
using namespace std;
using ll = int64_t;

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

  size_t n, m;
  cin >> n >> m;
  vector <bool> solved (n);
  vector <ll> wa (n);
  rep (i, m)
  {
    size_t p;
    string s;
    cin >> p >> s;
    -- p;

    if (solved [p]) continue;
    if (s == "AC") solved [p] = true;
    if (s == "WA") ++ wa [p];
  }

  ll acnum = 0;
  ll wanum = 0;
  rep (i, n)
  {
    if (solved [i])
    {
      ++ acnum;
      wanum += wa [i];
    }
  }
  cout << acnum <<  " " << wanum << endl;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

ll L;
struct icicle{
  ll len,id,time;
  icicle *l,*r;
  int Grow(){
    if(len == 0) return false;
    if( ( l == nullptr || l->len < len) && ( r == nullptr || r->len < len)){
      time += max(l->time,r->time) + L - len;
      len = L;
      ll a = l->Grow();
      return true + a;
    }
    return false;
  }
  void Cut(){
    if(len == L){
      len = 0;
    }
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n >> L;
  vector<icicle> vi(n+2);
  vi[0] = icicle{-1,0,0,nullptr,&vi[1]};
  vi[n+1] = icicle{-1,n+1,0,&vi[n],nullptr};
  REP(i,1,n+1){
    cin >> vi[i].len;
    vi[i].id = i;
    vi[i].l = &vi[i-1];
    vi[i].r = &vi[i+1];
    vi[i].time = 0;
  }
  ll cnt = n,ans = 0;
  while(cnt){
    REP(i,0,n+2){
      cnt -= vi[i].Grow();
    }
    REP(i,0,n+2){
      vi[i].Cut();
    }
  }
  REP(i,0,n+2){
    ans = max(ans,vi[i].time);
  }
  cout << ans <<endl;
  return 0;
}

//       cout << i << "'s r =" << ((vi[i].r != nullptr)?vi[i].r->id:ice.id) << "and" << ((vi[i].l != nullptr) ?vi[i].l->id:ice.id) <<endl;

Measured memory_bytes: 6788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int main() {
	int a;
	cin>>a;
	printf("%.2lf",2*a*3.1415);
} 

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ll long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fr(i, a, b) for(int i=a; i>=b; i--)
#define l long int
#define endl '\n'
#define pb push_back
#define pf pop.front()
using namespace std;


void solve()
{
l n,cnta=0,cntw=0,cntt=0 ,cntr=0;
string s;
cin>>n;
while(n--)
{
	cin>>s;
	if(s == "AC")
	cnta++;
	else if(s == "WA")
	cntw++;
	else if(s == "TLE")
	cntt++;
	else
	cntr++;
}
cout<<"AC x "<<cnta<<endl;
cout<<"WA x "<<cntw<<endl;
cout<<"TLE x "<<cntt<<endl;
cout<<"RE x "<<cntr<<endl;
}


int32_t main()
{
FAST
l T=1;
//cin>>T;
while(T--)
{
solve();
}
}










Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<int,int>
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,j,k,l,m,o,p,t,sum,sum1,flag;
    string s,s1;
    cin>>s>>s1;
    sum=0;
    for(i=0;i<s.length();i++){
        if(s[i]!=s1[i]){
            sum+=1;
        }
    }
    cout<<sum<<endl;

}



Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

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

    if (t.substr(0, t.size()-1) == s && s.size() + 1 == t.size()) {
        cout << "Yes" << endl;
        
    }else {
        cout << "No" << endl;
        
    }


    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define IOS std::ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
const int N = 1e4+20;
const ll Mod = 1e5;
const int INF = 0x3f3f3f3f;
int a[N] = {0};
int b[N] = {0};
int g[N][N] = {0};
int main(){
  int n,m;
  cin>>n>>m;
  int k1=1,k2=n;
  rep(i,m){
    int x,y;
    cin>>x>>y;
    if(x > k1){
      k1 = x;
    }
    if(y < k2){
      k2 = y;
    }
  }
  if(k2 >= k1){
    cout<<k2 - k1+1<<endl;
  }else{
    cout<<0<<endl;
  }
	return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

template<class T>
vector<T> Dijkstra(vector<vector<Edge<T>>> &edges, int st) {

	int V = (int)edges.size();
	const T inf = numeric_limits<T>::max() / 2;
	vector<T> cost(V, inf);
	cost[st] = 0;

	priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> p_que;
	p_que.emplace(st, cost[st]);

	while (!p_que.empty()) {

		Edge<T> now(p_que.top().to, p_que.top().cost);
		p_que.pop();

		if (cost[now.to] < now.cost) continue;
		for (const Edge<T> &e : edges[now.to]) {
			T tmp_cost = now.cost + e.cost;
			if (cost[e.to] > tmp_cost) {
				cost[e.to] = tmp_cost;
				p_que.emplace(e.to, cost[e.to]);
			}
		}
	}

	return cost; // min cost to vertex idx from st
}

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

lint mypow(lint a, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, s, t;
	cin >> N >> M >> s >> t;
	s--, t--;

	vector<vector<Edge<lint>>> edge_yen(N), edge_snu(N);
	for (int i = 0; i < M; i++) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		u--, v--;
		edge_yen[u].emplace_back(v, a);
		edge_yen[v].emplace_back(u, a);
		edge_snu[u].emplace_back(v, b);
		edge_snu[v].emplace_back(u, b);
	}

	auto d_yen = Dijkstra(edge_yen, s);
	auto d_snu = Dijkstra(edge_snu, t);
	DMP(d_yen, d_snu);

	vector<lint> sum_cost(N);
	for (int i = 0; i < N; i++) sum_cost[i] = d_yen[i] + d_snu[i];
	for (int i = N - 2; i >= 0; i--) sum_cost[i] = min(sum_cost[i], sum_cost[i + 1]);

	for (int i = 0; i < N; i++) cout << mypow(10, 15) - sum_cost[i] << "\n";

	return 0;
}

Measured memory_bytes: 19016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 300010;
int n;
vector<vector<int>> v;
int vis[N];
int main() {
	//freopen("input.txt", "r", stdin);
	scanf("%d", &n);
	v.resize(n + 1);
	for (int a, b, i = 0; i < n - 1; i++) {
		scanf("%d%d", &a, &b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	queue<int> q;
	vis[1] = 1, vis[n] = 2;
	q.push(1);
	q.push(n);
	int b = 0, w = 0;
	while (q.size()) {
		int x = q.front();
		q.pop();
		for (int i = 0; i < v[x].size(); i++) {
			int no = v[x][i];
			if (!vis[no]) {
				if (vis[x] == 1)
					b++;
				else
					w++;
				vis[no] = vis[x];
				q.push(no);
			}
		}
	}
	if (w >= b)
		puts("Snuke");
	else
		puts("Fennec");

	return 0;
}


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

dic = {}
list_town = []
set_town = set()
town = 1

for i, v in enumerate(A):
    dic[i+1] = v

for _ in range(K):
    list_town.append(town)
    set_town.add(town)
    town = dic[town]
    if town in set_town:
        stop_twon = town
        break

if N <= K:
    list_first_split = list_town[:list_town.index(stop_twon)]
    list_second_split = list_town[list_town.index(stop_twon):]
    print(list_second_split[(K - (len(list_first_split))) % len(list_second_split)])
else:
    print(town)

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

const int INF = 1e9;
const int MAX_K = 1<<11;

struct P{
    int v,w;
    P(){}
    P(int v, int w):v(v),w(w){}
};
bool operator<(const P &a, const P &b){return a.w<b.w;}
P operator+(const P &a, const P &b){return {a.v+b.v,a.w+b.w};}
ostream &operator<<(ostream &os, const P &a){
    return os<<"("<<a.w<<","<<a.v<<")";
}

vector<P> S[MAX_K];

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vector<P> nodes(N);
    rep(i,N){
        int v,w; cin>>v>>w;
        nodes[i] = P(v,w);
    }
    S[0].pb(P(0,0));
    int K = min(MAX_K,N+1);
    FOR(i,1,K-1){
        int p = i/2;
        for(P e:S[p]){
            S[i].pb(e);
            S[i].pb(e+nodes[i-1]);
        }
        sort(all(S[i]));
        int M = S[i].size();
        int m=1;
        FOR(j,1,M-1){
            if (S[i][m-1].v < S[i][j].v){
                S[i][m++] = S[i][j];
            }
        }
        S[i].erase(S[i].begin()+m, S[i].end());
    }
    // for(P e:nodes){
    //     cout<<e<<" ";
    // }cout<<endl;
    // rep(v,K){
    //     for(P e:S[v]){
    //         cout<<e<<" ";
    //     }cout<<endl;
    // }

    int Q; cin>>Q;
    while(Q--){
        int v,L; cin>>v>>L;
        vector<P> ps;
        ps.pb(P(0,0));
        while(v>=K){
            int M = ps.size();
            rep(i,M){
                ps.pb(ps[i]+nodes[v-1]);
            }
            v>>=1;
        }
        int ans=0;
        for(P e:ps){
            if (L<e.w) continue;
            auto itr = upper_bound(all(S[v]), P(0,L-e.w)); itr--;
            chmax(ans,e.v+itr->v);
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 27164
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, X, Y;
  cin >> A >> B >> C >> D;
  X = A + B;
  Y = C + D;
  if (X == Y) {
    cout << "Balanced" << endl;
  }
  else if (X < Y) {
    cout << "Right" << endl;
  }
  else {
    cout << "Left" << endl;
  }
}


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

typedef unsigned long long ll;

int main(){
	int n,k,s,t;
	int a[52];
	scanf("%d%d%d%d",&n,&k,&s,&t);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int j=0;j<18;j++){
		if(((s>>j)&1)==1&&((t>>j)&1)==0){
			puts("0");
			return 0;
		}
	}
	
	int n_=0;
	int a_[52];
	for(int i=1;i<=n;i++){
		bool ok=true;
		for(int j=0;j<18;j++){
			if(((s>>j)&1)==1&&((a[i]>>j)&1)==0)ok=false;
			if(((t>>j)&1)==0&&((a[i]>>j)&1)==1)ok=false;
		}
		if(ok){
			n_++;
			a_[n_]=a[i];
		}
	}
	n=n_;
	for(int i=1;i<=n_;i++){
		a[i]=a_[i];
	}
	
	if(n==0){
		puts("0");
		return 0;
	}
	vector<int> v;
	for(int j=0;j<18;j++){
		if(((s>>j)&1)==0&&((t>>j)&1)==1)v.push_back(j);
	}
	if(v.size()==0){
		if(n==1)puts("1");
		else puts("0");
		return 0;
	}
	for(int i=1;i<=n;i++){
		a_[i]=0;
		for(int j=0;j<v.size();j++){
			if((a[i]>>v[j])&1)a_[i]+=1<<j;
		}
		a[i]=a_[i];
	}
	int tt=v.size();
	
	ll ret=0;
	static int cnt[1<<18];
	static int dig[1<<18]={};
	for(int i=0;i<(1<<18);i++){
		dig[i]=0;
		for(int j=0;j<18;j++){
			if((i>>j)&1)dig[i]++;
		}
	}
	static ll C[52][52]={};
	C[0][0]=1;
	for(int i=1;i<=50;i++){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<=i-1;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
		}
	}
	for(int i=0;i<=50;i++){
		for(int j=1;j<=50;j++){
			C[i][j]+=C[i][j-1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<(1<<tt);j++)cnt[j]=0;
		for(int j=i+1;j<=n;j++){
			cnt[((1<<tt)-1)^(a[i]^a[j])]++;
		}
		for(int k=0;k<tt;k++){
			for(int j=0;j<(1<<tt);j++){
				if((j>>k)&1){}
				else cnt[j]+=cnt[j+(1<<k)];
			}
		}
		for(int j=0;j<(1<<tt);j++){
			if(dig[j]&1)ret-=C[cnt[j]][k-1];
			else ret+=C[cnt[j]][k-1];
		}
	}
	cout<<ret<<endl;
}

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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


int main() {
    int a, b;
    cin >> a >> b;
    prt(a * b);

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main (void)
{
  int n; cin >> n;
  for (int i = 0; i < 100; i++) {
    int m = n - 4 * i;
    if (m >= 0 && m % 7 == 0) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}


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

using namespace std;

#define all(a) a.begin(),a.end()
#define fori(i,n) for(int i=0;i<n;i++)
#define forb(i,s,t) for(int i=s;i<t;i++)
#define fore(e,v) for(auto &e : v)
#define maxv(v) *max_element(all(v))
#define uniques(v) si s(all(ais));v.assign(all(s))
#define inp(i) scanf("%i",&i)
#define debug(x) cout<<#x<<" "<<x<<endl;
#define start_clock clock_t begin = clock();
#define end_clock cout<<double(clock()-begin)/CLOCKS_PER_SEC<<endl;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef vector<ll> llv;
typedef set<int> si;

int main () {
	int a,b;
	cin>>a>>b;
	if(a == b) {
		cout<<0<<endl;
		return 0;
	}
	if (b > a) swap(a,b);
	if ((a-b)%2 == 1) {
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	cout<<(a+b)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
author: madhav_1999 aka orthodoxparadox
22 March 2020 at 5:34 PM
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define dbl long double
#define int ll
#define ll long long
#define pii pair<int, int>
#define len(x) (int) x.size()
#define rev(a) reverse(all(a))
#define oiint ostream_iterator<int>(cout, " ") 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vector
#define inf 2e18
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#ifdef MADHAV
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define dbg(...) 42
#endif
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(int i=0;i<v.size();++i) x<<v[i]<<" ";return x;} 
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;} 
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;} 
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct pair_hash {inline std::size_t operator()(const std::pair<int, int> & v) const {return v.first*31+v.second;}};
const int MOD = 1e9 + 7;

int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}

int fast_exp(int base, int expo, int mod = MOD) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;}
	return res;}

int modinv(int a, int mod = MOD){return takemod(fast_exp(takemod(a), mod-2, mod), mod);}


void solve()
{
	int L;
	cin >> L;
	dbl p = L/3.0l;
	cout << fixed << setprecision(20);
	cout << p * p * p;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#ifdef MADHAV
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
	#endif
	clock_t t1, t2;
	t1 = clock();

	int tt = 1;
	// cin >> tt;
	while(tt--)
	{
		solve();
	}
	#ifdef MADHAV
	t2 = clock(); cerr << "time taken: " << (t2-t1)/(dbl)CLOCKS_PER_SEC;
	#endif
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

#[allow(dead_code)]
const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a: usize = sc.cin();
    let b: usize = sc.cin();
    let c: usize = sc.cin();
    put!(a+b+c-max(a,max(b,c)))
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
using namespace std;
int gcd(int a,int b,int c){
    int n=1;
    int i=2;
    int m=min(a,min(b,c));
    while(i<=m){
        while(a%i==0&&b%i==0&&c%i==0){
            a/=i,b/=i,c/=i;
            n*=i;
        }
        i++;
    }
    return n;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K;
    cin>>K;
    int sum=0;
    for(int a=1;a<=K;a++){
        for(int b=a+1;b<=K;b++){
            for(int c=b+1;c<=K;c++){
                sum+=6*gcd(a,b,c);
            }
        }
    }
    for(int a=1;a<=K;a++){
        sum+=a;
    }
    for(int a=1;a<=K;a++){
        for(int b=1;b<=K;b++){
            if(a==b)continue;
            sum+=3*gcd(a,b,b);
        }
    }
    cout<<sum<<"\n";
}

Measured memory_bytes: 3668
using System;
using System.Linq;

namespace AGC016
{
    class A
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().ToCharArray();

            int[] c = new int[26];
            for (int i = 0; i < s.Length; i++)
            {
                c[s[i] - 'a']++;
            }

            int min = int.MaxValue;
            for (char x = 'a'; x <= 'z'; x++)
            {
                if (0 < c[x - 'a'])
                {
                    var S2 = new string(s).ToCharArray();
                    while (S2.Distinct().Count() > 1)
                    {
                        for (int j = 0; j < S2.Length - 1; j++)
                        {
                            if (S2[j + 1] == x) { S2[j] = x; }
                        }
                        S2 = S2.Where((n, i) => i < S2.Length - 1).ToArray();
                    }
                    min = Math.Min(min, s.Length - S2.Length);
                }
            }
            if (min == int.MaxValue) { min = 0; }
            Console.WriteLine(min);
        }
    }
}


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

list_even = [n for n in A if n % 2 == 0]

cnt_all = 0
for even in list_even:
  cnt_by_even = 0
  while even % 2 == 0:
    even = even / 2
    cnt_by_even += 1
  
  cnt_all += cnt_by_even
  
print(cnt_all)

'''考え方
偶数の値だけを取得し、何回２で割り算することができるか、を計算する。
'''


Measured memory_bytes: 4148
#include"bits/stdc++.h"
using namespace std;
int n;
double sum=0;
double a[3000];//This is the input
double f[3000][3000];//This is the function
int main()
{
	scanf("%d",&n);
	f[0][0]=1;//Init
	f[0][1]=0;//Init
	for(int i=1;i<=n;i++)
	{
		scanf("%lf",&a[i]);//Input
		f[i][0]=f[i-1][0]*(1-a[i]);
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++)
			f[i][j]=f[i-1][j]*(1-a[i])+f[i-1][j-1]*a[i];//This is a function for the question
	for(int i=(n+1)/2;i<=n;i++)
		sum+=f[n][i];//sum the function to get the answer
	printf("%.10lf",sum);//Output the answer
}

Measured memory_bytes: 68864
#include<bits/stdc++.h>
#define inf 1e9
using namespace std;
struct activity{
   int  A,B,C;
};
int solve(vector<activity>a,int n)
{
    int dp[n+1][3];
    dp[1][0]=a[1].A;
    dp[1][1]=a[1].B;
    dp[1][2]=a[1].C;
    for(int i=2;i<=n;i++)
    {
        dp[i][0]=a[i].A+max(dp[i-1][1],dp[i-1][2]);
       dp[i][1]=a[i].B+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i].C+max(dp[i-1][1],dp[i-1][0]);
    }
    return max(dp[n][0],max(dp[n][1],dp[n][2]));
}
main()
{
    int n,k;
    cin>>n;
    vector<activity> a(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].A;
        cin>>a[i].B;
        cin>>a[i].C;
    }
    cout<<solve(a,n);
}


Measured memory_bytes: 6684
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,X,T = MI()

time = 0
takoyaki = 0
while takoyaki < N:
    time += T
    takoyaki += X

print(time)

Measured memory_bytes: 27124
DIV = 1_000_000_007
n = gets.to_i
l = n.times.map{ gets.chomp }
l.delete('-')
s = l.size
u = l.count('U')
dp = 2.times.map{ [0]*(s+1) }
dp[0][0] = 1
pos = 0
pre = true
for i in (0...s)
  pos += 1 if pre
  if l[i] == 'U' && !pre
    pre = true
  elsif l[i] == 'D' && pre
    pre = false
  end
  for j in (0..i+1)
    dp[1][j] = (j > 0 ? dp[0][j-1]*(pos-j) : 0)
    dp[1][j] += dp[0][j]*(pre ? pos-j : pos-j-1) if j < i+1
    dp[1][j] %= DIV
  end
  dp.rotate!
end
p dp[0][u]

Measured memory_bytes: 8756
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ignore ignore
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define YES printf("YES\n")
#define NO printf("NO\n")
#define yes printf("Yes\n")
#define no printf("No\n")
#define lin printf("\n")
// Iterator
#define rep(i,n) for(i=0;i<n;++i)
#define rrep(i,n) for(i=n-1;i>=0;--i)
#define lp(i,a,b) for(i=a;i<b;++i)
#define rlp(i,a,b) for(i=a;i>=b;--i)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// function
#define sz(x) x.size()
#define inrange(i,a,b) (i>=a && i<=b)
#define FLUSH fflush(stdout)
#define precision(x) cout << setprecision(x) << fixed
#define remax(a,b) a=max(a,b)
#define remin(a,b) a=min(a,b)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
// Constant
const double PI = acos(-1);
const double eps = (1e-9);
const ll INF = 2e15;
const int M = (1e9)+7;
const int N = (1e4)+5;  // check the limit, man
int dp[1003][N];
int A[N],B[N];
int fun(int i,int p)
{
    if(p<=0)
        return 0;
    if(i<0)
        return M;
    if(dp[i][p]>0)
        return dp[i][p];
    dp[i][p]=min(B[i]+fun(i,p-A[i]),fun(i-1,p));
    return dp[i][p];
}
int main()
{
    int n,h,i,j;
    in2(h,n);
    rep(i,n)
    {
        rep(j,h+1)
            dp[i][j]=-1;
    }
    rep(i,n)
        in2(A[i],B[i]);
    out(fun(n-1,h));
}







Measured memory_bytes: 39808
#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 imos[30][100005];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, C;
    cin >> n >> C;
    rep(i,n){
        int s, t, c;
        cin >> s >> t >> c;
        ++imos[c-1][s];
        --imos[c-1][t];
    }
    int ans = 0;
    for(int i = 1; i < 100001; ++i){
        int cnt = 0;
        rep(j,C){
            imos[j][i] += imos[j][i-1];
            cnt += (imos[j][i] || imos[j][i-1]);
        }
        chmax(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12032
N = int(input())
a = list(map(int, input().split()))

cnt = 0
t_f = True

while t_f == True:
    for i in range(N):
        if a[i] % 2 == 1:
            t_f = False
            break
        else:
            a[i] = a[i]//2
    cnt += 1
    
print(cnt - 1)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  int n;
  double x;
  cin >> n;
  x=ceil(n/1.08);
  if((int)(x*1.08)==n)
    cout << x << endl;
  else
    cout << ":(" << endl;
  return 0;
}

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

int main() {
    int N; cin >> N;
    vector<long long> A(N);
    map<long long, long long, greater<long long> > C;
    for(int i=0; i<N; ++i) {
        cin >> A[i];
        C[A[i]] += 1;
    }
    sort(A.begin(), A.end(), greater<long long>());

    int ans = 0;
    for(int i=0; i<N; ++i) {
        if(C[A[i]] == 0) continue;
        long long a = A[i];
        long long p = 1;
        while(a > 0) {p <<= 1; a >>= 1;}
        if((p >> 1) == A[i]) {
            ans += C[A[i]] / 2;
            C[A[i]] %= 2;
        } else {
            long long tmp = min(C[A[i]], C[p-A[i]]);
            C[A[i]] -= tmp;
            C[p-A[i]] -= tmp;
            ans += tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 26752
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	oW, oH, ox, oy := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	W := float64(oW)
	H := float64(oH)
	x := float64(ox)
	y := float64(oy)
	total := W * H
	fmt.Print(total / 2)
	fmt.Print(" ")
	if x == W/2 && y == H/2 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 640
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
F = sys.stdin
A, B = F.readline().rstrip().split()
A = int(A)
B = int(B)

if A < 10 and B < 10:
    print(A * B)
    sys.exit()

print('-1')


Measured memory_bytes: 5640
N,M,C = map(int, input().split())
B = list(map(int, input().split()))
A =[]
for i in range(N):
  A.append(list(map(int, input().split())))
ans = 0
list= 0*[N]
for i in range(N):
  num = 0
  for j in range(M):
    num +=  A[i][j]*B[j]
  num += C
  
  if num > 0:
      ans += 1
print(ans)

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int a[110000];
bool used[110000];
signed main() {
    cin >> N;
    rep(i, N) { cin >> a[i], a[i]--; }
    int cur = 0, ans = 0;
    do {
        if (used[cur]) { fin(-1); }
        used[cur] = true;
        cur = a[cur];
        ans++;
    } while (cur != 1);
    cout << ans << endl;
}


Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		char []s = sc.next().toCharArray();
		char []t = sc.next().toCharArray();
		
		char[]ans = new char [2*n];
		
		for(int i = 0 ;i < n;i++) {
			ans[2 *i] = s[i];
			ans[2 * i + 1] = t[i];
 		}
		
		String a = String.valueOf(ans);
		
		System.out.println(a);

	}

}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9

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

    if(n>=400 && n<600) cout << 8 << endl;    
    if(n>=600 && n<800) cout << 7 << endl;    
    if(n>=800 && n<1000) cout << 6 << endl;    
    if(n>=1000 && n<1200) cout << 5 << endl;    
    if(n>=1200 && n<1400) cout << 4 << endl;    
    if(n>=1400 && n<1600) cout << 3 << endl;    
    if(n>=1600 && n<1800) cout << 2 << endl;    
    if(n>=1800 && n<2000) cout << 1 << endl;    

    return 0;

}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define INF 1000000001
#define MOD 1000000007

using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> a;
	REP(i, n) {
		int b;
		cin >> b;
		a.push_back(b);
	}
	REP(i, n) {
		int key = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > key) {
			a[j + 1] = a[j];
			j--;
		}
		a[j+1] = key;
		REP(k, n) {
			cout << a[k];
			if (k != n - 1)cout << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3124
require 'pp'

n, k = gets.split.map(&:to_i)
r, s, p = gets.split.map(&:to_i)
ch = gets.chomp!.chars

sum = 0
memo = Array.new(n)
ch.each_with_index do |c, i|
    if c == 'r' # グー
        next if memo[i - k] && memo[i - k] == 'p'

        memo[i] = 'p'
        sum += p
    elsif c == 's' # チョキ
        next if memo[i - k] && memo[i - k] == 'r' 

        memo[i] = 'r'
        sum += r
    else # パー 
        next if memo[i - k] && memo[i - k] == 's'

        memo[i] = 's'
        sum += s
    end
end

puts sum


Measured memory_bytes: 16380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+7;
int n;
ll a[N];
int vis;
ll sum[N];
ll num[N];
int cnt;
int main(){
	scanf("%d",&n);
	for(int i = 1;i<=n;i++){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	sort(sum+1,sum+n+1);
	sum[0]=sum[1]+1;
	for(int i = 1;i<=n;i++){
		if(sum[i]!=sum[i-1]){
			num[++cnt]=1;
			if(sum[i]==0) vis=cnt;
		}
		else num[cnt]++;	
	}
	ll ans=0;
	for(int i = 1;i<=cnt;i++) {
		ans+=num[i]*(num[i]-1)/2;
	}
	ans+=num[vis];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll INF = 1e10;

ll sx,sy,gx,gy; ll N;

vector<vector<pair<ll,double>>> to;
vector<double> to_dist;

vector<ll> x; vector<ll> y; vector<ll> r;

//to　は重みあり隣接リスト（第一成分が接続先で、第二成分が辺の重み）で
// to　は　vec<ve<cpair
// to_dist　は　各ノードへのvからの（暫定的な)最小値を保存でただのvec

void Dijkstra(ll v){
  to_dist[v] = 0.0; 
  
  priority_queue<pair<double,ll>, vector<pair<double,ll>>, greater<pair<double,ll>>> Q; 
  Q.push(make_pair(0.0,v)); 
  //キューは、暫定の重さとノードの番号を持つ priorityは第一成分に適用、つまり
  //暫定の値が最も小さなものから見ていく
  
  while(!Q.empty()){
    //行きについてまずは調べる
    pair<double,ll> p = Q.top(); Q.pop();
    ll s = p.first; ll t = p.second; //sが重さ、tが番号
    if( to_dist[t] < s){ continue;}
    else{
      //t-ノードから繋がる全てのノードについて、もしto_dist[t] + to[t][]より大きければ更新
      for(auto ne: to[t]){
        ll x = ne.first;  double y = ne.second;
        //firstが隣接するノード、secondがそこまでの距離
        if( to_dist[x] > to_dist[t] + y){
          to_dist[x] = to_dist[t] + y; Q.push(make_pair( to_dist[x], x));}}}}

  
}

int main(){

  cin >> sx >> sy >> gx >> gy;
  
  cin >> N; x.resize(N+2); y.resize(N+2); r.resize(N+2); to.resize(N+2);
  to_dist = vector<double> (N+2, INF);
  
  for(ll i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> r[i];}
  
  x[N] = sx; y[N] = sy; x[N+1] = gx; y[N+1] = gy;
  r[N] = 0; r[N+1] = 0;
  //startを(sx,sy)、goalを(gx,gy)とおく
 
  
  for(ll i = 0; i <=N+1; i++){
    for(ll j = 0; j <=N+1; j++){
      //iとjの間をundirectedに結ぶ
      if( i != j){
        double d = max( (double)sqrt(pow(x[j]-x[i],2.0)+pow(y[j]-y[i],2.0))-(double)(r[i]+r[j]),0.0); 
       
        to[i].push_back(make_pair(j,d));}
    }
  }
  
  
    
      Dijkstra(N);
      
      cout << fixed << setprecision(10) << to_dist[N+1] << endl;
  
  
      
      return 0;}
      
      
    
  

Measured memory_bytes: 22512