akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;

int main() {
  ll n, d, a;
  cin >> n >> d >> a;
  vector<P> monster(n);
  rep(i, n) {
    ll x, h;
    cin >> x >> h;
    monster[i] = P(x, h);
  }
  sort(monster.begin(), monster.end());

  queue<P> bomb;
  ll ans = 0;
  ll bombnum = 0;

  rep(i, n) {
    ll x = monster[i].first;
    ll h = monster[i].second;
    while (!bomb.empty()) {
      ll bombx = bomb.front().first;
      if (bombx < x) {
        bombnum -= bomb.front().second;
        bomb.pop();
      } else {
        break;
      }
    }

    ll remain = h - (bombnum * a);
    // cout << remain << endl;
    if (remain > 0) {
      ll num = (remain + a - 1) / a;
      ll expire = x + 2 * d;
      bomb.push(P(expire, num));

      ans += num;
      bombnum += num;
    }
  }

  cout << ans << endl;
}

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

inline int readInt() {
	int n = 0, ch = getchar();
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) n = n * 10 + ch - '0', ch = getchar();
	return n;
}

const int MAX_N = 400 + 3, MAX_M = 100000 + 3;
bitset<MAX_N> s[MAX_N];
int n, m, x[MAX_M], y[MAX_M];
bool ok[MAX_N];

void prepare() {
	for (int i = 0; i < n; ++i) {
		s[i].reset(), ok[i] = true, s[i][i] = 1;
		for (int j = m - 1; j >= 0; --j)
			if (s[i][x[j]] && s[i][y[j]]) {
				ok[i] = false;
				break;
			} else if (s[i][x[j]]) {
				s[i][y[j]] = true;
			} else if (s[i][y[j]]) {
				s[i][x[j]] = true;
			}
	}
}

int main() {
	n = readInt(), m = readInt();
	for (int i = 0; i < m; ++i) x[i] = readInt() - 1, y[i] = readInt() - 1;

	prepare();

	int ans = 0;
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j)
			if (ok[i] && ok[j] && (s[i] & s[j]).none())
				++ans;

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

	return 0;
}


Measured memory_bytes: 1024
L,R = map(int,input().split())
if R - L > 2019:
        print(0)
else:
    ans = 10**9
    for i in range(L,R):
        for j in range(i+1,R+1):
            if ans > i*j%2019:
                ans = i*j%2019
                if ans == 0:
                    break
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <math.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define str string
#define deb_arr(arr,n) for(ll i=0;i<(n);i++){ cout << (arr)[i] << " ";}
#define in_arr0(arr,n) for(ll i=0;i<(n);i++){ cin >> (arr)[i]; }
#define in_arr1(arr,n) for(ll i=1;i<=(n);i++){ cin >> (arr)[i];}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define vll vector<ll> 
#define fr(n) for(i=0;i<(n);i++)
#define fr1(n) for(i=1;i<=(n);i++)
#define pll pair<ll,ll>
#define f first
#define s second
#define vpll vector<pll>
#define ump unordered_map
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define IN(a,b) ((a).find(b)!=(a).end())
#define pb push_back
#define mkp make_pair
#define PI M_PI
#define INF 1e18
#define deb(x) if(ON) cout << #x <<" : " << x << endl
#define fast ios_base::sync_with_stdio(false)
#define io cin.tie(NULL),cout.tie(NULL)
#define ON !false
ll dx[]={0,-1,0,1};
ll dy[]={1,0,-1,0};
const ll mod=1e9+7;
inline ll add(ll a,ll b){
    return  ((a%mod)+(b%mod)+mod)%mod;
}
inline ll mul(ll a,ll b){
    return ((a%mod)*(b%mod)+mod)%mod;
}
void pause(ll id){
    cout << "Waiting " << id << endl;
    cin >> id;
}

int mxn=2e5+10;

void init(){

    return ;
}


signed main(){
    fast;
    io;
    if(!true){
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    }
    init();
    ll i,j;
    ll n,k;
    cin >> n >> k;
    ll arr[n+1];
    in_arr1(arr,n);
    ll cnt=0;
    vll vis(n+1,0);
    vll ans;
    i=1;
    map<ll,ll> mp;
    while(true){
        if(vis[i]){
            break;
        }
        mp[i]=cnt;
        cnt++;
        vis[i]=1;
        ans.pb(i);
        i=arr[i];
    }
    ll ok;
    k++;
    i=mp[i];

    if(k <= i ){
        cout << ans[k-1] << endl;
        return 0;
    }
    k-=i;
    ll sz=(ans.size()-i);
    k=k%sz;
    cout << ans[i+(k-1+sz)%sz] << endl;

   
    return 0;
}


