akhauriyash/Code-Regression huggingface dataset:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    R = I()
    G = I()

    ans = 2 * G - R
    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9940
""" AtCoder """

import sys
input = sys.stdin.readline

N, T = map(int, input().split())

min_c = 1001

for _ in range(N):
    c, t = map(int, input().split())
    if t <= T and c < min_c:
        min_c = c

if min_c == 1001:
    print("TLE")
else:
    print(min_c)


Measured memory_bytes: 2940
<?php
define('MOD', 10 ** 9 + 7);
list($n) = ints();
$p = new Prime((int) sqrt(10 ** 6) + 1);
$a = ints();
for ($i = 0; $i < $n; ++$i) {
    $pfs = $p->factor($a[$i]);
    foreach ($pfs as $k => $v) {
        if (isset($cnt[$k])) $cnt[$k] = max($cnt[$k], $v);
        else $cnt[$k] = $v;
    }
}
$lcm = 1;
foreach ($cnt as $k => $v) $lcm = modMul($lcm, modPow($k, $v));
$ans = 0;
for ($i = 0; $i < $n; ++$i) $ans = modAdd($ans, modDiv($lcm, $a[$i]));
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}

// 足し算
function modAdd($x, $y)
{
    return ($x + $y) % MOD;
}

// 引き算
function modSub($x, $y)
{
    return ($x + MOD - $y) % MOD;
}

// 掛け算
function modMul($x, $y)
{
    return ($x * $y) % MOD;
}

// 割り算
function modDiv($x, $y)
{
    return modMul($x, modPow($y, MOD - 2));
}

// 累乗（繰り返し二乗法）
function modPow($n, $x)
{
    if ($x === 0) return 1;
    $res = (modPow($n, $x >> 1) ** 2) % MOD;
    if ($x % 2 === 1) $res = modMul($res, $n);
    return $res;
}

// 階乗
function modFac($n)
{
    if ($n === 0) return 1;
    return modMul($n, modFac($n - 1));
}

// 順列
function nPr($n, $r)
{
    if ($r === 0) return 1;
    return modMul(nPr($n, $r - 1), $n - $r + 1);
}

// 組み合わせ
function nCr($n, $r)
{
    $r = min($r, $n - $r);
    if ($r === 0) return 1;
    return modDiv(nPr($n, $r), modFac($r));
}

// 階乗、逆元を前処理
function init($n)
{
    global $fact, $ifact;
    $fact[0] = 1;
    for ($i = 1; $i <= $n; ++$i) $fact[$i] = modMul($fact[$i - 1], $i);
    $ifact[$n] = modDiv(1, $fact[$n]);
    for ($i = $n; $i >= 1; --$i)
        $ifact[$i - 1] = modMul($ifact[$i], $i);
}

// 順列（前処理）
function nPr2($n, $r)
{
    global $fact, $ifact;
    return modMul($fact[$n], $ifact[$n - $r]);
}

// 組み合わせ（前処理）
function nCr2($n, $r)
{
    global $fact, $ifact;
    return modMul(modMul($fact[$n], $ifact[$r]), $ifact[$n - $r]);
}

// 素数関係
class Prime
{
    private $n;
    private $table; // 素数の添字にtrueが格納された配列

    function __construct($n)
    {
        $this->n = $n;
        $this->makeTable();
    }

    function makeTable()
    {
        $n = $this->n;
        $table = array_fill(2, $n - 1, true);
        $rn = (int) floor(sqrt($n));
        for ($i = 2; $i <= $rn; $i++) {
            if (!isset($table[$i])) continue;
            for ($j = 2 * $i; $j <= $n; $j += $i) {
                unset($table[$j]);
            }
        }
        $this->table = $table;
    }

    // 素数
    function primes()
    {
        return array_keys($this->table);
    }

    function table()
    {
        return $this->table;
    }

    // 素数判定
    function isPrime($x)
    {
        return isset($this->prime_table[$x]);
    }

    // 素因数分解
    function factor($x)
    {
        $res = [];
        if ($x === 1) return $res;
        $primes = $this->primes();
        foreach ($primes as $prime) {
            while ($x % $prime === 0) {
                if (isset($res[$prime])) $res[$prime]++;
                else $res[$prime] = 1;
                $x /= $prime;
            }
        }
        if ($x > 1) {
            if (isset($res[$x])) $res[$x]++;
            else $res[$x] = 1;
        }
        return $res;
    }
}


Measured memory_bytes: 17576
from bisect import bisect_left
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l, r = 0, 10000000000
while r - l > 1:
    m = (l + r) // 2
    res = 0
    for x in a:
        res += n - bisect_left(a, m - x)
    if res >= k:
        l = m
    else:
        r = m
