akhauriyash/Code-Regression huggingface dataset:
#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; }

void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// C++ 17に完全移行したら消す
// 最大公約数を求める
template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

// 最小公倍数を求める
template <class T> T lcm(T n, T m) {
  int g = gcd(n, m);
  return n * m / g;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "tmp.cpp"

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

  int n, k;
  cin >> n >> k;
  vl xs(n), ys(n);
  REP(i, n) { cin >> xs[i] >> ys[i]; }

  ll ans = numeric_limits<ll>::max();
  for (const auto xi : xs) {
    for (const auto xj : xs) {
      for (const auto yi : ys) {
        for (const auto yj : ys) {
          ll x_max = max(xi, xj), x_min = min(xi, xj), y_max = max(yi, yj), y_min = min(yi, yj);

          int cnt = 0;
          REP(i, n) {
            ll xk = xs[i], yk = ys[i];
            if (x_min <= xk && xk <= x_max && y_min <= yk && yk <= y_max)
              cnt++;
          }
          if (cnt >= k) {
            chmin(ans, (x_max - x_min) * (y_max - y_min));
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <math.h>
#include <set>
using namespace std;

int N,K;
int a[105];

int main()
{
    int sum = 0;
    cin>>N>>K;
    for(int i =1;i<=N;i++)
    {
        int temp;
        cin>>temp;
       // cout<<temp<<"  * "<<endl;
        if(temp<K-temp) sum +=temp*2;
        else sum += (K-temp)*2;
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
t = gets.split.map(&:to_i)
m = gets.to_i
sum = t.inject(&:+)

p = []
x = []
m.times do
  pt,xt = gets.split.map(&:to_i)
  p << pt
  x << xt
end

m.times do |i|
  puts sum - t[p[i]-1] + x[i]
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll,ll>
#define pint pair<int,int>
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 100005
#define endl '\n'
#define mp make_pair
#define INF INT_MAX
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)            //counts no of ones in binary representation
#define w(t)     int t; cin>>t; while(t--)
#define pi 3.141592653589793238
#define sortt(v)  sort(v.begin(),v.end())
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;

int main(){
	fast;
	ll l,r,d;
	cin>>l>>r>>d;
	ll ans=0;
	ll x=l/d,y=r/d;
	ans=y-x;
	if(l%d==0)	ans++;
	cout<<ans;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long sum=0,i,n;
   string s;
   cin>>s;
   for(i=0;i<s.length();i++)
   {
       sum=sum+((int)s[i]-(int)'0');
   }
   if(sum%9==0)
   {
       cout<<"Yes"<<endl;
   }
   else
    cout<<"No"<<endl;
}


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

int main(){

	double a,b,c,d,e,f;

	double x,y;

	while(cin>>a){
		cin>>b;
		cin>>c;
		cin>>d;
		cin>>e;
		cin>>f;

		x = (e * c + (-b)*f)/(a*e-b*d);
		y = (-d * c + a * f)/(a*e-b*d);

		if(fabs(x)<1e-3 && fabs(y)<1e-3){
			printf("%.3f %.3f\n",fabs(x),fabs(y));
		}
		else if(fabs(x)<1e-3){
			printf("%.3f %.3f\n",fabs(x),y);
		}
		else if(fabs(y)<1e-3){
			printf("%.3f %.3f\n",x,fabs(y));
		}
		else{
			printf("%.3f %.3f\n",x,y);
		}

	}

	return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;

int main() {
	
	int n, p;
	cin >> n >> p;
	int t = 0; int x;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (x >= p)t++;
	}
	cout << t << endl;
	return 0;
	



}

Measured memory_bytes: 256
import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
cnt = 1
p = 0
q = 0
for n in itertools.permutations(range(1, N+1)):
    if P == list(n):
        p = cnt
    if Q == list(n):
        q = cnt
    cnt += 1
total = abs(p-q)
print(total)

Measured memory_bytes: 3064
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

long ans(long h) {
  if (h == 1) return 1;
  else return 2*ans(h/2) + 1;
}

int main() {
  long h;
  scanf("%ld", &h);
  printf("%ld\n", ans(h));
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double n = (double)N;
        System.out.println(N % 2 == 0 ? (n / 2.0) / n : (double)(N / 2 + 1) / n);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll INF = Mod * 100;
  ll N;
  cin >> N;
  ll F[N][10];
  ll P[N][11];
  ll ans = -INF;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> P[i][j];
    }
  }

  for (int bit = 1; bit < (1 << 10); bit++) {
    ll res = 0;
    for (int i = 0; i < N; i++) {
      int cnt = 0;
      for (int j = 0; j < 10; j++) {
        if (bit & (1 << j)) {
          if (F[i][j] == 1) {
            cnt++;
          }
        }
      }
      res += P[i][cnt];
    }
    ans = max(ans,res);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>

int main(){
  int N,T,A,lowest,biggestGap=0,count,i;

  scanf("%d %d",&N,&T);
  scanf("%d",&lowest);
  for(i=1;i<N;++i){
    scanf("%d",&A);
    if(A>lowest){
      if(A-lowest>biggestGap){
        biggestGap=A-lowest;
        count=1;
      }
      else if(A-lowest==biggestGap) ++count;
    }
    else lowest=A;
  }

  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ld long double
#define int long long
#define fi first
#define se second
using namespace std;
const int N = 2e5 + 12;
const int inf = 2e9;


map<string, int> m;

void run() {
    int i, j, k, n;
    string s;
    cin >> n;
    m["RE"] = 0;
    m["AC"] = 0;
    m["WA"] = 0;
    m["TLE"] = 0;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        ++m[s];
    }
    cout << "AC" << " x " << m["AC"] << endl;
    cout << "WA" << " x " << m["WA"] << endl;
    cout << "TLE" << " x " << m["TLE"] << endl;
    cout << "RE" << " x " << m["RE"] << endl;

}

signed main() {
    #ifdef local
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int test;
    run();
}


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

using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<vector<ll> > a(n, vector<ll>(n, 0));
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> a[i][j];

    vector<vector<ll> > dist = a;
    vector<vector<int> > g(n, vector<int>(n, 1));
    for(int k = 0; k < n; k++) {
        for(int i = 0; i < n; i++) {
            g[i][i] = 0;
            for(int j = 0; j < n; j++) {
                if(a[i][j] > a[i][k] + a[k][j]) {
                    cout << "-1" << endl;
                    return 0;
                }
                if(i == k || k == j) continue;
                if(a[i][j] == a[i][k] + a[k][j]) {
                    g[i][j] = 0;
                    g[j][i] = 0;
                }
            }
        }
    }

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

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2048
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
  a += [int(input())]

dp = [0 for _ in range(n+1)]
broken_id = 0

dp[0] = 1
if broken_id < m and a[broken_id] == 1:
  broken_id += 1
  dp[1] = 0
else:
  dp[1] = 1

for i in range(2, n+1):
  if broken_id < m and a[broken_id] == i:
    dp[i] = 0
    broken_id += 1
  else:
    dp[i] = dp[i-1] + dp[i-2]
    
print(dp[n] % 1000000007)

Measured memory_bytes: 460056
#include<bits/stdc++.h>
#define V vector
#define L long
#define W V<L>
using namespace std;L E=70,M=2e17,i,a,b;W S(V<W>p){if(!E)return{1,0};V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1)T[x[1]&1].push_back({x[0]/2,++x[1]/2});}for(L i;i<2;i++){a=0;for(W x:T[!i])a^=(2*x[0]+x[1])%3+1;if(!a){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p)v[0]++;W A=S(p);A[0]--;return A;}int main(){cin>>i;V<W>p(i);while(i--,cin>>a>>b)p[i]={a+M,b+M};W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
#include<stdio.h>

int main(void)
{
  int n,i,max=0,sum=0;
  char str[101];
  scanf("%d %s",&n,str);
  for(i=0;i<n;i++)
    {
      if(str[i] == 'I')
	{
	  sum++;
	}
      else if(str[i] == 'D')
	{
	  sum--;
	}
      if(sum > max)
	{
	  max = sum;
	}
    }

  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 128
a, b, k =map(int, input().split())
if a>=k:
    aa = a-k
    ans=' '.join([str(aa), str(b)])
    print(ans)
else:
    if b>=k-a:
        bb = b-(k-a)
        ans = ' '.join([str(0), str(bb)])
        print(ans)
    else:
        ans = ' '.join([str(0), str(0)])
        print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <list>
#include <stack>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#define m7 1000000007
#define m9 1000000009
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second

using namespace std;
int dp[101][100001];
int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> V(n);
	for (int i = 0; i < n; i++) {
		cin >> V[i];
	}
	for (int i = 0; i < 101; i++) {
		for (int j = 0; j < 100001; j++) {
			dp[i][j] = 0;
		}
	}
	for (int i = 0; i <= V[0]; i++) {
		dp[0][i] = 1;
	}
	
	for (int i = 1; i < n; i++) {
		vector<int> T(k + 1, 0);
		for (int j = 0; j <= k; j++) {
			T[j] = (T[j] + dp[i - 1][j]) % m7;
			if (j + V[i] + 1 <= k)
			{
				T[j + V[i] + 1] = (T[j + V[i] + 1]  + m7 - dp[i - 1][j]) % m7;
			}
		}
		dp[i][0] = T[0];
		for (int j = 1; j <= k; j++) {
			dp[i][j] = ( dp[i][j-1] + T[j])%m7 ;
		}
	}
	cout << dp[n - 1][k];
	return 0;
}

Measured memory_bytes: 40064
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int k = sc.nextInt();

    String s = sc.next();

    if (s.length() <= k) {
      System.out.println(s);
    } else {
      System.out.println(s.substring(0,k)+"...");
    }

  }

}


Measured memory_bytes: 38664
from collections import defaultdict
n,*L=map(int,open(0).read().split())
mod=10**9+7
d=defaultdict(lambda:[0,0])
gcd=lambda x,y:x if y==0 else gcd(y,x%y)
two=[1]*(n+1)
for i in range(n):
	two[i+1]=(two[i]*2)%mod
zero=0
for a,b in zip(*[iter(L)]*2):
	if a==b==0:
		zero+=1
		continue
	if a==0:
		d[(0,1)][0]+=1
	elif b==0:
		d[(0,1)][1]+=1
	else:
		g=gcd(a,b)
		a//=g
		b//=g
		if a*b>0:
			d[(a,b)][0]+=1
		else:
			d[(abs(b),abs(a))][1]+=1
ans=1
for (_,_),(x,y) in d.items():
	ans*=(two[x]+two[y]-1)%mod
	ans%=mod
print((ans+zero+mod-1)%mod)


Measured memory_bytes: 95084
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = [[int(x) for x in input().split()] for _ in range(D)]
    t = [int(input()) for _ in range(D)]

    score = 0
    cnt = [-1] * 26

    for i in range(D):
        score += S[i][t[i] - 1]
        minusscore = 0
        cnt[t[i] - 1] = i
        for j in range(26):
            minusscore += (i - cnt[j]) * C[j]
        score -= minusscore
        print(score)




if __name__ == '__main__':
    main()



Measured memory_bytes: 9424
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 1) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    cout << (a + b) / 2 << endl;
}


Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class AtCoderC
{
    private static int l;
    private static int r;

    static void Main()
    {
        {
            string line = Console.ReadLine();
            var words = line.Split(' ');
            l = int.Parse(words[0]);
            r = int.Parse(words[1]);
        }

        int min = int.MaxValue;

        int startModL = l % 2019;
        for (int i = l; i <= r; i++)
        {
            int modL = i % 2019;
            if (i != l && modL == startModL)
            {
                break;
            }

            int startModR = (i + 1) % 2019;
            for (int j = i + 1; j <= r; j++)
            {
                int modR = j % 2019;
                if (j != i + 1 && modR == startModR)
                {
                    break;
                }
                int mod = modL * modR % 2019;
                min = Math.Min(min, mod);
            }
        }

        Console.WriteLine(min);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::string s;
    std::cin >> s;
    int n = s.size();

    std::vector<std::vector<int>> g(n, std::vector<int>(26));
    std::vector<int> nxt(26, -1);
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++) {
            g[i][j] = nxt[j];
        }
        nxt[s[i] - 'a'] = i;
    }

    // (len, to)
    std::vector<std::pair<int, int>> t(n, std::make_pair(1000000, -1));
    t[n - 1] = std::make_pair(2, 0);
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++) {
            if (g[i][j] < 0) {
                t[i] = std::min(t[i], std::make_pair(2, j));
            } else {
                t[i] = std::min(t[i], std::make_pair(t[g[i][j]].first + 1, j));
            }
        }
    }

    std::string ret = "";
    for (int i = 0; i < 26; i++) {
        if (nxt[i] < 0) {
            if (ret.size() != 1) ret = 'a' + i;
        } else {
            std::string tmp = "";
            int v = nxt[i];
            do {
                tmp += s[v];
                if (t[v].first > 2) {
                    v = g[v][t[v].second];
                } else {
                    tmp += ('a' + t[v].second);
                    break;
                }
            } while (true);
            if (ret.size() == 0) ret = tmp;
            else if (tmp.size() < ret.size() || (tmp.size() == ret.size() && tmp < ret)) ret = tmp;
        }
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 28548
// CODE © by 𝕌𝕥𝕜𝕒𝕣𝕤𝕙 𝔾𝕒𝕣𝕘
// Copying or sharing of this code without permission of the Author is strictly prohibited!!!
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Speed ios::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define endl "\n"
int power(int x, int n, int mod) {int res = 1; x %= mod; while (n) {if (n & 1)res = (res * x) % mod; x = (x * x) % mod; n >>= 1;} return res;}
long long dp[101][100001];
int knap(int w[], int v[], int n, int tw) {
	if (n == 0 || tw == 0)return 0;
	if (dp[n][tw] != -1)return dp[n][tw];
	if (w[n - 1] > tw)return dp[n][tw] = knap(w, v, n - 1, tw);
	return dp[n][tw] = max(knap(w, v, n - 1, tw - w[n - 1]) + v[n - 1], knap(w, v, n - 1, tw));
}
signed main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
#endif
	memset(dp, -1, sizeof(dp));
	int n, tw;
	cin >> n >> tw;
	int w[n], v[n];
	for (int i = 0; i < n; i++)cin >> w[i] >> v[i];
	cout << knap(w, v, n, tw);
}

Measured memory_bytes: 82544
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,ans=0;
    cin>>n>>x>>y;
    while(n--)
    {
        int X,Y;
        cin>>X>>Y;
        if(X>=x&&Y>=y)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
 
using namespace std;
 
int main() {
	long long n;
	long long a, b, ans, rem=0;
	cin >> n >> a >> b;
	ans = n / (a + b) * a;
	rem = n % (a + b);
	ans += min(rem, a);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  string c;
  cin >> c;
  if (c[0] == 'a' || c[0] == 'i' || c[0] == 'u' || c[0] == 'e' || c[0] == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;

ll mod = 1e9 + 7;

int main()
{
    fastIO;
    ll s;
    cin >> s;
    if (s < 3) {
        cout << "0\n";
        return 0;
    }
    vector<ll> dp(s+1);
    dp[0] = 1;
    for (int i=0; i<s; i++) {
        if (!dp[i]) continue;
        for (ll j=3; j<=s-i; j++) {
            dp[i+j] += dp[i];
            dp[i+j] %= mod;
        }
    }
    cout << dp[s] << '\n';
}

Measured memory_bytes: 3656
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw			"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int n;
	cin>>n;
	vi a(n);
	for0(i,n) cin>>a[i];
	a[0]--;
	for1(i,n-1){
		if(a[i]<a[i-1]){
			pf("No");
			return 0;
			}
		else if(a[i]>a[i-1]) a[i]--;
		}
	cout<<"Yes";
	
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <cmath>
#include <string>
#include <iomanip>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 2000006;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        int r,g;
        cin>>r>>g;
        cout<<(2*g-r)<<endl;


    }
    return 0;
}



Measured memory_bytes: 892
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int n;in n;int l;in l;
vi pos;
vi neg;
vi z;
int sum=0;
for(int i=1;i<=n;i++){
  int a=l+i-1;
  sum+=a;
  if(a<0)
    neg.pb(a);
  else if(a>0)
    pos.pb(a);
  else
  z.pb(a);
}
if(z.size()>0)
    cout<<sum<<endl;
else if(neg.size()>0){
  sort(neg.begin(),neg.end());
  cout<<sum-neg[neg.size()-1];
}
else
    {
      sort(pos.begin(),pos.end());
      cout<<sum-pos[0];
    }
    return 0;
}


Measured memory_bytes: 256
/*
.   Bismillahir Rahmanir Rahim
.   Author - Marajul islam
.   created- Sun May 31 18:06:05 2020

*/ 
#include<bits/stdc++.h>
using namespace std;


 
int sc1() {int x; scanf("%d", &x); return x;}
long long sc2() {long long x; scanf("%lld", &x); return x;}

const int mod= 1e9 + 7;
inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (long long)a * b % mod;}
 