Measured memory_bytes: 20056
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)

int main(){
    ll N,K;
    cin>>N>>K;
    vector<ll>sunuke(N);
    ll a,b;
    rep(i,K){
        cin>>a;
        rep(j,a){
           cin>>b;
           sunuke[b-1]++;
        }
    }
    int ans=0;
    rep(i,N){
       if(sunuke[i]==0) ans++;
    }
     cout<<ans<<endl;   
   
}



Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 1000 * 1000 * 1000
#define MOD 1000000007ll
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<double, double> pr;
typedef pair<pair<int, int>, int> tup;

inline void solve()
{
	ll n, a, b;
	cin >> n >> a >> b;
	ll otv = INT64_MAX;
	if (abs(a - b) % 2 == 0)
		otv = min(otv, abs(a - b) / 2);
	else
	{
		otv = min(otv, min(a, b) - 1 + 1 + (abs(a - b) - 1) / 2);
		otv = min(otv, n - max(a, b) + 1 + (abs(a - b) - 1) / 2);
	}

	otv = min(otv, max(a, b) - 1);
	otv = min(otv, n - min(a, b));
	cout << otv;
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

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


int main() {
  string s;
  cin >> s;
  int n = s.length();

  for(int i=0; i<(n-1)/2; i++){
    if(s.at(i) != s.at(n-1-i)){
      cout << "No" <<endl;
      return 0;
    }
  }

  n = (s.length() - 1) / 2;
  for(int i=0; i<n/2; i++){
    if(s.at(i) != s.at(n-1-i)){
      cout << "No" <<endl;
      return 0;
    }
  }

  cout << "Yes" <<endl;

}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << std::setprecision(10) << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<double> e;
	std::vector<std::pair<int,int> > a;
	rep(i,n) {
		int x,y;
		std::cin >> x >> y;
		for(auto ele:a) {
			e.emplace_back(std::sqrt((x-ele.first)*(x-ele.first) + (y-ele.second)*(y-ele.second)));
		}
		a.emplace_back(x,y);
	}
	double sum = 0;
	debug(e);
	for(auto i:e) sum+=i;
	print((double)(n-1)*sum/(double)e.size());

	return 0;
}


Measured memory_bytes: 256
s = input()
k = int(input())
n = len(s)
for i in range(n):
  num = ord(s[i])
  if num == 97 or 123-num > k:
    continue
  k -= (123-num)
  s = s[:i] + 'a' + s[i+1:]
if k > 0:
  t = k%26
  s = s[:n-1] + chr(ord(s[n-1])+t)
print(s)  

Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;

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);}
using namespace std;

void solve(){
	int n;
	ll c,k;
	cin>>n>>c>>k;
	vector<ll>t(n);
	rep(i,n){
		cin>>t[i];
	}
	sort(t.begin(),t.end());
	ll now=0,ans=0;
	while(now<n){
		ll nxt=now;
		while(nxt<n&&nxt-now<c&&t[nxt]-t[now]<=k)++nxt;
		++ans;
		now=nxt;
	}
	cout<<ans<<endl;
}

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


Measured memory_bytes: 1024
import java.util.*;
 import java.math.BigInteger;
public class Main
{
	public static  void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		// String h[]=sc.nextLine().split(" ");
		// long n=Long.parseLong(sc.nextLine());
		String s[]=sc.nextLine().split(" ");
		int n=Integer.parseInt(s[0]);
		int m=Integer.parseInt(s[1]);
		int q=Integer.parseInt(s[2]);
		ArrayList<Pair>ch=new ArrayList<>();
		for(int i=0;i<q;i++)
		{
			String h[]=sc.nextLine().split(" ");
			ch.add(new Pair(Integer.parseInt(h[0]),Integer.parseInt(h[1]),Integer.parseInt(h[2]),Integer.parseInt(h[3])));
		}
		System.out.println(get(new int[n],1,0,ch,m));
	}
	static int get(int [] arr, int k, int i, ArrayList<Pair>ch, int m)
	{
		if(i==arr.length)
		{
			int sum=0;
			for(int u=0;u<ch.size();u++)
			{
				if(arr[ch.get(u).b-1]-arr[ch.get(u).a-1]==ch.get(u).c){sum+=ch.get(u).d;}
			}
			return sum;
		}
		int max=0;
		for(int u=k;u<=m;u++)
		{
			arr[i]=u;
			max=Math.max(max,get(arr,u,i+1,ch,m));
			
		}
		return max;
	}

}
class Pair
{
	int a;
	int b;
	int c;
	int d;
	Pair(int e,int f, int g,int h){
		a=e;
		b=f;
		c=g;
		d=h;
	}
}



	


