akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	int t;
	cin>>t;
	REP(roop, t) {
		string s;
		string res = "";
		cin>>s;
		char buf = s[0];
		int cnt = 0;
		REP(i, s.size()) {
			if(s[i] == '0') {
				if(cnt == 0) {
					if(i + 1 < s.size()) buf = s[i + 1];
					continue;
				}
				int num = buf - '0';
				if(num == 1) {
					switch(cnt % 5) {
						case 1: {
							res += ".";
							break;
						}
						case 2: {
							res += ",";
							break;
						}
						case 3: {
							res += "!";
							break;
						}
						case 4: {
							res += "?";
							break;
						}
						case 0: {
							res += " ";
							break;
						}
					}
				} else if(num < 7) {
					res += (char)(('a' + (num - 2) * 3) + ((cnt - 1) % 3));
				} else if(num == 7){
					res += (char)('p' + ((cnt - 1) % 4));
				} else if(num == 8){
					res += (char)('t' + ((cnt - 1) % 3));
				} else {
					res += (char)('w' + ((cnt - 1) % 4));
				}
				if(i + 1 < s.size()) buf = s[i + 1];
				cnt = 0;
			} else {
				++cnt;
			}
		}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 3152
input()
A = [int(i) for i in input().split()]
flag = 1
n = 0
while flag:
    flag = 0
    for j in range(len(A) - 1, 0, -1):
        # print("debug: j = {0}".format(j))
        if A[j] < A[j - 1]:
            A[j], A[j - 1] = A[j - 1], A[j]
            flag = 1
            n += 1
print(" ".join(map(str, A)))
print(n)



Measured memory_bytes: 5604
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

const int mod = 1e9 + 7;
const int mod2 = 998244353;

void fact_init(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll komb(ll a, ll b);

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}

const int N = 4e5 + 5;

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	int h, w, k; cin>>h>>w>>k;
	char g[h][w];
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin>>g[i][j];
		}
	}
	int ans = 0;
	for(int i = 0; i < (1<<h); i++){
		for(int j = 0; j < (1<<w); j++){
			bool sil[h] = {}, sil2[w] = {};
			for(int u = 0; u < h; u++){
				if(i & (1<<u)) sil[u] = true;
			}
			for(int u = 0; u < w; u++){
				if(j & (1<<u)) sil2[u] = true;
			}
			int cnt = 0;
			for(int r = 0; r < h; r++){
				for(int c = 0; c < w; c++){
					//if(sil2[c]) continue;
					if(!sil[r] && !sil2[c] && g[r][c] == '#') cnt++;
				}
			}
			ans += cnt == k;
		}
	}
	cout<<ans<<"\n";
}

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

#define rep(i,b) for(long long i = 0; i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
using ll = long long;

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

void solve() 
{ 
int n;
cin>>n;
string s;
cin>>s;
int ans=0;
rep(i,n){
	
	if(i+1<n&&s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
		ans++;
	}
}
cout<<ans;
}
 

int main(){


		solve();
		cout<<endl;
	

	
					
}
		

	

		

 



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

using namespace std;

int N;
int M;
int x = 0;
int y = 100000;

int main() {
	cin >> N >> M;
	vector<int> l(M);
	vector<int> r(M);
	for (int i = 0; i < M; i++) {
		cin >> l[i] >> r[i];
	}
	for (int j = 0; j < M; j++) {
		if (l[j] >= x)
			x = l[j];
		if(r[j] <= y)
			y = r[j];
	}
	if (y - x + 1 > 0) {
		cout << y - x + 1;
	}
	else
	{
		cout << 0;
	}
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a > b)
			System.out.println("a > b");
		if(a < b)
			System.out.println("a < b");
		if(a == b)
			System.out.println("a == b");
	}
}

Measured memory_bytes: 17156
#include <stdio.h>
#include <algorithm>
#include <limits.h>
using namespace std;

int main()
{
    int n, tmp;
    int min_t = INT_MAX, max_t = INT_MIN;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &tmp);
        if (i > 0) max_t = max(max_t, tmp-min_t);
        min_t = min(min_t, tmp);

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



Measured memory_bytes: 2716
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int point[100001] = {0};

