akhauriyash/Code-Regression huggingface dataset:
import math
import time
import pprint
import sys
from collections import deque
pp = pprint.PrettyPrinter(width = 30)
sys.setrecursionlimit(10**7)
INF = 10 ** 18
def MI(): return map(int, sys.stdin.readline().split())
def IS(): return input()
def bfs(q):
    # かかる歩数
    require = [[0 for i in range(w)] for j in range(h)]
    # 訪れたかどうか
    check = [[0 for i in range(w)] for j in range(h)]
    x_diff = [-1, 0, 1, 0]
    y_diff = [0, 1, 0, -1]
    while len(q) != 0:
        tmp_y, tmp_x = q.popleft()
        # print(tmp_y, tmp_x)
        for i in range(4):
            next_y = tmp_y + y_diff[i]
            next_x = tmp_x + x_diff[i]
            if ( 0 <= next_x <= w-1 
                    and 0 <= next_y <= h-1 
                    and check[next_y][next_x] == 0 
                    and a[next_y][next_x] != '#'):
                check[next_y][next_x] = 1 
                require[next_y][next_x] = require[tmp_y][tmp_x] + 1
                q.append([next_y, next_x])
                # pp.pprint(check)
    return require


h, w = MI()
a = [IS() for _ in range(h)]
# start = time.time()
# h, w = 1000, 1000
# a = ['#.#.' * (w//4) for _ in range(h)]
out = 0
que = deque()

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            que.append([i,j])
# print(que)

ans = bfs(que)

for i in range(h):
    for j in range(w):
        out = max(out,ans[i][j])

# print(time.time() - start)
print(out)


Measured memory_bytes: 145412
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}

class Segtree {
public:
	int n;
	vector<int>data;
public:
	Segtree(int _n,int MAX) {
		n = 1;
		while (n < _n) n *= 2;
		for (int i = 0; i < 2 * n - 1; i++) {
			data.push_back(MAX);
		}
	}

	void update(int k, int a) {
		k += n - 1;
		data[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = min(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}

	int query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return INF;
		if (a <= l && r <= b) return data[k];
		else {
			int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
			int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
			return min(vl, vr);
		}
	}

	int query(int s, int t) {
		return query(s, t + 1, 0, 0, n);
	}
};

signed main() {
	int n, m;
	cin >> n >> m;
	Segtree seg(n, INF);
	pair<P, int>p[100005];
	rep(i, m) {
		int l, r, c;
		cin >> l >> r >> c;
		l--, r--;
		p[i] = { {l,r},c };
	}
	sort(p, p + m);
	seg.update(0, 0);
	rep(i, m) {
		seg.update(p[i].first.second, min(seg.data[p[i].first.second+seg.n-1], seg.query(p[i].first.first, p[i].first.second) + p[i].second));
		//cout << min(seg.data[p[i].first.second+seg.n-1], seg.query(p[i].first.first, p[i].first.second) + p[i].second) << endl;
	}
	/*cout << seg.n << endl;
	rep(i, seg.data.size()) cout << seg.data[i] << " ";
	cout << endl;*/
	if (seg.data[seg.n - 2 + n] == INF) cout << -1 << endl;
	else cout << seg.data[seg.n - 2+n] << endl;

	return 0;
}


Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	int a,b;
	cin >> a >> b;
	cout<<max(a+b,max(a-b,a*b))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}


//深さ優先探索
void dfs(vector<string> &m,vector<vector<bool>> &seen, ll x, ll y, ll h, ll w){

	seen[y][x]=true;

	
	for(ll i=0;i<4;i++){
		ll nx=x,ny=y;
		if(i==0){ //up
			ny=y-1;
		}
		else if(i==1){ //down
			ny=y+1;
		}
		else if(i==2){ //right
			nx=x+1;
		}
		else{ //left
			nx=x-1;
		}

		if(nx<0 || nx>=w || ny<0 || ny>=h){
			continue;
		}
		if(seen[ny][nx]){
			continue;
		}
		
		if(m[ny][nx]=='#'){
			continue;
		}

		dfs(m,seen,nx,ny,h,w);
	}
}

const ll MOD=1000000007;

void solve(){

	ll n,k;
	cin>>n>>k;

	vector<ll> a(n,0);

	for(ll i=0;i<k;i++){
		ll d=0;
		cin>>d;
		for(ll j=0;j<d;j++){
			ll A=0;
			cin>>A;
			a[A-1]++;
		}
	}

	ll ans=0;
	for(ll i=0;i<n;i++){
		if(a[i]==0){
			ans++;
		}
	}

	cout<<ans<<endl;


}