Measured memory_bytes: 36636
#include <stdio.h>

int main(void)
{
	int i, j, n;
	char s[100];
	
	while (scanf("%s", s) != EOF){
		for (i = 0; s[i] != '\0'; i++){
			n = 0;
			if (s[i] == '@'){
				n = s[i + 1] - '0';
				i++;
				for (j = 1; j < n; j++){
					printf("%c", s[i + 1]);
				}
			}
			else {
				printf("%c", s[i]);
			}
		}
		printf("\n");
	}
	
	return (0);
}

Measured memory_bytes: 524
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;
 
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)
 
typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;
 
constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
 
int main() {
    int X,Y; cin>>X>>Y;
    cout<<X+Y/2<<endl;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"

using ld = long double;
using ll = long long;

inline ll addm(ll __a, ll __b, ll __m);
inline ll subm(ll __a, ll __b, ll __m);
inline ll mulm(ll __a, ll __b, ll __m);
ll powm(ll __a, ll __b, ll __m);
ll inv(ll __x, ll __m);
// }}}

const ll INFL = numeric_limits<ll>::max() / 2;
const ll INF = numeric_limits<int>::max() / 2;
const ll MOD = 1e9+7;

const int N = 105;
const int K = 100500;
int a[N];
ll dp[K], sum[K];
void solve()
{
    int n, k; cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= k; j++) {
            sum[j] = dp[j] + (j ? sum[j-1] : 0);
            sum[j] %= MOD;
        }
        for (int j = 0; j <= k; j++) {
            dp[j] = sum[j] - (j-1 >= a[i] ? sum[j-a[i]-1] : 0);
            dp[j] += MOD;
            dp[j] %= MOD;
        }
    }
    cout << dp[k] << endl;
}

// main {{{
int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}

inline ll addm(ll __a, ll __b, ll __m = MOD) {
    return ((__a+__b)%__m);
}
inline ll subm(ll __a, ll __b, ll __m = MOD) {
    return (((__a-__b)%__m+__m)%__m);
}
inline ll mulm(ll __a, ll __b, ll __m = MOD) {
    return ((__a*__b)%__m);
}
ll powm(ll __a, ll __b, ll __m = MOD) {
    ll ret = (!__b) ? 1 : powm(__a, __b/2, __m);
    return (!__b) ? 1 : mulm(mulm(ret, ret, __m), (__b%2) ? __a : 1, __m);
}
ll inv(ll __x, ll __m = MOD) {
    return powm(__x, __m-2, __m);
}
// }}}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n,k,tot = 1;
  cin >> n >> k;
  for(int i = 1; i < n; ++i) tot = (k-1)*tot;
  cout << k*tot;
  return 0;
}


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

int main(){
  string X,Y,Z;cin>>X>>Y>>Z;
  int lx=X.size();
  int ly=Y.size();
  int lz=Z.size();
  int p=1,q=0,r=0;
  char S=X.at(0);
  char ans;
  while(true){
    if(lx==1 && S=='a'){
      ans='A';
      break;
    }
    if(S=='a'){
      S=X.at(p);
      p++;
    }
    else if(S=='b'){
      S=Y.at(q);
      q++;
    }
    else{
      S=Z.at(r);
      r++;
    }
    if(S=='a'&&p==lx){
      ans='A';
      break;
    }
    else if(S=='b' && q==ly){
      ans='B';
      break;
    }
    else if(S=='c' && r==lz){
      ans='C';
      break;
    }
  }
  cout<<ans<<endl;
}
    


Measured memory_bytes: 3488
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
ll a[100010][3];
ll dp[100010][3];
    
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 3; ++j){
            cin >> a[i][j];
        }
    }
    
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 3; ++j){
            for(int k = 0; k < 3; ++k){
                if(j == k) continue;
                chmax(dp[i+1][k], dp[i][j]+a[i][k]);
            }
        }
    }
    ll res = 0;
    for(int j = 0; j < 3; ++j){
        chmax(res, dp[N][j]);
    }
    cout << res << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <cstring>
typedef long long lint;
const int N=2005;
const int mod=1e9+7;
int n,ans,fac[N<<2],inv[N<<2],dp[N<<1][N<<1];
struct pnt{
	int x,y;
}pt[(int)2e5+2];

template <class T> inline void twk(T &x){
	if(x>=mod) x-=mod;
}

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

inline int C(const int x,const int y){
	if(x<y) return 0;
	return (lint)fac[x]*inv[y]%mod*inv[x-y]%mod;
}

inline int qpow(int x,int t){
	int ans=1;
	for(;t;t>>=1,x=(lint)x*x%mod){
		if(t&1) ans=(lint)ans*x%mod;
	}
	return ans;
}

