akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define N 100001
#define NIL -1

typedef struct {
  int parent, left, right;
}Node;

Node Tree[N]; 
void print(int);
int Depth[N];



int main(VOID){
  int i, j, n, cc, child[N], node;
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = NIL;
    Tree[i].left = NIL;
    Tree[i].right = NIL;
  }
  
  

  for(i=0; i < n; i++ ){
    scanf("%d %d", &node, &cc);
    for(j=0; j < cc; j++){
      scanf("%d", &child[j]);
      
      Tree[child[j]].parent = node;
      if(j == 0) Tree[node].left = child[0];
      else Tree[child[j-1]].right = child[j]; 
    }
  }
  
  for(i=0; i<n;i++) Depth[i] = getDepth(i);
  for ( i = 0; i < n; i++ ) print(i);
  
  return 0;
}





int getDepth(int in){
  int d=0;
  
  while(Tree[in].parent >= 0){
    in = Tree[in].parent;  
    d++;
  }
  
  return d;
}


void print(int node){
  int i, count=0;
  
  printf("node %d: parent = %d, depth = %d, ",node ,Tree[node].parent, Depth[node]);
  
  if(Tree[node].parent == NIL)
    printf("root, [");
  
  else if(Tree[node].left == NIL)
    printf("leaf, [");
  
  else
    printf("internal node, [");
  
  node = Tree[node].left;
  while(node != NIL){
    if(count==0) printf("%d", node);
    else printf(", %d", node);
    
    node = Tree[node].right;
    count++;
    
  }
  
  
  printf("]\n");
  
}

Measured memory_bytes: 2560
// AtCoder Beginner Contest 126 - Problem C: Dice and Coin (https://atcoder.jp/contests/abc126/tasks/abc126_c)
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

vector<ii> _2s;

long double solve(int N, int K)
{
    long double one = 1.0;
    long double ans = 0.0;

    for (int i = 1; i <= min(N, K - 1); ++i)
    {
        int m = (K + (i - 1)) / i;
        auto it = lower_bound(_2s.begin(), _2s.end(), ii(m, 0));
        auto q = it->second;


        ans += ((one/N)*(powl(one/2.0, q)));
    }

    if (N >= K)
    {
        ans += (N - K + 1)*(one / N);
    }
     
    return ans;
}