int main(){
	
	solve();
	
    return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] NM = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] cnt = new long[NM[1]];

            for (int j = 0; j < NM[0]; j++)
            {
                long[] A = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
                for (int z = 1; z <= A[0]; z++)
                {
                    cnt[A[z] - 1]++;
                }
            }
            if (cnt.Max() < NM[0])
            {
                Console.WriteLine(0);
                return;
            }
            int resultCnt = 0;
            for(int x = 0; x < cnt.Count(); x++)
            {
                if (cnt[x] == cnt.Max())
                {
                    resultCnt++;
                }
            }
            Console.WriteLine(resultCnt);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n, m;
    while ( cin >> n >> m, n || m ) {
        vector<ll> v(n); cin >> v;
        REP(i, n) v[i] %= m;
        REP(i, n-1) v[i+1] = (v[i]+v[i+1])%m;
        set<ll> s; s.insert(0);
        ll ans = 0;
        REP(i, n) {
            ans = max(ans, v[i]);
            if ( s.upper_bound(v[i]) != s.end() ) {
                ans = max(ans, (v[i]-*s.upper_bound(v[i])+m)%m);
            }
            s.insert(v[i]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 4396
#include<stdio.h>
int main()
{
	int w,i,r;
	for(;~scanf("%d",&w)&&w!=-1;)
	{
		for(r=0,i=10;i<w;i++)
		{
			if(i<20)
				r+=125;
			else if(i<30)
				r+=140;
			else
				r+=160;
		}
		printf("%d\n",3130-r);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

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

bool cmp(pair<ll, ll> a, pair<ll, ll> b)
{
  return a.second > b.second;//昇順
}


int main()
{
  int N, M;
  cin >> N >> M;

  vector<ll> A(N);
  vector<pair<ll, ll>> BC(M);
  for(int i=0; i<N; i++)
    cin >> A[i];

  for(int i=0; i<M; i++)
    cin >> BC[i].first >> BC[i].second;
  
  sort(BC.begin(), BC.end(), cmp);

  priority_queue<ll, vector<ll>, greater<ll>> q;
  for(int i=0; i<N; i++)
    q.push(A[i]);

  ll count=0;
  for(int i=0; i<M && count<N; i++)
    {
      
      for(int j=0; j<BC[i].first && count<N; j++)
	{
	  q.push(BC[i].second);
	  q.pop();
	  count++;
	}
    }

  ll sum = 0;
  for(int i=0; i<N; i++)
    {
      sum += q.top();
      q.pop();
    }
  cout << sum << endl;
  
  return 0;
}

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 3704
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int combination(int n,int r){
  if(n==r or r==0) return 1;
  else return combination(n,r-1)*(n-r+1)/r;
}

int main(){
  int n,p; cin>>n>>p;
  int even=0,odd=0;
  for(int i=0;i<n;i++){
    int a; cin>>a;
    if(a%2==0) even++;
    else odd++;
  }
  long sumEven=0,sumOdd=0;
  sumEven=pow(2,even);
  if(p==0){
    for(int i=0;i<=odd;i+=2) sumOdd+=combination(odd,i);
  }
  else{
    for(int i=1;i<=odd;i+=2) sumOdd+=combination(odd,i);
  }
  cout<<sumEven*sumOdd<<endl;
  return 0;
}


Measured memory_bytes: 256
import math
import fractions
n,x = map(int,input().split())
l  = sorted(map(int,input().split()+[x]))
dec = []
for i in range(n):
    j = abs(l[i-1]-l[i])
    dec.append(j)
ans = dec.pop()
for i in dec:
    ans = fractions.gcd(ans,i)
print(ans)


Measured memory_bytes: 16240
#include <string>
#include <vector>



struct RollingHash {
  using size_t = std::size_t; using ull = unsigned long long; using uint = unsigned int;
  static constexpr ull mod = (1ull<<61)-1, m30 = (1ull<<30)-1, m31 = (1ull<<31)-1;
  static constexpr ull mul(ull l, ull r) {
    ull lu = l>>31, ld = l&m31, ru = r>>31, rd = r&m31; ull mid = ld*ru + lu*rd;
    return ((lu*ru)<<1) + ld*rd + ((mid&m30)<<31) + (mid>>30);
  }
  static constexpr ull mul(ull l, uint r) {
    ull lu = l>>31, rd = r&m31; ull mid = lu*rd;
    return (l&m31)*rd + ((mid&m30)<<31) + (mid>>30);
  }
  static constexpr ull calc_mod(ull val) {
    val = (val&mod)+(val>>61); if(val>mod) val -= mod;
    return val;
  }

  static constexpr uint base = 1007;
  std::vector<ull> power, hashed;
  size_t n;

  RollingHash(std::string const& s) {
    n = s.size();
    hashed.assign(n+1, 0);
    power.assign(n+1, 0);
    power[0] = 1;
    for(size_t i=0;i<n;++i) {
      power[i+1] = calc_mod(mul(power[i], base));
      hashed[i+1] = calc_mod(mul(hashed[i], base) + s[i]);
    }
  }

  ull get(size_t l, size_t r) const {
    return calc_mod(hashed[r] + mod*((1ull<<3)-1) - mul(hashed[l], power[r-l]));
  }

  ull connect(ull h1, ull h2, size_t h2len) const {
    return calc_mod(mul(h1, power[h2len]) + h2);
  }
  void connect(std::string const& s) {
    size_t m = s.size();
    hashed.resize(n+m+1);
    power.resize(n+m+1);
    for(size_t i=n;i<n+m;++i) {
      power[i+1] = calc_mod(mul(power[i], base));
      hashed[i+1] = calc_mod(mul(hashed[i], base) + s[i-n]);
    }
    n += m;
  }

};

std::size_t lcp(RollingHash const& a, std::size_t l1, std::size_t r1,
                RollingHash const& b, std::size_t l2, std::size_t r2) {
  std::size_t len = (r1-l1<r2-l2?r1-l1:r2-l2);
  std::size_t ok=0, ng=len+1;
  while(ng-ok>1) {
    std::size_t mid = ((ng-ok)>>1)+ok;
    if(a.get(l1, l1+mid) == b.get(l2, l2+mid)) ok = mid;
    else ng = mid;
  }
  return ok;
}



#include <iostream>

void abc141_e() {
  using namespace std;
  size_t N; string S;
  cin >> N >> S;
  RollingHash rh(S);
  size_t ans = 0;
  for(size_t i=0;i<N;++i) for(size_t j=0;j<i;++j) {
    size_t l = lcp(rh, i, rh.n, rh, j, rh.n);
    if(l > i-j) l = i-j;
    if(ans < l) ans = l;
  }
  cout << ans << '\n';
}

signed main() {

  abc141_e();

  return 0;
}

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

int pow_mod(int a, int b, int div) {
  if (b == 0) return 1;
  if (b == 1) return a;
  int x = pow_mod(a, b/2, div);
  x = (long)x * x % div;
  if (b % 2) x = (long)x * a % div;
  return x;
}

int main() {
  int DIV = 1e+9 + 7;
  string S; cin >> S;
  int N = S.size();
  int k = 1, sum = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '1') {
      sum = ((long)sum + (long)k * pow_mod(3, N - i - 1, DIV)) % DIV;
      k = k * 2 % DIV;
    }
  }
  sum = (sum + k) % DIV;
  cout << sum << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
struct UFT{
  vector<int> par;//親
  vector<int> rank;//木の深さ
  vector<int> size;//木の大きさ
  int n;
  
  UFT(int _n)
  {
    n = _n;
    par.resize(n);
    rank.assign(n,0);
    size.assign(n,0);
    rep(i,n){
      par[i] = i;
    }
  }
  
  //xの根を返す
  int find(int x)
  {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  //x,yを併合
  void unite(int x,int y)
  {
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank[x] < rank[y]){
      par[x] = y;
      size[y] += size[x];
    }
    else{
      par[y] = x;
      size[x] += size[y];
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  //x,yが同じグループにいるかどうかを返す
  bool same(int x,int y)
  {
    return find(x) == find(y);
  }

  //xの属する木のサイズを探す
  int usize(int x)
  {
    return size[find(x)];
  }
};

int main()
{
  int n,m; cin >> n >> m;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<int> x(m),y(m);
  rep(i,m) {
    cin >> x[i] >> y[i];
  }
  if(m + n/2 < n - 1) {
    cout << "Impossible" << "\n";
    return 0;
  }
  
  UFT uf(n);
  rep(i,m) uf.unite(x[i], y[i]);
  set<int> st;
  rep(i,n) st.insert(uf.find(i));
  int idx = 0;
  map<int,int> mp;
  for(auto s: st) mp[s] = idx++;
  vector<vector<ll>> vec(idx);
  rep(i,n) {
    vec[mp[uf.find(i)]].push_back(a[i]);
  }

  ll res = 0;
  multiset<ll> mst;
  if(idx == 1) {
    cout << 0 << "\n";
    return 0;
  }
  
  rep(i,idx) {
    sort(vec[i].begin(), vec[i].end());
    rep(j,vec[i].size()) {
      if(j == 0) {
	res += vec[i][j];
      }
      else {
	mst.insert(vec[i][j]);
      }
    }
  }

  int cnt = (idx - 1)*2 - idx;
  auto it = mst.begin();
  while(cnt-- > 0) {
    res += *it;
    it++;
  }
  cout << res << "\n";
  
  return 0;
}


Measured memory_bytes: 12800
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }
bool ischeck(int num,int mon){
	int p1,p2,temp;
	temp = num;
	p1= temp%10;
	temp/=10;
	p2 = temp;
	if(p1*p2>mon || p1<2 || p2<2)
		return false;
	return true;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll m,d;
	cin>>m>>d;
	ll cnt=0;
	for(int i=22;i<=99;i++){
		if(i<=d && ischeck(i,m)){
			// cout<<i<<"\n";
			cnt++;
		}else
			continue;
	}	
	cout<<cnt<<"\n";
return 0;
}

Measured memory_bytes: 384
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int[] G => ReadLine().Split().Select(int.Parse).ToArray();
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	int V, Mod;
	List<int>[] es;
	void Solve()
	{
		var I = G;
		V = I[0];
		Mod = I[1];
		es = new List<int>[V];
		for (var u = 0; u < V; u++) es[u] = new List<int>();
		for (var e = 0; e < V - 1; e++)
		{
			I = G;
			es[I[0] - 1].Add(I[1] - 1);
			es[I[1] - 1].Add(I[0] - 1);
		}
		var dp0 = DFS0(0, V);
		var dp1 = DFS1(0, dp0);
		for (var u = 0; u < V; u++) WriteLine(dp0[u] * (dp1[u] + 1) % Mod);
	}
	long[] DFS0(int u, int p)
	{
		var dp0 = new long[V];
		var st = new Stack<A0>();
		st.Push(new A0(u, p));
		while (st.Count > 0)
		{
			var f = st.Pop();
			if (f.p >= 0)
			{
				dp0[f.u] = 1L;
				es[f.u].Remove(f.p);
				if (es[f.u].Count == 0) continue;
				st.Push(new A0(f.u, -1));
				foreach (var v in es[f.u]) st.Push(new A0(v, f.u));
			}
			else foreach (var v in es[f.u]) dp0[f.u] = dp0[f.u] * (dp0[v] + 1) % Mod;
		}
		return dp0;
	}
	long[] DFS1(int u, long[] dp0)
	{
		var dp1 = new long[V];
		var st = new Stack<int>();
		st.Push(u);
		// var x = new long[V + 1]; x[0] = 1;
		var y = new long[V + 1];
		while (st.Count > 0)
		{
			u = st.Pop();
			var W = es[u].Count;
			if (W == 0) continue;
			y[W] = 1;
			// for (var i = 0; i < W; i++) x[i + 1] = x[i] * (dp0[es[u][i]] + 1) % Mod;
			for (var i = W - 1; i >= 1; i--) y[i] = y[i + 1] * (dp0[es[u][i]] + 1) % Mod;
			var X = 1L;
			for (var i = 0; i < W; i++)
			{
				dp1[es[u][i]] = (dp1[u] + 1) * X % Mod * y[i + 1] % Mod;
				X = X * (dp0[es[u][i]] + 1) % Mod;
			}
			foreach (var v in es[u]) st.Push(v);
		}
		return dp1;
	}
}
struct A0 { public int u, p; public A0(int u, int p) { this.u = u; this.p = p; } }


Measured memory_bytes: 33656
// g++ -std=gnu++1y -O2 main.cpp

#include <cassert>
#include <cstdio>
#include <vector>
#include <set>

#include <map>
#include <unordered_map>
#include <deque>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <climits>

using namespace std;

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

const int INF = 1e9;
const long long LINF = 1e18;

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

	deque<long long> d;
	for (int i = 1; i <= 9; i++)
		d.push_back(i);

	long long ans = 1;
	for (int i = 0; i < K; i++)
	{
		ans = d.front();
		// cout << "ans: " << ans << endl;
		d.pop_front();

		long long n = ans % 10;
		if (n != 0)
			d.push_back(ans * 10 + n - 1);
		
		d.push_back(ans * 10 + n);

		if (n != 9)
			d.push_back(ans * 10 + n + 1);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 1792
N, A = map(int, input().split())
X = [x-A for x in map(int, input().split())]

d = {}
d[0] = 1

for x in X:
    for k, v in tuple(d.items()):
        d[k+x] = d.get(k+x, 0) + v

print(d[0]-1)


Measured memory_bytes: 67612
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#include<iomanip>
#include<ios>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	long double l;
	cin>>l;
	l=l/3;
	cout<<setprecision(15)<<pow(l, 3)<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
#define MOD 1e9+7
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

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

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;
const int MAX_N = 10010;
int G[8][8];
int g[8][8];

int dfs(int h, int w, int dh, int dw) {
    int nh = h+dh;
    int nw = w+dw;
    if (nh < 0 || nh >= 8 || nw < 0 || nw >= 8) return 1;
    if (g[nh][nw]) return 0;
    return dfs(nh, nw, dh, dw);
}

int main() {
    int k;
    cin >> k;
    REP(i, 8) {
        REP(j, 8) {
            G[i][j] = 0;
        }
    }
    REP(i, k) {
        int r, c;
        cin >> r >> c;
        G[r][c] = 1; 
    }
    vi v(8);
    REP(i, 8) v[i] = i;
    
    do {
        REP(i, 8) {
            REP(j, 8) {
                g[i][j] = G[i][j];
            }
        }
        int res = 0;
        REP(i, 8) {
            int cnt = 0;
            g[i][v[i]] = 1;
            cnt += dfs(i, v[i], 0, -1);
            cnt += dfs(i, v[i], -1, -1);
            cnt += dfs(i, v[i], -1, 0);
            cnt += dfs(i, v[i], -1, 1);
            cnt += dfs(i, v[i], 0, 1);
            cnt += dfs(i, v[i], 1, 1);
            cnt += dfs(i, v[i], 1, 0);
            cnt += dfs(i, v[i], 1, -1);
            if (cnt == 8) res += 1; 
            else break;
        }
        if (res == 8) {
            REP(i, 8) {
                REP(j, 8) {
                    if (g[i][j]) cout << 'Q';
                    else cout << '.';
                }
                cout << endl;
            }
        }
    } while (next_permutation(v.begin(), v.end()));
    return 0;
}


Measured memory_bytes: 3104
package main

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


func foo(a []int) string {
  for _, e := range a {
    if e % 2 != 0 {
      continue
    }
    if e % 3 != 0 && e % 5 != 0 {
      return "DENIED"
    }
  }
  return "APPROVED"
}

// input process
var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func nextText() string {
    sc.Scan()
    return sc.Text()
}

func main() {
  // input
  sc.Split(bufio.ScanWords)
  n := nextInt()

  // store to slice
  var a []int
  for i := 0; i < n; i++ {
    a = append(a, nextInt())
  }

  // output
  fmt.Println(foo(a))
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  ll n, k;
  cin >> n >> k;
  long double ans = 0;
  for (ll i = 1; i <= n; i++) {
    if (i >= k)
      ans += 1.0 / n;
    else {
      ll cnt = 1;
      ll t = i;
      while (t < k)
        t *= 2, cnt *= 2;
      ans += 1.0 / (n * cnt);
    }
  }
  printf("%.10Lf\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b, temp, i;
    for(i=1; i<=3000; i++)
  { 
     cin >> a >> b;
    
    
    if(a==0 && b==0)
       break;
    
    
    if(a > b)
    {
    temp = a;
    a = b;
    b = temp;
    }
    
    cout << a << " " << b << endl;
  }
}


Measured memory_bytes: 2988
#include <stdio.h>
#include <string.h>
 char s[101];
 int main(void) {
   scanf("%s", s);
   int res = 0;
   int i;
   int n = strlen(s);
   for ( i = 0; i < n; i++) {
      if (s[i] != s[n - 1 - i]) res++;
 }
  printf("%d\n", res / 2);
  return 0;
 }


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
int INF=1e9;
const long long mod=1e9+7;

int main(){
  int N; cin>>N;
  vector<long long>x(N),y(N);
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i];
  }
  if(N==1)cout<<1<<endl;
  else{
    int ans=N;
    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
        int count=N;
        if(i!=j){
          int a=x[i]-x[j];
          int b=y[i]-y[j];
          for(int k=0;k<N;k++){
            for(int l=0;l<N;l++){
              if(x[k]-a==x[l]&&y[k]-b==y[l]){
                count--;
              }
            }
          }
          ans=min(ans,count);
        }
      }
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,i,j;
  while(1){
  scanf("%d %d",&n,&m);
  if(n==0&&m==0) break;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      if(i%2==0){
	if(j%2==0){
	  printf("#");
	} else{
	  printf(".");
	}
      } else{
	if(j%2==0){
	  printf(".");
	} else{
	  printf("#");
	}
      }
    }
    printf("\n");
  }
  printf("\n");
  }
  return(0);
}

Measured memory_bytes: 1004
N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)
if N == 1 :
    ans = T[0]
else :
    for i in range(len(T)) :
        if i == 0 :
            ans = lcm(T[i],T[i+1])
        else :
            ans = lcm(T[i],ans)
print(ans)


Measured memory_bytes: 3064
n = gets.chomp.to_i

arr = ("a".."z").to_a
if n <= 26
  puts arr[n-1]
  exit
end

m = n
a = 26
dig = 1
while m > 0
  m -= a
  break if m <= 0
  a *= 26
  dig += 1
end

s = []
m = m + a - 1
dig.times do
  q = m % 26
  m /= 26
  s.unshift(arr[q])
end
puts s.join


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

const int N = 500010;
const int LOG = 21;
int pr[N][21], f[N][28], a[N];
char ch[N];
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}

