akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

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

    vector<char> str(3);
    rep (i, 3)
        cin >> str[i];
    sort(all(str));

    if (str[0] == 'a' and str[1] == 'b' and str[2] == 'c')
        print("Yes");
    else
        print("No");

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll n = nxt(), w = nxt();

    vector <ll> dp(w+1, 0);

    for(ll i=0; i<n; i++)
    {
        ll weight = nxt(), value = nxt();

        for(ll j=w-weight; j>=0; j--)
        {
            dp[j+weight] = max(dp[j+weight], dp[j] + value);
        }
    }

    ll ans = 0;

    for(ll i=0; i<=w; i++)
    {
        ans = max(ans, dp[i]);
    }

    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long r;
long long d;
long long x[2100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>r>>d>>x[2000];
	for(int i=2001;i<=2010;i++){
		x[i]=x[i-1]*r-d;
		cout<<x[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
l = []
for _ in range(n):
    l.append([int(x) for x in input().split()])
for j in range(n):
    if j == 0:
        i = l[0][1] + l[0][2]
        c = l[0][0]
    else:
        i = (l[j][1] - l[j-1][1]) + (l[j][2] - l[j-1][2])
        c = l[j][0] - l[j-1][0]
    if i > c:
        print("No")
        break
    elif i == c or (c - i) % 2 == 0:
        if j == n-1:
            print("Yes")
            break
        else: continue
    else:
        print("No")
        break

Measured memory_bytes: 21156
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	string s;
	cin>>s;

	if(s[s.length()-1]=='s')
	{
		s+='e';
		s+='s';
	}
	else if(s[s.length()-1]=='e')
	{
		s+='s';
	}
	else
	{
		s+='s';
	}
	cout<<s<<endl;


}

Measured memory_bytes: 3664
#097_D
n, m = map(int, input().split())
p = [int(x)-1 for x in input().split()]

#Union-Find
par=[i for i in range(n)]
size=[1 for _ in range(n)]
rank=[0 for _ in range(n)]

def find(x):#木の根を求める
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
    
def merge(x,y):#併合
    x=find(x)
    y=find(y)
    if x==y:
        return
    
    if rank[x]>rank[y]:
        par[y]=x
        size[x]+=size[y]
    else:
        par[x]=y
        size[y]+=size[x]
        if rank[x]==rank[y]:
            rank[y]+=1
            
def same(x,y):
    return find(x)==find(y)

for _ in range(m):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    merge(x, y)

ans = 0
for i in range(n):
    if same(i, p[i]):
        ans += 1
        
print(ans)

Measured memory_bytes: 13812
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll dp[3010][3010][4];

int main(){
    int R,C,K; cin >> R >> C >> K;
    vector<int> r(K),c(K),v(K);
    vector<vector<int>> f(R,vector<int>(C));
    rep(i,K){
        cin >> r[i] >> c[i] >> v[i];
        r[i]--; c[i]--;
        f[r[i]][c[i]] = v[i];
    }
    rep(i,3010)rep(j,3010)rep(k,4){
        dp[i][j][k] = -1;
    }
    if(f[0][0]) dp[1][1][1] = f[0][0];
    dp[1][1][0] = 0;

    rep(i,R+1)rep(j,C+1)rep(k,4){
        if(dp[i][j][k] == -1) continue;
        if(j < C) dp[i][j+1][k] = max(dp[i][j+1][k],dp[i][j][k]);
        if(i < R){
            dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][k]);
            dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][k]+f[i][j-1]);
        }
        if(k < 3 && j < C) dp[i][j+1][k+1] = max(dp[i][j+1][k+1],dp[i][j][k]+f[i-1][j]);
    }
    ll ans = 0;
    rep(i,4) ans = max(ans,dp[R][C][i]);
    cout << ans << endl;

}



Measured memory_bytes: 323912
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;

#define MAX_N 100010

#define exchange(a, b) exchange_(&(a), &(b))
void exchange_(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int Partition(int *A, int p, int r) {
	int x = A[r];
	int i = p - 1, j;
	for (j = p; j < r; j++) {
		if (A[j] <= x) {
			i++;
			exchange(A[i], A[j]);
		}
	}
	exchange(A[i+1], A[r]);
	return i+1;
}

int arr[MAX_N];
int n;

int main(int argc, char **argv)
{
	int i, p;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}

	p = Partition(arr, 0, n-1);

	const char *fmt, *sp = "";
	for (i = 0; i < n; i++) {
		if (i == p) {
			fmt = "%s[%d]";
		} else {
			fmt = "%s%d";
		}
		printf(fmt, sp, arr[i]);
		sp = " ";
	}
	putchar('\n');
	return 0;
}

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