int main()
{
    for (int i = 0; i < 64; ++i)
        _2s.push_back(ii(1LL << i, i));

    int N, K;
    cin >> N >> K;

    cout.precision(15);
    cout << fixed << solve(N, K) << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
ll solve(ll a, ll b) {
	ll c = a % b;
	if (c == 0) return 2 * a - b;
	return 2 * (a - c) + solve(b, c);
}
int main() {
	ll n, x;
	scanf("%lld%lld", &n, &x);
	if (x <= n / 2) printf("%lld\n", n + solve(n - x, x));
	else printf("%lld\n", n + solve(x, n - x));
}


Measured memory_bytes: 256
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n, q = read_ints()
    tree = [[] for _ in range(n)]
    c = [0] * n
    for _ in range(n-1):
        a, b = read_ints()
        tree[~-a].append(~-b)
        tree[~-b].append(~-a)
    for _ in range(q):
        p, x = read_ints()
        c[~-p] += x
    que = deque([0])
    seen = [False] * n
    while que:
        p = que.pop()
        seen[p] = True
        for x in tree[p]:
            if seen[x]: continue
            que.append(x)
            c[x] += c[p]
    
    print(*c)

if __name__ == '__main__':
    Main()

Measured memory_bytes: 56616
#include <iostream>

using namespace std;

#define ll long long

int main() {

    ll int a, ans = 0;
    long double b;
    cin >> a >> b;

    if(b != 0){
        ans = a * b + 0.001;
    }
    
 //   cout << a << ", " << b << ", " << ans <<  endl;
    cout << ans <<  endl;
    


    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD =998244353
 ;

int main(){
  ll N,S;
  cin >> N >> S;
  vector<ll> A(N);
  rep(i,N) cin >> A.at(i);
  vector<vector<ll>> dp(N,vector<ll>(S+1,0));
  dp.at(0).at(0)=2;
  if(A.at(0)<=S){
    dp.at(0).at(A.at(0))=1;
  }
  for(ll i=1;i<N;i++){
    for(ll j=0;j<=S;j++){
      dp.at(i).at(j)+=dp.at(i-1).at(j)*2;
      dp.at(i).at(j)%=MOD;
      if(j+A.at(i)<=S){
        dp.at(i).at(j+A.at(i))+=dp.at(i-1).at(j);
        dp.at(i).at(j+A.at(i))%=MOD;
      }
    }
  }
  cout <<dp.at(N-1).at(S) << endl;
        
  
  
}


Measured memory_bytes: 73708
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
string s, t;

void solve(){
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	cout << (s < t ? "Yes" : "No") << endl;
}

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


Measured memory_bytes: 256
def main():
    n, m = map(int,(input().split()))
    if m==1 and n == 1:
        print(1)
    elif n <= 2 and m <= 2:
        print(0)
    elif n>2 and m>2:
        print((n-2)*(m-2))
    elif n>2:
        if m == 2:
            print(0)
        else:
            print(n-2)
    elif m>2:
        if n == 2:
            print(0)
        else:
            print(m-2)
    

    

        


if __name__ == "__main__":
    main()

Measured memory_bytes: 9152
#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++)
#define fi first
#define se second
long long mo = 1e9 + 7;
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;

ll dp[101][4][2];

int main(){
    string S;
    ll K;
    cin >> S;
    cin >> K;
    ll N = S.size();
    //vector<vector<ll>> dp(N+1, vector<ll>(2));
    dp[0][0][0] = 1;
    rep(i,N){
        ll c = S[i] - '0';
        rep(j,10){
            rep(k,4){
                if(j == 0){
                    dp[i+1][k][1] += dp[i][k][1];
                }else{
                    if(k == 3){
                        continue;
                        //dp[i+1][k][1] += dp[i][k][1];
                    }else{
                        dp[i+1][k+1][1] += dp[i][k][1];
                    }
                }
            }
        }
        rep(j,c){
            rep(k,4){
                if(j == 0){
                    dp[i+1][k][1] += dp[i][k][0];
                }else{
                    if(k == 3){
                        continue;
                        //dp[i+1][k][1] += dp[i][k][0];
                    }else{
                        dp[i+1][k+1][1] += dp[i][k][0];
                    }
                }
            }
        }
        rep(k,3){
            if(c == 0){
                dp[i+1][k][0] += dp[i][k][0];
            }else{
                dp[i+1][k+1][0] += dp[i][k][0];
            }
        }
    }
    cout << dp[N][K][0] + dp[N][K][1] << endl;
}

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

using namespace std;

typedef long long llint;

llint a, b, c;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << 0;
    } else {
        cout << min(a * b, min(a * c, b * c));
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<math.h>

using namespace std;

using ll = long long;

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

const ll INF = 1LL << 60;

typedef pair<ll, double> P;

bool pairCompare(const P & firstElof, const P & secondElof)
{
	return firstElof.second < secondElof.second;
}

bool b[1000000009] = { false };
signed main() {
	bool check = false;
	ll n;
	cin >> n;
	rep(i, n) {
		ll a;
		cin >> a;
		if (b[a] == false)b[a] = true;
		else check = true;
	}
	if (check == false)cout << "YES";
	else cout << "NO";
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	string S;
	int cnt[255]={};

	cin >> S;

	bool ans = true;
	for(auto c: S) if( cnt[c]++ > 0 ) ans = false;

	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
ll mod = 1000000007;
vector<vector<int>> graph;
ll N, K;
ll dfs(int pos,int parent){
    ll canUseColor = (parent == -1) ? K - 1 : K - 2;

    if((ll)graph[pos].size() > K){
        return 0;
    }else{
        ll res = 1;
        for(int u:graph[pos]){
            if(u == parent)
                continue;
            res *= canUseColor;
            res %= mod;
            canUseColor--;
        }

        for(int u:graph[pos]){
            if(u == parent)
                continue;
            res *= dfs(u, pos);
            res %= mod;
        }
        return res;
    }
}

int main(){

    cin >> N >> K;
    graph.resize(N);
    for (int i = 0; i < N - 1;i++){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    ll ans = K * dfs(0, -1);
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10368
N,X = map(int, input().split())

layer_size = [1]
P_cnt = [1]

for _ in range(50):
    layer_size.append(layer_size[-1]*2+3)
    P_cnt.append(P_cnt[-1]*2+1)
    
def solve(level,x):
    if x == 1:
        return 0 if level > 0 else 1
    l = layer_size[level-1]
    p = P_cnt[level-1]
    if x <= 1+l:
        return solve(level-1,x-1)
    elif x == l+2:
        return p+1
    elif x <= 2*l+2:
        return p+1+solve(level-1,x-l-2)
    else:
        return 2*p+1

ans = solve(N,X)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e18;
const double PI=3.1415926535897932;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

ll kake(ll x){
    return x*(x+1)/2;
}

ll aru(ll N){
    ll BIG=N+1, SMALL=0;
    while(BIG>SMALL+1){
        ll MID=(BIG+SMALL)/2;
        ll X=kake(MID);
        if(X==N) return MID;
        else if(X>N) BIG=MID;
        else SMALL=MID;
    }
    return -2;
}

ll d[2000][2000];

int main(){
    ll N; cin>>N;
    ll X=aru(N);
    if(X<0) cout<<"No"<<endl;
    else{
        cout<<"Yes"<<endl;
        cout<<X+1<<endl;
        ll C=1;
        REP(i,2,X+2) REP(j,1,i){
            d[i][j]=C;
            C++;
        }
        
        C=1;
        REP(j,1,X+1) REP(i,1,j+1){
            d[i][j]=C;
            C++;
        }
        REP(i,1,X+2){
            cout<<X<<' ';
            REP(j,1,X+1) {
                cout<<d[i][j];
                if(j!=X) cout<<' ';
            }
            cout<<endl;
        }
    }
    


}

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

int N, C, K, A[100005];

int main() {
	scanf("%d%d%d", &N, &C, &K);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	sort (A, A + N);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		//printf("%d\n", i);
		int pos = upper_bound(A, A + N, A[i] + K) - A;
		int act_pos = min(pos, i + C);
		ans++;
		i = act_pos - 1;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 764
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = input().rstrip()
    tree = SegmentTree(initial_values=S, f=lambda x,y:x|y, converter=lambda c: 1 << (ord(c)-ord('a')))
    Q = int(input())
    update = tree.update
    query = tree.query
    for _ in range(Q):
        t, a, b = input().rstrip().split()
        if t == '1': update(int(a)-1, b)
        else: print(bin(query(int(a)-1, int(b))).count('1'))

class SegmentTree:
    def __init__(self, n=None, f=max, zero_factory=int, converter=lambda x:x, initial_values=None):
        assert(n or initial_values)
        size = n if n else len(initial_values)
        self.__f, self.__z, self.__c = f, zero_factory, converter
        self.__n = 1 << ((size - 1).bit_length())
        self.__dat = [zero_factory() for _ in range(2 * self.__n)]
        if initial_values:
            zi = self.__get_leaf(0)
            for i, v in enumerate(initial_values): self.__dat[zi + i] = converter(v)
            for i in range(zi-1, -1, -1): self.__dat[i] = f(*self.__get_children(i))

    def update(self, index, value):
        i, v = self.__get_leaf(index), self.__c(value)
        if self.__dat[i] == v: return
        self.__dat[i] = v
        while i:
            i = self.__get_parent(i)
            v = self.__f(*self.__get_children(i))
            if self.__dat[i] == v: break
            self.__dat[i] = v

    def query(self, from_inclusive, to_exclusive):
        ans = self.__z()
        if to_exclusive <= from_inclusive: return ans
        l, r = self.__get_leaf(from_inclusive), self.__get_leaf(to_exclusive) - 1
        while r - l > 1:
            if self.__is_right(l): ans = self.__f(ans, self.__dat[l])
            if self.__is_left(r): ans, r = self.__f(ans, self.__dat[r]), r-1
            l, r = l//2, self.__get_parent(r)
        ans = self.__f(ans, self.__dat[l])
        if l != r: ans = self.__f(ans, self.__dat[r])
        return ans

    def __get_leaf(self, i): return self.__n + i - 1
    def __get_parent(self, i): return (i-1)//2
    def __get_children(self, i): return (self.__dat[2*i+1], self.__dat[2*i+2])
    def __is_left(self, i): return i&1 == 1
    def __is_right(self, i): return i&1 == 0

if __name__ == '__main__':
    main()


Measured memory_bytes: 116300
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0){
      cout<<"DENIED"<<endl;
    return 0;
  }
  }
  cout<<"APPROVED"<<endl;
  return 0;
}
  

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int main(){

int n,ct=0;
cin>>n;
vector<ll> vec(n);
for(int i=0;i<n;i++){
    cin>>vec[i];
  
}

for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        for(int k=0;k<n;k++){
    ll big=max(vec[i],max(vec[j],vec[k]));
       if(vec[i]!=vec[j] && vec[i]!=vec[k] && vec[j]!=vec[k] && (big<vec[i]+vec[j]+vec[k]-big)){
        ct++;
       
       }

        }
    }
}
int ans=ct/6;
cout<<ans<<endl;


}

Measured memory_bytes: 3624
#include <iostream>

int main() {
    int N, L;
    std::cin >> N >> L;

    int sum = N * L + N * (N - 1) / 2;
    if (L > 0) {
        std::cout << sum - L << std::endl;
    } else if (L + N >= 1) {
        std::cout << sum << std::endl;
    } else {
        std::cout << sum - (L + N - 1) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n, s) for (int i = s; i < n; i++)
#define INF 10000000000
using namespace std;

typedef long long int LL;
typedef long double LD;
typedef pair<LD, int> P;

struct BR {double x, y, r;};

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

	int N;
	double x1, y1, x2, y2, x, y, r;
	cin >> x1 >> y1 >> x2 >> y2 >> N;
	BR b[1002];
	b[0] = {x1, y1, 0.0};
	REP(i, N, 0) {
		cin >> x >> y >> r;
		b[i+1] = {x, y, r};
	}
	b[N+1] = {x2, y2, 0.0};
	vector<pair<int, LD>> G[1002];
	REP(i, N+2, 0) {
		REP(j, N+2, i + 1) {
			LD dis = sqrt((b[i].x - b[j].x) * (b[i].x - b[j].x) + (b[i].y - b[j].y) * (b[i].y - b[j].y)) - b[i].r - b[j].r;
			if (dis < 0) dis = 0.0;
			G[i].push_back(make_pair(j, dis));
			G[j].push_back(make_pair(i, dis));
		}
	}
	LD dp[1002];
	fill(dp, dp+N+2, INF);
	dp[0] = 0.0;
	priority_queue<P, vector<P>, greater<P> > que;
	que.emplace(0, 0);
	while (que.size()) {
		LD d = que.top().first;
		int c = que.top().second;
		que.pop();
		if (d > dp[c]) continue;
		for (pair<int, LD> p : G[c]) {
			if (dp[p.first] > dp[c] + p.second) {
				dp[p.first] = dp[c] + p.second;
				que.emplace(dp[p.first], p.first);
			}
		}
	}
	cout << fixed << setprecision(12) << dp[N+1] << endl;

	return 0;
}

Measured memory_bytes: 41104
# abc167_c.py
N, M, X = map(int,input().split())
C = []
A = []
for i in range(N):
    c,*a = map(int,input().split())
    C.append(c)
    A.append(a)

def calc_price(C,s):
    ans = 0
    for i,v in enumerate(s):
        if v==1:
            ans+=C[i]
    return ans


import itertools
status = [(0, 1) for _ in range(N)]
state = list(itertools.product(*status))
#print(state)
ans = 10**9+7
flg = -1
for s in state:
    price = 0
    gakuryoku = [0]*M
    for j,v in enumerate(s):
        if v == 1:
            price+=C[j]
            for k in range(M):
                gakuryoku[k] += A[j][k]
        if min(gakuryoku)>=X and ans > price:
            ans = price
            flg=0
if flg==-1:
    print(-1)
else:
    print(ans)



Measured memory_bytes: 9736
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> cnt(100001);
    Rep(i, N) {
        int a, b;
        cin >> a >> b;
        cnt[a] += b;
    }
    ll count = 0;
    Rep(i, 100001) {
        count += cnt[i];
        if (count >= K) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4036
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  vector<int> v(5);
  for(int i=0; i<5; i++) cin >>v[i];
  
  vector<int> num(5); for(int i=0; i<5; i++) num[i]=i;
  int ans=-1;
  do{
    int time=0;
    int next=0;
    for(int i=0; i<5; i++){
      time=next+v[num[i]];
      next=ceil((double)time/10)*10;
    }
    if(ans==-1) ans=time;
    else ans=min(ans, time);
  }while(next_permutation(num.begin(), num.end()));
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> que;
    rep(i, 0, N){
        int A;
        cin >> A;
        que.push(A);
    }
    rep(i, 0, M){
        int A = que.top();
        que.pop();
        que.push(A/2);
    }
    ll ans = 0;
    rep(i, 0, N){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 892
import math

a, b = map(int, input().split())
amin = math.ceil(a * 100 / 8)
amax = math.ceil((a+1) * 100 / 8) - 1
bmin = math.ceil(b * 100 / 10)
bmax = math.ceil((b+1) * 100 / 10) -1

if amin > bmax or bmin > amax:
    print('-1')
else:
    print(max(amin, bmin))


Measured memory_bytes: 3060
/*
   TASK: nocows
   LANG: C++14
 */

#include "bits/stdc++.h"
typedef long long ll;
typedef long double ld;

using namespace std;
#define finish(x) return cout << x, 0;

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

const string USCAO_TAG = "nocows";
void usaco() { setIn(USCAO_TAG + ".in"); setOut(USCAO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	((std::cout << args << " "), ...);
}
*/
ll dp[101][100001];

ll a[100001];
ll b[100001];

int main() {
	//usaco();
	#ifndef ONLINE_JUDGE
	//setIn("in.txt");
	#endif

	int n, w;
	cin >> n >> w;

	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	ll mx = b[0];
	for(int i = 0; i <= w; i++){
		if(a[0] <= i){
			dp[0][i] = b[0];
		}
	}

	for(int i = 1; i < n; i++){
		for(int j = 0; j <= w; j++){
			dp[i][j] = dp[i - 1][j];
			if(j - a[i] >= 0)
				dp[i][j] = max(dp[i][j], dp[i - 1][j - a[i]] + b[i]);
			mx = max(mx, dp[i][j]);
		}
	}

	cout << mx;
}


Measured memory_bytes: 78592
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)

const ll INF = 10010001010;
const int inf = 2000000000;

typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; 

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int N;
    cin >> N;
    vector<int> H(N);
    int ans = 0;
    int dp[N];
    for (int i = 0; i < N; i++)
    {
        cin >> H[i];
    }
    dp[0] = 0;
    dp[1] = abs(H[1] - H[0]);
    for (int i = 2; i < N;i++)
    {
        if(dp[i-1] + abs(H[i] - H[i-1]) < dp[i-2] +  abs(H[i] - H[i-2])){
            dp[i] = dp[i - 1] + abs(H[i] - H[i - 1]);
        }
        else{
            dp[i] = dp[i - 2] + abs(H[i] - H[i - 2]);
        }
    }
    cout << dp[N - 1] << endl;
    
}


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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <string> s(n);
    vector <int> t(n);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        int sz = (int) s[i].size();
        for (int j = 0; j + 1 < sz; j++) {
            if (s[i][j] == 'A' && s[i][j + 1] == 'B') {
                cnt++;
            }
        }
        if (s[i].back() == 'A') {
            t[i] = 1;
        }
        if (s[i][0] == 'B') {
            t[i] = 2;
        }
        if (s[i].back() == 'A' && t[i] == 2) {
            t[i] = 3;
        }
    }
    int cnt_1 = 0;
    int cnt_2 = 0;
    int cnt_3 = 0;
    for (int i = 0; i < n; i++) {
        cnt_1 += (t[i] == 1);
        cnt_2 += (t[i] == 2);
        cnt_3 += (t[i] == 3);
    }
    int ans = cnt;
    if (cnt_3) {
        ans += cnt_3 - 1;
        if (cnt_1) {
            ans++;
            cnt_1--;
        }
        if (cnt_2) {
            ans++;
            cnt_2--;
        }
        ans += min(cnt_1, cnt_2);
    } else {
        ans += min(cnt_1, cnt_2);
    }
    cout << ans << '\n';
    return 0;
}


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