b = [0] * (n + 1)
for i in range(1, n + 1):
    b[i] = b[i - 1] + a[n - i]
cnt = 0
ans = 0
for x in a:
    t = n - bisect_left(a, l - x)
    ans += b[t] + x * t
    cnt += t
print(ans - (cnt - k) * l)


Measured memory_bytes: 55700
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
vector<int> dy={1,0,-1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(m),b(m);
    rep(i,m){
        cin>>a[i];
        int v;
        cin>>v;
        int x=0;
        rep(i,v){
            int c;
            cin>>c;
            x+=pow(2,c-1);
        }
        b[i]=x;
    }
    
    vector<vector<int>> dp(1010,vector<int>(6000,INF));
    dp[0][0]=0;
    
    rep(i,m){
        for(int bit=0; bit<(1<<n); bit++){
            dp[i+1][(bit|b[i])] = min(dp[i+1][(bit|b[i])], dp[i][bit]+a[i]);
            dp[i+1][bit] = min(dp[i+1][bit], dp[i][bit]);
        }
    }
    
    cout<<(dp[m][(1<<(n))-1]==INF ? -1 : dp[m][(1<<(n))-1])<<endl;
}


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

int main(){
    int N, T, A;
    cin >> N >> T >> A;
    vector<double> diff(N);
    for(int i=0; i<N; i++){
        int h;
        cin >> h;
        diff[i] = abs(T-h*0.006-A);
    }
    int ans = min_element(diff.begin(), diff.end()) - diff.begin() + 1;
    cout << ans << endl;
    return 0;
}

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

int main() {
    int a,b  ;
    cin >> a >> b;
    for(int i = a / .08; i <= (b + 1) / .1; i++) {
        if((int)(i * .08) == a && (int)(i * .1) == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

void solve(string s){
	int n=s.size();
	vvl dp(n+1,vl(11));
	rep(i,n){
		rep(j,11){
			dp[i+1][(j*10+(s[i]-'0'))%11]+=dp[i][j];
		}
		if(s[i]-'0'!=0)dp[i+1][(s[i]-'0')%11]++;
	}
	ll ans=0;
	range(i,1,n+1)ans+=dp[i][0];
	cout<<ans<<endl;

}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	while(cin>>s,s!="0")solve(s);
}


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

using namespace std;

#define MAX_W 10000
#define INF LLONG_MAX/4
typedef long long ll;

ll dp[MAX_W+1];

int main(){
    ll M,N,E;
    int C;
    cin >> M >> N;
    vector<ll> P(M);
    for(ll i = 0 ; i < M ; i++){
        cin >> P[i];
    }
    sort(P.begin(),P.end(),greater<ll>());
    fill(dp,dp+MAX_W+1,INF);
    dp[0] = 0;
    for(ll i = 0 ; i < N ; i++){
        cin >> C >> E;
        for(int j = MAX_W ; j >= 0 ; j--){
            dp[j] = min(dp[j],dp[max(0,j-C)]+E);
        }
    }
    ll res = 0,sum = 0;
    for(int i = 0 ; i < M ; i++){
        sum += P[i];
        res = max(res,sum-dp[i+1]);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1372
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)

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

  int sum = 0;
  int tmp;

  tmp = N;
  while (tmp > 0) {
    sum += tmp % 10;
    tmp /= 10;
  }

  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

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



int main() {

	string s;
	cin >> s;

	int ap;
	int zp;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			ap = i;
			break;

		}
	}

	for (int i = s.size() - 1; i > -1; i--) {
		if (s[i] == 'Z') {
			zp = i;
			break;

		}

	}

	cout << zp - ap + 1 << endl;
	return 0;
}




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

int main() {
	
	int n;
	cin >> n;
	vector<pair<int, pair<int, int> > > points(n+1);
	for (int i=1; i<=n; i++) {
		cin >> points[i].first >> points[i].second.first >> points[i].second.second;
	}
	points[0] = make_pair(0, make_pair(0, 0));
	for (int i=1; i<=n; i++) {
		int dist = abs(points[i].second.first - points[i-1].second.first) + abs(points[i].second.second - points[i-1].second.second);
		if (dist > points[i].first - points[i-1].first) {
			cout << "No" << endl;
			exit(0);
		}
		if (dist % 2 != (points[i].first - points[i-1].first) % 2) {
			cout << "No" << endl;
			exit(0);
		}
	}
	cout << "Yes" << endl;
	
	
	
	
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

typedef long long int llint;

class UnionFind {
private:
	//ノードの数
	int size = 0;

	//ノードの親(根は自分自身)
	vector<int> par;

	//ノードの深さ(0～size)
	vector<int> rank;

	//キー値を入れる(必須ではない)
	vector<int> key;

	//グループのサイズ
	vector<int> group_size;

public:
	//サイズを指定し、UnionFind木を作成し、init() を呼ぶ
	UnionFind(int V, int K = 0);

	//UnionFind木を初期化する(全てを分解する)
	void init();

	//ノードが属する部分木の根を求める
	int find(int x);

	//二つの部分木を合体する
	void unite(int x, int y);

	//二つのノードが同じ部分木に属しているか調べる
	bool same(int x, int y);

	//キー値をセットする
	void set_key(int index, int x);

	//キー値を取得する
	int get_key(int index);

	//所属するグループのサイズを返す
	int get_group_size(int index);

	//デバッグ用
	void debug();
};

UnionFind::UnionFind(int V, int K) {
	if (V < 0) { V = 0; }
	size = V;
	par = vector<int>(V);
	rank = vector<int>(V);
	key = vector<int>(V, K);
	group_size = vector<int>(V, 1);
	init();
}

void UnionFind::init() {
	for (int i = 0; i < size; i++) {
		par[i] = i;
		rank[i] = 0;
		key[i] = 0;
	}
}

int UnionFind::find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void UnionFind::unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) { return; }//既に合体済み
	if (rank[x] < rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank[x] == rank[y]) { rank[x]++; }
	}
	int new_size = group_size[x] + group_size[y];
	group_size[x] = new_size;
	group_size[y] = new_size;
}