inline void init_C(){
	fac[0]=1;
	for(int i=1;i<N<<2;++i){
		fac[i]=(lint)fac[i-1]*i%mod;
	}
	inv[(N<<2)-1]=qpow(fac[(N<<2)-1],mod-2);
	for(int i=(N<<2)-1;i;--i){
		inv[i-1]=(lint)inv[i]*i%mod;
	}
}

int main(){
#ifndef ONLINE_JUDGE
//	freopen("e.in","r",stdin);
#endif
	init_C();
	n=nxi();
	for(int i=1;i<=n;++i){
		const int x=nxi(),y=nxi();
		twk(ans+=mod-C((x+y)<<1,x<<1));
		pt[i]=(pnt){x,y};
		++dp[N-x][N-y];
	}
	for(int i=1;i<N<<1;++i){
		for(int j=1;j<N<<1;++j){
			twk(dp[i][j]+=dp[i-1][j]);
			twk(dp[i][j]+=dp[i][j-1]);
		}
	}
	for(int i=1;i<=n;++i){
		twk(ans+=dp[pt[i].x+N][pt[i].y+N]);
	}
	printf("%lld\n",(lint)ans*inv[2]%mod);
	return 0;
}

Measured memory_bytes: 64640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))

class CSumOfProductOfPairs {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<int> a(n);
    REP(i,n) in >> a[i];
    int sub_sum = 0;
    FOR(i,1,n){
      sub_sum += a[i];
    }
    int ans = 0;
    REP(i,n-1){
      ans += (a[i] % MOD) * (sub_sum % MOD);
      ans %= MOD;
      sub_sum -= a[i+1];
    }
    out << ans << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	CSumOfProductOfPairs solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4828
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main() {
    int N; cin >> N;
    vector<long long> vx(N), vy(N), vh(N);
    int si = -1;
    for (int i = 0; i < N; ++i) {
        cin >> vx[i] >> vy[i] >> vh[i];
        if (vh[i] > 0) si = i;
    }

    long long resx = -1, resy = -1, resh = -1;
    for (long long x = 0; x <= 100; ++x) {
        for (long long y = 0; y <= 100; ++y) {
            long long h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
            bool ok = true;
            for (int i = 0; i < N; ++i) {
                if (vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i]))
                    ok = false;
                if (vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i]))
                    ok = false;
            }
            if (ok) resx = x, resy = y, resh = h;
        }
    }
    cout << resx << " " << resy << " " << resh << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<=(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int k,x;
	cin >> k >> x;
	if (k * 500 >= x) cout << "Yes";
	else cout << "No";
	cout << endl;

	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  for(Int k=0;k<20;k++)
    if((1<<k)==n) drop("No");

  assert(n>=3);
  cout<<"Yes"<<endl;
  vector< vector<Int> > G(n*2+1);
  auto add_edge=
    [&](Int u,Int v){
      G[u].emplace_back(v);
      G[v].emplace_back(u);
    };

  add_edge(1,2);
  add_edge(2,3);
  add_edge(3,n+1);
  add_edge(n+1,n+2);
  add_edge(n+2,n+3);

  for(Int i=4;i+1<=n;i+=2){
    add_edge(1,i);
    add_edge(i,i+1);

    add_edge(n+1,n+i+1);
    add_edge(n+i+1,n+i);
  }

  if(n%2==0){
    Int k=1;
    while(k*2<n) k*=2;
    assert(k>=2);
    assert(k<n);
    assert(n<k*2);
    assert(k+1<=n);
    add_edge(n+k+1,n);
    if((n^k)==2){
      add_edge(n+2,n+n);
    }else{
      add_edge((n^k),n+n);
    }
  }

  for(Int v=1;v<=n*2;v++)
    for(Int u:G[v])
      if(v<u) cout<<v<<" "<<u<<"\n";
  cout<<flush;
  return 0;
}


Measured memory_bytes: 14320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(void){
	string s,t; cin>>s>>t;
	int ans=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
#include <cstdio>
#include <set>
using namespace std;

int main(){
    set<int> cds;
    int i,n;
    for(i=0;i<1100;i++){cds.insert(i);}
    scanf("%d",&n);
    int ary[n];
    for(i=0;i<n;i++){scanf("%d",&ary[i]);cds.erase(ary[i]);}
    for(i=0;i<n-1;i++){cds.erase(ary[i]*10+ary[i+1]);}
    for(i=0;i<n-2;i++){cds.erase(ary[i]*100+ary[i+1]*10+ary[i+2]);}
    printf("%d\n",*(cds.begin()));
    return 0;
}



Measured memory_bytes: 2864
#include<stdio.h>
int main(void){
 int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==5&&b==5&&c==7||a==5&&b==7&&c==5||a==7&&b==5&&c==5) printf("YES");
  else printf("NO");
  return 0;
}

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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}