int main()
{
	scanf("%s", ch);
	int len = strlen(ch);
	for (int i = 0; i < len; i ++) a[i] = ch[i] - 'a';
	for (int j = 0; j <= 26; j ++) f[len][j] = -1;
	for (int i = len - 1; i >= 0; i --)
	{
		for (int j = 0; j <= 26; j ++)  f[i][j] = -1;
		f[i][a[i]] = i + 1;
		bool flag = false;
		for (int j = a[i] + 1; j <= 26; j ++)
		{
			int at = f[f[i][j - 1]][j - 1];
			if (at == -1)
			{
				flag = true;
				break;
			}
			f[i][j] = at;
		}
		if (!flag)
			for (int j = 0; j < a[i]; j ++)
				f[i][j] = f[f[i][26]][j];
	}
	for (int i = 0; i <= len; i ++) pr[i][0] = f[i][26];
	for (int j = 1; j < LOG; j ++)
		for (int i = 0; i <= len; i ++)
		{
			if (pr[i][j - 1] == -1) pr[i][j] = -1;
			else pr[i][j] = pr[pr[i][j - 1]][j - 1];
		}

	int T;
	T = read();
	for(int Case = 1; Case <= T; Case ++)
	{
		int x, y;
		x = read();
		y = read();
		x --;
		for(int i = LOG - 1; i >= 0; i --)
		{
			if(pr[x][i] == -1) continue;
			if(pr[x][i] <= y) x = pr[x][i];
		}
		if(x == y) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 98816
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

macro_rules ! max { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ z : expr ) ,+ ) => { { std :: cmp :: max ( $ x , max ! ( $ ( $ z ) ,* ) ) } } }
macro_rules ! min { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ z : expr ) ,+ ) => { { std :: cmp :: min ( $ x , min ! ( $ ( $ z ) ,* ) ) } } }