int main(){

    int N;
    int x[100], y[100], h[100];
    cin >> N;
    for( int i = 0; i < N; i++ ) cin >> x[i] >> y[i] >> h[i];


    bool can = false; // 特定のCx, Cyに対してloopが最後まで実行されるかどうか

    for( int Cx = 0; Cx <= 100; Cx++ ){
        for( int Cy = 0; Cy <= 100; Cy++ ){

            int H;
            //Cx, Cyに対してHの値を一つ定める
            for( int i = 0; i < N; i++ ){
                if( h[i] != 0 ){
                    H = h[i] + abs(x[i] - Cx) + abs(y[i] - Cy);
                    break;
                }
            }
            
            //上で定めたHが正しいかcheck
            for( int i = 0; i < N; i++ ){
                if( h[i] != 0 ){
                    if( H != h[i] + abs(x[i] - Cx) + abs(y[i] - Cy) ) break;
                }else{
                    if( H > abs(x[i] - Cx) + abs(y[i] - Cy) ) break;
                }
                if( i == N-1 ) can = true;
            }
            

            /*int H = 0;
            vector<int> constraint;
            
            for( int i = 0; i < N; i++ ){
                int ans = h[i] + abs(x[i] - Cx) + abs(y[i] - Cy);
                if( h[i] != 0 ){
                    if( H == 0 ) H = ans;
                    else if( H != ans ) break;
                }else{ // h[i] == 0のとき
                    constraint.push_back( ans );
                    if( H != 0 ){
                        for( int j = 0; j < constraint.size(); j++ ){
                            if( H > constraint[j] ) break;
                        }
                    }
                }
                if( i == N-1 ) can = true; // breakされずにloopの最後まできたら
            }*/

            if( can ){
                cout << Cx << " " << Cy << " " << H << endl;
                break;
            }
        }
        if( can ) break;
    }

    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            Console.WriteLine(N * (N - 1) / 2);

        }
    }
}

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

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

const int MOD = 1e9 + 7;

int main(int argc, char** argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> pos, neg;
  bool zero = false;
  vector<int> a(n);
  for (int x, i = 0; i < n; i++) {
    cin >> x;
    zero |= x == 0;
    if (x > 0) pos.push_back(x);
    if (x < 0) neg.push_back(x);
    a[i] = x;
  }
  if (sz(neg) + sz(pos) < k) return cout << 0, 0;
  sort(all(pos));
  sort(all(neg));
  reverse(all(neg));
  if ((pos.empty() && k % 2 == 1) || (sz(neg) + sz(pos) == k && sz(neg) & 1) || n == k) {
    if (zero) return cout << 0, 0;
    sort(all(a));
    reverse(all(a));
    long long product = 1;
    for (int i = 0; i < k; i++) {
      product = (product % MOD * a[i] % MOD) % MOD;
      product %= MOD;
    }
    while (product < 0) product += MOD;
    return cout << product << '\n', 0;
  }
  vi res;
  auto add = [&](vi& nums) {
    res.push_back(nums.back());
    nums.pop_back();
    res.push_back(nums.back());
    nums.pop_back();
  };
  if (k & 1) {
    res.push_back(pos.back());
    pos.pop_back();
    --k;
  }
  while (k >= 2) {
    if (sz(pos) >= 2 && sz(neg) >= 2) {
      long long x = 1ll * pos[sz(pos) - 1] * pos[sz(pos) - 2];
      long long y = 1ll * neg[sz(neg) - 1] * neg[sz(neg) - 2];
      if (x > y)
        add(pos);
      else
        add(neg);
    } else if (sz(neg) >= 2)
      add(neg);
    else
      add(pos);
    k -= 2;
  }
  long long product = 1;
  for (int& num : res) {
    product = (product % MOD * num % MOD) % MOD;
    while (product < 0) product += MOD;
    product %= MOD;
  }
  cout << product % MOD << '\n';
  return 0;
}


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

int main() {
  int N;
  int K;
  cin >> N >> K;
  
  int dist = 0;
 
  
  for (int i = 0; i < N; i++) {
    int x;
  	cin >> x;
    if (x < K - x) {
      dist += x*2;
    }
    else {
      dist += (K-x)*2;
    }
  }
  
  cout << dist << endl;
  

}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

ll L;

int nc = 1;
int son[400050][2];
bool chk[400050];
char u[400050];
ll G = 0;
ll getv(ll d) {
	ll rv = 1;
	while (d % 2 == 0) {
		rv *= 2;
		d /= 2;
	}
	return rv;
}