int main()
{
	

    string A, B;
    cin >> A >> B;
    int N = A.size(), M = B.size();
    int cache[N+1][M+1];
    for(int i = 0; i <= N; i++)
    {
    	for(int j = 0; j <= M; j++)
    	{
    		if(i == 0 || j == 0)
    		{
    			cache[i][j] = 0;
    		}
    		else
    		{
    			if(A[i-1] == B[j-1])
    			{
    				cache[i][j] = cache[i-1][j-1] + 1;
    			}
    			else
    			{
    				cache[i][j] = max(cache[i][j-1], cache[i-1][j]);
    			}
    		}
    	}
    }
    int i = N, j = M;
    string ans = "";
    while(i > 0 and j > 0)
    {
    	//cout<<"( " <<i<<" ,"<<j<<") ";
    	if(A[i - 1] == B[j - 1])
    	{
    		ans += A[i - 1];
    		//cout<<ans<<" ";
    		i--;
    		j--;

    	}
    	else if(cache[i-1][j] > cache[i][j-1])
    	{
    		i--;
    	}
    	else
    	{
    		j--;
    	}

    }
    reverse(ans.begin(), ans.end());
    cout << ans;
}

Measured memory_bytes: 35456
/*
    NO 
        TIME 
            TO 
                DIE
                    --007
                            */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <complex>
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// define x, y as real(), imag()