int main()
{
   su;
   int a,b,cnt;
   float t;
   cin>>a>>b>>t;
   t+=0.5;
   cnt=(int)(t/a)*b;
   cout<<cnt<<nl;
   return 0;
}


Measured memory_bytes: 3712
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)


main :: IO ()
main = do
    [a,b] <- r'
    print $ ceiling ((fromIntegral $ b-a) / (fromIntegral $  a-1)) + 1






Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll h,w;
  cin >> h >> w;
  vector<string> c(h);
  for(ll i=0;i<h;i++) cin >> c[i];
  for(ll i=0;i<2*h;i++) {
    cout << c[i/2] << endl;
  }
}

Measured memory_bytes: 256
N=int(input())
mod=10**9+7
def power_func(a,n,p):
    bi=str(format(n,"b"))
    res=1
    for i in range(len(bi)):
        res=(res*res)%p
        if bi[i] == "1":
            res=(res*a)%p
    return res

a=power_func(10,N,mod)
b=power_func(9,N,mod)
c=power_func(8,N,mod)
ans=(a+c-(2*b))%mod
print(ans)

Measured memory_bytes: 9204
import itertools
import numpy as np
N,M,X = map(int,input().split())

C,A = [],[]
for i in range(N):
  inp = np.array(list(map(int,input().split())))
  #print(inp)
  c = inp[0]
  a = inp[1:]
  C.append(c),A.append(a)

comb = [0,1]
Comb = list(itertools.product(comb, repeat=N))

min_cost = float('inf')
for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_cost = 0
  tmp_u = np.array([0]*M)
  for j in range(N):            
     if(tmp[j] == 1):
       tmp_u += A[j]
       tmp_cost += C[j] 
  
  flag = 1
  for j in tmp_u:
    flag = flag*(X<=j)
  if(flag == 1):      
     min_cost = min(min_cost,tmp_cost)       
                 
if(min_cost == float('inf')):
  print(-1)
else:
  print(min_cost)
             
                 
  

Measured memory_bytes: 27432
// A Dynamic Programming based solution for 0-1 Knapsack problem 
#include<stdio.h> 
#include <iostream>
using namespace std;


// A utility function that returns maximum of two integers 
int max(int a, int b) { return (a > b)? a : b; } 

// Returns the maximum value that can be put in a knapsack of capacity W 
long long int knapSack(long long int W, long long int wt[], long long int val[], long long int n) 
{ 
int i, w; 
long long int K[n+1][W+1]; 

// Build table K[][] in bottom up manner 
for (i = 0; i <= n; i++) 
{ 
	for (w = 0; w <= W; w++) 
	{ 
		if (i==0 || w==0) 
			K[i][w] = 0; 
		else if (wt[i-1] <= w) 
				K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w]); 
		else
				K[i][w] = K[i-1][w]; 
	} 
} 

return K[n][W]; 
} 

int main() 
{ 
	long long int val[101]; 
	long long int wt[101]; 
	long long int n,W;
  	cin>>n>>W;
  	int c=n;
  int i=0,j=0;
  	while(c--){
    cin>>wt[i++]>>val[j++];
    }
	
	cout<< knapSack(W, wt, val, n); 
	return 0; 
} 



Measured memory_bytes: 79104
#include<iostream>
#include<string>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < n; i++){
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,K=MAP()
L=list(input().split())
L=set(L)
for i in range(N,100000):
  if set(str(i))&L==set():
    print(i)
    exit()

Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<18,INF=1<<30;

struct data{
    int l;
    int r;
    int id;
};

int bit[MAX+1],N;

//1-indexed

int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}

//sからtの和=sum(t)-sum(s-1)

void add(int i,int x){
    while(i<=N){
        bit[i]+=x;
        i+=i&-i;
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int M;cin>>M;
    vector<data> S(M);
    vector<int> cnt(100005),C(M),D(M);
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        S[i].l=a;
        S[i].r=b;
        S[i].id=i;
        cnt[a]++;
        cnt[b]--;
    }
    int ma2=0;
    
    for(int i=1;i<100005;i++){
        cnt[i]+=cnt[i-1];
        ma2=max(ma2,cnt[i]);
    }
    
    sort(all(S),[](data a,data b){
        return a.r<b.r;
    });
    
    N=200000;
    
    for(int i=0;i<M;i++){
        add(S[i].r,1);
        C[S[i].id]=sum(S[i].l);
    }
    
    memset(bit,0,sizeof(bit));
    
    sort(all(S),[](data a,data b){
        return a.l>b.l;
    });
    
    for(int i=0;i<M;i++){
        add(S[i].l,1);
        D[S[i].id]=sum(N-1)-sum(S[i].r-1);
    }
    
    int ma=0;
    
    for(int i=0;i<M;i++){
        ma=max(ma,M-C[i]-D[i]);
    }
    
    cout<<ma<<" "<<ma2<<endl;
    
}



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