bool UnionFind::same(int x, int y) {
	return find(x) == find(y);
}

void UnionFind::set_key(int index, int x) {
	key[index] = x;
}

int UnionFind::get_key(int index) {
	return key[index];
}

int UnionFind::get_group_size(int index) {
	index = find(index);
	return group_size[index];
}

void UnionFind::debug() {
	cout << "UnionFindTree:" << endl;
	cout << "size = " << size << endl;
	for (int i = 0; i < size; i++) {
		cout << i << "番ノード:" << flush;
		cout << "値:" << get_key(i) << flush;
		cout << "親:" << find(i) << endl;
	}
}

int N, M;

int main() {
	cin >> N >> M;
	UnionFind uf(N);
	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B;
		A--; B--;
		uf.unite(A, B);
		//uf.debug();
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = max(ans, uf.get_group_size(i));
	}
	cout << ans << endl;
}

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

int main() {
  int m; cin >> m;
  ll d = 0, c = 0;
  rep(i, m) {
    ll a, b; cin >> a >> b;
    d += a * b;
    c += b;
  }
  cout << (c - 1) + (d - 1)/9 << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = (int) 2e5 + 7;
int n;
int t[N];
int sz[N];
int mn[N];

int root(int a)
{
    if (t[a] == a)
    {
        return a;
    }
    else
    {
        return t[a] = root(t[a]);
    }
}

void unite(int a, int b)
{
    a = root(a);
    b = root(b);
    if (a != b)
    {
        t[a] = b;
        sz[b] += sz[a];
        mn[b] = min(mn[b], mn[a]);
    }
}

struct T
{
    int x;
    int y;
    int i;
};

bool cmp(T a, T b)
{
    return a.x < b.x;
}

T a[N];
int pos[N];
int sol[N];

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

    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        t[i] = i;
        sz[i] = 1;
        mn[i] = i;
        cin >> a[i].x >> a[i].y;
        a[i].i = i;
    }
    sort(a + 1, a + n + 1, cmp);
    for (int i = 1; i <= n; i++)
    {
        pos[a[i].y] = i;
    }
    set<int> s;
    for (int i = 1; i <= n; i++)
    {
        int val = a[i].y;
        auto it = s.lower_bound(val);
        int cnt = 10;
        while (it != s.begin() && cnt--)
        {
            it--;
            unite(i, pos[*it]);
        }
        s.insert(val);
    }
    s.clear();
    for (int i = n; i >= 1; i--)
    {
        int val = a[i].y;
        auto it = s.lower_bound(val);
        int cnt = 10;
        while (it != s.end() && cnt--)
        {
            unite(i, pos[*it]);
            it++;
        }
        s.insert(val);
    }

    for (int i = 1; i <= n; i++)
    {
        sol[a[i].i] = sz[root(i)];
    }
    for (int i = 1; i <= n; i++)
    {
        cout << sol[i] << "\n";
    }
}


Measured memory_bytes: 19208
#include <iostream>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>
#include <type_traits>
#include <map>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