template<class T>
istream& operator>> (istream& is, complex<T>& p) {
  T value;
  is >> value;
  p.real(value);
  is >> value;
  p.imag(value);
  return is;
}
#define M_PI 3.14159265358979323846
typedef long long int lli;
lli mod=1e9+9ll;
#define OS //single input use oeis
lli INF=9223372036854775807;
lli eps=1e-8;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,z,k,x,m,d,y,q,b,s,t;
const double pi=3.14159265358979323846;
lli me(lli a,lli b)
{
    // cout<<mod<<"\n";
    lli res=1;
    while(b)
    {
        if(b&1)
        res=(res%mod*a%mod)%mod;
        a=a*a;
        a%=mod;
        b=b>>1;
    }
    return res;
}
lli mI(lli a)
{
    return (me(a,mod-2)%mod+mod)%mod;
}
lli a[15][15];
lli c[15];
lli anss=1e15;
lli tot=0;
lli aa[15];
void slv(lli i)
{
	if(i>n+1)
	return;
	// cout<<tot<<" "<<x<<"\n";
	
	if(i==0)
	slv(i+1);
	else
	{
		lli flag=0;
		for(int j=1;j<=m;j++)
		{
			if(aa[j]<x)
			flag=1;
		}
		if(flag)
		{
		slv(i+1);
		tot+=c[i];
		for(int j=1;j<=m;j++)
		aa[j]+=a[i][j];
		slv(i+1);
		tot-=c[i];
		for(int j=1;j<=m;j++)
		aa[j]-=a[i][j];
		}
		else
		{
			// cout<<tot<<"\n";
			anss=min(anss,tot);
			return;
		}
	}
}
int main()
{
cin>>n>>m>>x;
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=m+1;j++)
	{
		if(j==1)
		cin>>c[i];
		else
		cin>>a[i][j-1];
	}
}