int main()
{
	int N = 0, K = 0, Q = 0;
	int i = 0;
	scanf("%d %d %d", &N, &K, &Q);
	for (i = 0; i < Q; i++) {
		int temp = 0;
		scanf("%d", &temp);
		point[temp-1]++;
	}
	for (i = 0; i < N; i++) {
		if (((K - Q) + point[i]) > 0) {
			printf("Yes\n");
		} else {
			printf("No\n");
		}
	}

    return 0;
}


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;
const int maxn = 2e5 + 10;
ll ans[maxn];
int n, A[maxn];

vector <int> E[maxn], vec[maxn];

int fa[maxn], sz[maxn], bl[maxn], son[maxn], lst[maxn];

void dfs(int u, int f) {
  int x = lst[A[u]];
  fa[u] = f, bl[u] = son[x];
  vec[x].push_back(u), lst[A[u]] = u;
  for (int v : E[u]) if (v != f) {
    son[u] = v, dfs(v, u), sz[u] += sz[v];
  }
  lst[A[u]] = x, sz[u]++;
}

int T, vis[maxn], cnt[maxn];

int main() {
  cin >> n;
  rep(i, 1, n) A[i] = read();
  rep(i, 2, n) {
    int u = read(), v = read();
    E[u].push_back(v), E[v].push_back(u);
  }
  son[0] = 1;
  dfs(1, 0);
  rep(u, 1, n) {
    T++;
    for (int v : vec[u]) {
      if (vis[bl[v]] < T) vis[bl[v]] = T, cnt[bl[v]] = 0;
      cnt[bl[v]] += sz[v];
    }
    for (int v : E[u]) if (v != fa[u]) {
      if (vis[v] != T) {
        ans[A[u]] += 1ll * sz[v] * (sz[v] + 1) / 2;
      }
    }
    for (int v : vec[u]) {
      if (vis[bl[v]] == T) {
        int cur = sz[bl[v]] - cnt[bl[v]];
        ans[A[u]] += 1ll * cur * (cur + 1) / 2;
        vis[bl[v]] = 0;
      }
    }
  }
  memset(cnt, 0, sizeof cnt);
  for (int u : vec[0]) {
    cnt[A[u]] += sz[u];
  }
  rep(i, 1, n) if (A[1] != i) {
    int cur = n - cnt[i];
    ans[i] += 1ll * cur * (cur + 1) / 2;
  }
  rep(i, 1, n) printf("%lld\n", 1ll * n * (n + 1) / 2 - ans[i]);
  return 0;
}

Measured memory_bytes: 48192
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let h: Vec<i32> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let mut dp = vec![0; n];
    dp[1] = (h[1] - h[0]).abs();
    for i in 2..n {
        dp[i] = std::cmp::min(dp[i - 2] + (h[i] - h[i - 2]).abs(), dp[i - 1] + (h[i] - h[i - 1]).abs());
    }
    println!("{}", dp[n - 1]);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int x;
int main(){
	cin>>n;
	n=abs(n);
	for(int i=1;;i++){
		if((1+i)*i/2>=n){
			cout<<i<<endl;
			return 0;
		}
	}
}
//(1+5)*5/2=15

Measured memory_bytes: 256
s = input()
l = int(len(s))
ans = "Yes"

for i in range(int((l - 1) / 2)):
    if s[i] != s[-1 - i]:
        ans = "No"

half = int((l - 1) / 2)
s1 = s[0:half]
s2 = s[half + 1:]

if half % 2 == 0:
    for i in range(int(half / 2)):
        if s1[i] != s1[-1 - i]:
            ans = "No"
        if s2[i] != s2[-1 - i]:
            ans = "No"
else:
    for i in range(int((half - 1) / 2)):
        if s1[i] != s1[-1 - i]:
            ans = "No"
        if s2[i] != s2[-1 - i]:
            ans = "No"