int gcd_euclid(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

// 最大公約数算出
int calc_gcd(const vector<int> vec){
	int gcd = *min_element(vec.begin(), vec.end());
	for (const int ele: vec){
		gcd = gcd_euclid(gcd,ele);
	}
	return gcd;
}

// 最小公倍数
int calc_lcm(const vector<int> vec) {
	int tmp = 1;
	for (const int ele: vec){
		tmp *= ele;
	}
	int gcd = calc_gcd(vec);
	return tmp/gcd;
}

void run() {
    int n,t; get n; get t;

    int cost = 9999;
    rep(i,0,n){
    	int c,time; get c; get time;
    	if ((time <= t) && (c < cost)) {
    		cost = c;
    	}
    }

    if (cost == 9999){
    	put "TLE";
    } else {
    	put cost;
    }
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum[ohara],pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<ll,ll> cou;

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>m;
    rep(i,n){
        cin>>a[i];
        a[i]%=m;
        sum[i]=a[i];
    }
    rrep(i,1,n){
        sum[i]+=sum[i-1];
    }
    rep(i,n){
        sum[i]%=m;
        if(sum[i]==0)ans++;
    }
    rep(i,n){
        cou[sum[i]]++;
    }
    rep(i,n){
        ans+=(cou[sum[i]]*(cou[sum[i]]-1))/2;
        cou[sum[i]]=0;
    }
    Cout(ans);
    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;
const int inv = 5e8 + 4;

int main()
{
  int N, dp[5001][5002] = {{}};
  string S;

  cin >> N;
  cin >> S;

  dp[0][0] = 1;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j <= N; j++) {
      (dp[i + 1][max(0, j - 1)] += dp[i][j]) %= mod;
      (dp[i + 1][j + 1] += dp[i][j] * 2 % mod) %= mod;
    }
  }
  int ret = dp[N][S.size()];
  for(int i = 0; i < S.size(); i++) ret = 1LL * ret * inv % mod;
  cout << ret << endl;
}

Measured memory_bytes: 97920
#include <bits/stdc++.h>
#define MAXN 505
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(c) (c).begin(), (c).end()
#define KONJ 42-42
using namespace std;



int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	
	int n;
	cin >> n;
	ll sol = 0;
	for (int i = 1; i <= n; i++)
		if (i % 5 && i % 3) sol += i;
	cout << sol;
	return 0;
}




Measured memory_bytes: 3612
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll N;
    sll(N);
    vector<ll> dp(N+1);
    vector<ll> as(N+1);
    rep(i, N){
        sll(as[i+1]);
    }

    dp[0] = 1000;
    rep(i, N){
        dp[i+1] = dp[i];
        for(ll j=1;j<=i;j++){
            ll W = dp[j-1] / as[j];
            ll M = dp[j-1] - as[j] * W;
            M = M + as[i+1] * W;
            dp[i+1] = max(dp[i+1], M);
        }
    }
    cout << dp[N] <<endl;
}

int main(){
    Main();
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a + b + c > 21) cout << "bust" << endl;
  else cout << "win" << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();

    int ans = N / 3;

    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 23252
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