slv(0);
if(anss==1e15)
cout<<-1;
else
cout<<anss;
}

Measured memory_bytes: 3592
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  ll a,b,k;cin>>a>>b>>k;
  // for(ll i=0;i<k;++i) {
  //   if(a>0) a-=1;
  //   else if(b>0) b-=1;
  //   // p(a,b);
  //   p(i);
  // }
  if(a>k) {
    p(a-k,b);
  } else if(a+b>k) {
    p(0,a+b-k);
  } else {
    p(0,0);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int X; cin>>X;
    int b=sqrt(X);
    int ans=0;
    for(int i=X;i>0;i--){
        for(int j=b;j>1;j--){
            for(int k=2;k<=10;k++){
                ans=pow(j,k);
                if(ans==i){
                    cout<<i;
                    return 0;
                }
            }
        }
    }
    cout<<1;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[]x = new int[n];
		int[]y = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = scan.nextInt();
		}
		for(int i = 0; i < n; i++) {
			y[i] = scan.nextInt();
		}
		scan.close();
		long d1 = 0;
		long d2 = 0;
		long d3 = 0;
		long d4 = 0;
		for(int i = 0; i < n; i++) {
			long k = Math.abs(x[i] - y[i]);
			d1 += k;
			d2 += k * k;
			d3 += k * k * k;
			d4 = Math.max(d4, k);
		}
		double k2 = Math.sqrt(d2);
		double k3 = Math.pow(d3, (double)1/3);
		System.out.println(d1);
		System.out.println(k2);
		System.out.println(k3);
		System.out.println(d4);
	}
}


