akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    string S;
    cin >> S;
    int A = S[0] - '0', B = S[1] - '0', C = S[2] - '0', D = S[3] - '0';

    if (A + B + C + D == 7) printf("%d+%d+%d+%d=7\n", A, B, C, D);
    else if (A + B + C - D == 7) printf("%d+%d+%d-%d=7\n", A, B, C, D);
    else if (A + B - C + D == 7) printf("%d+%d-%d+%d=7\n", A, B, C, D);
    else if (A - B + C + D == 7) printf("%d-%d+%d+%d=7\n", A, B, C, D);
    else if (A + B - C - D == 7) printf("%d+%d-%d-%d=7\n", A, B, C, D);
    else if (A - B - C + D == 7) printf("%d-%d-%d+%d=7\n", A, B, C, D);
    else if (A - B + C - D == 7) printf("%d-%d+%d-%d=7\n", A, B, C, D);
    else if (A - B - C - D == 7) printf("%d-%d-%d-%d=7\n", A, B, C, D);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int N = 2e5 + 9;
const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}

int sub(int a, int b) {
	return (a - b + MOD) % MOD;
}

int binpow(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

int divv(int a, int b) {
	return mul(a, binpow(b, MOD - 2));
}

int f[N];

void init() {
	f[0] = 1;
	for (int i = 1; i < N; i++) {
		f[i] = mul(i, f[i - 1]);
	}
}

int C(int n, int k) {
	if (k < 0 || k > n) return 0;
	return divv(f[n], mul(f[k], f[n - k]));
}

vector<int> dp_w;
vector<int> dp_b;

void calc_dp(int W, int B) {
	dp_w.resize(W + B + 1);
	dp_b.resize(W + B + 1);
	for (int i = min(W, B); i <= W + B; i++)  {
		{
			dp_w[i] = dp_w[i - 1];
			dp_w[i] = add(dp_w[i], divv(C(i - 1, W - 1), binpow(2, i)));
		}
		{

			dp_b[i] = dp_b[i - 1];
			dp_b[i] = add(dp_b[i], divv(C(i - 1, B - 1), binpow(2, i)));
		}		
	}
}

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

	init();

	int w, b;
	cin >> b >> w;
	calc_dp(w, b);
	for (int i = 1; i <= w + b; i++) {
		int prob_end = dp_w[i - 1];
		int prob_ok = sub(1, add(dp_w[i - 1], dp_b[i - 1]));
		int ans = add(prob_end, divv(prob_ok, 2));
		cout << ans << '\n';
	}
}


Measured memory_bytes: 6912
import math

def prime(x):
    if x == 2 or x == 3:
        return True
    for i in range(2, int(math.sqrt(x))+2):
        if x%i == 0:
            return False
    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if prime(x):
        count += 1