int main(){
    fastIO;
    ll x;
    cin >> x;
    ll res = 0;
    ll p = x/11ll;
    ll d = x % 11ll;
    if(d > 0){
        if(p % 2 == 1){
            if(d <= 5){
                res ++;
            }
            else {
                res += 2;
            }
        }
        else{
            if(d <= 6){
                res ++ ;
            }
            else{
                res += 2;
            }
        }
    }
    res += p * 2;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
string s;
bool vis[100000][2][2];
bool t[100000];
bool check() {
	for (int i = 2; i < n; ++i) {
		if (t[i] == false) {
			if (s[i] == 'o')
				t[(i + 1) % n] = t[i - 1];
			else
				t[(i + 1) % n] = !t[i - 1];
		}
		else {
			if (s[i] == 'o')
				t[(i + 1) % n] = !t[i - 1];
			else
				t[(i + 1) % n] = t[i - 1];
		}
	}
	for (int i = 0; i < n; ++i) {
		int l = t[(i + n - 1) % n];
		int r = t[(i + 1) % n];
		if (t[i] == false) {
			if (s[i] == 'o' && l != r)
				return false;
			if (s[i] == 'x' && l == r)
				return false;
		}
		else {
			if (s[i] == 'o' && l == r)
				return false;
			if (s[i] == 'x' && l != r)
				return false;
		}
	}
	return true;
}
int main()
{
	cin >> n >> s;
	for(int i=0;i<2;++i)
		for(int j=0;j<2;++j)
			for (int k = 0; k < 2; ++k) {
				t[0] = i;
				t[1] = j;
				t[2] = k;
				if (check()) {
					for (int i = 0; i < n; ++i)
						if (t[i])
							printf("W");
						else
							printf("S");
					puts("");
					return 0;
				}
			}
	puts("-1");
	return 0;
}

Measured memory_bytes: 640
n, t = map(int, input().split())

l = []

for i in range(n):
    l.append(list(map(int, input().split())))

ans = float('inf')

for i in range(n):
    if l[i][1] <= t:
        ans = min(ans, l[i][0])

if ans != float('inf'):
    print(ans)
else:
    print('TLE')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	for(int i=0;i<b.size();i++)
		cout<<a[i]<<b[i];
	if(a.size()!=b.size())
		cout<<a[a.size()-1];
	return 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    i64 x;
    cin >> x;

    i64 money = 100;
    i64 year = 0;
    while (money < x)
    {
        money = money * 1.01;
        year++;
    }
    
    cout << year << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n, h, w; scanf("%d%d%d", &n, &h, &w);
	
	printf("%d\n", (n - h + 1) * (n - w + 1));
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define LL long long
int main(){
	LL ans=0;
	int h,w,r1,r2;
	scanf("%d%d",&h,&w);
	if(h==1||w==1){
		printf("1\n");
		return 0;
	}
	r1=(w+1)/2;
	r2=w/2;
	ans+=(LL)h/2*(r1+r2);
	ans+=h%2*r1;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
integer::squarecheck(0:16000)
integer N,D
integer,allocatable,dimension(:,:)::X
integer preans,ans

squarecheck=0
do i=0,200
  if(i*i>16000)exit
  squarecheck(i*i)=1
end do

read*,N,D
allocate(X(N,D))
do i=1,N
  READ*,X(i,:)
end do

ans=0
do i=1,n-1
  do j=i+1,N
    preans=0
    do jj=1,D
      preans=preans+(X(i,jj)-X(j,jj))*(X(i,jj)-X(j,jj))
    end do
    if(squarecheck(preans)==1)ans=ans+1
  end do
end do

print"(i0)",ans
end

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,N,K,j;
  double sum,num,b;
  scanf("%d %d",&N,&K);
  for(i = 1;i <= N;i++){
    num = 1.0/N;b=1.0;
    for(j = 0;j < 20;j++){
      if((i<<j)>=K){sum += num*b;break;}
      b/=2;
    }
  }
  printf("%.15f\n",sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n = 0, m = 0;
    cin >> n >> m;

    vector<int> k(m, 0);

    vector<vector<int>> s(m, vector<int>(n, 0));
    for (int im = 0; im < m; im++)
    {
        cin >> k[im];

        for (int ik = 0; ik < k[im]; ik++)
        {
            int ss = 0;
            cin >> ss;
            s[im][ik] = (ss - 1);
        }
    }

    vector<int> p(m, 0);
    for (int im = 0; im < m; im++)
    {
        cin >> p[im];
    }

    int cnt = 0;
    for (int bit = 0; bit < (1 << n); bit++)
    {
        vector<int> s1(n, 0);
        for (int in = 0; in < n; in++)
        {
            s1[in] = ((bit >> in) & 1);
            // cout << s1[in];
        }
        // cout << endl;

        int lamps = 0;
        for (int im = 0; im < m; im++)
        {
            int parity = 0;
            for (int ik = 0; ik < k[im]; ik++)
            {
                parity += s1[s[im][ik]];
            }

            if (parity % 2 == p[im])
            {
                lamps++;
            }
        }
        // cout << ": " << lamps << endl;
        if (lamps == m)
        {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
n, m  = gets.strip.split.map(&:to_i)
as = gets.strip.split.map(&:to_i)

match_numbers = [2, 5, 5, 4, 5, 6, 3, 7, 6].map.with_index {|e, i| [e, i+1] }.select {|_, i| as.include?(i) }.sort.to_h

#p match_numbers
dp = Array.new(n+1, 0)

(1..n).each do |i|
  tmp = match_numbers[i].to_i.to_s
  match_numbers.each do |cost, number|
    next if i-cost<0 || dp[i-cost].zero?

    a = dp[i-cost].to_s
    b = number.to_s
    str = a < b ? (b+a) : (a+b)
    if tmp.length < str.length || (tmp.length==str.length && tmp < str)
      tmp = str
    end
  end
  dp[i] = tmp.to_i
#p dp
end

p dp[n]






Measured memory_bytes: 49796
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <bitset>
#include <cassert>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define endl '\12'
#define eb emplace_back
#define SZ(a) int32_t(a.size())
#define ALL(x) (x).begin(),(x).end()
#define trav(a,x) for (auto& a: x)
#define LOG(FMT...) fprintf(stderr, FMT)
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
constexpr int mod = 1e9+7;
constexpr int Erica = 998244353;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll ex_gcd(ll a, ll b, ll& x, ll& y){if(!b){x=1;y=0;return a;}ll ret=ex_gcd(b,a%b,y,x);y-=a/b*x;return ret;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
int norm(int x) { return x >= mod ? (x - mod) : x; }
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
inline ll get_inv(ll a) { ll x, y; ex_gcd(a, mod, x, y); return norm(x + mod);}
template<class T>inline void umin(T &x, T y) {x = x > y ? y : x;}
template<class T>inline void umax(T &x, T y) {x = x < y ? y : x;}
template<class T>inline void dec(T &x, T y) {x -= y; if(x < 0) x += mod;}
template<class T>inline void add(T &x, T y) {x += y; if(x >= mod) x -= mod;}
const double PI = acos(-1.0);
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr ull base=2333, P_1=19260817, P_2=999998639;
constexpr int maxn = 1e6+10; // remember to calculate. if tle, check maxn first.
ll n , d , ans;
int main()
{
    close;
    cin >> n >> d;
    while(n--){
        ll x, y;
        cin >> x >> y;
        if(1ll * x * x + 1ll * y * y <= 1ll * d * d) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005
ll n;
ll dp[N];
vi adj[N];
ll fun(ll node)
{
	if(dp[node]!=-1)
		return dp[node];
	ll ans=0;
	for(auto i:adj[node])
		ans=max(ans,fun(i)+1);
	dp[node]=ans;
	return ans;
}
void solve()
{

	ll m;
	cin>>n>>m;
	ll x,y;
	rep(i,0,m)
	{
		cin>>x>>y;
		adj[x].pb(y);
	}
	rep(i,1,n+1)
	dp[i]=-1;
	ll mx=0;
	rep(i,1,n+1)
	{
		mx=max(mx,fun(i));
	}
	cout<<mx<<endl;
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 8576
#include <iostream>
#include <queue>
#include <tuple>

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

using namespace std;

int main () {

    int n,m;
    cin >> n >> m;
    tuple<ll,ll,ll> item_table[n];

    rep(i, n) {
        ll a,b,c;
        cin >> a >> b >> c;
        item_table[i] = make_tuple(a,b,c);
    }

    ll a_total,b_total,c_total;
    // abc 0 ... 負, 1 ... 正
    // 000
    // 001
    // 010
    // 011
    // 100
    // 101
    // 110
    // 111

    priority_queue<ll>  sum_q;
    rep(i, 8) { // 0 ... 7
        ll sign_symbol_a = i & 0b001 ? 1 : -1;
        ll sign_symbol_b = i & 0b010 ? 1 : -1;
        ll sign_symbol_c = i & 0b100 ? 1 : -1;

        priority_queue<ll> tmp_q;
        rep(j, n) {
            tmp_q.push( sign_symbol_a * get<0>(item_table[j]) +
                        sign_symbol_b * get<1>(item_table[j]) +
                        sign_symbol_c * get<2>(item_table[j]) );
        }

        ll tmp_sum = 0;
        rep(j, m) {
            tmp_sum += tmp_q.top();
            tmp_q.pop();
        }

        sum_q.push(tmp_sum);
    }

    cout << sum_q.top() << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second

using namespace std;

int N, nr, st[109], ap[109];
long double coef[109];
const long double PI = acos (-1.0);

typedef pair < int, int > point;
pair < point, int > init[109];
point p[109];

long long det (point a, point b, point c)
{
    return 1LL * a.x * b.y + 1LL * b.x * c.y + 1LL * c.x * a.y - 1LL * a.x * c.y - 1LL * b.x * a.y - 1LL * c.x * b.y;
///              A.x * B.y +       B.x * C.y+        C.x * A.y   -     A.x * C.y -       B.x * A.y        -C.x * B.y
}

void add (int i)
{
    while (nr >= 2 && det (p[st[nr - 1]], p[st[nr]], p[i]) >= 0)
        ap[st[nr]] = 0, nr --;
    ap[i] = 1, st[++nr] = i;
}

long long d2 (point a, point b)
{
    return 1LL * (a.x - b.x) * (a.x - b.x) + 1LL * (a.y - b.y) * (a.y - b.y);
}

long double d (point a, point b)
{
    return sqrt (1.0 * d2 (a, b));
}

//ofstream cout ("output");
void print (long double val, string s)
{
    cout << setprecision (15) << val << s;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d %d", &init[i].first.x, &init[i].first.y), init[i].second = i, coef[i] = 0.0;
sort (init + 1, init + N + 1);
for (int i=1; i<=N; i++)
    p[i] = init[i].first;
if (N == 2)
{
    printf ("0.5\n0.5\n");
    return 0;
}
//for (int i=1; i<=N; i++)
  //  cout << p[i].x << " " << p[i].y << '\n';
nr = 2, st[1] = 1, st[2] = 2, ap[2] = 1;
for (int i=3; i<=N; i++)
    if (ap[i] == 0)
        add (i);
for (int i=N - 1; i>1; i--)
    if (ap[i] == 0)
        add (i);
add (1), nr --;
/*for (int i=1; i<=nr; i++)
    cout << st[i] << " ";
cout << '\n';*/
if (nr == 1)
{
    for (int i=1; i<=N; i++)
        if (i == init[1].second || i == init[N].second)
            printf ("0.5\n");
        else
            printf ("0.0\n");
    return 0;
}
st[0] = st[nr], st[nr + 1] = st[1];
for (int i=1; i<=nr; i++)
{
    point a = p[st[i - 1]], b = p[st[i]], c = p[st[i + 1]];
    long double csa = (long double) (1.0 * d2 (b, c) + 1.0 * d2 (a, b) - 1.0 * d2 (a, c)) / (2.0 * d (a, b) * d (b, c));
    if (csa > 1.0) csa = 1.0;
    if (csa < -1.0) csa = -1.0;
    coef[init[st[i]].second] = PI - acos (csa);
}
long double sum = 0.0;
for (int i=1; i<=N; i++)
    sum += coef[i];//, print (coef[i], "\n");
//print (sum, "=sum\n");
for (int i=1; i<=N; i++)
    print ((long double) coef[i] / sum, "\n");
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, k = 0;
    string s;
    cin >> a >> b >> s;
    for (int i = 0; i < s.size(); i++)
        if (s[i] == '-') k++;
    if (k == 1 && s[a] == '-') cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e5;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Graph{
	private:
	int n;
	vvp g;
	public:
	vi DIJ(int s){
		priority_queue<P> q;
		vi d(n,inf);
		d[s]=0;
		q.push({0,s});
		while(!q.empty()){
			P p=q.top();
			q.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(auto i:g[v]){
				int u=i.first,D=d[v]+i.second;
				if(d[u]>D){
					d[u]=D;
					q.push({-D,u});
				}
			}
		}
		return d;
	}
	Graph(int v){
		n=v;
		g=vvp(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back({t,c});
		g[t].push_back({s,c});
	}
};

int n,x,y;

int main(){
	cin>>n>>x>>y;
	Graph g(n);
	g.add_edge(x-1,y-1,1);
	for(int i=0;i<n-1;i++) g.add_edge(i,i+1,1);
	vi a(n);
	for(int i=0;i<n;i++){
		vi d=g.DIJ(i);
		for(int j=i+1;j<n;j++) a[d[j]]++;
	}
	for(int i=1;i<n;i++) cout<<a[i]<<endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  map<int, int> m;
  int a, b;
  REP(i, 3) {
    scanf(" %d %d", &a, &b);
    m[a]++;
    m[b]++;
  }

  string ans = "YES";
  FOR(i, 1, 5) {
    if(m[i] >= 3) {
      ans = "NO";
    }
  }
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
for i in range(H):
    s = input()
    cnt = -1
    res = []
    for j in range(W):
        if s[j] == 'c':
            cnt = 0
        else:
            if cnt != -1:
                cnt += 1
        res.append(cnt)
    print(*res)

Measured memory_bytes: 5628
N, M = list(map(int, input().split()))
B = [True] * M
for i in range(N):
    A = list(map(int, input().split()))[1:]
    _B = [False] * M
    for a in A:
        _B[a - 1] = True
    B = list(map(lambda x: x[0] and x[1], zip(B, _B)))
print(sum(filter(lambda x: x, B)))


Measured memory_bytes: 9172
import sys
N, M = [int(x) for x in input().split()]
a = [float(x) for x in input().split()]
total = sum(a)
OK, NG = 0, 0
for j, i in enumerate(a):
    if i >= 1.0*total/(4*M):
        OK += 1
        if OK >= M:
            print('Yes')
            sys.exit()
    else:
        NG += 1
        if OK + (len(a) - j - 1) < M:
            print('No')
            sys.exit()


Measured memory_bytes: 9124
H,W,D = list(map(int,input().split()))

mp = [0 for i in range(H*W+1)]

for i in range(H):
    a=list(map(int,input().split()))
    for j in range(W):
        mp[a[j]]=[i,j]
S = []
for i in range(1,D+1):
    s1 = [0]
    s2 = 0
    j=1
    while j*D+i<=H*W:
        s2+=abs(mp[j*D+i][0]-mp[(j-1)*D+i][0])+abs(mp[j*D+i][1]-mp[(j-1)*D+i][1])
        s1.append(s2)
        j+=1
    S.append(s1)
ans=[]
Q=int(input())
for i in range(Q):
    L,R=list(map(int,input().split()))
    d=(L-1)%D
    e=(R-1)//D
    f=(L-1)//D
    ans.append(S[d][e]-S[d][f])
    
for a in ans:
    print(a)

Measured memory_bytes: 23564
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 long double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  101LL
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll Powb(ll b,ll n,ll m);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
ll P[N+1];
void Sieve(int n=N);

int main()
{
fast;
ll q=1,t;
//cin >> q; t = q;
while(q--)
{
    ll i,j,n,m,k,l=0,r=0,a=0,b=0,c=0,d=0,e,g=1,p,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> n;
    vector<ll> V(n);
    for(i=0;i<n;i++) cin >> V[i];
    for(i=0,j=1;i<n;i++)
    {
        if(V[i]==j) j++;
    }
    if(j==1) cout << -1;
    else
        cout << (n-j+1);
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

void Sieve(int n)
{
    //memset(P,true,sizeof(P));
    //P[0] = false;
    //P[1]= false;
    for(int i=1;i<=n;i++) P[i] = i;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i]==i)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                if(P[j]==j)
                    P[j]=i;
            }
        }
    }

}



Measured memory_bytes: 4748
#include <bits/stdc++.h>
#define rep(i, z, n) for(int64_t i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
#define PI 3.14159265358979
//const int64_t INF = 1LL << 60;
const int INF = 1 << 29;
//const int MODINF = 1000000007;
//const int64_t INF = 998244353;
using namespace std;
typedef pair<int64_t, int64_t> P;

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && A != C) cout << "Yes" << endl;
    else if (A == C && A != B) cout << "Yes" << endl;
    else if (C == B && A != C) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;
using ll=long long;

int main() {
    ll N;
    cin >> N;
    ll A[200000] = {};
    ll cnt[200001] = {};
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        cnt[A[i]]++;
    }

    ll res = 0;
    ll comb = 0;
    for (int i = 1; i <= N; ++i) {
        comb += (cnt[i] * (cnt[i] - 1)) / 2;
    }
    for (int k = 0; k < N; ++k) {
        res = comb - (cnt[A[k]] - 1);
        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 5760
n=gets.to_i
a=gets.split.map &:to_i
p 2*n-1
if a.max.abs>=a.min.abs
i=a.index(a.max)+1
(1..n).each{|w| print("#{i} #{w}\n")}
(1...n).each{|v| print(v," ", v+1 ,"\n")}
else
i=a.index(a.min)+1
(1..n).each{|w| print("#{i} #{w}\n")}
(0...n-1).each{|v| print(n-v," ",n-v-1 ,"\n")}
end

Measured memory_bytes: 3836
main = do
  [x,y] <- map read . words <$> getLine
  let g1 = [1,3,5,7,8,10,12]
  let g2 = [4,6,9,11]
  let g3 = [2]
  let gx = map (or . map (==x)) [g1,g2,g3]
  let gy = map (or . map (==y)) [g1,g2,g3]
  putStrLn $ if gx==gy then "Yes" else "No"

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

int main(){
  string s,t;
  cin>>s>>t;
  int flag=0;
  vector<int> ind;
  int ans=0;
  for(int i=0;i+t.size()<=s.size();i++){
    if(s[i]==t[0]||s[i]=='?'){
      flag=0;
      for(int j=0;j<t.size();j++){
        if(s[i+j]==t[j]||s[i+j]=='?'){
          flag=1;
        }else{
          flag=0;
          break;
        }
      }
      if(flag==1){
        ind.push_back(i);
        ans=1;
      }
    }
  }

  string anss=s;
  string ans2(s.size(),'z');

  if(ans==1){
    for(int k=0;k<ind.size();k++){
      for(int i=0;i<s.size();i++){
        if(i<ind[k]||i>=ind[k]+t.size()){
          if(s[i]=='?'){
            anss[i]='a';
          }else{
            anss[i]=s[i];
          }
        }else if(i==ind[k]){
          for(int j=0;j<t.size();j++){
            anss[i+j]=t[j];
          }
          i=ind[k]+t.size()-1;
        }
      }
      ans2=min(ans2,anss);
    }
  }else{
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  cout<<ans2<<endl;
  return 0;
}


Measured memory_bytes: 256