const HALF: usize = 512;
const MAX: usize = 100_001;

fn dfs(n: usize, i: usize, dp: &mut Vec<Vec<usize>>, vw: &Vec<(usize, usize)>) {
    let (v, w) = vw[i];
    if i == 0 {
        for j in 0..MAX {
            dp[i][j] = if j < w { 0 } else { v };
        }
    } else {
        let p = (i - 1) / 2;
        for j in 0..MAX {
            dp[i][j] = if j < w {
                dp[p][j]
            } else {
                max!(dp[p][j], dp[p][j - w] + v)
            };
        }
    }

    for j in 0..2 {
        let next = 2 * i + j + 1;
        if next >= n {
            continue;
        }
        dfs(n, next, dp, vw);
    }
}

fn main() {
    input! {
        n: usize,
        vw: [(usize, usize);n],
        q: usize,
        vl: [(Usize1, usize);q],
    }

    let half = min!(n, HALF);

    let mut dp = vec![vec![0; MAX]; half];
    dfs(half, 0, &mut dp, &vw);

    for (v, l) in vl {
        if v < half {
            println!("{}", dp[v][l]);
            continue;
        }

        let mut vec = Vec::new();
        let mut pos = v;
        while pos >= half {
            vec.push(pos);
            pos = (pos - 1) / 2;
        }

        let size = vec.len();
        let mut mx = 0;
        for i in 0..1 << size {
            let mut val = 0;
            let mut wei = 0;
            for j in 0..size {
                if (i >> j) & 1 == 0 {
                    continue;
                }
                let (v, w) = vw[vec[j]];
                val += v;
                wei += w;
            }
            if wei > l {
                continue;
            }
            mx = max!(mx, val + dp[pos][l - wei]);
        }
        println!("{}", mx);
    }
}