void DFS(int n, int d) {
	if (n == 0) {
		G ^= getv(L - d + 1);
		return;
	}
	if (chk[n]) return;
	if (d == L) return;

	DFS(son[n][0], d + 1);
	DFS(son[n][1], d + 1);
}
int main() {
	int N, i, j, k;
	scanf("%d %lld", &N, &L);
	for (i = 1; i <= N; i++) {
		scanf("%s", u);
		for (j = 0, k = 1; u[j]; j++) {
			int t = u[j] - '0';
			if (!son[k][t]) son[k][t] = ++nc;
			k = son[k][t];
		}
		chk[k] = true;
	}
	DFS(1, 0);
	if (G == 0) printf("Bob\n");
	else printf("Alice\n");
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
    using namespace std;
     
    int main()
    {   
        ios_base::sync_with_stdio(0);
        cin.tie(0);         
        int x,a;
        cin>>x>>a;
        cout<<(x<a?0:10)<<endl; 
                    
     
        return 0;
    }

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;

void solve();

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

void solve() {
    string s;
    cin >> s;
    if (s.size() == 1) {
        cout << s << endl;
    } else {
        bool all_nine = true;
        REP1(i, s.size() - 1) {
            if (s[i] != '9') {
                all_nine = false;
                break;
            }
        }
        if (all_nine) {
            cout << (s[0] - '0') + 9 * (s.size() - 1) << endl; 
        } else {
            cout << (s[0] - '1') + 9 * (s.size() - 1) << endl;
        }
    }
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

#define MAX_H 805
#define MAX_W 805
#define MAX_K (MAX_H * MAX_W)

int H, W, K;
char Field[MAX_H][MAX_W];
int Sx, Sy;

int used[MAX_H][MAX_W];

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

bool isInField(int x, int y)
{
  return 0 <= x && x < W && 0 <= y && y < H;
}

bool isGoal(int x, int y)
{
  return x == 0 || x == W-1 || 0 == y || y == H-1;
}

int main()
{
  cin >> H >> W >> K;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> Field[i][j];
      if(Field[i][j] == 'S'){
        Sx = j; Sy = i;
        Field[i][j] = '.';
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      used[i][j] = INF;
    }
  }

  using Pos = pair<int, int>;
  queue<Pos> que;
  queue<Pos> ansList;

  que.push(Pos(Sx, Sy));

  used[Sy][Sx] = 0;

  while(que.size()){
    Pos p = que.front();
    que.pop();

    int x = p.first;
    int y = p.second;

    ansList.push(p);

    if(used[y][x] == K){
      continue;
    }

    for (int d = 0; d < 4; d++) {
      int nx = x + dx[d];
      int ny = y + dy[d];
      if(isInField(nx, ny) && used[ny][nx] == INF && Field[ny][nx] == '.'){
        used[ny][nx] = used[y][x]+1;
        que.push(Pos(nx, ny));
      }
    }

  }

  int ans = 1145141919;
  while(ansList.size()){

    Pos p = ansList.front();
    ansList.pop();

    int x = p.first;
    int y = p.second;

    if(isGoal(x, y)){
      cout << 1 << endl;
      return 0;
    }

    //左
    int tmp = x/K + (x % K > 0 ? 1 : 0);
    ans = min(ans, tmp);

    //右
    tmp = (W-x-1)/K + ((W-x-1) % K > 0 ? 1 : 0);
    ans = min(ans, tmp);

    //上
    tmp = y/K + (y % K > 0 ? 1 : 0);
    ans = min(ans, tmp);

    //下
    tmp = (H-1-y)/K + ((H-1-y) % K > 0 ? 1 : 0);
    ans = min(ans, tmp);

  }

  cout << ans + 1 << endl;

  return 0;
}


Measured memory_bytes: 8576
N = int(input())
X_N = [int(i) for i in input().split()]
M = int(input())
A_M = [int(i) for i in input().split()]

for i in range(0, M):
    if (X_N[A_M[i]-1] != 2019) and ((A_M[i] == N) or (X_N[A_M[i]] != X_N[A_M[i]-1] + 1)):
        X_N[A_M[i]-1] += 1
        
for i in range(0, N):
    print(X_N[i])


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m; cin >> n >> m;
  int a[m],b[m];
  for(int i; i<m; i++) cin >> a[i] >>b[i];
  int r[n];
  for(int i; i<n; i++) r[i]=0;
  for(int i; i<m; i++){
    r[a[i]-1] += 1;
    r[b[i]-1] += 1;
  }
  for(int i; i<n; i++)  cout << r[i] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A,B,C,D;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    if(A+B>C+D)
    printf("Left\n");
    else if((A+B)<(C+D))
    printf("Right\n");
    else
    printf("Balanced\n");
    return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  ll N,sum=0;
  cin>>N;
  ll A[N];
  map<ll,ll> m;
  map<ll,ll> ans;
  map<ll,ll> hiku;
  set<ll> s;
  for(ll i=0;i<N;i++){
    cin>>A[i];
    m[A[i]]++;
  }
  for(ll i=0;i<N;i++){
    if(s.count(A[i])) continue;
    ll a;
    a=m[A[i]];
    ans[A[i]]=a*(a-1)/2;
    hiku[A[i]]=(a-1)*(a-2)/2;
    if(ans[A[i]<0]) ans[A[i]]=0;
    if(hiku[A[i]]<0) hiku[A[i]]=0;
    s.insert(A[i]);
    sum+=ans[A[i]];
  }
  for(ll i=0;i<N;i++){
    cout<<sum-ans[A[i]]+hiku[A[i]]<<endl;
  }
}


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

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector <int> v(n);
    int ans = 0;
    for (auto &x : v){
        cin >> x;
        if (x >= k){
            ++ans;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int x,a;
    scanf("%d %d",&x,&a);
    if(x<a)
    {
        printf("0");
    }
    else if(x==a)
    {
        printf("10");
    }
    else if(x>a)
    {
        printf("10");
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){
  int n;
  scanf("%d", &n);
  int a[n+1];
  int x, y, z;
  int i;
  for(i=1; i<n+1; i++){
    a[i]=0;
  }
  
  for(x=1; x<110; x++){
    for(y=1; y<110; y++){
      for(z=1; z<110; z++){
        i=0;
        i=x*x+y*y+z*z+x*y+y*z+z*x;
        if(i > n){
          continue;
        }else{
          a[i]+=1;
        }
      }
    }
  }
  
  for(i=1; i<n+1; i++){
    printf("%d\n", a[i]);
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

vector<ll> fact, ifact;

void init_table(int n) {
  fact.assign(n + 1, 1), ifact.assign(n + 1, 1);
  for (int i = 2; i < n + 1; ++i) fact[i] = i * fact[i - 1] % MOD;
  ifact[n] = modinv(fact[n], MOD);
  for (int i = n; i > 2; --i) ifact[i - 1] = i * ifact[i] % MOD;
}

ll comb(int n, int r) {
  return fact[n] * (ifact[r] * ifact[n - r] % MOD) % MOD;
}

int main() {
  int n, k;
  cin >> n >> k;
  init_table(n);
  
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());

  ll ma = 0;
  for (int i = k - 1; i < n; ++i) {
    ll c = comb(i, k - 1);
    ll tmp = c * a[i];
    tmp %= MOD;

    ma += tmp;
    ma %= MOD;
  }

  reverse(a.begin(), a.end());
  ll mi = 0;
  for (int i = k - 1; i < n; ++i) {
    ll c = comb(i, k - 1);
    ll tmp = c * a[i];
    tmp %= MOD;

    mi += tmp;
    mi %= MOD;
  }
  ll ans = ma - mi;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;



int main() {

    string S;
    cin >> S;
    vector<pair<char, int>> arr;
    vector<int> n;
    char prev = 'R';
    int rnum = 0, lnum = 0;


    REP(i, S.length()){
        if(S[i] == 'R'){
            rnum++; 
            if(prev == 'L'){
                arr.push_back({'L', lnum});
                lnum = 0;
            }
            prev = 'R';
        }
        if(S[i] == 'L'){
            lnum++;
            if(prev == 'R'){
                arr.push_back({'R', rnum});
                rnum = 0;
            }
            prev = 'L';
        }
    }

    arr.push_back({'L', lnum});

    // REP(i, arr.size()){
    //     cout << arr[i].first << " " << arr[i].second << endl; 
    // }

    for(int i = 0; i < arr.size(); i+= 2){
        int tmpr = 0;
        int tmpl = 0;
        if(arr[i].second % 2 == 0){ // R
            tmpr += arr[i].second / 2;
            tmpl += arr[i].second / 2;
        } else{
            tmpr += (arr[i].second+1) / 2;
            tmpl += (arr[i].second-1) / 2;       
        }
        if(arr[i+1].second % 2 == 0){ // L
            tmpr += arr[i+1].second / 2;
            tmpl += arr[i+1].second / 2;
        } else{ 
            tmpr += (arr[i+1].second-1) / 2;
            tmpl += (arr[i+1].second+1) / 2;
        }
        REP(j, arr[i].second-1){
            cout << 0 << " ";
        }
        cout << tmpr << " ";
        cout << tmpl << " ";
        REP(j, arr[i+1].second-1){
            cout << 0 << " ";
        }
    }




    //確定
    





}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin >> n;
  int flg = 0;
  for(int i = 1; i <= 9; i++){
	for(int j = 1; j <= 9; j++) if(n == i * j) flg = 1;
  }
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
int main()
{
    ll n,q,h,s,d;
    cin>>q>>h>>s>>d>>n;
    ll two=1e18;
    two=min(two,d);
    two=min(two,2*s);
    two=min(two,4*h);
    two=min(two,8*q);
    ll ans=0;
    ans+=(n/2)*two;
    if(n%2!=0)
    {
        ll one=1e9;
        one=min(one,s);
        one=min(one,2*h);
        one=min(one,4*q);
        //cout<<one;
        ans+=one;
    }
    cout<<ans;
    return 0;
}


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

int main() {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> l(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> l[i];
  }

  std::sort(l.begin(), l.end(), std::greater<int>());
  int sum = 0;
  for (int i = 0; i < K; ++i) {
    sum += l[i];
  }
  std::cout << sum << std::endl;

  return 0;
}


Measured memory_bytes: 256
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,n) for(int i=(1);i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 200005;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Test.insert(x)late ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    int n,m;
    cin>>n>>m;
    char s[55][55];
    int cnt[55][55]={0};
    rep(i,n)rep(j,m){
        cin>>s[i][j];
    }
    rep(i,n)rep(j,m){
        if(s[i][j]=='#'){
            if(s[i+1][j]=='.')cnt[i+1][j]++;
            if(s[i][j+1]=='.')cnt[i][j+1]++;
            if(s[i-1][j]=='.')cnt[i-1][j]++;
            if(s[i][j-1]=='.')cnt[i][j-1]++;
            if(s[i+1][j+1]=='.')cnt[i+1][j+1]++;
            if(s[i-1][j-1]=='.')cnt[i-1][j-1]++;
            if(s[i+1][j-1]=='.')cnt[i+1][j-1]++;
            if(s[i-1][j+1]=='.')cnt[i-1][j+1]++;
        }
    }
    rep(i,n){rep(j,m){
        if(s[i][j]=='#')cout<<'#';
        else cout<<cnt[i][j];
    }cout<<enl;}

    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
int main(){
    ll n,mi=1e15;
    cin>>n;
    rep(i,0,5){
        ll a;
        cin>>a;
        mi=min(mi,a);
    }
    ll tim;
    tim=n/mi;
    if(n%mi)tim++;
    cout<<tim+4<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        int a,b;
 
        while(true){
            a = sc.nextInt();
            b = sc.nextInt();
 
            if(a == 0 && b == 0)break;
 
            System.out.printf("%d %d\n", Math.min(a, b),Math.max(a, b));
        }
 
    }
}


Measured memory_bytes: 39984
using System;

class M_Solu_B{
  static void Main(){
    string N = Console.ReadLine();
    int X = 0;
    for (int i = 0; i < N.Length; i++){
      if (N.Substring(i, 1) == "x") X++;
    }
    if (X >= 8) Console.WriteLine("NO");
    else Console.WriteLine("YES");
  }
}

Measured memory_bytes: 13140
import heapq
n, m = map(int, input().split())
a_lst = list(map(int, input().split()))
bc_lst = [list(map(int, input().split())) for _ in range(m)]

bc_lst = sorted(bc_lst, key = lambda x: -x[1])
aa_lst = a_lst[:]

heapq.heapify(aa_lst)
for bc in bc_lst:
    for i in range(bc[0]):
        if aa_lst[0] < bc[1]:
            heapq.heapreplace(aa_lst, bc[1])
        else:
            break
        
print(sum(aa_lst))

Measured memory_bytes: 99352
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
using namespace std;

int main()
{
	vector<int> NumberRow;
	while(true){
		string in;
		cin >> in;
		if(cin.good() == false){
			break;
		}
		if(in != "+" && in != "-" && in != "*"){
			int Num;
			stringstream ss;
			ss << in;
			ss >> Num;
			NumberRow.push_back(Num);
		}
		int M = NumberRow.size() - 2;
		if(in == "+"){
			int c = NumberRow[M] + NumberRow[M+1];
			NumberRow[M] = c;
			NumberRow.pop_back();
		}else if(in == "-"){
			int c = NumberRow[M] - NumberRow[M+1];
			NumberRow[M] = c;
			NumberRow.pop_back();
		}else if(in == "*"){
			int c = NumberRow[M] * NumberRow[M+1];
			NumberRow[M] = c;
			NumberRow.pop_back();
		}
	}
	cout << NumberRow[0] << endl;
	return 0;
}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
using namespace std;
long long a,b;
char ch;
int main()
{
    cin>>a>>ch>>b;
    if(ch=='-')cout<<a-b;
    if(ch=='+')cout<<a+b;
    if(ch=='*')cout<<a*b;
    if(ch=='/')cout<<a/b;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll A, B; cin >> A >> B;
  int K; cin >> K;
  rep(i,K){
    if(i%2==0){
      if(A%2==1) A--;
      B += A/2; A /= 2;
    }
    else{
      if(B%2==1) B--;
      A += B/2; B /= 2;
    }
  }
  cout << A << " " << B << endl;
  return 0;
}


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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }

// 4近傍（右, 下, 左, 上）
const std::vector<int> dy = { 0, -1, 0, 1 };
const std::vector<int> dx = { 1, 0, -1, 0 };

using namespace std;

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

    while (true) {
        int n, s;
        cin >> n >> s;
        if (n == 0 and s == 0) { break; }

        // dp[i][j] = i個からjを作る組み合わせの数
        vector<vector<LL>> dp(n + 2, vector<LL>(s + 1, 0));
        dp[0][0] = 1;

        FOR(v, 0, 101) {
            for(int i = n; i >= 0; --i) {
                FOR(j, 0, s + 1) {
                    if (dp[i][j] == 0) { continue; }

                    if (j + v < dp[0].size()) {
                        dp[i + 1][j + v] += dp[i][j];
                    }
                }
            }
        }

        cout << (dp[n][s] == -1 ? 0 : dp[n][s]) << endl;
    }

    return 0;
}


Measured memory_bytes: 3204
# coding:utf-8

import sys
import math
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, a, b = LI()
V = LI()
V.sort()
V.reverse()

cnt = defaultdict(int)
sum_v = 0
for i in range(a):
    sum_v += V[i]
    cnt[V[i]] += 1

# 大きい順にa個選ぶ場合，価値の平均値は最大となる
print(sum_v / a)

# a個選んだ中で一番価値の低いものがいくつ残っているか数える
min_v = V[i]
min_cnt = cnt[min_v]
for i in range(a, n):
    v = V[i]
    if v != min_v:
        break
    cnt[v] += 1

if cnt[min_v] == min_cnt:
    print(1)
    exit()
elif len(cnt.keys()) != 1:
    print(comb(cnt[min_v], min_cnt))
    exit()
ans = 0
for i in range(b - a + 1):
    if cnt[min_v] < min_cnt + i:
        break
    ans += comb(cnt[min_v], min_cnt + i)

print(ans)


Measured memory_bytes: 3316
n=int(input())
li=list(map(int,input().split()))
newli=sorted(li)
gu=[]
ki=[]
for i in range(n):
  if i%2==0:
    gu.append(newli[-(i+1)])
  else:
    ki.append(newli[-(i+1)])
print(sum(gu)-sum(ki))


Measured memory_bytes: 9076
import java.util.*;

public class Main {                  
    
    public static void main(String[] args){           
        
        Scanner sc = new Scanner(System.in);
                                                
        int N = sc.nextInt();
        
        int num_divisor[] = new int[1001];
        
        for(int i = 2;i <= N;i++){
            int divisor = 2;
            int i2 = i;
            while(i2 != 1){                
                while(i2%divisor == 0){
                   i2 /= divisor;
                   num_divisor[divisor]++;
                }                         
                divisor++;
            }                                    
        }
        
        long ans = 1;
                                
        for(int i = 2;i <= N;i++){
            if(num_divisor[i] != 0){
                ans = ( ans* (num_divisor[i] + 1) )%1000000007;
            }
        }
        
        System.out.println(ans);
        
    }    
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG


bool ch(vector<string> &s, string &ans, int A, int B, int C, int i) {
  if(i == s.size()) {
    if(A >= 0 && B >= 0 && C >= 0) return true;
    else return false;
  }
  if(!(A >= 0 && B >= 0 && C >= 0)) return false;
  if(s[i] == "AB") {
    if(ch(s, ans, A+1, B-1, C, i+1)) ans[i] = 'A';
    else if(ch(s, ans, A-1, B+1, C, i+1)) ans[i] = 'B';
    else return false;
    return true;
  }
  if(s[i] == "AC") {
    if(ch(s, ans, A+1, B, C-1, i+1)) ans[i] = 'A';
    else if(ch(s, ans, A-1, B, C+1, i+1)) ans[i] = 'C';
    else return false;
    return true;
  }
  if(s[i] == "BC") {
    if(ch(s, ans, A, B+1, C-1, i+1)) ans[i] = 'B';
    else if(ch(s, ans, A, B-1, C+1, i+1)) ans[i] = 'C';
    else return false;
    return true;
  }
}

signed main() {
  int N, A, B, C; cin >> N >> A >> B >> C;
  vector<string> s(N);
  rep(i, N) cin >> s[i];
  string ans;
  rep(i, N) ans += "A";
  
  if(ch(s, ans, A, B, C, 0)) {
    cout << "Yes" << endl;
    rep(i, N) cout << ans[i] << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 16016
import std.algorithm, std.conv, std.range, std.stdio, std.string;

const mod = 10 ^^ 9 + 7;
alias mint = FactorRing!mod;

void main()
{
  auto n = readln.chomp.to!int;
  auto b = new int[](n+1), i = 0, j = 0;
  b[] = -1;

  auto a = readln.splitter;
  foreach (p; 0..n+1) {
    auto ai = a.front.to!int; a.popFront();
    if (b[ai] >= 0) {
      i = b[ai];
      j = p;
      break;
    }
    b[ai] = p;
  }

  auto fact = new mint[](n+2);
  fact[0] = 1;
  foreach (p; 1..n+2) fact[p] = fact[p-1] * p;

  auto invFact = new mint[](n+2);
  invFact[n+1] = fact[n+1].inv;
  foreach_reverse (p; 1..n+2) invFact[p-1] = invFact[p] * p;

  auto combi(int n, int r)
  {
    if (n < 0 || r < 0 || n < r) return mint(0);
    else return fact[n] * invFact[r] * invFact[n-r];
  }

  foreach (k; 1..n+2) {
    auto ans = combi(n+1, k);
    auto w = n+1-j+i;
    ans -= combi(w, k) - combi(w-1, k);
    writeln(ans);
  }
}

struct FactorRing(int m, bool pos = false)
{
  version(BigEndian) {
    union { long vl; struct { int vi2; int vi; } }
  } else {
    union { long vl; int vi; }
  }

  @property int toInt() { return vi; }
  alias toInt this;

  this(int v) { vi = v; }
  this(int v, bool runMod) { vi = runMod ? mod(v) : v; }
  this(long v) { vi = mod(v); }

  ref FactorRing!(m, pos) opAssign(int v) { vi = v; return this; }

  pure auto mod(int v) const
  {
    static if (pos) return v % m;
    else return (v % m + m) % m;
  }

  pure auto mod(long v) const
  {
    static if (pos) return cast(int)(v % m);
    else return cast(int)((v % m + m) % m);
  }

  static if (m < int.max / 2) {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vi + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vi - rhs)); }
  } else {
    pure auto opBinary(string op: "+")(int rhs) const { return FactorRing!(m, pos)(mod(vl + rhs)); }
    pure auto opBinary(string op: "-")(int rhs) const { return FactorRing!(m, pos)(mod(vl - rhs)); }
  }
  pure auto opBinary(string op: "*")(int rhs) const { return FactorRing!(m, pos)(mod(vl * rhs)); }

  pure auto opBinary(string op)(FactorRing!(m, pos) rhs) const
    if (op == "+" || op == "-" || op == "*") { return opBinary!op(rhs.vi); }

  static if (m < int.max / 2) {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vi + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vi - rhs); }
  } else {
    auto opOpAssign(string op: "+")(int rhs) { vi = mod(vl + rhs); }
    auto opOpAssign(string op: "-")(int rhs) { vi = mod(vl - rhs); }
  }
  auto opOpAssign(string op: "*")(int rhs) { vi = mod(vl * rhs); }

  auto opOpAssign(string op)(FactorRing!(m, pos) rhs)
    if (op == "+" || op == "-" || op == "*") { return opOpAssign!op(rhs.vi); }

  pure auto inv() const
  {
    int x = vi, a, b;
    exEuclid(x, m, a, b);
    return FactorRing!(m, pos)(mod(a));
  }
}