print(ans)

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 Q;
    cin >> Q;

    priority_queue<i64,vector<i64>> l;
    priority_queue<i64,vector<i64>,greater<i64>> r;
    i64 ans=0,base=0;
    rep(i,0,Q){
        i64 q;
        cin >> q;
        if(q==1){
            i64 a,b;
            cin >> a >> b;
            base+=b;
            l.push(a);
            r.push(a);
            if(l.top()<=r.top()) continue;
            else {
                i64 x=l.top(),y=r.top();
                ans+=x-y;
                l.pop();
                r.pop();
                l.push(y);
                r.push(x);
            }
        }else{
            cout << l.top() << " " << ans+base << endl;
        }
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 4588
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		string S = Console.ReadLine();
		
		int[] csumW = new int[N+1];
		int[] csumB = new int[N+1];
		csumW[0] = 0;
		csumB[0] = 0;
		for(int i = 1; i <= N; i++)
		{
			csumW[i] = csumW[i-1];
			csumB[i] = csumB[i-1];
			if(S[i-1] == '.')
				csumW[i]++;
			else
				csumB[i]++;
		}
		
		int ans = Int32.MaxValue;
		for(int i = 0; i <= N; i++)
		{
			// 1 to i : ....
			// i + 1 to N : ####
			int tmp = 0;
			tmp += csumB[i];
			tmp += (csumW[N] - csumW[i]);			
			ans = Math.Min(ans,tmp);		
		}
		
		Console.WriteLine(ans);
	}
}





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

int main() {
  int N,M;
  cin >> N >> M;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  int S = 0;
  for (int i = 0; i < N; i++) {
    S += A.at(i);
  }
  
  int j = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) * 4 * M >= S)
      j++;
  }
  
  if (j >= M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#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;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};
int main() {
	fastIO;
	int test = 1 , j = 1;
	//cin >> test;
	while (test--) {
		double d, t, s;
		cin >> d >> t >> s;
		double res = d / s;
		if (t >= res) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}





Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define MAX_c 200000
int N, K;
vector<int> check;

int main(){
    cin>> N >> K;
    check = vector<int>(N+1, 0);
    int buf;
    for(int i = 0; i< N; i++){
        cin >> buf;
        check.at(buf) += 1;
    }
    sort(check.begin(), check.end(), greater<int>());
    int ans = 0;
    for(int i = 0; i< N+1; i++){
        if(K > 0){
            K--;
        }else{
            ans += check.at(i);
        }
        
    }
    cout << ans << endl;


}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
typedef long long ll;

int main(void){
    ll  P, Q, R;
    
    cin >> P >> Q >> R;
    
    ll min;
    
    min = P + Q;
    
    if(P + R < min){
        min = P +R;
    }
    
    if(Q + R < min){
        min = Q + R;
    }
    
    cout << min << endl;
    
}


Measured memory_bytes: 256
h,w = map(int,input().split())
grid = []
grid.append(["#"]*(w+2))
for i in range(h):
    a = input()
    a = "#" + a + "#"
    a = list(a)
    grid.append(a)
grid.append(["#"]*(w+2))
for i in range(h+2):
    print("".join(grid[i]))


Measured memory_bytes: 38512
def main():
    S = input()
    lc = list(set(list(S)))
    lc.sort()
    # print(lc)
    if lc == ["E", "N", "S", "W"] or lc == ["E", "W"] or lc == ["N", "S"]:
        return "Yes"
    return "No"

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

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

int main(){
    string s;
    cin >> s;
    int acc = 0;
    for (int i=0;i<s.size();i++){
        acc += (int)(s[i]) - '0';
    }
    if (stoi(s) % acc == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

using namespace std;

#define N 120

const int mod=1000000007;
int n,ans,a[N],b[N],c[N],f[N][N][N],g[N];

void upd(int &x,int y){x=(x+y)%mod;}

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n*2-1;++i) scanf("%d",a+i);
	sort(a+1,a+n*2);
	for (int i=n-1;i;--i) g[i]+=a[i]!=a[i+1];
	for (int i=n+1;i<=n*2-1;++i) g[i]+=a[i]!=a[i-1];
	f[0][0][0]=1;
	for (int i=1;i<=n;++i)
		for (int j=0;j<=i*2;++j)
			for (int k=0;k<=i*2;++k){
				upd(f[i][j+g[n-i]][k+g[n+i]],f[i-1][j][k]);
				for (int l=1;l<=j;++l)
					upd(f[i][j+g[n-i]-l][k+g[n+i]+1],f[i-1][j][k]);
				for (int l=1;l<=k;++l)
					upd(f[i][j+g[n-i]+1][k+g[n+i]-l],f[i-1][j][k]);
			}
	for (int i=0;i<=n*2;++i)
		for (int j=0;j<=n*2;++j) upd(ans,f[n][i][j]);
	printf("%d\n",ans);
	
	return 0;
}
			

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  if (n % 2) {
    cout << (n - 1) / 2 << endl;
  } else {
    cout << n / 2 - 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdlib> 
#include <iostream>
using namespace std;
int main()
{
	long n;
	cin>>n;
	long a[n][3],dp[n][3];
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(int i=1;i<n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
	}
	long t=max(dp[n-1][0],dp[n-1][1]);
	t=max(t,dp[n-1][2]);
	cout<<t<<"\n";
	return 0;
}

Measured memory_bytes: 4992
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		char[] c = scanner.next().toCharArray();
		num = new int[n];
		for (int i = 0; i < n; i++)
			num[i] = 1 << "JOI".indexOf(c[i]);
		dp = new int[8][n];
		System.out.println(slove(1, 0));
	}

	private int slove(int x, int day) {
		if (day == n)
			return 1;
		if (dp[x][day] != 0)
			return dp[x][day];
		int ans = 0;
		for (int i = 1; i < 8; i++) {
			if (((x & i) == 0) || (i & num[day]) == 0)
				continue;
			ans += slove(i, day + 1);
			ans %= mod;

		}
		return dp[x][day] = ans % mod;
	}

	int n;
	int[] num;
	int[][] dp;
	int mod = 10007;
}

Measured memory_bytes: 19464
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		long r=0;
		int[] a=new int[n+1];
		Arrays.setAll(a,i->s.nextInt());
		for(int i=0;i<n;++i){
			int b=s.nextInt(),v=Math.min(b,a[i]+a[i+1]);
			r+=v;
			a[i+1]-=Math.max(0,v-a[i]);
		}
		System.out.println(r);
	}
}