Measured memory_bytes: 413348
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  REP(i,s.size()){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      a++;
    } else {
      c = max(c,a);
      a = 0;
    }
  }
  c = max(c,a);
  OUT(c);
}

Measured memory_bytes: 256
import sys
from collections import deque

hw = list(map(int, input().split()))
field = [list(input()) for l in range(hw[0])]
ans = 0

#下右上左
direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]

for i in range(hw[0]):
    for j in range(hw[1]):
        #そもそもスタートposが#だったらその時点で終わり
        if field[i][j] == "#":
            continue
        
        #距離マップを準備
        costmap = [[-1] * hw[1] for k in range(hw[0])]
        costmap[i][j] = 0
        
        #キューを準備
        que = deque([[i, j]])
        
        while len(que) > 0:
            #キューから取り出す
            nh, nw = que.popleft()

            #方向を決める        
            for dh, dw in direction:

                #行った先判定
                #はみ出してないか？
                if dh + nh > hw[0] - 1:
                    continue
                if dh + nh < 0:
                    continue
                if dw + nw > hw[1] - 1:
                    continue
                if dw + nw < 0:
                    continue 

                #壁じゃないか？
                if field[nh + dh][nw + dw] == "#":
                    continue

                #探索済みじゃないか？
                if costmap[nh + dh][nw + dw] != -1:
                    continue

                #コストを書き込む
                costmap[nh + dh][nw + dw] = costmap[nh][nw] + 1

                #書き込んだ行をキューに入れる
                que.append([nh + dh, nw + dw])
        ans = max(ans, max([max(d) for d in costmap]))