bool okay(vector<int> &v, int x, int k){
    ll times = 0;
    rep(i, v.size()){
        times += (v[i] - 1) / x;
    }
    return times <= k;

}

int main(){
    int N, K; cin >> N >> K;
    vector<int> v(N);
    rep(i, N){
        cin >> v[i];
    }
    int l = 0, r = 1e9;
    while(r-l > 1){
        int m = (l + r) / 2;
        if(okay(v, m, K)){
            r = m;
        }else{
            l = m;
        }
    }
    cout << r << endl;
}



Measured memory_bytes: 3988
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();

    // input
    let h: usize = read(&mut stdin_lock, &mut buf, b' ');
    let a: usize = read(&mut stdin_lock, &mut buf, b'\n');

    println!("{}", (h + a - 1) / a);
}


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

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  int sum=0, maxnum=0;
  for(int i=0; i<n; ++i){
    cin >> l.at(i);
    sum += l.at(i);
    maxnum = max(maxnum, l.at(i));
  }
  if(sum-maxnum > maxnum) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
  //cin>>t;
    while(t--){
      ll n,i,k;
      cin>>n>>k;
      ll arr[n];
      fr(i,0,n)
      cin>>arr[i];
      ll dp[n+1]={0};
      dp[1]=abs(arr[0]-arr[1]);
      fr(i,2,n)
      {
        int j;
        dp[i]=1e18;
        fr(j,max(0ll,i-k),i)
        dp[i]=min(dp[i],dp[j]+abs(arr[j]-arr[i]));
      }
      cout<<dp[n-1];
      
       
    }
  return 0;
  }



Measured memory_bytes: 1792
A = list(input())
B = list(input())
C = list(input())

x = 'a'
for i in range(len(A) + len(B) + len(C)):
    if x == 'a':
        if len(A) == 0:
            ans = 'A'
            break
        else:
            x = A.pop(0)
    elif x == 'b':
        if len(B) == 0:
            ans = 'B'
            break
        else:
            x = B.pop(0)
    else:
        if len(C) == 0:
            ans = 'C'
            break
        else:
            x = C.pop(0)
            
print(ans)

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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<pair<char, char>> t(q);
    for(int i = 0; i < q; i++){
        char a, b;
        cin >> a >> b;
        t[i] = make_pair(a, b);
    }
    int l = 0, r = n - 1;
    for(int i = q - 1; i >= 0; i--){
        if(l < n && t[i].first == s[l] && t[i].second == 'L'){
            l++;
        }else if(l > 0 && t[i].first == s[l - 1] && t[i].second == 'R'){
            l--;
        }
        if(r >= 0 && t[i].first == s[r] && t[i].second == 'R'){
            r--;
        }else if(r < n - 1 && t[i].first == s[r + 1] && t[i].second == 'L'){
            r++;
        }
        if(r < l) break;
    }
    cout << max(0, n - l - (n - 1 - r)) << endl;
    return 0;
}


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

int fa[100001];

struct edge
{
	int u,v;
}e[100001];

long long ans[100001],len[100001];

int findfa(int x)
{
	if(x!=fa[x]) fa[x]=findfa(fa[x]);
	return fa[x];
}

int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>e[i].u>>e[i].v;
	
	for(int i=1;i<=n;i++)
	{
		fa[i]=i;
		len[i]=1;
	}
	
	ans[m]=(long long)n*(n-1)/2;
	
	int f1,f2;
	for(int i=m;i>=1;i--)
	{
		f1=findfa(e[i].u);
		f2=findfa(e[i].v);
		if(f1==f2)
			ans[i-1]=ans[i];
		else
		{
			ans[i-1]=ans[i]-len[f2]*len[f1];
			len[f2]+=len[f1];
			fa[f1]=f2;
		}
	}
	
	for(int i=1;i<=m;i++)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 4096
import sys

def main():
    input = sys.stdin.readline
    S = list(map(str, input().strip()))
    n = len(S) - 2
    i = S[0]
    e = S[-1]

    ans = str(i) + str(n) + str(e)

    return ans


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


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

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

int main() {
	string S;
	cin >> S;
	ll ans = 0;
	ll now = 0;
	rep(i, S.size()) {
		if (S[i] == 'R') { now++; }
		else { now = 0; }
		ans = max(now, ans);
	}
	cout << ans << endl;
}


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