pure T exEuclid(T)(T a, T b, ref T x, ref T y)
{
  auto g = a;
  x = 1;
  y = 0;
  if (b != 0) {
    g = exEuclid(b, a % b, y, x);
    y -= a / b * x;
  }
  return g;
}


Measured memory_bytes: 5180
s=input()
a=[]
for i in range(len(s)):
    if s[i]=="0":
        a.append(str(0))
    elif s[i]=="1":
        a.append(str(1))
    elif s[i]=="B":
        if len(a)>0:
            a.pop(-1)
print("".join(a))

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

int prod(int d){
	if(d <= 9)
		return 0;
	if((d % 10) < 2 or (d / 10) < 2)
		return 0;
	return (d % 10) * (d / 10);
}

int main(){
	int m, d;
	cin >> m >> d;
	int ans = 0;
	for(int i = 1; i <= m; i++){
		for(int j = 1; j <= d; j++){
			if(prod(j) == i){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

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

using namespace std;
const int inf=1<<20;

int num[210];
char op[210];
bool lb[210],rb[210];

int memo[210][210][2];

int rec(int l,int r){
	if(r-l==1) return memo[l][r][0]=memo[l][r][1]=num[l];

	if(lb[r-1]) return -inf;
	if(rb[l]) return -inf;
	
	int &cmin=memo[l][r][0];
	int &cmax=memo[l][r][1];
	if(cmax!=-inf) return cmax;

	rep(m,l+1,r){
		int a=rec(l,m),b=rec(m,r);
		if(a==-inf||b==-inf) continue;
		if(op[m]=='+'){
			chmax(cmax,memo[l][m][1]+memo[m][r][1]);
			chmin(cmin,memo[l][m][0]+memo[m][r][0]);
		}else{
			chmax(cmax,memo[l][m][1]-memo[m][r][0]);
			chmin(cmin,memo[l][m][0]-memo[m][r][1]);
		}
	}

	return cmax;
}


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

	int tidx=0,oidx=1;
	for(auto &c:s){
		if(c=='(') lb[tidx]=true;
		if(c==')') rb[tidx-1]=true;
		if(isdigit(c)) num[tidx++]=c-'0';
		if(c=='+'||c=='-') op[oidx++]=c;
	}

	// rep(i,5) cout << num[i] << " " << lb[i] << " " << rb[i] << endl;
	// rep(i,1,5) cout << op[i] << endl;

	rep(i,210)rep(j,210) memo[i][j][0]=inf,memo[i][j][1]=-inf;
	cout << rec(0,tidx) << endl;

	return 0;
}

Measured memory_bytes: 3536
#include <stdio.h>
#define INF 2000000000
#define MIN(a,b) ((a)<(b)?(a):(b))
 int p[2]={1,-1};
 int main(void)
 {
 	int x,y;
 	int res=INF;
 	scanf("%d %d",&x,&y);
 	for(int i=0;i<2;i++){
 	    for(int j=0;j<2;j++){
     		int t=x*p[i],s=y*p[j];
     		if(s>=t) res=MIN(res,s-t+i+j);
     	}
 	}
 	printf("%d\n",res);
 	return 0;
 }


Measured memory_bytes: 128
import Data.List
import qualified Data.ByteString.Char8 as B
import Debug.Trace

main :: IO ()
main = breads >>= print . solve

solve :: [Int] -> Int
solve [x, y] = check x 0
    where
        check n acc
            | n > y = acc
            | otherwise = check (n * 2) (acc + 1)

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)

Measured memory_bytes: 380
def main():
    a = int(input())
    b,c = map(int,input().split())

    n = a
    i = 1
    while n <= c:
        n = a* i
        if n>=b and n <= c:
            print('OK')
            return
        i+=1
    print('NG')
if __name__=='__main__':
    main()


Measured memory_bytes: 9168
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, s1, s2;
vector<int>E[201000], G[201000];
struct Edge {
	int a, b;
}Ed[201000];
int par[201000], Dep[201000], v[201000];
void DFS1(int a, int pp) {
	par[a] = pp;
	int i;
	for (i = 0; i < E[a].size(); i++) {
		if (E[a][i] != pp) {
			Dep[E[a][i]] = Dep[a] + 1;
			DFS1(E[a][i], a);
		}
	}
}
void DFS2(int a, int pp, int d) {
	int i;
	v[a] = 1;
	for (i = 0; i < G[a].size(); i++) {
		if (G[a][i] != pp && d + 1 < Dep[G[a][i]])DFS2(G[a][i], a, d + 1);
	}
}
int main() {
	int i, a, b;
	scanf("%d%d%d", &n, &s1, &s2);
	for (i = 1; i < n; i++) {
		scanf("%d%d", &a, &b);
		G[a].push_back(b);
		G[b].push_back(a);
		Ed[i] = { a,b };
	}
	for (i = 1; i < n; i++) {
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	DFS1(s2, 0);
	DFS2(s1, 0, 0);
	int res = 0;
	for (i = 1; i <= n; i++) {
		if (v[i])res = max(res, Dep[i] * 2);
	}
	for (i = 1; i < n; i++) {
		a = Ed[i].a, b = Ed[i].b;
		if (Dep[a] < Dep[b])swap(a, b);
		if (par[a] == b || par[par[a]] == b || par[a] == par[b])continue;
		if (v[a] || v[b]) {
			printf("-1\n");
			return 0;
		}
	}
	printf("%d\n", res);
}

Measured memory_bytes: 37500
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  int n,m;
  cin >> n >> m;
  if(n == m)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
h = [int(i) for i in input().split()]
a_b = []
for i in range(m):
    a_b.append(input().split())

a_b.sort()
a = [0] * (1+n)
check = 0
for i in range(m):
    if i == 0:
        if h[int(a_b[i][0])-1] > h[int(a_b[i][1])-1]:
            a[int(a_b[i][1])] = -1
        elif h[int(a_b[i][0])-1] < h[int(a_b[i][1])-1]:
            a[int(a_b[i][0])] = -1
        elif h[int(a_b[i][0])-1] == h[int(a_b[i][1])-1]:
            a[int(a_b[i][0])] = -1
            a[int(a_b[i][1])] = -1
    elif a_b[i-1][0] == a_b[i][0]:
        if a[int(a_b[i][0])] == -1:
            if h[int(a_b[i][0])-1] >= h[int(a_b[i][1])-1]:
                a[int(a_b[i][1])] = -1
            
        else:
            if h[int(a_b[i][0])-1] > h[int(a_b[i][1])-1]:
                a[int(a_b[i][1])] = -1
            elif h[int(a_b[i][0])-1] < h[int(a_b[i][1])-1]:
                a[int(a_b[i][0])] = -1
            elif h[int(a_b[i][0])-1] == h[int(a_b[i][1])-1]:
                a[int(a_b[i][0])] = -1
                a[int(a_b[i][1])] = -1
    else:
        if h[int(a_b[i][0])-1] > h[int(a_b[i][1])-1]:
            a[int(a_b[i][1])] = -1
        elif h[int(a_b[i][0])-1] < h[int(a_b[i][1])-1]:
            a[int(a_b[i][0])] = -1
        elif h[int(a_b[i][0])-1] == h[int(a_b[i][1])-1]:
            a[int(a_b[i][0])] = -1
            a[int(a_b[i][1])] = -1
            

ans = a.count(0)
print(ans-1)

Measured memory_bytes: 43196
n = int(input())
hs = tuple(map(int, input().split()))

a, b = 0, abs(hs[1] - hs[0])

for i in range(2, n):
  d1 = a + abs(hs[i] - hs[i-2])
  d2 = b + abs(hs[i] - hs[i-1])
  a, b = b, min(d1, d2)

print(b)

Measured memory_bytes: 14056