Measured memory_bytes: 86208
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i = 0, j = 0;//ループ用配列
	int a[5] = {};
	vector<int> last;
	int flag = 0;
	int ans = 0;

	rep(i, 5) {
		cin >> a[i];
	}
	
	rep(i, 5) {
		if (a[i] % 10 == 0)ans = ans + a[i]; 
		else {
			ans = ans + a[i] - (a[i] % 10);
			last.push_back(a[i] % 10);
			flag++;
		}
	}
	if (flag != 0) {
		sort(last.begin(), last.end());
		ans = ans + ((last.size() - 1) * 10) + last[0];
	}
	cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];

int main(){
    string O, E;
    char Z[110];
    cin >> O >> E;
    int maxt = max(O.size(), E.size());
    rep(i, O.size()){
        cout << O[i];
        if(i < E.size()) cout << E[i];
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  using tsi = tuple<string,int,int>;
  
  vector<tsi> p(N);
  for(int i = 0; i< N; i++){
    string city;
    int score;
    cin >> city >> score;
    p.at(i) = make_tuple(city,-score,i+1);
  }
  sort(p.begin(),p.end());
  
  for(auto el : p){
   cout << get<2>(el) << endl; 
  }
}


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

void fail(){
    cout << "No" << endl;
    exit(0);
}

int main(){
    string S;
    cin >> S;
    int N = S.size();
    for(int i=0; i<N; i++){
        if(i%2 && S[i] == 'R') fail();
        if(i%2==0 && S[i] == 'L') fail();
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_que<int> pque;//これは大きい順
//typedef priority_que<int, vector<int>, greater<int>> pque;//これは小さい順


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

	int flag = 0;
	for(int i=0;i<n;i++){
		if(a[i] %2 == 0 ){
			if(a[i] % 3 == 0 || a[i] % 5 == 0){
				continue;
			}else{
				flag = 1;
			}
		}
	}
	if(flag == 0){
		cout << "APPROVED" << endl;
	}else{
		cout << "DENIED" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanInt2() (int, int) {
	return scanInt(), scanInt()
}
func scanFloat2() (float64, float64) {
	return scanFloat(), scanFloat()
}
func main() {
	sc.Split(bufio.ScanWords)

	N, D := scanInt2()
	var ans int
	for i := 0; i < N; i++ {
		var xy float64
		X, Y := scanFloat2()
		xx, yy := X*X, Y*Y
		var dd float64 = float64(D) * float64(D)
		if dd < xx || dd < yy {
			continue
		}
		xy = math.Sqrt(xx + yy)
		if xy <= float64(D) {
			ans++
		}
	}
	fmt.Println(ans)
}


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

int main(){

int a,b,c,d,e,k;

cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cin >> k;

if ((e-a)<=k){cout << "Yay!" << endl;}

else {cout << ":(" << endl;}

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K; 
cin >> N >> K; 
long long int A[114514]; 
for (int i = 1; i <= N; i++){
cin >> A[i]; 
}
long long int ans = 40000000000000; 
for (int i = 1; i <= N - K + 1; i++){
long long int nagasa = 0; 
if((A[i] * A[K-1 + i])<= 0) {
nagasa = (A[K - 1 +i] - A[i]) + min(abs(A[K - 1 +i]), abs(A[i]));
}
else{
nagasa = max(abs(A[K- 1 +i]), abs(A[i])); 
}
ans = min(ans, nagasa);
}
cout << ans << endl; 
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String X = sc.next();
        if (Character.isUpperCase(X.charAt(0))) {
            System.out.println('A');
        } else {
            System.out.println('a');
        }
        sc.close();
    }
}


Measured memory_bytes: 35480
#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>;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int s = 0;
  rep(i,n) s += a[i];
  int cnt = 0;
  rep(i,n) {
    if (a[i]*(4*m) >= s) cnt++;
  }
  if (cnt >= m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
	int n, y,i,j=0;
	cin >> n >> y;
	for ( i = 0; i * 10000 <= y&&i<=n; i++) {
		for ( j = 0; i * 10000 + j * 5000 + 1000 * (n - i - j) <= y && i + j <= n; j++) {
			if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y) {
				cout << i << " " << j << " " << n - i - j << endl;
				getchar();
				getchar();
				return 0;
			}
		}
	}
	cout << "-1" <<" "<< "-1"<<" " << "-1" << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	MOD := int(math.Pow10(9) + 7)
	var H, W, K int
	fmt.Scan(&H, &W, &K)

	DP := make([][]int, H+1)
	for i := 0; i <= H; i++ {
		DP[i] = make([]int, W)
	}
	DP[0][0] = 1

	for i := 1; i <= H; i++ {
		// jはW-1桁(0~W-2桁目まで)
		for j := 0; j < (1 << (W - 1)); j++ {
			flg := true
			for k := 0; k < (W - 2); k++ {
				if (j&(1<<k))*(j&(1<<(k+1))) > 0 {
					flg = false
					break
				}
			}

			if !flg {
				continue
			}

			for k := 0; k < W; k++ {
				if k == 0 {
					if j&(1<<k) > 0 {
						DP[i][k] += DP[i-1][k+1]
					} else {
						DP[i][k] += DP[i-1][k]
					}
				} else if k == W-1 {
					if j&(1<<(k-1)) > 0 {
						DP[i][k] += DP[i-1][k-1]
					} else {
						DP[i][k] += DP[i-1][k]
					}
				} else {
					if j&(1<<k) > 0 {
						DP[i][k] += DP[i-1][k+1]
					} else if j&(1<<(k-1)) > 0 {
						DP[i][k] += DP[i-1][k-1]
					} else {
						DP[i][k] += DP[i-1][k]
					}
				}
				DP[i][k] %= MOD
			}
		}
	}
	fmt.Println(DP[H][K-1])
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 n, r;
	while(cin >> n >> r && n && r){
		vector<int32> x(n);
		REP(i, n) x[i] = i;
		REP(i, r){
			int32 p, c;
			cin >> p >> c;
			p--;
			vector<int32> nx(n);
			REP(j, n){
				if(x[j] < p) nx[j] = x[j]+c;
				else if(x[j] < p+c) nx[j] = x[j]-p;
				else nx[j] = x[j]; 
			}
			swap(nx, x);
		}
		int32 res = 0;
		REP(i, n) if(x[i] == 0) res = n-i;
		cout << res << endl;
	}
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    ll n,m,k,a,b,c,x,y; string s,t;
    cin >> n;
    cout << n*(n-1)/2;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char str[20], estr[20] = {'\0'};
	int ei = 0;
	scanf("%s", str);
	for (int i = 0; str[i] != '\0'; i++) {
		switch (str[i]) {
		case '0':estr[ei] = '0'; ei++; break;
		case '1':estr[ei] = '1'; ei++; break;
		case 'B':
			if (ei) {
				ei--;
				estr[ei] = '\0';
			}
		}
	}
	printf("%s", estr);
	return 0;
}

Measured memory_bytes: 2152
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n = gets.chomp.to_i
    ds = gets.split.map(&:to_i)

    ans = 0
    0.upto(n-2) do |i|
      (i+1).upto(n-1) do |j|
        ans += ds[i] * ds[j]
      end
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2044
#include <iostream>

using namespace std;

int main() {
    int w, h, n;

    cin >> w >> h >> n;

    int x, y, a;
    int right = w, left = 0, up = h, down = 0;

    for (int i=0; i<n; i++) {
        cin >> x >> y >> a;

        switch (a) {
            case 1:
                left = max(left, x);
                break;

            case 2:
                right = min(right, x);
                break;

            case 3:
                down = max(down, y);
                break;

            case 4:
                up = min(up, y);
                break;
        }
    }

    cout << max(0, right-left) * max(0, up-down) << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
class aoj
{
    static void Main()
    {
        while (true)
        {
            string a = Console.ReadLine();
            if (String.IsNullOrEmpty(a)) break;
            string[] b = a.Split(' ');
            int c = int.Parse(b[0]), d = int.Parse(b[1]), e = int.Parse(b[2]), f = c + d;
            int plus = 0, mainasu = 0; ;
            for (int i = 1; i <= 10; i++)
            {
                if (i != c && i != d && i != e)
                {
                    for (int j = 1; j <= 10; j++)
                    {
                        if (j != c && j != d && j != e && i != j)
                        {
                            if (f + j <= 20)
                                plus++;
                            else
                                mainasu++;
                        }
                    }
                }
            }
            if (plus >= mainasu)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 8912
import fractions
a,b,c,d = (int(i) for i in raw_input().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def get_num(n, c, d):
    num_of_c = n // c
    num_of_d = n // d
    num_of_cd = n // lcm(c,d)
    ret = n - num_of_c - num_of_d + num_of_cd
    return ret

print get_num(b, c, d) - get_num(a - 1, c, d)

Measured memory_bytes: 5032
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
map<int,int>mp;
multiset<string> st;
multiset<string> :: iterator it;

deque <char> q ;
int vis [1000];
int main()
{
   int n,l;
   cin>>n>>l;
   string s;
   while(n--)
   {
       cin>>s;
       st.insert(s);
   }
   string f="";
   for(it=st.begin();it!=st.end();++it)
   {
       f+=(*it);
   }
   cout<<f<<endl;
}






Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod) { a %= _mod; b %= _mod; ll res = 1; switch(op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break; } if (res < 0) res += _mod; return res; }


int main()
{
        map<ll, ll> mp;
        rep(i, 0, 3) {
                ll a, b;
                cin >> a >> b;
                mp[a]++;
                mp[b]++;
        }

        rep(i, 1, 5) {
                if (mp[i] >= 3) {
                        cout << "NO" << endl;
                        return 0;
                }
        }
        cout << "YES" << endl;
}


Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

bool debug = false;
const int NIL = -1;
const int INF = 1000000000;
const int NUM = 100010;
clock_t START, END;

int u[NUM], v[NUM], w[NUM], p[NUM], r[NUM];
int V, E;

int cmp(const int i, const int j) {
	return w[i] < w[j];
}

int find(int x) {
	return p[x] == x ? x : p[x] = find(p[x]);
}

int Kruskal() {
	int ans = 0;
	for (int i = 0; i < V; i++)
		p[i] = i;
	for (int i = 0; i < E; i++)
		r[i] = i;
	sort(r, r + E, cmp);
	for (int i = 0; i < E; i++) {
		int e = r[i];
		int x = find(u[e]);
		int y = find(v[e]);
		if (x != y) {
			ans += w[e];
			p[x] = y;
		}
	}
	return ans;
}

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in29.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int ans;
	cin >> V >> E;
	for (int i = 0; i < E; i++)
		scanf("%d%d%d", &u[i], &v[i], &w[i]);
	ans = Kruskal();
	cout << ans << endl;
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 4768
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
long int a[200000];
int main(void){
    int n,m;
    cin>>n>>m;
    char a[100][100],b[100][100];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
            cin>>b[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int x=0;
            for(int k=0;k<m;k++){
                for(int l=0;l<m;l++){
                    if(b[k][l]==a[i+k][j+l]){
                        x++;
                        if(x==m*m){
                            cout<<"Yes"<<endl;
                            return 0;
                        }
                    }
                }
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
auto scan = []{ static LL a; scanf("%lld", &a); return a;};


LL A[10];
int main() {
  LL n = scan(), ans = 1, tominus = 1;
  for (LL i = 0; i < n; ++i ) {
    ans *= 3;
    tominus *= (scan()%2? 1 : 2);
  }
  printf("%lld\n",ans - tominus);
}


/*
 4
 3
 0 0
 1 1
 1 2
 3
 1 2
 2 4
 4 8
 4
 1 1
 2 2
 3 3
 4 4
 5
 0 0
 2 0
 0 2
 2 2
 1 1
 
 */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int x=0;
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for (int i = 0; i < n; i++){
        if (s[i]=='I'){x+=1;}
        else{x-=1;}
        if(ans<x){ans=x;}
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstring>
#include<stdlib.h>
using namespace std;
#include<algorithm>
long long a[100005];
int main()
{
	int t;
	cin>>t;
	for(int i=0;i<t;i++)
		cin>>a[i];
	sort(a,a+t);
	int sum=0,ac=1;
	for(int i=1;i<t;i++)
	{
		if(a[i]==a[i-1])
			{
				ac++;
				ac=(ac)%2;
			}
		else
			sum+=ac,ac=1;
	}
	if(ac%2)
		sum++;
		cout<<sum;
}

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

int main()
{
    int n,m;cin>>n>>m;
    vector<int>h(n);
    vector<bool>flag(n,true);

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

    for(int i=0;i<m;i++)
    {
        int a,b;cin>>a>>b;a--;b--;

        if(h[a]>=h[b])flag[b]=false;
        if(h[a]<=h[b])flag[a]=false;
    }
    int ans=0;
    for(int i=0;i<n;i++)ans+=flag[i];

    cout<<ans<<endl;
}


Measured memory_bytes: 3736
import java.util.*;

public class Main{
	public static void main(String[] args) {
	
				Scanner sc = new Scanner(System.in);
				// 整数の入力
				int a = sc.nextInt();
				// スペース区切りの整数の入力
				int b = sc.nextInt();
				
				
				int c = 2*b -a;
				// 出力
				System.out.println(c);
	
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<string, int> m;
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i){
    string s;
    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;
  return 0;
}

Measured memory_bytes: 3528
N = int(input())
i = 1 
res =N
flag = True
if N ==1:
  print(0)
else:
  k = int(N**0.5)
  for j in range(1,k+1):
    k = N / j
    b = int(k)
    if k-b == 0:
      res = min(res,j+b-2)
print(res)

Measured memory_bytes: 9344
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);
            var c = int.Parse(_[2]);

            var ans = b / a < c ? b / a : c;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
 
using namespace std;
 
#define EPS 1e-10
#define equal(a,b) (fabs(a-b) < EPS)
#define not_equal(a,b) (!equal(a,b))
#define lt(a,b) (a-b < -EPS)
 
struct Point{
    double x,y;
 
    Point(){}
    Point(double x,double y) : x(x),y(y) {}
 
    Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
    Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
    Point operator * (const double &k)const{ return Point(x*k,y*k); }
    Point operator / (const double &k)const{ return Point(x/k,y/k); }
    bool operator < (const Point &p)const{ return x != p.x ? x < p.x : y < p.y; }
};
 
double dot(const Point &a,const Point &b){ return a.x*b.x+a.y*b.y; }
double cross(const Point &a,const Point &b){ return a.x*b.y - b.x*a.y; }
double norm(const Point &p){ return dot(p,p); }
double abs(const Point &p){ return sqrt(norm(p)); }
 
istream &operator >> (istream &is,Point &p){ 
    return is >> p.x >> p.y;
}
 
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
typedef Point Vector;
 
int ccw(Point p0,Point p1,Point p2){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if(cross(a,b) > EPS) return COUNTER_CLOCKWISE; 
    if(cross(a,b) < -EPS) return CLOCKWISE; 
    if(dot(a,b) < -EPS) return ONLINE_BACK; 
    if(norm(a) < norm(b)) return ONLINE_FRONT; 
    return ON_SEGMENT;
}
 
struct Segment{
    Point s,t;
    Segment(){}
    Segment(Point s,Point t) : s(s),t(t) {}
};
 
Point projection(const Segment &s,const Point &p){
    Vector b = s.t-s.s;
    double t = dot(p-s.s,b)/norm(b);
    return s.s+b*t;
}
 
bool isIntersectSP(const Segment &s,const Point &p){
    return equal(ccw(s.s,s.t,p),0);
}
 
bool isIntersectSS(const Segment &a,const Segment &b){
    Point s[2] = {a.s,a.t}, t[2] = {b.s,b.t};
    return (ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0
	    && ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0);
}
 
double distanceSP(const Segment &s,const Point &p){
    Point r = projection(s,p);
    if(isIntersectSP(s,r)){ return abs(r-p); }
    return min(abs(s.s-p),abs(s.t-p));
}
 
double distanceSS(const Segment a,const Segment b){
    if(isIntersectSS(a,b)) return 0; 
    return min(min(distanceSP(a,b.s),distanceSP(a,b.t)),
	       min(distanceSP(b,a.s),distanceSP(b,a.t)));
}
 
int main(){
    int N1,N2;
    vector<Point> p[2];
    cin >> N1;
    p[0].resize(N1+2);
    p[0][0] = Point(0,0);
    p[0][N1+1] = Point(1000,0);
    for(int i = 1 ; i <= N1 ; i++){
	cin >> p[0][i];
    }
    cin >> N2;
    p[1].resize(N2+2);
    p[1][0] = Point(0,1000);
    p[1][N2+1] = Point(1000,1000);
    for(int i = 1 ; i <= N2 ; i++){
	cin >> p[1][i];
    }
    vector<Segment> s[2];
    for(int i = 1 ; i <= N1+1 ; i++){
	s[0].push_back(Segment(p[0][i-1],p[0][i]));
    }
    for(int i = 1 ; i <= N2+1 ; i++){
	s[1].push_back(Segment(p[1][i-1],p[1][i]));
    }
    double res = (1<<29);
    int l1 = s[0].size(), l2 = s[1].size();
    for(int i = 0 ; i < l1 ; i++){
	for(int j = 0 ; j < l2 ; j++){
	    res = min(res,distanceSS(s[0][i],s[1][j]));
	}
    }
    printf("%.10f\n",res);
    return 0;
}

Measured memory_bytes: 3284
def bubbleSort(cards, N):
    flag = True
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if cards.numbers[j] < cards.numbers[j - 1]:
                cards.swap(j, j-1)
                flag = True
    return cards

def selectionSort(cards,N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if cards.numbers[j] < cards.numbers[minj]:
                minj = j
        if minj != i:
            cards.swap(i, minj)
    return cards

class Cards(object):
    
    def __init__(self, cards):
        self.cards = cards
        self.numbers = [int(card[1]) for card in cards]

    def filter_by_number(self, number):
        return [card for card in self.cards if card.endswith(str(number))]

    def swap(self, i, j):
        self.cards[i], self.cards[j] = self.cards[j], self.cards[i]
        self.numbers = [int(card[1]) for card in self.cards]

    def show(self):
        print(' '.join(self.cards))

    def is_stable(self, cards):
        for n in range(1,10):
            suits_x = self.filter_by_number(str(n))
            suits_y = cards.filter_by_number(str(n))
            if suits_x != suits_y:
                return False
        return True

    def copy(self):
        return Cards([card for card in self.cards])

def run():
    n = int(input())
    cards = Cards(input().split())
    cards_sorted = bubbleSort(cards.copy(),n)
    cards_sorted.show()
    if cards.is_stable(cards_sorted):
        print('Stable')
    else:
        print('Not stable')

    cards_sorted = selectionSort(cards.copy(),n)
    cards_sorted.show()
    if cards.is_stable(cards_sorted):
        print('Stable')
    else:
        print('Not stable')

if __name__ == '__main__':
    run()


Measured memory_bytes: 5616
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int a, b, ret;
  cin >> a >> b;
  if (a >= 13) {
    ret = b;
  } else if (a >= 6) {
    ret = b / 2;
  } else {
    ret = 0;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256