akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAntiDivision solver = new CAntiDivision();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAntiDivision {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long c = in.nextLong();
            long d = in.nextLong();
            long lcm = (c * d) / Maths.gcd(c, d);
            long p = r / c - (l - 1) / c;
            long q = r / d - (l - 1) / d;
            long ext = r / lcm - (l - 1) / lcm;
//        out.println(p);
//        out.println(q);
//        out.println(ext);
            long ans = r - l + 1 - p - q + ext;
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

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

            long r, i;
            while (b != 0) {
                r = a % b;
                a = b;
                b = r;
            }
            return a;
        }

    }
}



Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;

double a;
double table[12] = { 128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625 };
double f[20];
int k = 0, l = 0;

void dfs(double* a, int i){
	if (i == 12)return;

	if (*a >= table[i]){
		*a -= table[i];
		f[i] = 1;
	}

	dfs(a, i + 1);
}

int main(){
	while (cin >> a){
		if (a < 0) break;
		dfs(&a, 0);
		if (a == 0){
			REP(i, 8){
				cout << f[i];
			}
			cout << '.';
			FOR(i, 8, 12){
				cout << f[i];
			}
			cout << endl;
		}
		else{
			cout << "NA\n";
		}
		REP(i, 12){
			f[i] = 0;
		}
	}
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
template<class Type> class UnionFind
{
  public:
    vector<Type> data;
    UnionFind(int sz) { data.assign(sz, -1); }
    bool unite(Type x, Type y)
    {
        x = find(x), y = find(y);
        if (x == y) return (false);
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }
    Type find(Type k) {
        if (data[k] < 0) return (k);
        return (data[k] = find(data[k]));
    }
    Type size(Type k) { return (-data[find(k)]); }
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    vector<ll> a(m), b(m);
    for(int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    ll cnt = (n * n - n) / 2;
    UnionFind<ll> uf(n + 1);
    vector<ll> ans;
    for(int i = m - 1; i >= 0; i--)
    {
        ans.push_back(cnt);
        if(uf.find(a[i]) == uf.find(b[i])) continue;
        cnt -= uf.size(a[i]) * uf.size(b[i]);
        uf.unite(a[i], b[i]);
    }
    reverse(ans.begin(), ans.end());
    for(int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
    return 0;
}



Measured memory_bytes: 4596
#include<iostream>
using namespace std;
int main () {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A --;
  B --;
  C --;
  D --;
  char map[200001];
  for (int i = 0; i < N; i ++) cin >> map[i];
  bool ok = true;
  int end[200001];
  int esi = 0;
  for (int i = A; i < N - 1; i ++) {
    if(map[i] == '#' && map[i + 1] == '#') {
      end[esi] = i - 1;
      esi ++;
    }
  }
  for (int i = 0; i < esi; i ++) {
    if (A < end[i] && end[i] < max(C, D)) ok = false;
  }
  bool ng = false;
  if (C > D) {
    for (int i = B; i <= D; i ++) {
      if (map[i - 1] == '.' && map[i] == '.' && map[i + 1] == '.') {
        ng = true;
      }
    }
  }
  else ng = true;
  //cout << ok << ng << endl;
  if (ng && ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}
  



Measured memory_bytes: 384
#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;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k,a,b; cin>>k>>a>>b;
    FOR(i,a,b){
        if (i%k==0){
            cout<<"OK\n";
            return 0;
        }
    }
    cout<<"NG\n";
    return 0;
}


Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import sys
from collections import Counter
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l=prime_factorize(N)
c=Counter(l)
ans=0
for k,v in c.items():
    tmp=1
    while True:
        if tmp<=v:
            ans+=1
            v-=tmp
            tmp+=1
        else:
            break
print(ans)

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

int main() {
    int n, i;
    cin >> n;
    bool ans = true;
    vector<int> lst(n);
    for(i = 0; i < n; i++){
        cin >> lst.at(i);
        if(lst.at(i) % 2 == 0){
            if(lst.at(i) % 3 != 0 && lst.at(i) % 5 != 0){
                ans = false;
                break;
            }
        }
    }
    if(ans) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

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

#define nl '\n'
#define F fisrt
#define S second
#define pb push_back
#define mp make_pair
#define REP(i,a,b) for(int i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef stack<int> si;
typedef deque<int> di;
typedef pair<int,int> pi;

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

	//your code here
	int a,b,c;
	cin >> a >> b >> c;
	vi v;
	v.pb(a);
	v.pb(b);
	v.pb(c);
	sort(v.begin(), v.end());
	if((v[0]+v[1])!=10)
		cout << "NO";
	else
		cout << "YES";
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll 
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = 3005;
#ifndef LOCAL
#define cerr if(0)cout
#endif
int dp[MAXN][MAXN];
pi par[MAXN][MAXN];
string ans;
string s,t;
void recurse(int i, int j) {
	if(i==0&&j==0)return;
	//db2(i,j);
	//db(dp[i][j]);
	//db(ans);
	if(par[i][j]!=pi(i-1,j-1)) {
		recurse(par[i][j].f, par[i][j].s);
		return;
	}
	if(s[i-1]==t[j-1]) {
		ans.pb(s[i-1]);
		recurse(i-1,j-1);
	} else {
		recurse(i-1,j-1);
	}
}

int32_t main() 
{
	IAMSPEED
	cin >> s >> t;
	FOR(i,1,s.size()){
		FOR(j,1,t.size()) {
			int mx =  max({dp[i-1][j], dp[i][j-1], dp[i-1][j-1] + (s[i-1]==t[j-1])});
			if(dp[i-1][j]== mx){
				dp[i][j] = dp[i-1][j];
				par[i][j] = pi(i-1,j);
			} else if(dp[i][j-1] == mx) {
				dp[i][j] = dp[i][j-1];
				par[i][j] = pi(i,j-1);
			} else {
				dp[i][j] = dp[i-1][j-1]+1;
				par[i][j] = pi(i-1,j-1);
			}
		}
	}
	recurse(s.size(), t.size());
	reverse(all(ans));
	cout << ans;
}



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

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vii;

void dfs(vii &graph, int u, vector<bool> &vis, vi &memopad) {

    vis[u] = true;
    for (auto v : graph[u]) {
        if (!vis[v])
            dfs(graph, v, vis, memopad);
    }
    for (auto v : graph[u])
        memopad[u] = max(memopad[u], memopad[v] + 1);


}

int main() {
    int n, m;
    cin >> n >> m;
    vii graph(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        graph[u].push_back(v);
    }
    stack<int> s;
    int ans = 0;
    vector<bool> vis(n, false);
    vi memopad(n, 0);
    for (int v = 0; v < n; ++v)
        if (!vis[v])
            dfs(graph, v, vis, memopad);
    ans = *max_element(memopad.begin(), memopad.end());
//    for (auto it : memopad)cout << it << ' ';

    printf("%i", ans);
}

Measured memory_bytes: 9472
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

struct P {
  string dealer;
  string type;
  char name;
  int price;
  P(string dealer, string type, char name, int price ):dealer(dealer),type(type),name(name),price(price) {}
};

typedef pair<int, int> pii;
typedef pair<pii, pii> piiii;

int main() {
  int n;
  while(cin>>n,n) {
    vector<P> v;
    map<char, piiii> ans1;
    map<string, pii> ans2;
    
    REP(i,n) {
      string dealer, type;
      char name;
      int price;
      cin >> dealer >> type >> name >> price;
      vector<P>::iterator hoge;
      int m;
      if (type == "BUY") m = INF;
      else m = -1;
      FOR(it, v) {
        if (it->dealer != dealer && it->name == name) {
          if (it->type == "SELL" && type == "BUY") {
            if (it->price <= price) {
              if (it->price < m) {
                m = it->price;
                hoge = it;
              }
            }
          } else if (it->type == "BUY" && type == "SELL") {
            if (it->price >= price) {
              if (it->price > m) {
                m = it->price;
                hoge = it;
              }
            }
          }
        }
      }
      if (ans2.count(dealer) == 0) {
        ans2[dealer] = pii(0,0);
      }
      if (m != -1 && m != INF) {
        //cout << hoge->dealer << " " << hoge->type << " " << hoge->name << " " <<hoge->price << endl;
        //cout << dealer << " " << type << " " << hoge->
        int tmp = (hoge->price+price)/2;
        if (ans1.count(name) == 0) {
          ans1[name] = piiii(pii(tmp,tmp),pii(tmp,1));
        } else {
          ans1[name].first.first = min(ans1[name].first.first, tmp);
          ans1[name].first.second = max(ans1[name].first.second, tmp);
          ans1[name].second.first += tmp;
          ans1[name].second.second++;
        }
        if (type == "BUY") {
          ans2[dealer].first += tmp;
          ans2[hoge->dealer].second += tmp;
        } else {
          ans2[dealer].second += tmp;
          ans2[hoge->dealer].first += tmp;  
        }
        v.erase(hoge);
      } else {
        v.push_back(P(dealer, type, name, price));
      }
    }

    FOR(it, ans1) {
      cout << it->first << " ";
      piiii p = it->second;
      printf("%d %d %d\n", p.first.first, p.second.first/p.second.second, p.first.second);
    }
    cout << "--" << endl;
    FOR(it, ans2) {
      cout << it->first << " ";
      printf("%d %d\n", it->second.first, it->second.second);
    }
    cout << string(10,'-') << endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
 
int main() {
	int x1,x2,x3,x4,y1,y2,y3,y4;
  cin >>x1;cin >> y1;cin >>x2; cin >>y2;
  int line[2];
  line[0]=x2-x1;
  line[1]= y2-y1;
  x3=x2-line[1];
  y3=y2+line[0];
  x4=x3-line[0];
  y4=y3-line[1];
  cout << x3 <<" ";
  cout << y3 <<" ";
  cout << x4 <<" ";
  cout << y4 <<" ";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

typedef long long ll;

const int N = 100001;

int n = 1;
ll dat[N * 4];

void init(int _n){
	while(n < _n)n *= 2;
	for(int i = 0; i < 2 * n - 1; ++i)dat[i] = 0;
}

void update(int k, ll x){
	k += n - 1;
	dat[k] += x;
	while(k > 0){
		k = (k - 1) / 2;
		dat[k] += x;
	}
}

ll rec(int a, int b, int k, int l, int r){
	if(b <= l || r <= a)return 0;
	if(a <= l && r <= b)return dat[k];
	else return (rec(a, b, 2 * k + 1, l, (l + r) / 2) + rec(a, b, 2 * k + 2, (l + r) / 2, r));
}

ll query(int a, int b){
	return rec(a, b, 0, 0, n);
}

int main(){
	int _n, q;
	std::cin >> _n >> q;
	
	init(_n);
	
	for(int i = 0; i < q; ++i){
		int c, x, y;
		std::cin >> c >> x >> y;
		
		if(c == 0)update(x - 1, y);
		else std::cout << query(x - 1, y) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 5132
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999

const double EPS = 1e-8;
typedef vector<double> vd;
typedef vector<vd> mat;

//Ax=b????§£??? A?????£?????????
//?§£??????or????????§?????? ??´????????????0???vector?????????
vd gauss_jordan(const mat& A, const vd& b){
    int n=A.size();
    mat B(n,vd(n+1));
    rep(i,n) rep(j,n) B[i][j]=A[i][j];
    
    rep(i,n) B[i][n] = b[i];                                    //??????A????????????b?????????????????????????????????
    
    rep(i,n){
        int pivot = i;
        for(int j=i;j<n;j++){                                   //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£?????????
            if(abs(B[j][i])>abs(B[pivot][i]))pivot = j;
        }
        swap(B[i],B[pivot]);
        
        if(abs(B[i][i])<EPS)return vd();                        //?§£??????or????????§??????
        
        for(int j=i+1;j<=n;j++)B[i][j]/=B[i][i];                //??¨????????????????????°????????°???1?????????
        rep(j,n){
            if(i!=j){
                for(int k=i+1;k<=n;k++)B[j][k]-=B[j][i]*B[i][k];//j??????????????°????¶????
            }
        }
    }
    vd x(n);
    rep(i,n)x[i]=B[i][n];    //??????????????????b????§£?????????
    return x;
}

int main(){
    int a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d>>e>>f){
        vd vec;
        vec.pb(c);
        vec.pb(f);
        mat mvec;
        vd x,y;
        x.pb(a);
        x.pb(b);
        y.pb(d);
        y.pb(e);
        mvec.pb(x);
        mvec.pb(y);
        vd res = gauss_jordan(mvec, vec);
        printf("%.3lf %.3lf\n",res[0],res[1]);
    }
}

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

int main(){
		int a,b;
		cin>>a>>b;
		for(int i=1;i<=1010;i++){
			if(i*8/100 == a &&  i*10/100 == b){
				cout<<i;
				return 0;
			}
		}
		cout<<"-1";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <atcoder/all>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, D;
ll X[1010], Y[1010];

int main() {
  std::cin >> N >> D;

  rep( i, N )
    std::cin >> X[i] >> Y[i];

  atcoder::two_sat ts(N);

  rep( i, N ) rep( j, i ) {
    if( llabs(X[i]-X[j]) < D ) {
      ts.add_clause( i, false, j, false );
    }
    if( llabs(X[i]-Y[j]) < D ) {
      ts.add_clause( i, false, j, true );
    }
    if( llabs(Y[i]-X[j]) < D ) {
      ts.add_clause( i, true, j, false );
    }
    if( llabs(Y[i]-Y[j]) < D ) {
      ts.add_clause( i, true, j, true );
    }
  }

  if( !ts.satisfiable() ) {
    std::cout << "No" << endl;

    return 0;
  }

  std::cout << "Yes" << endl;

  auto vs = ts.answer();

  rep( i, vs.size() ) {
    std::cout << (vs[i] ? X[i] : Y[i]) << endl;
  }

  return 0;
}

Measured memory_bytes: 3776
class Stack():
    def __init__(self):
        self.items = []

    def is_empty(self):
        return self.items == []

    def push(self, item):
        self.items.append(item)

    def pop(self):
        return self.items.pop()



if __name__ == "__main__":
    stack = Stack()
    a = input().split()
    ans = 0

    for x in a:
        if x == "+":
            stack.push(stack.pop() + stack.pop())
        elif x == "-":
            stack.push(-stack.pop() + stack.pop())
        elif x == "*":
            stack.push(stack.pop() * stack.pop())
        else:
            x = int(x)
            stack.push(x)
    print(stack.pop())


Measured memory_bytes: 5596
//temprates
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

using ll = long long;
using namespace std;

#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define LFOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define FORR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LFORR(i,a,b) for(ll i = (int)(a); i >= (ll)(b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define LREP(i,n) LFOR(i,0,(ll)(n)-1)
#define REPR(i,n) FORR(i,(int)(n)-1,0)
#define LREPR(i,n) LFORR(i,(ll)(n)-1,0)

#define SIZ(v) int(v.size())
const int INF = 1e8;
const ll LINF = 1e15;
const int MOD = 1e9+7;




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  vector<int> p;
  int ans=0;
  cin >> n;
  REP(i,n){int k; cin >> k; p.push_back(k);}
  FOR(i,1,n-2){
    if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1]))
      ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
const int MaxX=1e2;
const int MaxY=1e2;
int main(){
	int X, Y, a, b;
	scanf("%d %d\n",&X,&Y);
	
	b=Y-(X<<1);
	a=X-(b>>1);
	puts(((b&1)==0 and a>=0 and b>=0)?"Yes":"No");
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

//右下左上
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    ll n, k;
    cin >> n >> k;
    vll a(n);
    rep(i, 0, n)
    {
        cin >> a[i];
        a[i]--;
    }
    vll pass(n);
    ll start = 0, end = 0;
    rep(i, 0, k)
    {
        pass[start] = 1;
        if (!pass[a[start]])
            start = a[start];
        else
        {
            end = start, start = a[start];
            break;
        }
        if (i == k - 1)
            return cout << start + 1 << endl, 0;
    }
    //cout << start << " " << end << endl;
    if (end - start == 0)
        return cout << start + 1 << endl, 0;
    ll cnt = 1, sp = 0;
    for (int i = 0;; i++)
    {
        if (sp == start)
        {
            k -= i;
            cnt = 1;
        }
        else if (sp == end)
        {
            sp = a[sp];
            k %= cnt;
            break;
        }
        sp = a[sp];
        cnt++;
    }
    rep(j, 0, k)
        sp = a[sp];

    return cout << sp + 1 << endl, 0;
}


Measured memory_bytes: 6416
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, cnt[60], ans;
ll a[N];

inline int add (int a, int b) {
   a += b;
   a %= mod;
   return a;
}

inline int mult (int a, int b) {
   return (a % mod) * (b % mod) % mod;
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n;
   for (int i = 1; i <= n; i ++) cin >> a[i];
   for (int i = 1; i <= n; i ++) {
      for (int j = 0; j < 60; j ++) {
         if (a[i] & (1ll << j)) ans = add (ans, mult ((i - 1 - cnt[j]), (1ll << j))), cnt[j] ++;
         else ans = add (ans, mult (cnt[j], (1ll << j))); 
      }
   }
   cout << ans;
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 2560
import math
K = int(input())
total = 0
for i in range(1, K + 1):
  for j in range(i, K + 1):
    for k in range(j, K + 1):
      if i == j == k:
        times = 1
      elif i == j or j == k or k == i:
        times = 3
      else:
        times = 6
      total += math.gcd(math.gcd(i,j), k) * times
print(total)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define For( i, j, k ) for( int i = j; i <= k; ++i ) 
#define Rep( i, j, k ) for( int i = j; i >= k; --i )
const int Maxn = 51;
int n, A, x[ Maxn ];
long long ans, f[ Maxn ][ Maxn * Maxn ];
int main( )
{
	std::ios::sync_with_stdio( false );
	using std::cin;
	using std::cout;
	cin >> n >> A;
	For( i, 1, n )
		cin >> x[ i ],
		x[ i ] += x[ i - 1 ];
	f[ 0 ][ 0 ] = 1;
	For( i, 1, n )
	{
		int X = x[ i ] - x[ i - 1 ]; 
		Rep( j, i, 1 )
			For( k, X, x[ i ] )
			f[ j ][ k ] += f[ j - 1 ][ k - X ];
	}
	For( i, 1, n )
		ans += f[ i ][ i * A ];
	cout << ans;
	return 0;
}


Measured memory_bytes: 4564
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))


a,b,h,m=input_list()

a_thita=2*math.pi*(h/12+m/720)
b_thita=2*math.pi*(m/60)

a_xy=[(-1)*a*math.cos(a_thita-math.pi/2),(-1)*a*math.sin(a_thita-math.pi/2)]
b_xy=[(-1)*b*math.cos(b_thita-math.pi/2),(-1)*b*math.sin(b_thita-math.pi/2)]
#print(a_xy)
#print(b_xy)
ans=math.sqrt((a_xy[0]-b_xy[0])**2+(a_xy[1]-b_xy[1])**2)
print(ans)

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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string a,b;
    cin>>a>>b;
    reverse(all(b));
    if(a==b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

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

int main(int argc, const char * argv[]) {
    int S,h,m,s;
    cin >> S;
    h = S/3600;
    m = (S%3600)/60;
    s = (S%3600)%60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}

Measured memory_bytes: 1168
import java.util.*

val sc = Scanner(System.`in`)
val S: String = sc.next()

fun main(args: Array<String>) {
    println(if (judge(S)) "yes" else "no")
}

fun judge(s: String): Boolean {
    val dic = mutableSetOf<Char>()
    for (c in s) {
        if (c in dic) {
            return false
        }
        dic.add(c)
    }
    return true
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb emplace_back
#define INF 1000000000000

#define mod 1000000007

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define loop(i,n) for (lli i = 0; i < n; i++)
#define loopitr(xt,vec) for (auto xt : vec)
#define FOR(i,a,b) for (lli i = a; i < b; i+=1)
#define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
#define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
#define itr :: iterator it
#define WL(t) while(t --)

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define vbool vector<bool>
#define seti set<lli>
#define pii pair<lli,lli>
#define pcc pair<char , char>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

#define endl '\n'

template <typename T>
void print(T x){cout<<x<<endl;}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<endl;}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<endl;}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvector(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define deb(x) cout<<#x<<" "<<x<<endl;


void solve(){
    lli n; cin>>n;
    lli answer=0; lli found=false;
    for(int i=0;i<n;i++){
        lli a,b; cin>>a>>b;
        if(a==b){
            answer++;
            if(answer>=3){found=true; break;}
        }
        else answer=0;
    }
    if(found) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
int main(){
	fastio
	lli t=1;
	while(t--){
		solve();
		
	}
	return 0;
}

Measured memory_bytes: 3632
N = int(input())
a = list(map(int,input().split()))
if N == 2:
    print(abs(a[1]-a[0]))
    exit()
S = sum(a)
m = float('inf')
memo = [0]*(N-1)
memo[0] = a[0]
for i in range(1,N-1):
    memo[i] = memo[i-1] + a[i]
for i in range(N-1):
    m = min(abs(S-memo[i]*2),m)

print(m)

Measured memory_bytes: 24832
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    loop {
        let a:u32 = sc.read();
        let b:u32 = sc.read();
        if a == 0 && b == 0 {
            break;
        }
        for _ in 0..a {
            for _ in 0..b {
                print!("#");
            }
            println!("");
        }
        println!("");
    }
    
}

use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
 
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}


Measured memory_bytes: 5016
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ans = new int[4];
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			if(s.equals("AC")) {
				ans[0] = ans[0]+1;
			}else if(s.equals("WA")){
				ans[1] = ans[1]+1;
			}else if(s.equals("TLE")) {
				ans[2] = ans[2]+1;
			}else if(s.equals("RE")) {
				ans[3] = ans[3]+1;
			}
		}
		sc.close();

		System.out.println("AC x "+ans[0]);
		System.out.println("WA x "+ans[1]);
		System.out.println("TLE x "+ans[2]);
		System.out.println("RE x "+ans[3]);


	}
}

Measured memory_bytes: 58120
#include<bits/stdc++.h>
using namespace std;
queue<int> q[1010];
int main()
{
	int n, m;
	scanf("%d%d",&n,&m);
	while(m--)
	{
		int x;
		scanf("%d",&x);
		if(x == 0)
		{
			int y, z;
			scanf("%d%d",&y,&z);
			q[y].push(z);
		}
		else if(x == 1)
		{
			int y;
			scanf("%d",&y);
			if(q[y].size()) printf("%d\n",q[y].front());
		}
		else if(x == 2)
		{
			int y;
			scanf("%d",&y);
			if(q[y].size())q[y].pop();
		}
	}
	return 0;
}


Measured memory_bytes: 4388
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long N = GetLong();

		long ans = long.MaxValue;
		for(long i = 1; i * i <= N; i++)
		{
			if(N % i != 0)
				continue;

			long j = N / i;
			long dist = i - 1 + j - 1;
			chmin(ref ans, dist);
		}

		Console.WriteLine(ans);
	}

	private void chmin(ref long x, long y) => x = Math.Min(x, y);
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;


int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> chank_pos,chank_neg;
    int temp_count = 1;
    char pre = s[0];
    irep(i,1,n){
	if(s[i]!=pre){
	    pre == '1' ? chank_pos.pb(temp_count) : chank_neg.pb(temp_count);
	    pre = s[i];
	    temp_count = 1;
	}
	else ++temp_count;
    }
    pre == '1' ? chank_pos.pb(temp_count) : chank_neg.pb(temp_count);
    
    if(chank_neg.size() <= k){
	cout << s.length() << endl;
	return 0;
    }

    if(s.back() == '0')chank_pos.pb(0);
    if(s.front() == '0')chank_pos.insert(chank_pos.begin(),0);

    int res = 0;
    int temp = 0;
    rep(i,k+1)temp += chank_pos[i];
    rep(i,k)temp += chank_neg[i];
    res = max(res, temp);
    rep(i,chank_neg.size()-k){
	temp -= chank_neg[i];
	temp -= chank_pos[i];
	temp += chank_neg[i+k];
	temp += chank_pos[i+k+1];
	res = max(res, temp);
    }

    cout << res << endl;
}


Measured memory_bytes: 1020
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a=0,b,c,d;
  string s[5];
  cin >>s[0]>>s[1]>>s[2];
  cout <<s[0][0]<<s[1][1]<<s[2][2]<<'\n';
  return (0);
}