typedef string::iterator S;
string ss;

string snakeA(S it){
    int count = 0;
    for(;it!=ss.end()&&*it=='=';it++,count++);
    if(!count) return "NA";
    if(it==ss.end()||*it!='#') return "NA";
    it++;
    for(;it!=ss.end()&&*it=='=';it++,count--);
    if(it==ss.end()||*it!='~') return "NA";
    it++;
    if(*it||count) return "NA";
    return "A";
}

string snakeB(S it){
    while(true){
        if(it==ss.end()||*it++!='Q') return "NA";
        if(it==ss.end()||*it++!='=') return "NA";
        if(it==ss.end()) return "NA";
        if(*it=='~') break;
    }
    if(*++it=='~'&&!*++it) return "B";
    return "NA";
}

string snake(string ss){
    S it = ss.begin();
    if( *it++ != '>' ) return "NA";
    if( *it == '\'' ) return snakeA(++it);
    else if( *it == '^' ) return snakeB(++it);
    else return "NA";
}

int main(){
    int n;
    for(cin>>n,cin.ignore();n--;){
        getline(cin, ss);
        cout<<snake(ss)<<endl;
    }
    return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstring>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erase(unique(all(v)),v.end());
#define pvec(v) rep(i,v.size()){ cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sizeof(m))

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;
ll dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}





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

	ll a = 0, b = 0, c = 0, d, e, ans = 0, n, ret = M, m, x = 0, y = 0;
	//bool x = false;
	string s;
	cin >> a >> b;
	cout << a+ (b-a)*2 << endl;
	return 0;
}