print(ans)

Measured memory_bytes: 3316
//
//AtCoder Beginner Contest 170
//B - Crane and Turtle
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int x,y;
    cin >> x >> y;

    string ans = "No";
    REP(i,x){
        if (y == i*2+(x-i)*4) {
            ans = "Yes";
            break;
        }
        if (y == i*4+(x-i)*2) {
            ans = "Yes";
            break;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
	public static void main(final String[] args) {

        final Scanner sc = new Scanner(System.in);

        // 人数
        int num = Integer.parseInt(sc.nextLine());
        // 住人の座標
        Integer[] point = convertString(sc.nextLine(), num);
        // 住人の座標の最小値・最大値
        int minPoint = 100;
        int maxPoint = 1;
        // 総和の最小値
        int minSum = 1000000;

        // 住人の座標の最小値・最大値取得
        for (final int i : point) {

            if (i < minPoint) {

                minPoint = i;
            }

            if (i > maxPoint) {

                maxPoint = i;
            }
        }

        // 住人の座標の最小値～最大値の間で総和を計算
        for (int i = minPoint; i <= maxPoint; i++) {

            int sum = 0;

            for (int j = 0; j < point.length; j++) {

                sum += Math.pow(point[j] - i, 2);
            }

            if (sum < minSum) {

                minSum = sum;
            }
        }

        // 出力
        System.out.println(minSum);
    }

    // String配列をInteger配列に変換
    private static Integer[] convertString(String text, Integer num) {

        String[] numStrCol = text.split(" ");
        Integer[] numCol = new Integer[num];

        for (int i = 0; i < num; i++) {

            numCol[i] = Integer.parseInt(numStrCol[i]);
        }

        return numCol;
    }
}

Measured memory_bytes: 23636
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/range/numeric.hpp>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif

#include<cstdlib>
#include<ctime>

namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::uint64_t p)
	{
		T ret = T(1);
		for (std::uint64_t i = 0; i <= 63; ++i)
		{
			if (((1ull << i) & p) != 0)
			{
				ret *= base;
			}
			base *= base;
		}
		return ret;
	}
	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find
	{
		std::vector<int> upper;
		union_find(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				return upper[index] = group(upper[index]);
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		write_line();
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}
namespace adaptor = boost::adaptors;

void Main()
{
	int A, B, C;
	std::cin >> A >> B >> C;
	if (A == B && B == C)
	{
		out::write_line("Yes");
	}
	else
	{
		out::write_line("No");
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
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 dyominov
 */
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);
        ACanYouGetAC solver = new ACanYouGetAC();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACanYouGetAC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.print(in.next().contains("AC") ? "Yes" : "No");
        }

    }

    static class InputReader implements AutoCloseable {
        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 void close() {
        }

    }
}



Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define F first 
#define S second 
#define MAX 10000003 
  