Measured memory_bytes: 256
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

x,a = map(int,input().split())

if x < a:
    print(0)
else:
    print(10)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
DbgTimer D_t;
  #define TSTART() D_t.start()
  #define TSTOP() D_t.stop()
#else
  #define DUMP(i) 
  #define TSTART()
  #define TSTOP()  
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int EPS = 1e-9;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  while(cin >> n >> k){
    TSTART();
    vi L(n);
    REP(i,n){
      cin >> L[i];
    }

    sort(ALL(L));
    reverse(ALL(L));
    int ans = 0;
    REP(i,k){
      ans += L[i];
    }
    cout << ans << endl;
    TSTOP();
  }
  return 0;
}



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

const ll mod = 1e9 + 7;

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

int main(){
    int a,N,M_dist=0;
    cin >> N;
    vector<int> v(N+5,0);
    for (int i = 0; i < N-1; i++){
        cin >> a;
        v[a-1]++;
    }
    for (int i = 0; i < N; i++){
        cout << v[i] << endl;
    }
}

Measured memory_bytes: 4044
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gosu_Hiroo
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}

template <typename T>
ostream& operator << (ostream& os, const vector<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

//#define int ll

class CXYetAnotherDieGame {
public:

void solve(std::istream& cin, std::ostream& cout) {
    ll t;
    cin >> t;
    cout << t/11*2 + (t%11+5)/6;
}


};


#undef int
int main() {


	CXYetAnotherDieGame solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

int main(){
    int n;
    int h[100005];
    int dp[100005];

    cin >> n;

    for(int i=1;i<=n;i++){
        cin >> h[i];
    }
    dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);
    for(int i=3;i<=n;i++){
        dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
    cout << dp[n] << "\n";

    return 0;
}


Measured memory_bytes: 1024
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 20;
int c[MAXN], a[MAXN][MAXN] , u[MAXN];

int main(){
	ios_base::sync_with_stdio(NULL);cin.tie(nullptr);cout.tie(nullptr);
        int n , m , x , ans = INT_MAX , now = 0;
        cin >> n >> m >> x;
        bool flag;
        for(int i = 0 ; i < n ; i++){
                cin >> c[i];
                for(int j = 0 ; j < m ; j++){
                        cin >> a[i][j];
                }
        }
        for(int i = 0 ; i <= 1 << n ; i++){
                fill(u , u + MAXN , 0);
                now = 0;
                for(int j = 0 ; j <= n ; j++){
                        if(i & 1 << j){
                                now += c[j];
                                for(int q = 0 ; q < m ; q++){
                                        u[q] += a[j][q];
                                }
                        }
                }
                flag = 1;
                for(int j = 0 ; j < m ; j++)
                        if(u[j] < x) flag = 0;
                if(flag) ans = min(ans , now);
        }
        cout << (ans == INT_MAX ? -1 : ans) << '\n';

}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
    int a ,b ,A ;
    cin>> a >> b ;
    
    A=a*b;
    if(10<=a||10<=b){
        A=-1;
    }
    cout <<A <<endl;
  



    return 0;
}

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

using namespace std;
int h[100010];
int near[100010];
int her[100010];
int main()
{
    int n,m;
    int a,b;
    int ans=0;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&h[i]);
    }
    for(int i=1;i<=m;i++)
    {
        scanf("%d %d",&a,&b);
        near[a]++;
        near[b]++;
        if(h[a]>h[b])
            her[a]++;
        if(h[b]>h[a])
            her[b]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(near[i]==0)
            ans++;
        else if(near[i]==her[i])
            ans++;
    }
    printf("%d",ans);

    return 0;
}