#define F               first
#define S               second 
#define mp              make_pair
#define pb              push_back
#define pf              push_front
#define speed_up        ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x)           (int)x.size()
#define all(x)          x.begin(), x.end()
#define debug           cerr << "OK\n";
#define ub              upper_bound
#define lb              lower_bound
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define Int             sc1()
#define LL              sc2()
#define For(n)          for(int i=0;i<n;i++)
#define Forj(n)         for(int j=0;j<n;j++)
#define Fork(n)         for(int k=0;k<n;k++)
#define For1(n)         for(int i=1;i<=n;i++)

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef set <int>       si;
typedef set <ll>        sll;
typedef multiset <int>  msi;
typedef multiset <ll>   msll;
typedef map <int, int>  mi;
typedef map <ll, ll>    mll;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}
  
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 5e6 + 5;
 
 
 
int solve() {
 
	long double a,b;
	cin>>a>>b;
	long double c=a*b;
	cout<<(long long)c<<endl;
 
	return 0;
}
 
 
 
 
int main()
{
	//speed_up;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
 
	int test = 1, tc = 0;
	//scanf("%d", &test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
 
	return 0;
 
 
 
 
}




Measured memory_bytes: 3728
#include <iostream>
#include <vector>

int main(){
   int N, D, X;
   std::cin >> N >> D >> X;
   std::vector<int> A(N);
   for (int i=0; i<N; i++){
      std::cin >> A.at(i);
   }
   int cnt = 0;
   for (int i=0; i<N; i++){
      int j = 0;
      while (j*A.at(i) + 1 <= D){
         j++;
      }
      cnt = cnt + j;
   }
   std::cout << cnt+X << std::endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    char x,y;
    cin>>x>>y;
    if (x==y)
    cout<<"=";
    else if (x<y)
        cout<<"<";
    else
        cout<<">";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
    ll n,w;
    cin >> n >> w;
    ll i,j,k;
    vector<pair<ll,ll> > p(n);
    for (i = 0; i < n; i++){
        cin >> p[i].first >> p[i].second;
    }
    ll V=10010;
    ll dp[n + 1][V];
    for(i = 0; i <= n; i++) {
        for(j = 0; j < V;j++){
            dp[i][j] = w + 1000;
        }
    }
    for(i = 0; i <= n;i++){
        dp[i][0] = 0;
    }
    for(i = 0; i < n; i++) {
        for(j = 0; j < V; j++) {
            if(j>=p[i].first)dp[i + 1][j] = min(dp[i][j - p[i].first] + p[i].second, dp[i][j]);
            else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }
    ll ret = 0;
    for(i = 0; i < V; i++) {
        if(dp[n][i]<=w)ret = max(i, ret);
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 10984
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		long[] a = new long[count];
		for(int i=0;i<count;i++) {
			a[i] = sc.nextLong();
		}
		
		for(int i=1;i<=count;i++) {
			System.out.print("node "+i+": key = "+a[i-1]+", ");
			if(i!=1) {
				System.out.print("parent key = "+a[i/2-1]+", ");
			}
			if(2*i<=a.length) {
				System.out.print("left key = "+a[2*i-1]+", ");
			}
			if(2*i<=a.length-1) {
				System.out.print("right key = "+a[2*i]+", ");
			}
			System.out.println();
		}
}}



Measured memory_bytes: 27020
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    for (;;) {
        int N, M; cin >> N >> M;
        if (N == 0) break;
        int r; cin >> r;
        struct event {
            int time, com, type;
        };
        map<int,vector<event>> data;
        while (r--) {
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            --n, --m;
            data[m].push_back(event{t, n, s});
        }

        int q; cin >> q;
        while (q--) {
            int s, e, m;
            cin >> s >> e >> m;
            --m;
            int ans = 0;
            map<int,int> com;
            int prev = 0;
            for (event& ev : data[m]) {
                if (!com.empty()) {
                    ans += max(min(ev.time, e) - max(prev, s), 0);
                }
                if (ev.type) com[ev.com] = 1;
                else com.erase(ev.com);
                prev = ev.time;
            }
            cout << ans << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3192
#include<stdio.h>
#include<math.h>
main(){
  double n,money=100000,i,j;
  scanf("%lf",&n);
  for(i=0;i<n;i++){
    money=(money*1.05);
    if(fmod(money,1000)!=0){
      money=money-fmod(money,1000)+1000;
    }
  }
  printf("%.0f\n",money);
  return 0;
}

Measured memory_bytes: 644
#include<iostream>
using namespace std;
int main()
{
    int n,k,q;
    cin>>n>>k>>q;
    int a[100006],a1[100006],a3[100006];
    for(int i=0; i<q; i++)
    {
        cin>>a[i];
    }
    for(int i=0; i<n; i++)
    {
        a1[i]= q-k;
    }
    for(int i=0; i<=n; i++)
    {
        a3[i]= 0;
    }
    for(int i=0; i<q; i++)
    {
        a3[a[i]] += 1;
    }
    for(int i=0; i<n; i++)
    {
        if(a3[i+1]>a1[i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import fractions
from functools import reduce
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
if n == 1:
    print (abs(x_list[0]-x))
    exit (0)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

y_list = []
for i in x_list:
    y_list.append(abs(i-x))

print (gcd_list(y_list))

Measured memory_bytes: 16280
#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string N;
    std::cin >> N;
    if ((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])) { std::cout << "Yes" << std::endl; }
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <queue>
#include <memory>
#include <algorithm>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <functional>
#include <cassert>
using namespace std;

long long a, b;

int main(int argn, char **argc) {

	cin >> a >> b;
	if (a > b) swap(a, b);
	long long m = (b - a);
	if (m % 2) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		m /= 2;
		cout << a + m << endl;
	}

    return 0;
}

Measured memory_bytes: 256
let () =
  let s = read_line () in
  let li = Stack.create () in
  let res = Stack.create () in
  let rec get i a =
    if Stack.is_empty res then a
    else let (j, x) = Stack.pop res in
         if j < i then begin
             Stack.push (j, x) res;
             a
           end
         else begin
             get i (a+x)
           end in
  let rec to_list st ls =
    if Stack.is_empty st then ls
    else let (_, x) = Stack.pop st in to_list st (x::ls) in
  String.iteri (fun i c ->
                if c = '\\' then Stack.push i li
                else if c = '/' then begin
                    if Stack.is_empty li then ()
                    else let j = Stack.pop li in
                         let m = get j 0 in
                         Stack.push (j, m + i - j) res
                  end
               ) s;
  let l = to_list res [] in
  List.fold_left (+) 0 l |> string_of_int |> print_endline;
  (List.length l) :: l |> List.map string_of_int |> String.concat " " |> print_endline

Measured memory_bytes: 3384
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    vector A(N, 0);
    int ma = INT32_MIN;
    int mi = INT32_MAX;
    int mai,mii;
    rep(i,N) {
        cin >> A.at(i);
        if (ma < A[i]) {
            ma = A[i];
            mai = i;
        }
        if (mi > A[i]) {
            mi = A[i];
            mii = i;
        }
    }
    if ((ll)ma * mi > 0LL) {
        cout << N-1 << endl;
        if (ma > 0)
            for (int i = 1; i < N; i++) cout << i << " " << i + 1 << endl;
        else
            for (int i = N; i > 1; i--) cout << i << " " << i - 1 << endl;
    } else {
        int ind;
        ind = (abs(ma) > abs(mi)) ? mai : mii;
        cout << 2 * N - 1 << endl;
        rep(i,N) cout << ind + 1 << " " <<  i + 1 << endl;
        if (ind == mai && ma > 0) 
            for (int i = 0; i < N - 1; i++) cout << i + 1 << " " << i + 2 << endl;
        else
            for (int i = N; i > 1; i--) cout << i << " " << i - 1 << endl;
    }
}


Measured memory_bytes: 3628
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    private static final Scanner scanner = new Scanner(System.in);
    private static final Consumer<List<String>> consumer = solve();

    public static void main(String[] args) {
        consumer.accept(readInput());
    }

    private static List<String> readInput() {
        final List<String> lineList = new ArrayList<>();
        while (scanner.hasNextLine()) {
            lineList.add(scanner.nextLine());
        }
        return lineList;
    }

    private static Consumer<List<String>> solve() {
        return args -> {
            Integer N = Integer.valueOf(args.get(0).split(" ")[0]);
            Integer K = Integer.valueOf(args.get(0).split(" ")[1]);
            boolean[][] edges = new boolean[N + 1][N + 1];
            for (int i = 0; i < N + 1; i++) {
                Arrays.fill(edges[i], false);
            }
            Arrays.fill(edges[1], true);
            edges[1][0] = false;
            edges[1][1] = false;

            int curr = IntStream.range(1, N - 1).sum();
            if (K > curr) {
                System.out.println(-1);
                return;
            }

            int m = N - 1;
            int from = 2;
            int to = from + 1;
            while (curr > K) {
                edges[from][to] = true;
                curr--;
                m++;
                if (to < N) {
                    to++;
                } else {
                    from++;
                    to = from + 1;
                }
            }

            System.out.println(m);
            for (int i = 0; i < N + 1; i++) {
                for (int j = 0; j < N + 1; j++) {
                    if (edges[i][j]) {
                        System.out.printf("%d %d\n", i, j);
                    }
                }
            }
        };
    }

}


Measured memory_bytes: 33548
A, B, C, D = map(int, input().split())

def gcd(a, b):
    if (b==0):
        return a
    else:
        return gcd(b, a % b)

G = C * D // gcd(C, D)

ans_b = B - B//C - B//D + B//G
ans_a = A - 1 - (A-1)//C - (A-1)//D + (A-1)//G

print(ans_b - ans_a)

Measured memory_bytes: 3060
def BinarySearch(A, key):
    left = 0
    right = len(A)
    while left < right:
        mid = (left + right) // 2
        if A[mid] == key:
            return mid
        elif key < A[mid]:
            right = mid
        else:
            left = mid+1
    return -1
    
n = int(input())
S = list(map(int, input().split(" ")))
q = int(input())
T = list(map(int, input().split(" ")))

C = 0
for t in T:
    if BinarySearch(S, t) != -1:
        C += 1
print(C)

Measured memory_bytes: 18848
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define ll              long long int
#define vll             vector<ll>
#define vs              vector <string>                                    
#define mll             map<ll,ll>
#define pll             pair<ll, ll>
#define vpll            vector < pair<ll,ll> >
#define itr             vll::iterator
#define all(c)          c.begin(),c.end()
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pb              push_back
#define mb              make_pair
#define ff              first
#define ss              second
#define max3(a,b,c)     max(max(a,b),c)                                    
#define min3(a,b,c)     min(min(a,b),c)  
#define mod             1000000007
#define inf             1000000000000000001
#define from(i, n)      for(__typeof(n) i = 0; i <  n; ++i)
#define fromj(i, j, n)  for(__typeof(n) i = j; i <  n; ++i)
#define printv(v)       from(i,v.size())cout<<v[i]<<" ";cout<<"\n";
#define w(x)            int x; cin>>x; while(x--)

using namespace std;
using namespace __gnu_pbds; 

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}
 
bool func(const pll &a, const pll &b){
    return a.ss < b.ss;
}

typedef tree<int, null_type, less<int >, rb_tree_tag, 
             tree_order_statistics_node_update> pbds; 
/*map<pair<ll,ll>,ll > mp;             
ll knp(ll k,ll pos,vpll &v){
    //cout<<k<<"\n";
    if(pos>=v.size()||k<=0)return 0;
    if(mp[mb(k,pos)])return mp[mb(k,pos)];
    ll ans=0;
    for(ll i=pos;i<v.size();i++){
        if(v[i].ff>k)break;
        if(v[i].ff==k)ans=max(ans,v[i].ss);
        if(v[i].ff<k)ans=max(ans,v[i].ss+knp(k-v[i].ff,i+1,v));
    }
    mp[mb(k,pos)]=ans;
    return ans;
}*/
int main(){
    c_p_c();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,k,V=0,W=0;
    cin>>n>>k;
    vpll v(n);
    from(i,n){
        ll a,b;
        cin>>a>>b;
        v[i]=mb(a,b);
        V+=b;
        W+=a;
    }
    sort(all(v));
    if(k>=W)cout<<V;
    else {
        ll ar[n+1][k+1];
        //memset(ar,0,sizeof(ar));
        from(i,n+1)ar[i][0]=0;
        from(i,k+1)ar[0][i]=0;
        //cout<<ar[n][k];
        for(ll i=1;i<n+1;i++){
            for(ll j=1;j<k+1;j++){
                if(v[i-1].ff>j)ar[i][j]=ar[i-1][j];
                else ar[i][j]=max(ar[i-1][j],v[i-1].ss+ar[i-1][j-v[i-1].ff]);
            }
        }
        cout<<ar[n][k];
    }
}    

Measured memory_bytes: 82116
def abc112_b():
    n, limit_time = map(int, input().split())
    ans = 10000

    for _ in range(n):
        cost, time = map(int, input().split())

        if time <= limit_time and ans > cost:
            ans = cost

    return ans if ans != 10000 else "TLE"


if __name__ == '__main__':
    print(abc112_b())

Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;


int main(void) {
	long long int n, m, max;
	int i, j;
	int e[200000];
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> e[i];
	}
	max = 0;
	m = 0;
	for (i = n - 1; i >0; i--) {
		m += e[i];
		m %= MOD;
		max += e[i - 1] * m;
		max %= MOD;
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 4312
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
typedef pair<ll, ll> LP;
 
ll POW(ll m,ll n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  return m*POW(m,n-1)%MOD;
}
 
ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a, ll m) {
    ll x, y;
    extGCD(a, m, x, y);
    return mod(x, m);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return m%MOD*COM(m-1,n)%MOD*modinv(m-n,MOD)%MOD;
}
 

int main()
{
  ll n,m,k,ans;
  k=0;
  cin >> n >> m;
  FOR(i,n,n+100000)if(m%i==0){k=1;
                            printf("%lld",m/i);
                            break;
                           }
  if(k==0){FOR(i,1,100000)if(m%i==0&&m/i>=n)ans=i;
           printf("%lld",ans);
          }
                                        
}

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

int main(){
	string s,t;
	cin>>s>>t;
	int sl=s.size(),tl=t.size();
	
	if(tl-sl==1){
		for(int i=0;i<sl;i++){
			if(s[i]!=t[i]){
				cout<<"No";
				return 0;
			}
		}
	}
	else{
		cout<<"No";
		return 0;
	}
	
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    readLine()
    val n = readLine()!!.toInt()
    val l = readLine()!!.split(" ").map { it.toInt() }
    var a = 0
    l.forEach {
        a += Math.min(it, n - it) * 2
    }
    println(a)
}

Measured memory_bytes: 37952
#include<iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

#define LOCAL  1
#define UPLOAD 2

using namespace std;

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    string S, T;
    cin >> S >> T;

    int count = 0;
    for(int i=0;i<S.length();i++){
        if(S[i] == T[i]){
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  long n,k,min;
  cin>>n>>k;
  long min1,min2;
  min1=n%k;
  min2=k-min1;
  min=min1<min2?min1:min2;
  cout<<min;
  
  
 
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef unsigned long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(vector<LL>& a, vector<LL>& b) {
return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

LL fact(LL n) {
	LL sum = 1;
	REP(i, n) {
		sum *= i + 1;
		sum = sum%mod; 
	}
	return sum;
}

int main() {
	LL N, M;
	cin >> N >> M;
	if (N == M + 1|| N == M || N +1== M ) {
		if (N == M + 1) {
			cout << (fact(N) * fact(M)) % mod << endl;
		}else
			if (N + 1 == M) {
				cout << (fact(N) * fact(M)) % mod << endl;
			}
			else {
				cout << (fact(N) * fact(M))*2 % mod << endl;
			}
	}
	else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
        cout << "YES";
    else
        cout << "NO";
}


Measured memory_bytes: 256