Measured memory_bytes: 256
/*input
5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define YY cout<<"YES\n"
#define NN cout<<"NO\n"
#define yy cout<<"Yes\n"
#define nn cout<<"No\n"
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	IOS;
	int n;
	cin>>n;
	if(n==3||n==5||n==7) cout<<"YES\n";
	else cout<<"NO\n";	

	return 0;
}


Measured memory_bytes: 256
import sys
a=[1]*500000
for i in range(3,999,2):
 if a[i//2]:a[(i*i)//2::i]=[0]*len(a[(i*i)//2::i])
for e in map(int,sys.stdin):print([e-1,sum(a[:(e+1)//2])][e>3])


Measured memory_bytes: 15012
#include <iostream>

using namespace std;

const int MAX = 246913;

int main()
{
	int n;
	bool prime[MAX];
	prime[2] = true;
	for(int i=3; i < MAX; i+=2) prime[i] = true;
	for(int i=3; i < MAX; i+=2) {
		if(prime[i]) {
			for(int j=i+i+i; j < MAX; j+=i) {
				if(j&1) prime[j] = false;
			}
		}
	}
	while(cin >> n, n)
	{
		int cnt = 0;
		int m = (n << 1) + 1;
		if(n == 1) cnt++;
		n = (n&1)? n+2 : n+1;
		for(int i=n; i < m; i+=2) {
			if((i&1) && (prime[i])) cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
signed main(){
    int n;cin>>n;
    vector<pair<string,int>> r(n);
    rep(i,n){
        int buf;cin>>r[i].first>>buf;
        r[i].second=(100-buf)*1000+i+1;
    }
    sort(r.begin(),r.end());
    rep(i,n){
        cout<<r[i].second%1000<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var k,x,y,xx=0,yy=0;

console.log(main());
function main(){
  k = o.a();
  x = o.a();
  y = o.a();
  if(x === 0 && y === 0)return 0;
  if(k%2 === 0 && (x+y)%2)return -1;
  var ans = [], k2 = k*2;
  var l = mh();
  while(l > k2 || l%2){
    ans.push(near());
    l = mh();
  }
  if(l % k === 0){
    while(mh())ans.push(near());
  }else{
    var xxx = x, yyy = y;
    var z = (k2 - Math.abs(xx-x) - Math.abs(yy-y)) / 2;
    if(Math.abs(xx-x) >= Math.abs(yy-y)){
      if(yy < y)y = yy-z;else y = yy+z;
      if(xx < x)x = xx+k-z; else x = xx-k+z;
    }else{
      if(xx < x)x = xx-z; else x = xx+z;
      if(yy < y)y = yy+k-z;else y = yy-k+z;
    }
    ans.push(near());
    x = xxx, y = yyy;
    ans.push(near());
  }
  console.log(ans.length);
  return ans.join("\n");
}
function mh(){
  return Math.abs(xx-x)+Math.abs(yy-y);
}
function near(){
  var t = k;
  if(x < xx){
    if(t >= xx-x){
      t -= xx-x;
      xx = x;
    }else{
      xx -= t;
      t = 0;
    }
  }else if(x > xx){
    if(t >= x-xx){
      t -= x-xx;
      xx = x;
    }else{
      xx += t;
      t = 0;
    }
  }
  if(t){
    if(y < yy){
      yy -= t;
    }else{
      yy += t;
    }
  }
  return xx+" "+yy;
}

Measured memory_bytes: 51236
package main

import (
	"fmt"
	"os"
	"bufio"

)

func main(){
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var s string
	fmt.Fscanf(in, "%s\n", &s)
	b := []byte(s)

	if b[2]==b[3] && b[4] == b[5]{
		fmt.Println("Yes")
	}else{
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long n = Long.parseLong(sc.next());
		
		List <Integer> L = new ArrayList <Integer>();
		final long m = n;
		for(long i = 2 ;i*i<= m;i++) {
			int cnt = 0;
			while(n % i == 0) {
				n = n /i;
				cnt++;
			}
			L.add(cnt);
			if(n == 1) {
				break;
			}
		}
		
		long cnt = n == 1 ? 0 :1;
		for(long num : L) {
			long sum = 0L;
			long id = 0;
			for(long i = 1 ;; i++) {
				sum += i;
				if(sum > num) {
					break;
				}
				id = i;
			}
			cnt += id;
		}
		
		System.out.println(cnt);
		
	}
}


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

using namespace std;

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

char s[1252525];
int main(){
  scanf("%s",s);
  int mx = 0;
  int cj,co,ci;
  cj=co=ci=0;
  int n = strlen(s);
  REP(i,n){
    if(s[i]=='J'){
      if(co>0||ci>0){
        // reset
        if(co<=ci){
          mx=max(mx,co);
        }
        cj=co=ci=0;
      }
      cj++;
    }else if(s[i]=='O'){
      if(ci>0){
        // reset
        if(co<=ci){
          mx=max(mx,co);
        }
        cj=co=ci=0;
      }else{
        co++;
      }
    }else if(s[i]=='I'){
      if(ci==0){
        // minify
        if(cj>=co){
          cj=co;
        }else{
          cj=co=0;
        }
      }
      ci++;
    }
  }
        if(co<=ci){
          mx=max(mx,co);
        }
  printf("%d\n",mx);
}

Measured memory_bytes: 2116
MOD = 10**9+7
N, M = gets.split.map(&:to_i)
if (N-M).abs > 1
  puts 0
  exit(0)
end

def fact(n)
  (1..n).inject(1){|r,i|r*i%MOD}
end

if N==M
  f = fact(N)%MOD
  puts f*f*2%MOD
else
  N, M = M, N if N < M
  f = fact(M)
  puts f*f*N%MOD
end

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

int main(){
  long N,T;
  cin>>N;
  cin>>T;
  long t[N]={},etime=0;
  cin>>t[0];
  etime += T;
  for(int i=1;i<N;i++){
    cin>>t[i];
    if(t[i]- t[i-1]>=T){
      etime += T;
    }else{
      etime += t[i]-t[i-1];
    }
  }
  cout<<etime<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll MOD = 998244353;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    string alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(int i = 0; i < s.size(); i++)
    {
        int pos = s[i] - 'A';
        cout << alpha[pos+n];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a <= b) {
        a = b;
        return true;
    }
    return false;
}


int main(){
    ll n;cin >> n;
    vl x(n),y(n);rep(i,n)cin >> x[i] >> y[i];
    rep(i,n-2){
        if(x[i]==y[i]&&x[i+1]==y[i+1]&&x[i+2]==y[i+2]){
            cout << "Yes" <<endl;return 0;
        }
    }
    cout << "No" <<endl;
}   

Measured memory_bytes: 3600
program main
  implicit none
  integer :: i, n, lb, rw, res
  integer, allocatable :: nb(:)
  logical :: flag = .false.
  character(200000) :: s

  read *, n
  read *, s
  allocate (nb(n))
  nb = 0
  res = n

  do i = 1, n
    if (i >= 2) nb(i) = nb(i-1)
    if (s(i:i) == '#') nb(i) = nb(i) + 1 
  end do

  do i = 1, n-1
    if (s(i:i+1) == '.#') then
      lb = nb(i)
      rw = n-i-1 - (nb(n)-nb(i+1))
      res = min(res, rw+lb) 
    end if
  end do
  if (res==n) res = 0
  rw = verify(trim(s), '#') - 1
  if (verify(trim(s), '.', .true.) == rw) res = min(rw, n-rw)

  print '(i0)', res

end program

Measured memory_bytes: 1548