Measured memory_bytes: 4996
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

const int INF = 1 << 30;
const int MAXN = 300005;

string s;

int n;

int Lw[MAXN], Le[MAXN], Rw[MAXN], Re[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'E')
			Le[i] = 1, Re[i] = 1;
		else
			Lw[i] = 1, Rw[i] = 1;
	}	
	for (int i = 1; i < n; i++)
		Lw[i] += Lw[i - 1], Le[i] += Le[i - 1];
	for (int i = n - 2; i >= 0; i--)
		Rw[i] += Rw[i + 1], Re[i] += Re[i + 1];
	int res = min(Re[1], Lw[n - 1]);
	for (int i = 1; i < n - 1; i++)
		res = min(res, Lw[i - 1] + Re[i + 1]);
	cout << res << endl;
	return 0;
}


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



int main() {
  int n;
  cin >> n;
  map<string,int>mp;
  for (int i = 1; i <= (n); ++i){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  ll ans = 0;
  for(auto p : mp){
    int s = p.second;
    ans += (ll)s*(s-1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib> 
using namespace std;
struct node{int x,y;}a[300010];
inline bool cmp(node a,node b){return a.y<b.y;}
int n;
int main()
{
  cin>>n;
  for(int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
  sort(a+1,a+n+1,cmp);
  int T=0,kill=0;
  for(int i=1;i<=n;i++)
  {
    if(T+a[i].x>a[i].y){kill=1; break;}
    T+=a[i].x;
  }
  if(kill==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 1792
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto S = RD!string;
	auto cnt = new bool[](26);
	foreach (c; S)
	{
		cnt[c-'a'] = true;
	}
	string ans;
	foreach (i, e; cnt)
	{
		if (e == false)
		{
			ans = [cast(char)('a'+i)];
			break;
		}
	}

	writeln(ans == "" ? "None" : ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 508
n = raw_input()


def weight(i, j):
    l = len(n)
    return 2 ** (max(i-1, 0) + max(l-j-2, 0))

s = 0
for i in range(len(n)):
    for j in range(i, len(n)):
        num = int(n[i:j+1])
        s += int(num) * weight(i, j)

print s


Measured memory_bytes: 2568