typedef long long ll; 
const long long int mod = 1000000007; 
  
long long  int prime[MAX]; 
unordered_map<long long int,long long int> max_map; 
  
// Function to return a^n 
long long int power(long long int a,long long int n) 
{ 
    if (n == 0) 
        return 1; 
   long long int p = power(a, n / 2) % mod; 
    p = (p * p) % mod; 
    if (n & 1) 
        p = (p * a) % mod; 
    return p; 
} 
  
// Function to find the smallest prime factors 
// of numbers upto MAX 
void sieve() 
{ 
    prime[0] = prime[1] = 1; 
    for (long long int i = 2; i < MAX; i++) { 
        if (prime[i] == 0) { 
            for (long long int j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) { 
                    prime[j] = i; 
                } 
            } 
            prime[i] = i; 
        } 
    } 
} 
  
// Function to return the LCM modulo M 
ll lcmModuloM(const long long int* ar,long long int n) 
{ 
  
    for (long long int i = 0; i < n; i++) { 
        long long int num = ar[i]; 
        unordered_map<long long int,long long  int> temp; 
  
        // Temp stores mapping of prime factor to 
        // its power for the current element 
        while (num > 1) { 
  
            // Factor is the smallest prime factor of num 
           long long  int factor = prime[num]; 
  
            // Increase count of factor in temp 
            temp[factor]++; 
  
            // Reduce num by its prime factor 
            num /= factor; 
        } 
  
        for (auto it : temp) { 
  
            // Store the highest power of every prime 
            // found till now in a new map max_map 
            max_map[it.first] = max(max_map[it.first], it.second); 
        } 
    } 
  
    ll ans = 1; 
  
    for (auto it : max_map) { 
  
        // LCM is product of primes to their highest powers modulo M 
        ans = (ans * power(it.F, it.S)) % mod; 
    } 
  
    return ans; 
} 