print(count)


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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n), q(n), r(n);
    rep(i, n) {
        cin >> p.at(i);
    }
    rep(i, n) {
        cin >> q.at(i);
    }
    rep(i, n) {
        r.at(i) = i + 1;
    }

    int a = 0, b = 0, temp = 0;

    do {
        temp++;
        if (r == p) a = temp;
        if (r == q) b = temp;
    } while (next_permutation(r.begin(), r.end()));

    cout << max(b - a, a - b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  string S,T;
  bool ans = false;
  cin >> S >> T;
  //cout << S.size() << endl;
  for(int i = 0; i < S.size(); ++i){
    if(S == T){
      ans = true;
    }
    //cout << S.back() << " " <<S.substr(0,S.size() - 1) << endl;
    S = S.back() + S.substr(0,S.size() - 1);
    //cout << S << endl;
  }
  if(ans){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

ll mymin = 10000000;
ll N, M, X;
ll C[13];
ll A[13][13];
bool ans = false;

void rec(ll sumC, array<ll, 13> sumA, int n)
{
    if (n == N)
    {
        bool flag = true;
        for (int i = 0; i < M; i++)
        {
            if (sumA[i] < X)
            {
                flag = false;
            }
        }
        if (flag && mymin > sumC)
        {
            mymin = sumC;
            ans = true;
        }
        return;
    }
    rec(sumC, sumA, n + 1);
    for (int i = 0; i < M; i++)
    {
        sumA[i] += A[n][i];
    }
    rec(sumC + C[n], sumA, n + 1);
}

int main()
{
    cin >> N >> M >> X;
    for (int i = 0; i < N; i++)
    {
        cin >> C[i];
        for (int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
    }
    ll sumC = 0;
    array<ll, 13> sumA = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    rec(sumC, sumA, 0);
    if (ans)
    {
        cout << mymin << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll int
#define maxn 10001
#define MOD 1000000007
using namespace std;

string s;
ll k, n;
ll dp[maxn][101][2];
vector<ll> num;

/*
 dp[p][s][f]
    p = position
    s = sum upto p
    f = flag if the value is crossing the range or not
*/

ll solve(ll pos, ll sum, ll f){
    if(n==pos){
        if(sum==0) return 1;
        else return 0;
    }
    if(dp[pos][sum][f] != -1) return dp[pos][sum][f];
    ll res = 0, lmt;
    if(f==0){ // the pos can only be (0, s[pos])
        lmt = num[pos];
    }
    else { // the pos can be anything
        lmt = 9;
    }
    for(ll i = 0; i <= lmt; i++){
        ll newf = f; // newf is the flag value for next position
        if(f==0 && i<lmt) newf = 1; // if currently f =0 ie restricted and
                                 // current pos is less than the edge value
                                 //the next pos can be anything bw (0,9), hence newf is 1
        res += solve(pos+1, (sum+i)%k, newf);
        res %= MOD;
    }
    return dp[pos][sum][f] = res;
}

int main(){
    //ll t; cin >> t; while(t--){
        cin >> s >> k;
        num.clear();
        n = s.length();
        for(ll i=0; i<n; i++){
            num.push_back(s[i]-'0');
        }
        memset(dp, -1, sizeof(dp));
        ll ans = solve(0,0,0);
        ans--;
        if(ans<0) ans+= MOD;
        cout << ans << endl;
    //}
}


Measured memory_bytes: 9088
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 105;
const int mod = 1000000007;

int gcd(int x, int y){
  if(y==0)return x;
  return gcd(y, x % y);
}


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  int ret = 0;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++){
      int tt = gcd(i, j);
      for(int k=1;k<=n;k++){
        ret+=gcd(k, tt);
      }
    }
  cout<<ret<<endl;
  return 0;
}

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

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

struct UnionFind{
  vi data;

  UnionFind(int size){
    data.resize(size,-1);
    //rep(i, size) data[i] = -1;
  }

  bool unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x != y){
      if(data[y] < data[x]) swap(x,y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }

  bool find(int x, int y){
    return root(x) == root(y);
  }

  int root(int x){
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }

  int size(int x){
    return -data[root(x)];
  }

  void print(){
    cout << "i :\t";
    rep(i, data.size()) cout << i << "\t";
    cout << endl;
    cout << "data :\t";
    rep(i, data.size()) cout << root(i) << "\t";
    cout << endl;
  }
};

main(){
  int n,k,l; cin >> n >> k >> l;
  
  struct UnionFind a(n), b(n);

  rep(i,k){
    int p,q; cin >> p >> q;
    a.unite(p-1,q-1);
  }

  rep(i,l){
    int r,s; cin >> r >> s;
    b.unite(r-1,s-1);
  }
  
  //a.print();
  //b.print();

  map<pii,int> mp;
  rep(i,n){
    mp[pii(a.root(i),b.root(i))]++;
  }

  rep(i,n){
    cout << mp[pii(a.root(i),b.root(i))];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
}

Measured memory_bytes: 13568
N, M = map(int, input().split())
ab = []
for i in range(N):
    ab.append(list(map(int, input().split())))

ab.sort()

cost = 0
for a, b in ab:
    if b < M:
        cost += a * b
        M -= b
    else:
        cost += a * M
        break


print(cost)



Measured memory_bytes: 27760
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
string a, b;
int main() {
    DAU
    cin >> a >> b;
    b.erase(b.end() - 1);
    if (a == b)
        cout << "Yes";
    else cout << "No";
    PLEC
}


Measured memory_bytes: 3696
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let n: u64 = input();
    let mut i = 1;
    while i*i <= n {        
        i += 1;
    }
    println!("{}", (i-1)*(i-1));
}


Measured memory_bytes: 4352
import Foundation

let testCaseCount = Int(readLine()!)!
var ac = 0, wa = 0, tle = 0, re = 0;
for _ in 0..<testCaseCount {
    let result = readLine()!
    switch result {
    case "AC":
        ac += 1
    case "WA":
        wa += 1
    case "TLE":
        tle += 1
    case "RE":
        re += 1
    default:
        print("")
    }
}

print("AC x \(ac)")
print("WA x \(wa)")
print("TLE x \(tle)")
print("RE x \(re)")


Measured memory_bytes: 13216
#include<stdio.h>
#include<iostream>

using namespace std;

int main(){

int n;
while(cin>>n,n){
int Ac[10001];
int Bc[10001];
int Ap=0;
int Bp=0;

for(int i=0;i<n;i++)cin>>Ac[i]>>Bc[i];

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

  if(Ac[i]>Bc[i])Ap+=Ac[i]+Bc[i];
  else if(Ac[i]<Bc[i])Bp+=Ac[i]+Bc[i];
  else if(Ac[i]==Bc[i]){
   Ap+=Ac[i];
   Bp+=Bc[i];
  }
 }

cout<<Ap<<' '<<Bp<<endl;

}

return 0;

}

Measured memory_bytes: 1236
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
    string S;
    cin >> S;

    bool isOdd = true;
    bool isEasy = true;

    for (auto &&x : S)
    {
        if (isOdd)
        {
            if (x == 'L')
            {
                isEasy = false;
            }
        }
        else
        {
            if (x == 'R')
            {
                isEasy = false;
            }
        }
        isOdd = !isOdd;
    }
    
    cout << (isEasy?"Yes":"No") << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h_L = list(map(int,input().split()))

h_L.append(0)

count = 0
for i in range(1,n):
    tmp_L = h_L[0:i+1]
    if h_L[i] == sorted(tmp_L)[-1]:
        count +=1

print(count+1)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define int long long

using namespace std;

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

    string s[100];
    int n, l;
    cin >> n >> l;
    for (int i = 0; i < n; i++)
        cin >> s[i];
    sort(s, s + n);
    for (int i = 0; i < n; i++)
        cout << s[i];
    cout << '\n';

    return 0;
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    lli n;
    cin1(n);
    cout << (n - 1) * n /2 << endl;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

class UnionFind {
    vector<int> data;
    int num;

  public:
    UnionFind(int size) : data(size, -1), num(size) {}
    bool unionSet(int x, int y) {
        x = root(x);
        y = root(y);
        if(x != y) {
            if(data[y] < data[x])
                swap(x, y);
            data[x] += data[y];
            data[y] = x;
            num--;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
    int numSet() {
        return num;
    }
};

void solve() {
    ll n, m;
    cin >> n >> m;
    UnionFind uni(n);

    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        uni.unionSet(a, b);
    }
    cout << uni.numSet() - 1 << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
#define ll      long long int
#define nl      '\n'
using namespace std;

int main(void){

    ll n,m,ans=0,cnt=0;

    //vector<ll>a(n+5);

    string s;
        cin>>n;
        cin>>s;

    for(ll i=1; i<=n; i++){
        if(s[i]!=s[i-1]) cnt++;
    }
    cout<<cnt;
}



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

using namespace std;

#define rep(i,a,b) for(ll i = a; i<ll(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

int main(){
	cin.sync_with_stdio(false);
    ll n; cin>>n;
    vi a(n);
    ll mxInd = 0;
    rep(i,0,n) {
        cin>>a[i];
        if(abs(a[i])>abs(a[mxInd]))
            mxInd = i;
    }
    bool rev = (a[mxInd]<0);
    if(a[mxInd]<0){
        rep(i,0,n) a[i] *= -1;
        reverse(all(a));
    }
    cout<<2*n<<endl;
    a[0] += a[mxInd]*2;
    cout<<mxInd+1<<" "<<(rev?n:1ll)<<endl;
    cout<<mxInd+1<<" "<<(rev?n:1ll)<<endl;
    rep(i,1,n){
        a[i] += a[i-1]*2;
        cout<<(rev?(n-i+1):(i))<<" "<<(rev?(n-i):(i+1))<<endl;
        cout<<(rev?(n-i+1):(i))<<" "<<(rev?(n-i):(i+1))<<endl;
    }
    //rep(i,0,n-1) assert(a[i]<=a[i+1]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll Pow(ll a, int n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1)res *= a;
		a *= a;
		n >>= 1;
	}
	return res;
}
int main() {
	init();

	int N, P; cin >> N >> P;
	vector<int>vec(N);
	rep(i, 0, N)cin >> vec[i];
	int cnt = 0;
	rep(i, 0, N) {
		if (vec[i] % 2 == 1)++cnt;
	}
	if (P == 0) {
		if (cnt == 0)cout << Pow(2LL, N);
		else cout << Pow(2LL, N - 1);
	}
	else {
		if (cnt == 0)cout << 0 << "\n";
		else cout << Pow(2LL, N - 1);
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;

// /////////////////////////////////////////////

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// ////////////////////////////////

#define int long long
const int N = 2e3 + 10;
int n , x , y;
int ans[N];
vector<int> v[N];
void bfs(int s , int *lev){

	bool vis[N];
	memset(vis , false , sizeof vis);

	queue<int> q;
	q.push(s);
	lev[s] = 0;
	vis[s] = true;
	while(!q.empty()){

		int node = q.front();
		q.pop();
		for(int it : v[node]){

			if(!vis[it]){

				vis[it] = true;
				q.push(it);
				lev[it] = lev[node] + 1;
			}
		}
	}


}

void solve(){

	cin>>n>>x>>y;

	for(int i = 1 ; i < n ; ++i)
		v[i].pb(i+1), v[i+1].pb(i);

	v[x].pb(y);
	v[y].pb(x);
	int lev[n+1];
	for(int i = 1 ; i <= n ; ++i){

		bfs(i , lev);

		for(int j = i+1 ; j <= n ; ++j)
			ans[lev[j]]++;

	}

	for(int i = 1 ; i <= n-1 ; ++i)
		cout<<ans[i]<<endl;

}

signed main(){

    fast;
    int t = 1;
    //cin>>t;
    for(int i = 1 ; i <= t; ++i){

    	solve();
    }
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

int main(){
	LL x;cin>>x;
	LL ans=x/11;
	ans*=2;
	if(x%11>6)ans++;
	if(x%11)ans++;
	printf("%lld",ans);
}


Measured memory_bytes: 256
/*BY-ADITYA OJHA
  LEARN DSA SINCERELY*/
#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define forjn for(int j=0;j<n;j++)
#define pb push_back
#define vx vector<ll> x
#define fas1  ios_base::sync_with_stdio(false)
#define fas2   cin.tie(NULL)
using namespace std;


int main()
{
     fas1;
     fas2;
     
    ll n,m;
    cin>>n>>m;
    if(n==m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
from fractions import gcd

A, B, C, D = map(int, input().split())


def lcb(x, y):
    return int((x * y) / gcd(x, y))


l = lcb(C, D)

A -= 1
AC = A // C
AD = A // D
ACD = A // l
x = A - AC - AD + ACD
# print(x)

BC = B // C
BD = B // D
BCD = B // l
y = B - BC - BD + BCD
# print(y)

ans = y - x
print(ans)


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

const int Mx = 300 * 300 + 9;

const int mod = 998244353;
ll dp[Mx + 9];
ll dp2[Mx + 9];

ll modPow(ll n, ll k) {
	ll res = 1;
	for (n %= mod; k; k >>= 1) {
		if (k & 1)
			res = res * n % mod;
		n = n * n % mod;
	}
	return res;
}

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

	int n;
	cin >> n;

	ll sum = 0;

	dp[0] = dp2[0] = 1;
	for (int rep = 0; rep < n; ++rep) {
		int x;
		cin >> x;
		sum += x;
		for (int i = Mx; i >= 0; --i) {
			dp[i] = (2 * dp[i] + (i < x ? 0 : dp[i - x])) % mod;
			dp2[i] = (dp2[i] + (i < x ? 0 : dp2[i - x])) % mod;
		}
	}

	ll res = modPow(3, n) - accumulate(dp + (sum + 1) / 2, dp + Mx + 1, 0LL) * 3;
	if (sum % 2 == 0)
		res += 3 * dp2[sum / 2];
	cout << (res % mod + mod) % mod;
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		List<List<Long>> list = new ArrayList<List<Long>>();
		for (int i = 0; i < n; ++i) {
			long x = sc.nextLong();
			long y = sc.nextLong();
			long z = sc.nextLong();
			List<Long> tmp = new ArrayList<Long>();
			tmp.addAll(Arrays.asList(x, y, z));
			list.add(tmp);
		}
		sc.close();
		long ans = 0;
		int d[][] = { { -1, -1, -1 }, { -1, -1, 1 }, { -1, 1, -1 }, { -1, 1, 1 }, { 1, -1, -1 }, { 1, -1, 1 },
				{ 1, 1, -1 }, { 1, 1, 1 } };
		for (int i = 0; i < 8; ++i) {
			long tmp[] = new long[n];
			for (int j = 0; j < n; ++j) {
				for (int k = 0; k < list.get(j).size(); ++k) {
					tmp[j] += d[i][k] * list.get(j).get(k);
				}
			}
			Arrays.sort(tmp);
			long sum = 0;
			for(int j = 0; j < m; ++j) 
				sum += tmp[n - 1 - j];
			ans = Math.max(ans,  sum);
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 28724
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 2000010
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-6
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
const ll mod = 1e9 + 7;
ll n, m;
map<string, int> MP;
int main() {
	io(); cin >> n;
	rep(i, 1, n) {
		string s; cin >> s;
		MP[s]++;
	}
	int maxx = 0;
	for (auto i : MP) {
		maxx = max(maxx, i.second);
	}
	vector<string> vec;
	for (auto i : MP) {
		if (i.second == maxx) {
			vec.emplace_back(i.first);
		}
	}
	sort(vec.begin(), vec.end());
	for (auto i : vec) cout << i << '\n';
}

Measured memory_bytes: 25584
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e3 + 5, mod = 1e9 + 7;

ll dp[N][N] = {0}, fact[N], factPow[N][N];

ll fastModExp(ll x, ll e);

int main()
{
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;	

	for (int j = 0; j <= n; ++j)
		dp[0][j] = 1;

	fact[0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		fact[i] = (i * fact[i-1]) % mod;
		factPow[i][0] = 1;

		for (int j = 1; j <= n; ++j)
			factPow[i][j] = (fact[i] * factPow[i][j-1]) % mod;
	}

	for (int i = 1; i <= n; ++i)
	{
		for (int j = a; j <= b; ++j)
		{
			dp[i][j] = dp[i][j-1];
			for (int k = c; k <= d; ++k)
			{
				if (k*j > i)
					break;

				ll num = fact[i];
				ll den = fact[i - k*j];
				den = (den * factPow[j][k]) % mod;
				den = (den * fact[k]) % mod;
				den = fastModExp(den, mod - 2);
				num = (num * den) % mod;

				dp[i][j] = (dp[i][j] + num*dp[i - k*j][j-1]) % mod;
			}
		}
	}

	cout << dp[n][b];
}

ll fastModExp(ll x, ll e)
{
	ll res = 1;
	x %= mod;
	while (e)
	{
		if (e % 2)
			res = (res * x) % mod;

		e /= 2;
		x = (x * x) % mod;
	}

	return res;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;
//階乗できるよ
ll kaizyo(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  int n,m,x; cin >> n >> m >> x;
  vector<int> value(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i,n) {
    cin >> value[i];
    rep(j,m) {
      cin >> a[i][j];
    }
  }

  ll ans = INF;
  ll all = 1 << n;
  rep(mask,all) {
    vector<int> level(m);
    ll cost = 0;
    rep(i,n) {
      if((mask>>i)&1){
        cost += value[i];
        rep(j,m) {
          level[j] += a[i][j];
        }
      }
    }

    bool flag = true;
    rep(i,m) {
      if(level[i] < x) flag = false;
    }
    
    if(flag) {
      ans = min(ans, cost);
    }
  }
  if(ans == INF) cout << -1 << endl;
  else cout << ans << endl;
}



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

using ll = long long;

int main(){
  ll a,b;
  cin>>a>>b;
  if(a>0){
    cout<<"Positive"<<endl;
  }else if(b>0&&a<0){
    cout<<"Zero"<<endl;
  }else if((b-a)%2==0){
    cout<<"Negative"<<endl;
  }else{
    cout<<"Positive"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
const ll MAXX = 1e18;  

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	cout << ((n - 1) * n) / 2 << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

char ss[510000];
int flip;
int main(){
	char*s1=ss+200010;
	scanf("%s",s1);
	char*s2=s1+strlen(s1);
	int q;
	scanf("%d",&q);
	while(q--){
		int t;
		scanf("%d",&t);
		if(t==1)flip^=1;
		else{
			int f;
			char c;
			scanf("%d %c",&f,&c);
			f--;
			if(f^flip)*s2++=c;
			else *--s1=c;
		}
	}
	while(s1!=s2){
		if(flip)putchar(*--s2);
		else putchar(*s1++);
	}
}

Measured memory_bytes: 1936
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

using ll = long long;
using ld = long double;
using lli = long long int;

#define PI 3.14159265358979323846264338327950L

int main(){
  int X, N;
  vector<int> p_i;
  int i, j, temp, ans_idx, cur_abs;
  bool in_flag = false;

  cin >> X >> N;
  cur_abs = X;
  ans_idx = 0;

  for(i=0; i<N; i++){
    cin >> temp;
    p_i.push_back(temp);
  }
  
  for(i=0; i<=X; i++){
    temp = X-i;
    for(j=0; j<p_i.size(); j++){
      if(temp == p_i.at(j)){
        in_flag = true;
        break;
      }
    }
    if( ! in_flag){
      cout << temp << endl;
      return 0;  
    }

    in_flag = false;
    temp = X+i;
    for(j=0; j<p_i.size(); j++){
      if(temp == p_i.at(j)){
        in_flag = true;
        break;
      }
    }
    if( ! in_flag){
      cout << temp << endl;
      return 0;  
    }
    else{
      in_flag = false;
    }
  }

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
const int MX = 200005;
//----------------------------------------------------------------

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  int n;
  cin>>n;
  vl x(n);
  cin>>x;
  vl w = x;
  sort(rng(w));
  int hn = n/2;
  rep(i,n){
    if( distance(w.begin(), upper_bound(rng(w),x[i]-1)) < hn ){
      cout<<w[hn]<<endl;
    }else{
      cout<<w[hn-1]<<endl;
    }
  }

} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 5376
#include <stdio.h>

int main(void)
{
	int student;
	double weight;
	double height;
	
	while (scanf("%d%*c%lf%*c%lf", &student, &weight, &height) != EOF){
		if (weight / height / height >= 25) printf("%d\n", student);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int array[3];
  int temp;
  scanf("%d %d %d", &array[0], &array[1], &array[2]);
  for(int i = 0; i < 3; i++){
    for(int j = i + 1; j < 3; j++){
      if(array[i] < array[j]){
	temp = array[i];
	array[i] = array[j];
	array[j] = temp;
      }
    }
  }

  if(array[0] == 7 && array[1] == 5 && array[2] == 5){
    printf("YES\n");
  }
  else{
    printf("NO\n");
  }
  return 0;
}

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

int main(){
  int n; string s;
  cin >>n >>s;
  int ans = 0;
  for(int i = 1; i<n; i++){
    int cnt = 0;
    for(char c = 'a'; c<='z'; c++){
      bool left = false, right = false;
      rep(j,i) if(s[j]==c) left = true;
      for(int j = i; j<n; j++) {
        if(s[j]==c) right = true;
      }
      if(left && right) cnt++;
    }
    if(cnt>ans) ans = cnt;
  }
  cout << ans << endl;
  return 0; 
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String x = sc.next();
        String y = sc.next();
        String z = sc.next();
        
        x = x.toUpperCase();
        y = y.toUpperCase();
        z = z.toUpperCase();
        
        System.out.print(x.charAt(0));
        System.out.print(y.charAt(0));
        System.out.println(z.charAt(0));
        
        sc.close();
        
    }
}


Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s[i]=='9'){
            s[i]='1';
        }else{
            s[i]='9';
        }
    }
    cout<<s<<endl;
}


Measured memory_bytes: 256
n=int(input())

pts=[]
for i in range(n):
    pts.append(tuple(map(int,input().split())))

diffs={}
for i in range(n-1):
    for j in range(i+1,n):
        dx=pts[i][0]-pts[j][0]
        dy=pts[i][1]-pts[j][1]
        if dx<0 :
            dx=-dx
            dy=-dy
        elif dx==0 and dy<0:
            dy=-dy
        key="{},{}".format(dx,dy)
        if key in diffs:
            diffs[key]+=1
        else:
            diffs[key]=1

max=0
maxkey=""
for k,v in diffs.items():
    if v>max:
        max=v
        maxkey=k
        
print(n-max)

Measured memory_bytes: 39152
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n;
vector<i64> p, q;
int main() {
  cin >> n;
  read_n(p, n);
  q.assign(n + 1, 0);
  for (i64 i = 0; i < n; ++i) q[p[i]] = i + 1;

  multiset<i64> st;
  st.insert(0);
  st.insert(0);
  st.insert(n + 1);
  st.insert(n + 1);
  i64 ans = 0;
  for (i64 x = n; x > 0; --x) {
    st.insert(q[x]);
    auto lit = st.find(q[x]);
    auto rit = lit;
    i64 a, b, c, d, e;
    b = *(--lit);
    a = *(--lit);
    c = *rit;
    d = *(++rit);
    e = *(++rit);
    // cerr << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl;
    ans += x * ((b - a) * (d - c) + (e - d) * (c - b));
  }
  cout << ans << endl;
  return 0;
}

// 8 2 7 3 4 5 6 1
//   



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

int main() {
  int n;
  cin >> n;
  vector<ll> h(n);
  rep(i, n) {
    cin >> h.at(i);
  }
  int k = 0;
  reverse(h.begin(), h.end());
  for(int i = 1; i < n;i++) {
    if (h.at(i) - h.at(i-1) == 1) {
      k++;
      h.at(i)--;
    } else if (h.at(i) -h.at(i-1) > 1) {
      cout << "No" << endl;
      break;
    } else {
      k++;
      continue;
      
    }
  }
  if (k == n-1) {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
tot = 0
for i in range(0, n):
  if a[i] < b[i]:
    tot += (b[i] - a[i]) // 2
  else:
    tot -= a[i] - b[i]
print ("Yes" if tot >= 0 else "No")


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

const ld EPS = 1e-10;
const ld PI = acos(-1.0);
const int INF = (int)1e9 + 5;
const ll LINF = (ll)1e18 + 5;

template<class T> 
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T> 
ll round(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

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

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
		os << *it;
		if ((it + 1) != v.end()) os << ", ";
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

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

#define all(a) (a).begin(), (a).end()

int main() {
	srand(time(0));
#ifdef LOCAL 
	freopen("input.txt", "r", stdin);
#else
#endif

	int n, k;
	cin >> n >> k;
	
	vector<int> d(k);
	
	for (int & x : d) {
		cin >> x;
	}

	auto good = [&](int x) {
		while (x) {
			if (binary_search(all(d), x % 10)) return false;
			x /= 10;
		}
		return true;
	};

	int x;
	for (x = n; ; ++x) {
		if (good(x)) break;
	}

	cout << x << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, m, k = map(int, input().split())
for i in range(n + 1):
    a = k - i * m
    b = n - 2 * i
    if b != 0 and a % b == 0 and 0 <= a // b <= m:
        print("Yes")
        exit()
print("No")


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

using namespace std;
using ll = long long;
ll kaij(ll n) {
    if(n == 0) {
        return 0;
    }
    if(n == 1) {
        return 0;
    }
    return n*(n - 1);
}

int main() {
    ll N = 0;
    cin >> N;
    vector<ll> A(N,0);
    ll ans = 0;
    vector<ll> c(2*1e5 + 100, 0);
    for(ll i = 0; i < N; i++) {
        cin >> A.at(i);
        c.at(A.at(i))++;
    }
    for(ll i = 0; i < 2*1e5 + 10; i++) {
        if(c.at(i)) {
            ans += kaij(c.at(i))/2;
        }
    }
    //cout << ans << endl;
    for(ll i = 0; i < N; i++) {
        cout << ans - kaij(c.at(A.at(i)))/2 + kaij(c.at(A.at(i)) - 1)/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 6356
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    rep(i,n)cin >> c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));
    ll ans = 0;
    vector<ll> sum_b(n+1,0), num_b(n);
    rep(i,n){
        ll num = c.end() - upper_bound(all(c), b[i]);
        num_b[i] = num;
    }
    rep(i,n)sum_b[i+1] = sum_b[i] + num_b[i];
    rep(i,n){
        ll idx = upper_bound(all(b), a[i]) - b.begin();
        ans += sum_b[n] - sum_b[idx];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4224
#include <iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int one = 0, two = 0, four = 0;
	while (n--)
	{
		int x;
		cin >> x;
		if (x % 4 == 0)
			four++;
		else if (x % 2 == 0)
			two++;
		else
			one++;
	}
	four -= one - 1;
	if (two)
		four--;
	if (four >= 0)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int  /*a=0,b=0,c=0,*/n=0,x=0,i=0,j=0,k=0,sum=0;

        int aa[128][128];
        //int bb[]={};
        cin >> n >> x;
        //if(n==0 && x==0)break;
        for(i=0;i<n;i++){
            for(j=0;j<x;j++){
                cin >> k;
                aa[i][j]=k;
                sum+=k;
            }
            aa[i][j]=sum;
            sum=0;
        }


 for(j=0;j<x+1;j++){
        for(i=0;i<n;i++){
            sum+=aa[i][j];
        }
        aa[i][j]=sum;
        sum=0;

    }

        for(i=0;i<n+1;i++){
            for(j=0;j<x+1;j++){
                cout << aa[i][j];
                if(j<x)cout << ' ';
            }
            cout << endl;
        }


    //cout << endl;

return 0;

}

//1793081

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

vector<vector<ll>> G(200);
vector<ll> memo(200);
bool dfs(ll v, ll p){
    bool flag = false;
    for(auto& u:G[v]){
        //if(u == p) continue;
        if(memo[u] != 0){
            if(memo[u] != p){
                return true;
            }else{
                continue;
            }
        }
        memo[u] = p;
        ll n = (p==1?2:1);
        flag = flag || dfs(u,n);
    }
    return flag;
}
vector<vector<ll>> d(200, vector<ll>(200,1e18));
void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}

int main(){
    ll N;
    cin >> N;
    string s;
    rep(i,N){
        cin >> s;
        d[i][i] = 0;
        rep(j,N){
            if(s[j] == '1'){
                G[i].push_back(j);
                d[i][j] = 1;
            }
        }
    }
    memo[0] = 1;
    if(dfs(0,2)){
        cout << -1 << endl;
        return 0;
    }
    warshall_floyd(N);
    ll ans = 0;
    rep(i,N)rep(j,N){
        //cout << d[i][j] << endl;
        cmax(ans,d[i][j]);
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 4212
using System;

    class Program
    {
        static void Main()
        {
            double[] num = Console.ReadLine().Split(' ').toDoubleArray();
            Vector vec1 = new Vector(num[0], num[1]);
            Vector vec2 = new Vector(num[2], num[3]);

            Console.WriteLine(vec2.subVector(vec1).norm().ToString());
        }
    }

    class Vector
    {
        public double X;
        public double Y;

        public Vector(double x, double y)
        {
            X = x;
            Y = y;
        }

        public double norm()
        {
            return Math.Sqrt(X * X + Y * Y);
        }

        public Vector addVector(Vector vec)
        {
            return new Vector(X + vec.X, Y + vec.Y);
        }

        public Vector subVector(Vector vec)
        {
            return new Vector(X - vec.X, Y - vec.Y);
        }
    }

    static class Extensions_strArray
    {
        static public double[] toDoubleArray(this string[] array)
        {
            return Array.ConvertAll<string, double>(array,
                delegate(string value)
                {
                    return double.Parse(value);
                }
            );
        }
    }

Measured memory_bytes: 5828
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = [0]
for i in range(1,n+1):
    a.append(inn())
ddprint(a)
sm = 0
while len(a)>0:
    sm += a[-1]//2
    if len(a)>1 and a[-1]%2==1 and a[-2]>0:
        sm += 1
        a[-2] -= 1
    a.pop()
print(sm)


Measured memory_bytes: 51052
#include <bits/stdc++.h>
#define zcin(type, a) type a; cin >> a;
#define zcout(a, sep1, b, sep2) cout << a << sep1 << b << sep2;
#define zfor(i, b, n) for (int i = b; i < n; ++i)
#define pb push_back

using namespace std;

vector<int> value(107), weight((int)1e5 + 5);

long long memo[107][(int)1e5 + 5];
int n, w;

long long knapsack(int i, int tweight)
{
	if (!tweight || i >= n)
		return 0;
	if (memo[i][tweight] > -1)
		return memo[i][tweight];
	if (tweight < weight[i])
		return memo[i][tweight] = knapsack(i+1, tweight);
	return memo[i][tweight] = max(knapsack(i + 1, tweight), knapsack(i + 1, tweight - weight[i]) + value[i]);
	
}
int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		//freopen("output.txt", "w", stdout);
	#endif


	scanf("%d%d", &n, &w);
	for (int i = 0; i < n; ++i)
		scanf("%d%d", &weight[i], &value[i]);
	memset(memo, -1, sizeof(memo));

	printf("%lld", knapsack(0, w));

	return 0;
}


Measured memory_bytes: 84224
N,M = map(int,input().split())
a = [-1]*N
ans = 0
for i in range(M):
    s,c = map(int,input().split())
    if a[s-1] == -1:
        a[s-1] = c
    elif a[s-1] != c:
        ans = -1
        break
if a[0] == 0 and N>1:
    ans = -1
if ans != -1:
    if a[0] == -1 and N>1:
        a[0] = 1
    if a[0] == -1 and N == 1:
        a[0] = 0
    for i in range(N):
        if a[i] == -1:
            a[i] = 0
        a[i] = str(a[i])
    ans = "".join(a)
print(ans)

Measured memory_bytes: 9224
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000
#define MOD 1000000007
#define N 200005
#define M 1000005
#define LOG 21
#define KOK 32000
#define EPS 0.000000001
using namespace std;

char s[N];

int main() {
 
	//freopen("input.txt","r",stdin);

	scanf("%s",s+1);

	int n=strlen(s+1);

	ll ans=0;

	int tot=0;

	for(int i=n;i>=1;i--) {

		tot+=(s[i]=='W');

		if(s[i]=='B') ans+=tot;

	}	

	printf("%lld",ans);

}


Measured memory_bytes: 384