Measured memory_bytes: 26384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++)
#define all(v) v.begin(), v.end()
#define pr(x) cout << x << endl


int main()
{
    int a, b;
    cin >> a >> b;
    pr(a *b);;
    return 0;
}



Measured memory_bytes: 3624
#include<iostream>
using namespace  std;
int main()
{
	int k,a,b,c,d;
	cin>>k>>a>>b;
	c=a%k;
	a=a/k;
	d=b%k;
	b=b/k;
	if(a<b)
	cout<<"OK";
	else if(a==b)
	{
		if(c==d&&c==0)
		cout<<"OK";
		else if(c==0)
		cout<<"OK";
		else cout<<"NG";
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n, maxi = 1;
  cin >> n;
  for (int i = 1; i < n; i++){
    for (int j = 2; j < n; j++){
      if(n >= (int)pow(i,j)){
        maxi = max(maxi, (int)pow(i, j));
        continue;
      }else{
        break;
      }
    }
  }
  cout << maxi << "\n";
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
double doINF = 1.0/0.0 ;
ostream_iterator <int> outp(cout," ");
inline ll modadd(ll n,ll m,ll mod){
    ll sum = ((n+m)%mod+mod)%mod;
    return sum;
} 
inline ll modsub(ll n,ll m, ll mod){
    ll diff = ((n-m+mod)%mod+mod)%mod;
    return diff;
}
inline ll modpro(ll n,ll m,ll mod){
    ll pro = ((n*m)%mod+mod)%mod;
    return pro;
}
inline ll pow(int x,int y){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}
inline ll powmod(ll x,ll y,ll mod){
    ll res = 1;
    while (y > 0) {
        if (y & 1)
            res = modpro(res , x,mod);
        y = y >> 1;
        x = modpro(x , x,mod);
    }
    return res;
}
//ll min(ll a, ll b){
//    if(a>b){
//        return b;
//    }
//    return a;
//}
// 
//ll max(ll a, ll b){
//    if(a>b){
//        return a;
//    }
//    return b;
//}
bool pairdec(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 		if(a.fi!=b.fi)
       	return (a.fi> b.fi);
		else return a.se>b.se;  
} 

ll power(ll x, ll y, ll mod) 
{ 
    ll res = 1; 
    x = x%mod; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % mod; 
  
        y = y >> 1;
        x = (x * x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll a, ll mod) 
{ 
    return  powmod(a, mod - 2, mod); 
} 
ll modFact(ll n, ll mod) 
{ 
    if (n >=mod) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) %mod; 
  
    return result; 
} 
//cout<<setprecision(9)<<fixed<<sum<<endl; --- precision for double numbers
//copy(v.beg,v.en,outp);

int main()
{
	string a,b,c;
	cin>>a>>b;
	int x,y;
	cin>>x>>y;
	cin>>c;
	if(c==a)
	{
		cout<<x-1<<" "<<y<<endl;	
	}else if(c==b)
	{
		cout<<x<<" "<<y-1<<endl;
	}else
	{
		cout<<x<<" "<<y<<endl;
	}
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n=parseInt(readline())
    array=Tuple{String,Int,Int}[("",0,i) for i in 1:n]
    for i in 1:n
        s,p=split(readline())
        array[i]=(s,parseInt(p),i)
    end
    sort!(array,by=x->x[2],rev=true)
    sort!(array,by=x->x[1])
    for i in 1:n
        println(array[i][3])
    end
end
main()

Measured memory_bytes: 172028
#include <cstdio>

int n;
long long int t[100];
long long int g, l;

long long int gcd(long long int m, long long int n){
	if(m % n == 0) return n;
	return gcd(n, m % n);
}

int main(){
	scanf("%d", &n);
	for(int i=0; i<n; ++i) scanf("%lld", &t[i]);
	l = 1;
	for(int i=0; i<n; ++i){
		g = gcd(t[i], l);
		l *= t[i] / g;
	}
	printf("%lld\n", l);
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

ll f[1000005],inv[1000005],m=1e9+7;

ll p(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2)
		r=(r*a)%m;
		a=(a*a)%m;
		b/=2;
	}
	return r;
}

ll ncr(ll n,ll r)
{
	if(r<0||r>n)return 0;
	ll kk=(f[n]*inv[r])%m;
	kk=(kk*(inv[n-r]))%m;
	return kk;
}

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
if(n==2)
{
	ol("1");
	return 0;
}
f[0]=1;
rep(i,1,1000004)f[i]=(f[i-1]*i)%m;
inv[1000004]=p(f[1000004],m-2);

ren(i,1000003,0)
inv[i]=(inv[i+1]*(i+1))%m;

ll ans=0,lst=0;

rep(i,2,n-1)
{
	ll kk=(ncr(i-1,n-1-i))%m;
	kk=(kk*f[i])%m;
	kk=(kk*f[n-1-i])%m;
	ans=(ans+(kk-lst)*i)%m;
	lst=kk;
}
ol((ans+m)%m);

return 0;
}



Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

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

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;

typedef long long ll;
const int N = 100005;

string str;
ll dp[N][13], pot[N];

ll back(int pos, int md){
	if(pos == str.size()) {
		return (md == 5);
	}
	ll &ans = dp[pos][md];
	if(ans != -1) return ans;
	if(str[pos] != '?') return ans = back(pos+1, (md + ((str[pos] - '0') * pot[pos]))%13)%mod;
	ans = 0;
	for (int i=0; i<10; i++){
		ans = (ans + back(pos+1, (md+(i*pot[pos]))%13))%mod;
	}
	return ans;
}

int main(){
	memset(dp, -1, sizeof dp);
	pot[0] = 1LL;
	for (int i=1; i<N; i++){
		pot[i] = (pot[i-1] * 10LL)%13;
	}
	cin >> str;
	reverse(str.begin(), str.end());
	cout << back(0, 0) << endl;
}


Measured memory_bytes: 19200
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define rn return
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int main(){
    int N,M,X,Y; cin >> N >> M >> X >> Y;
    vector<int> x(N);
    vector<int> y(M);
    rep(i,N) cin >> x[i];
    rep(i,M) cin >> y[i];
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    
    if (min(y[0],Y)<=max(x[N-1],X)){
        cout << "War" << endl;
        rn 0;
    }
    else{
        cout << "No War" << endl;
        rn 0;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 1e6+7;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int a, b;
int main()
{
    cin >> a>> b;
    cout << 2*b-a;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
long long a,b;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	cout<<a/__gcd(a,b)*b<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

es = [[] for _ in range(N)]
for i,row in enumerate(S):
    for j,c in enumerate(row):
        if c=='1':
            es[i].append(j)
            es[j].append(i)

#n個の頂点の色を初期化。0:未着色、1:黒、-1:白
colors = [0 for i in range(N)]

#頂点vをcolor(1 or -1)で塗り、再帰的に矛盾がないか調べる。矛盾があればFalse
def dfs(v,color):
    #今いる点を着色
    colors[v] = color
    #今の頂点から行けるところをチェック
    for to in es[v]:
        #同じ色が隣接してしまったらFalse
        if colors[to] == color:
            return False
        #未着色の頂点があったら反転した色を指定し、再帰的に調べる
        if colors[to] == 0 and not dfs(to, -color):
            return False
    #調べ終わったら矛盾がないのでTrue
    return True

#2部グラフならTrue, そうでなければFalse
def is_bipartite():
    return dfs(0,1) # 頂点0を黒(1)で塗ってDFS開始

if not is_bipartite():
    print(-1)
    exit()

dist = [[N]*N for _ in range(N)]
for i,row in enumerate(S):
    for j,c in enumerate(row):
        if i==j:
            dist[i][j] = 0
        elif c=='1':
            dist[i][j] = 1
for k in range(N):
    for i in range(N):
        for j in range(N):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

print(max(max(row) for row in dist) + 1)

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

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

    int n;
    cin >> n;
    n = n % 10;
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
    {
        cout << "hon" << endl;
    }
    else if (n == 0 || n == 1 || n == 6 || n == 8)
    {
        cout << "pon" << endl;
    }
    else
    {
        cout << "bon" << endl;
    }

    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(void) {
int A, B, C, D;
scanf("%d\n%d\n%d\n%d\n", &A, &B, &C, &D);
if(A<B){
if(C<D){
printf("%d\n", A+C);
}else{
printf("%d\n", A+D);
}}else{
if(C<D){
printf("%d", B+C);
}else{
printf("%d", B+D);
}}
	return 0;
}


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

ll mod = 1e9+7;

ll gcd(ll a,ll b){
	if(b==0)return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){ans = ans*base;}
        base *= base;pow/=2;}return ans;
}
ll inv(ll x){return expo(x,mod-2);}

int vis[123456], col[123456];
int arr[26], prev1[26];

int main(){
    //freopen("ip.txt", "rt", stdin);
    //freopen("op.txt", "wt", stdout);
    int n, m;
    cin >> n >> m;
    vector <string> vec(n);
    int n2 = 0, n1 = 0;
    if(n%2){
            n2 += m/2;
    }
    if(m%2){
            n2 += n/2;
    }
    if(n%2 && m%2) n1++;
    for(int i = 0; i < n; i++) cin >> vec[i];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++) arr[vec[i][j]-'a']++;
    }
    for(int i = 0; i < 26; i++){
        if(arr[i]%4 == 0) continue;
        if(arr[i]%2 == 0){
           if(n2) n2--;
           else{
              cout << "No";
              return 0;
           }
        }
        else{
            if(n1) n1--;
            else{
              cout << "No";
              return 0;
            }
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 256
fn main() {
    proconio::input! {
        s: String,
        t: String,
    }
    let s: Vec<char> = s.chars().collect();
    let t: Vec<char> = t.chars().collect();
    let mut r = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            r += 1;
        }
    }

    println!("{}", r);
}


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

int main() {
  long long  h;
  cin >> h;
  
  long long ans = 1;
  long long bai = 1;
  
  while(h>1){
    h /= 2;
    bai *= 2;
    ans += bai;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
'use strict';
process.stdin.on('data', function(chunk) {
  // ????????????????????????
  var inputs = chunk.toString().trim();
  var data = inputs.split(' ').map(Number);
  var a = data[0];
  var b = data[1];
  var c = data[2];
  var count = 0;
  
  for (var i = a; i < b + 1; i++) {
    if (c % i === 0) {
      count++;
    }
  }
  console.log(count);


});
process.stdin.resume();
process.stdin.setEncoding('utf8');

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

int main(int argc, char **argv)
{
    int i, j;
    for(i=1; i<=9; i++)
    {
        for(j=1; j<=9; j++)
        {
            printf("%dx%d=%d\n", i, j, i*j);
        }
    }
    return 0;
}

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

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));
#ifdef LOCAL
#define debug(x) std::cerr << #x << ": " << x << endl
#else
#define debug(x) 860111
#endif
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

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

//mt19937 mrand(random_device{}());
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e3+7;
int n;
//ll a[maxn];
int h, w;
char a[maxn][maxn];
int dp[maxn][maxn];

//check T
void solve()
{
	//cin >> n; rep(i, 0, n) cin >> a[i];
	cin >> h >> w;
	rep(i, 1, h+1) cin >> (a[i]+1);
	//dp[1][1] = a[1][1] == '#';
	rep(i, 1, h+1)rep(j, 1, w+1)
	{
		dp[i][j] = INT_MAX;
		if(i-1 > 0) dp[i][j] = min(dp[i][j], dp[i-1][j] + (a[i-1][j] == '.'&& a[i][j] == '#'));
		if(j-1 > 0) dp[i][j] = min(dp[i][j], dp[i][j-1] + (a[i][j-1] == '.'&& a[i][j] == '#'));
		if(i==1 && j==1) dp[1][1] = a[1][1] == '#';
	}
	cout << dp[h][w] << endl;
  return;
}


signed main()
{
  fastIO();
  T = 1;
  //cin >> T; //this
  while(T--) solve();
  return 0;
}


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

using namespace std;

int main()
{
  int N, M; cin >> N >> M;
  vector<vector<pair<int, int>>> PM(N, vector<pair<int, int>>());
  for (int i = 0; i < M; ++i) {
    int p, y; cin >> p >> y;
    PM[p-1].push_back(make_pair(y, i));
  }

  for (int i = 0; i < PM.size(); ++i) {
    sort(PM[i].begin(), PM[i].end());
  }

  vector<string> ans(M);
  for (int i = 0; i < PM.size(); ++i) {
    for (int j = 0; j < PM[i].size(); ++j) {
      stringstream ssp, ssy;
      ssp << setw(6) << setfill('0') << i+1;
      ssy << setw(6) << setfill('0') << j+1;
      ans[PM[i][j].second] = ssp.str() + ssy.str();
      // cout << "Debug: " << ans[PM[i][j].second] << endl;
    }
  }

  for (int i = 0; i < M; ++i) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 12416