long long int power1(long long int x, long long  int y,long long  int p) 
{ 
    long long int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
}
int main ()         
{
    sieve(); 
  long long int n;cin>>n;
 
  long long  int a[n],k,sum=0,m=1000000007,r;
  for (long long int i=0;i<n;i++) {
      cin>>a[i];
  }
  k=lcmModuloM(a, n);
  //cout<<k<<endl;
  k=k%m;
  //cout<<k<<endl;
  for (long long int i=0;i<n;i++) {
     r=power1(a[i], m-2, m);
      sum+=k*r;
      sum=sum%m;
  }
  cout<<sum<<endl;

}

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

using namespace std;
typedef long long ll;
ll a,b,c,p,q,r;

int main()
{
    cin >> a >> b >> c >> p >> q;
    a=min(a,c*2); b=min(b,c*2);
    r=min(p,q);
    cout << r*min(c*2,a+b)+(p-r)*a+(q-r)*b << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A+B <= C*2:
        ans = A*X + B*Y
    else:
        if X<=Y:
            ans = C*X*2 + min(B,C*2)*(Y-X)
        elif X>Y:
            ans = C*Y*2 + min(A,C*2)*(X-Y)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61808
#include <iostream>
#include <unordered_map>
#include <algorithm>

using namespace std;

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

	unordered_map<int, int> m;

	int n;
	int in;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> in;
		m[in - 1]++;
		m[in]++;
		m[in + 1]++;
	}
	
	int ans = 0;
	for (const auto& x : m)
	{
		ans = max(ans, x.second);
	}
	cout << ans << endl;
}

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

using namespace std;

long long p = 1000000007;

int main(void) {
    int n, fac = 0;
    cin >> n;   
    vector <int> arr(n + 1);
    vector <int> cnt(n + 1);
    long long ans = 1;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
        (ans *= ((arr[i] ? cnt[arr[i] - 1] : 3) - cnt[arr[i]])) %= p;
        cnt[arr[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std ; 

typedef long long ll ; 

int main()
{
    ll N, X ; 
    scanf("%lld%lld", &N, &X) ; 
    ll ans = 0 ;
    ans += X ; 
    ans += N-X ; 
    ll a = N-X ; 
    ll b = X ; 
    while(a != b){
        if(a < b){
            //while(a < b){
            //    b -= a ; 
            //    ans += 2*a ; 
            //}
            ll cnt = b/a ; 
            if(b % a == 0)
                cnt-- ; 
            ans += 2*a*cnt ; 
            b -= cnt*a ; 
        }
        else{
            swap(a, b) ; 
        }
    }
    printf("%lld\n", ans+a) ; 
    return 0 ; 
}


Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n,m=MI()
    deg=[0]*n
    for _ in range(m):
        a,b=MI1()
        deg[a]+=1
        deg[b]+=1
    for d in deg:
        print(d)

main()

Measured memory_bytes: 3064